Blocking and non-blocking assignments
always @(posedge CLK) begin temp = B; B = A; A = temp; end
always @(posedge CLK) begin A <= B; B <= A; end
Blocking assignments (Q = A)
- Variable is assigned immediately
- New value is used by subsequent statements
Non-blocking assignments (Q <= A)
- Variable is assigned after all scheduled statements are executed
- Value to be assigned is computed but saved for later
- Usual use: Register assignment
- Registers simultaneously take new values after the clock edge