Introduction to Digital Logic

Similar documents
Sequential vs. Combinational

Memory Elements I. CS31 Pascal Van Hentenryck. CS031 Lecture 6 Page 1

Chapter 14 Sequential logic, Latches and Flip-Flops

ELCT201: DIGITAL LOGIC DESIGN

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 7 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Using the NOT realization from the NAND, we can NOT the output of the NAND gate making it a NOT NOT AND or simply an AND gate.

Sequential Logic Circuits

Chapter 4. Sequential Logic Circuits

Sequential Logic. Rab Nawaz Khan Jadoon DCS. Lecturer COMSATS Lahore Pakistan. Department of Computer Science

EET 310 Flip-Flops 11/17/2011 1

Chapter 7 Sequential Logic

Latches. October 13, 2003 Latches 1

CSE370 HW6 Solutions (Winter 2010)

Lecture 14 Finite state machines

Problem Set 9 Solutions

Synchronous Sequential Logic

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

Lecture 14: State Tables, Diagrams, Latches, and Flip Flop

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

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

Sequential Circuits Sequential circuits combinational circuits state gate delay

Overview of Chapter 4

Sequential Circuit Analysis

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Konstruktion av Vippor och Latchar

Lecture 7: Sequential Networks

Computers also need devices capable of Storing data and information Performing mathematical operations on such data

PGT104 Digital Electronics. PGT104 Digital Electronics

Vidyalankar S.E. Sem. III [ETRX] Digital Circuits and Design Prelim Question Paper Solution

Week-5. Sequential Circuit Design. Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.

Topic 8: Sequential Circuits

EE 209 Logic Cumulative Exam Name:

ELEN Electronique numérique

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

ELCT201: DIGITAL LOGIC DESIGN

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

CS61C : Machine Structures

Chapter #6: Sequential Logic Design

15.1 Elimination of Redundant States

CSE140: Components and Design Techniques for Digital Systems. Midterm Information. Instructor: Mohsen Imani. Sources: TSR, Katz, Boriello & Vahid

LOGIC CIRCUITS. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

CS61C : Machine Structures

S.Y. Diploma : Sem. III [DE/ED/EI/EJ/EN/ET/EV/EX/IC/IE/IS/IU/MU] Principles of Digital Techniques

CS/COE1541: Introduction to Computer Architecture. Logic Design Review. Sangyeun Cho. Computer Science Department University of Pittsburgh

I. Motivation & Examples

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

Logic design? Transistor as a switch. Layered design approach. CS/COE1541: Introduction to Computer Architecture. Logic Design Review.

Unit 7 Sequential Circuits (Flip Flop, Registers)

Lecture 3 Review on Digital Logic (Part 2)

Topics. CMOS Design Multi-input delay analysis. John A. Chandy Dept. of Electrical and Computer Engineering University of Connecticut

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Digital Techniques

Chapter 3. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 3 <1>

Adders allow computers to add numbers 2-bit ripple-carry adder

Laboratory Exercise #8 Introduction to Sequential Logic

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

ESE 570: Digital Integrated Circuits and VLSI Fundamentals

Lecture 17: Designing Sequential Systems Using Flip Flops

Chapter 5 Synchronous Sequential Logic

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) State any two Boolean laws. (Any 2 laws 1 mark each)

Digital Fundamentals

5. Sequential Logic x Computation Structures Part 1 Digital Circuits. Copyright 2015 MIT EECS

Q: Examine the relationship between X and the Next state. How would you describe this circuit? A: An inverter which is synched with a clock signal.

Sequential Logic (3.1 and is a long difficult section you really should read!)

ALU, Latches and Flip-Flops

CS/COE0447: Computer Organization

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Digital Logic Design - Chapter 4

University of Minnesota Department of Electrical and Computer Engineering

CPE100: Digital Logic Design I

Topic 8: Sequential Circuits. Bistable Devices. S-R Latches. Consider the following element. Readings : Patterson & Hennesy, Appendix B.4 - B.

Time Allowed 3:00 hrs. April, pages

Schedule. ECEN 301 Discussion #25 Final Review 1. Date Day Class No. 1 Dec Mon 25 Final Review. Title Chapters HW Due date. Lab Due date.

EECS150 - Digital Design Lecture 23 - FFs revisited, FIFOs, ECCs, LSFRs. Cross-coupled NOR gates

Vidyalankar S.E. Sem. III [CMPN] Digital Logic Design and Analysis Prelim Question Paper Solution

I. Motivation & Examples

CPS 104 Computer Organization and Programming Lecture 11: Gates, Buses, Latches. Robert Wagner

Chapter 9 Asynchronous Sequential Logic

CMPEN 411. Spring Lecture 18: Static Sequential Circuits

