Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3693114
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:20:23+00:00 2026-05-19T04:20:23+00:00

I am a little confused about how blocking and non blocking assignments are interpreted

  • 0

I am a little confused about how blocking and non blocking assignments are interpreted when it comes to drawing a hardware diagram. Do we have to infer that a non blocking assignment gives us a register? Then according to this statement c <= a+b , c would be a register right, but not a and b?

module add (input logic clock,  
output logic[7:0] f);   

logic[7:0] a, b, c;  

always_ff @(posedge clock)  
begin   
  a = b + c;   
  b = c + a;   
  c <= a + b;  
end   

assign f = c;  

endmodule
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:20:23+00:00Added an answer on May 19, 2026 at 4:20 am

    It’s definitely a bit tricky to get your head around the differences between blocking and nonblocking assignments initially. But no fear – there’s a handy rule of thumb:

    If you want to infer combo logic with an always block, use blocking assignments (=). If you want sequential logic, use a clocked always block with nonblocking assignments (<=). And try not to mix the two.

    Your code above is probably not the best example. Without knowing what adder/flipflop structure you were trying to build, there’s the danger of having combo feedback paths (which are bad). And since you’ve no input buses, you’re essentially trying to construct a, b & c out of thin air!

    But to answer your question, any variable assigned to within a clocked always block will infer a flipflop, unless its assigned using the blocking operator (=) and used as a kind of a local variable.

    module add
      (
       input clock,
       input [7:0] in1,
       input [7:0] in2,
       output logic [7:0] f1, f2, f3, f4, f5
       );   
    
    
       // f1 will be a flipflop
       always_ff @(posedge clock) begin
          f1 = in1 + in2;
       end
    
    
       // f2 will be a flipflop
       always_ff @(posedge clock) begin
          f2 <= in1 + in2;
       end
    
    
       // f3 will be a flipflop
       // c1 will be a flipflop
       logic [7:0] c1;
       always_ff @(posedge clock) begin
          c1 <= in1 + in2;
          f3 <= c1 + in1;
       end
    
    
       // f4 will be a flipflop
       // c2 is used only within the always block and so is treated
       // as a tmp variable and won't be inferred as a flipflop
       logic [7:0] c2;
       always_ff @(posedge clock) begin
          c2 = in1 + in2;
          f4 = c2 + in1;
       end
    
    
       // c3 will be a flipflop, as it's used outside the always block
       logic [7:0] c3;
       always_ff @(posedge clock) begin
          c3 = in1 + in2;
       end
    
       assign f5 = c3 + in1;
    
    endmodule
    

    A big reason for following the rule of thumb and not mixing blocking and nonblocking assignments within an always block, is that mixing your assignments can cause serious simulation mismatches between RTL sims and gate-sims/real hardware operation. The verilog simulator treats = and <= quite differently. Blocking assignments mean ‘assign the value to the variable right away this instant’. Nonblocking assignments mean ‘figure out what to assign to this variable, and store it away to assign at some future time’. A good paper to read to understand this better is: Also see: http://www.sunburst-design.com/papers/CummingsSNUG2000SJ_NBA.pdf

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a little confused about the Swing painting model. Suppose that I have a
I am little confused about setting events in .NET. I have methods that is
I am a little confused about the HttpApplication events. I have a SessionService* that
I'm a little confused about how the standard library will behave now that Python
I am a little confused about object assignment and pointers in Ruby, and coded
I am a little confused about the auto-increment id field in rails. I have
I'm a little confused about how to do something that I thought would be
I'm a little confused about how EGit workes. I have an existing git repository
I'm a little confused about how C++ handles includes. I have something like: typedef
I'm a little confused about the Honeycomb hardware acceleration. The documentation says to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.