Sequential Circuits: Latches & Flip-Flops

Similar documents
Chapter. Synchronous Sequential 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.

Introduction to Sequential Circuits

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

Unit 11. Latches and Flip-Flops

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

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

Logic Design. Flip Flops, Registers and Counters

ELCT201: DIGITAL LOGIC DESIGN

D Latch (Transparent Latch)

ELCT201: DIGITAL LOGIC DESIGN

Other Flip-Flops. Lecture 27 1

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

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

Synchronous Sequential Logic

ECE 341. Lecture # 2

Experiment 8 Introduction to Latches and Flip-Flops and registers

Engr354: Digital Logic Circuits

Chapter 11 Latches and Flip-Flops

`COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

CHAPTER 4: Logic Circuits

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

ELE2120 Digital Circuits and Systems. Tutorial Note 7

DIGITAL CIRCUIT LOGIC UNIT 11: SEQUENTIAL CIRCUITS (LATCHES AND FLIP-FLOPS)

Combinational vs Sequential

Clocks. Sequential Logic. A clock is a free-running signal with a cycle time.

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

Switching Circuits & Logic Design

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

Chapter 5 Sequential Circuits

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

6. Sequential Logic Flip-Flops

Last time, we saw how latches can be used as memory in a circuit

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).

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.

CPS311 Lecture: Sequential Circuits

Sequential Design Basics

RS flip-flop using NOR gate

Digital Design, Kyung Hee Univ. Chapter 5. Synchronous Sequential Logic

CHAPTER 4: Logic Circuits

MC9211 Computer Organization

CH 11 Latches and Flip-Flops

INTRODUCTION TO SEQUENTIAL CIRCUITS

Chapter 5: Synchronous Sequential Logic

Asynchronous (Ripple) Counters

RS flip-flop using NOR gate

Chapter 8 Sequential Circuits

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

LATCHES & FLIP-FLOP. Chapter 7

CHAPTER1: Digital Logic Circuits

Lecture 8: Sequential Logic

Sequential Logic and Clocked Circuits

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

LAB #4 SEQUENTIAL LOGIC CIRCUIT

Chapter 5 Synchronous Sequential Logic

Slide Set 7. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

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

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

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

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

CHAPTER 1 LATCHES & FLIP-FLOPS

Synchronous Sequential Logic

Switching Circuits & Logic Design

Chapter 5 Sequential Circuits

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

Spring 2017 EE 3613: Computer Organization Chapter 5: The Processor: Datapath & Control - 1

CHAPTER 11 LATCHES AND FLIP-FLOPS

(Refer Slide Time: 2:00)

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

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

Lecture 7: Sequential Networks

Sequential Logic Circuits

EEE2135 Digital Logic Design Chapter 6. Latches/Flip-Flops and Registers/Counters 서강대학교 전자공학과

Chapter 4. Logic Design

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

UNIT-3: SEQUENTIAL LOGIC CIRCUITS

Latches, Flip-Flops, and Registers. Dr. Ouiem Bchir

UNIT IV. Sequential circuit

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

Synchronous Sequential Logic

Combinational / Sequential Logic

Rangkaian Sekuensial. Flip-flop

COSC 243. Sequential Logic. COSC 243 (Computer Architecture) Lecture 5 - Sequential Logic 1

Module 4:FLIP-FLOP. Quote of the day. Never think you are nothing, never think you are everything, but think you are something and achieve anything.

Chapter. Sequential Circuits

Digital Circuit And Logic Design I. Lecture 8

Digital Circuit And Logic Design I

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

Introduction to Microprocessor & Digital Logic

Synchronous Sequential Logic. Chapter 5

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

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

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

CMSC 313 Preview Slides

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

UNIT III. Combinational Circuit- Block Diagram. Sequential Circuit- Block Diagram

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

Flip Flop. S-R Flip Flop. Sequential Circuits. Block diagram. Prepared by:- Anwar Bari

Digital Logic Design ENEE x. Lecture 19

Digital Logic Design I

Transcription:

Sequential Circuits: Latches & Flip-Flops

Overview Storage Elements Latches SR, JK, D, and T Characteristic Tables, Characteristic Equations, Eecution Tables, and State Diagrams Standard Symbols Flip-Flops SR, JK, D, and T Characteristic Tables, Characteristic Equations, Eecution Tables, and State Diagrams Standard Symbols Design of Latches/Flip-Flops using a given Latch/Flip-Flop Implementing Latches using Logic Gates SR Latch Design using Logic Gates D Latch Design using Logic Gates Implementing Flip-Flops using Latches D Flip-Flop Design based on SR Latch and D Latch Fall 27 2

Storage Elements Sequential Circuits contain Storage Elements that keep the state of the circuit. Fall 27 n Combinational Circuit feed-back loop One storage element can store one bit of information. A one-bit storage element should have at least three properties: It should be able to hold a single bit, or (storage mode). You should be able to read the bit that was stored. You should be able to change the value. Since there s only a single bit, there are only two choices: Set the bit to Reset, or clear, the bit to. q Net state m Storage Elements q Present state 3

Storage Elements (cont.) Two types of storage elements are used in Sequential Circuits: Latches and Flip-Flops. Latches (SR, JK, D, T) Fall 27 General description of a latch: -bit storage device with several inputs (X) and an output (). Output is changed = f( X ) only when specific combinations occur at the inputs X; otherwise the output remains unchanged (storage mode). X : Flip-Flops (SR, JK, D, T) General description of a Flip-Flop: -bit storage device with several inputs (X), an output (), and a specific trigger input (). Output is changed = f( X ) on response of a pulse at the trigger input (on the rising or falling edge of the pulse). When a pulse is absent at input the output remains unchanged (storage mode). X : L FF 4

SR Latch Symbol S C R C Function Table S(t) R(t) (t) (t+)?? (t) Operation No change Reset Set Undefined No change Characteristic Table S(t) R(t) (t) (t+) Eecution Table (t) Fall 27 (t+) S(t) R(t) State Diagram Characteristic Equation S,R =,X R(t) S,R =, = = S(t) S,R =, (t) S,R = X, (t+) = S(t) + R(t) (t) 5

JK Latch Symbol J C K C Function Table J(t) K(t) (t) (t+) (t) Operation No change Reset Set Complement No change Characteristic Table J(t) K(t) (t) (t+) Eecution Table (t) Fall 27 (t+) J(t) K(t) J,K =,X State Diagram J,K =,X = = J,K = X, J,K = X, Characteristic Equation J(t) K(t) (t) (t+) = J(t) (t) +K(t) (t) 6

D Latch Symbol D C C Function Table D(t) (t) (t+) (t) Operation Propagate input D No change Characteristic Table D(t) (t) (t+) Eecution Table (t) (t+) D(t) State Diagram D = D = = = D = D = Characteristic Equation D(t) (t) (t+) = D(t) Fall 27 7

T Latch Symbol T C C Function Table T(t) (t) (t+) (t) Operation No change Complement No change Characteristic Table T(t) (t) (t+) Eecution Table (t) Fall 27 (t+) T(t) State Diagram Characteristic Equation T = T = = = T = T = (t) T(t) (t+) = T(t) (t) 8

Standard Symbols for Latches We have seen that a Latch can change state if there is an active level on the control input C. Logic- active level Latches: Latch can change state if C = Logic- Standard symbols for Logic- active level Latches: S J D T C C R K C C Logic- active level Latches: Latch can change state if C = Logic- Standard symbols for Logic- active level Latches: S J D T C C R K C C Fall 27 9

SR Flip-Flop Symbol S R - rising edge - or or falling edge Function Table S(t) R(t) (t) (t+)?? (t) Operation No change Reset Set Undefined No change Characteristic Table S(t) R(t) (t) (t+) Eecution Table (t) Fall 27 (t+) S(t) R(t) State Diagram Characteristic Equation S,R =,X R(t) S,R =, = = S(t) S,R =, (t) S,R = X, (t+) = S(t) + R(t) (t)

JK Flip-Flop Symbol J K - rising edge - or or falling edge Function Table J(t) K(t) (t) (t+) (t) Operation No change Reset Set Complement No change Characteristic Table J(t) K(t) (t) (t+) Eecution Table (t) Fall 27 (t+) J(t) K(t) J,K =,X State Diagram J,K =,X = = J,K = X, J,K = X, Characteristic Equation J(t) K(t) (t) (t+) = J(t) (t) +K(t) (t)

D Flip-Flop Symbol D - rising edge - or or falling edge Function Table D(t) (t) (t+) (t) Operation Propagate input D No change Characteristic Table D(t) (t) (t+) Eecution Table (t) (t+) D(t) State Diagram D = D = = = D = D = Characteristic Equation D(t) (t) (t+) = D(t) Fall 27 2

T Flip-Flop Symbol T - rising edge - or or falling edge Function Table T(t) (t) (t+) (t) Operation No change Complement No change Characteristic Table T(t) (t) (t+) Eecution Table (t) Fall 27 (t+) T(t) State Diagram Characteristic Equation T = T = = = T = T = (t) T(t) (t+) = T(t) (t) 3

Standard Symbols for Flip-Flops We have seen that a Flip-Flop can change state, only during a transition of the trigger input (Edge-Triggered). Rising-Edge Triggered Flip-Flops: Flip-Flop can change state only during -to- transition on Standard symbols for Rising-Edge triggered Flip-Flops: S J D T R K Falling-Edge Triggered Flip-Flops: Flip-Flop can change state only during -to- transition on Standard symbols for Falling-Edge triggered Flip-Flops : S J D T R K Fall 27 4

Asynchronous Set/Reset of Flip-Flops Many times it is desirable to asynchronously (i.e., independent of the clock) set or reset FFs. Asynchronous set is called direct set or Preset Asynchronous reset is called direct reset or Clear Eample: At power-up so that we can start from a known state. Eamples of Standard Graphics Symbols S S J S S D T S R R K R R R Fall 27 NOTE: n indicates that CKLn controls all inputs whose label starts with n. Hence, n does NOT control S and R (S and R have Logic- active level). 5

Asynchronous Set/Reset: Eample JK Flip-Flop with asynchronous set & reset. J K S R IEEE standard graphics symbol for JK-FF with direct set & reset S R Function Table J(t) K(t) (t) Independent of (t+) (t)? Operation No change Reset Set Complement No change Asynch. Preset Asynch. Clear Undefined NOTE: Characteristic Table, Characteristic Equation, Eecution Table, and State Diagram are the same as for the normal JK Flip-Flop (without direct set & reset). Fall 27 6

Fall 27 Latches & Flip-Flops The Latches are Level-triggered whereas the Flip- Flops are Edge-triggered. SR Latch and SR Flip-Flop have the same Characteristic Table, Characteristic Equation, Eecution Table, and State Diagram. The above is valid for the other pairs: JK Latch JK Flip-Flop, D Latch D Flip-Flop, T Latch T Flip-Flop. Given a Latch of type X (X is SR or JK or D or T), any other type of Latch can be designed using X. Given a Flip-Flop of type X (X is SR or JK or D or T), any other type of Flip-Flop can be designed using X. 7

Design Procedure The procedure to design Latches with a given Latch of type X is the same as the procedure to design Flip-Flops with a given Flip-Flop of type X. So, I will illustrate the design procedure for Flip-Flops. Given D Flip-Flop, design: SR Flip-Flop, JK Flip-Flop, and T Flip-Flop (see this lecture) Given SR Flip-Flop, design: D Flip-Flop (see this lecture) JK Flip-Flop, and T Flip-Flop (see homework 7) Given JK Flip-Flop, design: SR Flip-Flop, D Flip-Flop (see homework 7) T Flip-Flop (try at home) Given T Flip-Flop, design: SR Flip-Flop, JK Flip-Flop, and D Flip-Flop (try at home) Fall 27 8

SR Flip-Flop with D Flip-Flop S R? D S(t) R(t) Determine D using the Eecution Table for D Characteristic Table SR (t) (t+)?? D S R D S(t) R(t) (t) D = S(t) + R(t) (t) Fall 27 9

JK Flip-Flop with D Flip-Flop J K? D J(t) K(t) Determine D using the Eecution Table for D Characteristic Table JK (t) (t+) D J K D J(t) K(t) (t) D = J(t) (t) + K(t) (t) Fall 27 2

T Flip-Flop with D Flip-Flop Determine D using the Eecution Table for D T? D Characteristic Table T T (t) (t+) D T D T(t) (t) D = T(t) (t) Fall 27 2

D Flip-Flop with SR Flip-Flop Determine S and R using the Eecution Table for SR D? S R Characteristic Table D D (t) (t+) S R (t) D S R D(t) D(t) (t) S = D(t) R = D (t) Fall 27 22

T Flip-Flop with JK Flip-Flop Determine J and K using the Eecution Table for JK T? J K Characteristic Table T T (t) (t+) J K (t) T J K T(t) T(t) (t) J = T(t) R = T(t) Fall 27 27

SR Flip-Flop with T Flip-Flop S R? T S(t) R(t) Determine T using the Eecution Table for T Characteristic Table SR (t) (t+)?? T S R T S(t) R(t) (t) T = S(t) (t) + R(t) (t) Fall 27 28

JK Flip-Flop with T Flip-Flop J K? T J(t) K(t) Determine T using the Eecution Table for T Characteristic Table JK (t) (t+) T J K T J(t) K(t) (t) T = J(t) (t) + K(t) (t) Fall 27 29

D Flip-Flop with T Flip-Flop Determine T using the Eecution Table for T D? T Characteristic Table D D (t) (t+) T D T D(t) (t) T = D(t) (t) Fall 27 3

Implementing Latches & Flip-Flops We have seen so far that we can design any other Latch/Flip-Flop with a given Latch/Flip-Flop. To do this we need to implement at least one Latch and one Flip-Flop using gates (transistors). Historically, first SR Latch has been implemented using gates (transistors) net slides will show you how! D Latch can be implemented using SR Latch (you already know how to do it!). D Flip-Flop can be implemented using SR Latch and D Latch - net slides will show you how! Given D Latch we can implement JK Latch and T Latch (you already know how to do it!). Given D Flip-Flop we can implement SR, JK, and T Flip- Flops (you already know how to do it!). Fall 27 3

What eactly is storage (memory)? A memory should have at least three properties.. It should be able to hold a value. 2. You should be able to read the value that was stored. 3. You should be able to change the value that is stored. We ll start with the simplest case, a one-bit memory.. It should be able to hold a single bit, or. 2. You should be able to read the bit that was saved. 3. You should be able to change the value. Since there s only a single bit, there are only two choices: Set the bit to Reset, or clear, the bit to. Fall 27 32

The Basic Idea of a Storage Element How can a circuit remember anything, when it s just a bunch of gates that produce outputs according to the inputs? The basic idea is to make a loop, so the circuit outputs are also inputs. Here is one initial attempt: Does this satisfy the properties of storage? Fall 27 These circuits remember, because its value never changes. (Similarly, never changes either.) We can also read, by attaching a probe or another circuit. But we can not change! There are no eternal inputs here, so we can not control whether = or =. 33

SR Latch Design using Logic Gates Let us use NOR gates instead of inverters. The circuit is called SR latch. It has two inputs S and R, which will let us control the outputs and. Here and feed back into the circuit. They are not only outputs, they are also inputs! To figure out how and change, we have to look at not only the inputs S and R, but also the current values of and : net = (R + current ) net = (S + current ) Let s see how different input values for S and R affect this circuit. Fall 27 34

Storing a Value: SR = What if S = and R =? The equations on the right reduce to: net = ( + current ) = current net = ( + current ) = current net = (R + current ) net = (S + current ) So, when SR =, then net = current. Whatever value has, it keeps. This is eactly what we need to store values in the latch. Fall 27 35

Setting The Latch: SR = What if S = and R =? Since S =, net is, regardless of current : net = ( + current ) = Then, this new value of goes into the top NOR gate, along with R =. net = ( + ) = So when SR =, then net = and net =. net = (R + current ) net = (S + current ) This is how you set the latch to. The S input stands for set. Notice that it can take up to two steps (two gate delays) from the time S becomes to the time net becomes. But once net becomes, the outputs will stop changing. This is a stable state. Fall 27 36

Latch Delays Timing diagrams are especially useful in understanding how circuits work. Here is a diagram which shows an eample of how our latch outputs change with inputs SR=.. Suppose that initially, = and =. net = (R + current ) net = (S + current ). Since S=, will change from to after one NOR-gate delay (marked by vertical lines in the diagram for clarity). 2. This change in, along with R=, causes to become after another gate delay. 3. The latch then stabilizes until S or R change again. S R 2 3 4 Fall 27 37

Resetting The Latch: SR = What if S = and R =? Since R =, net is, regardless of current : net = ( + current ) = Then, this new value of goes into the bottom NOR gate, where S =. net = ( + ) = So when SR =, then net = and net =. This is how you reset, or clear, the latch to. The R input stands for reset. Again, it can take two gate delays before a change in R propagates to the output net. net = (R + current ) net = (S + current ) Fall 27 38

What about SR =? Both net and net will become. This contradicts the assumption that and are always complements. Another problem is what happens if we then make S = and R = together. net = ( + ) = net = ( + ) = But these new values go back into the NOR gates, and in the net step we get: net = (R + current ) net = (S + current ) Fall 27 net = ( + ) = net = ( + ) = The circuit enters an infinite loop, where and cycle between and forever. This is actually the worst case, but the moral is do not ever set SR=! 39

SR latch: Summary SR latch is indeed -bit memory. Why? We can store the present value We can set it to We can reset it to S R No change (reset) (set) Undefined! SR latch is a simple asynchronous sequential circuit. Why? It is made of gates with feed-back loops The output represents the data stored in the latch. It is sometimes called the state of the latch. Fall 27 4

S R latch Design using Logic Gates There are several varieties of latches. You can use NAND instead of NOR gates to get a S R latch. S R No change (reset) (set) Undefined! This is just like an SR latch, but with inverted inputs, as you can see from the table. You can derive this table by writing equations for the outputs in terms of the inputs and the current state, just as we did for the SR latch. Fall 27 4

SR Latch with a Control Input Here is SR latch with a control input C. It is based on an S R latch. The additional gates generate the S and R signals, based on inputs S and R and C ( control ). C S R S R No change No change (reset) (set) Undefined Notice the hierarchical design! The dotted blue bo is the S R latch from the previous slide. The additional NAND gates are simply used to generate the correct inputs for the S R latch. The control input acts just like an enable. Fall 27 42

D Latch Design using Logic Gates Finally, a D latch is based on an SR latch. The additional inverter generates the R signal, based on input D ( data ). When C =, S and R are both, so the state does not change. When C =, the latch output will equal the input D. No more messing with one input for set and another input for reset! S R S R C D No change Also, this latch has no bad input combinations to avoid. Any of the four possible assignments to C and D are valid. Fall 27 43

Latches: Behaviour & Issues Level triggered Latches are transparent, i.e., any change on the inputs is seen at the outputs immediately. This causes synchronization problems! (not recommended for use in synchronous designs) Solution: use latches to create Flip-Flops that can respond (update) ONLY on SPECIFIC times (instead of ANY time). The specific times are the rising or falling edge of a clock signal. Thus, Flip-Flops are Edge triggered and used in synchronous design. Fall 27 44

D Flip-Flop Design using Latches Here is the internal structure of a D flip-flop. The flip-flop inputs are C and D, and the outputs are and. The D latch on the left is the master, while the SR latch on the right is called the slave. Master Slave Note the layout here (Master-Slave structure). The flip-flop input D is connected directly to the master latch. The master latch output goes to the slave. The flip-flop outputs come directly from the slave latch. Fall 27 45

D Flip-Flop Behavior Master Slave The D flip-flop s control input C enables either the D latch or the SR latch, but not both. When C = : The master D latch is enabled. Whenever D changes, the master s output changes too. The slave is disabled, so the D latch output has no effect on it. Thus, the slave just maintains the flip-flop s current state. As soon as C becomes : The master is disabled. Its output will be the last D input value seen just before C became. Any subsequent changes to the D input while C = have no effect on the master latch, which is now disabled. The slave latch is enabled. Its state changes to reflect the master s output. Fall 27 46

D Flip-Flop Behavior (cont.) D Master Slave Based on the behavior described in previous slide we conclude that: The flip-flop output changes only at the rising edge of C. The change is based on the flip-flop input value that was present right at the rising edge of the clock signal. Thus, this is called a rising edge-triggered flip-flop. How do we get a falling edge-triggered flip-flop? Fall 27 47