8/9/2019 nptel CAD VLSI
1/14
1
CAD for VLSI Design - ILecture 14
V. Kamakoti and Shankar Balachandran
8/9/2019 nptel CAD VLSI
2/14
2
Overview of the lecture
• Blocking and Non Blocking proceduralassignments
– Understanding the difference
– Blocks with mix of both assignments (hybrid case)
– Importance of the same in simulation
8/9/2019 nptel CAD VLSI
3/14
3
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 anotherconcurrent construct also
always @(posedge clk)begin
word[15:8] = word[ 7:0];
word[ 7:0] = word[15:8];
end
//swap bytes in word???
always @(posedge clk)
begin
word[ 7:0] = word[15:8];
word[15:8] = word[ 7:0];
end
//swap bytes in word???
8/9/2019 nptel CAD VLSI
4/14
4
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
• Execution flow within the procedure continuesuntil a timing control is encountered (flow is not
blocked)
• Operator is
8/9/2019 nptel CAD VLSI
5/14
5
Sequential Procedural Assignments
• The order of evaluation is determinate – A sequential blocking assignment evaluates and assigns before
continuing on in the procedure
always @(posedge clk)
beginA = 1; // evaluate and assign A immediately
B = A + 1; // evaluate and assign; uses A = 1
end
– A sequential non-blocking assignment evaluates, then continues on tothe next timing control before assigning
always @(posedge clk)
begin
A
8/9/2019 nptel CAD VLSI
6/146
Concurrent Procedural Assignments
• The order of evaluation isindeterminate
– Concurrent blocking assignments have unpredictable results
always @(posedge clk)
A = A + 1;always @(posedge clk)
B = A + 1; // use previous A or current A ??
– Concurrent nonblocking assignments have predictableresults
always @(posedge clk)
A
8/9/2019 nptel CAD VLSI
7/147
Sequential Procedural Assignmentalways @(posedge clk)
begin
y1 = in;
y2 = y1;end
always @(posedge clk)
begin
y1
8/9/2019 nptel CAD VLSI
8/148
Concurrent Procedural Assignment
always @(posedge clk)
y1 = in;
always @(posedge clk)y2 = y1;
always @(posedge clk)
y1
8/9/2019 nptel CAD VLSI
9/149
Procedural Assignments
• Combinational Logic – If there are no delays added, use blocking
assignments
– Delays ??
• Sequential Logic
– If there are no delays, use non-blockingassignments
– Delays??
8/9/2019 nptel CAD VLSI
10/1410
Mixing Statements (1)always
begin
a = 3;
a = 4;
a = 5;
b = a; #5;
end
always
begin
a = 3;
a = 4;
a = 5;
b
8/9/2019 nptel CAD VLSI
11/1411
Mixing Statements (2)always begin
a = 3;
a = 4;
b = a;
a = 5;
b = a; #5;
end
always begin
a = 3;
a = 4;b
8/9/2019 nptel CAD VLSI
12/1412
Mixing Statements (3)always
begin
a
8/9/2019 nptel CAD VLSI
13/1413
Mixing Statements (4)always begin
a
8/9/2019 nptel CAD VLSI
14/1414
Questions and Answers
Thank You