ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.

Slides:



Advertisements
Similar presentations
VHDL Structural Architecture ENG241 Week #5 1. Fall 2012ENG241/Digital Design2 VHDL Design Styles Components and interconnects structural VHDL Design.
Advertisements

1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
HDL-Based Digital Design Part I: Introduction to VHDL (I) Dr. Yingtao Jiang Department Electrical and Computer Engineering University of Nevada Las Vegas.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 2 Khurram Kazi Some of the slides were taken from K Gaj ’ s lecture slides from GMU ’ s VHDL.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
Simple Testbenches Behavioral Modeling of Combinational Logic
EENG 2910 – Digital Systems Design Fall Course Introduction Class Time: M9:30am-12:20pm Location: B239, B236 and B227 Instructor: Yomi Adamo
Introduction to VHDL for Synthesis
Data Flow Modeling of Combinational Logic Simple Testbenches
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 4: Modeling Dataflow.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 5: Modeling Structure.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
ENG241 Digital Design Week #4 Combinational Logic Design.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #16 – Introduction.
Introduction to VHDL Spring EENG 2920 Digital Systems Design Introduction VHDL – VHSIC (Very high speed integrated circuit) Hardware Description.
1 ECE 545 – Introduction to VHDL Dataflow Modeling of Combinational Logic Simple Testbenches ECE 656. Lecture 2.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Refresher Lecture 2.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
George Mason University Simple Testbenches ECE 545 Lecture 4.
George Mason University Data Flow Modeling in VHDL ECE 545 Lecture 7.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches Concurrent Statements & Adders.
Data Flow Modeling in VHDL
CDA 4253 FPGA System Design Introduction to VHDL
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
Lecture 2 VHDL Refresher ECE 448 – FPGA and ASIC Design with VHDL.
Digital Design Using VHDL and PLDs ECOM 4311 Digital System Design Chapter 1.
George Mason University Introduction to VHDL for Synthesis Lecture 3.
May 9, 2001Systems Architecture I1 Systems Architecture I (CS ) Lab 5: Introduction to VHDL Jeremy R. Johnson May 9, 2001.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Refresher Lecture 2.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
ECE 448 Lab 1 Developing Effective Testbenches
George Mason University Data Flow Modeling of Combinational Logic ECE 545 Lecture 5.
George Mason University ECE 545 – Introduction to VHDL Data Flow & Structural Modeling of Combinational Logic ECE 545 Lecture 2.
ECE 448 – FPGA and ASIC Design with VHDL George Mason University ECE 448 Lab 2 Implementing Combinational Logic in VHDL.
Structural style Modular design and hierarchy Part 1
Basic Language Concepts
Behavioral Style Combinational Design with VHDL
IAY 0600 Digital Systems Design
ENG2410 Digital Design “Combinational Logic Design”
Structural style Modular design and hierarchy Part 1
Behavioral Style Combinational Design with VHDL
LIBRARY IEEE; Include Libraries for standard logic data types USE IEEE.STD_LOGIC_1164.ALL; -- Entity name normally the same as file name.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
ECE 448 Lab 1a Developing Effective Testbenches
ECE 434 Advanced Digital System L08
LIBRARY IEEE; Include Libraries for standard logic data types USE IEEE.STD_LOGIC_1164.ALL; -- Entity name normally the same as file name.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
IAS 0600 Digital Systems Design
ECE 448 Lab 1 Developing Effective Testbenches
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Data Flow Modeling of Combinational Logic
VHDL Structural Architecture
VHDL Introduction.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
ECE 448 Lab 1 Developing Effective Testbenches
IAS 0600 Digital Systems Design
Modeling of Circuits with a Regular Structure
ECE 545 Lecture 5 Simple Testbenches.
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
ECE 448 Lab 1 Developing Effective Testbenches
(Simple Testbenches & Arithmetic Operations)
Presentation transcript:

ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches

VHDL Design Styles ECE 332 George Mason University VHDL subset most suitable for synthesis STRUCTURAL components and interconnects VHDL Design Styles DATAFLOW “concurrent” statements State machines Registers “sequential” statements NON- SYNTHESIZABLE SYTHESIZABLE BEHAVIORAL Test Benches Modeling IP

XOR3 Example ECE 332 George Mason University

Entity XOR3 (same for all architectures) LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY xor3 IS PORT( A : IN STD_LOGIC; B : IN STD_LOGIC; C : IN STD_LOGIC; Result : OUT STD_LOGIC ); END xor3; ECE 332 George Mason University

Dataflow Architecture ARCHITECTURE dataflow OF xor3 IS SIGNAL U1_out: STD_LOGIC; BEGIN U1_out <= A XOR B; Result <= U1_out XOR C; END dataflow; U1_out ECE 332 George Mason University

Dataflow Description Describes how data moves through the system and the various processing steps. – Dataflow uses series of concurrent statements to realize logic. – Dataflow is most useful style when series of Boolean equations can represent a logic  used to implement simple combinational logic Concurrent statements are evaluated at the same time; thus, the order of these statements doesn’t matter – This is not true for sequential/behavioral statements This order… U1_out <= A XOR B; Result <= U1_out XOR C; Is the same as this order… Result <= U1_out XOR C; U1_out <= A XOR B; ECE 332 George Mason University

