⟩ What are the blocking and nonblocking assignments in Verilog and which is preferred in Sequential circuits?
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.