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

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

ECE 545 Lecture 4. Simple Testbenches. George Mason University

Quartus Counter Example. Last updated 9/6/18

Chapter 8 VHDL Code Examples

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

EENG 2910 Project III: Digital System Design. Due: 04/30/2014. Team Members: University of North Texas Department of Electrical Engineering

VHDL Simulation. Testbench Design

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

[VARIABLE declaration] BEGIN. sequential statements

Test Benches - Module 8

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

Constructing VHDL Models with CSA

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University

In our case Dr. Johnson is setting the best practices

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

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Tutorial on Simulation using Aldec Active-HDL Ver 1.0

VHDL/Verilog Simulation. Testbench Design

EE261: Intro to Digital Design

Hardware Description Language VHDL (1) Introduction

Sequential Statement

VHDL Testbench Design. Textbook chapters 2.19, , 9.5

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Summary of FPGA & VHDL

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles

COE Design Process Tutorial

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

Lecture 6. Advanced Testbenches. George Mason University

Solutions - Homework 2 (Due date: October 9:30 am) Presentation and clarity are very important!

CPE 626 Advanced VLSI Design Lecture 6: VHDL Synthesis. Register File: An Example. Register File: An Example (cont d) Aleksandar Milenkovic

ENGR 5865 DIGITAL SYSTEMS

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

The Optimization of a Design Using VHDL Concepts

Digitaalsüsteemide disain

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

Introduction to Xilinx Vivado tools

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

Introduction to VHDL #3

CCE 3202 Advanced Digital System Design

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

Designing with VHDL and FPGA

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

Symbolically a D-Latch can be represented as so, it s truth table is also given:

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

Very High Speed Integrated Circuit Har dware Description Language

VHDL in 1h. Martin Schöberl

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

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 3

Using ModelSim to Simulate Logic Circuits in VHDL Designs. 1 Introduction. For Quartus II 13.0

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

Inthis lecture we will cover the following material:

Functions, Procedures, and Testbenches

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 3

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

Introduction to VHDL. Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez

CS/EE Homework 7 Solutions

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

ECE 545 Lecture 7. Advanced Testbenches. George Mason University

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

Active-HDL. Getting Started

Lecture 4. VHDL Basics. Simple Testbenches

COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs

FPGA Design Flow. - from HDL to physical implementation - Victor Andrei. Kirchhoff-Institut für Physik (KIP) Ruprecht-Karls-Universität Heidelberg

Simulation with ModelSim Altera from Quartus II

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

Handout #1: The Xilinx ISE Project Navigator

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

ECOM 4311 Digital Systems Design

Accelerate FPGA Prototyping with

CDA 4253 FPGA System Design Introduction to VHDL. Hao Zheng Dept of Comp Sci & Eng USF

Getting Started with VHDL

Lecture 5: Aldec Active-HDL Simulator

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

Introduction to VHDL #1

Digital Systems Design

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

Computer-Aided Digital System Design VHDL


DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 8

Lab 3. Advanced VHDL

Summary of basic structures

EL 310 Hardware Description Languages Midterm

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

EITF35: Introduction to Structured VLSI Design

Lab # 5. Subprograms. Introduction

Lecture 4. VHDL Fundamentals. George Mason University

CS232 VHDL Lecture. Types

EEL 4712 Digital Design Test 1 Spring Semester 2007

Tutorial 4 HDL. Outline VHDL PROCESS. Modeling Combinational Logic. Structural Description Instantiation and Interconnection Hierarchy

Lab 3: FPGA and VLSI Design

Control and Datapath 8

VHDL VS VERILOG.

VHDL: A Crash Course

VHDL And Synthesis Review

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

CCE 3202 Advanced Digital System Design

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

ECE 459/559 Secure & Trustworthy Computer Hardware Design

Getting Started with Xilinx WebPack 13.1

Transcription:

