Comprehensive VHDL Module 9 More on Types November 2000 1.

Slides:



Advertisements
Similar presentations
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Advertisements

Generic Multiplexers: Parameters Discussion D2.5 Example 8.
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.
第6章 VHDL NUMBERS, STRINGS, AND EXPRESSIONS 義守大學電機工程學系 陳慶瀚
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & data Types.
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
A.7 Concurrent Assignment Statements Used to assign a value to a signal in an architecture body. Four types of concurrent assignment statements –Simple.
Figure 5.1 Conversion from decimal to binary. Table 5.1 Numbers in different systems.
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
Lecture 3 Chap 4 Types Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
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.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
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.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
VHDL Basics. VHDL BASICS 2 OUTLINE –Component model –Code model –Entity –Architecture –Identifiers and objects –Operations for relations VHDL ET062G &
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Concordia University 1 Lecture #8 In this lecture we will cover the following material: The standard package, The std_logic_1164  Objects & 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.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Data Storage VHDL ET062G & ET063G Lecture 4 Najeem Lawal 2012.
ECOM 4311—Digital System Design with VHDL
BASIC VHDL LANGUAGE ELEMENTS Digital Design for Instrumentation with VHDL 1.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
Number Representation and Arithmetic Circuits
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Case Study: Xilinx Synthesis Tool (XST). Arrays & Records 2.
Multiplier: Functions Discussion D7.2 Example 19.
EGRE 6311 LHO 04 - Subprograms, Packages, and Libraries EGRE 631 1/26/09.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
IAY 0600 Digital Systems Design
Introduction To VHDL 홍 원 의.
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
UNIT 8: Synthesis Basics
Dataflow Style Combinational Design with VHDL
Part IV: VHDL CODING.
Custom Designed Integrated Circuits
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
ECE 545 Lecture 9 Modeling of Circuits with a Regular Structure Aliases, Attributes, Packages.
IAS 0600 Digital Systems Design
Sequential-Circuit Building Blocks
ECE 434 Advanced Digital System L17
HDL Programming Fundamentals
CHAPTER 10 Introduction to VHDL
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
VHDL Hardware Description Language
VHDL (VHSIC Hardware Description Language)
ECE 545 Lecture 17 RAM.
IAS 0600 Digital Systems Design
Chapter 5 – Number Representation and Arithmetic Circuits
Modeling of Circuits with a Regular Structure
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
Data Flow Description of Combinational-Circuit Building Blocks
IAS 0600 Digital Systems Design
UNIT 6: Mixed-Type Description
Data Flow Description of Combinational-Circuit Building Blocks
Modeling of Circuits with a Regular Structure
Variables variable variable_name: variable_type
VHDL Data Types Module F3.1.
Sequntial-Circuit Building Blocks
Data Types Each data object has a type associated with it.
4-Input Gates VHDL for Loops
(Sequential-Circuit Building Blocks)
(Simple Testbenches & Arithmetic Operations)
Presentation transcript:

Comprehensive VHDL Module 9 More on Types November 2000 1

More on Types Aim To understand the use of integer and array types Topics covered Package declarations Integer subtypes, operators and literals Array types and memories Array attributes and type attributes Aggregates Qualified expressions

VHDL Data Types enumeration integer Scalar Numbers (one value) floating physical Number + unit, e.g. TIME array Composite (many values) record synthesizable access Dynamic memory allocation not synthesizable file File I/O

Data Types and Packages package TYPES is type CODE is (A, B, C, D, E); end TYPES; use WORK.TYPES.all; entity FILTER is port (IP: in CODE; OP: out CODE); end FILTER; U1 use WORK.TYPES.all; ... signal I, O: CODE; U1: FILTER port map (IP => I, OP => O); I IP OP O

Integer Subtypes Defined in STD.STANDARD User defined subtypes type INTEGER is range -2**31+1 to 2**31-1; subtype NATURAL is INTEGER range 0 to 2**31-1; subtype POSITIVE is INTEGER range 1 to 2**31-1; Defined in STD.STANDARD subtype SHORT is INTEGER range -128 to +127; subtype LONG is INTEGER range -2**15 to 2**15-1; signal S: SHORT; signal L: LONG; User defined subtypes variable I: INTEGER range 0 to 255; Anonymous subtype I := -1; S <= L; Are these assignments errors?

Synthesis of Integer Subtypes subtype Byte is INTEGER range 0 to 255; signal B: Byte; 8-bit, unsigned subtype Int8 is INTEGER range -128 to +127; signal I: Int8; 8-bit, twos complement subtype Silly is INTEGER range 1000 to 1001; signal S: Silly; 10-bit, unsigned signal J: INTEGER; 32-bit, twos complement - beware!

