Chapter 6 Introduction to state machines

Similar documents
Logical design of digital systems

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

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

Different encodings generate different circuits

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

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

Synchronous Sequential Logic

FSM model for sequential circuits

Chapter 7 Sequential Logic

Simplify the following Boolean expressions and minimize the number of literals:

Synchronous Sequential Circuit Design

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

Sequential vs. Combinational

ECE380 Digital Logic. Synchronous sequential circuits

CE1911 LECTURE FSM DESIGN PRACTICE DAY 1

Synchronous Sequential Circuit Design. Digital Computer Design

Digital Logic and Design (Course Code: EE222) Lecture 19: Sequential Circuits Contd..

Lecture 14 Finite state machines

Finite State Machine (FSM)

Lecture 10: Synchronous Sequential Circuits Design

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

(Boolean Algebra, combinational circuits) (Binary Codes and -arithmetics)

Lecture 3 Review on Digital Logic (Part 2)

14.1. Unit 14. State Machine Design

or 0101 Machine

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

Overview of Chapter 4

CprE 281: Digital Logic

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

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

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

Lecture 8: Sequential Networks and Finite State Machines

Sequential Circuit Design

CPE100: Digital Logic Design I

ELCT201: DIGITAL LOGIC DESIGN

15.1 Elimination of Redundant States

Sequential Circuit Analysis

Finite State Machine. By : Ali Mustafa

6. Finite State Machines

Sequential Synchronous Circuit Analysis

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

ELCT201: DIGITAL LOGIC DESIGN

Fundamentals of Digital Design

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

Chapter 14 Sequential logic, Latches and Flip-Flops

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

Lecture 9: Digital Electronics

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

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

Synchronous Sequential Logic Part I

Problem Set 9 Solutions

Topic 8: Sequential Circuits

Review for B33DV2-Digital Design. Digital Design

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

Chapter 11 Binary Codes

Latches. October 13, 2003 Latches 1

Asynchronous sequence circuits

I. Motivation & Examples

ENGG 1203 Tutorial_9 - Review. Boolean Algebra. Simplifying Logic Circuits. Combinational Logic. 1. Combinational & Sequential Logic

Digital Circuit Engineering

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

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

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

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

EECS150 - Digital Design Lecture 23 - FSMs & Counters

EET 310 Flip-Flops 11/17/2011 1

Chapter 5 Synchronous Sequential Logic

Lecture 17: Designing Sequential Systems Using Flip Flops

Digital Circuits and Systems

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Combinational vs. Sequential. Summary of Combinational Logic. Combinational device/circuit: any circuit built using the basic gates Expressed as

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.

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

Digital Circuit Engineering

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

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

Synchronous Sequential Circuit

Logic Design II (17.342) Spring Lecture Outline

14:332:231 DIGITAL LOGIC DESIGN

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

ELE2120 Digital Circuits and Systems. Tutorial Note 9

Introduction to Digital Logic

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

Digital Electronics Sequential Logic

Clocked Synchronous State-machine Analysis

Digital Control of Electric Drives

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

Chapter 3 Digital Logic Structures

Chapter 15 SEQUENTIAL CIRCUITS ANALYSIS, STATE- MINIMIZATION, ASSIGNMENT AND CIRCUIT IMPLEMENTATION

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

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

Logic. Basic Logic Functions. Switches in series (AND) Truth Tables. Switches in Parallel (OR) Alternative view for OR

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

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

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

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

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

EEE2135 Digital Logic Design

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

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

Transcription:

9..7 hapter 6 Introduction to state machines Dr.-Ing. Stefan Werner Table of content hapter : Switching Algebra hapter : Logical Levels, Timing & Delays hapter 3: Karnaugh-Veitch-Maps hapter 4: ombinational ircuit Design hapter 5: Latches and Flip Flops hapter 6: Finite State Machines hapter 7: Basic Sequential ircuits hapter 9: Number Systems State Tables hapter 9: Binary Arithmetic hapter : Binary odes Introduction Mealy and Moore Machines State Graphs Transitions in State Graphs Machines and Flip-Flops Synthesizing a Finite State Machine Introduction to State Machine Minimization of 4

9..7 Example: RS-FF, as a FSM S R n n Functionality new State depends on actual state store X X reset set forbidden State Z with corresponding Output Y = State Z with corresponding Output Y = X States Z Output Y 3of 4 Example: RS-FF, as a FSM S R n n Functionality store reset transition function: g(x t, Z t ) if (r,s)=(i,) set g((s,r), ) = if (r,s)=(,) I if (r,s)=(,i) X forbidden Set X=(s,r)={, X I, I} Output Set Y=()={,I} State Set Z=(z)={,I} g((s,r), I) = if (r,s)=(i,) I if (r,s)=(,) I if (r,s)=(,i) 4of 4

