EET 310 Flip-Flops 11/17/2011 1

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

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 vs. Combinational

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

Sequential Logic Circuits

ELCT201: DIGITAL LOGIC DESIGN

Introduction to Digital Logic

Sequential Circuits Sequential circuits combinational circuits state gate delay

Chapter 7 Sequential Logic

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

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

Chapter 4. Sequential Logic Circuits

Digital Fundamentals

Chapter 14 Sequential logic, Latches and Flip-Flops

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

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

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

CHW 261: Logic Design

Latches. October 13, 2003 Latches 1

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

Problem Set 9 Solutions

ELCT201: DIGITAL LOGIC DESIGN

Digital Circuits ECS 371

Different encodings generate different circuits

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

CSE370 HW6 Solutions (Winter 2010)

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

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

Synchronous Sequential Logic

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

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

Counters. We ll look at different kinds of counters and discuss how to build them

ALU, Latches and Flip-Flops

Topic 8: Sequential Circuits

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

Synchronous Sequential Circuit

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

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

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

Module - 19 Gated Latches

Sequential Logic Design: Controllers

Vidyalankar S.E. Sem. III [CMPN] Digital Logic Design and Analysis 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.

Chapter 5 Synchronous Sequential Logic

Lecture 14 Finite state machines

PGT104 Digital Electronics. PGT104 Digital Electronics

CPE100: Digital Logic Design I

DIGITAL LOGIC CIRCUITS

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

Integrated Circuits & Systems

ESE 570: Digital Integrated Circuits and VLSI Fundamentals

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

15.1 Elimination of Redundant States

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

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

Reg. No. Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER Second Semester. Computer Science and Engineering

Sequential Circuit Analysis

Digital Logic Appendix A

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

Digital Fundamentals

Chapter 2. Review of Digital Systems Design

Synchronous Sequential Circuit Design

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

MOSIS REPORT. Spring MOSIS Report 1. MOSIS Report 2. MOSIS Report 3

CPE/EE 422/522. Chapter 1 - Review of Logic Design Fundamentals. Dr. Rhonda Kay Gaede UAH. 1.1 Combinational Logic

Lecture 9: Digital Electronics

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

EE 209 Logic Cumulative Exam Name:

or 0101 Machine

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

Unit 7 Sequential Circuits (Flip Flop, Registers)

P2 (10 points): Given the circuit below, answer the following questions:

Introduction EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 6: Sequential Logic 3 Registers & Counters 5/9/2010

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

CPE100: Digital Logic Design I

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

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

Experiment 9 Sequential Circuits

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.

SIR C.R.REDDY COLLEGE OF ENGINEERING ELURU DIGITAL INTEGRATED CIRCUITS (DIC) LABORATORY MANUAL III / IV B.E. (ECE) : I - SEMESTER

Overview of Chapter 4

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

Sequential Logic Worksheet

Designing Sequential Logic Circuits

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

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

Digital Circuits and Systems

Digital Electronics Sequential Logic

Digital electronics form a class of circuitry where the ability of the electronics to process data is the primary focus.

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

University of Minnesota Department of Electrical and Computer Engineering

Laboratory Exercise #8 Introduction to Sequential Logic

Stop Watch (System Controller Approach)

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

Digital Electronics II Mike Brookes Please pick up: Notes from the front desk

Chapter 6 Flip-Flops, and Registers

Transcription:

EET 310 Flip-Flops 11/17/2011 1

FF s and some Definitions Clock Input: FF s are controlled by a trigger or Clock signal. All FF s have a clock input. If a device which attempts to do a FF s task does not have a Clock then it is a LATCH, not a FF. 11/17/2011 2

FF s and some Definitions Synchronous Input: Controls the device based on the timing from a clock signal. When the clocking signal occurs, the synchronous input is allowed to affect the output. If the signal does not occur the synchronous input can not affect anything. 11/17/2011 3

Synchronous Input Asynchronous Input D PRE Q Clk Clock Input CLR Q Asynchronous Input Asynchronous Input: Affects the output without waiting for a clocking signal. It IGNORES the clock. 11/17/2011 4

Pre and Clr Inputs PRE Input The PRE input will cause the Q output to SET (go HIGH) when a 0 is applied to the PRE input. This occurs ASYNCHRONOUSLY (without the clock). 11/17/2011 5

Pre and Clr Inputs PRE Input The PRE input will cause the Q output to SET (go HIGH) when a 0 is applied to the PRE input. This occurs ASYNCHRONOUSLY (without the clock). CLR Input The CLR input will cause the Q output to RESET (go LOW) when a 0 is applied to the CLR input. This occurs ASYNCHRONOUSLY (without the clock). 11/17/2011 6

