VHDL Packages. I Packages incapsulano elementi che possono essere condivisi tra più entity Un package consiste di due parti:

Similar documents
Concurrent Signal Assignment Statements (CSAs)

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

Subprograms, Packages, and Libraries

Introduction to VHDL. Main language concepts

Introduction to VHDL

EEL 4783: Hardware/Software Co-design with FPGAs

Very High Speed Integrated Circuit Har dware Description Language

Lecture 10 Subprograms & Overloading

Synthesis of Digital Systems CS 411N / CSL 719. Part 3: Hardware Description Languages - VHDL

Basic Language Concepts

Inthis lecture we will cover the following material:

VHDL And Synthesis Review

Multi-valued logic and standard IEEE 1164

Generatore di parità. LIBRARY ieee; USE ieee.std_logic_1164.all ; ENTITY xor2 IS PORT( A, B : in std_logic ; Y : out std_logic ) ; END xor2 ;

VHDL for FPGA Design. by : Mohamed Samy

Introduction to VHDL #1

ECEU530. Last Few Lectures. ECE U530 Digital Hardware Synthesis. What is on Quiz 2. Projects. Today:

Data types defined in the standard package

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

PART I THE VHDL LANGUAGE CHAPTER 1: TOP LEVEL VHDL OVERVIEW

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009

Building Blocks. Entity Declaration. Entity Declaration with Generics. Architecture Body. entity entity_name is. entity register8 is

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 4 Introduction to VHDL

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

VHDL Part 2. What is on the agenda? Basic VHDL Constructs. Examples. Data types Objects Packages and libraries Attributes Predefined operators

Lecture 3 Introduction to VHDL

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

Menu. Introduction to VHDL EEL3701 EEL3701. Intro to VHDL

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

!"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification Part II

The CPU Bus : Structure 0

Discrete Event Models

BASIC VHDL LANGUAGE ELEMENTS AND SEMANTICS. Lecture 7 & 8 Dr. Tayab Din Memon

What Is VHDL? VHSIC (Very High Speed Integrated Circuit) Hardware Description Language IEEE 1076 standard (1987, 1993)

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution Spring 2016

[1] Douglas L. Perry, VHDL, third edition, ISBN , McRaw- Hill Series on Computer Engineering.

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs

Combinational Logic COMB. LOGIC BLOCK. A Combinational Logic Block is one where the outputs depend only on the current inputs

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements

Sub-programs in VHDL

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

Digital Systems Design

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

Hardware Description Language VHDL (1) Introduction

VHDL is a hardware description language. The code describes the behavior or structure of an electronic circuit.

VHDL for Complex Designs

Design units can NOT be split across different files

MW MOC SUPPORTING AND TROUBLESHOOTING WINDOWS 10

LANGUAGE VHDL FUNDAMENTALS

CPE/EE 422/522. Chapter 8 - Additional Topics in VHDL. Dr. Rhonda Kay Gaede UAH. 8.1 Attributes - Signal Attributes that return a value

Review of Digital Design with VHDL

Contents. Appendix D VHDL Summary Page 1 of 23

COVER SHEET: Total: Regrade Info: 2 (6 points) 3 (8 points) 4 (10 points) 8 (12 points) 6 (6 points) 7 (6 points) 9 (30 points) 10 (4 points)

Basic Language Constructs of VHDL

Automatic Creation of Define.xml for ADaM

Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs.

DOD, VHSIC ~1986, IEEE stnd 1987 Widely used (competition Verilog) Commercial VHDL Simulators, Synthesizers, Analyzers,etc Student texts with CDROMs

VHDL Structural Modeling II

Digital Systems Design

VHDL: Code Structure. 1

Tutorial 4 HDL. Outline VHDL PROCESS. Modeling Combinational Logic. Structural Description Instantiation and Interconnection Hierarchy

Computer-Aided Digital System Design VHDL

VHDL 2 IDENTIFIERS, DATA OBJECTS AND DATA TYPES

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

Outline. CPE/EE 422/522 Advanced Logic Design L07. Review: JK Flip-Flop Model. Review: VHDL Program Structure. Review: VHDL Models for a MUX

Lecture 3. VHDL Design Units and Methods. Entity, Architecture, and Components Examples of Combinational Logic Hands-on in the Laboratory

ORA1134 Oracle Database 12c: Backup and Recovery Workshop

Specifications Part 3

MSQ3-8 - MOC UPDATING YOUR SQL SERVER SKILLS TO MICROSOFT SQL SERVER 2014

COE 405 Design Methodology Based on VHDL

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :

Board-Data Processing. VHDL Exercises. Exercise 1: Basics of VHDL Programming. Stages of the Development process using FPGA s in Xilinx ISE.

Test Benches - Module 8

VHDL. Chapter 7. Behavioral Modeling. Outline. Behavioral Modeling. Process Statement

Outline of this Introduction to VHDL

COVER SHEET: Total: Regrade Info: 5 (5 points) 2 (8 points) 6 (10 points) 7b (13 points) 7c (13 points) 7d (13 points)

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

