Lab 7: VHDL 16-Bit Shifter



Similar documents
Digital Design with VHDL

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr

Lenguaje VHDL. Diseño de sistemas digitales secuenciales

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

Using Xilinx ISE for VHDL Based Design

VGA video signal generation

Let s put together a Manual Processor

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

VHDL programmering H2

Digital Logic Design Sequential circuits

! " # # $ '"() * #! +, # / $0123$

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

Step : Create Dependency Graph for Data Path Step b: 8-way Addition? So, the data operations are: 8 multiplications one 8-way addition Balanced binary

An Example VHDL Application for the TM-4

Digital Systems Design. VGA Video Display Generation

Modeling Latches and Flip-flops

5 Combinatorial Components. 5.0 Full adder. Full subtractor

VHDL GUIDELINES FOR SYNTHESIS

Sprites in Block ROM

Digital Design with Synthesizable VHDL

Introduction to Programmable Logic Devices. John Coughlan RAL Technology Department Detector & Electronics Division

VHDL Reference Manual

Rotary Encoder Interface for Spartan-3E Starter Kit

SELECT INPUTS STROBE OUTPUTS

CHAPTER IX REGISTER BLOCKS COUNTERS, SHIFT, AND ROTATE REGISTERS

16-bit ALU, Register File and Memory Write Interface

INTRODUCTION TO DIGITAL SYSTEMS. IMPLEMENTATION: MODULES (ICs) AND NETWORKS IMPLEMENTATION OF ALGORITHMS IN HARDWARE

(1) D Flip-Flop with Asynchronous Reset. (2) 4:1 Multiplexor. CS/EE120A VHDL Lab Programming Reference

VHDL Test Bench Tutorial

Hardware Implementation of the Stone Metamorphic Cipher

Layout of Multiple Cells

Asynchronous & Synchronous Reset Design Techniques - Part Deux

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

CPE 462 VHDL: Simulation and Synthesis

Computer organization

Digital Design and Synthesis INTRODUCTION

Chapter 2 Logic Gates and Introduction to Computer Architecture

State Machines in VHDL

A CPLD VHDL Introduction

Memory Elements. Combinational logic cannot remember

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Combinational-Circuit Building Blocks

Lecture-3 MEMORY: Development of Memory:

Finite State Machine Design and VHDL Coding Techniques

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY

Quartus II Introduction for VHDL Users

Printed Circuit Board Design with HDL Designer

EXPERIMENT 8. Flip-Flops and Sequential Circuits

Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit

Lab 1: Introduction to Xilinx ISE Tutorial

Floating point package user s guide By David Bishop (dbishop@vhdl.org)

Coding Guidelines for Datapath Synthesis

Modeling Registers and Counters

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

A Platform for Visualizing Digital Circuit Synthesis with VHDL

Register File, Finite State Machines & Hardware Control Language

路 論 Chapter 15 System-Level Physical Design

Start Active-HDL by double clicking on the Active-HDL Icon (windows).

>

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

Registers & Counters

ECE 451 Verilog Exercises. Sept 14, James Barnes

Decimal Number (base 10) Binary Number (base 2)

FINITE STATE MACHINE: PRINCIPLE AND PRACTICE

University of St. Thomas ENGR Digital Design 4 Credit Course Monday, Wednesday, Friday from 1:35 p.m. to 2:40 p.m. Lecture: Room OWS LL54

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies


Study of 32-bit RISC Processor Architecture and VHDL FPGA Implementation 32-bitMatrix Manipulation

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Two Binary Algorithms for Calculating the Jacobi Symbol and a Fast Systolic Implementation in Hardware

Design of All Digital FM Receiver Circuit

Chapter 9 Computer Design Basics!

Asynchronous Counters. Asynchronous Counters

Quartus II Software Design Series : Foundation. Digitale Signalverarbeitung mit FPGA. Digitale Signalverarbeitung mit FPGA (DSF) Quartus II 1

The components. E3: Digital electronics. Goals:

(1) /30 (2) /30 (3) /40 TOTAL /100