The PRE and CLR inputs ACTIVE HIGH or LOW? The activity level of an input or output is determined by the existence of an inverting bubble on the terminal or not. Both the PRE and the CLR inputs below are ACTIVE LOW inputs. This means that a 0 is required on the input in order for the input to affect the output. D PRE Q Clk CLR Q 11/17/2011 7

The CLOCK There are three types of clock inputs: Level Triggered (not used often) Leading Edge Triggered Trailing Edge Triggered (pictured below) 11/17/2011 8

Level Triggering The problem with this type of triggering is that the input could change millions of times during each Level period, thus affecting the output millions of times. 11/17/2011 9

Leading Edge Triggering V(t) 1 Clk 0 time The Leading edge of each pulse will allow one and only one input event for each edge to affect the output. 11/17/2011 10

Trailing Edge Triggering 11/17/2011 11

How the edge trigger is accomplished CLK CLK CLK CLK Leading CLKedge CLK CLK Trailing CLKedge CLK CLKedge CLK CLKedge These circuits work by using the fact that there is no such thing as an ideal gate. Instead, there exists a delay from the input and the output. The gate on the far right is a negative logic representation of a NOR gate. 11/17/2011 12

The RS FF The RS FF is not seen much anymore except on tests and in textbooks. The S=1,R=1 condition should never be allowed to happen. S R Q Q 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 Never 1 1 1 Never 11/17/2011 13

The D Flip-flop D 1 PRE Clk CLR 1 Q Q The D Flip-flop output will take on the value of the D input. So, if there is a logic 1 on the D input when the trigger event occurs, the 1 will be transferred to the output until the next trigger event. At that point, if D changes to a logic 0, so will the Q output. 11/17/2011 14

Present State and Next State Q P = Present state: The state of the output before the clock signal. Q N = Q + = Next state: The state the output will attain based on the flip-flop synchronous inputs after the clock signal occurs. It is what will happen in the FUTURE! Some books use Q n for present state and Q n+1 for next state. 11/17/2011 15

D FF Transitions D 0 Q p 0 1 1 0 1 1 Q 0 0 N When D is 0 and the present state, Q p, is 0, then the next state, Q n, is 0. 11/17/2011 16

D FF Transitions D Q p Q 0 0 0 0 1 0 1 0 1 1 N When D is 0 and Q p, is 1 then Q n is 0. 11/17/2011 17

D FF Transitions D Q Q p 0 0 0 N 0 1 0 1 0 1 1 1 When D is 1, and Q p is 0, then Q n, is 1. 11/17/2011 18

D FF Transitions D Q Q p 0 0 0 N 0 1 0 1 0 1 1 1 1 When D is 1 and Q p, is 1, then Q n, is 1. 11/17/2011 19

D FF wrap up We note that whenever the D input is a 0, the output will be Reset no matter what the present state is. D Q Q p N 0 0 0 0 1 0 1 0 1 1 1 1 11/17/2011 20

D FF wrap up Whenever the D input is a 1, the output will be Set, no matter what the present state is. D Q Q p N 0 0 0 0 1 0 1 0 1 1 1 1 11/17/2011 21

D FF wrap up D Q Q p 0 0 0 N 0 1 0 1 0 1 1 1 1 The main thing to note here is that the NEXT STATE column is always the same as the D column in a D-FF 11/17/2011 22

D FF wrap up D Q Q p N 0 0 0 0 1 0 1 0 1 1 1 1 The D FF performs two basic named functions: Data: The D-ff is one of the most basic memory cells. Data placed on the input D is transferred to the output Q and stored there until it is replaced during the next clock active period. 11/17/2011 23

D FF wrap up D Q Q p N 0 0 0 0 1 0 1 0 1 1 1 1 The D FF performs two basic named functions: Data: The D-ff is one of the most basic memory cells. Data placed on the input D is transferred to the output Q and stored there until it is replaced during the next clock active period. Delay: Data placed on the input D is delayed in its transition to the output Q until the clocks active period occurs. 11/17/2011 24

The T Flip-flop Transitions T Q Q p 0 0 0 N 0 1 1 1 0 1 1 1 0 T 1 PRE Clk CLR Q Q For a T FF, whenever the T input is 0, the output will be in a Hold condition in which whatever Q p is will be held there until the next trigger or clock event. 1 11/17/2011 25

The T Flip-flop Transitions T Q Q p 0 0 0 N 0 1 1 1 0 1 1 1 0 T 1 PRE Clk CLR Q Q Whenever the T input is 1. the output will be in a Toggle condition where if Q p is 0 the output will toggle to a 1 and vice versa. 1 11/17/2011 26