Lecture 4. VHDL Fundamentals. George Mason University

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

Entity, Architecture and Process

FREE STANDING LEAFLET DISPLAY

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

COVER SHEET: Total: Regrade Info: 1 (8 points) 2 ( 8 points) 3 (16 points) 4 (16 points) 5 (16 points) 6 (16 points) 7 (16 points) 8 (8 points)

PACKAGE. Package syntax: PACKAGE identifier IS...item declaration... END PACKAGE [identifier]

Outline CPE 626. Advanced VLSI Design. Lecture 3: VHDL Recapitulation. Intro to VHDL. Intro to VHDL. Entity-Architecture Pair

The University of Alabama in Huntsville ECE Department CPE Midterm Exam February 26, 2003

ECE 3401 Lecture 10. More on VHDL

Esempio con Google Play tore Example with Google Play tore

Module 6 : VHDL 1. Module- 6 VHDL

Introduction to the VHDL language. VLSI Digital Design

Digital Design Laboratory Lecture 2

Control and Datapath 8

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

VHDL: skaitmeninių įtaisų projektavimo kalba. 2 paskaita Pradmenys

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification

Form HTML FORM E PHP. Un insieme di elemen5 in una pagina web con cui l'utente interagisce per inviare informazioni ad uno script

Transcription:

1 VHDL Packages I Packages incapsulano elementi che possono essere condivisi tra più entity Un package consiste di due parti: Declaration Dichiarazione di tutti gli elementi contenuti nel package Body Descrizione degli elementi del package

2 Packages Nei package possiamo inserire: Subprograms (functions and procedures) Dati e dichiarazione di tipo: User record definitions User types and enumerated types Constants Files Aliases Attributes Dichiarazione di component Entities ed Architectures non possono essere dichiarate Un package viene richiamato con la keyword use

3 Package Declaration PACKAGE resources IS -- user defined enumerated type TYPE level IS ('X', '0', '1', 'Z'); -- type for vectors (buses) TYPE level_vector IS ARRAY (NATURAL RANGE <>) OF level; -- subtype used for delays SUBTYPE delay IS time; -- resolution function for level FUNCTION wired_x (input : level_vector) RETURN level; -- subtype of resolved values SUBTYPE level_resolved_x IS wired_x level; -- type for vectors of resolved values TYPE level_resolved_x_vector IS ARRAY (NATURAL RANGE <>) OF level_resolved_x; END resources;

4 Package Body PACKAGE BODY resources IS -- resolution function FUNCTION wired_x (input : level_vector) RETURN level IS VARIABLE has_driver : BOOLEAN := FALSE; VARIABLE result : level := 'Z'; BEGIN L1 : FOR i IN input RANGE LOOP IF(input(i) /= 'Z') THEN IF(NOT has_driver) THEN has_driver := TRUE; result := input(i); ELSE -- has more than one driver result := 'X'; EXIT L1; END IF; END IF; END LOOP L1; RETURN result; END wired_x; END resources;

5 Type std_logic PACKAGE std_logic_1164 IS TYPE std_ulogic IS ( U, -- Uninitialized X, -- Forcing Unknown 0, -- Forcing 0 1, -- Forcing 1 Z, -- High Impedance W, -- Weak Unknown L, -- Weak 0 H, -- Weak 1 - -- Don t care ); ------------------------------------------------------- -- unconstrained array of std_ulogic ------------------------------------------------------- TYPE std_ulogic_vector IS ARRAY ( NATURAL RANGE <> ) OF std_ulogic; ------------------------------------------------------- -- resolution function ------------------------------------------------------- FUNCTION resolved ( s : std_ulogic_vector ) RETURN std_ulogic; ------------------------------------------------------- -- *** industry standard logic type *** ------------------------------------------------------- SUBTYPE std_logic IS resolved std_ulogic;

6 Type std_logic PACKAGE BODY std_logic_1164 IS CONSTANT resolution_table : stdlogic_table := ( -- -------------------------------------------------------- -- U X 0 1 Z W L H - -- -------------------------------------------------------- ( U, U, U, U, U, U, U, U, U ), -- U ( U, X, X, X, X, X, X, X, X ), -- X ( U, X, 0, X, 0, 0, 0, 0, X ), -- 0 ( U, X, X, 1, 1, 1, 1, 1, X ), -- 1 ( U, X, 0, 1, Z, W, L, H, X ), -- Z ( U, X, 0, 1, W, W, W, W, X ), -- W ( U, X, 0, 1, L, W, L, W, X ), -- L ( U, X, 0, 1, H, W, W, H, X ), -- H ( U, X, X, X, X, X, X, X, X ), -- - ); FUNCTION resolved ( s : std_ulogic_vector ) RETURN std_ulogic IS VARIABLE result : std_ulogic := Z ; -- weakest state BEGIN -- the test for a single driver is essential IF (s LENGTH = 1) THEN RETURN s(s LOW); ELSE FOR i IN s RANGE LOOP result := resolution_table(result, s(i)); END LOOP; END IF; RETURN result; END resolved;

