Laboratory Exercise 3

Similar documents
Laboratory Exercise 6

HDL & High Level Synthesize (EEET 2035) Laboratory II Sequential Circuits with VHDL: DFF, Counter, TFF and Timer

Laboratory Exercise 7

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

Laboratory Exercise 7

Ryerson University Department of Electrical and Computer Engineering EES508 Digital Systems

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

STATIC RANDOM-ACCESS MEMORY

Digital Circuits ECS 371

Flip-flop and Registers

Laboratory 4. Figure 1: Serdes Transceiver

LATCHES & FLIP-FLOP. Chapter 7

Debugging of VHDL Hardware Designs on Altera s DE2 Boards

EET 1131 Lab #10 Latches and Flip-Flops

Lab 13: FPGA Circuit Realization Ian Callahan

Lab #11: Register Files

Chapter. Synchronous Sequential Circuits

Lab #12: 4-Bit Arithmetic Logic Unit (ALU)

Chapter 5 Sequential Circuits

RS flip-flop using NOR gate

Sequential Digital Design. Laboratory Manual. Experiment #3. Flip Flop Storage Elements

EMT 125 Digital Electronic Principles I CHAPTER 6 : FLIP-FLOP

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

Synchronous Sequential Logic

ELE2120 Digital Circuits and Systems. Tutorial Note 7

(CSC-3501) Lecture 7 (07 Feb 2008) Seung-Jong Park (Jay) CSC S.J. Park. Announcement

ASYNCHRONOUS COUNTER CIRCUITS

Unit 11. Latches and Flip-Flops

Other Flip-Flops. Lecture 27 1

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 220. Experiment 4 - Latches and Flip-Flops

Debugging of Verilog Hardware Designs on Altera s DE-Series Boards. 1 Introduction. For Quartus Prime 15.1

Digital Fundamentals. Lab 5 Latches & Flip-Flops CETT Name: Date:

RS flip-flop using NOR gate

Laboratory Exercise 4

Logic Design. Flip Flops, Registers and Counters

CPE 200L LABORATORY 3: SEQUENTIAL LOGIC CIRCUITS UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND: SR FLIP-FLOP/LATCH

Flip-Flops. Because of this the state of the latch may keep changing in circuits with feedback as long as the clock pulse remains active.

Lab #11: Register Files

Modeling Latches and Flip-flops

Ryerson University Department of Electrical and Computer Engineering COE/BME 328 Digital Systems

COE 202: Digital Logic Design Sequential Circuits Part 1. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Unit 9 Latches and Flip-Flops. Dept. of Electrical and Computer Eng., NCTU 1

Microprocessor Design

Rangkaian Sekuensial. Flip-flop

Engr354: Digital Logic Circuits

Electrical and Telecommunications Engineering Technology_TCET3122/TC520. NEW YORK CITY COLLEGE OF TECHNOLOGY The City University of New York

EECS150 - Digital Design Lecture 3 Synchronous Digital Systems Review. Announcements

Digital Logic Design ENEE x. Lecture 19

Feedback Sequential Circuits

Name Of The Experiment: Sequential circuit design Latch, Flip-flop and Registers

Elwin Cabrera May 11, 2016 DIGITAL CLOCK. ECE271/CSC222 Final Project Report

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

ECE 341. Lecture # 2

CHAPTER 11 LATCHES AND FLIP-FLOPS

Design and Simulation of a Digital CMOS Synchronous 4-bit Up-Counter with Set and Reset

CprE 281: Digital Logic

Digital Logic. ECE 206, Fall 2001: Lab 1. Learning Objectives. The Logic Simulator

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

Chapter 5 Synchronous Sequential Logic

CprE 281: Digital Logic

CHAPTER 1 LATCHES & FLIP-FLOPS

Asynchronous (Ripple) Counters

COMP2611: Computer Organization Building Sequential Logics with Logisim

Sequential Design Basics

EKT 121/4 ELEKTRONIK DIGIT 1

D Latch (Transparent Latch)

Modeling Latches and Flip-flops

Synchronous Sequential Logic

EE 109 Homework 6 State Machine Design Name: Score:

Sequential Logic Circuits