The JK Flip-flop Transitions J K 1 PRE Clk CLR 1 Q Q Row 0 1 2 3 4 5 6 J K Q Q 0 0 0 0 0 0 1 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 7 1 1 1 For a JK-ff, when both the J and K inputs are at a logic 0 the output will be in a HOLD condition. 11/17/2011 27 p N

The JK Flip-flop Transitions J K 1 PRE Clk CLR 1 Q Q Row 0 1 2 3 4 5 6 J K Q Q 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 0 1 1 1 0 7 1 1 1 When J = 0 and K = 1 the output will be in a RESET condition no matter what present state is. 11/17/2011 28 p N

The JK Flip-flop Transitions J K 1 PRE Clk CLR 1 Q Q Row J K Qp Q 0 0 0 0 0 1 0 0 1 1 2 0 1 0 0 3 0 1 1 0 4 1 0 0 1 5 1 0 1 1 6 1 1 0 7 1 1 1 When J = 1 and K = 0 the output will be in a SET condition no matter what present state is. 11/17/2011 29 N

The JK Flip-flop Transitions J K 1 PRE Clk CLR 1 Q Q Row 0 1 2 3 4 5 6 7 J K Qp Q 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 When J = 1 and K = 1 the output will be in a TOGGLE condition no matter what present state is. 11/17/2011 30 N

The JK used as a T-FF Before simplifying the JK truth table we can note that the table looks like it is made up of both the T and the D flip-flops. We can convert the JK into a T-FF by simply shorting the two inputs together and using the resulting input as a T input. T J K PRE Clk 1 CLR 1 Q Q Row 0 1 2 3 4 5 6 7 J K Q 0 0 0 0 0 0 1 1 1 1 0 p Q 1 1 1 1 0 N 11/17/2011 31

The JK used as a D-FF All that is necessary to convert a JK into a D-FF is to place an inverter between the J and the K inputs so that they will always be opposite values. D J K PRE Clk 1 CLR 1 Q Q Row J K Qp Q 0 1 2 0 1 0 0 3 0 1 1 0 4 1 0 0 1 5 1 0 1 1 6 7 N 11/17/2011 32

Simplifying the JK truth table We can simplify the JK table and make it more useful at the same time by introducing the concept of the Don t Care. An input is in a Don t Care state when it really doesn t matter what value is placed on the input. There will be no change on the output due to any value on the input. 11/17/2011 33

The State Transition Table We start out by switching the order of the columns so that the state transitions are first. The table now becomes a Transition Table. Q P Q N 0 0 0 1 1 0 1 1 J K 11/17/2011 34

The 0 to 0 transition Next we look for the two rows that have transitions from state 0 to state 0. Note that it doesn t matter what value K assumes because the transition remains the same. So we place a 0 in the J column and an X for don t care in the K column. Row 0 1 2 3 4 5 6 7 J K Qp Q 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 N Q P Q N 0 0 0 1 1 0 1 1 J K 0 X 11/17/2011 35

The 0 to 1 transition Next we look for the two rows that have transitions from state 0 to state 1. Note that it doesn t matter what value K assumes because the transition remains the same. So we place a 1 in the J column and an X for don t care in the K column. Row 0 1 2 3 4 5 6 7 J K Q Q 0 0 1 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 p N QP QN J K 0 0 0 X 0 1 1 X 1 0 1 1 11/17/2011 36

The 1 to 0 transition Next we look for the two rows that have transitions from state 1 to state 0. Note that it doesn t matter what value J assumes because the transition remains the same. So we place a 1 in the K column and an X for don t care in the J column. Row 0 1 2 3 4 5 6 7 J K Q Q 0 0 1 1 0 1 1 0 1 p 0 1 1 1 1 1 0 N Q P Q N J K 0 0 0 X 0 1 1 X 1 0 X 1 1 1 11/17/2011 37

The 1 to 1 transition Next we look for the two rows that have transitions from state 1 to state 1. Note that it doesn t matter what value J assumes because the transition remains the same. So we place a 0 in the K column and an X for don t care in the J column. Row J K Qp Q 0 1 0 0 1 1 2 3 4 5 1 0 1 1 6 7 N QP Q 0 0 0 1 1 0 1 1 11/17/2011 38 N J K 0 X 1 X X 1 X 0

Timing Diagrams Quite often it is necessary to examine how a circuit acts given a set of input signals. The tool used to accomplish this is the Timing Diagram. Use a set of signals to examine how the JK-FF below reacts. Note that the PRE and CLR inputs are not set at any logic level. 11/17/2011 39

