Stratified event queues:
Stratified event queue model will help us how the various statements like blocking, non blocking, $display,...etc inside module gets executed.
According to the Verilog IEEE standard, the Verilog event queue is logically segmented into four different regions as shown below.
1) Active events:
Active events include continuous assignments, blocking assignments, evaluation of R.H.S of non blocking assignments, $display statements, evaluation of inputs and updation of outputs of primitive gates and other module instances. The above events can be executed in current simulation time in any order.
2) In active events:
After completing execution of active events, inactive events are processed. Here #0 (zero delay statements ) are scheduled.
3) NBA:
Assignment of evaluated things of R.H.S in active region to L.H.S happens after processing active and inactive events. After assigning a value to a variable that may or may not triggers the other always block. If it triggers then that always block is executed in current simulation time only that's why simulator will go to active after NBA.
4)Monitoring:
After NBA if no always block triggers then monitoring events are evaluated. $strobe, $monitor are monitoring events. if simulator loops from NBA to active 100 times and each loop contains one monitoring statement then 100 monitoring statements are stored in a queue, when the simulator comes out of the loop then all 100 monitoring statements are evaluated.
Example:
always@(x,y) begin
z = x | y;
a <= z;
end
always@(a) begin
w = a;
end
Here if x or y changes then first blocking assignment i.e., z is updated and that is evaluated value on R.H.S of NBA. At the end of tick z is assigned to a that indirectly triggers the other always block. Blocking assignment executed and then simulator advances the time i.e., next time tick.
No comments:
Post a Comment