Lecture 8: Sequential Logic

Problems with D-Latch

Chapter 8 Sequential Circuits

A clock is a free-running signal with a cycle time. A clock may be either high or low, and alternates between the two states.

2.6 Reset Design Strategy

ECE 3401 Lecture 11. Sequential Circuits

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

10.1 Sequential logic circuits are a type of logic circuit where the output of the circuit depends not only on

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science SOLUTIONS

ELCT201: DIGITAL LOGIC DESIGN

Sequential Digital Design. Laboratory Manual. Experiment #7. Counters

Lecture 10: Programmable Logic

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Experiment 8 Introduction to Latches and Flip-Flops and registers

COMP2611: Computer Organization. Introduction to Digital Logic

CHAPTER 4 RESULTS & DISCUSSION

ELCT201: DIGITAL LOGIC DESIGN

Solar Power for Small Hall

Final Exam review: chapter 4 and 5. Supplement 3 and 4

CprE 281: Digital Logic

EE292: Fundamentals of ECE

Digital Circuits I and II Nov. 17, 1999

Digital Electronics II 2016 Imperial College London Page 1 of 8

CS 261 Fall Mike Lam, Professor. Sequential Circuits

CSE 352 Laboratory Assignment 3

CprE 281: Digital Logic

FPGA TechNote: Asynchronous signals and Metastability

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

INTRODUCTION TO SEQUENTIAL CIRCUITS

Transcription:

Laboratory Exercise 3 Latches, Flip-flops, and egisters The purpose of this exercise is to investigate latches, flip-flops, and registers. Part I Altera FPGAs include flip-flops that are available for implementing a user s circuit. We will show how to make use of these flip-flops in Parts IV to VII of this exercise. But first we will show how storage elements can be created in an FPGA without using its dedicated flip-flops. Figure 1 depicts a gated latch circuit. A style of VHL code that uses logic expressions to describe this circuit is given in Figure 2. If this latch is implemented in an FPGA that has 4-input lookup tables (LUTs), then only one lookup table is needed, as shown in Figure 3a. _g _g Figure 1. A gated latch circuit. - - A gated latch desribed the hard way LIBAY ieee; UE ieee.std_logic_1164.all; ENTITY part1 I POT (,, : IN T_LOGIC; : OUT T_LOGIC); EN part1; ACHITECTUE tructural OF part1 I IGNAL _g, _g, a, : T_LOGIC ; ATTIBUTE keep : boolean; ATTIBUTE keep of _g, _g, a, : IGNAL I true; _g <= AN ; _g <= AN ; a <= NOT (_g O ); <= NOT (_g O a); <= a; EN tructural; Figure 2. pecifying the latch by using logic expressions. 1

Although the latch can be correctly realized in one 4-input LUT, this implementation does not allow its internal signals, such as _g and _g, to be observed, because they are not provided as outputs from the LUT. To preserve these internal signals in the implemented circuit, it is necessary to include a compiler directive in the code. In Figure 2 the directive keep is included by using a VHL ATTIBUTE statement; it instructs the uartus II compiler to use separate logic elements for each of the signals _g, _g,a, and. Compiling the code produces the circuit with four s depicted in Figure 3b. (a) Using one 4-input lookup table for the latch. _g _g (b) Using four 4-input lookup tables for the latch. Figure 3. Implementation of the latch from Figure 1. Create a uartus II project for the latch circuit as follows: 1. Create a new project for the latch. elect as the target chip the Cyclone II EP2C35F672C6, which is the FPGA chip on the Altera E2 board. 2. Generate a VHL file with the code in Figure 2 and include it in the project. 3. Compile the code. Use the uartus II TL Viewer tool to examine the gate-level circuit produced from the code, and use the Technology Viewer tool to verify that the latch is implemented as shown in Figure 3b. 4. Create a Vector Waveform File (.vwf) which specifies the inputs and outputs of the circuit. raw waveforms for the and inputs and use the uartus II imulator to produce the corresponding waveforms for _g, _g,a, and. Verify that the latch works as expected using both functional and timing simulation. Part II Figure 4 shows the circuit for a gated latch. 2

