Lecture 3 Simulation and Testbench

Slides:



Advertisements
Similar presentations
Chapter 15:Introduction to Verilog Testbenches Objectives In this section,you will learn about designing a testbench: Creating clocks Including files Strategic.
Advertisements

Verilog.
Simulation executable (simv)
Supplement on Verilog adder examples
ELEN 468 Lecture 61 ELEN 468 Advanced Logic Design Lecture 6 Delay Models.
Verilog Modules for Common Digital Functions
16/04/20151 Hardware Descriptive Languages these notes are taken from Mano’s book It can represent: Truth Table Boolean Expression Diagrams of gates and.
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
1 Brief Introduction to Verilog Weiping Shi. 2 What is Verilog? It is a hardware description language Originally designed to model and verify a design.
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 6 – Part 1.
1 Verilog Digital Computer Logic Kashif Bashir WWW: http//:
Lecture 12 Latches Section Schedule 3/10MondayLatches (1) /12WednesdayFlip-flops5.4 3/13ThursdayFlip-flops, D-latch 3/17MondaySpring.
ELEN 468 Lecture 81 ELEN 468 Advanced Logic Design Lecture 8 Behavioral Descriptions II.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
ELEN468 Lecture 31 ELEN 468 Advanced Logic Design Lecture 3 Simulation and Testbench.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
 Delay values control the time between the change in a right-hand-side operand and when the new value is assigned to the left- hand side.  Three ways.
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
Module 1.2 Introduction to Verilog
Chap. 4 Modules and Ports. 2 Modules and Ports Modules Ports Hierarchical Names Summary.
Timing Model VHDL uses the following simulation cycle to model the stimulus and response nature of digital hardware Start Simulation Update Signals Execute.
3/4/20031 ECE 551: Digital System * Design & Synthesis Lecture Set 2 2.1: Verilog – The Basics 2.2: Verilog – Simulation and Testbenches.
Switch Level Modeling Part II 26 September Contents 1.Clarifications: a)nMOS and pMOS instantiations b)Testbenches for NOR gate example c)Use of.
ELEN 468 Lecture 131 ELEN 468 Advanced Logic Design Lecture 13 Synthesis of Combinational Logic II.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 4: Testing, Dataflow Modeling Spring 2009.
Introduction to Verilog Section Outline Set Up the Environment Your First Verilog File Set Up the Test Bench Running the Simulation.
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
ELEN 468 Lecture 171 ELEN 468 Advanced Logic Design Lecture 17 Midterm1 Review.
LECTURE V TEST BENCHES. As your projects become more complex and multiple modules are employed, it will no longer be possible to simulate them as we did.
Structural Description
Adapted from Krste Asanovic
Term Project: Overview
HDL simulation and Synthesis (Marks16)
EI205 Lecture 8 Dianguang Ma Fall 2008.
Discussion 2: More to discuss
Verilog Introduction Fall
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
VLSI Testing Lecture 5: Logic Simulation
‘if-else’ & ‘case’ Statements
Behavioral Modeling Structural modeling Behavioral modeling
Timing Model Start Simulation Delay Update Signals Execute Processes
Term Project: Overview
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages
D Flip-Flop.
Registers and Counters
Topics The logic design process..
Hardware Descriptive Languages these notes are taken from Mano’s book
For NTUEE Undergraduate
SYNTHESIS OF SEQUENTIAL LOGIC
Lecture 1.3 Hardware Description Languages (HDLs)
Registers and Counters
332:437 Lecture 8 Verilog and Finite State Machines
Test Fixture (Testbench)
332:437 Lecture 5 Verilog Tutorial
The Verilog Hardware Description Language
The Verilog Hardware Description Language
CS 153 Logic Design Lab Professor Ian G. Harris
The Verilog Hardware Description Language
332:437 Lecture 5 Verilog Tutorial
Registers and Counters
332:437 Lecture 5 Verilog Tutorial
Registers and Counters
332:437 Lecture 8 Verilog and Finite State Machines
COE 202 Introduction to Verilog
Registers and Counters
Presentation transcript:

