Blocking vs Non-blocking questions (verilog)

OP (Company: Raytheon) #4541911
Rate this post
• ▲ useful
▼ not useful
1. I can't remember learning this specifically but for some reason I 
think you are not supposed to use blocking in sequential blocks? If so 
why is this?

2. I was taught that if blocking is used, but would still be 
functionally the same as non blocking, it synthesizes the same as non 
blocking, i.e a single = statement within an always block. I answered 
this way in an interview once and was told I was wrong, that they do 
synthesize differently. So, which is it? How does synthesis handle 
blocking vs non-blocking?
#4551974
Rate this post
• ▲ useful
▼ not useful
Trevor H. wrote:
> 1.

This rule applies to variables driven and read by different processes.

The core of the issue is in Verilog's scheduling semantics (cf. 
IEEE1800-2012, sec. 4.4 “Stratified event scheduler”). Blocking 
assignments take place in the Active region, that is as soon as the 
corresponding statements are executed. Non-blocking assignments will be 
scheduled into the NBA region, that is after all statements have 
executed.¹

IOW, the non-blocking assignment ensures that all processes that are 
looking at a variable will see the value it had before any changes in 
the current time step. Much like a VHDL signal (but not quite the same).

> 2.

As far as a single assignment statement is concerned, I'd say this is 
true. But if there is an assignment before reading back the variable, 
blocking vs non-blocking does synthesize differently.

Footnotes:
¹ Simplified. There are loopholes. Verilog gives you enough rope to hang 
yourself.

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.