Module 4
Module 4
21EC71
Course Outcomes (CO)
• Understand the VLSI design flow
• Describe the concept of ASIC design methodology
• Create floorplan including partition and routing with the use of CAD
algorithms
• Will have better insights into VLSI back-end design flow
• Learn verification basics and System Verilog
Text Books
• Michael John Sebastian Smith, Application - Specific Integrated
Circuits, Addison-Wesley Professional, 2005.
• Chris Spear, System Verilog for Verification – A guide to learning the
Test bench language features, Springer Publications, Second Edition,
2010
Module 4
• Procedural Statements and Routines: Procedural
statements, Tasks, Functions and void functions, Task and
function overview, Routine arguments, returning from a
routine, Local data storage, time values.
• Connecting the test bench and design: Separating the test
bench and design, The interface construct, Stimulus timing,
Interface driving and sampling, System Verilog assertions.
(Text Book 2)
Introduction
• SystemVerilog introduces many incremental improvements to
make this easier by making the language look more like C,
especially around argument passing.
Procedural Statements
• SystemVerilog adopts many operators and statements from C and C++. You can
declare a loop variable inside a for loop that then restricts the scope of the loop
variable and can prevent some coding bugs.
• The increment ++ and decrement -- operators are available in both pre- and post-
form. If you have a label on a begin or fork statement, you can put the same label
on the matching end or join statement.
• This makes it easier to match the start and finish of a block. You can also put a
label on other SystemVerilog end statements such as endmodule, endtask,
endfunction, and others
• Example 1 New procedural statements and operators
initial
begin : example
integer array[10], sum, j; // Declare i in for statement
for (int i=0; i<10; i++) // Increment i
array[i] = i; // Add up values in the array
sum = array[9];
j=8;
do // do...while loop
sum += array[j]; // Accumulate
while (j--); // Test if j=0
$display("Sum=%4d", sum); // %4d - specify width
end : example // End label
Example 2 Using break and continue while reading a file
initial begin
logic [127:0] cmd;
integer file, c;
file = $fopen("commands.txt", "r");
while (!$feof(file)) begin
c = $fscanf(file, "%s", cmd);
case (cmd)
"": continue; // Blank line - skip to loop end
"done": break; // Done - leave loop
// Process other commands here
...
endcase // case(cmd)
end
$fclose(file);
end
Tasks, Functions, and Void Functions
• Verilog makes a very clear differentiation between tasks and functions.
The most important difference is that a task can consume time while a
function cannot. A function cannot have a delay, #100, a blocking
statement
such as @(posedge clock) or wait(ready), or call a task.
• Additionally, a Verilog function must return a value, and the value
must be used, as in an assignment statement.
• In SystemVerilog, if you want to call a function and ignore its return
value, cast the result to void. This might be done if you are calling the
function to use a side effect.
Example 3 Ignoring a function’s return value
void’(my_func(42));
task multiple_lines;
$display("First line");
$display("Second line");
endtask : multiple_lines
• Routine Arguments
Many of the SystemVerilog improvements for routine make it easier
to declare arguments and expand the ways you can pass values to
and from a routine.