Basic VHDL RASSP Education & Facilitation Module 10 Version 2.02 Copyright  1995-1998 RASSP E&F All rights reserved. This information is copyrighted by.

Slides:



Advertisements
Similar presentations
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
Advertisements

Introduction to VHDL (Lecture #5) ECE 331 – Digital System Design The slides included herein were taken from the materials accompanying Fundamentals of.
VHDL Data Types Module F3.1. VHDL Data Types Scalar Integer Enumerated Real (floating point)* Physical* Composite Array Record Access (pointers)* * Not.
Sistemas Digitais I LESI - 2º ano Lesson 5 - VHDL U NIVERSIDADE DO M INHO E SCOLA DE E NGENHARIA Prof. João Miguel Fernandes Dept.
HDL-Based Digital Design Part I: Introduction to VHDL (I) Dr. Yingtao Jiang Department Electrical and Computer Engineering University of Nevada Las Vegas.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
Package with 4-valued logic Signal Attributes Assertion Data Flow description.
ECE 368 Basic VHDL Shantanu Dutt UIC
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
1 H ardware D escription L anguages Basic Language Concepts.
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
Basic VHDL RASSP Education & Facilitation Module 10 Version 2.02 Copyright  RASSP E&F All rights reserved. This information is copyrighted by.
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Structural VHDL RASSP Education & Facilitation Module 11 Version 2.01 Copyright.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
VHDL IE- CSE. What do you understand by VHDL??  VHDL stands for VHSIC (Very High Speed Integrated Circuits) Hardware Description Language.
Language Concepts Ver 1.1, Copyright 1997 TS, Inc. VHDL L a n g u a g e C o n c e p t s Page 1.
RTL Hardware Design by P. Chu Chapter Basic VHDL program 2. Lexical elements and program format 3. Objects 4. Data type and operators RTL Hardware.
Modern VLSI Design 3e: Chapters 3 & 8Partly from 2002 Prentice Hall PTR week6-1 Lectures 16 Transfer Characteristics (Delay and Power) Feb. 10, 2003.
Basic Concepts in VHDL Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
Lecture #8 Page 1 Lecture #8 Agenda 1.VHDL : Operators 2.VHDL : Signal Assignments Announcements 1.HW #4 assigned ECE 4110– Digital Logic Design.
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.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
Topics AliasesSubprograms Generics & Configurations.
Timing Model VHDL uses the following simulation cycle to model the stimulus and response nature of digital hardware Start Simulation Update Signals Execute.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
L13 – VHDL Language Elements. VHDL Language Elements  Elements needed for FPGA design Types  Basic Types  Resolved Types – special attributes of resolved.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
VHDL – Part 2 Some of the slides are taken from
CEC 220 Digital Circuit Design More VHDL Fri, February 27 CEC 220 Digital Circuit Design Slide 1 of 15.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, February 25 CEC 220 Digital Circuit Design Slide 1 of 19.
16/11/2006DSD,USIT,GGSIPU1 Packages The primary purpose of a package is to encapsulate elements that can be shared (globally) among two or more design.
1/8/ L16 Timing & Concurrency III Copyright Joanne DeGroat, ECE, OSU1 Timing & Concurrency III Delay Model foundations for simulation and.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Basic VHDL RASSP Education & Facilitation Module 10 Version 2.02 Copyright  RASSP E&F All rights reserved. This information is copyrighted by.
BASIC VHDL LANGUAGE ELEMENTS Digital Design for Instrumentation with VHDL 1.
ECOM 4311—Digital System Design with VHDL
CEC 220 Digital Circuit Design Introduction to VHDL Friday, February 21 CEC 220 Digital Circuit Design Slide 1 of 10.
Lecture #8 Page 1 Lecture #8 Agenda 1.VHDL : Operators 2.VHDL : Signal Assignments Announcements 1.HW #4 assigned ECE 4110– Sequential Logic Design.
VHDL Tutorial.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, Oct 14 CEC 220 Digital Circuit Design Slide 1 of 19.
Basic VHDL RASSP Education & Facilitation Module 10 Version 3.00
Introduction To VHDL 홍 원 의.
Introduction to VHDL (14 Marks)
Basic Language Concepts
Basic VHDL RASSP Education & Facilitation Module 10 Version 2.02
HDL simulation and Synthesis (Marks16)
Basic VHDL RASSP Education & Facilitation Module 10 Version 2.02
Module Goals Introduce structural VHDL constructs Use of components
Timing Model Start Simulation Delay Update Signals Execute Processes
Chapter 2. Introduction To VHDL
CPE/EE 428, CPE 528 Basic VHDL Department of Electrical and Computer Engineering University of Alabama in Huntsville.
CPE/EE 422/522 Advanced Logic Design L06
ECE 434 Advanced Digital System L08
CHAPTER 10 Introduction to VHDL
Some of the slides are taken from
ECE 434 Advanced Digital System L9
CPE 528: Lecture #4 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
CPE/EE 422/522 Advanced Logic Design L08
CPE/EE 422/522 Advanced Logic Design L11
ECE 434 Advanced Digital System L10
CPE 528: Lecture #3 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
RASSP Education & Facilitation
RASSP Education & Facilitation
VHDL Data Types Module F3.1.
Data Object By E. Thirumeni Department of Electronics
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

Basic VHDL RASSP Education & Facilitation Module 10 Version 2.02 Copyright  RASSP E&F All rights reserved. This information is copyrighted by the RASSP E&F Program and may only be used for non-commercial educational purposes. Any other use of this information without the express written permission of the RASSP E&F Program is prohibited. All information contained herein may be duplicated for non- commercial educational use provided this copyright notice is included. No warranty of any kind is provided or implied, nor is any liability accepted regardless of use. FEEDBACK: The RASSP E&F Program welcomes and encourages any feedback that you may have including any changes that you may make to improve or update the material. You can contact us at or

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Timing Model l VHDL uses the following simulation cycle to model the stimulus and response nature of digital hardware Start Simulation Update Signals End Simulation Delay

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delay Types Input delay Outpu t l All VHDL signal assignment statements prescribe an amount of time that must transpire before the signal assumes its new value l This prescribed delay can be in one of three forms: m Transport -- prescribes propagation delay only m Inertial -- prescribes propagation delay and minimum input pulse width m Delta -- the default if no delay time is explicitly specified

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Transport Delay l Transport delay must be explicitly specified m I.e. keyword “TRANSPORT” must be used l Signal will assume its new value after specified delay -- TRANSPORT delay example Output <= TRANSPORT NOT Input AFTER 10 ns; -- TRANSPORT delay example Output <= TRANSPORT NOT Input AFTER 10 ns; InputOutput Input Output

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Inertial Delay l Provides for specification propagation delay and input pulse width, i.e. ‘inertia’ of output: l Inertial delay is default and REJECT is optional : Output <= NOT Input AFTER 10 ns; -- Propagation delay and minimum pulse width are 10ns Output <= NOT Input AFTER 10 ns; -- Propagation delay and minimum pulse width are 10ns Input Output InputOutput target <= [REJECT time_expression] INERTIAL waveform;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Inertial Delay (cont.) l Example of gate with ‘inertia’ smaller than propagation delay m e.g. Inverter with propagation delay of 10ns which suppresses pulses shorter than 5ns l Note: the REJECT feature is new to VHDL Output <= REJECT 5ns INERTIAL NOT Input AFTER 10ns; Input Output

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F l Default signal assignment propagation delay if no delay is explicitly prescribed m VHDL signal assignments do not take place immediately m Delta is an infinitesimal VHDL time unit so that all signal assignments can result in signals assuming their values at a future time m E.g. l Supports a model of concurrent VHDL process execution m Order in which processes are executed by simulator does not affect simulation output Delta Delay Output <= NOT Input; -- Output assumes new value in one delta cycle Output <= NOT Input; -- Output assumes new value in one delta cycle

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1 A: 0 B:1 C:0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0 B:1 C:0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 2ns td= 1ns td= 5ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0->1 B:1 C:0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 2ns td= 1ns td= 5ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0->1 B:1->0 C:0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 2ns td= 1ns td= 5ns

Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0->1 B:1->0 C:0- >0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 2ns td= 1ns td= 5ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0 B:1 C:0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 5ns td= 1ns td= 2ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0->1 B:1 C:0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 5ns td= 1ns td= 2ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0->1 B:1 C:0->1 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 5ns td= 1ns td= 2ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0->1 B:1->0 C:0->1 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 5ns td= 1ns td= 2ns

Delta Delay An Example without Delta Delay l What is the behavior of C? 1 IN: 1->0 A: 0->1 B:1->0 C:0->1->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 NAND gate evaluated first: IN: 1->0 A: 0->1 B: 1->0 C: 0->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 AND gate evaluated first: IN: 1->0 A: 0->1 C: 0->1 B: 1->0 C: 1->0 td= 5ns td= 1ns td= 2ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example with Delta Delay l What is the behavior of C? IN: 1->0 1 A:0 B:1 C:0 Using delta delay scheduling Time Delta Event 0 ns 1 IN: 1->0 eval INVERTER 2 A: 0->1 eval NAND, AND 3 B: 1->0 C: 0->1 eval AND 4 C: 1->0 1 ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example with Delta Delay l What is the behavior of C? IN: 1->0 1 A:0->1 B:1 C:0 Using delta delay scheduling Time Delta Event 0 ns 1 IN: 1->0 eval INVERTER 2 A: 0->1 eval NAND, AND 3 B: 1->0 C: 0->1 eval AND 4 C: 1->0 1 ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example with Delta Delay l What is the behavior of C? IN: 1->0 1 A:0->1 B:1->0 C:0->1 Using delta delay scheduling Time Delta Event 0 ns 1 IN: 1->0 eval INVERTER 2 A: 0->1 eval NAND, AND 3 B: 1->0 C: 0->1 eval AND 4 C: 1->0 1 ns

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Delta Delay An Example with Delta Delay l What is the behavior of C? IN: 1->0 1 A:0->1 B:1->0 Using delta delay scheduling Time Delta Event 0 ns 1 IN: 1->0 eval INVERTER 2 A: 0->1 eval NAND, AND 3 B: 1->0 C: 0->1 eval AND 4 C: 1->0 1 ns C:0->1->0

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Module Outline l Introduction l VHDL Design Example l VHDL Model Components l Basic VHDL Constructs m Data types m Objects m Sequential and concurrent statements m Packages and libraries m Attributes m Predefined operators l Examples l Summary

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Data Types Types Access Scalar Composite ArrayRecord Integer RealEnumerated Physical l All declarations of VHDL ports, signals, and variables must specify their corresponding type or subtype

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F VHDL Data Types Scalar Types l Integer m Minimum range for any implementation as defined by standard: - 2,147,483,647 to 2,147,483,647 m Example assignments to a variable of type integer : ARCHITECTURE test_int OF test IS BEGIN PROCESS (X) VARIABLE a: INTEGER; BEGIN a := 1; -- OK a := -1; -- OK a := 1.0; -- illegal END PROCESS; END test_int; ARCHITECTURE test_int OF test IS BEGIN PROCESS (X) VARIABLE a: INTEGER; BEGIN a := 1; -- OK a := -1; -- OK a := 1.0; -- illegal END PROCESS; END test_int;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F ARCHITECTURE test_real OF test IS BEGIN PROCESS (X) VARIABLE a: REAL; BEGIN a := 1.3; -- OK a := -7.5; -- OK a := 1; -- illegal a := 1.7E13; -- OK a := 5.3 ns; -- illegal END PROCESS; END test_real; ARCHITECTURE test_real OF test IS BEGIN PROCESS (X) VARIABLE a: REAL; BEGIN a := 1.3; -- OK a := -7.5; -- OK a := 1; -- illegal a := 1.7E13; -- OK a := 5.3 ns; -- illegal END PROCESS; END test_real; VHDL Data Types Scalar Types (Cont.) l Real m Minimum range for any implementation as defined by standard: -1.0E38 to 1.0E38 m Example assignments to a variable of type real :

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F TYPE binary IS ( ON, OFF );... some statements... ARCHITECTURE test_enum OF test IS BEGIN PROCESS (X) VARIABLE a: binary; BEGIN a := ON; -- OK... more statements... a := OFF; -- OK... more statements... END PROCESS; END test_enum; TYPE binary IS ( ON, OFF );... some statements... ARCHITECTURE test_enum OF test IS BEGIN PROCESS (X) VARIABLE a: binary; BEGIN a := ON; -- OK... more statements... a := OFF; -- OK... more statements... END PROCESS; END test_enum; VHDL Data Types Scalar Types (Cont.) l Enumerated m User specifies list of possible values m Example declaration and usage of enumerated data type :

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F l Physical m Require associated units m Range must be specified m Example of physical type declaration : m Time is the only physical type predefined in VHDL standard TYPE resistance IS RANGE 0 TO UNITS ohm; -- ohm Kohm = 1000 ohm; -- i.e. 1 K  Mohm = 1000 kohm; -- i.e. 1 M  END UNITS; TYPE resistance IS RANGE 0 TO UNITS ohm; -- ohm Kohm = 1000 ohm; -- i.e. 1 K  Mohm = 1000 kohm; -- i.e. 1 M  END UNITS; VHDL Data Types Scalar Types (Cont.)

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F TYPE data_bus IS ARRAY(0 TO 31) OF BIT; VARIABLE X : data_bus; VARIABLE Y : BIT; Y := X(12); -- Y gets value of element at index 12 VARIABLE X : data_bus; VARIABLE Y : BIT; Y := X(12); -- Y gets value of element at index element indices......array values... VHDL Data Types Composite Types l Array m Used to group elements of the same type into a single VHDL object m Range may be unconstrained in declaration q Range would then be constrained when array is used m Example declaration for one-dimensional array (vector) :

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F l Example one-dimensional array using DOWNTO : l DOWNTO keyword must be used if leftmost index is greater than rightmost index m e.g. ‘Big-Endian’ bit ordering TYPE reg_type IS ARRAY(15 DOWNTO 0) OF BIT; VARIABLE X : reg_type; VARIABLE Y : BIT; Y := X(4); -- Y gets value of element at index 4 VARIABLE X : reg_type; VARIABLE Y : BIT; Y := X(4); -- Y gets value of element at index element indices......array values... VHDL Data Types Composite Types (Cont.)

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F TYPE binary IS ( ON, OFF ); TYPE switch_info IS RECORD status : BINARY; IDnumber : INTEGER; END RECORD; VARIABLE switch : switch_info; switch.status := ON; -- status of the switch switch.IDnumber := 30; -- e.g. number of the switch TYPE binary IS ( ON, OFF ); TYPE switch_info IS RECORD status : BINARY; IDnumber : INTEGER; END RECORD; VARIABLE switch : switch_info; switch.status := ON; -- status of the switch switch.IDnumber := 30; -- e.g. number of the switch VHDL Data Types Composite Types (Cont.) l Records m Used to group elements of possibly different types into a single VHDL object m Elements are indexed via field names m Examples of record declaration and usage :

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F l Subtype m Allows for user defined constraints on a data type q e.g. a subtype based on an unconstrained VHDL type m May include entire range of base type m Assignments that are out of the subtype range are illegal q Range violation detected at run time rather than compile time because only base type is checked at compile time m Subtype declaration syntax : m Subtype example : SUBTYPE name IS base_type RANGE ; VHDL Data Types Subtypes SUBTYPE first_ten IS INTEGER RANGE 0 TO 9;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F VHDL Data Types Summary l All declarations of VHDL ports, signals, and variables must include their associated type or subtype l Three forms of VHDL data types are : m Access -- pointers for dynamic storage allocation m Scalar -- includes Integer, Real, Enumerated, and Physical m Composite -- includes Array, and Record l A set of built-in data types are defined in VHDL standard m User can also define own data types and subtypes

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F VHDL Objects l There are four types of objects in VHDL m Constants m Variables m Signals m Files l The scope of an object is as follows : m Objects declared in a package are available to all VHDL descriptions that use that package m Objects declared in an entity are available to all architectures associated with that entity m Objects declared in an architecture are available to all statements in that architecture m Objects declared in a process are available only within that process

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F VHDL Objects Constants l Name assigned to a specific value of a type l Allow for easy update and readability l Declaration of constant may omit value so that the value assignment may be deferred m Facilitates reconfiguration l Declaration syntax : l Declaration examples : CONSTANT constant_name : type_name [:= value]; CONSTANT PI : REAL := 3.14; CONSTANT SPEED : INTEGER; CONSTANT PI : REAL := 3.14; CONSTANT SPEED : INTEGER;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F VHDL Objects Variables l Provide convenient mechanism for local storage m E.g. loop counters, intermediate values l Scope is process in which they are declared m VHDL ‘93 provides for global variables, to be discussed in the Advanced Concepts in VHDL module l All variable assignments take place immediately m No delta or user specified delay is incurred l Declaration syntax: l Declaration examples : VARIABLE opcode : BIT_VECTOR(3 DOWNTO 0) := "0000"; VARIABLE freq : INTEGER; VARIABLE opcode : BIT_VECTOR(3 DOWNTO 0) := "0000"; VARIABLE freq : INTEGER; VARIABLE variable_name : type_name [:= value];

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F VHDL Objects Signals l Used for communication between VHDL components l Real, physical signals in system often mapped to VHDL signals l ALL VHDL signal assignments require either delta cycle or user-specified delay before new value is assumed l Declaration syntax : l Declaration and assignment examples : SIGNAL signal_name : type_name [:= value]; SIGNAL brdy : BIT; brdy <= ‘0’ AFTER 5ns, ‘1’ AFTER 10ns; SIGNAL brdy : BIT; brdy <= ‘0’ AFTER 5ns, ‘1’ AFTER 10ns;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F VHDL Objects Files l Files provide a way for a VHDL design to communicate with the host environment l File declarations make a file available for use to a design l Files can be opened for reading and writing m In VHDL87, files are opened and closed when their associated objects come into and out of scope  In VHDL93 explicit FILE_OPEN() and FILE_CLOSE() procedures were added l The package STANDARD defines basic file I/O routines for VHDL types l The package TEXTIO defines more powerful routines handling I/O of text files

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Packages and Libraries l User defined constructs declared inside architectures and entities are not visible to other VHDL components m Scope of subprograms, user defined data types, constants, and signals is limited to the VHDL components in which they are declared l Packages and libraries provide the ability to reuse constructs in multiple entities and architectures m Items declared in packages can be used (i.e. included) in other VHDL components

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F l Packages consist of two parts m Package declaration -- contains declarations of objects defined in the package m Package body -- contains necessary definitions for certain objects in package declaration q e.g. subprogram descriptions l Examples of VHDL items included in packages : m Basic declarations q Types, subtypes q Constants q Subprograms q Use clause m Signal declarations m Attribute declarations m Component declarations Packages

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Packages Declaration l An example of a package declaration : l Note some items only require declaration while others need further detail provided in subsequent package body m for type and subtype definitions, declaration is sufficient m subprograms require declarations and descriptions PACKAGE my_stuff IS TYPE binary IS ( ON, OFF ); CONSTANT PI : REAL := 3.14; CONSTANT My_ID : INTEGER; PROCEDURE add_bits3(SIGNAL a, b, en : IN BIT; SIGNAL temp_result, temp_carry : OUT BIT); END my_stuff; PACKAGE my_stuff IS TYPE binary IS ( ON, OFF ); CONSTANT PI : REAL := 3.14; CONSTANT My_ID : INTEGER; PROCEDURE add_bits3(SIGNAL a, b, en : IN BIT; SIGNAL temp_result, temp_carry : OUT BIT); END my_stuff;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Packages Package Body l The package body includes the necessary functional descriptions needed for objects declared in the package declaration m e.g. subprogram descriptions, assignments to constants PACKAGE BODY my_stuff IS CONSTANT My_ID : INTEGER := 2; PROCEDURE add_bits3(SIGNAL a, b, en : IN BIT; SIGNAL temp_result, temp_carry : OUT BIT) IS BEGIN -- this function can return a carry temp_result <= (a XOR b) AND en; temp_carry <= a AND b AND en; END add_bits3; END my_stuff; PACKAGE BODY my_stuff IS CONSTANT My_ID : INTEGER := 2; PROCEDURE add_bits3(SIGNAL a, b, en : IN BIT; SIGNAL temp_result, temp_carry : OUT BIT) IS BEGIN -- this function can return a carry temp_result <= (a XOR b) AND en; temp_carry <= a AND b AND en; END add_bits3; END my_stuff;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Packages Use Clause l Packages must be made visible before their contents can be used m The USE clause makes packages visible to entities, architectures, and other packages -- use only the binary and add_bits3 declarations USE my_stuff.binary, my_stuff.add_bits3;... ENTITY declaration ARCHITECTURE declaration use all of the declarations in package my_stuff USE my_stuff.ALL;... ENTITY declaration ARCHITECTURE declaration...

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Libraries l Analogous to directories of files m VHDL libraries contain analyzed (i.e. compiled) VHDL entities, architectures, and packages l Facilitate administration of configuration and revision control m E.g. libraries of previous designs l Libraries accessed via an assigned logical name m Current design unit is compiled into the Work library m Both Work and STD libraries are always available m Many other libraries usually supplied by VHDL simulator vendor q E.g. proprietary libraries and IEEE standard libraries

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Attributes l Attributes provide information about certain items in VHDL m E.g. types, subtypes, procedures, functions, signals, variables, constants, entities, architectures, configurations, packages, components l General form of attribute use : l VHDL has several predefined, e.g : m X'EVENT -- TRUE when there is an event on signal X m X'LAST_VALUE -- returns the previous value of signal X m Y'HIGH -- returns the highest value in the range of Y m X'STABLE(t) -- TRUE when no event has occurred on signal X in the past ‘t’ time name'attribute_identifier -- read as “tick”

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Operators l Operators can be chained to form complex expressions, e.g. : m Can use parentheses for readability and to control the association of operators and operands l Defined precedence levels in decreasing order : m Miscellaneous operators -- **, abs, not m Multiplication operators -- *, /, mod, rem m Sign operator -- +, - m Addition operators -- +, -, & m Shift operators -- sll, srl, sla, sra, rol, ror m Relational operators -- =, /=,, >= m Logical operators -- AND, OR, NAND, NOR, XOR, XNOR res <= a AND NOT(B) OR NOT(a) AND b;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Operators Examples l The concatenation operator & VARIABLE shifted, shiftin : BIT_VECTOR(0 TO 3);... shifted := shiftin(1 TO 3) & '0'; VARIABLE shifted, shiftin : BIT_VECTOR(0 TO 3);... shifted := shiftin(1 TO 3) & '0'; l The exponentiation operator ** SHIFTIN SHIFTED x := 5**5 -- 5^5, OK y := 0.5** ^3, OK x := 4** ^0.5, Illegal y := 0.5**(-2) ^(-2), OK x := 5**5 -- 5^5, OK y := 0.5** ^3, OK x := 4** ^0.5, Illegal y := 0.5**(-2) ^(-2), OK

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Module Outline l Introduction l VHDL Design Example l VHDL Model Components l Basic VHDL Constructs l Examples l Summary

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Examples l Build a library of logic gates m AND, OR, NAND, NOR, INV, etc. l Include sequential elements m DFF, Register, etc. l Include tri-state devices l Use 4-valued logic m ‘X’, ‘0’, ‘1’, ‘Z’ m Encapsulate global declarations in a package

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Global Package PACKAGE resources IS TYPE level IS ('X', '0', '1', 'Z'); -- enumerated type TYPE level_vector IS ARRAY (NATURAL RANGE <>) OF level; -- type for vectors (buses) SUBTYPE delay IS TIME; -- subtype for gate delays -- Function and procedure declarations go here END resources;

RASSP E&F SCRA GT UVA Raytheon UCinc EIT ADL Copyright  RASSP E&F Two Input AND Gate Example USE work.resources.all; ENTITY and2 IS GENERIC(trise : delay := 10 ns; tfall : delay := 8 ns); PORT(a, b : IN level; c : OUT level); END and2; ARCHITECTURE behav OF and2 IS BEGIN one : PROCESS (a,b) BEGIN IF (a = '1' AND b = '1') THEN c <= '1' AFTER trise; ELSIF (a = '0' OR b = '0') THEN c <= '0' AFTER tfall; ELSE c<= 'X' AFTER (trise+tfall)/2; END IF; END PROCESS one; END behav;