9..7 State tables The state table (also called transition table or state transition table) contains the same information as the State Diagram hld holds information if i about Present State and Next State plus input lists all possible state transitions for all possible states for a table using one column for Present state, Next State and consits of n s. n i rows with -n i := no. of input variables -n s := no. of states. Present State S S S3 S3 Next State S3 S 5of 4 State tables A different form of a state table uses one column for the actual state and one column per input variable Such a table consists of ( n i ) columns and n s rows Present State S S S3 S3 Next State S3 S Present State I S S3 S3 S Next State 6of 4 3

9..7 State tables Output Values Moore Machine To assign the outputs there are differences, depending on the type of Machine: for a Moore Machine the outputs are written to an extra table. state table and output table can easily be combined to one Present State Output S S3 Output table of a Moore machine Present State I S S3 S3 S Output 7of 4 State tables Output Values Mealy Machine To assign the outputs there are differences, depending on the type of Machine for a Mealy Machine the output can be provided in an extra table or they can be included in the state table. 8of 4 4

9..7 State tables Output Values Mealy Machine Present Next Output Present State State State I S S / / S / S3 / S3 / S / S3 S3 Output included in S3 S the state table Output provided in an extra table (best choice depends on the actual complexity of the machine) 9of 4 Transition function and transition table Present State x x.. x j.. x m S S S 3 : s n ij =g(xi,zj) S i : S n of 4 5

9..7 Output table Present State x x.. x j.. x m S S S 3 : y ij =f(x i,s j ) S i : S n of 4 State table of a Mealy-Machine Present State x x.. x j.. x m S S S 3 : s ij n / y ij S i : S n of 4 6

9..7 State table of a Moore-Machine Present Output State x x.. x j.. x m S S S 3 : S i : S n s ij n =h(xi,zj) y y y 3... y k... y l 3 of 4 Machines and Flip Flops the simplest form of a Finite State Machine is the flip-flop. flip-flops are the memory of sequential circuits the part that provides the ability of having a state. Example: JK-Flip Flop l J K n Functionality X X n Disabled Preserve n s Preserve Set Reset n Toggle haracteristic equation: n n n = J K 4 of 4 7

9..7 Machines and Flip Flops l J K n Functionality X X n Disabled Preserve n s Preserve Set Reset n Toggle JK-FF has two input lines J and K JK-FF has one (two) Output lines (not ) JK-FF can be in one of two possible states S = Set =I = Reset = uncoded coded Output depends only on the actual state => JK-FF is a Moore Machine 5 of 4 Machines and Flip Flops - State transition table of JK-FF - l J K n JK-FF remains in its actual state Functionality X X n Disabled Preserve if J= and K= n Store s Preserve S = Set with output =I Set = Reset with Output = Reset n Toggle Being in S, JK-FF will transit to state regardless to the K input General structure of table with K= it transits to with k= it remains in S Out Present JK put State I I II S S S S S I Being in, JK-FF will transit to state S regardless to the J input with J= it transits to S with J= it remains in 6 of 4 8

9..7 Machines and Flip Flops - State Graph of JK-FF - State tranistion table of JK-FF X Present State S JK Out put I I II S S S S I S X J = don t care K= J = K= Note, that an input that does not have any influence on a certain transition is marked with an X at the according arrow (don t care). 7 of 4 Machines and Flip Flops Most machines contain more than only one FF Each of the machine s state is then assigned to exactly one possible combination of the flip-flop s states. Therefore the number of possible states grows by the power of with every new flip-flop: n flip-flops k = n possible states k states wanted n = (ld k) flip-flops needed The assignment flip-flop s states machine s state leads to socalled coded states and is basically free. 8 of 4 9

9..7 oding states Example Present State I Z Z Z Z Z Z3 Z3 Z Z Present I Output Output Three States => ld (3) = Flip Flops/ Variables needed (A,B) Even if coding is free of choice, there are usually smart assignments and less smart assignments The first intention is usually to represent the machine s states in such a way that the machine s output can be derived from the flip-flop s output with minimum effort. 9 of 4 Synthesizing a Finite State Machine The development of a Finite State Machine usually includes the steps translating ti the problem into a state t graph putting up state transition tables and output tables finding the simplified functions for the state transitions and outputs deducing the functions for the flip-flop s feedback circuit from the state transitions draw an appropriate circuit of 4

