a = #5 b;
#5 a = b;
Is there any difference between above 2 开发者_运维技巧statements?
The #
on the RHS is known as an intra-assignment delay. Read about the distinction in the IEEE Std (1800-2009), section 9.4.5 "Intra-assignment timing controls".
An intra-assignment delay or event control shall delay the assignment of the new value to the left-hand side, but the right-hand expression shall be evaluated before the delay, instead of after the delay.
Run a simulation with both statements to see what difference (if any) you observe. Use $monitor
and $time
.
To be precise that second statement doesn't specify a timing delay on the LHS of the blocking assignment. It is prefixed by a procedural_timing_control construct which can used before any type of procedural statement, not just assignment statements.
精彩评论