non-blocking assignment

A

andersod2

Guest
According to the verilog article on wikipedia, when a non-blocking
assignment is used, the action doesn't take place until the next clock
cycle (I'm guessing this applies to when the clock is in the
sensitivity list). I'm not sure I understand why this is the case, as
well as, why this is not the case for blocking assignment. In other
words, why is it not just a matter of how the gates are arranged in
blocking vs non-blocking, and why would the clock have anything to do
with that?

TIA-
 
andersod2 <thechrisanderson@gmail.com> wrote:

According to the verilog article on wikipedia, when a non-blocking
assignment is used, the action doesn't take place until the next clock
cycle (I'm guessing this applies to when the clock is in the
sensitivity list). I'm not sure I understand why this is the case, as
well as, why this is not the case for blocking assignment.
The description works for the specific example, though not in general.

As well as I know it, the assignment happens after all non-blocking
assignment have been processed. In the case of a simulator, it
goes through all the non-blocking assignments where the right hand
side has changed, and evaluates those as the future value.
When there is nothing else to do, then all the assignments are made
and the process begins again.

In the case of assignments in an always @negedge or @posedge
block, then it seems right that it waits until the next clock cycle.

Before non-blocking assignment, #1 was used to delay the assignment
for 1 time unit. For synthesis, and for simulation with a sufficiently
long clock period, that should have the appropriate result.

In other
words, why is it not just a matter of how the gates are arranged in
blocking vs non-blocking, and why would the clock have anything to do
with that?
The specific example is inside an @posedge clock block.

Otherwise, I tend to write the assignment in the opposite order
such that variables are used (in a serial language sense) before
they are changed. Even if you know about non-blocking it
makes it easier to read. (If you are used to serial languages.)

-- glen
 

Welcome to EDABoard.com

Sponsor

Back
Top