ECE C03 Lecture 131 Lecture 13 Finite State Machine Optimization Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.

Slides:



Advertisements
Similar presentations
Nonlinear & Neural Networks LAB. PART State Reduction ( )
Advertisements

ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 23 Finite State Machine.
Chapter #8: Finite State Machine Design 8
Lecture 21 State minimization via implication charts.
Some Slides from: U.C. Berkeley, U.C. Berkeley, Alan Mishchenko, Alan Mishchenko, Mike Miller, Mike Miller, Gaetano Borriello Gaetano Borriello Introduction.
Chapter #10: Finite State Machine Implementation
Lecture 15 Finite State Machine Implementation
Finite State Machines (FSMs)
VIII - Working with Sequential Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite state machine optimization State minimization  fewer.
Give qualifications of instructors: DAP
Digital Logic Design Lecture 27.
No. 9-1 Chapter #9: Finite State Machine Optimization.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
CS 151 Digital Systems Design Lecture 25 State Reduction and Assignment.
Sequential Circuit Design
ECE 331 – Digital System Design Introduction to and Analysis of Sequential Logic Circuits (Lecture #20) The slides included herein were taken from the.
ECE 331 – Digital System Design State Reduction and State Assignment (Lecture #22) The slides included herein were taken from the materials accompanying.
ECE 331 – Digital System Design
Sequential Circuit Design. 2 State Optimization Equivalent States:  Two states are equivalent if, for each member of the set of inputs,  they give exactly.
ECE C03 Lecture 111 Lecture 11 Finite State Machine Optimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design 8.5 Finite State Machine.
Give qualifications of instructors: DAP
Aho-Corasick String Matching An Efficient String Matching.
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design Finite State.
1 State Reduction: Row Matching Example 1, Section 14.3 is reworked, setting up enough states to remember the first three bits of every possible input.
Spring 2002EECS150 - Lec0-intro Page 1 EECS150 - Digital Design Lecture 9 - Finite State Machines 1 February 19, 2002 John Wawrzynek.
Spring 2002EECS150 - Lec15-seq2 Page 1 EECS150 - Digital Design Lecture 15 - Sequential Circuits II (Finite State Machines revisited) March 14, 2002 John.
Sources Gang Quan Univ. of Notre Dame Finite State Machines.
Contemporary Logic Design FSM Optimization © R.H. Katz Transparency No Chapter #9: Finite State Machine 9.4 Choosing Flip-Flops 9.5 Machine Partitioning.
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
ENGIN112 L25: State Reduction and Assignment October 31, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 25 State Reduction and Assignment.
CSCI 3301 Transparency No. 9-1 Chapter #9: Finite State Machine Optimization Contemporary Logic Design.
Lecture 17 General finite state machine (FSM) design
Zvi Kohavi and Niraj K. Jha 1 Capabilities, Minimization, and Transformation of Sequential Machines.
Chapter 5 - Part Sequential Circuit Design Design Procedure  Specification  Formulation - Obtain a state diagram or state table  State Assignment.
Rabie A. Ramadan Lecture 2
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Elevator Controller We’re hired to design a digital elevator controller for a four-floor building st try: Design a counter that counts up.
Chapter #8: Finite State Machine Design
Lecture 18 More Moore/Mealy machines.
Introduction to Sequential Logic Design Finite State-Machine Design.
CPEN Digital System Design Chapter 5 - Sequential Circuits Sequential Circuit Design C. Gerousis © Logic and Computer Design Fundamentals, 4 rd Ed.,
Introduction to State Machine
9-1 Introduction Chapter #9: Finite State Machine Optimization.
Sources Gang Quan Univ. of Notre Dame Finite State Machines.
DLD Lecture 26 Finite State Machine Design Procedure.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Sequential Circuit Design 05 Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.
Finite State Machines Mealy machine inputs Outputs next state function
Capabilities, Minimization, and Transformation of Sequential Machines
Finite state machine optimization
Sequential Networks and Finite State Machines
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN
Finite state machine optimization
Sequential logic design principles
State Reduction and State Assignment
Sequential Networks and Finite State Machines
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 25 Logistics Last lecture Today HW8 posted today, due 12/5
Implement FSM with fewest possible states • Least number of flip flops
Lecture 25 Logistics Last lecture Today HW8 posted today, due 12/5
Lecture 22 Logistics Last lecture Today
Lecture 20 State minimization via row matching.
CS M51A/EE M16 Winter’05 Section 1 Logic Design of Digital Systems Lecture 11 February 23 W’05 Yutao He 4532B Boelter Hall
EGR 2131 Unit 12 Synchronous Sequential Circuits
Announcements Assignment 7 due now or tommorrow Assignment 8 posted
Chapter5: Synchronous Sequential Logic – Part 3
CSE 370 – Winter Sequential Logic-2 - 1
Presentation transcript:

ECE C03 Lecture 131 Lecture 13 Finite State Machine Optimization Prith Banerjee ECE C03 Advanced Digital Design Spring 1998

ECE C03 Lecture 132 Outline Motivation for FSM Optimization State Minimization Algorithms Row Matching Method Implicit Chart Method CAD Tools for Optimization READING: Katz 9.1, 9.2.1, Dewey 9.3

ECE C03 Lecture 133 Motivation Basic FSM Design Procedure: (1) Understand the problem (2) Obtain a formal description (3) Minimize number of states (4) Encode the states (5) Choose FFs to implement state register (6) Implement the FSM

ECE C03 Lecture 134 Motivation for State Reduction Odd Parity Checker: two alternative state diagrams Identical output behavior on all input strings FSMs are equivalent, but require different implementations Design state diagram without concern for # of states, Reduce later 0 S0 [0] S1 [1] S2 [0] 1 S0 [0] S1 [1]

ECE C03 Lecture 135 Motivation for State Reduction Implement FSM with fewest possible states Least number of flipflops Boundaries are power of two number of states Fewest states usually leads to more opportunities for don't cares Reduce the number of gates needed for implementation

ECE C03 Lecture 136 State Reduction Goal Identify and combine states that have equivalent behavior Equivalent States: for all input combinations, states transition to the same or equivalent states Odd Parity Checker: S0, S2 are equivalent states Both output a 0 Both transition to S1 on a 1 and self-loop on a 0 Algorithmic Approach Start with state transition table Identify states with same output behavior If such states transition to the same next state, they are equivalent Combine into a single new renamed state Repeat until no new states are combined

ECE C03 Lecture 137 Row Matching Method Example FSM Specification: Single input X, output Z Taking inputs grouped four at a time, output 1 if last four inputs were the string 1010 or 0110 Example I/O Behavior: X = Z = Upper bound on FSM complexity: Fifteen states ( ) Thirty transitions ( ) sufficient to recognize any binary string of length four!

ECE C03 Lecture 138 Row Matching Method State Diagram for Example FSM: Reset 0/0 1/0 0/01/0 0/01/0 0/01/0 0/0 1/00/01/00/0 1/0 0/01/0 0/0 1/0 0/0 1/0 0/1 0/0 1/0 0/0 1/00/1

ECE C03 Lecture 139 Row Matching Method Initial State Transition Table: Present State S 0 S 1 S 2 S 3 S 4 S 5 S 6 S 7 S 8 S 9 S 10 S 11 S 12 S 13 S 14 Input Sequence Reset X= X=0 S 1 S 3 S 5 S 7 S 9 S 11 S 13 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 X=1 S 2 S 4 S 6 S 8 S 10 S 12 S 14 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 X= Next StateOutput

ECE C03 Lecture 1310 Row Matching Method Initial State Transition Table: Present State S 0 S 1 S 2 S 3 S 4 S 5 S 6 S 7 S 8 S 9 S 10 S 11 S 12 S 13 S 14 Input Sequence Reset X= X=0 S 1 S 3 S 5 S 7 S 9 S 11 S 13 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 X=1 S 2 S 4 S 6 S 8 S 10 S 12 S 14 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 0 X= Next StateOutput

ECE C03 Lecture 1311 Row Matching Method Present State S 0 S 1 S 2 S 3 S 4 S 5 S 6 S 7 S 8 S 9 S' 10 S 11 S 13 S 14 Input Sequence Reset or Next State X=0X=1 S 1 S 3 S 5 S 7 S 9 S 11 S 13 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 2 S 4 S 6 S 8 S' 10 S' S 14 S 0 S 0 S 0 S 0 S 0 S 0 S 0 X= X= Output

ECE C03 Lecture 1312 Row Matching Method Present State S 0 S 1 S 2 S 3 S 4 S 5 S 6 S 7 S 8 S 9 S' 10 S 11 S 13 S 14 Input Sequence Reset or Next State X=0X=1 S 1 S 3 S 5 S 7 S 9 S 11 S 13 S 0 S 0 S 0 S 0 S 0 S 0 S 0 S 2 S 4 S 6 S 8 S' 10 S' S 14 S 0 S 0 S 0 S 0 S 0 S 0 S 0 X= X= Output

ECE C03 Lecture 1313 Row Matching Method Present State S 0 S 1 S 2 S 3 S 4 S 5 S 6 S 7 ' S' 10 Input Sequence Reset not (011 or 101) 011 or 101 X=0 S 1 S 3 S 5 S 0 S 0 X=1 S 2 S 4 S 6 S 0 S 0 X= X= Next StateOutput S 7 ' S 7 ' S 7 ' S 7 ' S 7 ' S' 10 S' S 7 '

ECE C03 Lecture 1314 Row Matching Method Present State S 0 S 1 S 2 S 3 S 4 S 5 S 6 S 7 ' S' 10 Input Sequence Reset not (011 or 101) 011 or 101 X=0 S 1 S 3 S 5 S 0 S 0 X=1 S 2 S 4 S 6 S 0 S 0 X= X= Next StateOutput S 7 ' S 7 ' S 7 ' S 7 ' S 7 ' S' 10 S' S 7 '

ECE C03 Lecture 1315 Final Reduced State Machine Final Reduced State Transition Table Final Reduced State Transition Table Corresponding State Diagram Corresponding State Diagram Reset S1 S3' S7' S2 S4' S10' 0,1/0 0/0 1/0 0/1 S0 0/0

ECE C03 Lecture 1316 Critique of Row Matching Straightforward to understand and easy to implement Problem: does not allows yield the most reduced state table! Example: 3 State Odd Parity Checker No way to combine states S0 and S2 based on Next State Criterion! No way to combine states S0 and S2 based on Next State Criterion! Present State S 0 S 1 S 2 Next State X=0 S 0 S 1 S 2 X=1 S 1 S 2 S 1 Output 0 1 0

ECE C03 Lecture 1317 State Reduction by Implicant Charts New example FSM: Single input X, Single output Z Output a 1 whenever the serial sequence 010 or 110 has been observed at the inputs State transition table: Present State S 0 S 1 S 2 S 3 S 4 S 5 S 6 Input Sequence Reset X= Next StateOutput X=0 S 1 S 3 S 5 S 0 S 0 S 0 S 0 X=1 S 2 S 4 S 6 S 0 S 0 S 0 S 0 X=

ECE C03 Lecture 1318 Implication Chart Method Enumerate all possible combinations of states taken two at a time Naive Data Structure: Xij will be the same as Xji Also, can eliminate the diagonal Implication Chart Next States Under all Input Combinations S0 S1 S2 S3 S4 S5 S6 S0S1S2S3S4S5S6 S1 S2 S3 S4 S5 S6 S0S1S2S3S4S5

ECE C03 Lecture 1319 Implication Chart Method Filling in the Implication Chart Entry Xij — Row is Si, Column is Sj Si is equivalent to Sj if outputs are the same and next states are equivalent Xij contains the next states of Si, Sj which must be equivalent if Si and Sj are equivalent If Si, Sj have different output behavior, then Xij is crossed out Example: S0 transitions to S1 on 0, S2 on 1; S1 transitions to S3 on 0, S4 on 1; So square X contains entries S1-S3 (transition on zero) S2-S4 (transition on one) S1-S3 S2-S4 S0 S1

ECE C03 Lecture 1320 Implication Chart Method Starting Implication Chart S2 and S4 have different I/O behavior This implies that S1 and S0 cannot be combined S1 S2 S3 S4 S5 S6 S0 S1 S2 S3 S4 S5 S1-S3 S2-S4 S1-S5 S2-S6 S3-S5 S4-S6 S1-S0 S2-S0 S3-S0 S4-S0 S5-S0 S6-S0 S1-S0 S2-S0 S3-S0 S4-S0 S5-S0 S6-S0 S0-S0

ECE C03 Lecture 1321 Implication Chart Method Results of First Marking Pass Second Pass Adds No New Information S3 and S5 are equivalent S4 and S6 are equivalent This implies that S1 and S2 are too! Reduced State Transition Table Reduced State Transition Table S0-S0 S3-S5 S4-S6 S0-S0 S1 S2 S3 S4 S5 S6 S0S1S2S3S4S5

ECE C03 Lecture 1322 Multiple Input State Diagram Example State Diagram Symbolic State Diagram S0 [1] S2 [1] S4 [1] S1 [0] S3 [0] S5 [0]

ECE C03 Lecture 1323 Example (contd) Implication Chart Minimized State Table S1 S2 S3 S4 S5 S0-S1 S1-S3 S2-S2 S3-S4 S0-S0 S1-S1 S2-S2 S3-S5 S0 S0-S1 S3-S0 S1-S4 S5-S5 S0-S1 S3-S4 S1-S0 S5-S5 S1 S1-S0 S3-S1 S2-S2 S4-S5 S2 S1-S1 S0-S4 S4-S0 S5-S5 S3S4

ECE C03 Lecture 1324 Implication Chart Method Does the method solve the problem with the odd parity checker? Implication Chart S0 is equivalent to S2 since nothing contradicts this assertion! S 1 S 2 S 0 S 1 S 0 -S 2 S 1 -S 1

ECE C03 Lecture 1325 Detailed Algorithm 1.Construct implication chart, one square for each combination of states taken two at a time 2.Square labeled Si, Sj, if outputs differ than square gets "X". Otherwise write down implied state pairs for all input combinations 3.Advance through chart top-to-bottom and left-to-right. If square Si, Sj contains next state pair Sm, Sn and that pair labels a square already labeled "X", then Si, Sj is labeled "X". 4.Continue executing Step 3 until no new squares are marked with "X". 5.For each remaining unmarked square Si, Sj, then Si and Sj are equivalent.

ECE C03 Lecture 1326 CAD Tool for State Minimization There is a computer-aided tool for state machine minimization called STAMINA You will use the tool in your homework Example input file for traffic light controller inputscurrent_statenext_stateoutputs 0--HGHG HGHG HGHY10010 … --1FYHG11001

ECE C03 Lecture 1327 Summary Motivation for FSM Optimization State Minimization Algorithms Row Matching Method Implicit Chart Method CAD Tools for Optimization NEXT LECTURE: Finite State Machine State Assignment READING: Katz 9.3 Dewey 9.4