Verilog Procedural Blocks
Blocking vs Non-Blocking assignments, Always vs Initial blocks.
Beginner Level
Blocking `=` vs Non-Blocking `<=`. When to use which?
Blocking (=): Executes sequentially. Use for Comb Logic.
Non-Blocking (<=): Assignments happen in parallel (scheduled for end of time step). Use for Sequential Logic (Flip-Flops).
Can you mix blocking and non-blocking in the same always block?
No. It leads to unpredictable behavior and race conditions. Synthesis tools will warn you.
Intermediate Level
Swap two variables using blocking and non-blocking assignments.
Blocking: temp = a; a = b; b = temp; Non-Blocking: a <= b; b <= a; // No temp needed!
What triggers an `always @(*)` block?
It is triggered whenever any signal on the Right Hand Side (RHS) of assignments or in conditions changes. It is preferred for combinational logic to avoid incomplete sensitivity list latches.