Blocking and Non-blocking assignment ? 
Author Message
 Blocking and Non-blocking assignment ?

Hello,
  Can anybody explain to me , what is the differences between Blocking and
Non-blocking
  assignment ?  It would be better with a simple example.
  After reading the text written by Samir Palnitkar, I still can't figure
out.
  Thanks for answering.

Jason



Sat, 13 Mar 2004 16:17:45 GMT  
 Blocking and Non-blocking assignment ?
Hi,
    Read:

http://www.deepchip.com/items/0347-01.html

Srinivasan
--
Srinivasan Venkataramanan
ASIC Design Engineer
Software & Silicon Systems India Pvt. Ltd. (An Intel company)
Bangalore, India (http://www.vlsisrini.com)


Quote:
> Hello,
>   Can anybody explain to me , what is the differences between
Blocking and
> Non-blocking
>   assignment ?  It would be better with a simple example.
>   After reading the text written by Samir Palnitkar, I still can't
figure
> out.
>   Thanks for answering.

> Jason



Sat, 13 Mar 2004 17:56:09 GMT  
 Blocking and Non-blocking assignment ?

Quote:

>   Can anybody explain to me , what is the differences between Blocking and
> Non-blocking
>   assignment ?  It would be better with a simple example.
>   After reading the text written by Samir Palnitkar, I still can't figure
> out.

Just use one throught your code, don't worry about the difference, and you
will be fine.

If you don't like that answer, try this:
<http://alopatek.freeyellow.com/blocking.html>.

Mark.



Sat, 13 Mar 2004 21:43:39 GMT  
 Blocking and Non-blocking assignment ?

Quote:

> Just use one throught your code, don't worry about the difference, and you
> will be fine.

> If you don't like that answer, try this:
> <http://alopatek.freeyellow.com/blocking.html>.

Whooooaaaaa Nelly!

If you use blocking operators in your code and you expect blocking behavior,
your code will bit you in sensitive places.

A blocking operator (=) will consider the register value assigned after it's
coded (within a single always block, at least).  The non-blocking operator (<=)
puts off the assignment until all non-blocking operators are assigned at once.


begin
  out1 = in;     // While out1 takes on the value of in
  out2 = out1;   // out2 also gets the value of in on the same clock.
end              // Why not just use out2 = in; ?


begin
  out1 <= in;     // Here out1 still takes on the value of in as above
  out2 <= out1;   // but out2 gets the old value of out1 not the new value.
end

The non-blocking operator is almost always used.  There are times when the
subtle advantages of the blocking operator can really be a great help but
(thankfully) those times are infrequent.



Sat, 13 Mar 2004 23:49:21 GMT  
 Blocking and Non-blocking assignment ?
Excellent answer,
   to add a bit, I would say that the verilog non blocking is safer,
because blocking may generate different behaviour, on different platforms,

So in short avoid blocking statements.
Andre
Quote:


>> Just use one throught your code, don't worry about the difference, and
>> you will be fine.

>> If you don't like that answer, try this:
>> <http://alopatek.freeyellow.com/blocking.html>.

> Whooooaaaaa Nelly!

> If you use blocking operators in your code and you expect blocking
> behavior, your code will bit you in sensitive places.

> A blocking operator (=) will consider the register value assigned after
> it's
> coded (within a single always block, at least).  The non-blocking operator
> (<=) puts off the assignment until all non-blocking operators are assigned
> at once.


> begin
>   out1 = in;     // While out1 takes on the value of in
>   out2 = out1;   // out2 also gets the value of in on the same clock.
> end              // Why not just use out2 = in; ?


> begin
>   out1 <= in;     // Here out1 still takes on the value of in as above
>   out2 <= out1;   // but out2 gets the old value of out1 not the new
>   value.
> end

> The non-blocking operator is almost always used.  There are times when the
> subtle advantages of the blocking operator can really be a great help but
> (thankfully) those times are infrequent.



Sun, 14 Mar 2004 06:58:19 GMT  
 Blocking and Non-blocking assignment ?

Quote:


> > Just use one throught your code, don't worry about the difference, and you
> > will be fine.

> > If you don't like that answer, try this:
> > <http://alopatek.freeyellow.com/blocking.html>.

> Whooooaaaaa Nelly!

> If you use blocking operators in your code and you expect blocking behavior,
> your code will bit you in sensitive places.

> A blocking operator (=) will consider the register value assigned after it's
> coded (within a single always block, at least).  The non-blocking operator (<=)
> puts off the assignment until all non-blocking operators are assigned at once.


> begin
>   out1 = in;     // While out1 takes on the value of in
>   out2 = out1;   // out2 also gets the value of in on the same clock.
> end              // Why not just use out2 = in; ?


> begin
>   out1 <= in;     // Here out1 still takes on the value of in as above
>   out2 <= out1;   // but out2 gets the old value of out1 not the new value.
> end

> The non-blocking operator is almost always used.  There are times when the
> subtle advantages of the blocking operator can really be a great help but
> (thankfully) those times are infrequent.

Here is a fool proof style for coding sequential always blocks:
1) Always use nonblocking to infer flip-flops for variables declared
outside an always block (declared at the module level).
2) If it is advantageous to do so, you may use blocking assignments
for variables declared locally within an always block.  You are
guaranteed to have no race conditions with other blocks becuause the
variable is not visible in other blocks.


