Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL S i g n a l s & D a t a T y p e s Page 1.

Slides:



Advertisements
Similar presentations
Multiplexers Section 3-7 Mano & Kime. Multiplexers & Demultiplexers Multiplexers (Selectors) Lab 1 – Behavioral VHDL -- Multiplexers MUX as a Universal.
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.
VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
Comprehensive VHDL Module 6 Types November Comprehensive VHDL: Types Copyright © 2000 Doulos Types Aim ©To understand the use and synthesis.
VHDL Data Types Module F3.1. VHDL Data Types Scalar Integer Enumerated Real (floating point)* Physical* Composite Array Record Access (pointers)* * Not.
Introduction to VHDL Multiplexers. Introduction to VHDL VHDL is an acronym for VHSIC (Very High Speed Integrated Circuit) Hardware Description Language.
Introduction to VHDL CSCE 496/896: Embedded Systems Witawas Srisa-an.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
Programming in VHDL Using Processes. How Processes Run A process is either in suspend mode or is running. For a process to run, there has to be a change.
Introduction to VHDL Multiplexers Discussion D1.1.
第6章 VHDL NUMBERS, STRINGS, AND EXPRESSIONS 義守大學電機工程學系 陳慶瀚
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
1 Lecture 11 Chap 13: Test Benches Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Reconfigurable Computing - VHDL – Types & Statements John Morris The University of Auckland Iolanthe on the Hauraki Gulf.
Introduction to VHDL (part 2)
1 H ardware D escription L anguages Basic Language Concepts.
Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & data Types.
Reconfigurable Computing - VHDL - Types John Morris Chung-Ang University The University of Auckland.
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
10/17/2015DSD, USIT, GGSIPU1 Data Types Each data object has a type associated with it. The type defines the set of values that the object can have and.
IAY 0600 Digital Systems Design
Capt Michael Tanner Room 2F46A
1 CAD for VLSI Tutorial #1 VHDL - Very High Speed Integrated Circuit (VHSIC) 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.
1 Introduction to VHDL Spring What is VHDL? VHDL can be uses to model and synthesise digital systems. VHDL = VHSIC Hardware Description Language.
Packages and Use Clauses 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.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
IAY 0600 Digital Systems Design VHDL discussion Verification: Testbenches Alexander Sudnitson Tallinn University of Technology.
1 VHDL Overview A Quick Start Tutorial. 2 What does VHDL stand for ? V HSIC H ardware D escription L anguage VHSIC: V ery H igh S peed I ntegrated C ircuits.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Reconfigurable Computing - VHDL - Types John Morris Chung-Ang University The University of Auckland.
VHDL Basics. VHDL BASICS 2 OUTLINE –Component model –Code model –Entity –Architecture –Identifiers and objects –Operations for relations VHDL ET062G &
L13 – VHDL Language Elements. VHDL Language Elements  Elements needed for FPGA design Types  Basic Types  Resolved Types – special attributes of resolved.
Lecture #7 Page 1 Lecture #7 Agenda 1.VHDL Data Types Announcements 1.n/a ECE 4110– Digital Logic Design.
IAY 0600 Digital Systems Design VHDL discussion Dataflow Style Combinational Design Alexander Sudnitson Tallinn University of Technology.
L19 – Resolved Signals. Resolved Signals  What are resolved signals In systems In VHDL Resolution – Isn’t that for resolving conflicts?  Ref: text Unit.
IAY 0600 Digital Systems Design
DATA TYPES 1.Pre-Defined Data Types 2. User-Defined Data Types.
Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & data Types.
8-Jan-16EE5141 Chapter 6 Subprograms & Packages Subprogram declaration Subprogram body Package declaration Package body Resolution function Subprogram.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
ECOM 4311—Digital System Design with VHDL
BASIC VHDL LANGUAGE ELEMENTS Digital Design for Instrumentation with VHDL 1.
ECOM 4311—Digital System Design with VHDL
L20 – Register Set. The 430 Register Set  Not exactly a dual ported register set, but a dual drive register set.  Ref: text Unit 10, 17, 20 9/2/2012.
1/8/ L11 Project Step 5Copyright Joanne DeGroat, ECE, OSU1 Project Step 7 Behavioral modeling of a dual ported register set.
VHDL Tutorial.
Case Study: Xilinx Synthesis Tool (XST). Arrays & Records 2.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
IAY 0600 Digital Systems Design
Introduction To VHDL 홍 원 의.
Basic Language Concepts
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
B e h a v i o r a l to R T L Coding
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Reconfigurable Computing - VHDL - Types
IAS 0600 Digital Systems Design
ECE 434 Advanced Digital System L17
ECE 434 Advanced Digital System L15
IAS 0600 Digital Systems Design
IAS 0600 Digital Systems Design
VHDL Data Types Module F3.1.
Data Types Each data object has a type associated with it.
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL S i g n a l s & D a t a T y p e s Page 1

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Objectives  Introduction to Data-Types, capabilities and usage.  Scalar Types  Composite Types  Enumerated Types  Aggregates  Range Attributes Page 2

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL  Data-types are very important in VHDL. A given data-type allows only values within its range to be applied. Each object (signal, variable, constant) or port must have its type define when declared. VHDL is considered to be a strongly “typed” language, connected signals must be of the same type! The wide range of data-types available provides both flexibility in hardware modeling, and built-in error checking to ensure signal compatibility in large and complex hardware models. Data-Types Page 3

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Signals & Ports entity REG_4 is port ( D_in : in std_logic_vector (3 downto 0); Clock, Reset : in std_logic; Q_out : out std_logic_vector (3 downto 0)); end entity REG_4; signal A : integer ; signal B : bit ; signal C : integer ; signal D : std_logic ; A <= C; A <= C + 1; A <= B; D <= C; B <= D; Data-types must match on signal assignments ! Page 4

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Scalar Data-types  Scalar data-types are single values –In VHDL, this class includes: Bit Boolean Integer Real Physical Character Std_logic (Std_ulogic) Enumerated Page 5

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Bit & Boolean type bit is ( ‘0’, ‘1’ ) ; type boolean is ( false, true ) ; Type bit is helpful and concise for modeling hardware, but does not provide for high-impedance, unknown, don’t care, Etc. Type boolean is useful for modeling at the more abstract level. All relational operators return a value of type boolean. architecture BEHAVE of MUX is signal A,B,Sel, Z : bit ; begin if Sel = ‘1’ then Z <= A ; else Z <= B ; end if... if Sel =‘1’, if F >= G both yield a boolean Page 6

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Integer & Real type integer is range... Type integer allows for flexible, readily intuitive quantities and values in our models. It is essential to specify the range of any object of type integer, otherwise the language requires that synthesis tools generate a minimum 32 bit implementation. type real is range... Type real allows us to utilize floating point values and operations in our models. Since the range of real numbers is unlimited, we declare our type with the intended real number range. ( Real is not synthesizable !) signal A : integer range 0 to 7; signal B : integer range 15 downto 0 ; type CAPACITY is range to 25.0 ; signal Sig_1 : CAPACITY := 3.0 ; Page 7

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Physical Physical types are used to quantify real world physical concepts and amounts, such as mass, length, time, Etc. A physical type must be defined in terms of its primary unit, any secondary units must be multiples of the primary. Time is a pre-defined physical type in VHDL, it is important in our models for cell delays and other time based parameters. type time is range units fs; ps = 1000 fs; ns = 1000 ps; us = 1000 ns; ms = 1000 us;... constant Tpd : time := 3ns ;... Z <= A after Tpd ; Page 8

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Character type character is... In VHDL’93 Character literals can include any member of the full ISO character set. Note that VHDL ‘87 is limited to the 128 members of the ASCII set. signal MY_INIT : character ; signal End_of_Line : character ;... MY_INIT <= ‘E’ ; End_of_Line <= cr ; Page 9

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Std_logic (Std_ulogic) type std_ulogic is ( ‘U’ ; -- Uninitialized ‘X’ ; -- Forcing Unknown ‘0’ ; -- Forcing Zero ‘1’ ; -- Forcing One ‘Z’ ; -- High Impedance ‘W’ ; -- Weak Unknown ‘L’ ; -- Weak Zero ‘H’ ; -- Weak One ‘ - ‘; -- Don’t Care ) Type Std_logic was developed from the MVL (Multi-Value Logic) system and provides for more detailed hardware modeling. It supports different signal strengths, “don't-care” conditions and bussed structures with tri-state drivers. Note: type bit is limited to (‘0’, ‘1’). Page 10

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Std_logic Vs. Std_ulogic Both Std_logic and Std_ulogic contain the same set of same possible values. The difference is in implementation, the “u” in ulogic means “unresolved”. If we are using std_logic, and we wish to drive two or more signals to a common output, we may write a resolution function to indicate which driver is actually applied to the output. Std_ulogic offers no such capability, but provides an built-in means of error checking for inadvertent wire-oring of outputs. signal A,B,C,Res_Out : std_logic ; signal Out_1 : std_ulogic ; Out_1 <= A ; Out_1 <= B ; Out_1 <= C ; C 7 B A Out_1 C 4 B A Res_Out <= A; Res_Out <= B; Res_Out <= C; Res_Out Page 11

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Enumerated Enumerated types offer perhaps the most flexibility in abstract hardware models. We can use these types to specify values that are immediately recognizable and intuitively relevant to the operation of the model. This capability makes our code more readable when describing state machines and complex systems. type My_State is ( RST, LOAD, FETCH, WAIT, SHIFT ) ;... signal STATE, NEXT_STATE : My_State ;... Case (STATE) is when LOAD => if (COND_A and COND_B) then NEXT_STATE <= FETCH ; else NEXT_STATE <= WAIT ;... Page 12

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Composite Data-Types Composite Data_types are groups of elements in the form of an array or record. Bit_vector and Std_logic_vector are pre-defined composite types. signal A_word : bit_vector (3 downto 0) := “0011” This represents four “bit” elements grouped together into an array, there is no pre-defined LSB or MSB interpretation, therefore is not read as 3, ‘3’, or “3”. Page 13

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Arrays Arrays are groups of elements, all of the same type ! type WORD is array (3 downto 0) of std_logic ; index position 0123 B_bus What are the possible values for each element of the array ? signal B_bus : WORD ; type DATA is array (3 downto 0) of integer range 0 to 9 ; Remember to specify the integer range, to limit width of synthesized module ! Page 14 signal B_bus : DATA ;

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Array Assignments  When assigning arrays, the following rules apply. 1. The arrays must be the same type. 2. The arrays must be the same length. 3. The assignment is positional, from left to right ! signal My_BusA, My_BusB: bit_vector (3 downto 0 ); signal My_BusC, My_BusD: bit_vector ( 0 to 3 ); My_BusA My_BusC My_BusB My_BusB <= My_BusA ;.... My_BusC <= My_BusA ; Inadvertent bit-swap ? Page 15

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Records Records are groups of elements, that may be different types ! type OPCODE is record PARITY : bit; ADDRESS : std_logic_vector ( 0 to 3 ); DATA_BYTE : std_logic_vector ( 7 downto 0 ); NUM_VALUE : integer range 0 to 6; STOP_BITS : bit_vector (1 downto 0); end record ;... signal TX_PACKET, RX_PACKET : OPCODE; PARITYADDRESSDATA_BYTENUM_VALUESTOP_BITS... T X _ P A C K E T Page 16

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Aggregates  Aggregates are a convenient means of grouping both scalar and composite data-types for signal assignment. signal H_BYTE, L_BYTE: std_logic_vector (7 downto 0); signal DATA : std_logic_vector (15 downto 0); signal A, B, C, D : std_logic; signal WORD : std_logic_vector (3 downto 0); signal TX_PACKET, RX_PACKET : OPCODE; ( H_BYTE, L_BYTE ) <= DATA ; WORD <= ( A, B, C, D ) ; DATA ‘1’) ; WORD ‘1’, 3 => D, Others => ‘0’ ) ; The total number of elements on both sides are the assignment must match, “Others” can be used as a default assignment, regardless of the array size. Page 17 TX_PACKET <= ( ‘1’,”0011”,” ”,5,”10” ) ; TX_PACKET. ADDRESS <= ( “0011” ) ;

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Range Attributes  VHDL provides attributes for both scalar and composite data-types. The following range attributes are especially helpful in making our code more versatile and portable for operations on arrays. range `left range `right range `low range `high range `range range `length range `ascending... signal H_BYTE : std_logic_vector ( 7 downto 0 ) ; signal WORD : std_logic_vector ( 0 to 3 ) ; H_BYTE `left returns 7, H_BYTE `right returns 0, H_BYTE `low returns 0, H_BYTE `range returns 7 downto 0, WORD `left returns 0, WORD `low returns 0, WORD `length returns 4, WORD `ascending returns TRUE, Page 18

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Summary  Each object and port must have its type defined.  VHDL provides scalar and composite data-types.  Enumerated types can be used to enhance code readability.  Aggregates assignments can be made for arrays and records.  Types on connecting signals must match ! Page 19

Signals & Data-typesVer 1.1, Copyright 1997, TS, Inc. VHDL Questions Which of the following are permissible in VHDL, and why ? signal A_Bus, B_Bus: std_logic_vector (7 downto 0) ; signal Data_Word : std_logic_vector (15 downto 0) ; signal A, B, C, D, : std_logic ; signal Nibble : std_logic_vector (3 downto 0) ; type My_State is ( S1, S2, S3, S4) ; signal State, Next_State : My_State ; Given: A_Bus A, 5=>B, 3=>C, Others => ‘1’ ) ; Next_State <= (S1, S2) ; Data_Word <= (Nibble, Nibble, A_Bus) ; Page 20