Data Types. Composite Date Types n Arrays –Single and multi-dimensional –Arrays are single Type n Records –Records are mixed types.

Slides:



Advertisements
Similar presentations
INSTRUCTION SET ARCHITECTURES
Advertisements

Slide: 1 Copyright © AdaCore Arrays Presented Quentin Ochem university.adacore.com.
Elementary Data Types Prof. Alamdeep Singh. Scalar Data Types Scalar data types represent a single object, i.e. only one value can be derived. In general,
Introduction to VHDL (Lecture #5) ECE 331 – Digital System Design The slides included herein were taken from the materials accompanying Fundamentals of.
Comprehensive VHDL Module 6 Types November Comprehensive VHDL: Types Copyright © 2000 Doulos Types Aim ©To understand the use and synthesis.
Discussed in class and on Fridays n FSMs (only synchronous, with asynchronous reset) –Moore –Mealy –Rabin-Scott n Generalized register: –With D FFs, –With.
VHDL Data Types Module F3.1. VHDL Data Types Scalar Integer Enumerated Real (floating point)* Physical* Composite Array Record Access (pointers)* * Not.
Topics of Lecture Structural Model Procedures Functions Overloading.
N Objects n Constants n Variables n Types and Type Declarations n Numbers n Physical Types n Enumeration Types n Subtypes n Operators.
Elementary Data Types Scalar Data Types Numerical Data Types Other
N Structural Modeling: n Entities n Ports n Architectures n Packages.
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.
第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.
Lecture 18 Last Lecture Today’s Topic Instruction formats
Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & data Types.
VHDL Training ©1995 Cypress Semiconductor 1 Introduction  VHDL is used to:  document circuits  simulate circuits  synthesize design descriptions 
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
1/8/ L11 Project Step 5Copyright Joanne DeGroat, ECE, OSU1 Project Step 5 Step 2 in behavioral modeling. Use of procedures.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Lecture 3 Chap 4 Types Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
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.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
Basic VHDL RASSP Education & Facilitation Module 10 Version 2.02 Copyright  RASSP E&F All rights reserved. This information is copyrighted by.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Lecture #8 Page 1 Lecture #8 Agenda 1.VHDL : Operators 2.VHDL : Signal Assignments Announcements 1.HW #4 assigned ECE 4110– Digital Logic Design.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
Design Methodology Based on VHDL Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
Discussed in class and on Fridays n FSMs (only synchronous, with asynchronous reset) –Moore –Mealy –Rabin-Scott n Generalized register: –With D FFs, –With.
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.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
Introduction to VHDL. VHDL DARPA, VHSIC (Very High Speed Integrated Circuits) program Different manufacturers Standard language to describe –Structure.
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.
Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & data Types.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, February 25 CEC 220 Digital Circuit Design Slide 1 of 19.
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
Advanced FPGA Based System Design Lecture-6 & 7 VHDL Data Types By: Dr Imtiaz Hussain 1.
CEC 220 Digital Circuit Design Introduction to VHDL Friday, February 21 CEC 220 Digital Circuit Design Slide 1 of 10.
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.
Lecture #8 Page 1 Lecture #8 Agenda 1.VHDL : Operators 2.VHDL : Signal Assignments Announcements 1.HW #4 assigned ECE 4110– Sequential Logic Design.
IAY 0600 Digital Systems Design VHDL discussion Verification: Testbenches Alexander Sudnitson Tallinn University of Technology.
Case Study: Xilinx Synthesis Tool (XST). Arrays & Records 2.
CEC 220 Digital Circuit Design Introduction to VHDL Wed, Oct 14 CEC 220 Digital Circuit Design Slide 1 of 19.
Composite Data Types and Operations Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
13/06/59 1 Copyright  1997, KJH Introduction to VHDL Lecture 2 Prof. K. J. Hintz Department of Electrical and Computer Engineering George Mason University.
Introduction To VHDL 홍 원 의.
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
Operators Assignment Operators Logical Operators Relational Operators
VHDL Basics.
CHAPTER 10 Introduction to VHDL
ECE 434 Advanced Digital System L9
Advanced FPGA Based System Design
ECE 434 Advanced Digital System L10
Concurrent vs Sequential
IAS 0600 Digital Systems Design
IAS 0600 Digital Systems Design
Step 2 in behavioral modeling. Use of procedures.
VHDL Data Types Module F3.1.
Step 2 in behavioral modeling. Use of procedures.
COE 202 Introduction to Verilog
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

Data Types

Composite Date Types n Arrays –Single and multi-dimensional –Arrays are single Type n Records –Records are mixed types

Array n Array is an Indexed Collection of Elements All of the Same Type –One-dimensional with one index –Multi-dimensional with several indices

Constrained versus unconstrained Arrays –Constrained »the bounds for an index are established when the type is defined –Unconstrained »the bounds are established after the type is defined  Each position in the array has a scalar index value associated with it

Array Definition Syntax and Example type Large_Word is array ( 63 downto 0 ) of bit ; type Address_List is array ( 0 to 7 ) of Large_Word ; Example 1 Example 2

More examples of Array Declaration type 2D_FFT is array ( 1 to 128, 1 to 128 ) of real ; type Scanner is array ( byte range 0 to 63 ) of integer ; type Sensor_Status is array ( Stdby, On, Off ) of time ;

Unconstrained Declaration of array type Detector_Array is array ( natural range <> ) of natural ; n The symbol ‘<>’ is called a box and can be thought of as a place-holder for the index range. n Box is filled in later when the type is used. variable X_Ray_Detector : Detector_Array ( 1 to 64 ) ;

Two Examples of Predefined Unconstrained Types type string is array ( positive range <> ) of character ; type bit_vector is array ( natural range <> ) of bit ;

Two more Examples of Predefined Unconstrained Types type std_ulogic_vector is array ( natural range <> ) of std_ulogic ; type bit_vector is array ( natural range <> ) of bit ;

Unconstrained Array Ports n 1. Specify Port as unconstrained n 2. Determine size of port by Index Bounds of Signal –e.g., AND Gates With Different Number of Inputs You do the following:

1. Example of entity of Unconstrained Array Port entity And_Multiple is port ( i :inbit_vector ; y :outbit ) ; end entity And_Multiple ; i y And_Multiple You specify vector of bits with no number here

2. AND, example continued architecture And_Multiple_B of And_Multiple is begin And_Reducer : process ( i ) is variable Result : bit ; begin Result := ‘1’ ; for Index in i’Range loop Result := Result and i ( Index ) ; end loop ; variable Signal created outside the loop i y You use Range so you still do not tell how many bits

AND, example continued y <= Result ; end process And_Reducer ; end architecture And_Multiple_B ; signalHere we finished architecture And_Multiple_B without specifying number of bits In the next slide we will call this architecture structurally and at this time the number of bits will be decided

AND, e.g., signal count_value : bit_vector ( 7 downto 0 ) ; signal terminal_count : bit ; tc_gate : entity work.And_Multiple ( And_Multiple_B ) port map (i => count_value, y => terminal_count ) ; i y And_Multiple terminal_count count_value 8 bits architecture And_Multiple_B n The Input Port Is Constrained by the Index Range of the Input Signal, i.e., An 8-Input AND Gate.

Array References n Arrays Can Be Equated, Rather Than Having to Transfer Element by Element n Refer to Individual Elements By: –1. Single Index Value, e.g., A ( 5 ) –2. Range: a contiguous sequence of a one-dimensional array can be referred to by using it as an index. e.g., A( 5 to 15 ) –3. Previously defined subtype –4. Index types do not have to be the same

Examples of Array Aggregate type Sensor_Status is array ( Stdby, On, Off ) of time ; variable FLIR_Status : Sensor_Status := ( 0 sec, 0 sec, 0 sec ); variable FLIR_Status : Sensor_Status := ( On => 5 sec ) ; Sensor_Status StdbyOnOff Changes only one field

Array Aggregate Syntax type Sensor_Status is array ( Stdby, On, Off ) of time ; syntax

There are two ways to refer to elements in Array Aggregate n Two Ways of Referring to Elements –Positional: explicitly list values in order –Named Association: Explicitly list values by their index using “choices” »Order NOT important n Positional and Named Association Cannot Be Mixed Within an Aggregate.

Example of Named Association in Array Aggregate others Can Be Used in Place of an Index in a Named Association, –Indicating a Value to Be Used for All Elements Not Explicitly Mentioned variable FLIR_Status : Sensor_Status := ( Off => 10 min, others => 0 sec ) ; Named Association: Explicitly list values by their index using “choices” Order NOT important

Example of setting many elements to one value in Array Aggregate List of Elements Separated by Vertical Bars, |. n A Set of Values Can Be Set to a Single Value by Forming a List of Elements Separated by Vertical Bars, |. type 2D_FFT is array ( 1 to 128, 1 to 128 ) of real ; variable X_Ray_FFT : 2D_FFT := ( ( 60, 68 ) | ( 62, 67 ) | ( 67, 73 ) | ( 60, 60 ) => 1.0, others 0.0 ) ; Here I set 4 elements of array to 1 all other to 0

Array Operations: element by element logic operations n One-Dimensional Arrays of Bit or Boolean –Element by element AND, OR, NAND, NOR, XOR, XNOR can be done on array type Large_Word is array ( 63 downto 0 ) of bit ; variable Samp_1, Samp_2 : Large_Word ( 0 to 63 => ‘0’ ) ; Large_Word Here we declare variables Samp_1 and Samp_2 that we will use next

constant Bit_Mask : Large_Word ( 8 to 15 => ‘1’ ) ; Samp_2 := Samp_1 and Bit_Mask ; Bits from 8 to 15 are AND-ed with Bit_Mask Array Operations: element by element logic operations

NOT Operations –Complement of elements of a single array, NOT Samp_2 := not Samp_1 ; Array Operations: element by element logic operations

1D Shift and Rotate Array Operations n One-Dimensional Arrays Can Be Shifted and Rotated –Shift »Logical: Shifts and fills with zeros »Arithmetic: Shifts and fills with copies from the end being vacated –Rotate »Shifts bits out and back in at other end

Shift and rotate operations B” 1010_1100 ” sll 4 == B” 1100_0000 ” B” 1010_1100 ” sla 4 == B” 1100_0000 ” B” 1010_1100 ” sra 4 == B” 1111_1010 ” B” 1010_1100 ” rol 4 == B” 1100_1010 ” Rotate left Shift right arithmetic Shift left logic

Relational Array Operations n One-Dimensional Arrays Can Be Operated on by Relational Operators, =, /=,, >= –Arrays need not be of the same length –Arrays must be of same type

Array Operations: Concatenation n Concatenation Operator, & –Can combine array and scalar B” 1010_1100 ” & B” 1100_0000 ” == B” 1010_1100_1100_0000 ” B” 1010_1100 ” & ‘1’ == B” 1010_1100_1 ”

Conversion from one Array Type to another n One Array Type Can Be Converted to Another If: –Same element type –Same number of dimensions –Same index types

Example of Array Type Conversions Example subtype name is string ( 1 to 20 ) ; type display_string is array ( integer range 0 to 19 ) of character ; variable item_name : name ; variable display : display_string ; display := display_string ( item_name ) ; 0 to 19 1 to 20

Example of Array Aggregate n Assignments Can Be Made From a Vector to an Aggregate of Scalars or Vice-Versa. type Sensor_Status is array ( Stdby, On, Off ) of time ; variable Stdby_Time, On_Time, Off_Time : time ; Variable FLIR_Status : Sensor_Status := ( 0 sec, 0 sec, 0 sec ) ; ( Stdby_Time, On_Time, Off_Time ) := Flir_Status ; Aggregate of scalars

Predefined Attributes n Predefined Attributes deal with data obtained from Blocks, Signals, Types and Subtypes n Return values such as: – length of an array type – time since last signal change – range of values in a type n Predefined attributes are useful for performing certain type of functions such as: – timing checks – bounds – clock edge detection – type conversion We showed earlier attributes for signals. Now we show for types

Array Type Bound Example: use of predefined attributes attribute

Another Example of array bound

Multi-range array attributes

Array length attributes

Range attributes

Type attributes position function

Homework: Attributes Exercise

Example of using Attributes We calculate resistance dividing voltage by current

User Defined Attributes n These attributes attach data to objects n They are defined by the user of Data types n Data is constant n They are accessed with the same syntax as predefined attributes

User Defined Attributes

Records n Records in VHDL are collections of Named Elements of Possibly Different Types. n To refer to a Field of a Record Object, you should use a Selected Name.

Example of a Record * type instruction is record op_code : processor_op ; address_mode : mode ; operand1, operand2 : integer range 0 to 15 ; end record ; *Ashenden, VHDL cookbook

Records n Aggregates Can Be Used to Write Literal Values for Records. n Positional and Named Association Can Be Used –Record field names being used in place of array index names.

End of Lecture

Sources Prof. K. J. Hintz Department of Electrical and Computer Engineering George Mason University