Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Functional verification, in electronic design automation, is the task of verifying that the logic
design conforms to specification. In everyday terms, functional verification attempts to answer
the question "Does this proposed design do what is intended?" This is a complex task, and takes
the majority of time and effort in most large electronic system design projects.
Functional verification is very difficult - it is equivalent to program verification, and is NP-
hard or even worse - and no solution has been found that works well in all cases. However, it
can be attacked by many methods. None of them are perfect, but each can be helpful in certain
circumstances:
The generator[disambiguation needed] (or irritator) generates input vectors. Modern generators
generate random, biased, and valid stimuli. The randomness is important to achieve a high
distribution over the huge space of the available input stimuli. To this end, users of these
generators intentionally under-specify the requirements for the generated tests. It is the
role of the generator to randomly fill this gap. This mechanism allows the generator to
create inputs that reveal bugs not being searched for directly by the user. Generators also
bias the stimuli toward design corner cases to further stress the logic. Biasing and
randomness serve different goals and there are tradeoffs between them, hence different
1|Page
generators have a different mix of these characteristics. Since the input for the design must
be valid (legal) and many targets (such as biasing) should be maintained, many generators
use theConstraint satisfaction problem (CSP) technique to solve the complex testing
requirements. The legality of the design inputs and the biasing arsenal are modeled. The
model-based generators use this model to produce the correct stimuli for the target design.
The drivers translate the stimuli produced by the generator into the actual inputs for the
design under verification. Generators create inputs at a high level of abstraction, namely, as
transactions or assembly language. The drivers convert this input into actual design inputs
as defined in the specification of the design's interface.
The simulator produces the outputs of the design, based on the design’s current state
(the state of the flip-flops) and the injected inputs. The simulator has a description of the
design net-list. This description is created by synthesizing the HDL to a low gate level net-
list.
The monitor converts the state of the design and its outputs to a transaction abstraction
level so it can be stored in a 'score-boards' database to be checked later on.
The checker validates that the contents of the 'score-boards' are legal. There are cases
where the generator creates expected results, in addition to the inputs. In these cases, the
checker must validate that the actual results match the expected ones.
The arbitration manager manages all the above components together.
Different coverage metrics are defined to assess that the design has been adequately exercised.
These include functional coverage (has every functionality of the design been exercised?),
statement coverage (has each line of HDL been exercised?), and branch coverage (has each
direction of every branch been exercised?).
Functional Verification Tools
Avery Design Systems: SimCluster (for parallel logic simulation) and Insight (for formal
verification)
Cadence Design Systems
EVE/ZeBu
Mentor Graphics
Nusym Technology
Obsidian Software
Synopsys
2|Page
Test Bench
A test bench is a virtual environment used to verify the correctness or soundness of a design or
model (e.g., a software product).
The term has its roots in the testing of electronic devices, where an engineer would sit at a lab
bench with tools of measurement and manipulation, such as oscilloscopes, multimeters,
soldering irons, wire cutters, and so on, and manually verify the correctness of the device under
test.
In the context of software or firmware or hardware engineering, a test bench refers to an
environment in which the product under development is tested with the aid of a collection of
testing tools. Often, though not always, the suite of testing tools is designed specifically for the
product under test.
A test bench or testing workbench has four components.
1.INPUT: The entrance criteria or deliverables needed to perform work
2.PROCEDURES TO DO: The tasks or processes that will transform the input into the output
3.PROCEDURES TO CHECK: The processes that determine that the output meets the standards.
4.OUTPUT: The exit criteria or deliverables produced from the workbench
First create an empty folder in desktop to keep all your files and name it as “exercise”
3|Page
Now change your working directory to “exercise” folder
Click ok
4|Page
To create a new project, go to
5|Page
Observe there is one project tab added, in which your project name is counter
6|Page
Double click counter.v, and start coding for counter in open space
Click library tab, work is default working library of modelsim. It is empty because we have not yet
compiled our counter code.
7|Page
Click New File, name counter_test and type as “Verilog” and click ok
8|Page
Now select both files counter.v and counter_test.v ( use ctrl key to select both files)
9|Page
Simulate Start Simulation
10 |
Page
11 |
Page
All the waves in design are added to the waveform window.
Click on Simulate button , all the input vectors written in testbench are applied to the dut and
waveforms are displayed in the window aas shown below.
After doing basic simulation, click on view and select dataflow. This option is useful for
debugging porpose.
12 |
Page
Once, we add a signal to wave, following wizard pops up. This is helpful for debugging. If any of
the output is X, then by using dataflow command the backtrace can be done and the source that
causes X can be found.
Code coverage
This is useful for any design which helps the verification engineer to apply all cases to the DUT
and check whether all lines of code is covered or not. There are different types of code coverages
like Statement Coverage, Line Cloverage, Expression Coverage etc.
13 |
Page
Compile all the files in design.
14 |
Page
Click Start Simulation
15 |
Page
Enable Code Coverage
16 |
Page
Again run simulation with the selected coverage directives.
All the coverages can be found with 0% covered because we did not apply he inpu stimulus till
now.
17 |
Page
Once we run simulation, alll the coverage directives will be displayed.
18 |
Page
Synsthesis
After Functional verification is done, we now do synthesis.
In electronics, logic synthesis is a process by which an abstract form of desired circuit behavior
(typically register transfer level (RTL)) is turned into a design implementation in terms oflogic
gates. Common examples of this process include synthesis of HDLs, including VHDL and Verilog.
Some tools can generate bitstreams for programmable logic devices such asPALs or FPGAs,
while others target the creation of ASICs. Logic synthesis is one aspect of electronic design
automation.
The roots of logic synthesis can be traced to the treatment of logic by George Boole (1815 to
1864), in what is now termed Boolean algebra. In 1938, Claude Shannon showed that the two-
valued Boolean algebra can describe the operation of switching circuits. In the early days, logic
design involved manipulating the truth table representations as Karnaugh maps. The Karnaugh
map-based minimization of logic is guided by a set of rules on how entries in the maps can be
combined. A human designer can typically only work with Karnaugh maps containing up to four
to six variables.
The first step toward automation of logic minimization was the introduction of the Quine–
McCluskey algorithm that could be implemented on a computer. This exact minimization
technique presented the notion of prime implicants and minimum cost covers that would
become the cornerstone of two-level minimization. Nowadays, the much more
efficient Espresso heuristic logic minimizer has become the standard tool for this operation.
Another area of early research was in state minimization and encoding of finite state
machines (FSMs), a task that was the bane of designers. The applications for logic synthesis lay
primarily in digital computer design. Hence, IBM and Bell Labs played a pivotal role in the early
automation of logic synthesis. The evolution from discrete logic components to programmable
logic arrays (PLAs) hastened the need for efficient two-level minimization, since minimizing
terms in a two-level representation reduces the area in a PLA.
With a goal of increasing designer productivity, research efforts on the synthesis of circuits
specified at the behavioral level have led to the emergence of commercial solutions in 2004[1],
which are used for complex ASIC and FPGA design. These tools automatically synthesize circuits
specified at C level to a register transfer level (RTL) specification, which can be used as input to
a gate-level logic synthesis flow.[1] Today, high-level synthesis, also known as ESL synthesis and
behavioral synthesis, essentially refers to circuit synthesis from high level Languages like ANSI
C/C++ or SystemC etc., whereas Logic Synthesis refers to synthesis from structural or functional
description to RTL.
20 |
Page
TalusDesign by Magma Design Automation
21 |
Page
To start Precision follow this path.
Following window pops up, where we can create new project or open an existing project.
22 |
Page
To crate a new project, click new project
Enter project name and browse the path, where it should be saved.
23 |
Page
Now a new project is created named Techlabs_synthesis.
To add new .v or .vhd files, right click on input files and select add input files.
24 |
Page
We need to add only design files , no need to add test bench files here.
25 |
Page
Click on synthesis design.
After synthesis, many files are added to the output files as shown below.
26 |
Page
All the information in the output files can be viewed by double clicking on the file.
Technology Schematic.
27 |
Page
Area Report.
28 |
Page
All the options that can be accessed under each category is listed below.
29 |
Page
After running the process one can view all the files of different implementations for same project.
30 |
Page
Programs
adder_8bit.v
//outputs
output [7:0] sum;
output cout;
//wires
wire [7:0] a;
wire [7:0] b;
wire cin;
adder_1bit.v
module adder_1bit ( a , b, cin , sum, cout );
//inputs
input a , b , cin;
//outputs
output sum, cout;
31 |
Page
assign sum = a ^ b ^cin;
assign cout = cin(a^b) + ab;
endmodule
test_adder.v
// test bench for 8-bit adder
module test_adder();
reg [7:0] a;
reg [7:0] b;
reg cin;
initial begin
a = 8'b00000000;
b = 8'b00000000;
cin = 1'b0;
#100 $finish;
end
endmodule
32 |
Page
address_decoder.v
module decoder_using_case (
binary_in , // 4 bit binary input
decoder_out , // 16-bit out
enable // Enable for the decoder
);
input [3:0] binary_in ;
input enable ;
output [15:0] decoder_out ;
endmodule
33 |
Page
test_decoder.v
module test_decoder;
reg [3:0] binary_in;
reg enable;
wire [15:0] decoder_out;
initial begin
binary_in = 4'h0;enable = 0;
#10
enable = 1;
#10
binary_in = 4'h1;
#10
binary_in = 4'h7;
#10
binary_in = 4'hA;
#10
binary_in = 4'hF;
#10
binary_in = 4'h3;
end
endmodule
mux using if
module mux_4to1_using_if (a, b, c, d, s, o);
input a,b,c,d;
input [1:0] s;
output o;
reg o;
always @(a or b or c or d or s)
34 |
Page
begin
if (s == 2'b00)
o = a;
else if (s == 2'b01)
o = b;
else if (s == 2'b10)
o = c;
else
o = d;
end
endmodule
test_mux.v
module test_mux;
reg a, b, c, d;
reg [1:0] s;
wire o;
initial begin
a=1;b=1;c=0;d=0;
s=00;
#20
s=01;
#20
s=10;
#20
s=11;
end
endmodule
Multiplier
module multiplier_4bit( a , b , out);
//inputs
input [3:0] a;
35 |
Page
input [3:0] b;
//output
output [8:0] out;
//wires
wire [3:0] a;
wire [3:0] b;
assign out = a * b;
endmodule
Test_Multiplier
module test_multiplier;
reg [3:0] a;
reg [3:0] b;
initial begin
a=4'b0000, b=4'b0000;
#20
a=4'b0001, b=4'b0011;
#20
a=4'b1111, b=4'b1111;
end
endmodule
36 |
Page
Accumulator
test_accumulator
module test_acc;
wire [3:0] q;
initial begin
forever begin
clk <= 0;
#5
clk <= 1;
#5
clk <= 0;
end
end
37 |
Page
initial begin
clr = 0;
#20
clr = 1;data = 0001;
#20
clr = 0; data = 0010;
#20
data = 0011;
#20 clr = 1
end
endmodule
Counter
module up_counter (
out , // Output of the counter
enable , // enable for counter
clk , // clock Input
reset // reset Input
);
//----------Output Ports--------------
output [7:0] out;
//------------Input Ports--------------
input enable, clk, reset;
//------------Internal Variables--------
reg [7:0] out;
//-------------Code Starts Here-------
always @(posedge clk)
if (reset) begin
out <= 8'b0 ;
end else if (enable) begin
38 |
Page
out <= out + 1;
end
endmodule
module test_upcounter;
reg clk, reset,enable ;
wire [7:0] out;
initial begin
forever begin
clk <= 0;
#5
clk <= 1;
#5
clk <= 0;
end
end
initial begin
reset = 1;
#20
reset = 0;enable = 1;
#100
enable = 0;
#150
reset = 0;
end
endmodule
39 |
Page
PRBS Generator
//inputs
input clk, reset;
//outputs
output rand;
//wires
wire rand;
//internal registors
reg [3:0] temp;
begin
if (reset)
else
temp <= {temp[0]^temp[1],temp[3],temp[2],temp[1]};
end
endmodule
40 |
Page
Test Bench for PRBS
module main;
wire rand;
initial begin
forever begin
clk <= 0;
#5
clk <= 1;
#5
clk <= 0;
end
end
initial begin
reset = 1;
#12
reset = 0;
#90
reset = 1;
#12
reset = 0;
end
endmodule
41 |
Page