Structural Architecture (XOR3 gate) ARCHITECTURE structural OF xor3 IS SIGNAL U1_OUT: STD_LOGIC; COMPONENT xor2 IS PORT( I1 : IN STD_LOGIC; I2 : IN STD_LOGIC; Y : OUT STD_LOGIC ); END COMPONENT; BEGIN U1: xor2 PORT MAP (I1 => A, I2 => B, Y => U1_OUT); U2: xor2 PORT MAP (I1 => U1_OUT, I2 => C, Y => Result); END structural; XOR3 A B C Result ECE 332 George Mason University

Component and Instantiation Named association connectivity (recommended) COMPONENT xor2 IS PORT( I1 : IN STD_LOGIC; I2 : IN STD_LOGIC; Y : OUT STD_LOGIC ); END COMPONENT; BEGIN U1: xor2 PORT MAP (I1 => A, I2 => B, Y => U1_OUT);... COMPONENT PORT NAME LOCAL WIRE ECE 332 George Mason University

Component and Instantiation Positional association connectivity (not recommended) COMPONENT xor2 IS PORT( I1 : IN STD_LOGIC; I2 : IN STD_LOGIC; Y : OUT STD_LOGIC ); END COMPONENT; BEGIN U1: xor2 PORT MAP (A, B, U1_OUT);... ECE 332 George Mason University

Structural Description Structural design is the simplest to understand. This style is the closest to schematic capture and utilizes simple building blocks to compose logic functions. Components are interconnected in a hierarchical manner. Structural descriptions may connect simple gates or complex, abstract components. Structural style is useful when expressing a design that is naturally composed of sub-blocks. ECE 332 George Mason University

Behavioral Architecture (XOR3 gate) ARCHITECTURE behavioral OF xor3 IS BEGIN PROCESS (A,B,C) BEGIN IF ((A XOR B XOR C) = '1') THEN Result <= '1'; ELSE Result <= '0'; END IF; END PROCESS; END behavioral; ECE 332 George Mason University

Behavioral Description It accurately models what happens on the inputs and outputs of the black box (no matter what is inside and how it works). This style uses PROCESS statements in VHDL. Statements are executed in sequence in a process statement  order of code matters! ECE 332 George Mason University

Single Wire Versus Bus wire a bus b 1 8 SIGNAL a : STD_LOGIC; SIGNAL b : STD_LOGIC_VECTOR(7 downto 0); ECE 332 George Mason University

Standard Logic Vectors SIGNAL a: STD_LOGIC; SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL c: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL d: STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL e: STD_LOGIC_VECTOR(15 DOWNTO 0); SIGNAL f: STD_LOGIC_VECTOR(8 DOWNTO 0); ………. a <= '1'; b <= "0000"; -- Binary base assumed by default c <= B"0000"; -- Binary base explicitly specified d <= "0110_0111"; -- You can use '_' to increase readability e <= X"AF67"; -- Hexadecimal base f <= O"723"; -- Octal base ECE 332 George Mason University

Single versus Double Quote Use single quote to hold a single bit signal – a <= '0', a <='Z' Use double quote to hold a multi-bit signal – b <= "00", b <= "11" ECE 332 George Mason University

Testbenches ECE 332 George Mason University

Testbench Block Diagram Testbench Processes Generating Stimuli Design Under Test (DUT) Observed Outputs ECE 332 George Mason University

Testbench Defined A testbench applies stimuli (drives the inputs) to the Design Under Test (DUT) and (optionally) verifies expected outputs. The results can be viewed in a waveform window or written to a file. Since a testbench is written in VHDL, it is not restricted to a single simulation tool (portability). The same testbench can be easily adapted to test different implementations (i.e. different architectures) of the same design. ECE 332 George Mason University

Testbench Anatomy ENTITY tb IS --TB entity has no ports END tb; ARCHITECTURE arch_tb OF tb IS --Local signals and constants COMPONENT TestComp -- All Design Under Test component declarations PORT ( ); END COMPONENT; BEGIN DUT:TestComp PORT MAP( -- Instantiations of DUTs ); testSequence: PROCESS -- Input stimuli END PROCESS; END arch_tb; ECE 332 George Mason University

Testbench for XOR3 LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY xor3_tb IS END xor3_tb; ARCHITECTURE xor3_tb_architecture OF xor3_tb IS -- Component declaration of the tested unit COMPONENT xor3 PORT( A : IN STD_LOGIC; B : IN STD_LOGIC; C : IN STD_LOGIC; Result : OUT STD_LOGIC ); END COMPONENT; -- Stimulus signals - signals mapped to the ports of tested entity SIGNAL A, B, C : STD_LOGIC; SIGNAL test_result : STD_LOGIC; BEGIN DUT : xor3 PORT MAP ( A => A, B => B, C => C, Result => test_result); ECE 332 George Mason University

Testbench for XOR3 (2) PROCESS BEGIN A <= ‘0’; B <= ‘0’; C <= ‘0’; WAIT FOR 10 ns; A <= ‘0’; B <= ‘0’; C <= ‘1’; WAIT FOR 10 ns; A <= ‘0’; B <= ‘1’; C <= ‘0’; WAIT FOR 10 ns; A <= ‘0’; B <= ‘1’; C <= ‘1’; WAIT FOR 10 ns; A <= ‘1’; B <= ‘0’; C <= ‘0’; WAIT FOR 10 ns; A <= ‘1’; B <= ‘0’; C <= ‘1’; WAIT FOR 10 ns; A <= ‘1’; B <= ‘1’; C <= ‘0’; WAIT FOR 10 ns; A <= ‘1’; B <= ‘1’; C <= ‘1’; WAIT; END PROCESS; END xor3_tb_architecture; ECE 332 George Mason University

Testbench waveform ECE 332 George Mason University