Digital Electronic Meters

Hold Time Illustrations

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Chapter 6 Introduction to state machines

Module - 19 Gated Latches

CS/COE0447: Computer Organization

Synchronous Sequential Circuit

Lecture 9: Digital Electronics

Chapter 6 Flip-Flops, and Registers

Integrated Circuits & Systems

Clocked Sequential Circuits UNIT 13 ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS. Analysis of Clocked Sequential Circuits. Signal Tracing and Timing Charts

Chapter 3. Chapter 3 :: Topics. Introduction. Sequential Circuits

UMBC. At the system level, DFT includes boundary scan and analog test bus. The DFT techniques discussed focus on improving testability of SAFs.

Synchronous Sequential Logic Part I. BME208 Logic Circuits Yalçın İŞLER

EEE2135 Digital Logic Design

Lecture 7: Logic design. Combinational logic circuits

ALU A functional unit

11.1 As mentioned in Experiment 10, sequential logic circuits are a type of logic circuit where the output of

Sequential Logic. Handouts: Lecture Slides Spring /27/01. L06 Sequential Logic 1

Roger L. Tokheim. Chapter 8 Counters Glencoe/McGraw-Hill

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

Transcription:

Introduction to Digital Logic Lecture 17: Latches Flip-Flops

Problem w/ Bistables Output should have been at end of sequence Problem: Glitch was remembered Need some way to ignore inputs until they are stable and valid X 1 1 X O A>B A A 1 A 2 A 3 B B 1 B 2 B 3 I A<B I A>B I A=B 74LS85 O A<B O A>B O A=B R 2 6 7 S Mark Redekopp, All rights reserved Glitch causes to be set

Latches Latches are bistables that include a new clock input (sometimes called the gate or enable ) The clock input will tell the latch when to ignore the inputs (when =) and when to respond to them (when =1) R S R Internal S Internal RS Bistable RS Latch

Latches RS Latch (=) RS Latch (=1) R R 1 R S S S = causes S=R= and thus and remain unchanged =1 allows S,R to pass and thus and are set, reset or remain unchanged based on those inputs

lock Signals A clock signal is an alternating sequence of 1 s and s It can be used to help ignore the inputs of a bistable when there might be glitches or other invalid values Idea: When clock is, ignore inputs When clock is 1, respond to inputs Sample lock Signal 1 1 1 1 1 1 f = 1/T = 1 khz t = ms 1 ms 2 ms 3 ms 4 ms 5 ms

Solution with Latches = when inputs change In fact, in a real digital system, it is s transition to that triggers the inputs to change Glitches occur during this time and are filtered When = 1, inputs are stable and no glitches will occur Mark Redekopp, All rights reserved Glitch gets filtered in latch because =

Latches Rule When clock =, inputs don t matter, outputs remain the same When clock = 1, inputs pass to the inner bistable and the outputs change based on those inputs

SR-Latch When =, holds (remembers) its value When = 1, responds as a normal SRbistable S R LK S R x x 1 1 1 1 1 1 1 1 1 1 illegal

SR-Latch S R LK S R x x 1 1 1 1 1 1 1 1 1 1 illegal LK S S=1,R= causes =1 R S=,R=1 causes = S=1,R= causes =1 When =, holds its value

RS (SR) Latches S R SR Latch When =, outputs don t change no matter what the inputs do S R x x 1 1 1 1 1 1 1 1 1 1 illegal illegal LK S When =1, outputs change based on inputs R

RS (SR) Latches S R SR Latch S R x x 1 1 1 1 1 1 1 1 1 1 illegal illegal When =, ignore inputs LK S When =1, outputs change based on inputs R

Adding a Sequence of Numbers Back to our example of adding a sequence of numbers RS latches require 2 inputs (S,R) per output bit In this scenario, we only have 1-bit of input per output We ll modify an SR latch to become a latch that can remember 1 input bit 9, 3, 2 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Z Z1 Z2 Z3 This logic should remember (i.e. sequential logic) the sum and only update it when the next number arrives Just remember initial sum of 2 until 3 arrives. The data can still loop around and add up again (2+2=4) but if we just remember our output = 2 then the feedback loop will be broken

D-Latches D-Latches (Data latches) store data when the clock is low and pass data when the clock is high D-Latch is just an SR Latch with the D-input run into the S-input and inverted into the R-input D-Latch D S P P R

D-Latches Hold Mode When =1, outputs change based on inputs When =, outputs don t change no matter what the inputs do LK D D D Latch x 1 1 1 1 1 Hold Mode Transparent Mode

D-Latches When =, = Hold mode => stays the same When = 1, = D Transparent mode => follows D

