chapter 13: verification - wiley: · pdf filechapter 13: verification ... architecture of hdl...
TRANSCRIPT
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-1
Chapter 13: Verification
Department of Electronic Engineering
National Taiwan University of Science and Technology
Prof. Ming-Bo Lin
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-2
Syllabus
ObjectivesFunction verificationSimulationTest bench designDynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-3
Objectives
After completing this chapter, you will be able to:Describe the importance and essential of verificationUnderstand the essential of timing and functional verificationDescribe the essential issues of simulatorsUnderstand the essential principles of test bench designsUnderstand the principle of dynamic timing analysisUnderstand the principle of static timing analysisUnderstand issues of coverage analysisDescribe the ISE design flow and related issues
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-4
Syllabus
ObjectivesFunctional verification
IntroductionFunctional verificationSimulation-based verification
SimulationTest bench designDynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-5
Verification
The goal of verification To ensure 100% correct in functionality and timingSpend 50 ~ 70% of time to verify a design
Functional verificationSimulationFormal proof
Timing verificationDynamic timing simulation (DTS)Static timing analysis (STA)
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-6
Syllabus
ObjectivesVerification
IntroductionFunctional verificationSimulation-based verification
SimulationTest bench designDynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-7
Functional Verification
Simulated-based functional verificationA test benchInput stimuliOutput analysis
Formal verificationA protocolAn assertionA propertyA design rule
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-8
Models of Design under Test
Black box modelWhite box modelGray box model
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-9
Types of Assertion
Static assertionTemporal assertion
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-10
Syllabus
ObjectivesVerification
IntroductionFunctional verificationSimulation-based verification
SimulationTest bench designDynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-11
Simulation-Based Verification
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-12
Hierarchy of Functional Verification
Designer level (or block-level)Unit levelCore levelChip level
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-13
A Verification Test Set
Verification test set includes at leastCompliance tests Corner case tests Random tests Real code tests Regression tests Property check
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-14
Formal Verification
Uses mathematical techniques Proves a design property
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-15
Syllabus
ObjectivesVerificationSimulation
Types of simulations and simulatorsArchitecture of HDL simulators
Test bench designDynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-16
Types of Simulations
Behavioral simulationFunctional simulationGate-level (logic) simulationSwitch-level simulation Circuit-level (transistor-level) simulation
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-17
Variations of Simulations
Software simulationHardware accelerationHardware emulation
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-18
Syllabus
ObjectivesVerificationSimulation
Types of simulations and simulatorsArchitecture of HDL simulators
Test bench designDynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-19
An Architecture of HDL Simulators
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-20
Verilog HDL Simulators
Interpreted simulatorsCadence Verilog-XL simulator
Compiled code simulatorsSynopsys VCS simulator
Native code simulatorsCadence Verilog-NC simulator
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-21
Event-Driven/Cycle-Based Simulators
Event-driven simulatorsTriggered by events
Cycle-based simulatorsOn a cycle-by-cycle basis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-22
An Event-Driven Simulation
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-23
Syllabus
ObjectivesVerificationSimulationTest bench designs
Test bench designClock signal generationReset signal generationVerification coverage
Dynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-24
Test Bench Design Principles
Functions of a test benchgenerates stimulichecks responses in terms of test casesemploys reusable verification components
Two types of test benchesdeterministicself-checking
Options of choosing test vectorsExhaustive testRandom testVerification vector files
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-25
Test Bench Design Principles
Two basic choices of stimulus generationDeterministic versus random stimulus generationPregenerated test case versus on-the-fly test case generation
Types of result checkingon-the-fly checking end-of-test checking
Result analysisWaveform viewers Log files
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-26
Types of Automated Response Checking
Golden vectorsReference modelTransaction-based model
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-27
Test Bench Designs --- A Trivial Example
// test bench design example 1: exhaustive test.`timescale 1 ns / 100 ps…
nbit_adder_for UUT (.x(x), .y(y), .c_in(c_in), .sum(sum), .c_out(c_out));
reg [2*n-1:0] i;initial for (i = 0; i <= 2**(2*n)-1; i = i + 1) begin
x[n-1:0] = i[2*n-1:n]; y[n-1:0] = i[n-1:0]; c_in =1'b0; #20; end…
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-28
Test Bench Designs --- A Trivial Example
// test bench design example 2: Random test.`timescale 1 ns / 100 ps…nbit_adder_for UUT
(.x(x), .y(y), .c_in(c_in), .sum(sum), .c_out(c_out));integer i;reg [n:0] test_sum;initial for (i = 0; i <= 2*n ; i = i + 1) begin
x = $random % 2**n; y = $random % 2**n;c_in =1'b0; test_sum = x + y;
#15; if (test_sum != {c_out, sum}) $display("Error iteration %h\n", i);
#5; end…
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-29
Test Bench Designs --- A Trivial Example
// test bench design example 3: Using Verification vector files.`timescale 1 ns / 100 psparameter n = 4;parameter m = 8;…// Unit Under Test port map
nbit_adder_for UUT (.x(x), .y(y), .c_in(c_in), .sum(sum), .c_out(c_out));
integer i;reg [n-1:0] x_array [m-1:0];reg [n-1:0] y_array [m-1:0];reg [n:0] expected_sum_array [m-1:0];
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-30
Test Bench Designs --- A Trivial Example
initial begin // reading verification vector files$readmemh("inputx.txt", x_array);$readmemh("inputy.txt", y_array);$readmemh("sum.txt", expected_sum_array);
endinitial
for (i = 0; i <= m - 1 ; i = i + 1) begin x = x_array[i]; y = y_array[i];c_in =1'b0;
#15; if (expected_sum_array[i] != {c_out, sum}) $display("Error iteration %h\n", i);
#5; endinitial #200 $finish;
49d516d9
inputx.txt
13d2ddc6
inputy.txt
050c1a070e13190f
sum.txt
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-31
Syllabus
ObjectivesVerificationSimulationTest bench designs
Test bench designClock signal generationReset signal generationVerification coverage
Dynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-32
Types of Clock Signals
Types of clock signalsA general clock signalAligned derived clock signalsClock multipliersAsynchronous clock signals
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-33
A General Clock Signal
Examples
initial beginclk <= 1’b0; forever #10 clk <= ~ clk;
end
reg clk;always begin
#5 clk <= 1’b0;#5 clk <= 1’b1; end
initial clk <=1’b0;always #10 clk <= ~clk;
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-34
A General Clock Signal
Truncation error
Rounding error
Proper precision
`timescale 1 ns / 1 nsreg clk;parameter clk_period = 25;
always begin #(clk_period/2) clk <= 1’b0;#(clk_period/2) clk <= 1’b1;
end
always begin #(clk_period/2.0) clk <= 1’b0;#(clk_period/2.0) clk <= 1’b1;
end
`timescale 1 ns / 1 nsreg clk;parameter clk_period = 25;
always begin #(clk_period/2) clk <= 1’b0;#(clk_period/2) clk <= 1’b1;
end
`timescale 1 ns / 100 psreg clk;parameter clk_period = 25;
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-35
Aligned Derived Clock Signals
An improper approach
A proper approach
always begin if (clk == 1’b1) clk2 <= ~ clk2;
end
// both clk1 and clk2 are derived from clk.always begin
clk1 <= clk; if (clk == 1’b1) clk2 <= ~ clk2;
end
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-36
Clock MultipliersAn example
initial beginclk1 <= 1’b0; clk4 <= 1’b0;forever begin
repeat (4) begin #10 clk4 <= ~ clk4; end
clk1 <= ~ clk1;end
end
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-37
Asynchronous Clock Signals“Asynchronous” means random
initial beginclk100 <= 1’b0; #2;forever begin
#5 clk100 <= ~ clk100;end
end
initial beginclk33 <= 1’b0; #5;forever begin
#15 clk33 <= ~ clk33; end
end
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-38
Syllabus
ObjectivesVerificationSimulationTest bench designs
Test bench designClock signal generationReset signal generationVerification coverage
Dynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-39
Reset Signal Generations
Race conditionUsing nonblocking assignments
always begin#5 clk = 1’b0;#5 clk = 1’b1;
endinitial begin // has race condition.
reset = 1’b0;#20 reset = 1’b1;#40 reset = 1’b0;
end
always begin#5 clk <= 1’b0;#5 clk <= 1’b1;
endinitial begin // no race condition.
reset <= 1’b0;#20 reset <= 1’b1;#40 reset <= 1’b0;
end
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-40
Reset Signal Generations
Increase of maintainability
always begin #(clk_period/2) clk <= 1’b0;#(clk_period/2) clk <= 1’b1;
endinitial begin
reset = 1’b0;wait (clk !== 1’bx); repeat (3) @(negedge clk) reset <= 1’b1;reset <= 1’b0;
end
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-41
Reset Signal Generations
The use of a task
always begin #(clk_period/2) clk <= 1’b0;#(clk_period/2) clk <= 1’b1;
end// using a tasktask hardware_reset;begin
reset = 1’b0;wait (clk !== 1’bx);
// set reset to 1 for two clock cyclesrepeat (3) @(negedge clk) reset <= 1’b1;reset <= 1’b0;
end endtask
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-42
Syllabus
ObjectivesVerificationSimulationTest bench designs
Test bench designClock signal generationReset signal generationVerification coverage
Dynamic timing analysisStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-43
Coverage Analysis
Two major typesStructural coverageFunctional coverage
Q: What does 100% functional coverage mean?You have covered all the coverage points you included in the simulationBy no means the job is done
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-44
Structural Coverage
Statement coverageBranch or conditional coverageToggle coverageTrigger coverageExpression coverage Path coverageFinite-state machine coverage
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-45
Functional Coverage
Functional coverageItem coverageCross coverageTransition coverage
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-46
Syllabus
ObjectivesVerificationSimulationTest bench designsDynamic timing analysis
SDF and delay back-annotationISE design flowISE simulation flow
Static timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-47
SDF and Generation Guidelines
The standard delay format (SDF) fileThe SDF specifies
IOPATH delayINTERCONNECT delayTiming check (SETUP, HOLD, etc)
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-48
Generation of SDF Files
Pre-layoutGate delay information*_map.sdf (contains gate delay only) in ISE design flow
Post-layoutBoth gate and interconnect delay information*_timesim.sdf in ISE design flow
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-49
Delay Back-Annotation
$sdf_annotate (design_file_name _map.sdf", design_file_name);$sdf_annotate (design_file_name _timesim.sdf", design_file_name);
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-50
Syllabus
ObjectivesVerificationSimulationTest bench designsDynamic timing analysis
SDF and delay back-annotationISE design flowISE simulation flow
Static timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-51
The ISE Design Flow
Design entrySynthesis to create a gate netlistImplementation
TranslationMapPlace and route
Configure FPGA
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-52
The ISE Design Flow
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-53
Syllabus
ObjectivesVerificationSimulationTest bench designsDynamic timing analysis
SDF and delay back-annotationISE design flowISE simulation flow
Static timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-54
A Simulation Flow --- An ISE-Based Flow
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-55
Syllabus
ObjectivesVerificationSimulationTest bench designsDynamic timing analysisStatic timing analysis
Introduction to timing analysisStatic timing analysisTiming specifications
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-56
Timing Analysis
Q: The output needs to be stable by t = T for the correct functionality. But how to make sure of it?Two approaches
Dynamic timing simulationStatic timing analysis
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-57
Purposes of Timing Analysis
Timing verificationif a design meets a given timing constraint?Example: cycle-time constraint
Timing optimizationOptimizes the critical portion of a design Identifies critical paths
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-58
Syllabus
ObjectivesVerificationSimulationTest bench designsDynamic timing analysisStatic timing analysis
Introduction to timing analysisStatic timing analysisTiming specifications
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-59
Why Static Timing Analysis?
Drawbacks of DTShas posed a bottleneck for large complex designsrelies on the quality and coverage of the test bench
Basic assumptions of STANo combinational feedback loopsAll register feedback broken by the clock boundary
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-60
Static Timing Analysis
In STADesigns are broken into sets of signal pathsEach path has a start point and an endpoint
Start pointsInput portsClock pins of storage elements
EndpointsOutput portsData input pins of storage elements
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-61
Four Types of Path Analysis
Entry path (input-to-D path)Stage path (register-to-register path or clock-to-D path)Exit path (clock-to-output path)Pad-to-pad path (port-to-port path)
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-62
Path Groups
Types of path groupsPath groupDefault path group
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-63
Syllabus
ObjectivesVerificationSimulationTest bench designsDynamic timing analysisStatic timing analysis
IntroductionStatic timing analysisTiming specifications
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-64
Timing Specifications
Port-related constraintsInput delay (offset-in) Output delay (offset-out) Input-output (pad to pad) Cycle time (period)
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-65
Setup Time and Hold Time Checks
Clock-related constraintsClock period Setup timeHold time
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-66
Timing Analysis
A critical path The path of longest propagation delay A combinational logic path that has negative or smallest slack timeslack = required time – arrival time
= requirement – datapath (in ISE)
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-67
Timing Exceptions
Two timing exceptionsFalse pathsMulti-cycle paths
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-68
False Paths
A false pathA timing path does not propagate a signalSTA identifies as a failing timing path
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-69
Multi-Cycle Paths --- A Trivial Example
// a multiple cycle examplemodule multiple_cycle_example(clk, data_a, data_b, …);…// trivial multiple-cycle operationsalways @(posedge clk) begin
qout_a <= data_a * 5;@(posedge clk) qout_b <= data_b + 3;@(posedge clk) qout_c <= data_c - 7;
end
Q: Explain the operation of above code
Chapter 13: Verification
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-70
Multi-Cycle Paths --- A Trivial Example