1.

What Are The Blocking And Nonblocking Assignments In Verilog And Which Is Preferred In Sequential Circuits?

Answer»

A blocking ASSIGNMENT is one in which the statements are executed SEQUENTIALLY, i.e. first statement is executed and variable is assigned a value then second is executed and so on. A NON blocking assignment is one in which statements occurs CONCURRENTLY. Only nonblocking assignments should be used in sequential circuit.

e.g

initial
begin
a=b; //blocking
c<=a; //nonblocking
d=c; //blocking
end

In this EXAMPLE firstly the value of b is assigned to a and this value is assigned to c only after execution of first statement. The second and the third statements are executed simultaneously, i.e.

value a is assigned to c and previous value if c is assigned to d.

A blocking assignment is one in which the statements are executed sequentially, i.e. first statement is executed and variable is assigned a value then second is executed and so on. A non blocking assignment is one in which statements occurs concurrently. Only nonblocking assignments should be used in sequential circuit.

e.g

initial
begin
a=b; //blocking
c<=a; //nonblocking
d=c; //blocking
end

In this example firstly the value of b is assigned to a and this value is assigned to c only after execution of first statement. The second and the third statements are executed simultaneously, i.e.

value a is assigned to c and previous value if c is assigned to d.



Discussion

No Comment Found