The $display()
messages are being printed at time @2
. The simulator scheduler executes the $display()
messages when the lines are reached. The $monitor()
message is only printed at the end of the time step. Therefore, within the same time step, $display()
messages will be printed before the $monitor()
message. Add $time
to the $display
messages to help visualize this.
The final Reset is asserted, no iff
is not part of time 2, but time 3. When the clock has a rising.
@3 clk 1 rst 1 enable x d 0 q 0 latch x
The "with iff" message is not displayed because iff rst == 0
masks the posedge clk
from being observed when rst !=0
. The posedge clk
can only be observed when iff
condition is true.
Do note that iff
is not synthesizable, so do not put it in a design. The feature is for verification and behavioral modeling.