VHDL Testbench Tutorial 1 Contents 1 VHDL Testbench 2 Test Bench Syntax 3 Testbench Example: VHDL Code for Up Down Binary Counter 4 VHDL Testbench code for up down binary counter 5 Testbench Waveform for Up Down Binary Counter VHDL Testbench VHDL Testbench is important part of VHDL design to check the functionality of Design through simulation waveform. Testbench provide stimulus for design under test DUT or Unit Under Test UUT to check the output result. A test bench is HDL code that allows you to provide a documented, repeatable set of stimuli that is portable across different simulators. Testbench consist of entity without any IO ports, Design instantiated as component, clock input, and various stimulus inputs. Test Bench Syntax ENTITY tb_name IS END tb_name; ARCHITECTURE tb_arch OF tb_name IS Component Declaration for the Unit Under Test (UUT) Input/Output Signal Declaration

VHDL Testbench Tutorial 2 Clock period definitions BEGIN Instantiate the Unit Under Test (UUT) Clock process definitions Stimulus process END tb_arch; VHDL Testbench syntax consist of Header File declaration containing library LIBRARY ieee; USE ieee.std_logic_1164.all; entity without Ports declaration ENTITY tb_up_down IS END tb_up_down; architecture with component declaration for unit under test COMPONENT up_down_counter PORT( clock : IN std_logic; reset : IN std_logic; up_down : IN std_logic; counter : OUT std_logic_vector(3 downto 0) END COMPONENT; Testbench Internal signal declaration --Inputs signal clock : std_logic := '0'; signal reset : std_logic := '0'; signal up_down : std_logic := '0'; --Outputs signal counter : std_logic_vector(3 downto 0

VHDL Testbench Tutorial 3 For Sequential circuit Clock period representation for example: 50Mhz equals 20 ns. constant clock_period : time := 20 ns; Instantiate Design Under Test using Port Map. uut: up_down_counter PORT MAP ( clock => clock, reset => reset, up_down => up_down, counter => counter Clock definition Process clock_process :process clock <= '0'; clock <= '1'; Stimulus definition Process reset <= '1'; reset <= '0'; up_down <= '0'; wait for 200 ns; up_down <= '1'; wait; The following VHDL Code implement the up down counter,next code implement VHDL Testbench for up down counter and finally testbench waveform output.

VHDL Testbench Tutorial 4 Testbench Example: VHDL Code for Up Down Binary Counter library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity up_down_counter is port( clock : in std_logic; reset : in std_logic; up_down : in std_logic; counter : out std_logic_vector(3 downto 0) end up_down_counter; architecture bhv of up_down_counter is signal t_count: std_logic_vector(3 downto 0 process (clock, reset) if (reset='1') then t_count <= "0000"; elsif rising_edge(clock) then if up_down = '0' then t_count <= t_count + 1; else t_count <= t_count - 1; end if; end if; counter <= t_count; end bhv; VHDL Testbench code for up down binary counter LIBRARY ieee; USE ieee.std_logic_1164.all; -- Uncomment the following library declaration if using

VHDL Testbench Tutorial 5 -- arithmetic functions with Signed or Unsigned values --USE ieee.numeric_std.all; ENTITY tb_up_down IS END tb_up_down; ARCHITECTURE behavior OF tb_up_down IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT up_down_counter PORT( clock : IN std_logic; reset : IN std_logic; up_down : IN std_logic; counter : OUT std_logic_vector(3 downto 0) END COMPONENT; --Inputs signal clock : std_logic := '0'; signal reset : std_logic := '0'; signal up_down : std_logic := '0'; --Outputs signal counter : std_logic_vector(3 downto 0 -- Clock period definitions constant clock_period : time := 20 ns; BEGIN -- Instantiate the Unit Under Test (UUT) uut: up_down_counter PORT MAP ( clock => clock, reset => reset, up_down => up_down, counter => counter

VHDL Testbench Tutorial 6 -- Clock process definitions clock_process :process clock <= '0'; clock <= '1'; -- Stimulus process stim_proc: process -- hold reset state for 100 ns. reset <= '1'; reset <= '0'; up_down <= '0'; wait for 200 ns; up_down <= '1'; wait; END; Testbench Waveform for Up Down Binary Counter In the above waveform the counter output is UUUU for 10 ns at clock low period, XXXX for next 10 ns at clock High period. After that reset is HIGH for 20 ns so counter outputs 0000, then Counter start up counting for 200 ns and down count for remaining time period.