Timing Diagrams The figure below is the framework for a Timing diagram. Since the JK-FF had a trailing edge trigger, vertical lines have been added to remind the user about trigger events. 11/17/2011 40

Timing Diagrams A signals has been added for the PRE input. Since it is an asynchronous input, a vertical line has been to mark the edges where the input was active. 11/17/2011 41

Timing Diagrams The Q output is marked at a HIGH level during the time that PRE was LOW. Again, it makes no difference what the clock is doing here. 11/17/2011 42

Timing Diagrams Since there is no way that Q can change until the next trailing edge, the HIGH level extended. 11/17/2011 43

Timing Diagrams Now a CLR signal is added with its vertical markers showing the period when the signal is low. 11/17/2011 44

Timing Diagrams The LOW on the CLR line causes Q to go LOW asynchronously. clock Pre Clr J K Q 11/17/2011 45

Timing Diagrams Next, J and K signals are added. 11/17/2011 46

Timing Diagrams At this point the problem would need to state what the initial state is. In this case, the initial state is y 0 = 0. 11/17/2011 47

Timing Diagrams The Initial state of y 0 = 0 is added to the Q output. It should go up to the 1 st trailing edge but this time it goes up to where PRE forces the output HIGH. 11/17/2011 48

Timing Diagrams Note that if the initial state isn t given, the state becomes indeterminate until the first trigger event. clock Pre Clr J K Q 11/17/2011 49

Timing Diagrams OK, back to the original initial state. Note that PRE holds the output HIGH till the second trailing edge so J and K don t matter till then. 11/17/2011 50

Timing Diagrams At the 2 nd trigger, J = 0 and K = 0, so the FF is in a HOLD condition. Q stays HIGH till trigger 3. 11/17/2011 51

Timing Diagrams At the 3 rd trigger, J = 1 and K = 0, so the FF is in a SET condition. Q stays HIGH till trigger 4 since it was already set. 11/17/2011 52

Timing Diagrams At the 4 th trigger, J = 0 and K = 1, so the FF is in a RESET condition. Q goes low until the next trigger (or in this case until it runs into the CLR d output). clock Pre Clr J K Q 11/17/2011 53

Frequency Division A T- FF is also known as a frequency divider. Obviously, if it divides frequency then it multiplies time (or periods). 11/17/2011 54

Frequency Division Before we go any further, lets review the concept of duty cycle. Duty cycle is the ratio of Time High to the Period expressed as a percentage. T H D 100 T 11/17/2011 55

Frequency Division Duty cycle is the ratio of Time High to the Period expressed as a percentage. T D H 100 T So, if you look at the waveform below, you see the measurements for time high and period. 11/17/2011 56

Frequency Division The duty cycle for this waveform is: T H D 100 T 250 s 100 1ms 25% 11/17/2011 57

Frequency Division Now, lets supply a 25% duty cycle clock to a two T-FF ripple counter. 11/17/2011 58

Frequency Division The 1 st FF output, y 0, will toggle with each clock trailing edge. Clk y 1 y 0 1ms 2ms 3ms 4ms 5ms 11/17/2011 59

Frequency Division The 2 nd FF output, y 1, will toggle with each of the 1 st FF s trailing edges. Clk y 1 y 0 1ms 2ms 3ms 4ms 5ms 11/17/2011 60

Frequency Division Now, lets examine the waveform for y 0. Note that the duty cycle is now 50%. This is one of the effects of a T-FF. Clk y 1 y 0 1ms 2ms 3ms 4ms 5ms 11/17/2011 61

Frequency Division The period (T) of y 0 is 2ms which is twice the period of the clock. The period has been MULTIPLIED by 2! Clk y 1 y 0 1ms 2ms 3ms 4ms 5ms 11/17/2011 62

Frequency Division The frequency of the clock was: 1 1 f 1khz T 1ms Clk y 1 y 0 1ms 2ms 3ms 4ms 5ms 11/17/2011 63

Frequency Division The Frequency of y 0 is: f The Frequency has been divided by 2. 1 2ms 500hz Clk y 1 y 0 1ms 2ms 3ms 4ms 5ms 11/17/2011 64

Frequency Division The Frequency of y 1 is: This is one half of y 1 and one fourth of the clocks period! Clk f 1 4ms 250hz y 1 y 0 1ms 2ms 3ms 4ms 5ms 11/17/2011 65

Clock Slew Error Also known as timing skew, Clock skew is a phenomenon in synchronous circuits in which the clock signal reaches different components at different times. 11/17/2011 66

Clock Slew Error Also known as timing skew, Clock skew is a phenomenon in synchronous circuits in which the clock signal reaches different components at different times. The causes vary but the problem can cause serious glitches in some types of circuits. 11/17/2011 67

