Consider the following Verilog snippet:
module mod1 ( input clk, input [1:0] a, input [1:0] b, output reg [3:0] c);
always @ ( posedge clk)
begin
c <= {c, &a, |b};
c[0] <= ^c[3:2];
end
endmodule
In my textbook it says
A group of blocking assignments are evaluated in the order they appear in the code, whilst a group of nonblocking assignments are evaluated concurrently, before any of the statements on the left hand sides are updated.
So what does that mean here? Suppose c = 1100
, a = 11
and b = 01
at the beginning.
The first statement will read as c = 0011
and the second as c[0] = 0
because the c
in the second statement is 1100
since the assignments only take effect after the clock cycle if I understood the textbook correctly. But what is c
in the end? Is it 1100
because of the last statement, or is it 0010
? Please also explain why.