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.

Slides:



Advertisements
Similar presentations
Verilog Section 3.10 Section 4.5. Keywords Keywords are predefined lowercase identifiers that define the language constructs – Key example of keywords:
Advertisements

ENEL111 Digital Electronics
Verilog.
Supplement on Verilog adder examples
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 07: Verilog (3/3) Prof. Sherief Reda Division of.
CPEN Digital System Design
Verilog Intro: Part 1.
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.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.

DON’T CARE CONDITIONS Functions that have unspecified output for some input combinations are called incompletely specified functions. Unspecified minterms.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
ECE 353 Computer Systems Lab I Verilog Hardware Description Language.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Hardware Description Language HDL. 2 Hardware Description Language HDL  Describes circuits and systems in text. −As a software program.  Can be processed.
Quad 2-to-1 Multiplexer Discussion D7.4 Example 7.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Lecture # 12 University of Tehran
 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.
Combinational Circuits
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
Combinational Logic. Digital Circuits Introduction Logic circuits for digital systems may be combinational or sequential. A combinational circuit.
CENG 241 Digital Design 1 Lecture 5 Amirali Baniasadi
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Chap. 4 Modules and Ports. 2 Modules and Ports Modules Ports Hierarchical Names Summary.
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
LECTURE VII SECTION 4.12 PART 1 MODELS OF COMBINATIONAL CIRCUITS.
LECTURE III INTRODUCTION TO HDL/VERILOG. HDL: Hardware Description Languages (Verilog for this class) are a way in which digital circuits can be described.
LECTURE IV MODELSIM. Go to the link listed below for a demonstration of how to begin working with Modelsim. The video shows you how to write a Verilog.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Introduction to ASIC flow and Verilog HDL
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 4: Testing, Dataflow Modeling Spring 2009.
Unit - 3 NUMBER SYSTEM AND CODES
 A test bench is an HDL program used for applying stimulus to an HDL design in order to test it and observe its response during simulation.  In addition.
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.
Unit1: Modeling & Simulation Module5: Logic Simulation Topic: Unknown Logic Value.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
LECTURE VI USER DEFINED PRIMITIVES GATE-LEVEL MODELING.
Full Adder Verilog(HO: wires/regs, always) Section 4.5 (Full adder)
Lecture 1 Gunjeet kaur Dronacharya group of institutions.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
Hardware Description Languages: Verilog
TODAY’S OUTLINE Verilog Codings Concurrent and Sequential If-else
Reg and Wire:.
Discussion 2: More to discuss
Verilog Introduction Fall
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
Chapter 4 Combinational Logic
Hardware Descriptive Languages these notes are taken from Mano’s book
Introduction to Verilog
Digital Logic & Design Dr. Waseem Ikram Lecture 13.
Lecture 1.3 Hardware Description Languages (HDLs)
Hardware Descriptive Languages these notes are taken from Mano’s book
Boolean Algebra.
مدار منطقی به نام یگانه مهندس هستی مهدی قدیری
Gates Type AND denoted by X.Y OR denoted by X + Y NOR denoted by X + Y
ECB2212-Digital Electronics Numbering Systems
Introduction to Digital IC Design
COE 202 Introduction to Verilog
Combinational Circuit Design
Presentation transcript:

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 in lecture IV. We will need to build" test benches". Test benches are modules which instantiate other module(s) and provide stimulus (inputs) and timing requirements to those modules. Consider the following example shown on pg 114, fig 3.2, a circuit with state propagation delays. // Verilog model of simple circuit with propagation delays module Simple_Circuuit_prop_delay (A,B,C,D,E); output D,E; input A,B,C; wire w1; and #(30) G1 (w1, A, B); not #(10) G2 (E,C); or #(20) G3 (D, w1, E); endmodule

//Test bench for Simple_Circuit_prop_delay module tb_Simple_Circuit_prop_delay; wire D,E; // keyword 'wire' is used to define outputs in test benches reg A,B,C; // keyword 'reg' is used to define inputs in test benches Simple_Circuit_prop_delay M1 (A,B,C,D,E); // Instance name (M1) required initial begin A = 1'b0; B = 1'b0; C = 1'b0; //note the individual semicolons used #100 A = 1'b1; B = 1'b1; C = 1'b1; // "#100" is 100 time units later in the simulation end initial #200 $stop; // Use stop instead of finish. Indicates the end of simulation endmodule

Note: every instantiation of a module requires a unique identifier, e.g. M1, M2, M3, etc. placed immediately after the modules name. The TB keyword initial is used to indicate instructions sent directly to the simulator. If the TB keywords begin and end are used after the TB keyword initial, the instructions included between them are executed sequentially, Left to Right, Top to Bottom. This list of statements is known as a "block statement". As mentioned above I suggest using the TB keyword $stop rather than $finish as $finish will kick you out of the simulation, probably before you are ready to leave it. The initial #200 $stop; line tells the simulator to stop executing 200 time at 200 time units past the starting point. Note: Instruction listed between a begin and end are indeed executed sequentially, but the entire test bench module is executed simultaneously. So, for example, if you had written the initial #200 $stop; as initial #50 $stop, the module would never have gotten to the #100 A = 1'b1; B = 1'b1; C = 1b'1; line. The simulation would have ended at 50 time units.

BOOLEAN EXPRESSIONS Defining Boolean expressions requires the use of the keyword "assign” along with specific symbols used to represent the various logic operators. To wit: To indicate an AND gate, use && To indicate an OR gate, use || To indicate a NOT gate, use ! For example the Boolean expression: E= A + BC + B'D becomes: assign E= A || (B&&C) + (!B&&D); in Verilog speak. Likewise, F= B'C + BC'D' becomes: assign F= (!B&&C) || (B&&(!C)&&(!D)); Note: Notice that the ! comes before the variable name as opposed to the ' coming after the variable name when expressed in Boolean form. e.g. !D as opposed to D' Also, a very common error when writing complex Boolean expressions is to forget an ")" or two. A good idea is to count the left "("s and the right ")"s and make sure that you have an equal number of both.