Laboratory Exercise 3

Similar documents
7. Latches and Flip-Flops

Lesson 12 Sequential Circuits: Flip-Flops

Digital Fundamentals. Lab 8 Asynchronous Counter Applications

ECE380 Digital Logic

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors

Engr354: Digital Logic Circuits

Modeling Registers and Counters

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

Modeling Latches and Flip-flops

Finite State Machine Design A Vending Machine

Lab 1: Introduction to Xilinx ISE Tutorial

EXPERIMENT 8. Flip-Flops and Sequential Circuits

CHAPTER 11 LATCHES AND FLIP-FLOPS

DDS. 16-bit Direct Digital Synthesizer / Periodic waveform generator Rev Key Design Features. Block Diagram. Generic Parameters.

Quartus II Introduction for VHDL Users

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

Jianjian Song LogicWorks 4 Tutorials (5/15/03) Page 1 of 14

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

Quartus II Introduction Using VHDL Design

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus II 12.0

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

Theory of Logic Circuits. Laboratory manual. Exercise 3

EC313 - VHDL State Machine Example

Memory Elements. Combinational logic cannot remember

VHDL Test Bench Tutorial

The enable pin needs to be high for data to be fed to the outputs Q and Q bar.

Counters and Decoders

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

Digital Electronics Detailed Outline

Master/Slave Flip Flops

Using Altera MAX Series as Microcontroller I/O Expanders

Chapter 9 Latches, Flip-Flops, and Timers

BINARY CODED DECIMAL: B.C.D.

After opening the Programs> Xilinx ISE 8.1i > Project Navigator, you will come to this screen as start-up.

The 104 Duke_ACC Machine

Lab 1: Full Adder 0.0

VENDING MACHINE. ECE261 Project Proposal Presentaion. Members: ZHANG,Yulin CHEN, Zhe ZHANG,Yanni ZHANG,Yayuan

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

Figure 8-1 Four Possible Results of Adding Two Bits

Introduction to Digital Design Using Digilent FPGA Boards Block Diagram / Verilog Examples

MAX II ISP Update with I/O Control & Register Data Retention

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

earlier in the semester: The Full adder above adds two bits and the output is at the end. So if we do this eight times, we would have an 8-bit adder.

Using Xilinx ISE for VHDL Based Design

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

A Verilog HDL Test Bench Primer Application Note

Two's Complement Adder/Subtractor Lab L03

Active Learning in the Introduction to Digital Logic Design Laboratory Course

Gates, Plexers, Decoders, Registers, Addition and Comparison

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

ASYNCHRONOUS COUNTERS

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

Module 3: Floyd, Digital Fundamental

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

CHAPTER 11: Flip Flops

Lecture 8: Synchronous Digital Systems

PURDUE UNIVERSITY NORTH CENTRAL

Xilinx ISE. <Release Version: 10.1i> Tutorial. Department of Electrical and Computer Engineering State University of New York New Paltz

Multiplexers Two Types + Verilog

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

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

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

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

Upon completion of unit 1.1, students will be able to

Napier University. School of Engineering. Electronic Engineering A Module: SE42205 Digital Design

VHDL GUIDELINES FOR SYNTHESIS

So far we have investigated combinational logic for which the output of the logic devices/circuits depends only on the present state of the inputs.

TRILOGI 5.3 PLC Ladder Diagram Programmer and Simulator. A tutorial prepared for IE 575 by Dr. T.C. Chang. Use On-Line Help

DEPARTMENT OF INFORMATION TECHNLOGY

Academic year: 2015/2016 Code: IES s ECTS credits: 6. Field of study: Electronics and Telecommunications Specialty: -

Physics 226 FPGA Lab #1 SP Wakely. Terasic DE0 Board. Getting Started

Sequential Logic Design Principles.Latches and Flip-Flops

Asynchronous counters, except for the first block, work independently from a system clock.

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

9/14/ :38

8051 MICROCONTROLLER COURSE

Wiki Lab Book. This week is practice for wiki usage during the project.

Set-Reset (SR) Latch

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

LAB4: Audio Synthesizer

Traffic Light Controller. Digital Systems Design. Dr. Ted Shaneyfelt

Contents COUNTER. Unit III- Counters

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

2 : BISTABLES. In this Chapter, you will find out about bistables which are the fundamental building blocks of electronic counting circuits.

STEP 7 MICRO/WIN TUTORIAL. Step-1: How to open Step 7 Micro/WIN

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

FORDHAM UNIVERSITY CISC Dept. of Computer and Info. Science Spring, Lab 2. The Full-Adder

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Counters. Present State Next State A B A B

RUTGERS UNIVERSITY Department of Electrical and Computer Engineering 14:332:233 DIGITAL LOGIC DESIGN LABORATORY

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