_g _g Figure 4. Circuit for a gated latch. Perform the following steps: 1. Create a new uartus II project. Generate a VHL file using the style of code in Figure 2 for the gated latch. Use the keep directive to ensure that separate logic elements are used to implement the signals, _g, _g,a, and. 2. elect as the target chip the Cyclone II EP2C35F672C6 and compile the code. Use the Technology Viewer tool to examine the implemented circuit. 3. Verify that the latch works properly for all input conditions by using functional simulation. Examine the timing characteristics of the circuit by using timing simulation. 4. Create a new uartus II project which will be used for implementation of the gated latch on the E2 board. This project should consist of a top-level entity that contains the appropriate input and output ports (pins) for the E2 board. Instantiate your latch in this top-level entity. Use switch W 0 to drive the input of the latch, and use W 1 as the input. Connect the output to LE 0. 5. ecompile your project and download the compiled circuit onto the E2 board. 6. Test the functionality of your circuit by toggling the and switches and observing the output. Part III Figure 5 shows the circuit for a master-slave flip-flop. Master lave m s Figure 5. Circuit for a master-slave flip-flop. Perform the following: 1. Create a new uartus II project. Generate a VHL file that instantiates two copies of your gated latch entity from Part II to implement the master-slave flip-flop. 3

2. Include in your project the appropriate input and output ports for the Altera E2 board. Use switch W 0 to drive the input of the flip-flop, and use W 1 as the input. Connect the output to LE 0. 3. Compile your project. 4. Use the Technology Viewer to examine the flip-flop circuit, and use simulation to verify its correct operation. 5. ownload the circuit onto the E2 board and test its functionality by toggling the and switches and observing the output. Part IV Figure 6 shows a circuit with three different storage elements: a gated latch, a positive-edge triggered flipflop, and a negative-edge triggered flip-flop. a a b b c c (a) Circuit a b c (b) Timing diagram Figure 6. Circuit and waveforms for Part IV. 4

Implement and simulate this circuit using uartus II software as follows: 1. Create a new project. 2. Write a VHL file that instantiates the three storage elements. For this part you should no longer use the keep directive (that is, the VHL ATTIBUTE statement) from Parts I to III. Figure 7 gives a behavioral style of VHL code that specifies the gated latch in Figure 4. This latch can be implemented in one 4-input lookup table. Use a similar style of code to specify the flip-flops in Figure 6. 3. Compile your code and use the Technology Viewer to examine the implemented circuit. Verify that the latch uses one lookup table and that the flip-flops are implemented using the flip-flops provided in the target FPGA. 4. Create a Vector Waveform File (.vwf) which specifies the inputs and outputs of the circuit. raw the inputs and as indicated in Figure 6. Use functional simulation to obtain the three output signals. Observe the different behavior of the three storage elements. LIBAY ieee ; UE ieee.std_logic_1164.all ; ENTITY latch I POT (, : IN T_LOGIC ; : OUT T_LOGIC) ; EN latch ; ACHITECTUE Behavior OF latch I POCE (, ) IF = 1 THEN <=; EN IF ; EN POCE ; EN Behavior ; Figure 7. A behavioral style of VHL code that specifies a gated latch. Part V We wish to display the hexadecimal value of a 16-bit number A on the four 7-segment displays, HEX7 4. We also wish to display the hex value of a 16-bit number B on the four 7-segment displays, HEX3 0. The values of A and B are inputs to the circuit which are provided by means of switches W 15 0. This is to be done by first setting the switches to the value of A and then setting the switches to the value of B; therefore, the value of A must be stored in the circuit. 1. Create a new uartus II project which will be used to implement the desired circuit on the Altera E2 board. 2. Write a VHL file that provides the necessary functionality. Use KEY 0 as an active-low asynchronous reset, and use KEY 1 as a clock input. Include the VHL file in your project and compile the circuit. 3. Assign the pins on the FPGA to connect to the switches and 7-segment displays, as indicated in the User Manual for the E2 board. 4. ecompile the circuit and download it into the FPGA chip. 5. Test the functionality of your design by toggling the switches and observing the output displays. Copyright c 2006 Altera Corporation. 5