Refer to this question,I write a similar case.
module n; reg [1:0]a, b; initial begin a=1; a<=a+1; $strobe("strobe",a); $display("display",a); end endmodule The output is:
display 1 strobe 2 Refer to @toolic answer of refered question,
Then, still at time=0, you increment a by 1 with a<=a+1. This means a becomes 2 at time=0.
I have 2 questions:
1.As a become 2 at time 0,why $strobe and $display output different result for the same target?
2.In the begin end block,why $display output advance than $strobe?
a=1is done right away. Statementa<=a+1is done on the 'next clock' (time step for pedantic simulation cases). If you place '$strobe()' before thea=1, you will see it (via strobe).#1;before the$display()you will see the '2' value. These are tricky simulation details and (some are) not really useful in practice.