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

Similar documents
Other Flip-Flops. Lecture 27 1

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

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

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

Lecture 8: Sequential Logic

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

CHAPTER 4: Logic Circuits

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.

SEQUENTIAL LOGIC. Satish Chandra Assistant Professor Department of Physics P P N College, Kanpur

Asynchronous (Ripple) Counters

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) LATCHES and FLIP-FLOPS

Chapter 4. Logic Design

Digital Circuits ECS 371

CHAPTER 4: Logic Circuits

Logic Design. Flip Flops, Registers and Counters

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

ELCT201: DIGITAL LOGIC DESIGN

Flip-Flops and Sequential Circuit Design

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

RS flip-flop using NOR gate

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

ASYNCHRONOUS COUNTER CIRCUITS

Experiment 8 Introduction to Latches and Flip-Flops and registers

LAB #4 SEQUENTIAL LOGIC CIRCUIT

Unit 11. Latches and Flip-Flops

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

LATCHES & FLIP-FLOP. Chapter 7

EET2411 DIGITAL ELECTRONICS

Rangkaian Sekuensial. Flip-flop

ECE 341. Lecture # 2

Department of Electrical and Computer Engineering Mid-Term Examination Winter 2012

Digital Networks and Systems Laboratory 2 Basic Digital Building Blocks Time 4 hours

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

Sequential Logic and Clocked Circuits

RS flip-flop using NOR gate

MODULE 3. Combinational & Sequential logic

D Latch (Transparent Latch)

(Refer Slide Time: 2:05)

Engr354: Digital Logic Circuits

ELCT201: DIGITAL LOGIC DESIGN

Synchronous Sequential Logic

Review of Flip-Flop. Divya Aggarwal. Student, Department of Physics and Astro-Physics, University of Delhi, New Delhi. their state.

Sequential Circuits: Latches & Flip-Flops

CHAPTER 1 LATCHES & FLIP-FLOPS

INTRODUCTION TO SEQUENTIAL CIRCUITS

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

Chapter. Synchronous Sequential Circuits

AIM: To study and verify the truth table of logic gates

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

Digital Fundamentals: A Systems Approach

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Sequential Circuits

Sequential Design Basics

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Sequential Circuits

Chapter 5 Sequential Circuits

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

Chapter 2. Digital Circuits

Sri Vidya College of Engineering And Technology. Virudhunagar Department of Electrical and Electronics Engineering

B. Sc. III Semester (Electronics) - ( ) Digital Electronics-II) BE-301 MODEL ANSWER (AS-2791)

Introduction to Microprocessor & Digital Logic

Chapter 11 Latches and Flip-Flops

Introduction. NAND Gate Latch. Digital Logic Design 1 FLIP-FLOP. Digital Logic Design 1

CSE115: Digital Design Lecture 23: Latches & Flip-Flops

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

(Refer Slide Time: 2:00)

CSE 352 Laboratory Assignment 3

Vignana Bharathi Institute of Technology UNIT 4 DLD

Sequential Logic Basics

Chapter 5 Flip-Flops and Related Devices

Sequential Logic Circuits

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

COMP sequential logic 1 Jan. 25, 2016

Solution to Digital Logic )What is the magnitude comparator? Design a logic circuit for 4 bit magnitude comparator and explain it,

Exercise 2: D-Type Flip-Flop

Figure 30.1a Timing diagram of the divide by 60 minutes/seconds counter

Chapter 8 Sequential Circuits

UNIT-3: SEQUENTIAL LOGIC CIRCUITS

UNIT IV. Sequential circuit

Introduction to Sequential Circuits

Modeling Latches and Flip-flops

Counter dan Register

Part 4: Introduction to Sequential Logic. Basic Sequential structure. Positive-edge-triggered D flip-flop. Flip-flops classified by inputs

Counters

CSE Latches and Flip-flops Dr. Izadi. NOR gate property: A B Z Cross coupled NOR gates: S M S R Q M

