Swap (continued)
The following does not work either
- one of the blocks is executed first
- previous value of variable is lost
Use delayed assignment to fix this
- both blocks are scheduled by posedge CLK
always @(posedge CLK) begin A = B; end
always @(posedge CLK) begin B = A; end
always @(posedge CLK) begin A <= B; end
always @(posedge CLK) begin B <= A; end