Clock Data Recovery Design Techniques for E1/T1 Based on Direct Digital Synthesis Author: Paolo Novellini and Giovanni Guasti

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Memory unit. 2 k words. n bits per word

8254 PROGRAMMABLE INTERVAL TIMER

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Design of Remote Laboratory dedicated to E2LP board for e-learning courses.

Combining the ADS1202 with an FPGA Digital Filter for Current Measurement in Motor Control Applications

Implementation of Modified Booth Algorithm (Radix 4) and its Comparison with Booth Algorithm (Radix-2)

Introduction to Simulink

Lecture 12: More on Registers, Multiplexers, Decoders, Comparators and Wot- Nots

Systems I: Computer Organization and Architecture

Using the HT46R46 I/O Ports to Implement Half-Duplex SPI Communication

Sistemas Digitais I LESI - 2º ano

The Designer's Guide to VHDL

Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

Transcription:

Lab 7: VHDL 16-Bit Shifter Objectives : Design a 16-bit shifter which need implement eight shift operations: logic shift right, logic shift left, arithmetic shift right, arithmetic shift left, rotate right, rotate left rotate left with carry, rotate left with carry. 16-Bit Shifter specification: 16 4 S A C H To C 16 Figure 1. Symbol Figure 2. Logic diagram 1

S 1 S 0 Shift Operation 0 0 Logic Shift 0 1 Arithmetic shift 1 0 Rotate 1 1 Rotate with carry S 3 S 2 Shift direction 0 0 Parallel Load 0 1 Shift Right with I L 1 0 Shift Left with I R 1 1 No Change In the above logic diagram, for the unit 16-bit basic shifter design you may refer to the available code for the Universal Shift Register with parallel load(three different style codes are given). Universal Shifter Register with parallel Load Figure 3. Universal Shift Register Symbol S 1 S 0 Next State after Description rising_edge of clk 0 0 Q[3..0] <=Q[3..0] No Change 0 1 Q[3..0] <=I[3..0] Parallel Load 1 0 Q[3..1]<=Q[2..0], Q[0]<=I R Shift Left with I R 1 1 Q[3]<=I L, Q[2..0]<=Q[3..1] Shift Right with I L 1. Universal shift register using array slicing and concatenation method. LISTING 1: Save as Filename= univ_shiftreg1.vhd USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.NUMERIC_BIT.ALL; 2

ENTITY univ_shiftreg1 IS PORT(clk, il, ir : IN BIT; s: IN BIT_VECTOR(1 DOWNTO 0); i : IN BIT_VECTOR(3 DOWNTO 0); q : OUT BIT_VECTOR(3 DOWNTO 0)); END univ_shiftreg1; ARCHITECTURE beh1 OF univ_shiftreg1 IS SIGNAL qtmp : BIT_VECTOR(3 DOWNTO 0); PROCESS(clk) IF (clk = '1' AND clk'event) THEN CASE s IS WHEN "00" => qtmp <= qtmp; WHEN "01" => qtmp <= i; WHEN "10" => qtmp<=qtmp(2 DOWNTO 0) & ir; WHEN "11" => qtmp<=il & qtmp(3 DOWNTO 1); WHEN OTHERS => NULL; END CASE; END IF; END PROCESS; q <= qtmp; END beh1; 2. Universal shift register using shifting operators: sll, srl. LISTING 2: Save as Filename= univ_shiftreg2.vhd library ieee; use ieee.std_logic_1164.all; use ieee.numeric_bit.all; entity univ_shiftreg2 is port(clk,il,ir :in bit; s :in bit_vector(1 downto 0); i : in bit_vector(3 downto 0); q : out bit_vector(3 downto 0)); end univ_shiftreg2; architecture beh2 of univ_shiftreg2 is signal qtmp: bit_vector(5 downto 0); begin process(clk) begin if (clk = '1' and clk'event) then case s is when "00" => qtmp <= qtmp; 3

