BLOCKING VS NONBLOCKING

BLOCKING VS NONBLOCKING

In the context of digital hardware description languages (HDLs) like Verilog and VHDL, blocking and non-blocking statements are used to describe how concurrent assignments are executed within a block of code.

  1. Blocking Statements:In a blocking assignment, the execution of the next statement is delayed until the current assignment is completed. The assignment is performed in a sequential manner, meaning that the right-hand side (RHS) is evaluated and assigned to the left-hand side (LHS) before moving on to the next statement.
  2. Blocking assignments are denoted by the "=" symbol in Verilog.Example in Verilog:always @(posedge clk) a = b; // Blocking assignmentIn this example, the value of b is assigned to a on the rising edge of the clock, and the next statement will not be executed until this assignment is completed.
  3. Non-Blocking Statements:In a non-blocking assignment, the RHS is evaluated and assigned to the LHS without waiting for the assignment to complete. The next statement is executed immediately.
  4. Non-blocking assignments are denoted by the "<=" symbol in Verilog.Example in Verilog:always @(posedge clk) a <= b; // Non-blocking assignmentIn this example, the value of b is assigned to a on the rising edge of the clock, but the execution immediately moves on to the next statement without waiting for the assignment to complete. This allows for concurrent execution of assignments.

Why use Non-Blocking Assignments:

  • Non-blocking assignments are often used in scenarios where concurrent behavior is desired, such as modeling flip-flops and other sequential logic elements.
  • They are commonly used in clocked always blocks to model registers in hardware designs.

Why use Blocking Assignments:

  • Blocking assignments are typically used when sequential behavior is desired, such as in procedural blocks where you want each statement to complete before moving on to the next one.

In summary, the choice between blocking and non-blocking assignments depends on the intended behavior of the code and whether concurrent or sequential execution is desired in a particular context within a hardware description language.

要查看或添加评论,请登录

Manohar S的更多文章

  • ARITHMETIC CIRCUITS - III

    ARITHMETIC CIRCUITS - III

    Advantages of Half Adder and Half Subtractor Simplicity: The half adder and half subtractor circuits are simple and…

  • ARITHMETIC CIRCUITS - II

    ARITHMETIC CIRCUITS - II

    Full Adder is the adder that adds three inputs and produces two outputs. The first two inputs are A and B and the third…

  • ARTHIMETIC CIRCUITS - I

    ARTHIMETIC CIRCUITS - I

    Half adder is the simplest of all adder circuits. Half adder is a combinational arithmetic circuit that adds two…

  • TWO LEVEL LOGIC REALIZATION

    TWO LEVEL LOGIC REALIZATION

    Two-level logic realization refers to the implementation of digital logic functions using a combination of two levels…

  • K-MAPS in DIGITAL

    K-MAPS in DIGITAL

    Karnaugh maps, often abbreviated as K-maps, are a graphical method used to simplify boolean algebra expressions. They…

  • ERROR DETECTION & CORRECTION

    ERROR DETECTION & CORRECTION

    Error detection codes in digital communication are techniques used to identify errors or corruption that may occur…

  • DIGITAL CODES

    DIGITAL CODES

    Digital codes are sequences of symbols used to represent information in digital form. These codes are essential in…

  • FLIPFLOP VS LATCH

    FLIPFLOP VS LATCH

    Latch and flip-flop are two fundamental digital circuit elements used in digital electronics to store and synchronize…

  • Have a look on the clock buffers in FPGA.

    Have a look on the clock buffers in FPGA.

    Clock buffers play a crucial role in FPGA (Field-Programmable Gate Array) designs by ensuring the proper distribution…

  • Different types of CLOCKS in FPGA

    Different types of CLOCKS in FPGA

    FPGAs (Field-Programmable Gate Arrays) are versatile devices that can be used to implement various types of clocks to…

社区洞察

其他会员也浏览了