The outputs are formed by a combinational logic function of the inputs to the circuit or the values stored in the flip-flops (or both).

cascading flip-flops for proper operation clock skew Hardware description languages and sequential logic

EE292: Fundamentals of ECE

Logic Gates, Timers, Flip-Flops & Counters. Subhasish Chandra Assistant Professor Department of Physics Institute of Forensic Science, Nagpur

3 Flip-Flops. The latch is a logic block that has 2 stable states (0) or (1). The RS latch can be forced to hold a 1 when the Set line is asserted.

Multiplexor (aka MUX) An example, yet VERY useful circuit!

EKT 121/4 ELEKTRONIK DIGIT 1

Synchronous Sequential Logic

WINTER 15 EXAMINATION Model Answer

Module -5 Sequential Logic Design

CPS311 Lecture: Sequential Circuits

The basic logic gates are the inverter (or NOT gate), the AND gate, the OR gate and the exclusive-or gate (XOR). If you put an inverter in front of

IT T35 Digital system desigm y - ii /s - iii

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.

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) COUNTERS

Logic Design Viva Question Bank Compiled By Channveer Patil

REPEAT EXAMINATIONS 2002

Transcription:

DLHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 0 Experiment - Latches and Flip-Flops Objectives:. To implement an RS latch memory element. To implement a JK flip-flop. To implement a T flip-flop from a JK flip-flop. To implement a simple counter Theory: The ability to store information is essential in computing. Memory elements are used to store program information such as the results of calculations or user input. The information can later be read back from the memory elements to be used for new calculations or to display to the user. Remember in Lab two how we constructed addition and subtraction circuits. The circuits only allowed two numbers to be added together at a time. What if you only had one dder circuit, but needed to add three numbers together? Using a memory element, you can use the same adder circuit to add all three numbers together in two steps. In step one (Fig. below) you (the user) input your first and second numbers (ugend and ddend) into the adder circuit and get the result (sum). The result is then stored in some memory circuitry. In the second step (Fig. ) the adder circuit gets the result from the memory circuitry and uses it as the new ugend. You as the user input the third number as the new ddend. These numbers go through your adder circuit, and you receive your final result, which is the sum of all three numbers. Pocket calculators work somewhat like this when you are using them to perform long calculations.

In this lab we will be examining some basic memory elements, called latches and flip-flops. These are circuits that can perform memory storage operations, and have a few other tricks to them that are useful in timing or counting. The timing and counting functions of latches and flipflops will be examined in Lab #, but here we will just concentrate on their basic design and operation. Procedure: Part ) RS Latch The RS latch is the basic memory element. Most of the other latches and flip-flops are derived from the RS latch. Two versions of the latch circuit are shown in the first schematic, Sheet #. The RS latch can be constructed with either NND gates or NOR gates. Both versions are shown on your sheet. Notice that the output of each gate is wired to one of the inputs of the other. This is called feedback because the output is fed back to the input. The circuits are designed so that X and X are the output Q. X and X should always be the inverse of Q, called Q NOT. The RS latch has three functions it will perform on output Q. They are Set (S), Reset (R), and Hold. When the Set state is asserted, Q is and Q NOT is 0. When the Reset state is asserted Q is 0 and Q NOT is. When neither set or reset are asserted then the latch is automatically in the Hold state. While in hold mode, the latch simply keeps Q and Q NOT at whatever value they last were. The two input switches on each latch will trigger the Set (S) and Reset (R) functions. The two designs you have been given activate their set and reset functions differently. For one design you have to close a switch to assert its function (active high), and for the other you have to open the switch to assert its function (active low). For instance to activate the Set function in the active high design, close the Set switch. This sends a set signal through the logic and latches output Q to. If you then open the Set switch back up, Q should stay at and the device has entered the hold state. It is up to you to determine which switch is Set and which is Reset in each design, and which design is active high, and which is active low. a) Construct the circuits shown on the schematic, implement them using the digital board. b) Which switch is Set and which is Reset for each circuit, and which is active high and which is active low? c) What happens to Q and Q NOT when you assert Set and Reset at the same time? (E.g. for the active high design, you close both the Set and Reset switches at the same time) d) Construct a state transition table for each design. (See the end of the lab for an explanation of the state transition table and how to make one) The RS Latch allows us to remember a single bit. By activating the set function we make the output Q go high (or ). If we then deactivate the set function the latch enters the hold state and keeps the output in its high state. The output Q will only go low if the reset function is activated. So, until the latch is reset, it remembers (or latches ) a binary for us. If we want to store a binary number, we would use an RS latch for each bit. For instance to store the nibble 00 we would need four latches. Latch # and # would have Set asserted, and # and # would have Reset asserted. The latches would then be put into the hold state by de-asserting the Set and Reset functions. This stores (latches) our binary number in the four RS latches. To clear it we would just send a reset command to all four latches at once.