end beh2; when others => null; end case; end if; end process; q<=qtmp(4 downto 1); when "01" => qtmp <=il&i&ir; when "10" => qtmp <= (il&qtmp(4 downto 1)&ir) sll 1; when "11" => qtmp<= (il&qtmp(4 downto 1)&ir) srl 1 ; 3. Universal shift register using structural modelling. Figure 4. Universal Shift Register Implementation. MUX_sel NEXT STATE after rising_edge of clk S1S0 Q3 Q2 Q1 Q0 Operation 00 Q3 Q2 Q1 Q0 No Change 01 I3 I2 I1 I0 Parallel Load 10 Q2 Q1 Q0 IR Shift left 11 IL Q3 Q2 Q1 Shift right Write a vhdl code to model (entity and architecture) a four to one multiplexer called MUX41. LISTING 3: Save as Filename= univ_shiftreg3.vhd ENTITY MUX41 IS PORT (i3, i2, i1, i0 : IN BIT; 4

s: IN BIT_VECTOR(1 DOWNTO 0); o: OUT BIT); END MUX41; ARCHITECTURE arch_mux41 OF MUX41 IS PROCESS(i3, i2, i1, i0, s) CASE s IS WHEN "00" => o <= i0; WHEN "01" => o <= i1; WHEN "10" => o <= i2; WHEN "11" => o <= i3; WHEN OTHERS => NULL; END CASE; END PROCESS; END arch_mux41 Write a vhdl code to model (entity and architecture) d flip-flop called DFF. ENTITY DFF IS PORT(d, clk : IN BIT; q, qb : OUT BIT); END DFF; ARCHITECTURE arch_dff OF DFF IS PROCESS(clk) VARIABLE q_temp : BIT; IF(clk'EVENT AND clk='1')then q_temp := d; END IF; q <= q_temp; qb <= NOT q_temp; END PROCESS; END arch_dff; Using DFF and MUX41 components, generates the structural model of the univ_shiftreg. That is, show the port map for each of the components shown in Fig 2. ENTITY univ_shiftreg3 IS PORT(clk, il, ir : IN BIT; s: IN BIT_VECTOR(1 DOWNTO 0); i : IN BIT_VECTOR(3 DOWNTO 0); q : OUT BIT_VECTOR(3 DOWNTO 0)); END univ_shiftreg3; ARCHITECTURE struct OF univ_shiftreg3 IS COMPONENT MUX41 PORT (i3, i2, i1, i0 : IN BIT; s: IN BIT_VECTOR(1 DOWNTO 0); o: OUT BIT); END COMPONENT; COMPONENT DFF PORT(d, clk : IN BIT; 5

q, qb : OUT BIT); END COMPONENT; FOR U1, U2, U3, U4: MUX41 USE ENTITY WORK.MUX41(arch_mux41); FOR U5, U6, U7, U8: DFF USE ENTITY WORK.DFF(arch_dff); SIGNAL o: BIT_VECTOR(3 DOWNTO 0); SIGNAL qb: BIT_VECTOR(3 DOWNTO 0); SIGNAL qt:bit_vector(3 DOWNTO 0); U1:MUX41 PORT MAP(il,qt(2), i(3), qt(3), s, o(3)); U2:MUX41 PORT MAP(qt(3), qt(1), i(2), qt(2), s, o(2)); U3:MUX41 PORT MAP(qt(2), qt(0), i(1), qt(1), s, o(1)); U4:MUX41 PORT MAP(qt(1), ir, i(0), qt(0), s, o(0)); U5:DFF PORT MAP(o(3), clk, qt(3), qb(3)); U6:DFF PORT MAP(o(2), clk, qt(2), qb(2)); U7:DFF PORT MAP(o(1), clk, qt(1), qb(1)); U8:DFF PORT MAP(o(0), clk, qt(0), qb(0)); q <= qt; END struct; --------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------- Combinatorial Implementation of Basic 4-bit Shifter* A combinatorial implementation of basic 4 bit shifter is given in Fig 5. Please expand it to 16 bit shifter and use it in the implementation of Figure 2 instead of universal shift register. (S is 2 bit selection signal, S= S 1 S 0 ) Figure 5. 4 bit shifter *NOTE: This is 4-bit shifter implementation to be used in the project 6