Digital Design with VHDL



Similar documents
Lenguaje VHDL. Diseño de sistemas digitales secuenciales

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;

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

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

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

VHDL GUIDELINES FOR SYNTHESIS

Digital Design with Synthesizable VHDL

VHDL programmering H2

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

Lab 7: VHDL 16-Bit Shifter

An Example VHDL Application for the TM-4

VGA video signal generation

Digital Systems Design. VGA Video Display Generation

Using Xilinx ISE for VHDL Based Design

In this example the length of the vector is determined by D length and used for the index variable.

Sprites in Block ROM

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

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

State Machines in VHDL

Hardware Implementation of the Stone Metamorphic Cipher

VHDL Test Bench Tutorial

Computer organization

More Verilog. 8-bit Register with Synchronous Reset. Shift Register Example. N-bit Register with Asynchronous Reset.

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

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

A CPLD VHDL Introduction

Asynchronous & Synchronous Reset Design Techniques - Part Deux

Designing Digital Circuits a modern approach. Jonathan Turner

Registers & Counters

CHAPTER IX REGISTER BLOCKS COUNTERS, SHIFT, AND ROTATE REGISTERS

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

Modeling Latches and Flip-flops

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

ECE 451 Verilog Exercises. Sept 14, James Barnes

Finite State Machine Design and VHDL Coding Techniques

Printed Circuit Board Design with HDL Designer

Quartus II Introduction for VHDL Users

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

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

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

Modeling a GPS Receiver Using SystemC

CPE 462 VHDL: Simulation and Synthesis

Let s put together a Manual Processor

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

PROGETTO DI SISTEMI ELETTRONICI DIGITALI. Digital Systems Design. Digital Circuits Advanced Topics

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

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

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

A Verilog HDL Test Bench Primer Application Note

Cascaded Counters. Page 1 BYU

Lecture 10 Sequential Circuit Design Zhuo Feng. Z. Feng MTU EE4800 CMOS Digital IC Design & Analysis 2010

Digital Design and Synthesis INTRODUCTION

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

Introduction. Jim Duckworth ECE Department, WPI. VHDL Short Course - Module 1

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

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

Lecture 11: Sequential Circuit Design

Life Cycle of a Memory Request. Ring Example: 2 requests for lock 17

ASYNCHRONOUS COUNTERS

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

Lecture-3 MEMORY: Development of Memory:

IE1204 Digital Design F12: Asynchronous Sequential Circuits (Part 1)

From VHDL to FPGA

Lecture 10: Sequential Circuits

Design Verification & Testing Design for Testability and Scan

Finite State Machine. RTL Hardware Design by P. Chu. Chapter 10 1

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

Combinational-Circuit Building Blocks

Modeling Registers and Counters

VHDL Reference Manual

16-bit ALU, Register File and Memory Write Interface

Memory Elements. Combinational logic cannot remember

Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems

FINITE STATE MACHINE: PRINCIPLE AND PRACTICE

A Platform for Visualizing Digital Circuit Synthesis with VHDL

(Refer Slide Time: 00:01:16 min)

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

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

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

A New Paradigm for Synchronous State Machine Design in Verilog

Combinational Logic Design Process

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Systems I: Computer Organization and Architecture

CHAPTER 3 Boolean Algebra and Digital Logic

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

5 Combinatorial Components. 5.0 Full adder. Full subtractor

Systems I: Computer Organization and Architecture

ECE380 Digital Logic

5 A structured VHDL design method

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

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

From UML to HDL: a Model Driven Architectural Approach to Hardware-Software Co-Design

Module 3: Floyd, Digital Fundamental

Understanding Logic Design

Transcription:

Digital Design with VHDL CSE 560M Lecture 5 Shakir James Shakir James 1

Plan for Today Announcement Commentary due Wednesday HW1 assigned today. Begin immediately! Questions VHDL help session Assignment Shakir James 2

Design Entity Hardware abstraction Entity definition entity declaration architecture body i0 i1 i2 i3 and4 f Shakir James 3

Entity and Architecture entity and2 is port (x, y: in std_logic; f: out std_logic); end and2; architecture a1 of and2 is x y f add2 Entity declaration inputs and outputs process(x, y) f <= x and y; end process; end a2; architecture a2 of and2 is f <= 1 when a= 1 and b= 1 else 0 ; end a1; Architecture body Process description Structural description Concurrent assignment ( same as process) Shakir James 4

Multiple Assignments Concurrent region a wire architecture a1 of e is x <= 0 ; y <= x; x <= 1 ; end a1; Within a process pseudo-sequential architecture a2 of e is p: process(x, y) x <= 0 ; y <= x; x <= 1 ; end process; end a2; x = X ; y = X ; x = 1 ; y = 1 ; Shakir James 5

Structural Description entity and4 is port (i0,i1,i2,i3: in std_logic; f: out std_logic); end and4; x y f add2 architecture circuit of and4 is component and2 port (x,y : in std_logic; f : out std_logic); end component; signal n1, n2: std_logic; i0 i1 i2 i3 a2_1 n1 a2_2 n2 a2_3 f a2_1: and2 port map (i0,i1,n1); a2_2: and2 port map (i2,i3,n2); a2_3: and2 port map (n1,n2,f) end circuit; and4 Shakir James 6

