Self-Triggered always block:
Case-1: always with BA
Assume the initial value of clock is 0.
always@(clock) begin
#5 clock =~ clock;
end
Here the assignment is blocking i.e., active event. so, it is executed in current tick i.e., after 5 time units clock becomes 1 ans simulator comes out of the loop and watching event to be triggered but it will never happens because the change occurred when the simulator is with in the always block. so, always block executed only once. It is non self triggered always block.
Case-2: always with NBA
Assume the initial value of clock is 0.
always@(clock) begin
#5 clock <=~ clock;
end
Here the assignment is non blocking i.e., NBA event. so, the evaluation of R.H.S happens in current tick and assignment happens at the end of tick i.e., clock value is evaluated as 1 and the simulator comes out of always block and watching sensitivity list. At the end of tick 1 is assigned to clock. Here simulator sees the change of sensitivity list so always block executed continuously till the end of simulation. It is self triggered always block. It can be used for clock generation in verification.
No comments:
Post a Comment