Master/Slave JK-FF s The Master/Slave JK was designed to compensate for the clock skew problem. 11/17/2011 68

Master/Slave JK-FF s The Master/Slave JK was designed to compensate for the clock skew problem. This JK contains two latches connected serially. The first latch is designed to accept the data from the JK inputs on the leading clock edge. 11/17/2011 69

Master/Slave JK-FF s The Master/Slave JK was designed to compensate for the clock skew problem. This JK contains two latches connected serially. The first latch is designed to accept the data from the JK inputs on the leading clock edge. After the leading edge the contents of the JK inputs are held in the first latch. The inputs could continue to change but will not be accepted. (of course, in reality there exists about a 20ns setup time after the edge as well). 11/17/2011 70

Master/Slave JK-FF s The 2 nd latch doesn t act on the JK input instructions till the Trailing Edge of the clock. 11/17/2011 71

Master/Slave JK-FF s The 2 nd latch doesn t act on the JK input instructions till the Trailing Edge of the clock. This concept is known as Data Lockout. 11/17/2011 72

Master/Slave JK-FF s Data Lockout is analogous to a diver entering a submarine thru an airlock. 11/17/2011 73

Master/Slave JK-FF s Data Lockout is analogous to a diver entering a submarine thru an airlock. 11/17/2011 74

Master/Slave JK-FF s Data Lockout is analogous to a diver entering a submarine thru an airlock. 11/17/2011 75

The State Diagram A very useful design tool is the State Diagram. 11/17/2011 76

The State Diagram A very useful design tool is the State Diagram. A State Diagram allows you visualize the state progression of a state machine (Ch. 8). 11/17/2011 77

The State Diagram A very useful design tool is the State Diagram. A State Diagram allows you visualize the state progression of a state machine (Ch. 8). The State Diagram can precede the state table or follow it. 11/17/2011 78

The State Diagram A very useful design tool is the State Diagram. A State Diagram allows you visualize the state progression of a state machine (Ch. 8). The State Diagram can precede the state table or follow it. There are some categories of state machine which depend totally on the State Diagram (Sequence Detector, Ch. 8). 11/17/2011 79

A Two-State Diagram Lets start out with a two-state diagram. 11/17/2011 80

A Two-State Diagram Lets start out with a two-state diagram. A state is represented by a bubble with the state ID in the center. 11/17/2011 81

A Two-State Diagram Lets start out with a two-state diagram. A state is represented by a bubble with the state ID in the center. This ID could be a state variable, or it could be the actual state. 11/17/2011 82

A Two-State Diagram Lets start out with a two-state diagram. A state is represented by a bubble with the state ID in the center. This ID could be a state variable, or it could be the actual state. Or, it could have both as shown here. 11/17/2011 83

A Two-State Diagram All state diagrams MUST have a legend. 11/17/2011 84

A Two-State Diagram All state diagrams MUST have a legend. This legend is normally a rectangle placed somewhere on the periphery of the diagram 11/17/2011 85

A Two-State Diagram All state diagrams MUST have a legend. This legend is normally a rectangle placed somewhere on the periphery of the diagram The contents vary with the problem but normally consists of an input followed by a / and then the output. 11/17/2011 86

A Two-State Diagram All state diagrams MUST have a legend. This legend is normally a rectangle placed somewhere on the periphery of the diagram The contents vary with the problem but normally consists of an input (X) followed by a / and then the output (Z). 11/17/2011 87

A Two-State Diagram Note that the Q output of a FF (or a counter chip) is not really an output (from a state machine design perspective) Instead, it is a STATE. Outputs are the result of additional circuitry attached to the circuit. 11/17/2011 88

A Two-State Diagram For this example, if the input (X) is a 0 and the Present State is A, then the Next state will be A. The circuit output will be a 0. X 0 /Z 0/0 A/0 B/1 11/17/2011 89

A Two-State Diagram For this example, if the input (X) is a 0 and the Present State is A, then the Next state will be A. The circuit output will be a 0. Note that if the legend was not present there would be no way to determine what the contents of the arrow meant! X 0 /Z 0/0 A/0 B/1 11/17/2011 90

A Two-State Diagram Next, if the input (X) is a 1 and the Present State is A, then the Next state will be B and the circuit output will be a 1. 11/17/2011 91

A Two-State Diagram Next, if the input (X) is a 0 and the Present State is B, then the Next state will be B and the circuit output will be a 1. 11/17/2011 92

A Two-State Diagram And finally, if the input (X) is a 1 and the Present State is B, then the Next state will be A and the circuit output will be a 0. X 0 /Z 1/1 0/0 A/0 B/1 0/1 1/0 11/17/2011 93