Bistables vs. Latches Bistables No clock input outputs can change anytime the inputs change (including glitches) Latches lock/gate/enable input outputs can only change during clock high/low time Active-hi clock/gate/enable When =1, outputs respond to inputs When =, outputs hold their value

Notation To show that remembers its value we can put it in the past tense: = (urrent Value of = Old Value of ) OR put it in the future tense * = (Next Value of = urrent Value of ) Indicates next-value of x 1 1 1 1 1 * * x 1 1 1 1 1 urrent Value = Old Value Next Value = urrent Value

Adding a Sequence of Numbers Suppose we have a sequence of numbers that comes in over time that we want to sum up Possible solution: Route the outputs back to the inputs so we can add the current sum to the input X Problem 1: No way to initialize sum Problem 2: Outputs can race around to inputs and be added more than once per input number 9,3,2 X X1 X2 X3 Possible Solution A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Z Z1 Z2 Z3 Outputs feedback to inputs and update them sum more than once per input

Adding a Sequence of Numbers 2 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Z Z1 Z2 Z3 2 Time: Suppose somehow we can initialize outputs to Input X = 2 2+ = 2

Adding a Sequence of Numbers 2 2 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Z Z1 Z2 Z3 4 Time: 1 Output of 2 feeds back around to the inputs The X = 2 input hasn t changed Adder adds 2+2 = 4 It doesn t wait until X changes to the next number

Adding a Sequence of Numbers 2 4 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Z Z1 Z2 Z3 6 Time: 2 Output of 4 feeds back around to the inputs again The X = 2 input still hasn t changed Adder adds 2+4 = 6 Problem: We have an uncontrolled feedback loop

Adding a Sequence of Numbers Add logic at outputs to just capture and remember the new sum until we re ready to input the next number in the sequence This logic should remember (i.e. sequential logic) the sum and only update it when the next number arrives X A S Z 9, 3, 2 X1 X2 X3 A1 A2 A3 B B1 B2 B3 283 S1 S2 S3 Z1 Z2 Z3 Just remember initial sum of 2 until 3 arrives. The data can still loop around and add up again (2+2=4) but if we just remember our output = 2 then the feedback loop will be broken

Adding a Sequence of Numbers What if we put D-Latches at the outputs X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Y Y1 Y2 Y3 Z Z1 Z2 Z3 lock

Adding a Sequence of Numbers We ll change X on every clock period X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Y Y1 Y2 Y3 Z Z1 Z2 Z3 lock X 2 3 lock When = => * = When =1 => * = D

Adding a Sequence of Numbers Since the clock starts off low, the outputs of the latches can t change and just hold at 2 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Y Y1 2 Y2 Y3 Z Z1 Z2 Z3 time lock X 2 3 Y 2 lock Z When = => * = When =1 => * = D

Adding a Sequence of Numbers When the clock goes high the D goes through to and is free to loop back around 2 2 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 Y Y1 Y2 Y3 2 Z Z1 Z2 Z3 time lock X 2 3 Y 2 lock Z 2 When = => * = When =1 => * = D

Adding a Sequence of Numbers Once it loops back around it will be added again, change the Y value and go through to Z and loop back around again 2 4 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 4 Y Y1 Y2 Y3 4 Z Z1 Z2 Z3 time lock X 2 3 Y 2 4 lock Z 2 4 When = => * = When =1 => * = D

Adding a Sequence of Numbers This feedback loop continues until the clock goes low again 2 6 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 8 Y Y1 Y2 Y3 6 Z Z1 Z2 Z3 time lock X 2 3 Y 2 4 6 8 lock Z 2 4 6 8 When = => * = When =1 => * = D

Adding a Sequence of Numbers When the clock goes low again, the outputs will hold at their current value 8 until the clock goes high 3 8 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 11 Y Y1 Y2 Y3 8 Z Z1 Z2 Z3 time lock X 2 3 Y 2 4 6 8 11 lock Z 2 4 6 8 When = => * = When =1 => * = D

Adding a Sequence of Numbers When the clock goes high, the outputs will be free to change and we will get the feedback problem 3 8 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 11 Y Y1 Y2 Y3 8 Z Z1 Z2 Z3 time lock X 2 3 Y 2 4 6 8 11 14 17 2 lock Z 2 4 6 8 11 14 17 2 When = => * = When =1 => * = D

Adding a Sequence of Numbers Latches clearly don t work The goal should be to get one change of the outputs per clock period 3 8 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 S S1 S2 S3 11 Y Y1 Y2 Y3 8 Z Z1 Z2 Z3 time lock X 2 3 Y 2 4 6 8 11 14 17 2 lock Z 2 4 6 8 11 14 17 2 When = => * = When =1 => * = D

