Laboratory Exercise 3

Similar documents
Introduction to VHDL Design on Quartus II and DE2 Board

Laboratory Exercise 7

Laboratory 4 Design a Muti-bit Counter

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

Laboratory 4 Design a Muti-bit Counter and Programming a FPGA

Laboratory Exercise 8

QuartusII.doc 25/02/2005 Page 1

Laboratory Exercise 1

SignalTap II with Verilog Designs. 1 Introduction. For Quartus II 13.1

Field Programmable Gate Array

Tutorial 2 Implementing Circuits in Altera Devices

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

Logic Circuits II ECE 2411 Thursday 4:45pm-7:20pm. Lecture 3

QUARTUS II Altera Corporation

EECS150, Fall 2004, Midterm 1, Prof. Culler. Problem 1 (15 points) 1.a. Circle the gate-level circuits that DO NOT implement a Boolean AND function.

ENEE245 Digital Circuits and Systems Lab Manual

EE 231 Fall Lab 1: Introduction to Verilog HDL and Altera IDE

Laboratory Exercise 9

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

Laboratory Exercise 5

Nikhil Gupta. FPGA Challenge Takneek 2012

DE2 Board & Quartus II Software

Lab 6: Integrated the Decoder with Muti-bit Counter and Programming a FPGA

ENEE245 Digital Circuits and Systems Lab Manual

4DM4 Lab. #1 A: Introduction to VHDL and FPGAs B: An Unbuffered Crossbar Switch (posted Thursday, Sept 19, 2013)

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

Lab 2 EECE473 Computer Organization & Architecture University of Maine

problem maximum score 1 8pts 2 6pts 3 10pts 4 15pts 5 12pts 6 10pts 7 24pts 8 16pts 9 19pts Total 120pts

Laboratory Exercise 6

CET4805 Component and Subsystem Design II. EXPERIMENT # 5: Adders. Name: Date:

Readings: Storage unit. Can hold an n-bit value Composed of a group of n flip-flops. Each flip-flop stores 1 bit of information.

Lab #12: ArithmeticLogic Unit

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

Chapter 2 Getting Hands on Altera Quartus II Software

ENGN1640: Design of Computing Systems Topic 02: Design/Lab Foundations

problem maximum score 1 10pts 2 8pts 3 10pts 4 12pts 5 7pts 6 7pts 7 7pts 8 17pts 9 22pts total 100pts

Digital Design with FPGAs. By Neeraj Kulkarni

Using Library Modules in Verilog Designs

Using Library Modules in Verilog Designs. 1 Introduction. For Quartus II 13.0

ENGN1640: Design of Computing Systems Topic 02: Design/Lab Foundations

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

CPE 200L LABORATORY 4: INTRODUCTION TO DE2 BOARD UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND:

ECE 551: Digital System *

Verilog for High Performance

Chapter 5: Tasks, Functions, and UDPs

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

Sequential Logic Blocks

Verilog Hardware Description Language ROOM: B405

UNIVERSITI MALAYSIA PERLIS

ENGN1640: Design of Computing Systems Topic 02: Lab Foundations

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

Topics. Midterm Finish Chapter 7

Evolution of Implementation Technologies. ECE 4211/5211 Rapid Prototyping with FPGAs. Gate Array Technology (IBM s) Programmable Logic

Latch Based Design (1A) Young Won Lim 2/18/15

CSE P567 - Winter 2010 Lab 1 Introduction to FGPA CAD Tools

EE183 LAB TUTORIAL. Introduction. Projects. Design Entry

Modeling Sequential Circuits in Verilog

Verilog Sequential Logic. Verilog for Synthesis Rev C (module 3 and 4)

2 nd Year Laboratory. Experiment: FPGA Design with Verilog. Department of Electrical & Electronic Engineering. Imperial College London.

Laboratory Exercise 3 Comparative Analysis of Hardware and Emulation Forms of Signed 32-Bit Multiplication

Outline. EECS Components and Design Techniques for Digital Systems. Lec 11 Putting it all together Where are we now?

ECE 353 Lab 4. MIDI Receiver in Verilog. Professor Daniel Holcomb UMass Amherst Fall 2016

Laboratory Exercise 6

ENEE 245 Lab 1 Report Rubrics

Terasic DE0 Field Programmable Gate Array (FPGA) Development Board

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

ECE 4514 Digital Design II. Spring Lecture 15: FSM-based Control

! Program logic functions, interconnect using SRAM. ! Advantages: ! Re-programmable; ! dynamically reconfigurable; ! uses standard processes.

HDLs and SystemVerilog. Digital Computer Design

C A R L E T O N U N I V E R S I T Y. FINAL EXAMINATION April Duration: 3 Hours No. of Students: 108

NIOS CPU Based Embedded Computer System on Programmable Chip

CHAPTER 3 METHODOLOGY. 3.1 Analysis of the Conventional High Speed 8-bits x 8-bits Wallace Tree Multiplier

