Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

AHDL - VCC to dff.d

Altera_Forum
Honored Contributor II
1,281 Views

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
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
516 Views

I can't quite remember the syntax but is there something like valid_signal.r = VCC which would be a reset for the dff?

0 Kudos
Altera_Forum
Honored Contributor II
516 Views

Hi Ben, 

 

no, there is no reset input on this dff . . . only 'd', 'q' and 'CLK'. 

 

Thanks, 

Maik
0 Kudos
Altera_Forum
Honored Contributor II
516 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
516 Views

Hi Tricky, 

 

thanks for the answer! 

 

You confirmed my guesses. Now, I can better understand what is going on in that code! 

 

Maik
0 Kudos
Reply