A JK FF State Diagram Lets examine what the state diagram for a JK-FF would look like. Note that a JK-FF, just like any FF, does not have an output, just a state out. For this reason, the legend will be J/K. 11/17/2011 94

A JK FF State Diagram Any single FF will result in a two-state diagram. We will call state 0, A and state 1, B. 11/17/2011 95

A JK FF State Diagram It might help at this point to remind ourselves of the JK Transition Table Q P Q N 0 0 0 1 1 0 1 1 J K 0 X 1 X X 1 X 0 11/17/2011 96

A JK FF State Diagram According to the table, if J is 0 and Q p is 0, then Q N will be 0. Note that K is a don t care. Q P Q J K 0 0 0 X 0 1 1 X 1 0 X 1 1 1 X 0 N 11/17/2011 97

A JK FF State Diagram According to the table, if J is 1 and Q p is 0, then Q N will be 1. Q P Q N 0 0 J K 0 X 0 1 1 X 1 0 X 1 1 1 X 0 11/17/2011 98

A JK FF State Diagram According to the table, if J is 1 and Q p is 0, then Q N will be 1. Q P Q N 0 0 J K 0 X 0 1 1 X 1 0 X 1 1 1 X 0 11/17/2011 99

A JK FF State Diagram According to the table, if K is 1 and Q p is 1, then Q N will be 0. Note that J is now a don t care. Q P Q N J K 0 0 0 X 0 1 1 X 1 0 X 1 1 1 X 0 11/17/2011 100

A JK FF State Diagram And finally, if K is 0 and Q p is 1, then Q N will be 1. Q P Q N J K 0 0 0 X 0 1 1 X 1 0 X 1 1 1 X 0 11/17/2011 101

