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

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

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

Introduction to VHDL #3

Digital Systems Design

Very High Speed Integrated Circuit Har dware Description Language

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

Hardware Description Language VHDL (1) Introduction

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

Basic Language Concepts

Solutions - Homework 2 (Due date: October 9:30 am) Presentation and clarity are very important!

Test Benches - Module 8

Chapter 8 VHDL Code Examples

Constructing VHDL Models with CSA

VHDL. Chapter 1 Introduction to VHDL. Course Objectives Affected. Outline

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

In our case Dr. Johnson is setting the best practices

ECE 545 Lecture 4. Simple Testbenches. George Mason University

Chapter 6 Combinational-Circuit Building Blocks

EENG 2910 Project III: Digital System Design. Due: 04/30/2014. Team Members: University of North Texas Department of Electrical Engineering

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

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

Introduction to VHDL #1

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

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

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

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

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 3

Concurrent Signal Assignment Statements (CSAs)

[VARIABLE declaration] BEGIN. sequential statements

Introduction to VHDL

VHDL in 1h. Martin Schöberl

ECE 459/559 Secure & Trustworthy Computer Hardware Design

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

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Control and Datapath 8

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

Inthis lecture we will cover the following material:

Lattice VHDL Training

Getting Started with VHDL

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

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

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

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

Computer-Aided Digital System Design VHDL

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 3

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

CCE 3202 Advanced Digital System Design

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 8

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

VHDL Notes for Week 4. VHDL Programming in CprE 381. Entity and Component 9/22/2014. Generic Constant. Test bench

Quartus Counter Example. Last updated 9/6/18

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

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

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

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

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

EEL 4712 Name: SOLUTION Midterm 1 Spring 2016 VERSION 1 UFID:

EEL 4712 Digital Design Test 1 Spring Semester 2008

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

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

Sequential Logic - Module 5

Introduction to VHDL #2

14:332:331. Computer Architecture and Assembly Language Spring Week 6

VHDL And Synthesis Review

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

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

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

Lecture 12 VHDL Synthesis

Contents. Appendix D VHDL Summary Page 1 of 23

CprE 583 Reconfigurable Computing

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

VHDL Simulation. Testbench Design

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

EITF35: Introduction to Structured VLSI Design

COVER SHEET: Total: Regrade Info: Problem#: Points. 7 (14 points) 6 (7 points) 9 (6 points) 10 (21 points) 11 (4 points)

Digitaalsüsteemide disain

EE434 ASIC & Digital Systems

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

EEL 4783: Hardware/Software Co-design with FPGAs

LECTURE 4: The VHDL N-bit Adder

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Summary of FPGA & VHDL

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

CSC / EE Digital Systems Design. Summer Sample Project Proposal 01

EEL 4712 Digital Design Test 1 Spring Semester 2007

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

Experiment 8 Introduction to VHDL

VHDL for FPGA Design. by : Mohamed Samy

ECE 545 Lecture 9. Modeling of Circuits with a Regular Structure. Aliases, Attributes, Packages. George Mason University

Lab 3: Standard Combinational Components

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1. Your name 2/13/2014

EE261: Intro to Digital Design

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

The process. Sensitivity lists

TKT-1212 Digitaalijärjestelmien toteutus. Lecture 7: VHDL Testbenches Ari Kulmala, Erno Salminen 2008

ENGIN 241 Digital Systems with Lab

VHDL for Synthesis. Course Description. Course Duration. Goals

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

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

Inferring Storage Elements

Transcription:

Experiment-3: Write VHDL programs for the following circuits, check the wave forms and the hardware generated a. multiplexer b. De-Multiplexer Objective: i. To learn the VHDL coding for Multiplexer and Demultiplexer ii. To understand the behavior of Multiplexer and Demultiplexer iii. To synthesize and simulate Multiplexer and Demultiplexer Theory: A multiplexer is a combinational circuit which has 2 N :1 input output ports with N and control ports. The control port is used to select one of the 2 N input and connect it to the output. A multiplexer is also called a switcher as it switches one of several input lines through to a single common output line. The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below: Y = I 0. S + I 1. S The VHDL code for synthesizing the 2x1 multiplexer is given below in all the three style of modelling. VHDL CODING library IEEE; use IEEE.STD_LOGIC_1164.ALL;

