CPE 300L DIGITAL SYSTEM ARCHITECTURE AND DESIGN LABORATORY

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

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

EXPERIMENT 8. Flip-Flops and Sequential Circuits

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

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

Theory of Logic Circuits. Laboratory manual. Exercise 3

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

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

Modeling Registers and Counters

ECE380 Digital Logic

Lesson 12 Sequential Circuits: Flip-Flops

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

Flip-Flops and Sequential Circuit Design

CHAPTER 11 LATCHES AND FLIP-FLOPS

ENEE 244 (01**). Spring Homework 5. Due back in class on Friday, April 28.

Engr354: Digital Logic Circuits

Counters and Decoders

Multiplexers Two Types + Verilog

Modeling Latches and Flip-flops

CS311 Lecture: Sequential Circuits

Module 3: Floyd, Digital Fundamental

SEQUENTIAL CIRCUITS. Block diagram. Flip Flop. S-R Flip Flop. Block Diagram. Circuit Diagram

Memory Elements. Combinational logic cannot remember

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

Digital Logic Design Sequential circuits

Sequential Logic: Clocks, Registers, etc.

ECE 451 Verilog Exercises. Sept 14, James Barnes

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

A Verilog HDL Test Bench Primer Application Note

CHAPTER 11: Flip Flops

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

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

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

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

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

Asynchronous Counters. Asynchronous Counters

Master/Slave Flip Flops

Digital Design Verification

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

Sequential Logic Design Principles.Latches and Flip-Flops

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

A New Paradigm for Synchronous State Machine Design in Verilog

Chapter 5. Sequential Logic

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

Lecture 8: Synchronous Digital Systems

ASYNCHRONOUS COUNTERS

Upon completion of unit 1.1, students will be able to

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

CHAPTER 3 Boolean Algebra and Digital Logic

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

DEPARTMENT OF INFORMATION TECHNLOGY

Flip-Flops, Registers, Counters, and a Simple Processor

Chapter 9 Latches, Flip-Flops, and Timers

BINARY CODED DECIMAL: B.C.D.

Combinational Logic Design Process

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

7. Latches and Flip-Flops

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

Digital Electronics Detailed Outline

Verilog: Blocks

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

Digital Circuit Design Using Xilinx ISE Tools

Finite State Machine Design and VHDL Coding Techniques

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Registers & Counters

Getting the Most Out of Synthesis

Gates, Circuits, and Boolean Algebra

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

An Integer Square Root Algorithm

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

List of Experiment. 8. To study and verify the BCD to Seven Segments DECODER.(IC-7447).

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

Chapter 8. Sequential Circuits for Registers and Counters

Design and Implementation of Vending Machine using Verilog HDL

State Machines in VHDL

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

Chapter 2 Ensuring RTL Intent

VHDL GUIDELINES FOR SYNTHESIS

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

Lecture 7: Clocking of VLSI Systems

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

Finite State Machine Design A Vending Machine

Set-Reset (SR) Latch

Contents COUNTER. Unit III- Counters

PURDUE UNIVERSITY NORTH CENTRAL

Philadelphia University Faculty of Information Technology Department of Computer Science Semester, 2007/2008.

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

Active Learning in the Introduction to Digital Logic Design Laboratory Course

Chapter 13: Verification

Lab 1: Study of Gates & Flip-flops

Counters & Shift Registers Chapter 8 of R.P Jain

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

Chapter 7: Advanced Modeling Techniques

An Extension to DNA Based Fredkin Gate Circuits: Design of Reversible Sequential Circuits using Fredkin Gates

Digital Systems Laboratory

Latch Timing Parameters. Flip-flop Timing Parameters. Typical Clock System. Clocking Overhead

Lab 1: Introduction to Xilinx ISE Tutorial

E158 Intro to CMOS VLSI Design. Alarm Clock

Lecture-3 MEMORY: Development of Memory:

Transcription:

CPE 300L DIGITAL SYSTEM ARCHITECTURE AND DESIGN LABORATORY LABORATORY 2 SEQUENTIAL CIRCUIT DESIGN DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING UNIVERSITY OF NEVADA, LAS VEGAS OBJECTIVE Learn on various implementations of latches and flip-flops, Verilog models, synchronous and asynchronous operation and asynchronous system design. INTRODUCTION In this lab Altera Quartus II software is used to verify the correctness of the circuits modeled in the Verilog. Both structural models and models with component instantiations are used. Experiments are done for both synchronous and asynchronous cases. LAB DELIVERIES PRELAB 1. SR latch Write the structural Verilog codes for SR latch on NOR gates. Use a) gate logic level model and b) instances of Verilog gates. Examples for 3-input AND: a) assign y = a & b & c b) and3 andgate(a, b, c, y) Do the simulation in Quartus and get the waveform. Put the codes and waveforms in the prelab document. 2. Implementation of SR latch: Structural Verilog Models Analyze the Verilog code implementing the gated SR latch (Fig. 1). DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 1

// A gated RS latch module part1 (Clk, R, S, Q); input Clk, R, S; output Q; wire R_g, S_g, Qa, Qb; /* synthesis keep */ assign R_g = R & Clk; assign S_g = S & Clk; assign Qa = (R_g Qb); assign Qb = (S_g Qa); assign Q = Qa; Figure 1. Gated SR latch a) with component instantiation b) structural model Fig. 2. Verilog code for SR latch // A gated RS latch module part1 (Clk, R, S, Q); input Clk, R, S; output Q; wire R_g, S_g, Qa, Qb; /* synthesis keep */ and (R_g, R, Clk); and (S_g, S, Clk); nor (Qa, R_g, Qb); nor (Qb, S_g, Qa); assign Q = Qa; Implement both a) and b) codes and get waveforms. What is the difference between these two codes? 3. Enabled D latch 1. Generate a Verilog file using the style of code in Figure 3 for the gated D latch. Use the synthesis keep directive to ensure that separate logic elements are used to implement the signals R, S_g, R_g, Qa, and Qb. Fig. 3.1. Gated D latch Fig. 3.2. Gated D latch with multiplexer For latches in Fig. 3.1. and Fig. 3.2. write structural codes, simulate the designs and verify its correctness by checking the waveforms. DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 2

4. Asynchronous set/clear Add asynchronous Set and Clear inputs to the design of Gated D latch, as shown in Fig. 4. Write the structural Verilog code. Fig. 4. Gated D latch with asynchronous inputs Simulate the Verilog code for the design to get the waveforms. Verify correctness of the design in the waveforms, make sure that all the cases are tested, including both synchronous and asynchronous signals. Prelab part Delivery 1 a. Waveform b. Verilog code 2 c. Waveform for code 2.a) SR latch with component instantiation d. Waveform for code 2.b) SR latch structural model 3 a. Verilog code and waveform for 3.1 Gated D latch b. Verilog code and waveform for 3.2 Gated D latch with multiplexer 4 a. Verilog code and waveform DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 3

LAB EXPERIMENTS 1. D flip-flop 1.1. Master-Slave D flip-flop Write a structural code for Master-Slave D flip-flop in Fig. 5.1 using Fig. 5.2 latches for Master and Slave construction. Fig. 5.1. D flip-flop with Master-Slave gated latches Fig. 5.2. Gated D latch Simulate the code, check the correctness using waveforms. Check the logic utilization and component count in the simulation report (Total utilization, Combinational ALUTs, Dedicated logic registers). 1.2. 6-NAND D flip-flop Write a structural code for a smaller circuit of D flip-flop (6 NAND gates) in Fig. 6. Implement, check the correctness, and check the logic utilization and component count. Fig. 6. 6-NAND D flip-flop 1.3. 6-NAND D flip-flop with synchronous inputs Modify the circuit (structural Verilog model) from 1.2. to make the D latch with synchronous active low Set and Reset (sampled at Clock). DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 4

