Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assigning values in Verilog: difference between assign, <= and =

Tags:

assign

verilog

I have just started learning Verilog and I've seen these three lines from different sources. I am confused about the difference between the three:

  1. c <= a&b;
  2. assign c = ~a;
  3. c = 1'b0;

These lines seem to assign a value to c but what's the difference? Thanks.

like image 504
dringx Avatar asked Dec 12 '14 02:12

dringx


1 Answers

1) <=non-blocking and is performed on every positive edge of clock. these are evaluated in parallel so no guarantee of order. An example of this would be a register.

2) assign =continual assignment to wire outside an always statement. value of LHS is updated when RHS changes.

3) =blocking assignment, inside always statements enforces sequential order.

like image 167
chris Avatar answered Oct 23 '22 14:10

chris