Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania 18042 ECE 491 - Senior Design I Lecture 7 - Verification.

Slides:



Advertisements
Similar presentations
The Design Process, RTL, Netlists, and Verilog
Advertisements

Simulation executable (simv)
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Combinational Logic.
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 07: Verilog (3/3) Prof. Sherief Reda Division of.
Verilog Intro: Part 1.
ECE 551 Digital System Design & Synthesis Lecture 08 The Synthesis Process Constraints and Design Rules High-Level Synthesis Options.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
CSE241 Formal Verification.1Cichy, UCSD ©2003 CSE241A VLSI Digital Circuits Winter 2003 Recitation 6: Formal Verification.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Sequential Design.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 7 - Synchronizers.
Kazi Spring 2008CSCI 6601 CSCI-660 Introduction to VLSI Design Khurram Kazi.
Spring 07, Feb 6 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2007 Verification Vishwani D. Agrawal James J. Danaher.
02/02/20091 Logic devices can be classified into two broad categories Fixed Programmable Programmable Logic Device Introduction Lecture Notes – Lab 2.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 6 - Verilog Coding.
ECE 353 Computer Systems Lab I Verilog Hardware Description Language.
CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: Verilog Introduction.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Verilog 2 (Sequential.
2/9/2007EECS150 Lab Lecture #41 Debugging EECS150 Spring2007 – Lab Lecture #4 Laura Pelton Greg Gibeling.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 4 - Advanced Verilog.
EE694v-Verification-Lect5-1- Lecture 5 - Verification Tools Automation improves the efficiency and reliability of the verification process Some tools,
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 5 - Verification.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 6 - Behavioral Modeling.
Principle of Functional Verification Chapter 1~3 Presenter : Fu-Ching Yang.
02/10/06EECS150 Lab Lecture #41 Debugging EECS150 Spring 2006 – Lab Lecture #4 Philip Godoy Greg Gibeling.
VerificationTechniques for Macro Blocks (IP) Overview Inspection as Verification Adversarial Testing Testbench Design Timing Verification.
Overview Logistics Last lecture Today HW5 due today
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
Simulation Management. Pass or Fail? Managing Simulations Regression Behavioral Models.
1 VERILOG Fundamentals Workshop סמסטר א ' תשע " ה מרצה : משה דורון הפקולטה להנדסה Workshop Objectives: Gain basic understanding of the essential concepts.
ASIC/FPGA design flow. FPGA Design Flow Detailed (RTL) Design Detailed (RTL) Design Ideas (Specifications) Design Ideas (Specifications) Device Programming.
Some Course Info Jean-Michel Chabloz. Main idea This is a course on writing efficient testbenches Very lab-centric course: –You are supposed to learn.
Advanced Digital Circuits ECET 146 Week 5 Professor Iskandar Hack ET 221G, Me as I typed this slides.
Using Formal Verification to Exhaustively Verify SoC Assemblies by Mark Handover Kenny Ranerup Applications Engineer ASIC Consultant Mentor Graphics Corp.
SoC Verification HW #2 TA: Wei-Ting Tu Assignment: 04/12/06
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
Digital System Verification. VERIFICATION OUTLINE Purpose of Verification –Verification effort and cost Verification Tools –Linting tools –Code Coverage.
CS 61C L4.2.2 Verilog II (1) K. Meinz, Summer 2004 © UCB CS61C : Machine Structures Lecture Verilog II Kurt Meinz inst.eecs.berkeley.edu/~cs61c.
EE694v-Verification-Lect10-1- Lect 10 - Stimulus & Response Applying input stimulus to a design Creating clock signals Other waveforms Synchronizing inputs.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 9 - Coding Guidelines.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Chuck Benz ASIC & FPGA Design csrGen: Automated CSRs for ASIC/FPGA Processor Interfaces Chuck Benz Chuck Benz ASIC & FPGA Design
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
An Overview of Hardware Design Methodology Ian Mitchelle De Vera.
1 Extending FPGA Verification Through The PLI Charles Howard Senior Research Engineer Southwest Research Institute San Antonio, Texas (210)
Verification – The importance
ELEE 4303 Digital II Introduction to Verilog. ELEE 4303 Digital II Learning Objectives Get familiar with background of HDLs Basic concepts of Verilog.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Lecture 1 – Overview (rSp06) ©2008 Joanne DeGroat, ECE, OSU -1- Functional Verification of Hardware Designs EE764 – Functional Verification of Hardware.
M.Mohajjel. Objectives Learn How to write synthesizable Verilog code Common mistakes and how to avoid them What is synthesized for what we code Digital.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 4: Testing, Dataflow Modeling Spring 2009.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
04/21/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Functional & Timing Verification 10.2: Faults & Testing.
Lecture 5: Design for Testability. CMOS VLSI DesignCMOS VLSI Design 4th Ed. 12: Design for Testability2 Outline  Testing –Logic Verification –Silicon.
Lecture 5. Verilog HDL #3 Prof. Taeweon Suh Computer Science & Engineering Korea University COSE221, COMP211 Logic Design.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
Digital System Verification
Introduction to Verilog
EECS150 Fall 2007 – Lab Lecture #4 Shah Bawany
Debugging EECS150 Fall Lab Lecture #4 Sarah Swisher
Lecture 9: Testbench and Division
Debugging EECS150 Fall Lab Lecture #4 Sarah Swisher
Digital Design Verification
COE 202 Introduction to Verilog
Lecture 7: Verilog Part II
Presentation transcript:

Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 7 - Verification & Testbenches Fall 2008 Read Verilog Handout Sections 7-10

ECE 491 Fall 2008Lecture 8 - Verification2 Where we are  Last Time:  Simulation  Delay modeling  initial blocks  Functions  Tasks  Today:  Verification and Testbenches  Discuss Lab 3

ECE 491 Fall 2008Lecture 8 - Verification3 Verification  Goal of verification:  Demonstrate functional correctness of a design  Attempt to find design errors  Attempt to show that design implements specification  Importance of Verification  Costs of design errors can be high (think “Pentium Floating-Point Error” ~ $300M!)  According to [1], verification consumes about 70% of design effort [1] J. Bergeron, Writing Testbenches: Functional Verification of HDL Models Kluwer Academic Publishers, 2000.

ECE 491 Fall 2008Lecture 8 - Verification4 Verification - Reconvergence Model  Verification checks a “transformation” for correctness  RTL Design and Coding  Synthesis  Physical Design  Reconvergence Model: Initial Specification Transformation Result Transformation

ECE 491 Fall 2008Lecture 8 - Verification5 Verification ≠ Testing  Verification identifies design errors  Does the design correctly implement the specification?  Does it perform calculations correctly?  Performed before manufacturing  Testing identifies manufacturing faults  Does each chip function properly?  Applied after manufacturing Specification Netlist Design Verification Manufacturing Testing Silicon

ECE 491 Fall 2008Lecture 8 - Verification6 Verification of RTL Design  The Idea: Written Specification RTL Code RTL Coding Verification  How it Really Works: Written Specification RTL Code RTL Coding Verification Interpretation

ECE 491 Fall 2008Lecture 8 - Verification7 Redundancy in Verification  Use separate individuals for design, verification Written Specification Verification RTL Code RTL Coding Designer Interpretation Verifier Interpretation

ECE 491 Fall 2008Lecture 8 - Verification8 Verification Tools  Simulators and Testbenches  Hardware Prototyping  Other Tools (we won’t use these)  Linting Tools  Code Coverage Tools  Formal Verification Tools  Version Control  Issue Tracking

ECE 491 Fall 2008Lecture 8 - Verification9 Simulators  Allow testing of system response to stimulus  Event-driven - including delay models  Cycle-level - one evaluation per clock cycle  Simulation Tools  Waveform viewer  Testbenches - provide stimulus, check response  3rd party models - simulate existing designs Full models Bus-functional models  Limitations of simulation  Can’t be exhaustive for non-trivial designs  Performance bottleneck

ECE 491 Fall 2008Lecture 8 - Verification10 Testbenches  A testbench (test fixture) is HDL code to verify a module  Apply input vectors to module inputs  Check module outputs  Report errors to user  Why use a testbench instead of Verilogger TDE?  Portability - testbench will work on any HDL simulator  Automatic checking - don't have to interpret waveform  Expressability - can use the full semantics of HDL to: generate input vectors (possibly from input file) check output vectors control simulation

ECE 491 Fall 2008Lecture 8 - Verification11 Coding Testbenches in Verilog HDL Module Instance: Device Under Verification (DUV) Testbench Module

ECE 491 Fall 2008Lecture 8 - Verification12 Testbench Approaches - Visual Inspection Device under Verification (DUV) Stimulus Generator Testbench File Waveform Viewer OR Text Output

ECE 491 Fall 2008Lecture 8 - Verification13 Testbench Approaches - Output Comparison Device under Verification (DUV) Testbench File Reference Model Stimulus Generator Output Comparator Error/Status Messages “Gold” Vectors

ECE 491 Fall 2008Lecture 8 - Verification14 Testbench Approaches - Self-Checking Device under Verification (DUV) Stimulus Generator Output Signals Input Signals Testbench File Output Checker Error/Status Messages

ECE 491 Fall 2008Lecture 8 - Verification15 Comparing Approaches  Visual inspection  Only practical for small designs  Automatic support: Verilogger timing diagram editor  Output comparison  Effective when a good reference model is available  Used by ASIC foundries - “Gold” vectors are contractual specification of a “functional” chip  Self-checking (our focus)  Most difficult to code  Mandatory for large designs

ECE 491 Fall 2008Lecture 8 - Verification16 Coding Testbenches  Use simulation features of HDL  initial blocks  Functions & tasks  System Tasks

ECE 491 Fall 2008Lecture 8 - Verification17 Verilog Testbench Design  General approach:  Use initial block to apply vectors  Use # delay operator to sequence input changes in time operator to synchronize with clock  Use $display to show output, print messages  Common variations  Write a task (procedure) to do common checking  Use a separate always block to generate the clock

ECE 491 Fall 2008Lecture 8 - Verification18 Testbench Example - Comb. Logic  Develop a testbench for a comparator module module compare (a, b, aeqb, agtb, altb); input [7:0] a, b; output aeqb, agtb, altb; assign aeqb = (a == b); assign agtb = (a > b); assign altb = (a < b); endmodule  Do a simple test - no checking (yet)

ECE 491 Fall 2008Lecture 8 - Verification19 Testbench for Compare Module module compare_bench; reg [7:0] a, b; wire aeqb, agtb, altb; compare DUV(a,b,aeqb,agtb,altb); initial begin a = 0; b = 0; #10 a = 1; b = 0; #10 a = 255; b = 5; #10 b = 255; #10 a = 127; #10 $stop(); end // initial endmodule

ECE 491 Fall 2008Lecture 8 - Verification20 Testbench Example - Sequential Logic  Develop a testbench for this BCD counter: module bcdcounter(clk, reset, enb, Q, carry); input clk, reset, enb; output [3:0] Q; output carry; reg [3:0] Q; // a signal that is assigned a value assign carry = (Q == 9) & enb; posedge clk ) begin if (reset) Q <= 4'd0; else if (enb) begin if (carry) Q <= 0; else Q <= Q + 1; end endmodule

ECE 491 Fall 2008Lecture 8 - Verification21 BCD Counter Testbench - Design Ideas  Use a separate always statement to drive clock (must set at beginning of initial block)  Write a task to check values  Use $display system task for error messages

ECE 491 Fall 2008Lecture 8 - Verification22 Testbench for BCD Counter module bcdcounter_bench; // signals for connecting the counter reg clk; reg reset; reg enb; wire [3:0] Q; wire carry; // testbench variables; integer i; // counter instance bcdcounter DUT(.clk(clk),.reset(reset),.enb(enb),.Q(Q),.carry(carry));

ECE 491 Fall 2008Lecture 8 - Verification23 Testbench for BCD Counter (cont'd) task check; input [3:0] Q, check_Q; input carry, check_carry; begin if (Q != check_Q) $display("Error at time %t: Expected Q=%d, Actual Q=%d", $time, check_Q, Q); if (carry != check_carry) $display("Error at time %t: Expected carry=%d, Actual carry=%d", $time, check_carry, carry); end endtask // note clock drives both counter and bench always begin clk = 0; #5 clk = 1; #5 ; end

ECE 491 Fall 2008Lecture 8 - Verification24 Testbench for BCD Counter (cont'd) initial begin reset = 0; enb = clk); // do a reset and check that it worked reset = clk); check(Q,0,carry,0); // now try counting a few cycles #1 reset = 0; #1 enb = 1; for (i=0; i<9; i=i+1) clk); check(Q,i,carry,0); // exhaustively test counter end

ECE 491 Fall 2008Lecture 8 - Verification25 Testbench for BCD Counter (cont'd) // now check the carry count should be clk); check(Q,9,carry,1); // now check the clk); check(Q,0,carry,0); // intentional error - count !=2, carry != clk) check(Q,2,carry,0); check(Q,1,carry,1); repeat clk); #1 check(Q,9,carry,1); #5 enb = 0; #2 check(Q,9,carry,0); repeat clk); $stop(); // all done! end // initial endmodule

ECE 491 Fall 2008Lecture 8 - Verification26 Testbench Design  How do we verify designs that are too large for exhaustive simulation?  Identify key features How do we exercise? What is correct response?  Identify “Corner cases” Initial conditions “Boundaries” between modes of operation  Ensure code coverage Does testbench exercise all of the Verilog code? Commerical coverage tools help this process  Use random inputs to test unanticipated cases

ECE 491 Fall 2008Lecture 8 - Verification27 Verification of Large Designs  Create a verification plan which specifies  Features necessary for first-time success Prioritization of features - essential vs. optional Which features should be exercised What the response should be  Testcases to exercise features  Process for reporting and fixing bugs  Implement testbenches for each testcase  Report bugs & fix  Big question: when are you done?

ECE 491 Fall 2008Lecture 8 - Verification28 Lab 3 Overview  Self-checking testbench for generic counter  Identify important features  Create conditions that test these features  Check conditions  Write message when error occurs  “Insert” errors to demonstrate when self-check fails  Test for varying values of N (e.g. 8, 10, 16)  Self-checking testbench for clock divider  Verify divide by 50,000 function (note typo in handout)  Verify 50% duty cycle

ECE 491 Fall 2008Lecture 8 - Verification29 More about Testbenches  Testbenches are essential in large designs  Design team may include hundreds of people, who work on different subsystems  Testbenches allow semi-automatic checking when different subsystems are changed (regression)  Chip design groups do this with "simulation farms"

ECE 491 Fall 2008Lecture 8 - Verification30 Instance of M2 Instance of M3 Instance of M1 Definition of Module M4 Testbenches in Hierarchical Design  Example Hierarchy  Module M4 - Top-level module  Modules M1, M2, M3 - used as instances in M4  Create testbenches for all modules M1, M2, M3, M4  What if we change M2?  First run M2 testbench  Next, run M4 testbench

ECE 491 Fall 2008Lecture 8 - Verification31 Functional Verification Approaches  Black box  Verify using module I/O ports only  No knowledge of implementation  No access to internals  White box  Verify using module I/O ports and internals  Full knowledge of implementation  Full access to internals during simulation  Gray box  Verify using module I/O ports only  Full knowledge of implementation  No access to internals during simulation

ECE 491 Fall 2008Lecture 8 - Verification32 Linting Tools  Key idea: check code for potential problems that are legal HDL but not desirable, e.g.:  Latch inferences  Wire size mismatches  Implicit declarations  Types of Linting Tools  Commercial tools  Code reviews - peer review  Limitations  Sometimes report non-problems  Can’t look beyond syntax - “spell checker” analogy

ECE 491 Fall 2008Lecture 8 - Verification33 Code Coverage Tools  Key idea: check that all code is simulated  Check that all lines of code are exercised in simulation  Check that all paths through conditionals are exercise  Coverage tool function  Insert reporting code into HDL model  Summarize coverage & report to user  Key metric % coverage  Limitations  100% coverage difficult to accomplish  No guarantee of correctness

ECE 491 Fall 2008Lecture 8 - Verification34 Other Verification Tools  Verification languages (e.g. e, Vera)  Used to specify and generate testbenches  Abstraction used to increase productivity  Focus on constrained random stimulus  Revision control - used as in software engineering  Formal Verification  Equivalence checking - prove that input, output are equivalent  Model checking - Prove assertions concerning design properties, e.g. Reachability of states Deadlock avoidance Completion of transaction in an interface