ELEC EXPERIMENT 1 Basic Digital Logic Circuits

Chapter 13: Verification

LEVERAGING FPGA AND CPLD DIGITAL LOGIC TO IMPLEMENT ANALOG TO DIGITAL CONVERTERS

CS311 Lecture: Sequential Circuits

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

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

Combinational Logic Design Process

Binary Adders: Half Adders and Full Adders

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 Part IV 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 a () _g b 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, b : T_LOGIC ; ATTIBUTE KEEP : BOOLEAN; ATTIBUTE KEEP OF _g, _g, a, b : IGNAL I TUE; BEGIN _g <= AN ; _g <= AN ; a <= NOT (_g O b); b <= 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 to instruct the uartus II compiler to use separate logic elements for each of the signals _g, _g, a, and b. Compiling the code produces the circuit with four s depicted in Figure 3b. a () (a) Using one 4-input lookup table for the latch. _g a () _g b (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 uartus II project for your E-series 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 Map Viewer tool to verify that the latch is implemented as shown in Figure 3b. 4. imulate the behavior of your VHL code by using the simulation feature provided in the uartus II software. First, create a vector waveform file (*.vwf) using the uartus II software to specify the inputs and outputs of your circuit. Then, use the commands available in the uartus II imulation Waveform Editor tool to run a simulation of the circuit. The procedure for using the imulation Waveform Editor to perform a simulation is described in the tutorial uartus II Introduction, available on the Altera University Program website (more detailed instructions are provided in the tutorial Introduction to uartus II imulation). An example of a vector waveform file is displayed in Figure 4. The waveforms in the figure begin by setting = 1 and = 1, which allows the simulation tool to initialize all of the signals inside of the latch to known values. If the waveforms provided to the simulation tool do not allow for initialization of all signals in the circuit, then the simulation tool may exit with an error condition. 2

Figure 4: imulation waveforms for the latch. Part II Figure 5 shows the circuit for a gated latch. _g a () _g b Figure 5: 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 b. 2. Compile your project and then use the Technology Map 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 your Eseries board. This project should consist of a top-level module that contains the appropriate input and output ports (pins) for your board. Instantiate your latch in this top-level module. 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. Include the required pin assignments and then compile your project and download the compiled circuit onto your E-series board. 6. Test the functionality of your circuit by toggling the and switches and observing the output. 3

Part III Figure 6 shows the circuit for a master-slave flip-flop. Master lave m s Clock Figure 6: 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 module from Part II to implement the master-slave flip-flop. 2. Include in your project the appropriate input and output ports for your E-series board. Use switch W 0 to drive the input of the flip-flop, and use W 1 as the Clock input. Connect the output to LE 0. 3. Include the required pin assignments and then 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 your E-series board and test its functionality by toggling the and Clock switches and observing the output. 4

Part IV Figure 7 shows a circuit with three different storage elements: a gated latch, a positive-edge triggered flip-flop, and a negative-edge triggered flip-flop. a Clock a b b c c (a) Circuit Clock a b c (b) Timing diagram Figure 7: Circuit and waveforms for Part IV. Implement and simulate this circuit using the uartus II software as follows: 1. Create a new uartus II 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 8 gives a behavioral style of VHL code that specifies the gated latch in Figure 5. This latch can be implemented in one 4-input lookup table. Use a similar style of code to specify the flip-flops in Figure 7. 3. Compile your code and use the Technology Map 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. 5

4. Create a Vector Waveform File (.vwf) that specifies the inputs and outputs of the circuit. raw the inputs and Clock as indicated in Figure 7. 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 BEGIN POCE (, ) BEGIN IF = 1 THEN <= ; EN IF ; EN POCE ; EN Behavior ; Figure 8: A behavioral style of VHL code that specifies a gated latch. Part V We wish to display the hexadecimal value of an 8-bit number A on the two 7-segment displays HEX3 2. We also wish to display the hex value of an 8-bit number B on the two 7-segment displays HEX1 0. The values of A and B are inputs to the circuit which are provided by means of switches W 7 0. To input the values of A and B, first set the switches to the desired value of A, store these switch values in a register, and then change the switches to the desired value of B. Finally, use an adder to generate the arithmetic sum = A + B, and display this sum on the 7-segment displays HEX5 4. how the carry-out produced by the adder on LE(0). 1. Create a new uartus II project which will be used to implement the desired circuit on your E-series 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. 3. Include the necessary pin assignments for the pushbutton switches and 7-segment displays, and then compile the circuit. 4. ownload the circuit onto your E-series board and test its functionality by toggling the switches and observing the output displays. Copyright c 2015 Altera Corporation. 6