What is #0 in Verilog and how is it used?
What is #0 in Verilog and how is it used?
Model answer
#0 is a zero-delay control. The statement is moved from the Active region to the **Inactive** region of the *same* time step, so it executes after the other Active-region statements. It is sometimes used to force an order between two processes that write the same variable at the same time. Without #0 the final value (2 or 3) is non-deterministic. Using #0 is **bad practice** (it hides a race instead of removing it); fix the design so only one process drives the variable.