Lecture 3. VHDL Design Units and Methods. Notes. Notes. Notes

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

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

Introduction to VHDL #1

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

Very High Speed Integrated Circuit Har dware Description Language

Introduction to VHDL

Digital Systems Design

Introduction to VHDL #3

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

VHDL for FPGA Design. by : Mohamed Samy

Lecture 4. VHDL Fundamentals. George Mason University

Hardware Description Language VHDL (1) Introduction

Lattice VHDL Training

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

Basic Language Concepts

Menu. Introduction to VHDL EEL3701 EEL3701. Intro to VHDL

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

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

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Lecture 4. VHDL Fundamentals. Required reading. Example: NAND Gate. Design Entity. Example VHDL Code. Design Entity

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

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

ELCT 501: Digital System Design

Concurrent Signal Assignment Statements (CSAs)

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

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

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

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

TSIU03, SYSTEM DESIGN LECTURE 2

Computer-Aided Digital System Design VHDL

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

EEL 4783: Hardware/Software Co-design with FPGAs

Chapter 6 Combinational-Circuit Building Blocks

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

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

Introduction to VHDL. Main language concepts

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University

Lecture 12 VHDL Synthesis

CDA 4253 FPGA System Design Introduction to VHDL. Hao Zheng Dept of Comp Sci & Eng USF

Lecture 3 Introduction to VHDL

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

ENGIN 241 Digital Systems with Lab

Digital Systems Design

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

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

In our case Dr. Johnson is setting the best practices

Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 4111: Digital Systems Design Lab. Lab # 5. Concurrent Statements

EITF35: Introduction to Structured VLSI Design

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

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

Experiment 8 Introduction to VHDL

VHDL Structural Modeling II

VHDL Basics. Mehdi Modarressi. Department of Electrical and Computer Engineering, University of Tehran. ECE381(CAD), Lecture 4:

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

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

VHDL Examples Mohamed Zaky

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

EEL 4712 Digital Design Test 1 Spring Semester 2008

Control and Datapath 8

ECE 459/559 Secure & Trustworthy Computer Hardware Design

Contents. Appendix D VHDL Summary Page 1 of 23

VHDL in 1h. Martin Schöberl

VHDL And Synthesis Review

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

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

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 3

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

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

Verilog Design Principles

SRI SUKHMANI INSTITUTE OF ENGINEERING AND TECHNOLOGY, DERA BASSI (MOHALI)

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

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

Design units can NOT be split across different files

Mridula Allani Fall Fall

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

Subprograms, Packages, and Libraries

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

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

In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified.

Chapter 2 Basic Logic Circuits and VHDL Description

CS211 Digital Systems/Lab. Introduction to VHDL. Hyotaek Shim, Computer Architecture Laboratory

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

Basic Language Constructs of VHDL

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

Inthis lecture we will cover the following material:

ECEU530. Schedule. ECE U530 Digital Hardware Synthesis. Datapath for the Calculator (HW 5) HW 5 Datapath Entity

Combinational Logic II

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

Constructing VHDL Models with CSA

VHDL for Synthesis. Course Description. Course Duration. Goals

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

CCE 3202 Advanced Digital System Design

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

FPGA Design. Part III - Combinatorial VHDL. Thomas Lenzi

Lecture 4. VHDL Basics. Simple Testbenches

[VARIABLE declaration] BEGIN. sequential statements

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 3

14:332:331. Computer Architecture and Assembly Language Fall Week 5

Transcription:

Lecture Entity, Architecture, and Components Examples of Combinational Logic Hands-on in the Laboratory BTF4220 - Digital Electronics 2 Mar. 06, 2015 Bern University of Applied Sciences Agenda Rev. ec17bd.2 The basic elements are AND, OR, NOT, EXOR, NAND, NOR Such components have a library declaration LIBRARY IEEE; To have them available include the corresponding package (STD_LOGIC_1164). for the standard package of the library IEEE is shown below: LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.all; of an AND File name : exand-entity.vhdl Example : AND (entity) 1 LIBRARY ieee; 2 USE ieee.std_logic_1164.all; 4 ENTITY ExAnd is 5 Port( 6 AxDI : IN std_logic; 7 BxDI : IN std_logic; 8 FxDO : OUT std_logic 9 ); 10 END ExAnd; Figure: Ex : Entity Block Rev. ec17bd.