Part. JK Flip-Flop One problem with the RS latch is that when both Set and Reset are asserted at the same time both outputs become equal ( Q Q 0 ), which is an unwanted state. One solution to this is to add a pair of ND gates to the input to ensure that Set and Reset cannot receive an assert signal at the same time. The JK Flip-Flop schematic, found in Sheet #, shows this configuration. Since Q and Q are (theoretically) never the same, it guarantees that only one of the ND gates will be activated at a time. Note: t least one of the asynchronous inputs CLR (clear) or PR (preset) needs to be asserted to make Q Q when the circuit is initialized. Feeding Q and Q NOT back to the inputs through the two ND gates causes another interesting effect: toggling. Toggling is when the output Q flips back and forth from to 0. This occurs whenever the inputs are both asserted at the same time. (This is why the device is called a flip-flop ) For instance when the inputs to the ND gates (called J and K ) are both set to, and Q is (so Q NOT is 0 ) then the RS latch sees R =, S = 0. This resets the latch, changing Q to 0 and Q NOT to. These outputs are brought back around to the input (feedback), which swaps the activation state of the two ND gates. Now the RS latch sees R = 0, S =. This sets the latch, changing Q back to and Q NOT to 0. These are fed back to the inputs, and the cycle begins again. So, when inputs J and K are both high, we get toggling. a) Construct the basic JK flip-flop with asynchronous PR & CLR inputs as shown in diagram Sheet #, and implement it on the digital explorer board. b) fter initializing the flip-flop by asserting one of the asynchronous inputs, verify that: i. The Set & Reset states set by the J & K inputs work properly by making J or K (one at a time), ii. The outputs Q and Q never become equal unless you assert both asynchronous inputs simultaneously. iii. If the Set & Reset inputs to the RS latch (determined by J & K when both PR & CLR are de-asserted) are set to simultaneously the outputs Q and Q toggle indefinitely. The problem with the previous design is that it toggles continuously as long as J and K are. We would like a design that only toggles once, then stops toggling. This would let us get the complement of a bit stored in the latch. If we had four JK flip-flops, we could use the set and reset functions to latch a bit onto each one. For example, setting latch,, and, and resetting latch would store the binary nibble 0. If we then sent a toggle command to all four latches (by asserting J and K at the same time), all the bits would change state (toggle), giving us the compliment of the number: 000. If the latches continued to toggle then the output would keep changing from 0 to 000, which isn t very useful. To make a device that only toggles once, two latches are cascaded creating a Master/Slave JK Flip-Flop. The schematic for this is on the next page, Sheet #. Notice that it consists of two basic JK flip-flops with yet another pair of ND gates on the front and a single Inverter. The design uses three switches: J, K, and Clk. The Clk switch is called the Clock line

