Digitaalsüsteemide disain

Similar documents
ECOM 4311 Digital System Design using VHDL. Chapter 7

Hardware Synthesis. References

Hardware Synthesis. Midia Reshadi. CE Department Science and research branch of Islamic Azad University

ECE 545 Lecture 4. Simple Testbenches. George Mason University

Inthis lecture we will cover the following material:

CDA 4253 FPGA System Design VHDL Testbench Development. Hao Zheng Comp. Sci & Eng USF

Digital Systems Design

Digital Systems Design

Specifying time in VHDL

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

LANGUAGE VHDL FUNDAMENTALS

Introduction to VHDL. Main language concepts

Data types defined in the standard package

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification Part II

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Experiment 8 Introduction to VHDL

VHDL. Chapter 7. Behavioral Modeling. Outline. Behavioral Modeling. Process Statement

Test Benches - Module 8

VHDL Simulation. Testbench Design

Design units can NOT be split across different files

Concurrent Signal Assignment Statements (CSAs)

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

Lecture 4. VHDL Basics. Simple Testbenches

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification

Hardware Modeling. VHDL Syntax. Vienna University of Technology Department of Computer Engineering ECS Group

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

EEL 4783: Hardware/Software Co-design with FPGAs

Lecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN

ECE 3401 Lecture 10. More on VHDL

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

Tutorial on Simulation using Aldec Active-HDL Ver 1.0

Basic Language Constructs of VHDL

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

