Hello, All, I have a kind of a beginner question.
I've implemented several FPGA small projects, but I still don't understand the semantics and the resulting implementations of a blocking assignment.
I.e. I always used the non-blocking assignments in the clocked always blocks, and used the binary logic wire variables, inline logic and if statements inside the always blocks to implement the combinatorial logic.
For example:
wire pixelStrobe = (columnFrequencyDivider == 8'd0);
...
always @(posedge clock)
begin
if (hSyncTrigger)
pixelCounter <= 10'd0;
else if (pixelStrobe)
pixelCounter <= pixelCounter + 10'd1;
end
That approach pretty much satisfied all my hardware that I needed to implement, and I never understood the need for a blocking assignment. The non-blocking assignment gives a clear definition that what is the right side will be assigned after the execution and will be visible in the register in the next clock edge.
Yet I see bunch of examples where people use the blocking assignments inside the always(something) block, and I don't understand what hardware it generates.
For example, if you have regs reg1, reg2, reg3, reg4 then what hardware will this code generate?
always @(posedge clock)
begin
reg1 = 1;
reg2 = reg1;
reg3 = reg2 | reg4 | reg3;
end
Will it force to use some kind of special flip-flops that open up and propagate values straight though the flip-flop while the clock is positive? I know there flip-flop types like in 74xx logic. But that would contradict the posedge statement.