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

Similar documents
Entity, Architecture, Ports

Bruce s VHDL Tutorial By Bruce Misner Lakehead University

VHDL Examples Mohamed Zaky

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

In our case Dr. Johnson is setting the best practices

Very High Speed Integrated Circuit Har dware Description Language

Hardware Description Language VHDL (1) Introduction

CONCURRENT STATEMENTS COMPONENT DECLARATION COMPONENT INSTANTIATION

Hardware Synthesis. References

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

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

Computer-Aided Digital System Design VHDL

Sequential Statement

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

Review. LIBRARY list of library names; USE library.package.object; ENTITY entity_name IS generic declarations PORT ( signal_name(s): mode signal_type;

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

Test Benches - Module 8

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

Basic Language Concepts

ECE 545 Lecture 4. Simple Testbenches. George Mason University

Experiment 0 OR3 Gate ECE 332 Section 000 Dr. Ron Hayne June 8, 2003

Lab # 5. Subprograms. Introduction

Concurrent Signal Assignment Statements (CSAs)

Introduction to VHDL. Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez

Declarations of Components and Entities are similar Components are virtual design entities entity OR_3 is

Getting Started with VHDL

FPGA BASED SYSTEM DESIGN. Dr. Tayab Din Memon Lecture 9 & 10 : Combinational and Sequential Logic

Lattice VHDL Training

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

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

Summary of FPGA & VHDL

5. 0 VHDL OPERATORS. The above classes are arranged in increasing priority when parentheses are not used.

C-Based Hardware Design

2/14/2016. Hardware Synthesis. Midia Reshadi. CE Department. Entities, Architectures, and Coding.

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

EITF35: Introduction to Structured VLSI Design

VHDL 3 BASIC OPERATORS AND ARCHITECTURE BODY. Design descriptions & design constructions examples are taken from foundation series examples

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

Field Programmable Gate Array

VHDL for Modeling - Module 10

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

Inferring Storage Elements

CMPT 250: Computer Architecture. Using LogicWorks 5. Tutorial Part 1. Somsubhra Sharangi

N-input EX-NOR gate. N-output inverter. N-input NOR gate

CCE 3202 Advanced Digital System Design

VHDL Simulation. Testbench Design

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

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

Lecture 4: Modeling in VHDL (Continued ) EE 3610 Digital Systems

Review of Digital Design with VHDL

Introduction to VHDL #1

CCE 3202 Advanced Digital System Design

6.111 Lecture # 5. Entity section describes input and output. VHDL: Very High speed integrated circuit Description Language:

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Lecture 27. Structural Description of a 3-Bit Synchronous Decade Counter. FIGURE 4.31 A State diagram of a decade counter.

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

ENGIN 241 Digital Systems with Lab

CS232 VHDL Lecture. Types

Introduction to VHDL #3

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

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

Mridula Allani Fall Fall

Department of Technical Education DIPLOMA COURSE IN ELECTRONICS AND COMMUNICATION ENGINEERING. Fifth Semester. Subject: VHDL Programming

Department of Electronics & Communication Engineering Lab Manual E-CAD Lab

FPGA briefing Part II FPGA development DMW: FPGA development DMW:

EE6301 DIGITAL LOGIC CIRCUITS UNIT V VHDL PART A

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

Design a 4 bit-adder. Then design a 4-7 decoder to show the outputs. Output Sum(4 bits) Adder. Output carry(1 bit)

Lecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN

VHDL Quick Start. Edward Gatt

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

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture

VHDL VS VERILOG.

ACS College of Engineering. Department of Biomedical Engineering. Logic Design Lab pre lab questions ( ) Cycle-1

Document Version: 0.6 Document Date: 15 April 2011 Prepared by: Y. Ermoline for ATLAS Level-1Calorimeter Trigger

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles

Sudhakar Yalamanchili, Georgia Institute of Technology, 2006

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

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

Introduction to VHDL Lecture D

Digitaalsüsteemide disain

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University

Digital Design with SystemVerilog

Tutorial on Simulation using Aldec Active-HDL Ver 1.0

Quartus Counter Example. Last updated 9/6/18

Introduction to Design Vision. Instructor: Prof. Shantanu Dutt. TA: Soumya Banerjee

Lecture 12 VHDL Synthesis

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

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

Lecture 3 Introduction to VHDL

Hardware Description Languages. Modeling Complex Systems

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

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

IT T35 Digital system desigm y - ii /s - iii

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

VHDL: A Crash Course

Constructing VHDL Models with CSA

ELCT 501: Digital System Design

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

Transcription:

Modular Design

PACKAGE Package is a collection of : - Type declaration - Component declaration - Constants declaration - Subprograms (functions or procedures) Package is a separate VHDL code consisting of commonly used items. Package syntax: PACKAGE identifier IS...item declaration... END PACKAGE [identifier]

PACKAGE My_package.vhd PACKAGE my_package IS TYPE states IS (reset, idle, on, off); CONSTANTk : integer := 1; CONSTANT rst : std_logic_vector(0 to 7) := 00000000 ; COMPONENT half_adder PORT(a, b : in bit; sum, carry : out bit); END COMPONENT END my_package;

PACKAGE LIBRARY ieee; USE ieee.std_logic_1164.all; include standard library USE work.my_package.all; include package ENTITY my_design IS.. END my_design ARCHITECTURE behavior OF my_design IS.... END behavior;

VHDL design units can be reused by mean of hierarchy coding ENTITY Component #1 Component #3 Component #2

Components are VHDL design unit (code) that is reused in other codes. COMPONENT DECLARATION Each component is declared in declaration section of Architecture (before statement). COMPONENT component_name IS Port declaration END COMPONENT; Example COMPONENT mynand3 IS PORT( a,b,c : IN STD_LOGIC; x : OUT STD_LOGIC ); END COMPONENT;

COMPONENT INSTANTIATION (component usage) Each declared component can be instantiated as many times as needed. Each instantiation should be properly PORT MAPPED PORT MAPPING is the definition of internal connections between inputs, outputs and internal signal of different components and the top level entity within a structurally described system. Port mapping is done in the architecture after the keyword.

------ File inverter.vhd: ----- LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY inverter IS PORT (a: IN STD_LOGIC; b: OUT STD_LOGIC); END inverter; ARCHITECTURE inverter OF inverter IS b <= NOT a; END inverter;

------ File nand_2.vhd: ------- LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY nand_2 IS PORT (a, b: IN STD_LOGIC; c: OUT STD_LOGIC); END nand_2; ARCHITECTURE nand_2 OF nand_2 IS c <= NOT (a AND b); END nand_2;

----- File nand_3.vhd: -------- LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY nand_3 IS PORT (a, b, c: IN STD_LOGIC; d: OUT STD_LOGIC); END nand_3; ARCHITECTURE nand_3 OF nand_3 IS d <= NOT (a AND b AND c); END nand_3;

----- File project.vhd: ------- LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY project IS PORT (a, b, c, d: IN STD_LOGIC; x, y: OUT STD_LOGIC); END project; ARCHITECTURE structural OF project IS COMPONENT inverter IS PORT (a: IN STD_LOGIC; b: OUT STD_LOGIC); END COMPONENT; COMPONENT nand_2 IS PORT (a, b: IN STD_LOGIC; c: OUT STD_LOGIC); END COMPONENT; COMPONENT nand_3 IS PORT (a, b, c: IN STD_LOGIC; d: OUT STD_LOGIC); END COMPONENT; SIGNAL w: STD_LOGIC; U1: inverter PORT MAP (b, w); component instantiation U2: nand_2 PORT MAP (a, b, x); U3: nand_3 PORT MAP (w, c, d, y); END structural;

w

TESTBENCH Testbench is a process of testing VHDL model Testbench usually involves in writing another VHDL module which is used for generating of input signals for VHDL model being tested Testbench (VHDL file) Design under test (VHDL file) Testbench uses concept of COMPONENT

AND Gate Model -- library ieee; use ieee.std_logic_1164.all; ENTITY andgate IS port( A, B : in std_logic; F : out std_logic); END andgate; ARCHITECTURE func OF andgate IS F <= A and B; END func; TESTBENCH library ieee; use ieee.std_logic_1164.all; ENTITY andgate_tb IS END andgate_tb; ARCHITECTURE tb OF andgate_tb IS COMPONENT andgate IS PORT( A, B : in std_logic; F : out std_logic); END COMPONENT; signal ina, inb, outf : std_logic; mapping: andgate PORT MAP (ina, inb, outf); PROCESS InA <= '0'; --TEST 1 inb <= '0'; WAIT FOR 15 ns; InA <= '0'; --TEST 2 inb <= '1'; WAIT FOR 15 ns; InA <= '1'; --TEST 3 inb <= '1'; WAIT FOR 15 ns; WAIT; stop testbench -- END PROCESS; END tb;

TESTBENCH library ieee; use ieee.std_logic_1164.all; ENTITY dff_tb IS END dff_tb; ARCHITECTURE tb OF dff_tb IS signal T_data_in, T_clock, T_data_out : std_logic; COMPONENT dff IS PORT(d, clk: in std_logic; q: out std_logic); END COMPONENT; U_DFF: dff PORT MAP (T_data_in, T_clock, T_data_out); clock_gen: PROCESS T_clock <= '0'; WAIT FOR 5 ns; T_clock <= '1'; WAIT FOR 5 ns; END PROCESS clock_gen; PROCESS T_data_in <= '1'; -- case 1 WAIT FOR 20 ns; T_data_in <= '0'; -- case 2 WAIT FOR 20 ns; WAIT; -- stop testbench END PROCESS; END tb; D flip flop Testbench