Sun, 14 Mar 2004 07:41:36 GMT  
 Blocking and Non-blocking assignment ?
Hi John_H,
    Thanks for your answer.
    I think I understand the differences now.

Jason


Quote:

> > Just use one throught your code, don't worry about the difference, and
you
> > will be fine.

> > If you don't like that answer, try this:
> > <http://alopatek.freeyellow.com/blocking.html>.

> Whooooaaaaa Nelly!

> If you use blocking operators in your code and you expect blocking
behavior,
> your code will bit you in sensitive places.

> A blocking operator (=) will consider the register value assigned after
it's
> coded (within a single always block, at least).  The non-blocking operator
(<=)
> puts off the assignment until all non-blocking operators are assigned at
once.


> begin
>   out1 = in;     // While out1 takes on the value of in
>   out2 = out1;   // out2 also gets the value of in on the same clock.
> end              // Why not just use out2 = in; ?


> begin
>   out1 <= in;     // Here out1 still takes on the value of in as above
>   out2 <= out1;   // but out2 gets the old value of out1 not the new
value.
> end

> The non-blocking operator is almost always used.  There are times when the
> subtle advantages of the blocking operator can really be a great help but
> (thankfully) those times are infrequent.



Sun, 14 Mar 2004 10:43:19 GMT  
 Blocking and Non-blocking assignment ?
Cliff Cummings has an excellent paper which discusses the dangers
of blocking and nonblocking assignments.  This is a must read
for Verilog users that haven't achived the guru level.

This paper won 1st place at the 1999 Boston SNUG Conference.

'"full_case parallel_case", the Evil Twins of Verilog Synthesis'
http://www.sunburst-design.com/papers/CummingsSNUG1999Boston_FullPara...

Cliff has other interesting papers:

http://www.sunburst-design.com/papers/

Noel St. John
VLSI Design Engineer

Quote:


> > Just use one throught your code, don't worry about the difference, and you
> > will be fine.

> > If you don't like that answer, try this:
> > <http://alopatek.freeyellow.com/blocking.html>.

> Whooooaaaaa Nelly!

> If you use blocking operators in your code and you expect blocking behavior,
> your code will bit you in sensitive places.

> A blocking operator (=) will consider the register value assigned after it's
> coded (within a single always block, at least).  The non-blocking operator (<=)
> puts off the assignment until all non-blocking operators are assigned at once.


> begin
>   out1 = in;     // While out1 takes on the value of in
>   out2 = out1;   // out2 also gets the value of in on the same clock.
> end              // Why not just use out2 = in; ?


> begin
>   out1 <= in;     // Here out1 still takes on the value of in as above
>   out2 <= out1;   // but out2 gets the old value of out1 not the new value.
> end

> The non-blocking operator is almost always used.  There are times when the
> subtle advantages of the blocking operator can really be a great help but
> (thankfully) those times are infrequent.



Mon, 22 Mar 2004 01:48:34 GMT  
 Blocking and Non-blocking assignment ?