Some More Entity Examples Example : NOT (entity) 1 LIBRARY ieee; -- Library to include 2 USE ieee.std_logic_1164.all; -- Package of library 4 ENTITY ExNot is -- ENTITY block start 5 Port( -- PORT statement start 6 AxDI : IN std_logic; -- A input signal 7 FxDO : OUT std_logic -- A output signal 8 ); -- PORT end 9 END ExNot; -- ENTITY block end 1 type std_ulogic is ( 2 U, -- Uninitialized X, -- Forcing Unknown 4 0, -- Forcing 0 5 1, -- Forcing 1 6 Z, -- High Impedance 7 W, -- Weak Unknown 8 L, -- Weak 0 9 H, -- Weak 1 10 - -- Don t 11 ); A nine-value resolved logic type std_logic is not a part of the VHDL standard. It is defined in IEEE Std 1164. Rev. ec17bd.4 Figure: NAND based 2 to 1 Mux Some Vector Based Entities Example : AND 4 Bit (entity) 1 LIBRARY ieee; 2 USE ieee.std_logic_1164.all; 4 ENTITY ExAnd_4 is 5 Port( 6 AxDI : IN std_logic_vector( downto 0); 7 BxDI : IN std_logic_vector( downto 0); 8 FxDO : OUT std_logic_vector( downto 0) 9 ); 10 END ExAnd_4; std_logic_vector(7 downto 0); --7th bit is MSB and 0th bit is LSB here std_logic_vector(0 to 7); --0th bit is MSB and 7th bit is LSB here Rev. ec17bd.5 Some Vector Based Entities What to do when we would like to create a more generic component There is the possibility of specifying generics that are used for making components more adaptable. The generic should have a default specification that can be overwritten when instantiating the component. Example : Mux 4 to 1 generic (entity) 1 LIBRARY ieee; 2 USE ieee.std_logic_1164.all; 4 ENTITY ExMux_4_G is 5 GENERIC( 6 VECTOR_WIDTH : INTEGER := 8 7 ); 8 Port( 9 AxDI, BxDI, CxDI, DxDI : IN std_logic_vector(vector_width-1 downto 0) ; 10 Sel1xSI, Sel2xSI : IN std_logic; 11 DxDO : OUT std_logic_vector(vector_width-1 downto 0) 12 ); 1 END ExMux_4_G; Rev. ec17bd.5

Mux Exercises Exercise : Entity of 4 to 1 Mux Write the entity of a 4 to 1 multiplexer. Which libraries are required? What are the statements used? Use the syntax introduced. Figure: Logic Diagram 4 to 1 Mux Rev. ec17bd.6 Summary to the Interface We know the source code file block LIBRARIES: What libraries to use and which packages to include to have language definitions like standard logic types and basic logic functions available. We know the source code file part ENTITY: Describes the function unit, its interface (direction, type etc.) to the outside-world. How can we use this information in hardware description? To make designs more understandable and maintainable, a design is typically decomposed into several blocks. These blocks are then connected together to form a complete design. Each block in VHDL is analogous to an off-the-shelf part and is called an entity. The entity describes the interface to that block and a separate part associated with the entity describes how that block operates. description is like a pin description, specifying the inputs and outputs to the block. Let s analyze an example of a latch entirely. Rev. ec17bd.7 The Latch Example Example : Latch Entity 1 library ieee; 2 use ieee.std_logic_1164.all; 4 entity Latch is 5 6 port ( 7 SetxDI, RstxDI : in std_logic; 8 QxDO, QxDLO : out std_logic 9 ); 10 11 end Latch; Example : Latch Architecture 1 architecture dataflow of Latch is 2 signal QxDN, QxDNL : std_logic; begin -- architecture dataflow 4 5 QxDN <= RstxDI nor QxDNL; 6 QxDNL <= SetxDI nor QxDN; 7 8 QxDO <= QxDN; 9 QxDLO <= QxDNL; 10 11 end dataflow; The Library section includes the standard logic package of a Set/Reset Latch Ports of the same mode and object can be grouped together The second part of the Latch is a description of how it works. The first line of the declaration indicates that this is the definition of a new architecture called dataflow and it belongs to the entity named Latch. This example uses the data flow approach which is discussed later. Rev. ec17bd.8

The internals of an element Example : VHDL Architecture 1 architecture <MODEL_NAME> of <ENTITY_NAME> is -- start of architecture statement 2 -- This part is called the declarative 4 -- section of an architecture 5 -- here goes signals and type defs 6 -- component declarations etc. 7 8 begin -- architecture behavior (start of descriptive section) 9 10 -- This part is called descriptive 11 -- section of an architecture. 12 -- hre goes your component model 1 -- it can be behavioral, data-flow, 14 -- or structural. 15 16 end <MODEL_NAME>; -- end of architecture statement Rev. ec17bd.9 Signals, Assignment, Concurrency Example : Concurrent Signal Assignment 1 architecture dataflow of <ENTITY_NAME> is 2 -- declaration of signal objects among others e.g. constants -- <OBJECT_TYPE> <OBJECT_NAME> : <DATA_TYPE>; 4 signal MyTestSignalAxD : std_logic; 5 signal MyTestSignalBxD : std_logic; 6 7 begin -- architecture behavior 8 9 -- description of functional model 10 -- <TARGET> <= <EXPRESSION>; 11 MyTestSignalAxD <= MyInputAxDI and MyInputBxDI; 12 1 MyTestSignalBxD <= MyTestSignalAxD or MyInputBxDI; 14 15 -- the expression above is the same as 16 -- MyTestSignalBxD <= (MyInputAxDI and MyInputBxDI) or MyInputBxDI; 17 -- Signals are software representations of wires 18 -- The brackets are used to prioritize and nest sub-expressions 19 20 -- All statements are concurrent to each other 21 -- NO SEQUENTIAL execution -- think hardware whise 22 2 end dataflow; Rev. ec17bd.10 The dataflow paradigm In the data flow approach, circuits are described by indicating how the inputs and outputs of built-in primitive components (ex. an and gate) are connected together. In other words we describe how signals (data) flow through the circuit. A signal assignment statement describes how data flows from the signals on the right side of the <= operator to the signal on the left side. The right side of the <= operator is called an expression. The value of the expression is determined by evaluating the expression. Evaluating the expression is performed by substituting the values of the signals in the expression and computing the result of each operator in the expression. Exercise : S/R Latch Draw the gate diagram of the described S/R Latch Rev. ec17bd.11