7 Type std_logic LIBRARY IEEE; USE IEEE.std_logic_1164.ALL; ENTITY test IS PORT ( i0, i1, i2, i3: IN std_logic; o0,01,02,o3,o4 : OUT std_logic); END test; ARCHITECTURE a OF test IS BEGIN o0 <= '0' WHEN i0 = 0 AND i1 = 0 ELSE '1' ; o1 <= '-' WHEN i0 = 0 AND i1 = 0 ELSE '1' WHEN i0 = 1 AND i1 = 1 ELSE '0'; o2 <= '0' WHEN i0 = 0 AND i1 = 0 ELSE '1'; o2 <= '0' WHEN i0 = 0 AND i1 = 0 ELSE '1' WHEN i0 = 1 AND i1 = 1 ELSE '0'; o3 <= '0' WHEN i0 = 0 AND i1 = 0 ; o4 <= 'Z' WHEN i0 = 0 AND i1 = 0 ELSE '1'; o4 <= '0' WHEN i0 = 0 AND i1 = 0 ELSE 'Z'; END a;

8 Generate Statement Il VHDL permette di creare strutture ripetitive con la keyword GENERATE (e.g. RAMs, adders) Uno statement GENERATE statement può essere usato in ogni assegnazione concorrente name : FOR parameter_specification GENERATE [Declaration_statements BEGIN] {concurrent_statements} END GENERATE [name];

9 Esempio FOR -- this uses the and_gate component from before ARCHITECTURE test_generate OF test_entity IS SIGNAL S1, S2, S3: BIT_VECTOR(7 DOWNTO 0); BEGIN G1 : FOR N IN 7 DOWNTO 0 GENERATE and_array : and_gate GENERIC MAP (2 ns, 3 ns) PORT MAP (S1(N), S2(N), S3(N)); END GENERATE G1; END test_generate; S2(7:0) S1(7:0) S3(7:0)

10 Esempio IF name : IF boolean_expression GENERATE [Declaration_statements BEGIN] {concurrent_statements} END GENERATE [name]; ARCHITECTURE test_generate OF test_entity SIGNAL S1, S2, S3: BIT_VECTOR(7 DOWNTO 0); BEGIN G1 : FOR N IN 7 DOWNTO 0 GENERATE G2 : IF (N = 7) GENERATE or1 : or_gate GENERIC MAP (3 ns, 3 ns) PORT MAP (S1(N), S2(N), S3(N)); END GENERATE G2; G3 : IF (N < 7) GENERATE and_array : and_gate GENERIC MAP (2 ns, 3 ns) PORT MAP (S1(N), S2(N), S3(N)); END GENERATE G3; END GENERATE G1; END test_generate;

11

12 Instanziazione Per istasnzaiare un componente servono: Name: identifica un istanza unica del componente Component type: seleziona uno dei componenti dichiarati Port map: per collegarlo ai segnali dell'architettura Name Component Type Port Map r0 : reg1 PORT MAP (d=>d0,clk=>clk,q=>q0);

13 Generic Map Permette di personalizzare l' instanziazione del componente Nell'Entity sono previsti i valori di default E' simile al PORT MAP USE Work.my_stuff.ALL ARCHITECTURE test OF test_entity SIGNAL S1, S2, S3 : BIT; BEGIN Gate1 : my_stuff.and_gate -- component found in package GENERIC MAP (tplh=>2 ns, tphl=>3 ns) PORT MAP (S1, S2, S3); END test;

14 Binding Associa un componente istanziato ad unentity/architecture Single component FOR A1 : and_gate USE binding_indication; Multiple components FOR A1, A2 : and_gate USE binding_indication; All components FOR ALL : and_gate USE binding_indication; Other components FOR OTHERS : and_gate USE binding_indication;

15 Binding Si possono utilizzare due meccanismi: VHDL entity/architecture design object FOR ALL : reg1 USE work.dff(behav); VHDL configuration FOR reg4_inst : reg4_comp USE CONFIGURATION work.reg4_conf_1; Puo includere il PORT MAP e/o il GENERIC MAP

16 Esempio USE work.resources.all; ARCHITECTURE struct_3 OF reg4 IS COMPONENT reg1 IS PORT (d, clk : IN level; q : OUT level); END COMPONENT reg1; BEGIN r0 : reg1 PORT MAP (d=>d0,clk=>clk,q=>q0); r1 : reg1 PORT MAP (d=>d1,clk=>clk,q=>q1); r2 : reg1 PORT MAP (d=>d2,clk=>clk,q=>q2); r3 : reg1 PORT MAP (d=>d3,clk=>clk,q=>q3); END struct_3; USE work.resources.all; CONFIGURATION reg4_conf_1 OF reg4 IS CONSTANT enabled : level := '1'; FOR struct_3 FOR all : reg1 USE work.dff(behav) PORT MAP(d=>d,clk=>clk,enable=>enabled,q=>q,qn=>OPEN); END FOR; END FOR; END reg4_conf_1; -- Architecture in which a COMPONENT for reg4 is declared... FOR ALL : reg4_comp USE CONFIGURATION work.reg4_conf_1;