and (with the extra ND gates and inverter) it prevents the uncontrolled toggling seen in the basic JK flip-flop. a) Construct the Master-Slave JK flip-flop as shown on the schematic, and implement it on the digital explorer board. b) Construct a state transition table for the circuit. c) Inputs J and K do the same things as R and S. That is, one line triggers the set function and the other triggers the reset function. Which is which? d) How does the Master-Slave configuration prevent the circuit from continuously toggling the way the normal JK flip-flop does? Hint: Look at the way the inputs J and K propagate from gate to gate as the Clk line goes from to 0 and back to Part. T flip-flop from JK flip-flop The toggling function of the JK flip-flop is useful enough that versions of it are made that do nothing but toggle. These are called T flip-flops (the T stands for toggle). The T flip-flop is basically a Master-Slave JK flip-flop with J and K tied together. This time we will use a JK flip-flop from Xilinx library and use it to construct a T flip-flop. a) Select component FJKCP from Xilinx Flip_Flop category. Wire J and K straight to Vcc, forcing the JK flip-flop into toggle mode. Connect C to switch (SW), PRE to switch (SW), and CLR to switch (SW). b) Implement the T flip-flop on the digital explorer board. c) Construct the state transition table for the T flip-flop. d) What is switch connected to? Hint: refer to Master-Slave schematic from part e) What do switch and switch do? Part. simple counter We will use a simple D flip-flop, and an adder circuit to create a simple counter. Note the 7- segment display will be used again. This time it will output a hexadecimal code, so valid values are 0-9,-F. The schematic of requires five components. Draw the schematic as given, provided that: a. FDRE is found in the Flip_Flop category b. DD is found in the rithmetic category c. BinarySevenSeg is found in the first category. Do not use BCDSevenSeg, be sure to use BinarySevenSeg this time. d. VCC is found in General e. GND is found in General a) Construct the circuit shown in the attached schematic. Implement it. b) Play with switches SW & SW, what does changing the setting of the switches do to the count sequence you observe?

State Transition Tables: State Transition Tables are truth tables that show how a circuit s outputs change over time. Basic truth tables are good for showing the behavior of any circuit that is not clocked; the circuit is time independent. For instance an ND gate has no clock line so the inputs immediately affect the output. circuit that is clocked, such as the Master-Slave JK flipflop will not change its output until the circuit has received a complete clock pulse on the CLK line. The inputs can be changed but no reaction will be observed on the outputs until the clock has been triggered. Because of this dependence on the clock line, State Transition tables show the before and after states of the outputs. For example, say we have a JK flipflop with Q =, J = 0, K =. This setting should reset Q to zero once CLK receives a pulse. The output Q will remain at until the pulse is received. Shown in a table we have: J K Q Q+ 0 0 This shows the affect of the inputs on the output when the output is already. This is one line of the State Transition table for the JK flip-flop. J and K show the states of the inputs. Q shows the output before the clock pulse, and Q+ shows the output after the clock pulse. To complete the table you would give all possible inputs and output combinations. For instance the next line might look like: J K Q Q+ 0 0 0 This line would show how the inputs affect the output when the output starts as a 0. Since these circuits incorporate feedback, it is important to note that previous output state often affects the next output state. In effect, the output Q is like an input for Q+. full State Transition table should contain all the different input and output combinations. Looking at the table you create should give you all the information you need to answer most of the questions in the lab.

0 7 V CLR J-K Flip-Flop (Sheet ) B V Key = C UB 70N U Q. V B J UB C Key = 7LSN 77N C Q_ V. V D E K Key = B U 7LSN UB 77N D E V PR U 70N F F Key = D G Title: JKflipflop G ECED00, Lab, Part, Basic JK Flip-flop w/ asynch inputs Designed by: gonzalez Document N 000 Revision.0 Checked by: Date Oct 9, 00 Size pproved by: Sheet of 0 7

0 7 Master-Slave JK Flip-Flop (Sheet ) V Q Q_ B. V. V B C J Key = J J U 70N 9 0 UC 70N U 70N U 70N 9 UC 70N 0 C D E Key = K J Key = C UB 70N UD 70N U UB 70N UB 70N UD 70N D E 70N F F G G Title: JK_MasterSlave Sheet, Lab, ECED00 - Digital CIrcuits Designed by: Document N 000 Revision.0 Checked by: Date Nov 09, 00 Size pproved by: Sheet of 0 7