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

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

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

VHDL for FPGA Design. by : Mohamed Samy

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

Hardware Description Language VHDL (1) Introduction

Lecture 4. VHDL Fundamentals. George Mason University

Basic Language Concepts

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

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

Lattice VHDL Training

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

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

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

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

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

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

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

Concurrent Signal Assignment Statements (CSAs)

ELCT 501: Digital System Design

TSIU03, SYSTEM DESIGN LECTURE 2

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

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

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

Computer-Aided Digital System Design VHDL

EEL 4783: Hardware/Software Co-design with FPGAs

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

Chapter 6 Combinational-Circuit Building Blocks

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

Introduction to VHDL. Main language concepts

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

Lecture 3 Introduction to VHDL

Digital Systems Design

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

Lecture 12 VHDL Synthesis

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

ENGIN 241 Digital Systems with Lab

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

In our case Dr. Johnson is setting the best practices

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

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

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

VHDL Structural Modeling II

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

EITF35: Introduction to Structured VLSI Design

VHDL And Synthesis Review

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

VHDL Examples Mohamed Zaky

ECE 459/559 Secure & Trustworthy Computer Hardware Design

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

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

EEL 4712 Digital Design Test 1 Spring Semester 2008

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 3

Contents. Appendix D VHDL Summary Page 1 of 23

VHDL in 1h. Martin Schöberl

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

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

Experiment 8 Introduction to VHDL

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

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

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

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

Control and Datapath 8

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

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

Mridula Allani Fall Fall

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

Chapter 2 Basic Logic Circuits and VHDL Description

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

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

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

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

Verilog Design Principles

Inthis lecture we will cover the following material:

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

[VARIABLE declaration] BEGIN. sequential statements

Subprograms, Packages, and Libraries

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

Constructing VHDL Models with CSA

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

Design units can NOT be split across different files

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

VHDL for Synthesis. Course Description. Course Duration. Goals

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

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 3

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

Basic Language Constructs of VHDL

CS232 VHDL Lecture. Types

Digital Systems Design

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

VHDL simulation and synthesis

VHDL for Complex Designs

Transcription:

Lecture 3 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. ec317bd 3.2

The basic elements are AND, OR, NOT, EXOR, NAND, NOR Rev. ec317bd 3.3

The basic elements are AND, OR, NOT, EXOR, NAND, NOR Such components have a library declaration LIBRARY IEEE; Rev. ec317bd 3.3

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; Rev. ec317bd 3.3

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; 3 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. ec317bd 3.3

Some More Entity Examples Example : NOT (entity) 1 LIBRARY ieee; -- Library to include 2 USE ieee.std_logic_1164.all; -- Package of library 3 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 Rev. ec317bd 3.4

Some More Entity Examples Example : NOT (entity) 1 LIBRARY ieee; -- Library to include 2 USE ieee.std_logic_1164.all; -- Package of library 3 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 3 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. ec317bd 3.4

Some More Entity Examples Example : NOT (entity) 1 LIBRARY ieee; -- Library to include 2 USE ieee.std_logic_1164.all; -- Package of library 3 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 3 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. What circuit is it? What is its interface? Write the entity of the circuit on the left-hand side? Rev. ec317bd 3.4

Some More Entity Examples Example : NOT (entity) 1 LIBRARY ieee; -- Library to include 2 USE ieee.std_logic_1164.all; -- Package of library 3 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 3 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. Example : Mux 2 to 1 1 library ieee; 2 use ieee.std_logic_1164.all; 3 4 entity ExMux_2_1 is 5 port ( 6 AxDI, BxDI : in std_logic; 7 SelxSI : in std_logic; 8 DxDO : out std_logic 9 ); 10 end ExMux_2_1; Rev. ec317bd 3.4

Some Vector Based Entities Example : AND 4 Bit (entity) 1 LIBRARY ieee; 2 USE ieee.std_logic_1164.all; 3 4 ENTITY ExAnd_4 is 5 Port( 6 AxDI : IN std_logic_vector(3 downto 0); 7 BxDI : IN std_logic_vector(3 downto 0); 8 FxDO : OUT std_logic_vector(3 downto 0) 9 ); 10 END ExAnd_4; Rev. ec317bd 3.5

