I'm wondering why the first assignment for a clock signal in VHDL does not work like the second. I'd appreciate any explanations about the simulation behavior of assign statement with delay. Thanks.

First version: (just produces spikes 50 ns apart)

clk <= '0', (not clk) after 50 ns;

Second version: (produces a square wave of time period 100 ns as expected)

signal clk : std_logic:='0';
 clk <= not clk after 50 ns;

1 Answer 1


By omitting the "after" clause from the first assignment in your sequence of assignments (known as a waveform), you are implicitly implying "after 1 delta cycle". Delta cycles are the key to how the VHDL simulation is performed. A delta cycle can be thought of as an infinitesimally small delay, but in reality that is a gross simplification. So in your case this infinitesimally small delay is why you don't see the positive duration of the clock cycle last for very long, although this behaviour will vary slightly with different simulators.

I would suggest that you do some further reading on delta cycles and follow it up with reading your simulator's manual to understand their implementation.


A concurrent statement is evaluated every time a signal on the right hand side changed. It may help to think about concurrent statements such as these in their equivalent process form. A concurrent statement is equivalent to a process that is sensitive to the signals it references on the right hand side of the statement. If there are no referenced signals then it is equivalent to a process with an empty sensitivity list and a final wait statement.

The "clk <= '0', not clk after 50ns" example is evaluated every time clk changed, clk will be scheduled with '0' after one delta cycle and "not clk" (ie '1') after 50ns. At 50ns clk has changed and so the statement is evaluated again, at which point clk is scheduled with '0' after one delta cycle and "not clk" 50ns later. Therefore the duration between when clk is '1' and '0' is one delta cycle.

The "clk <= '0', '1' after 50ns" example is only evaluated once because there are no signals on the right hand side for it be sensitive to. Therefore clk is scheduled with '0' after one delta cycle and '1' after 50ns at which point no further changes are scheduled.

  • \$\begingroup\$ I understand delta cycles, and know the basic event driven simulation algorithm. This doesn't answer my question. Are you saying the first statement's driver is invoked as soon as a '1' is assigned and assigns a '0' after delta delay? This doesnt make sense, as a statement such as clk <= '0', '1' after 50 ns; works fine. (The '0' is not assigned again) \$\endgroup\$ May 6, 2013 at 6:00
  • \$\begingroup\$ That is exactly what I am saying. I have updated my answer for further clarification. \$\endgroup\$
    – Amoch
    May 6, 2013 at 22:57
  • \$\begingroup\$ your edit clarifies it. Thanks for the explanation, this is exactly what I was looking for. \$\endgroup\$ May 8, 2013 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.