Lab Lecture 3 VHDL Architecture styles and Test Bench -Aahlad.

Slides:



Advertisements
Similar presentations
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.
Advertisements

9/18/08 Lab 2 - Solution TA: Jorge. 9/18/08 Half-adder.
VHDL Intro What does VHDL stand for? VHSIC Hardware Description Language VHSIC = Very High Speed Integrated Circuit Developed in 1982 by Govt. to standardize.
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.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
ECE 331 – Digital System Design Single-bit Adder Circuits and Adder Circuits in VHDL (Lecture #12) The slides included herein were taken from the materials.
ECE 331 – Digital System Design
4-Bit Binary-to-BCD Converter: case Statement
(1) Programming Mechanics © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
1 H ardware D escription L anguages Basic Language Concepts.
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
Modeling styles: 1. Structural Modeling: As a set of interconnected components (to represent structure), 2. Dataflow Modeling: As a set of concurrent assignment.
Data Flow Modeling of Combinational Logic Simple Testbenches
DSD,USIT,GGSIPU1 Entity declaration –describes the input/output ports of a module entity reg4 is port ( d0, d1, d2, d3, en, clk : in std_logic; q0, q1,
VHDL TUTORIAL Preetha Thulasiraman ECE 223 Winter 2007.
ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 6: Configurations.
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 5: Modeling Structure.
Digital System 數位系統 Verilog HDL Ping-Liang Lai (賴秉樑)  
1/26 VHDL VHDL Structural Modeling Digital Logic.
CWRU EECS 317 EECS 317 Computer Design LECTURE 1: The VHDL Adder Instructor: Francis G. Wolff Case Western Reserve University.
Basic Overview of VHDL Matthew Murach Slides Available at:
EE3A1 Computer Hardware and Digital Design Lecture 5 Testbenches and Memories in VHDL.
Introduction to VLSI Design – Lec01. Chapter 1 Introduction to VLSI Systems Lecture # 6 Computer-Aided Design Technology for VLSI.
Module 1.2 Introduction to Verilog
L12 – VHDL Overview. VHDL Overview  HDL history and background  HDL CAD systems  HDL view of design  Low level HDL examples  Ref: text Unit 10, 17,
Introduction to VHDL Spring EENG 2920 Digital Systems Design Introduction VHDL – VHSIC (Very high speed integrated circuit) Hardware Description.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
1 component OR_3 port (A,B,C: in bit; Z: out bit); end component ; Reserved Words  Declarations of Components and Entities are similar  Components are.
ECE 331 – Digital System Design Single-bit Adder Circuits and Adder Circuits in VHDL (Lecture #11) The slides included herein were taken from the materials.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Hardware languages "Programming"-language for modelling of (digital) hardware 1 Two main languages: VHDL (Very High Speed Integrated Circuit Hardware Description.
1/8/ L2 VHDL Introcution© Copyright Joanne DeGroat, ECE, OSU1 Introduction to VHDL.
Lecture #9 Page 1 Lecture #9 Agenda 1.VHDL : Structural Design Announcements 1.n/a ECE 4110– Digital Logic Design.
Components/Entities 1 It is a method of describing entities that are used often. Components are like the sockets that will be connected on a breadboard.
Digital System Projects
1 Part III: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
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.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
IAY 0600 Digital Systems Design VHDL discussion Structural style Modular design and hierarchy Part 1 Alexander Sudnitson Tallinn University of Technology.
Combinational logic circuit
Structural style Modular design and hierarchy Part 1
Basic Language Concepts
Behavioral Style Combinational Design with VHDL
Dataflow Style Combinational Design with VHDL
ECE 4110–5110 Digital System Design
Structural style Modular design and hierarchy Part 1
Behavioral Style Combinational Design with VHDL
ENG6530 Reconfigurable Computing Systems
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
Hardware Descriptive Languages these notes are taken from Mano’s book
UNIT 2: Data Flow description
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
Structural style Modular design and hierarchy Part 1
VHDL Hardware Description Language
Hardware Descriptive Languages these notes are taken from Mano’s book
VHDL Discussion Subprograms
Behavioral Modeling of Sequential-Circuit Building Blocks
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
VHDL Discussion Subprograms
© Copyright Joanne DeGroat, ECE, OSU
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
4-Input Gates VHDL for Loops
(Simple Testbenches & Arithmetic Operations)
Presentation transcript:

Lab Lecture 3 VHDL Architecture styles and Test Bench -Aahlad

Architecture Styles Structural Style of Modeling (to represent interconnected components) Concurrent Style of Modeling ( to represent data flow) Sequential Style of Modeling ( to represent behavior ) Any combination of the above three

Architecture Body Architecture body has two parts, namely declaration and instantiation. architecture ABC of entity DEF is component…… signal…… begin work to be done, process…. end ABC; Declaration of signals, components…. Instantiation

Structural Modeling-Brief Overview Component : An entity X, when used in another entity Y, becomes a component for that entity Y. So a component is also an entity depending on the level at which it is modelled.

Structural Modeling-Brief Overview architecture HA_STRUCTURE of HALF_ADDER is component XOR2 port (X, Y: in BIT; Z: out BIT); end component; component AND2 port (L, M: in BIT; N: out BIT); end component; begin X1: XOR2 port map (A, B, SUM); A1: AND2 port map (A, B, CARRY); end HA_STRUCTURE; Component Declaration Component Instantiation

Structural Modeling-Brief Overview The components declared in the architecture body ( i.e. XOR2 and AND2 in the previous example ) must be either defined in the library or a separate entity having a behavioral description of the component. Components must be instantiated with labels (i.e. X1 and A1) and port mapped to the signals of the current architecture.

architecture DEC_STR of DECODER2x4 is component INV port (A: in BIT; Z: out BIT); end component; component NAND3 port (A, B, C: in BIT; Z: out BIT); end component; begin I0: INV port map (A, ABAR); I1: INV port map (B, BBAR); N0: NAND3 port map (ABAR, BBAR, ENABLE, Z(0)); N1: NAND3 port map (ABAR, B, ENABLE, Z(1)); N2: NAND3 port map (A, BBAR, ENABLE, Z(2)); N3: NAND3 port map (A, B, ENABLE, Z(3)); end DEC_STR; Will this code compile without errors? Assume all the inputs and outputs are declared in the entity

Structural Modeling-Brief Overview We missed the intermediate signals ABAR and BBAR in the previous programs. Signal declarations represent wires that interconnect various components of a digital system. As in real physical systems signals initialization doesn’t happen instantaneously. There is always a delay associated with it.

architecture DEC_STR of DECODER2x4 is component INV port (A: in BIT; Z: out BIT); end component; component NAND3 port (A, B, C: in BIT; Z: out BIT); end component; signal ABAR, BBAR: BIT;---signal declaration before begin begin I0: INV port map (A, ABAR); I1: INV port map (B, BBAR); N0: NAND3 port map (ABAR, BBAR, ENABLE, Z(0)); N1: NAND3 port map (ABAR, B, ENABLE, Z(1)); N2: NAND3 port map (A, BBAR, ENABLE, Z(2)); N3: NAND3 port map (A, B, ENABLE, Z(3)); end DEC_STR;

Data Flow Modeling-Brief Overview The flow of data through the entity is expressed primarily using concurrent signal assignment statements. A concurrent signal assignment statement is executed only when a signal used in the expression on the right hand side has a event on it. In data flow model order of statements is not important because all the statements are executed in parallel.

Concurrent Statements All statements other than statements within the process in the architecture instantiation part (after begin) are concurrent statements. Process statements are concurrent statements. Confused??

architecture HA_CONCURRENTof HALF_ADDER is begin SUM <= A xor B; CARRY <= A and B ; end HA_CONCURRENT

Data Flow Modeling-Brief Overview In the previous example whenever there is an event on A or B both SUM and CARRY will be executed in parallel. The order of SUM and CARRY in the architecture both is of no importance as they both are executed in parallel.

architecture dec_dataflgw of DECODER2x4 is signal ABAR, BBAR: BIT; begin Z(3) <= not (A and B and ENABLE); - statement 1 Z(0) <= not (ABAR and BBAR and ENABLE); - statement 2 BBAR <= not B; - statement 3 Z(2) <= not (A and BBAR and ENABLE); - statement 4 ABAR <= not A; - statement 5 Z(1 ) <= not (ABAR and B and ENABLE); - statement 6 end DEC_DATAFLOW; For an event on B at a time T statements 1, 3, 6 are executed at T and new values are assigned to signals Z(3), BBAR, Z(1) at T+Δ. Statements 2 and 4 are executed at time T+ Δ and the new values are assigned to Z(0) and Z(2) at T+2 Δ time interval.

Mixed Modeling-Identify the modeling styles architecture FA_MIXED of FULL_ADDER is component XOR2 port (A, B: in BIT; Z: out BIT); end component; signal S1: BIT; begin X1: XOR2 port map (A, B, S1 ); process (A, B, CIN) variable T1, T2, T3: BIT; begin T1 :=A and B; T2 := B and CIN; T3:=A and CIN; COUT <= T1 or T2 or T3; end process; SUM <= S1 xor CIN; end FA_M!XED;

Components A component can be instantiated any number of times. However, each instantiation should have a unique label. Component declaration component component-name port ( list-of-interface-ports ) ; end component ;

Components The component name must either be an entity in the library or must be explicitly bound to an entity. Component declaration appears in the declaration part of the architecture body i.e. before begin.

Components Component instantiation statement defines subcomponent of the entity in which it appears. It associates the signals in the entity with the ports of the subcomponent. component-label: component-name port map ( association-list); Signal association can be performed either by Position association or Named association.

entity HALF_ADDER is port (A, B: in BIT; SUM, CARRY: out BIT); end HALF_ADDER architecture HA_STRUCTURE of HALF_ADDER is component XOR2 port (X, Y: in BIT; Z: out BIT); end component; component AND2 port (L, M: in BIT; N: out BIT); end component; begin X1: XOR2 port map (A, B, SUM); A1: AND2 port map (A, B, CARRY); end HA_STRUCTURE

Position Association Example -- Component declaration: component NAND2 port (A, B: in BIT; Z: out BIT); end component; signal S1, S2, S3, X, Y, Z1 : std_logic; begin -- Component instantiation: N1: NAND2 port map (S1, S2, S3); N2: NAND2 port map (Z1, Y, X); S1  A, S2  B, S3  Z Z1  A, Y  Z, X  B ---Find the mistake?

Named Association -- Component declaration: component NAND2 port (A, B: in BIT; Z: out BIT); end component; signal S1, S2, S2 : std_logic; begin -- Component instantiation: N1: NAND2 port map (A=>S1, B=>S2, Z=>S3);

Example of multiple instantiation architecture PARITY_STR of PARITY_9_BIT is component XOR2 port (A, B: in BIT; Z: out BIT); end component; component INV2 port (A: in BIT; Z: out BIT); end component; signal E0, E1, E2, E3, F0, F1, H0: BIT; begin XE0: XOR2 port map (D(0), D(1), E0); XE1: XOR2 port map (D(2), D(3), E1); XE2: XOR2 port map (D(4), D(5), E2); XE3: XOR2 port map (D(6), D(7), E3); XF0: XOR2 port map (E0, E1, F0); XF1: XOR2 port map (E2, E3, F1); XH0: XOR2 port map (F0, F1, H0); XODD: XOR2 port map (H0, D(8), ODD); XEVEN: INV2 port map (ODD, EVEN); end PARITY_STR;

Test Bench A Test bench always has an empty entity. Test bench is used for simulation and to check the behavior of the code. Test bench uses component instantiation to supply the inputs. Lets look at an example from lab 2.

LIBRARY IEEE; USE IEEE.std_logic_1164.all; USE IEEE.std_logic_arith.all; USE IEEE.std_logic_unsigned.all; USE IEEE.STD_LOGIC_TEXTIO.ALL; USE STD.TEXTIO.ALL; ENTITY testbench IS END testbench; Empty Entity

ARCHITECTURE testbench_arch OF testbench IS COMPONENT tut1 PORT ( A : in std_logic; B : in std_logic; C : in std_logic; D : in std_logic; Y : out std_logic ); END COMPONENT; SIGNAL X_A : std_logic := '0'; SIGNAL X_B : std_logic := '0'; SIGNAL X_C : std_logic := '0'; SIGNAL X_D : std_logic := '0'; SIGNAL X_Y : std_logic := '0'; BEGIN UUT : tut1 PORT MAP ( A =>X_A, B =>X_B, C =>X_C, D =>X_D, Y =>X_Y ); Declaration Part of Architecture Body Signals of entity testbench

signal_A: process begin X_A <= NOT X_A; wait for 1 ns; end process; signal_B: process begin X_B <= NOT X_B; wait for 2 ns; end process; signal_C: process begin X_C <= NOT X_C; wait for 4 ns; end process; signal_D: process begin X_D <= NOT X_D; wait for 8 ns; end process; END testbench_arch; signal_A signal_B signal_C signal_D