entity MUX2x1 is Port ( I : in STD_LOGIC_VECTOR (1 downto 0 s : in STD_LOGIC; y : out STD_LOGIC end MUX2x1; architecture Behavioral of MUX2x1 is Y <= (I(0) and (not s)) or (I(1) and s end Behavioral; Behavioural Modelling of 2x1 multiplexer in VHDL library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity mux2x1_behave is Port ( i : in STD_LOGIC_VECTOR (1 downto 0 s : in STD_LOGIC; y : out STD_LOGIC end mux2x1_behave; architecture Behavioral of mux2x1_behave is mux2x1: process (i,s) if ( s='0') then

Y <= i(0 elsif( s='1') then Y <= i(1 else y <= 'Z'; end if; end process; end Behavioral; Designing a 4x1 multiplexer using 2x1 multiplexers in structural modelling A 4x1 multiplexer can be implemented in structural modelling using VHDL by using three 2x1 multiplexers. The block diagram and the VHDL code is shown below. VHDL CODE: library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity MUX4x1 is Port ( i : in STD_LOGIC_VECTOR (3 downto 0 s : in STD_LOGIC_VECTOR (1 downto 0 y : out STD_LOGIC

end MUX4x1; architecture Behavioral of MUX4x1 is signal w1,w2: std_logic; X1: entity work.mux2x1 port map X2: entity work.mux2x1 port map X3: entity work.mux2x1 port map end Behavioral; (I(0)=>I(0), I(1)=>I(1),s=>s(0), y=>w1 (I(0)=>I(2), I(1)=>I(3),s=>s(0), y=>w2 (I(0)=> w1, I(1)=>w2,s=>s(1), y=> Y Test Bench for MUX 4x1: LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY mux_4x1_tb IS

END mux_4x1_tb; ARCHITECTURE behavior OF mux_4x1_tb IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT MUX4x1 PORT( i : IN std_logic_vector(3 downto 0 s : IN std_logic_vector(1 downto 0 y : OUT std_logic END COMPONENT; --Inputs signali : std_logic_vector(3 downto 0) := (others => '0' signal s : std_logic_vector(1 downto 0) := (others => '0' --Outputs signal y : std_logic; BEGIN -- Instantiate the Unit Under Test (UUT) uut: MUX4x1 PORT MAP ( i =>i, s => s, y => y -- Stimulus process stim_proc: process

-- hold reset state for 100 ns. wait for 1000 ns; -- insert stimulus here i<= "0001"; s<= "00"; wait for 1000 ns; i<= "0001"; s<= "00"; wait for 1000 ns; i<= "0010"; s<= "01"; wait for 1000 ns; i<= "0100"; s<= "10"; wait for 1000 ns; i<= "1000"; s<= "11"; wait for 100 ns; wait; end process; END; Special Type of Mux: Now we move a step further in defining a multi-bit output multiplexer. Here we illustrate a mux2x1_4bit that accepts two four bit input number on its two input ports A and B. The sel input is used to select one of the two four bit input and passes it on the four bit output shared bus.

The general bloc for a MUX2x1_4bit is shown below followed by the VHDL concurrent style of modelling. VHDL CODE: LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY mux2_1_nbit_wide IS Generic ( N: integer :=4 PORT(in_a : IN STD_LOGIC_VECTOR(N DOWNTO 0 --input a in_b : IN STD_LOGIC_VECTOR(N DOWNTO 0 --input b sel : IN STD_LOGIC; --select input output : OUT STD_LOGIC_VECTOR(N DOWNTO 0) --data output END mux2_1_nbit_wide; ARCHITECTURE dataflow OF mux2_1_nbit_wide IS BEGIN WITH sel SELECT output<= in_a WHEN 0, in_b WHEN 1, (OTHERS => X ) WHEN OTHERS; END dataflow; OTHERS again Here we see OTHERS used to match cases where sel is not 1 or 0 in the WHEN OTHERS clause. i.e.: (OTHERS => X ) WHEN OTHERS; OTHERS is also used to provide a shorthand method of saying, make all the bits of the target signal X for however many bits are in target signal. (OTHERS => X ) WHEN OTHERS;

De-multiplexer: A de-multiplexer is a combinational circuit that behavior opposite to a multiplexer. It has a single input, S control inputs and 2S as output lines. Only one of the output will be activated by the control / selection lines and the input I will be transferred on the selected output line. Figure below shows the block diagram of the demultiplexer Output equations: Y0 = I.S1.S0 Y1 = I.S1.S0 Y2 = I.S1.S0 Y3 = I.S1.S0 VHDL Code: entitydemux is Port ( I : in STD_LOGIC; S : in STD_LOGIC_VECTOR (1 downto 0 Y : out STD_LOGIC_VECTOR (3 downto 0) enddemux; architecture Behavioral of DeMux is Y(0) <= I and (not S(1) ) and (not s(0) Y(1) <= I and (not S(1) ) and (s(0) Y(2) <= I and (S(1) ) and (not s(0) Y(3) <= I and (S(1) ) and (s(0) end Behavioral; TEST BENCH

LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY DeMux_tb IS END DeMux_tb; ARCHITECTURE behavior OF DeMux_tb IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT DeMux PORT( I : IN std_logic; S : IN std_logic_vector(1 downto 0 Y : OUT std_logic_vector(3 downto 0) END COMPONENT; --Inputs signal I : std_logic := '0'; signal S : std_logic_vector(1 downto 0) := (others => '0' --Outputs signal Y : std_logic_vector(3 downto 0 BEGIN -- Instantiate the Unit Under Test (UUT) uut: DeMux PORT MAP ( I => I, S => S, Y => Y -- Stimulus process stim_proc: process -- insert stimulus here wait for 100 ns; I <= '0'; S<= "00";

wait for 100 ns; I <= '1'; S<= "01"; wait for 100 ns; I <= '0'; S<= "10"; wait for 100 ns; I <= '1'; S<= "11"; wait; end process; END; Behavioural Modelling of De-Mux VHDL CODE library IEEE; use IEEE.STD_LOGIC_1164.ALL; entitydemux is Port ( I : in STD_LOGIC; S : in STD_LOGIC_VECTOR (1 downto 0 Y : out STD_LOGIC_VECTOR (3 downto 0) enddemux; architecture Behavioral of DeMux is

process(s,i) if (S="00") then Y <= "000"&I; elsif(s="01") then Y <= "00"&I&'0'; elsif (S="10") then Y <= '0'&I&"00"; else Y<= I&"000"; end if; end process; end Behavioral; SIMMULATION using ISIM