IAY 0600 Digital Systems Design

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.
Introduction to VHDL (Lecture #5) ECE 331 – Digital System Design The slides included herein were taken from the materials accompanying Fundamentals of.
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.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
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.
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.
Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & data Types.
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
IAY 0600 Digital Systems Design
Reconfigurable Computing - VHDL - Types John Morris Chung-Ang University The University of Auckland.
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
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.
Verilog Language Concepts
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.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #16 – Introduction.
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.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Refresher Lecture 2.
IAY 0600 Digital Systems Design VHDL discussion Verification: Testbenches Alexander Sudnitson Tallinn University of Technology.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
VHDL Basics. VHDL BASICS 2 OUTLINE –Component model –Code model –Entity –Architecture –Identifiers and objects –Operations for relations VHDL ET062G &
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.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
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.
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.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
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.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
ECOM 4311—Digital System Design with VHDL
Advanced FPGA Based System Design Lecture-6 & 7 VHDL Data Types By: Dr Imtiaz Hussain 1.
IAY 0600 Digital Systems Design Event-Driven Simulation VHDL Discussion Alexander Sudnitson Tallinn University of Technology.
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.
IAY 0600 Digital Systems Design
Basic Language Concepts
IAY 0600 Digitaalsüsteemide disain
Design Entry: Schematic Capture and VHDL
Verification: Testbenches in Combinational Design
VHDL Basics.
Dataflow Style Combinational Design with VHDL
Structural style Modular design and hierarchy Part 1
IAY 0600 Digital Systems Design
IAS 0600 Digital Systems Design
ECE 434 Advanced Digital System L17
CHAPTER 10 Introduction to VHDL
Structural style Modular design and hierarchy Part 1
CPE 528: Lecture #4 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
CPE/EE 422/522 Advanced Logic Design L11
VHDL Discussion Subprograms
IAS 0600 Digital Systems Design
IAS 0600 Digital Systems Design
CPE 528: Lecture #3 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
VHDL Discussion Subprograms
IAS 0600 Digital Systems Design
IAS 0600 Digital Systems Design
VHDL Data Types Module F3.1.
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

IAY 0600 Digital Systems Design VHDL discussion -1- Signals and Data Types Alexander Sudnitson Tallinn University of Technology

Port Mode IN Data comes in this port and can only be read within the entity. It can appear only on the right side of a signal or variable assignment. a Entity Port signal Driver resides outside the entity

Port Mode OUT The value of an output port can only be updated within the entity. It cannot be read. It can only appear on the left side of a signal assignment Entity Port signal Driver resides inside the entity z c <= z c Output cannot be read within the entity

Port Mode OUT (with extra signal) The value of an output port can only be updated within the entity. It cannot be read. It can only appear on the left side of a signal assignment. Port signal Entity Driver resides inside the entity x c z z <= x c <= x Signal x can be read inside the entity

Port Mode BUFFER Entity Port signal z c Port signal Z can be Used for a signal that is an output from an entity. The value of the signal can be used inside the entity, which means that in an assignment statement the signal can appear on the left and right sides of the <= operator The value read by the port is the same as the value driven by the port. Entity Port signal Driver resides inside the entity Port signal Z can be read inside the entity c z c <= z

Port Mode INOUT Port signal Entity a Signal can be The value of a bi-directional port can be read and updated within the entity model. It can appear on both sides of a signal assignment. The value read from the port is the result of resolution of the value assigned to the port and the values driven by all other sources that connect to the port. Signal can be read inside the entity Entity Port signal Driver may reside both inside and outside of the entity a

Predefined types Predefined scalar types Predifined (built-in) types are those defined in packges STANDARD and TEXTIO in the library STD. Predefined types

Composite type Array (groups elements of the same type together as single object). A one-demensional array is also called a vector.) Record (may be of different type)

Fundamental parts of a Library Library is a collection of commonly used pieces of code, grouped for reuse. LIBRARY PACKAGE 1 PACKAGE 2 TYPES CONSTANTS FUNCTIONS PROCEDURES COMPONENTS TYPES CONSTANTS FUNCTIONS PROCEDURES COMPONENTS

