- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
it was very difficult to find a proper thread title. I hope somebody felt addressed by it . . . I have an old project I have to maintain. Some of the code is in AHDL that I try ti understand. The code instantiates a dff called valid_signal. Also there is a state machine which is checking certain other signals. If everything is fine then the code in states 13 to 15 is as follows:
WHEN s13 => IF !in.q THEN
valid_signal.d = VCC;
rx_sm = s14;
END IF;
rx_sm = s0;
WHEN s14 => valid_signal.d = VCC;
rx_sm = s15;
WHEN s15 => valid_signal.d = VCC;
rx_sm = s0;
The question is how and when this VCC will be removed from the input of the valid_signal dff. I mean in my code there is no line like this: valid_signal.d = GND. To me it looks like that once the VCC is applied to the dff it will stay there forever because no other signal value is applied. Is there something like an unspoken rule that if nothing is applied to the dff in AHDL then the state of the input is GND or '0'? If so then this would mean that at state s0 where nothing is applied to the input of valid_signal it will be GND? Please help me with this as it is very hard to find proper documentation about AHDL these days. Thanks, Maik
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't quite remember the syntax but is there something like valid_signal.r = VCC which would be a reset for the dff?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ben,
no, there is no reset input on this dff . . . only 'd', 'q' and 'CLK'. Thanks, Maik- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IIRC, in AHDL, anything not written explicitly will have an implicit assignment. registers never hold their value unless explicitly written in the code. It can be a real pain when trying to understand whats going on.
So, any state where valid_signal.d is not set will actually be set to ground. To hold on to a previous state you have to actually set: valid_signal.d = valid_signal.q; This holds true for DFFE when enables are not set either, so they get implicity set to GND.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tricky,
thanks for the answer! You confirmed my guesses. Now, I can better understand what is going on in that code! Maik
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page