Some Vector Based Entities Example : AND 4 Bit (entity) 1 LIBRARY ieee; 2 USE ieee.std_logic_1164.all; 3 4 ENTITY ExAnd_4 is 5 Port( 6 AxDI : IN std_logic_vector(3 downto 0); 7 BxDI : IN std_logic_vector(3 downto 0); 8 FxDO : OUT std_logic_vector(3 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. ec317bd 3.5

Some Vector Based Entities Example : AND 4 Bit (entity) 1 LIBRARY ieee; 2 USE ieee.std_logic_1164.all; 3 4 ENTITY ExAnd_4 is 5 Port( 6 AxDI : IN std_logic_vector(3 downto 0); 7 BxDI : IN std_logic_vector(3 downto 0); 8 FxDO : OUT std_logic_vector(3 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 What to do when we would like to create a more generic component Rev. ec317bd 3.5

Some Vector Based Entities Example : AND 4 Bit (entity) 1 LIBRARY ieee; 2 USE ieee.std_logic_1164.all; 3 4 ENTITY ExAnd_4 is 5 Port( 6 AxDI : IN std_logic_vector(3 downto 0); 7 BxDI : IN std_logic_vector(3 downto 0); 8 FxDO : OUT std_logic_vector(3 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 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. Rev. ec317bd 3.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; 3 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 ); 13 END ExMux_4_G; Rev. ec317bd 3.5

Mux Exercises Figure: Block Diagram 4 to 1 Mux Rev. ec317bd 3.6

Mux Exercises Figure: Block Diagram 4 to 1 Mux Figure: Logic Diagram 4 to 1 Mux Rev. ec317bd 3.6

Mux Exercises Figure: Block Diagram 4 to 1 Mux 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. ec317bd 3.6

Mux Exercises Figure: Block Diagram 4 to 1 Mux Solution : Mux 4 to 1 (entity) 1 LIBRARY ieee; 2 USE ieee.std_logic_1164.all; 3 4 ENTITY ExMux_4_1 is 5 Port( 6 AxDI, BxDI, CxDI, DxDI : IN std_logic; 7 Sel1xSI, Sel2xSI : IN std_logic; 8 DxDO : OUT std_logic 9 ); 10 END ExMux_4_1; 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. Rev. ec317bd 3.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. Rev. ec317bd 3.7

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. Rev. ec317bd 3.7

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. Rev. ec317bd 3.7

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. ec317bd 3.7

The Latch Example Example : Latch Entity 1 library ieee; 2 use ieee.std_logic_1164.all; 3 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; 3 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 Rev. ec317bd 3.8

The Latch Example Example : Latch Entity 1 library ieee; 2 use ieee.std_logic_1164.all; 3 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; 3 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. ec317bd 3.8

The internals of an element Example : VHDL Architecture 1 architecture <MODEL_NAME> of <ENTITY_NAME> is -- start of architecture statement 2 3 -- 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 13 -- it can be behavioral, data-flow, 14 -- or structural. 15 16 end <MODEL_NAME>; -- end of architecture statement Rev. ec317bd 3.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 3 -- <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 13 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 23 end dataflow; Rev. ec317bd 3.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. Rev. ec317bd 3.11

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. Rev. ec317bd 3.11

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. Rev. ec317bd 3.11

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. ec317bd 3.11

The 4 to 1 Mux Architecture - Implicit Process Example : Mux 4 to 1 - pure logic Figure: Block Diagram 4 to 1 Mux 1 ARCHITECTURE purelogic OF ExMux_4_1 IS 2 BEGIN 3 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. ec317bd 3.12

The 4 to 1 Mux Architecture - Implicit Process Figure: Block Diagram 4 to 1 Mux Example : Mux 4 to 1 - WHEN/ELSE 1 ARCHITECTURE whenexample OF ExMux_4_1 IS 2 BEGIN 3 DxDO <= AxDI WHEN (Sel1xSI & Sel2xSI) = 00 ELSE 4 BxDI WHEN (Sel1xSI & Sel2xSI) = 01 ELSE 5 CxDI WHEN (Sel1xSI & Sel2xSI) = 10 ELSE 6 DxDI WHEN (Sel1xSI & Sel2xSI) = 11 ELSE 7 X 8 END whenexample; Implicit process Priority based description Realizes nested gates Dataflow method Rev. ec317bd 3.12

The 4 to 1 Mux Architecture - Implicit Process Figure: Block Diagram 4 to 1 Mux 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); 3 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 13 -- 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. ec317bd 3.12

ModelSim Do-Files ModelSim allows you to automate sequences of commands using DO files ModelSim DO-File reference manual : http://www.microsemi.com/document-portal/doc_view/ 134097-modelsim-command-reference-manual-v10-3a Rev. ec317bd 3.13

ModelSim Do-Files 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 ModelSim DO-File reference manual : http://www.microsemi.com/document-portal/doc_view/ 134097-modelsim-command-reference-manual-v10-3a Rev. ec317bd 3.13

ModelSim Do-Files 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 ModelSim DO-File reference manual : http://www.microsemi.com/document-portal/doc_view/ 134097-modelsim-command-reference-manual-v10-3a Rev. ec317bd 3.13

ModelSim Do-Files Example Do-file 1 # reset the simulation 2 restart -force -nowave 3 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 i3 9 add wave -logic Sel 10 add wave -logic out 11 12 # force the input signals 13 force -freeze i0 0 0 14 force -freeze i1 1 0 15 force -freeze i2 1 0 16 force -freeze i3 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 23 # 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. ModelSim DO-File reference manual : http://www.microsemi.com/document-portal/doc_view/ 134097-modelsim-command-reference-manual-v10-3a Rev. ec317bd 3.13

ModelSim Do-Files Example Do-file 1 # reset the simulation 2 restart -force -nowave 3 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 i3 9 add wave -logic Sel 10 add wave -logic out 11 12 # force the input signals 13 force -freeze i0 0 0 14 force -freeze i1 1 0 15 force -freeze i2 1 0 16 force -freeze i3 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 23 # 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>...] ModelSim DO-File reference manual : http://www.microsemi.com/document-portal/doc_view/ 134097-modelsim-command-reference-manual-v10-3a Rev. ec317bd 3.13

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. ec317bd 3.14