Skip to content

VLSIFacts

Let's Program the Transistors

  • Home
  • DHD
    • Digital Electronics
    • Fault Tolerant System Design
    • TLM
    • Verification
    • Verilog
    • VHDL
    • Xilinx
  • Embedded System
    • 8085 uP
    • 8086 uP
    • 8051 uC
  • VLSI Technology
    • Analog Electronics
    • Memory Devices
    • VLSI Circuits
  • Interview
    • Interview Experience
    • Training Experience
    • Question Bank
  • Notifications
  • QUIZ
  • Community
  • Job Board
  • Contact Us

Synthesis and Functioning of Blocking and Non-Blocking Assignments.

Posted on March 20, 2016June 17, 2025 By Priyadarshi No Comments on Synthesis and Functioning of Blocking and Non-Blocking Assignments.

Here are some examples on blocking and non-blocking assignments in Verilog, that can be really useful for the budding design Engineers. First let us discuss the features of these assignments.

  1. They are procedural assignments always used in a procedural block like initial or always.
  2. In BA (Blocking assignment) RHS of the assignment is assigned immediately to the LHS in the active region of the scheduler, that is to understand we can say the assignment is immediate and it does not wait for the procedural block to end. While in NBA (Non-Blocking Assignments) the RHS is calculated first, then it is assigned to the LHS much later in the scheduler, that is to understand after the completion of procedural block (initial or always). Other wise we can say that they get executed in the NBA part of the scheduler which is second last in the sequence after Active and Inactive. .
  3. In BA, assignments are done in the sequence in which they are written, In NBA all the RHS are calculated and stored in the temporary memory of the compiler and then are assigned to the LHS, at the same time, that is there is no set order of assigning, it depends on the compiler.

The following example illustrates the Blocking Assignment

initial
begin
   a=1;
   b=0;
   y=1; // at 0 simulation time y gets value 1;.
   #5 y=a&b; // at 5 time units y gets updated to a&b, i.e. 1&0=0
   z=y; // at 5 time units z gets updated to y value, i.e. 0
   #5 temp=a; // temp gets the value of a, i.e. 1 at 10 time units
end
BA

Wave forms for the above example
The following example illustrates the Non-Blocking Assignment

initial
begin
   a=1;// Use of blocking assignments to initialize
       // Blocking and non-blocking assignments can not be used together in a single
       // procedural block from the synthesis point of view.
       // It is used here for initializing purpose.
   b=0;
   y=1; // At 0 simulation time y gets 1.
   y=#5 a&b; // at 5 time units y gets updated
   z=y; // z has only X as value it does not get updated as reg initializes
        // to X and it does take the previous value of y which is X not 1 as y has a NBA on it.
   #5 temp=a; // temp gets the value at 5 time units executes at 5 only as above delay is propagation delay
 // with NBA.
end
NBA

Wave forms for the above example

Example (a) Synthesis view of four bit shift reg.

module shiftreg_4bit(dout,clk,rst,din);
 input clk,rst,din;
 output reg dout;
 reg a,b,c;
 always @ (posedge clk or posedge rst)
  begin
     if (rst)
     begin
        dout=0;
        a=0;
        b=0;
        c=0;
     end
     else
     begin
        a=din;  // Non-Blocking assignments here will hold the previous value and assign on the clock edge,
        b=a;   // implementing four registers as in conventional shift register.
        c=b;
        dout=c;
     end
  end
endmodule
4bit_shftreg

but if changed into Blocking Assignments.

 begin
  a=din;
  b=a;
  c=b; // Now blocking assignments will immediately update their values and will collapse into a wire
  dout=c; //resulting in a single flip flop.
 end
collapse_sr

Example (b) Example for scheduling.

module clk_ba_nba();
reg clk;
initial
 clk=1;
always @ (clk)
 #5 clk=~clk; // NBA on clk update after the event, accounted as a change for always block, clock toggles
endmodule
clock_toggle

but if changed assignments to Blocking Assignments

module clk_ba_nba();
reg clk;
initial
 clk=1;
always @ (clk)
 #5 clk=~clk; // Clk gets updated in the active region, change not accounted, clock does not toggle.
endmodule
clk_not_tgle

P.S Whenever you want to implement a fast event independent circuit like combinational circuits where the present value gets updated immediately, Use blocking assignments and whenever there are assignments that to be made together after an event use non-blocking assignment, usually in sequential circuits.

Spread the Word

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print

Like this:

Like Loading...

Related posts:

  1. Case and Conditional Statements Synthesis CAUTION !!!
  2. Synopsys – Interview Questions – based on Synthesis and Simulation
  3. Power Analysis in XILINX Xpower Analyzer
  4. Different Coding Styles of Verilog Language
DHD, Digital Electronics, Uncategorized, Verilog, VLSI Circuits, Xilinx Tags:Blocking assignments, Non-Blocking assignments, Scheduling, Synthesis, Verilog

Post navigation

Previous Post: Interview Experience – Si2Chip – Memory Design
Next Post: PMOS is no longer the Culprit

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Top Posts & Pages

  • ASCII Code
  • Circuit Design of a 4-bit Binary Counter Using D Flip-flops
  • NAND and NOR gate using CMOS Technology
  • Truth Tables, Characteristic Equations and Excitation Tables of Different Flipflops
  • AND and OR gate using CMOS Technology

Copyright © 2025 VLSIFacts.

Powered by PressBook WordPress theme

Subscribe to Our Newsletter

%d