The 4 to 1 Mux Architecture - Implicit Process Example : Mux 4 to 1 - pure logic 1 ARCHITECTURE purelogic OF ExMux_4_1 IS 2 BEGIN DxDO <= ( AxDI AND (NOT Sel1xSI AND NOT Sel2xSI) ) OR 4 ( BxDI AND (NOT Sel1xSI AND Sel2xSI)) OR 5 ( CxDI AND (Sel1xSI AND NOT Sel2xSI)) OR 6 ( DxDI AND (Sel1xSI AND Sel2xSI)); 7 END purelogic; Implicit process Dataflow method -> basic logic gates Fully concurrent implementation Rev. ec17bd.12 The 4 to 1 Mux Architecture - Implicit Process Example : Mux 4 to 1 - WHEN/ 1 ARCHITECTURE whenexample OF ExMux_4_1 IS 2 BEGIN DxDO <= AxDI WHEN (Sel1xSI & Sel2xSI) = 00 4 BxDI WHEN (Sel1xSI & Sel2xSI) = 01 5 CxDI WHEN (Sel1xSI & Sel2xSI) = 10 6 DxDI WHEN (Sel1xSI & Sel2xSI) = 11 7 X 8 END whenexample; Implicit process Priority based description Realizes nested gates Dataflow method Rev. ec17bd.12 The 4 to 1 Mux Architecture - Implicit Process Example : Mux 4 to 1 - WITH/SELECT/WHEN 1 ARCHITECTURE withexample OF ExMux_4_1 IS 2 SIGNAL SelxS : STD_LOGIC_VECTOR(1 DOWNTO 0); BEGIN 4 SelxS <= Sel1xSI & Sel2xSI; -- concatenate the select bits 5 WITH SelxS SELECT 6 DxDO <= AxDI WHEN 00, 7 BxDI WHEN 01, 8 CxDI WHEN 10, 9 DxDI WHEN 11, 10 X WHEN OTHERS; 11 -- others condition is required 12 -- due to std_logic is not only 1 -- 0 and 1, also X, Z among others 14 END withexample; Implicit process Not priority based implementation An efficient method of implementation Do not forget the others condition Rev. ec17bd.12

ModelSim Do-Files Example Do-file 1 # reset the simulation 2 restart -force -nowave 4 # add all input and output signals to the wave file 5 add wave -logic i0 6 add wave -logic i1 7 add wave -logic i2 8 add wave -logic i 9 add wave -logic Sel 10 add wave -logic out 11 12 # force the input signals 1 force -freeze i0 0 0 14 force -freeze i1 1 0 15 force -freeze i2 1 0 16 force -freeze i 0 0 17 18 force -freeze Sel 00 0 19 force -freeze Sel 01 50 20 force -freeze Sel 10 100 21 force -freeze Sel 11 150 22 2 # run the full simulation 24 run 200 25 26 # open the wave window 27 view wave ModelSim allows you to automate sequences of commands using DO files To create a new DO file, navigate to the ModelSim main window and choose File New Source Do To run a Do-file type in ModelSim command-line <NAME>.do The option -freeze is the default drive type and can be avoided. force [-freeze -drive -deposit] [-cancel <time>] [-repeat <time>] <item_name> <value> [<time>] [, <value> <time>...] Rev. ec17bd.1 ModelSim DO-File reference manual : http://www.microsemi.com/document-portal/doc_view/ 14097-modelsim-command-reference-manual-v10-a The parallel carry-ripple adder Exercise : 4 Bit Full-Adder Specify the interface of a 4 Bit Full-Adder by using VHDL. Exercise : The model Write the functional model to the 4 Bit Full-Adder interface by using the VHDL methods shown above. Exercise : The test Write the functional test by using ModleSim Do-File syntax. Outlook In the upcoming session we are going to finish and test the adder in the lab. Make sure every thing is clear! Prepare questions if there are any!! We will not only do logical testing, but also a test run on real-world hardware. Rev. ec17bd.14