Escolar Documentos
Profissional Documentos
Cultura Documentos
Lecture 14
V. Kamakoti and Shankar Balachandran
Blocking Assignments
Blocking
The assignment must complete before the next line
is executed
Blocks the flow of the program
Operator is =
Assignments can block execution in another
concurrent construct also
always @(posedge clk)
begin
word[15:8] = word[ 7:0];
word[ 7:0] = word[15:8];
end
//swap bytes in word???
Non-Blocking Assignments
Evaluated and assigned in two steps:
The right-hand side is evaluated immediately
The assignment to the left-hand side is postponed
until other evaluations in the current time step are
completed
Shift
Register
7
???
Shift
Register
8
Procedural Assignments
Combinational Logic
If there are no delays added, use blocking
assignments
Delays ??
Sequential Logic
If there are no delays, use non-blocking
assignments
Delays??
always
begin
a
a
b
a
end
=
=
=
=
3;
4;
a;
5; #5;
always
begin
a
a
b
a
end
= 3;
= 4;
<= a;
= 5; #5;
10
begin
= 3;
= 4;
= a;
= 5;
= a; #5;
begin
= 3;
= 4;
<= a;
= 5;
<= a; #5;
11
Some non-determinism
here
<= c;
<= d;
<= e;
= a; #5;
always
a
a
b
a
end
begin
Some non<= c;
determinism here
<= d;
= a;
<= e; #5;
<=
<=
<=
<=
c;
d;
e;
a; #5;
always
a
a
b
a
end
begin
<= c;
<= d;
<= a;
<= e; #5;
12
begin
<= c;
<= d;
= a;
<= e;
= a; #5;
always
a
a
b
a
b
end
begin
<= c;
<= d;
<= a;
<= e;
<= a; #5;
always
a
a
b
a
b
end
begin
<= c;
<= d;
= a; #5;
<= e;
= a;
always
a
a
b
a
b
end
begin
<= c;
<= d;
<= a; #5;
<= e;
<= a;
13
Thank You
14