I have 3 questions based on this small piece of code:
- Where does forever @event sit in event region in SV? Before NBA or after NBA?
- Why the $monitor in interface never get print?
- Why the last posedge a is not detected by $monitor and forever?
interface bus();
logic a;
initial $monitor($time,,a);
initial forever @(posedge a) $display("IF",, $time,, "Detect a posedge");
endinterface // bus
module tb;
bus busA();
initial begin
busA.a <= 0;
#1 busA.a <= 1;
#1 busA.a <= 0;
#1 busA.a <= 1;
#10 busA.a <= 0;
#20 busA.a <= 1;
#0 $finish;
end
initial $monitor("TB",, $time,, busA.a);
endmodule
The output is like this:
TB 0 0
IF 1 Detect a posedge
TB 1 1
TB 2 0
IF 3 Detect a posedge
TB 3 1
TB 13 0
Simulation complete via $finish(1) at time 33 NS + 1