Lecture 3 Simulation and Testbench Advanced Logic Design Lecture 3 Simulation and Testbench

Overview Analog simulation Event-driven logic simulation Signal levels in logic simulation Propagation delay Inertial delay Testbench

Analog Simulation Simulate waveforms Trace every signal at every time point at certain sampling rate Precise Long simulation time v t

Logic Simulation At any moment, most signals are quiescent Very few signal levels At any simulation time, trace only signals with transitions (event) Propagate events from inputs toward outputs In a logic simulator An ordered list of “event-times” At each even time, an event queue is maintained

X and Z a = b = 0: c = Z a = b = 1: c = X Initially, every line is X c 1 b a = b = 0: c = Z a = b = 1: c = X Initially, every line is X X is used in simulation. In real circuit, the value is determined by the circuit

Simulation without Delay X B X A C C D X B D X Y 0 10 20 30 40 50 tsim A = x B = x C = x D = x A = 1 B = 0 B = 1 A = 0 B = 0 C = 1 C = 0 C = 0 D = 0 D = 1 D = 1

Simulation with Delay 0 10 20 30 40 50 tsim 15 A X B X A C D C 3 2 X 13 B D X 0 10 20 30 40 50 15 tsim A = x B = x C = x D = x A = 1 B = 0 B = 1 A = 0 B = 0 C = 1 C = 0 C = 0 D = 0 D = 1 D = 1

Inertial Delay Delay is caused by charging and discharging node capacitors in circuit Gate delay and wire delay Pulse rejection If pulse with is less than delay, the pulse is ignored A C D B

Example of De-scheduling B A C D C 3 2 D B 10 20 30 40 50 T_sim 15 33 35 A=x B=x C=x D=x A=1 B=0 B=1 C=0 D=1 C=1 D=0 A=0 C=1

Testbench Stimulus generator Unit_Under_Test Design_Unit_Test_Bench Response monitor

Some New Keywords initial declares one-shot behaviors $monitor task is used to observe events $time returns simulation time $stop task stops execution and wait for interactive input $finish returns control to operating system

Example of NAND Latch module Nand_Latch_1 (q, qbar, preset, clear); 1 q_pre qbar_pre G1 preset q 1 qbar clear 1 G2 module Nand_Latch_1 (q, qbar, preset, clear); output q, qbar; input preset, clear; nand G1 (q, preset, qbar), G2 (qbar, clear, q); endmodule

Example of Testbench module test_Nand_Latch_1; reg preset, clear; wire q, qbar; Nand_Latch_1 M1 (q, qbar, preset, clear); // Instantiate UUT initial // Create response monitor $monitor ($time, "preset=%b clear=%b q=%b qbar=%b", preset, clear, q, qbar); initial begin // Create DUTB stimulus generator #10 preset = 0; clear = 1; #10 preset = 1; $stop; // Enter . to proceed #10 clear = 0; #10 clear = 1; #10 preset = 0; end #60 $finish; // Finish simulation endmodule G1 preset q 1 qbar clear 1 G2

Simulation Results tsim 0 10 20 30 40 50 tsim 0 10 20 30 40 50 G1 preset preset q 1 1 tsim 0 10 20 30 40 50 clear qbar 1 clear 1 G2 tsim 0 10 20 30 40 50 q 1 0 preset = x clear = x q = x qbar = x 10 preset = 0 clear = 1 q = x qbar = x 11 preset = 0 clear = 1 q = 1 qbar = x 12 preset = 0 clear = 1 q = 1 qbar = 0 20 preset = 1 clear = 1 q = 1 qbar = 0 30 preset = 1 clear = 0 q = 1 qbar = 0 31 preset = 1 clear = 0 q = 1 qbar = 1 32 preset = 1 clear = 0 q = 0 qbar = 1 40 preset = 1 clear = 1 q = 0 qbar = 1 tsim 0 10 20 30 40 50 qbar 1 tsim 0 10 20 30 40 50