Review. LIBRARY list of library names; USE library.package.object; ENTITY entity_name IS generic declarations PORT ( signal_name(s): mode signal_type;

BASIC VHDL LANGUAGE ELEMENTS AND SEMANTICS. Lecture 7 & 8 Dr. Tayab Din Memon

Lecture 38 VHDL Description: Addition of Two [5 5] Matrices

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

Lecture 4. VHDL Fundamentals. George Mason University

Experiment 0 OR3 Gate ECE 332 Section 000 Dr. Ron Hayne June 8, 2003

VHDL And Synthesis Review

The process. Sensitivity lists

ENGIN 241 Digital Systems with Lab

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :

Lecture 3 Introduction to VHDL

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009

Sign here to give permission to return your test in class, where other students might see your score:

EE261: Intro to Digital Design

2/14/2016. Hardware Synthesis. Midia Reshadi. CE Department. Entities, Architectures, and Coding.

C-Based Hardware Design

Sequential VHDL. Katarzyna Radecka. DSD COEN 313

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture

VHDL/Verilog Simulation. Testbench Design

Introduction to VHDL. Prof. Vanderlei Bonato - 10/10/16 1

VHDL 200X: The Future of VHDL

VHDL: skaitmeninių įtaisų projektavimo kalba. 2 paskaita Pradmenys

OUTLINE SYSTEM-ON-CHIP DESIGN. GETTING STARTED WITH VHDL September 3, 2018 GAJSKI S Y-CHART (1983) TOP-DOWN DESIGN (1)

Basic Language Concepts

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006

Department of Technical Education DIPLOMA COURSE IN ELECTRONICS AND COMMUNICATION ENGINEERING. Fifth Semester. Subject: VHDL Programming

Lecture 4. VHDL Fundamentals. Required reading. Example: NAND Gate. Design Entity. Example VHDL Code. Design Entity

PART I BASIC DIGITAL CIRCUITS

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

Digital Systems Design

Declarations of Components and Entities are similar Components are virtual design entities entity OR_3 is

Introduction to VHDL #1

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

JUNE, JULY 2013 Fundamentals of HDL (10EC45) PART A

Chapter 2 Basic Logic Circuits and VHDL Description

VHDL simulation and synthesis

Lecture 14 Test Bench Design

The University of Alabama in Huntsville ECE Department CPE Midterm Exam February 26, 2003

Chapter 6 Combinational-Circuit Building Blocks

TKT-1212 Digitaalijärjestelmien toteutus. Lecture 7: VHDL Testbenches Ari Kulmala, Erno Salminen 2008

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements

Assignment 01 Computer Architecture Lab ECSE

VHDL Testbench Design. Textbook chapters 2.19, , 9.5

What Is VHDL? VHSIC (Very High Speed Integrated Circuit) Hardware Description Language IEEE 1076 standard (1987, 1993)

ECEU530. Schedule. ECE U530 Digital Hardware Synthesis. Datapath for the Calculator (HW 5) HW 5 Datapath Entity

Designing with VHDL and FPGA

ECE 545 Lecture 7. Advanced Testbenches. Required reading. Simple Testbench. Advanced Testbench. Possible Sources of Expected Outputs

Part IV. Behavioural Description Using VHDL

ECE 545 Lecture 7. Advanced Testbenches. George Mason University

University of Twente. VHDL tutorial For internal use only. Faculty of Electrical Engineering, Mathematics and Computer Science. E.

HIERARCHICAL DESIGN. RTL Hardware Design by P. Chu. Chapter 13 1

Outline HIERARCHICAL DESIGN. 1. Introduction. Benefits of hierarchical design

Contents. Appendix D VHDL Summary Page 1 of 23

Programmable Logic Design Grzegorz Budzyń Lecture. 4: Introduction to VHDL

CPE/EE 422/522. Chapter 8 - Additional Topics in VHDL. Dr. Rhonda Kay Gaede UAH. 8.1 Attributes - Signal Attributes that return a value

VHDL: A Crash Course

A bird s eye view on VHDL!

Symbolically the RS-Latch that is being simulated is the one shown below, it s truth table is also given:

VHDL Packages for Synthesis Base Types Standard bit types may be used Typically IEEE 1164 Std. types are used. CPE 528: Session #9

VHDL for Complex Designs

CMPT 250: Computer Architecture. Using LogicWorks 5. Tutorial Part 1. Somsubhra Sharangi

VHDL Examples Mohamed Zaky

Transcription:

IAY 0600 Digitaalsüsteemide disain VHDL discussion Verification: Testbenches Design verification We want to verify that our design is correct before the target PLD is programmed. The process performed to accomplish this is design verification. An advantage of using VHDL is that the is written in the same language as the design description. Since a testbench is not synthesized, it can be written using any of the constructs and features of VHDL. There are two basic things that we need to verify One is that our design achieves its intended functionality. The other is that our design, after being synthesized and mapped to the target PLD, will meet its timing requirements. Tallinn University of Technology 2 Typical constituents of a simple testbench Self-checking testbench 1. UUT (Unit Under Test) For a functional verification, the design description is the UUT. For a timing verification, the VHDL timing model generated by the place-and-route tool is the UUT. 2. Stimulus generator. For combinational designs, only combinations of the values of 0 and 1, or sequences of combinations are applied. 3. Response monitor. In response to each stimulus, the UUT output values must be checked to verify that they are identical to the expected. 3 4 Testbench development The stimulus must not contain any metalogical or highimpedance values. Logical values L and H are replaced by 0 and 1, respectively. As a result, only combinations of the values 0 and 1 are applied as stimulus. 1. Determine the intent of the design from its specification. 2. Determine a strategy for verification of the design. 3. Determine the stimulus needed to achieve the design verification. 4. Create a model that represents the intent of the design. 5. Create the stimulus generator. 6. Evaluate the adequacy of the verification. 5 What is actually being verified? Our determination of the intent of system from its natural language specification is our personal interpretation of that specification. Ideally, the final testbench for a design is developed and written by persons other than those who wrote the design description. Since a combinational design s outputs at any time are a function only of its inputs at that time, the order in which input combinations are applied does not affect the verification results. For a combinational design, an exhaustive verification requires the application, in any order, for a UUT with n inputs 2 n possible input combinations. In contrast, exhaustive verification of a sequential design requires that every possible sequence of input combinations be applied to the UUT (exhaustive verification is impractical). 6

Testbench using projected waveforms The simplest testbench don t include code for a response monitor or an intent model. They just apply stimulus to the UUT. We must the visually verify UUT output values by inspecting waveforms using the simulator s waveform editor. Signals are projected waveforms (a signal has a current value, and future scheduled values). Two simple ways of generating a stimulus are: Using a projected signal assignment Using a process with wait statements In order to simulate the operation of a UUT using a testbench, we must actually simulate a testbench, since the UUT is simply a component in the testbench. 7 Testbench of a half adder library ieee ; use ieee.std_logic_1164.all ; architecture waveform of testbench is entity testbench is --testbench entity has no ports end testbench ; -- stimulus signals signal a_tb, b_tb : std_logic ; signal sum_tb, carry_out_tb : std_logic ; -- UUT port map; the label uut as name is not significant UUT : entity half_adder port map ( a => a_tb, b => b_tb, -- generating stimulus values a_tb <= '0', '1' after 40 ns ; b_tb <= '0', '1' after 20 ns, '0' after 40 ns, '1' after 60 ns ; end waveform ; 8 Statement with multiple waveform elements Timing waveform from example simulation The execution of assignment statement with multiple waveform elements results in a sequence of transactions being posted to the target signal s driver. The optional after clause specifies when its associated value should become the new value of a signal. Transactions in the signal assignment statement must be in ascending order with respect to time. After clauses are not synthesizable. 9 10 Physical types Physical types are numeric types used to represent realworld physical quantities such as time, frequency, voltage, and current. Type time is the only predefined physical type. It is used extensively to specify delays. Type time is declared in package STANDARD. type time is range implementation_defined units fs; -- femtosecond ps = 1000 fs; --picosecond ns = 1000 ps; --nanosecond us = 1000 ns; --microsecond ms = 1000 us; --millisecond sec = 1000 ms; --second min = 60 sec; --minute hr = 60 min; --hour end units ; 11 Single process testbench A single process testbench includes a process that applies a stimulus to the UUT, waits an appropriate length of time, and then checks the UUT outputs. The wait between applying each stimulus results in waveform being generated. The functionality of the stimulus generator and response monitor are provided by the single process. A single process testbench has two concurrent statements in its architecture body: One instantiates the UUT. The other is the process that applies the stimulus and verifies the UUT output values Since the UUT instantiation and the process are both concurrent statements, either one can appear first in the architecture body (however, instantiation of the UUT first is the more common practice). 12

Testbench for a half adder (architecture)-1 architecture waveform of testbench is -- Declare local signals to assign values to and to observe signal a_tb, b_tb : std_logic ; sum_tb, carry_out_tb : std_logic ; -- Create an instance of the circuit to be tested uut: entity half_adder port map ( a => a_tb, b => b_tb, -- Define a process to apply input stimulus and verify outputs tb : process constant period: time := 20 ns ; --Apply every posiible input combination a_tb <= '0' ; b_tb <= '0' ; assert ((sum_tb = '0' and (carry_out_tb = '0')) report "test failed for input combination 00" severity error ; 13 Testbench for a half adder (architecture)-2 a_tb <= '0' ; b_tb <= '1' ; assert ((sum_tb = '1' and (carry_out_tb = '0')) report "test failed for input combination 01" severity error ; a_tb <= '1' ; b_tb <= '0' ; assert ((sum_tb = '1' and (carry_out_tb = '0')) report "test failed for input combination 10" severity error ; a_tb <= '1' ; b_tb <= '1' ; assert ((sum_tb = '0' and (carry_out_tb = '1')) report "test failed for input combination 11" severity error ; wait ; -- indefinitely suspend process end process ; end ; 14 Wait statements in a testbench The use of a wait statement to produce a delay between the application of each stimulus, and the use of an assertion statement to automatically verify the UUT s response, is common practice. There are three reasons why the wait statement is required (for our example): 1) the signal assignment can not take effect until after process suspends 2) waiting for a time interval allows the new input values to appear in the simulator waveforms for this time period 3) the wait statements allow this same testbench to be used later, without modification, for timing simulation (after design being synthesized and mapped). Wait statements A process with no wait statement (or sensitivity list) executes its statements in sequence, starting at the first statement. After the last statement in the process is executed, the process immediatelly continues executution at the first statement, forming an infinite loop. As a result, the process never suspends. A wait statement suspends and resumes execution of the process containing the statement. Std 1076.6 2004 supports synthesis of all wait statements, except wait for statements. Std 1076.6 1999 only allowed wait until statement per process for synthesis. 15 16 Wait statements If only one, or none, of the optional clauses is included, four forms result: wait on sensitivity_list; wait until boolean_expression; wait for time expression; wait; When an event occures on any one of signals of sensitivity list (or in the boolean expression), the process resumes execution. 17 Assertion statements in a testbench Use of assertion statements eliminate the need to visually inspect timing waveforms. In half_adder example the condition in the assertion statement requires that: ((sum_tb = '0' and (carry_out_tb = '0')) If this condition is true, the next message in the process is executed (without any message). If it is false, the message "test failed for input combination 00 is generated and severity level error is assigned. The message aids debugging by making it clear for which input combination the failure occurred. 18

Assertion and report statements An assertion statement checks whether a specified a specified condition (the assertion) is true. If it is not true, a message is displayed. This approach can eliminate the need to visually inspect simulator waveforms. A severity level indicates the degree to which an assertion violation affects operation of the system and what actions the simulator must take. Type severity_level is predefined in package STANDARD as: type severity_level is (note, warning, error, failure); Severity levels Note is simply used to display informative messages during a simulation Warning is used to indicate an unusual situation where the simulation can continue but may produce unusual results Error is used to indicate a situation where corrective action should be taken Failure is used to indicate a situation that should never arise If severity clause is omitted, the default level is error 19 20 In previous testbenches, expected output values were predetermined for each input combination and included in the testbench as literals. Alternatively, a testbench can be written so that the expected output values are computed during the simulation. In a single process testbench, the same process is used to apply stimulus and compute and verify expected results. library ieee ; use ieee.std_logic_1164.all ; use ieee.numeric_std.all ; entity testbench is end testbench ; architecture behavior of testbench is -- Declare signals to assign values to and to observe signal a_tb, b_tb, sum_tb, carry_out_tb : std_logic ; -- Create an instance of the circuit to be tested uut: entity half_adder port map ( a => a_tb, b => b_tb, 21 22 -- Define a process to apply input stimulus and test outputs tb : process constant period: time := 20 ns ; constant n : integer := 2 ; --Apply every posiible input combination for i in 0 to 2**n - 1 loop (a_tb, b_tb) <= to_unsigned (i, n) ; assert ((sum_tb = (a_tb xor b_tb)) and (carry_out_tb = (a_tb and b_tb))) report "test failed" severity error ; end loop ; wait ; -- indefinitely suspend process end process ; end ; 23 Using function to_unsigned This function has two parameters. The first parameter is the integer to be converted. The second is the length of the returned unsigned vector. This vector s element values are the binary equivalent of the integer value passed to the function. In the statement (a_tb, b_tb) <= to_unsigned (i, n) ; the unsignet vector value returned by the to_unsigned function is assigned to an aggregare made up of the scalar input signals. Since each of these scalar inputs is type std_logic, the assignment is valid. The type unsigned is defined in pakcage NUMERIC_STD. type unsigned is array (natural range < >) of std_logic; 24

Type conversion To make an assignment of the value of one type to one of the others, the type of the value being assigned must be converted to the target type. For example, if signal x is declared as type std_logic_vector and signal y is declared as type unsigned, and they are of equal length, each of the following assignments is illegal: x <= y ; --illegal assignment, type conflict y <= x ; --illegal assignment, type conflict However, appropriate type conversions allow the following assignments to be made: x <= std_logic_vector (y) ; -- valid assignment y <= unsigned (x) ; -- valid assignment 25