Consider the following interaction between continuous assignment, an acti…
Consider the following interaction between continuous assignment, an active process, and $strobe scheduled at simulation time step t = 10 ns : reg clk, d; wire q_cont; reg q_seq; assign #0 q_cont = d; always @(posedge clk) begin q_seq <= d; $display("Display: q_seq=%b, q_cont=%b", q_seq, q_cont); $strobe ("Strobe : q_seq=%b, q_cont=%b", q_seq, q_cont); end initial begin clk = 0; d = 0; q_seq = 0; #10 d = 1; clk = 1; end According to the IEEE 1364 Verilog Stratified Event Queue standard, what are the exact lines printed to the console, and in which event regions do q_cont and q_seq complete their updates?
- Display: q_seq=0, q_cont=0 (or non-deterministic q_cont=1 ) Strobe : q_seq=1, q_cont=1 q_cont updates in the Inactive region ( #0 ); q_seq updates in the Non-Blocking Assignment (NBA) update region.
- Display: q_seq=1, q_cont=1 Strobe : q_seq=1, q_cont=1 Both q_cont and q_seq update simultaneously in the Active region.
- Display: q_seq=0, q_cont=1 Strobe : q_seq=0, q_cont=1 q_cont updates in the Active region; q_seq updates in the Postponed region.
- Display: q_seq=1, q_cont=0 Strobe : q_seq=1, q_cont=0 q_cont updates in the NBA region; q_seq updates in the Inactive region.
Correct answer
A. Display: q_seq=0, q_cont=0 (or non-deterministic q_cont=1 ) Strobe : q_seq=1, q_cont=1 q_cont updates in the Inactive region ( #0 ); q_seq updates in the Non-Blocking Assignment (NBA) update region.
Explanation
1. **Event Region Flow:** * **Active Region:** Statements in initial execute ( d = 1 , clk = 1 ). The rising edge triggers the always block. In the Active region, $display executes immediately. At this instant, q_seq has not yet taken its new value, so q_seq is 0 . * ** assign #0 Scheduling:** An explicit #0 delay forces the evaluation/update of q_cont into the **Inactive Region**. Depending on simulator implementation, if the continuous assignment was triggered in Active and pushed to Inactive, $display (running in Active) reads q_cont as 0 (or non-deterministically 1 if the #0 process resumes between active iterations). * **NBA Region:** The assignment q_seq <= d updates in the **NBA Region**, changing q_seq from 0 to 1 . * **Postponed Region:** $strobe prints in the **Postponed Region** (at the very tail end of the time step after all Active, Inactive, and NBA events have settled). At this point, both q_seq and q_cont are definitively 1 .