2. JK flip-flop construction Fig. 7. shows the Truth Table and JK circuit based on D flip-flop CPE 300L DIGITAL SYSTEM ARCHITECTURE AND DESIGN LABORATORY Fig. 7.1 JK flip-flop based on D Fig. 7. JK flip-flop Fig. 7.2. Truth table of JK flip-flop Implement three different Verilog models of JK flip provided below and verify the operation. Get waveforms for all the models. //#1 JK module JKFF (Q,QN,J,K,Clock); output Q, QN; // data output input J, K; // data input input Clock; reg Q; always @(posedge Clock) begin Q = J&(~Q) (~K)&Q; end assign QN = ~Q; //#2 JK module JKFF (Q,QN,J,K,Clock); output Q, QN; // data output input J, K; // data input input Clock; reg Q; always @(posedge Clock) begin if ({J,K} == 2'b01) Q = 1'b0; else if ({J,K} == 2'b10) Q = 1'b1; else if ({J,K} == 2'b11) Q = ~Q; else Q = Q; end assign QN = ~Q; // JK #3 module JKFF (Q,QN,J,K,Clock); output Q, QN; // data output input J, K; // data input input Clock; reg Q; always @(posedge Clock) begin case ({J,K}) 2'b01: Q = 1'b0; 2'b10: Q = 1'b1; 2'b11: Q = ~Q; default: Q = Q; endcase end assign QN = ~Q; DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 5

3. JK with synchronous clear Modify JK flip-flops from 2. to include synchronous ClearN. Draw the circuit and provide a behavioral model of your design. Synthesize, and verify the synthesized circuit in RTL viewer. 4. FSM Design Model the FSM machine defined as follows: PS NS Z X=0 X=1 X=0 X=1 S0 S1 S2 1 0 S1 S3 S4 1 0 S2 S4 S4 0 1 S3 S5 S5 0 1 S4 S5 S6 1 0 S5 S0 S0 0 1 S6 S0 1 Use always block to represent the combinational part of the circuit and generate the next state information and output. Use another always block to model the state register. 5. Asynchronous system design In a car security system, we usually want to connect the siren in such a way that the siren will activate when it is triggered by one or more sensors. In addition, there will be a master switch to turn the system on or off. Let us assume that there is a car door switch D, a vibration detector switch V, and the master switch M. We will use the convention that when the door is opened D = 1, otherwise, D = 0. Similarly, when the car is being shaken, V = 1, otherwise, V = 0. Thus, we want the siren S to turn on, that is, set S = 1, when either D = 1 or V = 1, or when both D = 1 and V = 1, but only for when the system is turned on, that is, when M = 1. However, we turn off the system, and either enter or drive the car, we do not want the siren to turn on. Hence, when M = 0, it does not matter what values D and V have, the siren should remain off. As a next step, what we really want is to have the siren remain on, even after both the door and vibration switches are off. In order to do so, we need to remember the state of the siren. In other words, for the siren to remain on, it should be dependent not only on whether the door or the vibration switch is on, but also on the fact that the siren is currently on. We can use the state of a SR latch to remember the state of the siren (i.e., the output of the latch will drive the siren). The state of the latch is driven by the conditions of the input switches. Design an asynchronous circuit for the car alarm system with the above requirements and use NAND based SR latch. Start with the truth Table, obtain the logic equation, simplify, and incorporate the latch. Write the structural Verilog Module and synthesize. Obtain the circuit (RTL viewer). Demonstrate the operation on the board. Instead of Siren sound use the LED output. DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 6

POSTLAB REPORT: Include the following elements in your postlab report: 1. Theory of operation a. Provide basic info about D and JK flip-flops b. Write few sentences: explain how waveforms are used to check the correctness of a circuit 2. Your prelab report include as a section 2 of the postlab 3. Results of the experiments Experiment Delivery 1.1 a. Verilog code and waveform b. Logic utilization and component count from the compilation report 1.2 a. Verilog code and waveform b. Logic utilization and component count from the compilation report 1.3 a. Verilog code and waveform 2 b. Waveforms for three JK models 3 a. Verilog codes and the waveforms for 3 JK flip-flops b. Circuits from RTL viewer for 3 JK flip-flops 4 a. The diagram of the FSM machine b. Verilog code c. Simulation results 5 a. Truth table b. Equation for the asynchronous design c. Simplified equation d. Asynchronous design with the latch e. Structural Verilog code f. Circuit from RTL viewer 4. Answer the questions: a. What is the meaning of component count from the Quartus compilation report? b. What is the advantage of using asynchronous Set and Reset in case of D flip-flop? Give an example. c. Regarding Logic Utilization from the Quartus Compilation Report what are ALUT and Dedicated Logic Registers? 5. Conclusions a. Write down your conclusions, things learned, problems encountered during the lab and how they were solved, etc. DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING 7