ECE 331 Digital System Design

VERILOG: FLIP-FLOPS AND REGISTERS

Addition of Unsigned Binary Numbers Using FPGA

University of California, Davis Department of Electrical and Computer Engineering. EEC180B DIGITAL SYSTEMS Spring Quarter 2018

Digital Integrated Circuits

ECE241 - Digital Systems. University of Toronto. Lab #2 - Fall Introduction Computer-Aided Design Software, the DE2 Board and Simple Logic

The QR code here provides a shortcut to go to the course webpage.

EMT1250 LABORATORY EXPERIMENT. EXPERIMENT # 10: Implementing Binary Adders. Name: Date:

Digital Design LU. Lab Exercise 1

N-input EX-NOR gate. N-output inverter. N-input NOR gate

ALTERA M9K EMBEDDED MEMORY BLOCKS

ENGN 1630: CPLD Simulation Fall ENGN 1630 Fall Simulating XC9572XLs on the ENGN1630 CPLD-II Board Using Xilinx ISim

Tutorial 3. Appendix D. D.1 Design Using Verilog Code. The Ripple-Carry Adder Code. Functional Simulation

Laboratory Exercise 6

One and a half hours. Section A is COMPULSORY

HANSABA COLLEGE OF ENGINEERING & TECHNOLOGY (098) SUBJECT: DIGITAL ELECTRONICS ( ) Assignment

register:a group of binary cells suitable for holding binary information flip-flops + gates

Engineering 1630 Fall Simulating XC9572XL s on the ENGN1630 CPLD-II Board

Lab 4: Register File and Memory 50 points Instructor: Yifeng Zhu Due: One week

Experiment 8 Introduction to VHDL

Tutorial on Quartus II Introduction Using Verilog Code

Lab 6 : Introduction to Verilog

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science

4. Configuring Cyclone II Devices

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

University of California, Davis Department of Electrical and Computer Engineering. Lab 1: Implementing Combinational Logic in the MAX10 FPGA

Computer Aided Design Basic Syntax Gate Level Modeling Behavioral Modeling. Verilog

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. Two styles of Verilog code that can be used to describe this circuit are given in Figure 2. Part a of the figure specifies the latch by instantiating logic gates, and part b uses logic expressions to create the same circuit. 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 module part1 (,,, ); input,, ; output ; wire _g, _g, a, b /* synthesis keep */ ; and (_g,, ); and (_g,, ); nor (a, _g, b); nor (b, _g, a); assign = a; endmodule Figure 2a. Instantiating logic gates for the latch. 1

// A gated latch module part1 (,,, ); input,, ; output ; wire _g, _g, a, b /* synthesis keep */ ; assign _g = & ; assign _g = & ; assign a = (_g b); assign b = (_g a); assign = a; endmodule Figure 2b. pecifying the latch by using logic expressions. 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 /* synthesis keep */ is included 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 project for the latch. elect as the target chip the Cyclone II EP2C35F672C6, which is the FPGA chip on the Altera E2 board. 2

2. Generate a Verilog file with the code in either part a or b of Figure 2 (both versions of the code should produce the same circuit) 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 b. Verify that the latch works as expected using both functional and timing simulation. Part II Figure 4 shows the circuit for a gated latch. _g a () _g b Figure 4. Circuit for a gated latch. Perform the following steps: 1. Create a new uartus II project. Generate a Verilog file using the style of code in Figure 2b for the gated latch. Use the /* synthesis keep */ directive to ensure that separate logic elements are used to implement the signals, _g, _g, a, and b. 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 module that contains the appropriate input and output ports (pins) for the E2 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. 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. 3

Part III Figure 5 shows the circuit for a master-slave flip-flop. Master lave m s Clock Figure 5. Circuit for a master-slave flip-flop. Perform the following: 1. Create a new uartus II project. Generate a Verilog 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 the Altera E2 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. 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 Clock 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. 4

a Clock a b b c c (a) Circuit Clock a b c (b) Timing diagram Figure 6. Circuit and waveforms for Part IV. Implement and simulate this circuit using uartus II software as follows: 1. Create a new uartus II project. 2. Write a Verilog file that instantiates the three storage elements. For this part you should no longer use the /* synthesis keep */ directive from Parts I to III. Figure 7 gives a behavioral style of Verilog 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 Clock as indicated in Figure 6. Use functional simulation to obtain the three output signals. Observe the different behavior of the three storage elements. 5

module _latch (,, ); input, ; output reg ; always @ (, ) if () =; endmodule Figure 7. A behavioral style of Verilog 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 Verilog 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 Verilog file in your project and compile the circuit. 4. 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. 5. ecompile the circuit and download it into the FPGA chip. 6. Test the functionality of your design by toggling the switches and observing the output displays. Copyright c 2006 Altera Corporation. 6