Process Description entity and4 is port (i0,i1,i2,i3: in std_logic; f: out std_logic); end and4; architecture a2 of and4 is signal n1,n2: std_logic; x y f p: process (i0,i1,i2,i3,n1,n2) add2 n1 <= a and b; n2 <= c and d; f <= n1 and n2; i0 i1 i2 i3 a2_1 n1 n2 a2_2 a2_3 f end process; end a2; and4 Shakir James 7

Combinatorial and Sequential Combinatorial Logic State No Yes Examples Logic functions Arithmetic functions Multiplexers Decoders Architecture Processes Concurrent statements Sequential Logic Latches Flip-flops Registers Counters Processes Concurrent statements are simpler! Shakir James 8

Combinatorial Logic as Process Common error #1 entity and3 is port (a, b, c: in std_logic; f: out std_logic); end and3; architecture a of and3 is p: process(a, b) o <= a and b and c; end process; end a; c missing in sensitivity list Common rror #2 architecture a of e is p: process(a, b) if a = 0 then x <= a; y <= b; elsif a = b then x <= 0 ; y <= 1 ; else x <= not a; fi end process; end a; y not defined in else Shakir James 9

Clocked Sequential Circuit x=0/z=0 entity fsm is port (x, rst_l, clk: in std_logic; z : out std_logic); end fsm; s0 x=1/z=1 x=1/z=0 s1 architecture mealy of fsm is type states is (s0, s1); signal state: states := s0; x=0/z=1 state_trans: process(clk) if (rising_edge(clk)) then if (rst_l= 0 ) then state <= s0; else case state is when s0 => if (x = 1 ) then state <= s1; end if; when s1 => if (x = 1 ) then state <= s0; end if; end case; end if; end process state_trans; -- code that defines outputs z <= 1 when (state = s0 and x = 1 ) or (state = s1 and x = 0 ) else 0 ; end mealy; Shakir James 10

Assignment HW1 assigned, due 9/23 Readings For Wednesday H&P: Appendix A, sections A3- A.5 Commentary: Retrospective on HLL Computers submit commentary to newsgroup before class For Monday H&P: Appendix A, sections A6- A.9 V&L: Ch. 4 Shakir James 11

Exercise 1 Write a VHDL module implementing a 4 input multiplexer. Each input should be a 32 bit wide std_logic_vector. Hint Entity: inputs: outputs: Architecture: combinatorial or sequential logic? Shakir James 12

Exercise 1 - Solution library ieee; use ieee.std_logic_1164.all; entity mux is port (p0,p1,p2,p3: in std_logic_vector(31 downto 0); sel : in std_logic_vector(1 downto 0); end mux; output : out std_logic_vector(31 downto 0)); architecture beh of mux is output <= p0 when sel="00" else end beh; p1 when sel="01" else p2 when sel="10" else p3 when sel="11"; Shakir James 13

Exercise 2 Write a VHDL module implementing a synchronous 32 bit counter. A reset signal resets the counter to 0. An en signal enables the counter modification. An up signal indicates whether the counter must be incremented (1)/ decremented(0). The output of the module is the value of the signal, represented as 32 bit wide std_logic_vector. Shakir James 14

Exercise 2 - Solution library ieee; use ieee.std_logic_1164.all; entity mux is port (p0,p1,p2,p3: in std_logic_vector(31 downto 0); sel : in std_logic_vector(1 downto 0); end mux; output : out std_logic_vector(31 downto 0)); architecture beh of mux is output <= p0 when sel="00" else end beh; p1 when sel="01" else p2 when sel="10" else p3 when sel="11"; Shakir James 15

Exercise 2 - Solution (cont d) architecture beh of counter is signal count : integer; counter_p: process(clk) if (rising_edge(clk)) then if (reset = '1') then else count <= 0; if en = '1' then if up = '1' then count <= count + 1; else count <= count - 1; end if; end if; end if; end if; end process; output <= conv_std_logic_vector(count,32); end beh; Shakir James 16

Exercise 3 Use the modules written for exercises 1 and 2 in order to implement a synchronous register file containing 4 counters. The multiplexer will allow to determine which counter will be seen on the single output. The module should present a global reset signal, a write enable signal, a read and a write selector, and an up signal. Shakir James 17

Exercise 3 - Solution library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; entity counter_reg is port (clk : in std_logic; write_en : in std_logic; up : in std_logic; reset : in std_logic; read_sel : in std_logic_vector(1 downto 0); write_sel: in std_logic_vector(1 downto 0); output : out std_logic_vector(31 downto 0)); end counter_reg; architecture struct of counter_reg is component mux port (p0,p1,p2,p3: in std_logic_vector(31 downto 0); sel : in std_logic_vector(1 downto 0); output : out std_logic_vector(31 downto 0)); end component; component counter port (clk : in std_logic; en : in std_logic; up : in std_logic; reset : in std_logic; output : out std_logic_vector(31 downto 0)); end component; Shakir James 18

Exercise 3 - Solution (cont d) wr_en <= "0000" when write_en = '0' else "0001" when write_sel="00" else "0010" when write_sel="01" else "0100" when write_sel="10" else "1000"; cloop: for i in 3 downto 0 generate cnt: counter port map (clk,wr_en(i),up,reset,outputs(i)); end generate; m: mux port map (outputs(0),outputs(1),outputs(2),outputs(3), read_sel,output); end struct; Shakir James 19