chapter 13: verification - wiley: · pdf filechapter 13: verification ... architecture of hdl...

70
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

Upload: hoangxuyen

Post on 13-Mar-2018

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 2: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 3: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 4: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 5: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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)

Page 6: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 7: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 8: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 9: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 10: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 11: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

Chapter 13: Verification

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-11

Simulation-Based Verification

Page 12: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 13: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 14: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 15: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 16: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 17: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 18: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 19: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

Chapter 13: Verification

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-19

An Architecture of HDL Simulators

Page 20: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 21: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 22: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

Chapter 13: Verification

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-22

An Event-Driven Simulation

Page 23: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 24: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 25: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 26: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 27: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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…

Page 28: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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…

Page 29: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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];

Page 30: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 31: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 32: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 33: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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;

Page 34: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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;

Page 35: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 36: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 37: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 38: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 39: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 40: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 41: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 42: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 43: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 44: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 45: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 46: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 47: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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)

Page 48: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 49: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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);

Page 50: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 51: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 52: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

Chapter 13: Verification

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010, John Wiley 13-52

The ISE Design Flow

Page 53: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 54: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 55: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 56: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 57: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 58: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 59: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 60: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 61: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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)

Page 62: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 63: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 64: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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)

Page 65: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 66: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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)

Page 67: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 68: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 69: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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

Page 70: Chapter 13: Verification - Wiley: · PDF fileChapter 13: Verification ... Architecture of HDL simulators Test bench design ... John Wiley 13-27 Test Bench Designs --- A Trivial Example

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