Quote:

> Here is a fool proof style for coding sequential always blocks:
> 1) Always use nonblocking to infer flip-flops for variables declared
> outside an always block (declared at the module level).
> 2) If it is advantageous to do so, you may use blocking assignments
> for variables declared locally within an always block.  You are
> guaranteed to have no race conditions with other blocks becuause the
> variable is not visible in other blocks.

This is fool-proof indeed - because it perfectly emulates
VHDL behavior (signals for communication, variables locally).

Using the above rules is indeed the second best advice
to give to Verilog designers - and much better than the
myriad of uncomprehensible rules that can be found elsewhere.

Unfortunately, it will be necessary to use a linting tool
to check compliance with this rules because no one
can be expected to comply with them "manually".

Jan

--
Jan Decaluwe           Easics              
Design Manager         System-on-Chip design services  
+32-16-395 600         Interleuvenlaan 86, B-3001 Leuven, Belgium



Mon, 22 Mar 2004 05:03:36 GMT  
 Blocking and Non-blocking assignment ?

Quote:

> Cliff Cummings has an excellent paper which discusses the dangers
> of blocking and nonblocking assignments.  This is a must read
> for Verilog users that haven't achived the guru level.

That paper is not excellent at all - mediocre at best.
What it does show is that Mr. Cummings doesn't understand
nor appreciate the value of variables (in Verilog speaky-speaky:
regs that are assigned through blocking assignments), and
in particular, flip-flop inference from variables.

To his and all Verilog designers' credit however, to a large extent
this is due to conceptual flaws in the language. To their debet
of course, is that they are still using it.

Quote:
> This paper won 1st place at the 1999 Boston SNUG Conference.

No VHDL designer will ever win a 1st place discussing this.
They won't even submit a paper. We have signals and variables,
so the issue just isn't there.

Regards, Jan

--
Jan Decaluwe           Easics              
Design Manager         System-on-Chip design services  
+32-16-395 600         Interleuvenlaan 86, B-3001 Leuven, Belgium



Mon, 22 Mar 2004 05:31:00 GMT  
 Blocking and Non-blocking assignment ?
Not another one of those verilog/vhdl disputes........

why can't people with differences of opinion accept they have people who
disagree.

ANY SUBJECT.

Please..........

< big snip of ego>



Tue, 23 Mar 2004 04:40:00 GMT  
 Blocking and Non-blocking assignment ?

Quote:


> > Here is a fool proof style for coding sequential always blocks:
> > 1) Always use nonblocking to infer flip-flops for variables declared
> > outside an always block (declared at the module level).
> > 2) If it is advantageous to do so, you may use blocking assignments
> > for variables declared locally within an always block.  You are
> > guaranteed to have no race conditions with other blocks becuause the
> > variable is not visible in other blocks.

> This is fool-proof indeed - because it perfectly emulates
> VHDL behavior (signals for communication, variables locally).

> Using the above rules is indeed the second best advice
> to give to Verilog designers - and much better than the
> myriad of uncomprehensible rules that can be found elsewhere.

> Unfortunately, it will be necessary to use a linting tool
> to check compliance with this rules because no one
> can be expected to comply with them "manually".

> Jan

There are linting tools that will perform this check.  For example, as
a result of a recent exchange with the Veritools folks regarding this
issue, they simply split the common "blocking assignment in sequential
block" warning into two separate ones in order to differentiate
between locally and globally declared variables.  However, there is
some weirdness in the register inference algorithm for variables with
blocking assignments.  I'm sure they will get it right in the next
release.


Sat, 27 Mar 2004 00:17:34 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. blocking and non-blocking assignment

2. Strange behaviour with blocking and non-blocking assignment

3. "Blocking and non-blocking" assignments

4. why target cannot be assigned (in verilog) using a blocking and non-blocking assignment?

5. Blocking and Non-blocking assignment ? Also portability issue.

6. blocking/non-blocking

7. Blocking/Non-Blocking

8. block and non-block?

9. blocking vs non blocking

10. Blocking vs Non-Blocking Assignemts

11. blocking vs non-blocking

12. Blocking and non-blocking sockets

 

 
Powered by phpBB® Forum Software