Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & data Types.

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

VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
ECE C03 Lecture 161 Lecture 16 Introduction to VHDL Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
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.
Signals vs. Variables Workshop Fri/Sat Test bench creation Misc IP Cores Chipscope Pro When Demos due.
Data Types. Composite Date Types n Arrays –Single and multi-dimensional –Arrays are single Type n Records –Records are mixed types.
ECE C03 Lecture 121 Lecture 12 Introduction to VHDL Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Introduction to VHDL CSCE 496/896: Embedded Systems Witawas Srisa-an.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
Topics of Lecture Structural Model Procedures Functions Overloading.
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.
第6章 VHDL NUMBERS, STRINGS, AND EXPRESSIONS 義守大學電機工程學系 陳慶瀚
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
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
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.
IAY 0600 Digital Systems Design VHDL discussion Dataflow&Behavioral Styles Combinational Design Alexander Sudnitson Tallinn University of Technology.
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.
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.
IAY 0600 Digital Systems Design VHDL discussion Verification: Testbenches Alexander Sudnitson Tallinn University of Technology.
1 Introduction to VHDL part 1 Fall Preliminary Class web page egre365/index.html Syllabus Grades: –Quizzes.
(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.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
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.
© 조준동 2008 ECE C03 Lecture 121 Lecture 12 Introduction to VHDL Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
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
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
Apr. 3, 2000Systems Architecture I1 Introduction to VHDL (CS 570) Jeremy R. Johnson Wed. Nov. 8, 2000.
May 9, 2001Systems Architecture I1 Systems Architecture I (CS ) Lab 5: Introduction to VHDL Jeremy R. Johnson May 9, 2001.
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.
IAY 0600 Digital Systems Design VHDL discussion Verification: Testbenches Alexander Sudnitson Tallinn University of Technology.
Case Study: Xilinx Synthesis Tool (XST). Arrays & Records 2.
IAY 0600 Digital Systems Design
Introduction To VHDL 홍 원 의.
Basic Language Concepts
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
Comprehensive VHDL Module 9 More on Types November
Verification: Testbenches in Combinational Design
VHDL Basics.
Dataflow Style Combinational Design with VHDL
CHAPTER 10 Introduction to VHDL
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
ECE 434 Advanced Digital System L10
IAS 0600 Digital Systems Design
CPE 528: Lecture #3 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
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:

Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & data Types (Signals, Variables, Constants, Literals, Character)  Types and Subtypes (Scalar & Composite types).

Concordia University 2 - A library clause declares a name that denotes a library. The name can be any legal identifier. - A library clause can declare more than one library name by declaring all the library names separated by comma. - Examples for user defined libraries: library Designs; -- Declaration for the Designs library use Designs.all; -- Use statement grants visibility of declarations inside the library --Examples for predefined libraries - Every design assumes the following 2 statement: library STD; use STD.STANDARD.all; -- Package STANDARD inside library STD -Every design assumes “ Library WORK” clause

Concordia University 3 - In VHDL there are no arithmetic operators for types that require bit operation. - Most VHDL Simulators these days provide arithmetic packages to perform arithmetic operations using STD_LOGIC_1164 types. - Some companies provide many math packages such as floating point. - Some synthesis tool provide special software that maps some functions such as adders, subtractors, multipliers, registers, counters etc. to ASIC library cells. - Most synthesis companies nowadays provide component packages for a variety of cells such as power and ground pads, I/O buffers, clock driver, 3- state pads etc. This is usually done by 2 stages first technology-independent codes are generated and then the components are mapped to primitives for technology dependent libraries after synthesis.

Concordia University 4 -- the types declared in the standard package are used similar to the way that the reserved words are used package subset_STANDARD is type BOOLEAN is (FALSE, TRUE); type BIT is ( ‘0’, ’1’); type SEVERITY_LEVEL is (NOTE, WARNING, ERROR, FAILURE); subtype NATURAL is INTEGER range 0 to INTEGER’HIGH; subtype Positive is INTEGER range 1 to INTGER’HIGH; type BIT_VECTOR is array (Natural rang<> ) of BIT; type STRING is array (Positive range <>) of CHARACTER; subtype DELAY_LENGTH is TIME range 0 fs to TIME’HIGH; -- A STRING array must have a positive index. -- The type TIME is declared in the STANDARD package as: type TIME is range implementation_defined Units fs; ps = 1000 fs; ns = 1000 ps; us = 1000 ns; ms =1000 us; sec = 1000 ms; end units; end subset_STANDARD;

Concordia University 5 - VHDL does not have a in build logic value system. The STANDARD package pre-defines the type BIT with two logic values of ‘0’ and ‘1’. - Normally additional values of ‘X’ (unknown) and ‘Z’ (high impendence) are also needed. - CMOS circuits require more levels and strengths. - The STD_LOGIC_1164 package includes functions to perform logical, shift, resolution and conversion functions. To access this package, the following statements have to be included: library IEEE; use IEEE.STD_LOGIC_1164.all; - The STD_LOGIC_1164 package contains definitions for a nine-value logic system. - The STD_ULOGIC is defined in STD_LOGIC_1164.

Concordia University 6 package subset_STD_1164 is -- defines the 9-vlaue logic system type STD_ULOGIC is ( ‘ U ’,-- Un-initialized ‘ X ’,-- Forcing unknown ‘ 0 ’,-- Forcing zero ‘ 1 ’,-- Forcing one ‘ Z ’,-- High Impedance ‘ W ’,-- Weak Impedance ‘ L ’,-- Weak zero ‘ H ’,-- Weak 1 ‘ _ ’, ); -- Don’t Care type STD_ULOGIC_VECTOR is array (Natural range <> ) of STD_ULOGIC; function resolved ( S: STD_ULOGIC_VECTOR) return STD_ULOGIC; subtype STD_LOGIC is resolved STD_ULOGIC; type STD_LOGIC_VECTOR is array(NATURAL range <>) of STD_LOGIC; function rising_edge (signal S: STD_ULOGIC) return BOOLEAN; falling_edge (signal S: STD_ULOGIC) return BOOLEAN; end subset_STD_1164; This type is used in most structural designs

Concordia University 7 library IEEE; use IEEE.STD_LOGIC_1164.all; entity control_buffer is port (A,OE : in std_logic; Y: out std_logic); end control_buffer; architecture arch1 of control_buffer is signal n: std_logic; - - Internal Signal Declaration begin n <= not A ; Y <= n when OE = ‘0’ else ‘Z’; end arch1; See new logic value New type

Concordia University 8 -- Place the library & use statements in front every entity library IEEE; use IEEE.STD_LOGIC_1164.all; entity package_1 …. end package_1; library IEEE; use IEEE.STD_LOGIC_1164.all; entity NO_1 …. end NO_1; library IEEE; use IEEE.STD_LOGIC_1164.all; Architecture structure of No_1 is …. end structure use IEEE.STD_LOGIC_1164.all; entity NO_2 …. end NO_2; Not essential Makes the entity visible to logic type used

Concordia University 9 signal identifier (Label) : subtype (bus/register) [<= expression] - A signal has a history of values. It has a past, present and future value -The expression specifies the initial value of the signal at simulation time. The expression is evaluated at each elaboration of the signal. - The default initial value for a signal of a scalar type T is T’left. - Signal can be only declared in concurrent descriptions. signal Sig_1: Bit; signal Address_Bus: BIT_VECTOR (31 downto 0); signal Bus: tristate; signal A, B, C : BIT_VECTOR (0 to 3); signal A: BIT<=‘0’; Initialized

Concordia University to make a signal global, declare it in a package and make the --package visible to the entities that requires it package GLOBAL_1 is signal M: std_logic; end GLOBAL_1; use WORK.GLOBAL_1. M ; -- Accessing a global signal architecture DATA of MULT is begin end DATA; M can be used here without declaration

Concordia University 11 A Concurrent signal assignment assigns a new value to the target signal whenever any of the signals on the right hand side change: Example: architecture SIG_ASSIGN of Half_Adder is begin SUM <= A xor B; CARRY <= A and B; end SIG_ASSIGN; A Concurrent signal assignment assigns a new value to the target signal whenever any of the signals on the right hand side change: Example: architecture SIG_ASSIGN of Half_Adder is begin SUM <= A xor B; CARRY <= A and B; end SIG_ASSIGN;

Concordia University 12 A signal assignment may have a delay specified: architecture DIFFERENT of SIG is constant A_Delay : time := 20ns; begin SUM <= A xor B after A-Delay -1 ns; CARRY <= A and B after 9 ns; end DIFFERENT; NOTE: Synthesis tools usually treat a signal assigned with a concurrent statement as combinational logic. Delays are ignored.

Concordia University 13 variable identifier (Label): subtype (bus/register) [:= expression] - A variable has only one value (current). - The expression specifies the initial value. The expression is evaluated at each elaboration of the variable. - The default initial value for a scalar type variable T is T’left. - It is a sequential statement and used inside processes, procedures and functions. -The value of the right hand side is copied immediately variable A : BIT := ‘ 0’; variable R20 : Integer; variable CHA : character := ‘Z’; variable BV: Bit Vector (0 to 3) := “0101”; variable volts : real := 2.67; Variables are synthesizeable if their type is acceptable by the synthesis tools.

Concordia University Delay can not be assigned to variables Assignments may be made from signals to variables and vice-versa, but types have to match: process (A, B, C, DIFF) variable Z : integer range 0 to 7; begin if DIFF = '1' then Z := B; else Z := C; end if; Y <= A * B + Z; -- Y has been declared as signal end process;

Concordia University 15 constant identifier (Label) : subtype (bus/register) [:= expression] -- Example constant my_weight: weight := 65 Kg ; constant period : TIME := 20ns ; constant Pai : real := 3.14 ; constant All_Ones: vector_4 := “1111” ; -- All subtypes are pre-defined. Constants can be synthesized if their type is acceptable by the synthesis tool.

Concordia University 16 --Literals are the values given to VHDL objects --Examples of decimal literals I1:= ; or I2:= 150_000; 0r I3:= 15 e4;.. All are the same R1:=1500.0; or R2:= 1_500.0; or R3:-1.5e3; --examples of based literals --The base can be either hexadecimal, octal or binary For example Integer literal of value 255 can be expressed as: In binary as 2#1111_1111 or In Octal as O#773# or In Hexadecimal as 16 # FF# --Bit string-literals X“FFE”= B” ” O“765”= B”111_110_101” (Where X is hexadecimal, O is Octal)

Concordia University 17 Character literals Between two ‘ ’ (comas) characters: ‘B’ ‘b’ ‘?’ String literals - Text inside two “ ” (double comas) characters: - A string must be fitting on a single line. - Concatenation operation is used to combine strings longer than one line. “When First line is full then we can continue be placing an “ &” “ we have continued on the second line ”

Concordia University 18 -Scalar Types  Single numerical value  Enumerated - Composite Types  Arrays  Records - Access Types  Pointers - File Types  Objects that contain a sequence of values for reference Integer, real, physicalCollection of values Of the same type Of different types

Concordia University 19 - A type is defined by a set of values and a set of actions/operations. Example: type Nibble_value is range 0 to 15 ; - A further constraint might be applied to values of a given type. Then a subtype is a type along with the added constraint. Example: subtype COUNT is INTEGER range 1 to 255 ; subtype SEVEN_BIT is COUNT range 1 to 127 ;  Constraint is checked during each simulation.

Concordia University 20 - CHRACTER 128 ASCII characters - BIT (‘0’, ‘1’) - BOOLEAN (FALSE, TRUE) - SEVERITY_LEVEL (NOTE, WARNING, ERROR, FAILURE) --Examples of Enumerations types are: type Transition is (H,L,U,Z) ; type STATE is (S1,S2,S3) ; type logic_strength is (W,S,D,) ; -- Enumeration literals must be characters and in ascending range

Concordia University The only pre-defined integer is INTEGER. -- Example type WEIGHT is INTEGER range 300 downto 30 ; subtype HEAVY is WIGHT range 100 to 250 ; subtype LIGHT is WEIGHT range 60 downto 40 ; -- Pre-defined -- Integer Range: ± Natural Range: 0 to Positive Range: 1 to 2 31

Concordia University ~ (Approx.) Real Numbers -- Contains a range constraint -- Example Type WIEGHT is range 0.5 to ; Subtype VERY-LIGHT is WEIGHT range 1.0 to 10.0 ; -- Pre-defined -- Real numbers are in Package STANDARD -- Guaranteed to include the range -- Natural Range: - 1E 31 to + 1E Real data types supports: =, /=,, >=, +, -, abs, *, /

Concordia University 23 -It is predefined in Package STANDARD  Includes the range to  All delays declared in VHDL must be of the type TIME type TIME is range - 1E 18 to + 1E 18; units fs; ps = 1000 fs; ns = 1000 ps; us = 1000 ns; ms =1000 u; sec = 1000 ms; min = 60 sec; hr = 3600 sec; end units; -- fs femto second ( seconds) is the base unit -- Values can be real or integer

Concordia University Example: User Defined Capacitance type Capacitance is range 0 to 2** 31 –1 ; Units aF; fF = 1000 aF; pF = 1000 fF; nF = 1000 pF; uF = 1000 nF; mF = 1000 uF; end units; -- Example: User Defined Voltage type Voltage is range 0 to 2** 31 –1 ; Units pV; nV = 1000 pV; uV = 1000 nV; mV = 1000 uV; V =1000 mV; end units;

Concordia University 25 - Array is collection of objects/values of similar type. Example type array_1 is array (15 downto 0) of std_ulogic; This array declaration defines array_1 that contains 16 elements. The indexes are decremented from15 to 0. An Array can be put under a decrement or increment mode with (y downto x) or (x to y ). - Multi-dimensional Array Arrays can have multiple indices: type Dimension_2 is array ( 0 to 7, 10 downto 0) of byte;

Concordia University 26 Array Type can be declared as Constrained or Unconstrained Constrained Array: array (discrete range) of element subtype indication Unconstrained Array: array (subtype name range) of element subtype indication -- Example: Array Types type word is array (7 downto 0) of BIT ; type memory is array (natural range <> ) of word ; variable ROM: memory (0 to 2 ** 10) ; variable Address: BIT_VECTOR (0 to N) ; signal mem1: word;

Concordia University 27 entity example_array end example_array; architecture Behave of example_array is type word is array (0 to 15) of BIT ; type byte is array (NATURAL range 7 downto 0) of BIT ; type unconstrained is array (NATURAL range ) of BIT ; begin is for the range that is not defined at the time. -- Range can be declared later when using the array, for example: subtype array_a is unconstrained (4 downto 0) ;

Concordia University 28 - Is a single dimensional vector, each element is of type BIT. - Bit Vector Array is pre-defined in the STANDARD Package. - Bit Vector is really a template for the elements of an array. Example COEN: out BIT_VECTOR (7 downto 0) ; Subtype Indication Indices (Length) of the array COEN <= B“ ” ; signal destiny : BIT_VECTOR (7 downto 0) destiny <= B“ ” ; COEN destiny

Concordia University Example subtype NATURAL is INTEGER range 0 to 2** 31 ; type BIT_VECTOR array (NATURAL range ) of BIT; type POSITIVE is INTEGER range 1 to 2** 31 ;

Concordia University architecture CONCURRENT of Half_Adder is begin SUM<= X XOR Y; CARRY<= X AND Y; End CONCURRENT; architecture ALGORITHMIC of Half_Adder is begin process (X,Y) begin SUM<= X XOR Y; CARRY<= X AND Y; end process; End ALGORITHMIC; 30 BEHAVIORAL_Concurrent verses Algorithm Concurrent entity normally infer logic design architecture BEHAVIORAL of Half_Adder is -- signal X,Y : integer; --X and Yare read as integers --signal SUM,CARRY: BIT; in the interface begin process (X, Y) variable Z : integer; begin SUM<=‘0’; CARRY<=‘0’; Z := X+ Y; if Z =1 then SUM <= ‘1’; elsif Z=2 then CARRY<=‘1’; end if; end process; end BEHAVIORAL;

Concordia University 31

Concordia University 32 Simulation of Half Adder

Concordia University 33 A good site for VHDL Syntax + Examples