Arithmetic Operators >= > <= < /= = abs mod rem ** / + - * OK for synthesis Tool dependent truncates toward zero B exponentiation A Constants or powers of 2 only e.g. A / 4 2**N remainder after A/B A modulo B absolute value |A| Tool dependent not equal OK for synthesis same as signal assignment

Representing Integer Values Decimal numbers 0 99 1e6 1E6 1000000 1_000_000 _ ignored Based numbers 2#00001111# 8#017# 16#0F# Writing STD_LOGIC_VECTORS in binary, octal and hex B"0000_1111" O"017" X"0F" VHDL 93 STD_LOGIC_VECTOR(TO_UNSIGNED(16#0F#,8)) VHDL 87

Array Subtypes Naming an array subtype avoids repeating the index constraint library IEEE; use IEEE.STD_LOGIC_1164.all; package BusTypes is subtype DataBus is STD_LOGIC_VECTOR(7 downto 0); end; library IEEE; use IEEE.STD_LOGIC_1164.all, WORK.BusTypes.all; entity CNTL is port (CLK: in STD_LOGIC; D: in DataBus; Sin: in STD_LOGIC_VECTOR(3 downto 0); Q: out DataBus; Sout: out STD_LOGIC_VECTOR(1 downto 0)); end;

Array Types Unconstrained array type type STD_LOGIC_VECTOR is array (NATURAL range <>) of STD_LOGIC; Index type Element type subtype BYTE is STD_LOGIC_VECTOR(7 downto 0); type RAM1Kx8 is array (0 to 1023) of BYTE; variable RAM: RAM1Kx8; Constrained array type

What would be synthesized? Modeling Memories VHDL 93 entity DualPortRam is port (Clock, Wr, Rd : in Std_logic; AddrWr, AddrRd: in Std_logic_vector(3 downto 0); DataWr : in Std_logic_vector(7 downto 0); DataRd : out Std_logic_vector(7 downto 0)); end entity DualPortRam; architecture V1 of DualPortRam is begin process (Clock) is type RamType is array (0 to 15) of Std_logic_vector(7 downto 0); variable Ram: RamType; if Rising_edge(Clock) then if Wr = '1' then Ram(To_integer(Unsigned(AddrWr))) := DataWr; end if; if Rd = '1' then DataRd <= Ram(To_integer(Unsigned(AddrRd))); end process; end architecture; What would be synthesized?

Instantiating Memories Parameters Memory generator VHDL behavioral model VHDL component template Hard macro / layout VHDL netlist VHDL simulation Layout tools

Array Attribute 'RANGE signal A: STD_LOGIC_VECTOR(...); process (A) variable V: STD_LOGIC; begin V := '0'; for I in 0 to 7 loop V := V xor A(I); end loop; for I in A'RANGE loop ... end process; Bad Good

Array and Type Attributes signal A: STD_LOGIC_VECTOR(7 downto 0); subtype SHORT is INTEGER range 0 to 15; type MODE is (W, X, Y, Z); Array attributes (use whenever possible) A'LOW = 0 A'HIGH = 7 A'LEFT = 7 A'RIGHT = 0 A'RANGE = 7 downto 0 A'REVERSE_RANGE = 0 to 7 A'LENGTH = 8 Type attributes (avoid for synthesis) SHORT'LOW = 0 SHORT'HIGH = 15 SHORT'LEFT = 0 SHORT'RIGHT = 15 MODE'LOW = W MODE'HIGH = Z MODE'LEFT = W MODE'RIGHT = Z

Aggregates type BCD6 is array (5 downto 0) of STD_LOGIC_VECTOR(3 downto 0); variable V: BCD6 := ("1001", "1000", "0111", "0110", "0101", "0100"); V := ("1001", "1000", others => "0000"); V := (3 => "0110", 1 => "1001", others => "0000"); V := (others => "0000"); variable A: STD_LOGIC_VECTOR(3 downto 0); A := (others => '1');

Ambiguous Types port (A, B: in Std_logic; process (A, B) begin case A & B is when "00" => ... Illegal! library IEEE; use IEEE.NUMERIC_STD.all; variable N: INTEGER; Illegal! N := TO_INTEGER("1111");

Qualified Expressions process (A, B) subtype T is Std_logic_vector(0 to 1); begin case T'(A & B) is when "00" => ... N = 15 N := TO_INTEGER(UNSIGNED'("1111")); N = -1 N := TO_INTEGER(SIGNED'("1111"));