Problem Example Consider a sequential circuit having one input (x), 2 states (y 2 and y 1 ), and one output variable. (Note: The book got the y 2 and y 1 backwards. Make the indicated state assignments. The initial state of the machine is y 0 = A. State y2y1 A 00 B 01 C 10 D 11 11/17/2011 102

Problem Example If the circuit has the following input (x) sequence applied to it: X=0110101100, the following behavior will be observed: State y2y1 A 00 B 01 C 10 D 11 Trigger 0 1 2 3 4 5 6 7 8 9 10 x 0 1 1 0 1 0 1 1 0 0 PS A D B A D B B A C C C NS D B A D B B A C C C z 0 1 0 0 1 1 0 1 1 1 11/17/2011 103

Problem Example Using the provided answer, create a state table. The left side of the table starts the same as always. The state assignment table was used to assign the state variables. State y2y1 A 00 B 01 C 10 D 11 x y2 y1 Y2 Y1 z 0 0 A 0 0 0 B 1 0 1 C 0 0 1 D 1 1 0 A 0 1 0 B 1 1 1 C 0 1 1 D 1 11/17/2011 104

Problem Example Use the behavior table to complete the next state and output columns: x y2 y1 Y2 Y1 z 0 0 A 0 D 0 0 0 B 1 0 1 C 0 0 1 D 1 1 0 A 0 1 0 B 1 1 1 C 0 1 1 D 1 Trig 0 1... x 0 1... PS A D... NS D B... z 0 1... 11/17/2011 105

Problem Example Use the behavior table to complete the next state and output columns: x y2 y1 Y2 Y1 z 0 0 A 0 D 0 0 0 B 1 0 1 C 0 0 1 D 1 1 0 A 0 1 0 B 1 1 1 C 0 1 1 D 1 B 1 Trig 0 1... x 0 1... PS A D... NS D B... z 0 1... 11/17/2011 106

Problem Example Use the behavior table to complete the next state and output columns: x y y Y Y z 2 1 2 1 0 0 A 0 D 0 0 0 B 1 0 1 C 0 0 1 D 1 1 0 A 0 1 0 B 1 A 0 1 1 C 0 1 1 D 1 B 1 Trig 2 3 4 x... 1 0 1... PS... B A D... NS... A D B... z... 0 0 1... 11/17/2011 107

Problem Example Use the behavior table to complete the next state and output columns: x y y Y Y z 2 1 2 1 0 0 A 0 D 0 0 0 B 1 0 1 C 0 0 1 D 1 1 0 A 0 1 0 B 1 A 1 1 C 0 1 1 D 1 B 1 0 Trig 2 3 4 x... 1 0 1... PS... B A D... NS... A D B... z... 0 0 1... Already finished columns 3 and 4 associated table rows. 11/17/2011 108

Problem Example Use the behavior table to complete the next state and output columns: x y2 y1 Y2 Y1 z 0 0 A 0 D 0 0 0 B 1 B 1 0 1 C 0 0 1 D 1 1 0 A 0 1 0 B 1 A 1 1 C 0 1 1 D 1 B 1 0 Trig 5 6 7 x... 0 1 1... PS... B B A... NS... B A C... z... 1 0 1... 11/17/2011 109

Problem Example Use the behavior table to complete the next state and output columns: x y y Y Y z 2 1 2 1 0 0 A 0 D 0 0 0 B 1 B 1 0 1 C 0 0 1 D 1 1 0 A 0 1 0 B 1 1 1 C 0 C 1 A 0 1 1 D 1 B 1 Trig 5 6 7 x... 0 1 1... PS... B B A... NS... B A C... z... 1 0 1... Column 6 wasn t needed. 11/17/2011 110

Problem Example Use the behavior table to complete the next state and output columns: x y y Y Y z 2 1 2 1 0 0 A 0 D 0 0 0 B 1 B 1 0 1 C 0 C 1 0 1 D 1 1 0 A 0 C 1 1 0 B 1 A 0 1 1 C 0 1 1 D 1 B 1 Trigger 8 9 10 x... 0 0 PS... C C C NS... C C z... 1 1 11/17/2011 111

Problem Example Use the behavior table to complete the next state and output columns: x y2 y1 Y2 Y1 z 0 0 A 0 D 0 0 0 B 1 B 1 0 1 C 0 C 1 0 1 D 1 1 0 A 0 C 1 1 0 B 1 A 0 1 1 C 0 1 1 D 1 B 1 Rows 3 and 6 are not covered by the problem so are considered to be undefined or illegal states. 11/17/2011 112

Problem Example Use the behavior table to complete the next state and output columns: x y y Y Y z 2 1 2 1 0 0 A 0 D 0 0 0 B 1 B 1 0 1 C 0 C 1 0 1 D 1 A 0 1 0 A 0 C 1 1 0 B 1 A 0 1 1 C 0 D 0 1 1 D 1 B 1 So, the designer is free to assign them in such a way as to lead to legal states. 11/17/2011 113

Problem Example Use the state assignment table to complete the Next state columns ID s. x y y Y Y z 2 1 2 1 0 0 A 0 D 0 0 0 B 1 B 1 0 1 C 0 C 1 0 1 D 1 0 A 0 0 1 0 A 0 C 1 1 0 B 1 0 A 0 0 1 1 C 0 D 0 1 1 D 1 B 1 State y y A 00 B 01 C 10 D 11 2 1 11/17/2011 114

Problem Example Use the state assignment table to complete the Next state columns ID s. x y y Y Y z 2 1 2 1 0 0 A 0 D 0 0 0 B 1 0 B 1 1 0 1 C 0 C 1 0 1 D 1 0 A 0 0 1 0 A 0 C 1 1 0 B 1 0 A 0 0 1 1 C 0 D 0 1 1 D 1 0 B 1 1 State y y 2 1 A 00 B 01 C 10 D 11 11/17/2011 115

Problem Example Use the state assignment table to complete the Next state columns ID s. x y y Y Y z 2 1 2 1 0 0 A 0 D 0 0 0 B 1 0 B 1 1 0 1 C 0 1 C 0 1 0 1 D 1 0 A 0 0 1 0 A 0 1 C 0 1 1 0 B 1 0 A 0 0 1 1 C 0 D 0 1 1 D 1 0 B 1 1 State y2y1 A 00 B 01 C 10 D 11 11/17/2011 116

Problem Example Use the state assignment table to complete the Next state columns ID s. x y y Y Y z 2 1 2 1 0 0 A 0 1 D 1 0 0 0 B 1 0 B 1 1 0 1 C 0 1 C 0 1 0 1 D 1 0 A 0 0 1 0 A 0 1 C 0 1 1 0 B 1 0 A 0 0 1 1 C 0 1 D 1 0 1 1 D 1 0 B 1 1 State y2y1 A 00 B 01 C 10 D 11 11/17/2011 117

Problem Example Before going, convert the table to a more concise form. x y y Y Y z 2 1 2 1 0 0 A 0 1 D 1 0 0 0 B 1 0 B 1 1 0 1 C 0 1 C 0 1 0 1 D 1 0 A 0 0 1 0 A 0 1 C 0 1 1 0 B 1 0 A 0 0 NS NS 1 1 C 0 1 D 1 0 PS X 0 X 1 1 1 D 1 0 B 1 1 y2 y 1 YY 2 1 /z YY 2 1 /z 0 A 0 D/0 0 B 1 1 C 0 1 D 1 11/17/2011 118

Problem Example Before going, convert the table to a more concise form. x y y Y Y z 2 1 2 1 0 0 B 1 0 B 1 1 0 1 C 0 1 C 0 1 0 1 D 1 0 A 0 0 1 0 A 0 1 C 0 1 1 0 B 1 0 A 0 0 1 1 C 0 1 D 1 0 1 1 D 1 0 B 1 1 NS NS PS X 0 X 1 y y YY / z YY /z 2 1 0 A 0 D/0 C /1 0 B 1 1 C 0 1 D 1 2 1 2 1 11/17/2011 119

Problem Example Before going, convert the table to a more concise form. x y y Y Y z 2 1 2 1 0 0 B 1 0 B 1 1 0 1 C 0 1 C 0 1 0 1 D 1 0 A 0 0 1 0 B 1 0 A 0 0 1 1 C 0 1 D 1 0 1 1 D 1 0 B 1 1 y NS NS PS X 0 X 1 y 2 1 YY 0 A 0 D/0 C /1 0 B 1 B/1 1 C 0 1 D 1 /z YY /z 2 1 2 1 11/17/2011 120

Problem Example Before going, convert the table to a more concise form. x y y Y Y z 2 1 2 1 0 1 C 0 1 C 0 1 0 1 D 1 0 A 0 0 1 0 B 1 0 A 0 0 1 1 C 0 1 D 1 0 1 1 D 1 0 B 1 1 NS NS PS X 0 X 1 y y YY /z YY / z 2 1 2 1 2 1 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 1 D 1 11/17/2011 121

Problem Example Before going, convert the table to a more concise form. x y y Y Y z 2 1 2 1 0 1 C 0 1 C 0 1 0 1 D 1 0 A 0 0 1 1 C 0 1 D 1 0 1 1 D 1 0 B 1 1 NS NS PS X 0 X 1 y y YY /z YY /z 2 1 2 1 2 1 0 A 0 D/0 C /1 0 B 1 B/ 1 A/0 1 C 0 C /1 1 D 1 11/17/2011 122

Problem Example Before going, convert the table to a more concise form. x y y Y Y z 2 1 2 1 0 1 D 1 0 A 0 0 1 1 C 0 1 D 1 0 1 1 D 1 0 B 1 1 NS NS PS X 0 X 1 y y YY /z YY /z 2 1 0 A 0 D/ 2 1 2 1 0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/ 0 1 D 1 11/17/2011 123

Problem Example Before going, convert the table to a more concise form. x y y Y Y z 2 1 2 1 0 1 D 1 0 A 0 0 NS NS PS X 0 X 1 1 1 D 1 0 B 1 1 y y YY /z 2 1 YY 2 1 2 1 /z 0 A 0 D/0 C / 1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 11/17/2011 124

Problem Example Before going, convert the table to a more concise form. x y y Y Y z 2 1 2 1 1 1 D 1 0 B 1 1 y PS 2 1 NS NS X 0 X 1 y YY /z YY / z 2 1 2 1 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 11/17/2011 125

Problem Example Finally, create the state diagram. NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 11/17/2011 126

Problem Example Finally, create the state diagram. Legend x/z A 0/0 C NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 B D 11/17/2011 127

Problem Example Finally, create the state diagram. NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 11/17/2011 128

Problem Example Finally, create the state diagram. NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 11/17/2011 129

Problem Example Finally, create the state diagram. NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 11/17/2011 130

Problem Example Finally, create the state diagram. NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 11/17/2011 131

Problem Example Finally, create the state diagram. 0/1 Legend x/z A B 0/0 0/0 1/1 C D NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 0/1 1/0 11/17/2011 132

Problem Example Finally, create the state diagram. NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 11/17/2011 133

Problem Example Finally, create the state diagram. NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 11/17/2011 134

Problem Example The completed solution. 1/0 0/1 Legend x/z A B 1/1 0/0 0/0 1/1 C D NS NS PS X 0 X 1 y2 y 1 YY 2 1 /z YY 2 1 / z 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 0/1 1/0 11/17/2011 135

An alternate concise table y PS 2 1 NS NS X 0 X 1 y YY /z YY / z 2 1 2 1 0 A 0 D/0 C /1 0 B 1 B/1 A/0 1 C 0 C /1 D/0 1 D 1 A/0 B/1 PS X 0 X 1 X 0 X y y YY YY z z 2 1 NS NS NS NS 2 1 2 1 0 A 0 D C 0 1 0 B 1 B A 1 0 1 C 0 C D 1 0 1 D 1 A B 0 1 1 11/17/2011 136