9..7 Synthesizing a Finite State Machine Example: traffic light Development of the control circuit for a traffic light. A traffic light basically runs through a sequence of several different states. As an extra; a control input can switch the traffic light into night mode => the yellow lamp blinks. Red Two different modes: day mode night mode Mode Traffic Light ontroller Yellow lock Green of 4 Synthesizing a Finite State Machine Example: traffic light Two different sequences depending on the mode Day mode Night mode Red S : Red Mode S : Red Yellow S4 : Yellow Traffic Light Yellow ontroller : Green S5 : All off S3 : Yellow S4 : Yellow S : Red lock Green the control line (mode) is used to switch between the modes. If control is, the traffic light shall remain in the present mode, it should switch modes. In day mode: light should start with yellow and continue with red. by power-on or in an undefined state: light should remain dark and switch to the day cycle s yellow with the next clock pulse. of 4

9..7 State Graph for traffic light control 3 of 4 Uncoded state table for traffic light control Present State (ontrol) I Output S S S4 R S S4 R,Y S3 S4 G Table is uncoded - 6 states: => ld(6) = 3 Variables - Output: => 3 Variables S3 S S4 Y S4 S5 S3 Y S5 S4 S3 Dark 4 of 4

9..7 oding the state table for traffic light control The states are to be expressed oded output table with the states of the flip-flops flops. State Output ( ) (RYG) State oded State ( ) S S S3 S4 S5 5 of 4 oded state transition table for traffic light control Present State (,, ) (ontrol) I Output (R,Y,G) I I I I I I II I II I I II I I I II II I II I II i,=f(s i,x i ) Remember:,, 6 of 4 3

9..7 How to read the transition functions from the state transition table Present State (,, ) (ontrol) I Output (R,Y,G) I I I I I I II I II I I II I I I II II I i,=f(s i,x i ) = II I II,, 7 of 4 Transition and output functions for traffic light control = = = R = Y = G = Now: Simplify with KV-Map Keep in mind: Not all combinations are used during the coding of the states 8 of 4 4

9..7 How to read the equations = X X X X = X X X X = = ( ) 9 of 4 All Functions for traffic light control = = ( ) = R = Y = G = 3 of 4 5

9..7 Flip Flop Feedback Functions Next: Design decision required for type of FF. Here: JK-Flip Flop n n = J K n J = K = n n = J K = J = K = n clk J clk K 3 of 4 Flip Flop Feedback Functions Next: Draw the circuit R = J = J = = = K J = ( ) = ( ) Y = K = K = = G = 3 of 4 6

9..7 hapter : Switching Algebra hapter : Logical Levels, Timing & Delays hapter 3: Karnaugh-Veitch-Maps hapter 4: ombinational ircuit Design hapter 5: Latches and Flip Flops hapter 6: Finite State Machines hapter 7: State Machine Minimization hapter 8: Basic Sequential ircuits hapter 9: Number Systems hapter : Binary Arithmetic hapter : Binary odes 33 of 4 Introduction to state machine miminization The minimization of a state machine means to reduce the number of states (if possible). The number of states can be reduced either when states can be eliminated or when they can be summarized with other states. 34 of 4 7

9..7 Elimination of states States can be eliminated if they are not reachable by any other state AND if they are not the initial starting state if they are isolated AND if they are not the initial starting state Sub-graphs can be eliminated if they are not reachable and if they do NOT contain the initial starting state Entire frame contains the state machine R: Reset or Starting Point 35 of 4 State Machine Minimization according to Huffmann/Mealy two states can be summarized/combined to one state, if they are equivalent. requirement for equivalency is that they have for identical input values the same next state with identical output vectors. 36 of 4 8

9..7 Example: State Machine Minimazing using state graphs State 5: X= Z n = Y n =I X=I Z n = Y n = State 6: same states can be combined state 5 remains state 6 can be deleted 37 of 4 Minimized State Graph 38 of 4 9

9..7 State Machine Minimazing using state tables Minimization is also possible with state table. Z n X= X=I / / 3/ 7/ 6/ / 3 / 4/ 4 5/ / 5 / / 6 / / 7 5/ / 39 of 4 State Machine Minimazing using state tables Minimization with state tables means, searching for identical rows Z n is a more systematic process X= X=I / / 3/ 7/ Delete state 6 and state 7 6/ / Rename 3 / 4/ all next states 6 to next state 5 4 5/ / all next states 7 to next state 4 5 / / Repeat searching for identical rows 6 / / 7 5/ / 4 of 4

9..7 State Machine Minimazing using state tables Z n X= X=I / / 3/ 4/ 5/ / 3 / 4/ 4 5/ / 5 / / Z n X= X=I / / 3/ / 5/ / 3 / / 5 / / More systematic and computer based approaches will be discussed in the lecture Logical Design of Digital Systems 4 of 4