Flip-Flops New class of sequential devices Outputs only change once per clock period Outputs change on either the positive edges of the clock or the negative edges Positive-Edge of the lock Negative-Edge of the lock

Flip-Flops vs. Latches Flip-Flops Edge-Sensitive (Edge-Triggered) Outputs can change only at the edge Latches Level Sensitive Outputs can change whenever clock is at a particular level (1 or ) If positive-edge triggered, only looks at the input at this instant Whenever clock is at level 1 the outputs respond to the inputs

Flip-Flops hange D Latches to D Flip-Flops hange SR Latches to SR Flip-Flops D S R D-Latch SR- Latch Triangle at clock input indicates edgesensitive FF D-FF LK SR-FF S LK R

Flip-Flops To indicate negative-edge triggered use a bubble in front of the clock input Positive-Edge Triggered D-FF Negative-Edge Triggered D-FF D D-FF D D-FF LK LK No bubble indicates positive-edge triggered Bubble indicates negative-edge triggered

Positive-Edge Triggered SR-FF only looks at S and R values only on the positive-edge LK S R * * x x 1 1 1 1 1 1 1 illegal LK S R

Positive-Edge Triggered D-FF looks at D only at the positive-edge LK * * x 1 x 1 1 1 LK D only samples D at the positive edges and then holds that value until the next edge

Negative-Edge Triggered D-FF looks at D only at the negative-edge LK * * x 1 x 1 1 1 LK D only samples D at the negative edges and then holds that value until the next edge

Sequence Adder In our quest to build an adder that can add a sequence of numbers that come in over times, using flip-flops will produce a workable solution Because FF only change on the edge, only 1 value will be added per clock (i.e. only 1 value can go around the loop per clock) X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 4 S S1 S2 S3 Y Y1 Y2 Y3 lock lear Z Z1 Z2 Z3

Sequence Adder We ll still change X once per clock X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 4 S S1 S2 S3 Y Y1 Y2 Y3 Z Z1 Z2 Z3 lock lear X 2 3 9 lock lear

Sequence Adder The on lear will cause Z to be initialized to, but then Z can t change until the next negative edge That means we will just keep adding + 2 = 2 2 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 4 S S1 S2 S3 Y Y1 2 Y2 Y3 Z Z1 Z2 Z3 time lock lear X 2 3 9 lock lear Y 2 Z

Sequence Adder At the negative edge the flip-flops will sample the D inputs and then remember 2 until the next negative edge That means we will just keep adding 3 + 2 = 5 3 X X1 X2 X3 2 A A1 A2 A3 B B1 B2 B3 283 4 S S1 S2 S3 Y Y1 5 2 Y2 Y3 Z Z1 Z2 Z3 time lock lear X 2 3 9 lock lear Y 2 5 Z 2

Sequence Adder At the negative edge the flip-flops will sample the D inputs and then remember 5 until the next negative edge That means we will just keep adding 9 + 5 = 14 9 X X1 X2 X3 5 A A1 A2 A3 B B1 B2 B3 283 4 S S1 S2 S3 Y Y1 14 5 Y2 Y3 Z Z1 Z2 Z3 time lock lear X 2 3 9 lock lear Y 2 5 14 Z 2 5

Sequence Adder Finally, at the negative edge the flip-flops will sample the D inputs and then remember 14 X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 4 S S1 S2 S3 Y Y1 Y2 Y3 14 Z Z1 Z2 Z3 time lock lear X 2 3 9 lock lear Y 2 5 14 Z 2 5 14

Sequence Adder Summary Flip-Flops provide a solution that prevents any feed back problems because the outputs only look at the inputs once per clock X X1 X2 X3 A A1 A2 A3 B B1 B2 B3 283 4 S S1 S2 S3 Y Y1 Y2 Y3 Z Z1 Z2 Z3 lock lear

JK Flip-Flop SR Flip-Flop suffers from the 1,1 illegal case We can change the SR-FF to do something useful when a 1,1 input occurs Resulting flip-flop is called a JK Flip-Flop

JK Flip-Flop JK-FF is exactly the same as an SR-FF except for the 1,1 case J = Set (S), K = Reset (R) So if J=1,K=1 that means we re trying to Set =1 and Reset = at the same time Instead, if = and we try to set and reset at the same time, only allow the set; since is already= disallow the reset thus * = 1 Similarly, if =1 and we try to set and reset at the same time, only allow the reset; since is already=1 disallow the set thus *= Thus * =

JK Flip-Flop LK S R * *,1 x x J K LK 1 1 1 1 Same as SR-FF 1 1 Toggle (Invert) Mode

JK Flip-Flop LK S R * * x x 1 1 1 1 1 1 1 LK J K At this edge, J,K=1,1 so inverts