VHDL for Synthesis (vs. for Simulation) VHDL was originally developed as a language for describing digital systems for the purpose of documentation and simulation, but not for synthesis. In 1999, the IEEE issued IEEE Std 1076.6-1999, IEEE Standard for VHDL Register Transfer Level (RTL) Synthesis. This standard described a subset of IEEE Std 1076 suitable for RTL synthesis. It also described the syntax and semantics of this subset with regard to synthesis. IEEE 1076.6 defines a subset of the language that is considered the official synthesis subset. A revision of this standard was issued in 2004.

Commonly Used Libraries ieee (Specifies multi-level logic system including STD_LOGIC, and STD_LOGIC_VECTOR data types) std (Specifies pre-defined data types (BIT, BOOLEAN, INTEGER, REAL, SIGNED, UNSIGNED, etc.), arithmetic operations, basic type conversion functions, basic text i/o functions, etc.) work (User-created designs after compilation) Needs to be explicitly declared Visible by default

Implicit context clause LIBRARY std, work; USE std.standard.all;

STD_ULOGIC (enumeration type) Type STD_ULOGIC is declared inpackage STD_LOGIC_1164 as: type_ulogic is ('U‘, ‘X’, ‘0’, ‘1’, ‘Z’, ‘W’, ‘L’, ‘H’, ‘-’);

STD_ULOGIC Type STD_ULOGIC is unresolved type. By default, types whether predefined or user defined, are unresolved. It is illegal for two sources to drive the same signal (compiler error is generated). Using STD_ULOGIC has an advantge that if our design unintenentionally creates two sourses for a signal (conflict), we can catch this error during compilation.

State and strength properties of std_ulogic Value Meaning 'U' Uninitialized ‘X’ Forcing (Strong driven) Unknown ‘0’ Forcing (Strong driven) 0 ‘1’ Forcing (Strong driven) 1 ‘Z’ High Impedance ‘W’ Weak (Weakly driven) Unknown ‘L’ Weak (Weakly driven) 0. Models a pull down. ‘H’ Weak (Weakly driven) 1. Models a pull up. ‘-’ Don't Care

Syntax for signal, type, subtype declaration Std_logic is a subtype of std_ulogic subtype std_logic is resolved std_ulogic; resolved is the name of a resolution function

Resolution table for std_logic resolved function uninitialized unknown forcing low forcing high high impedance weak low weak high Don’t Care weak unknown

STD_LOGIC versus STD_ULOGIC STD_LOGIC is a type declared with a resolution function (defines, for all possible combinations of one or more sorce values, the resulting (resolved) value of a signal). Example: a circuit with three-state outputs used in a bus interface; this is a situation where we intend for a signal to have multiple sources. Std_logic is a subtype of Std_ulogic (but both consist of the same nine values) and is declared in package STD_LOGIC_1164 (there is defined resolution function with the name resolved.

STD_LOGIC versus STD_ULOGIC A disadvantage of using std_logic instead of std_ulogic is that signals that are unintententionally multiply driven will not be detected as an error during compilation. However, Standard IEEE Std 1164 recomends that std_logic be used instead of std_ulogic, even if a signal has only a single sourse (vendors have to optimize the simulation of models using unresolved types in accordance with Standard).

Our use of Std_logic values We are interested in writing descriptions that will be synthesized and then implemented using FPGA (PLD). In PLD/VHDL design methodology we will assign only the values ‘0’, ‘1’, or ‘–’ to std_logic signals. Sometimes we add ‘z’ to the previous list of values. Assigning values ‘H’ and ‘L’ to signals is not compatible with the device technology normally used in FPGAs (PLDs). For testbenches we typically assign only the values ‘0’ and ‘1’ as inputs to the UUT. During simulation we may observe the value ‘U’ and sometimes the value ‘X’. Since we will not assign values ‘H’ and ‘L’ to signals, we don’t expect to obseve the value ‘W’.

SIGNAL b : STD_LOGIC_VECTOR(7 downto 0); Single Wire versus Bus wire a bus b 1 8 SIGNAL a : STD_LOGIC; SIGNAL b : STD_LOGIC_VECTOR(7 downto 0);

STD_LOGIC_VECTOR type type std_logic_vector is array (natural range <>) of std_logic;

Standard Logic Vectors SIGNAL a: STD_LOGIC; SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL c: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL d: STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL e: STD_LOGIC_VECTOR(15 DOWNTO 0); SIGNAL f: STD_LOGIC_VECTOR(8 DOWNTO 0); ………. a <= '1'; b <= "0000"; -- Binary base assumed by default c <= B"0000"; -- Binary base explicitly specified d <= "0110_0111"; -- You can use '_' to increase readability e <= X"AF67"; -- Hexadecimal base f <= O"723"; -- Octal base

Single versus Double Quote Use single quote to hold a single bit signal a <= '0', a <='Z‘ Use double quote to hold a multi-bit signal b <= "00", b <= "11"

Vectors and Concatenation SIGNAL a: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL c, d, e: STD_LOGIC_VECTOR(7 DOWNTO 0); a <= "0000"; b <= "1111"; c <= a & b; - - c = "00001111" d <= '0' & "0001111"; -- d <= "00001111" e <= '0' & '0' & '0' & '0' & '1' & '1' & '1' & '1'; -- e <= "00001111"

The predefined type boolean The predefined type boolean is defined as type boolean is (false, true); This type is used to represent condition values, which can control execution of a behavioral model. There are a number of operators that we can apply to values of different types to yield Boolean values, namely, the relational and logical operators. The relational operators equality (“=”) and inequality (“/=”) can be applied to operands of any type, provided both are of the same type. For example, the expressions 123 = 123, 'A' = 'A', 7 ns = 7 ns all yield the value true, and the expressions 123 = 456, 'A' = 'z', 7 ns = 2 us yield the value false.

The predefined type boolean To make an assignment of the value of one type to one of the others, the type of the value being assigned must be converted to the target type. For example, if signal x is declared as type std_logic_vector and signal y is declared as type unsigned, and they are of equal length, each of the following assignments is illegal: x <= y ; --illegal assignment, type conflict y <= x ; --illegal assignment, type conflict However, appropriate type conversions allow the following assignments to be made: x <= std_logic_vector (y) ; -- valid assignment y <= unsigned (x) ; -- valid assignment

Types UNSIGNED and SIGNED Type std_logic is not defined as a numeric representation, no arithmetic operators are not defined for it in package STD_LOGIC_1164. To avoid confusion separate types werw created for numeric representation in package NUMERIC_STD: type unsigned is array (natural range <>) of std_logic; type signed is array (natural range <>) of std_logic; Type signed is interpreted as a signed binary number in 2´s complement form. The leftmost element is the sign bit.

Context clause to use unsigned and signed LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.numeric_std.all;

Conversion between Std_logic_vector, Unsigned and Signed This conversion is easy to accomplish because these are considered clsely related. Type conversion between closely related types is accomplished by simply using the name of target type as it were a function. For example, if x is std_logic_vector and y is unsigned, and they are ofequal length, than asigments x <= y; and y <= x; are illegal. Type conversions are allowed assignments to be made: x <= std_logic_vector (y); y <= unsigned (x);

Functions to convert between types signed and signed and integer Examples: y <= to_unsigned (i, 8); x <= std_logic_vector (to_unsigned (i, 8));

Simplified syntax of package declaration Package is a primary design unit used to organize and collect together related commonly used declarations (constants,types, functions, procedures).

Simplified syntax of package body

Functions to convert between types

Port types for synthesis A synthesizer must translate all types used for signals into types that can represent wires. Typically, a synthesizer converts all types to either std_logic or std_logic_vector.

Type translations made by a synthesizer

VHDL operators are listed from higher to lower precedence a = floor_div(a, n) * n + (a mod n) a = (a / n) * n + (a rem n) 9 mod 5 = 4 9 rem 5 = 4 9 mod (-5) = -1 9 rem (-5) = 4 (-9) mod 5 = 1 (-9) rem 5 = -4 (-9) mod (-5) = -4 (-9) rem (-5) = -4

Shift operators Shift operators. Let A = “10010101” A sll 2 = “01010100” --shift left logical, filled with ‘0’ A srl 3 = “00010010” --shift right logical, filled with ‘0’ A sla 3 = “10101111” --shift left arithmetic, filled with right bit A sra 2 = “11100101” --shift right arithmetic, filled with left bit A rol 3 = “10101100” --rotate left by 3 A ror 5 = “10101100” --rotate right by 5