CS 150 - Spring 2008 – Lec #24: Seq Logic Optimization - 1 Sequential Logic Optimization zState Minimization yAlgorithms for State Minimization zState,

Slides:



Advertisements
Similar presentations
Escola Politécnica da Universidade de São Paulo GSEIS - LME Logic Synthesis in IC Design and Associated Tools Sequential Synthesis Wang Jiang Chau Grupo.
Advertisements

Introduction to Sequential Circuits
Lecture 21 State minimization via implication charts.
Sequential Logic Optimization
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
Implementation Strategies
General Sequential Design
1 Steps towards State assignment Slides of Mark Schulz used.
State-machine structure (Mealy)
VIII - Working with Sequential Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite state machine optimization State minimization  fewer.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 Topic C: State Assignment José Nelson Amaral.
No. 9-1 Chapter #9: Finite State Machine Optimization.
CS 151 Digital Systems Design Lecture 25 State Reduction and Assignment.
Sequential Circuit 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.
EDA (CS286.5b) Day 17 Sequential Logic Synthesis (FSM Optimization)
ECE C03 Lecture 131 Lecture 13 Finite State Machine Optimization Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
Sequential Circuits and Finite State Machines Prof. Sin-Min Lee
Give qualifications of instructors: DAP
Sequential Circuit Design
Overview Sequential Circuit Design Specification Formulation
Spring 2002EECS150 - Lec15-seq2 Page 1 EECS150 - Digital Design Lecture 15 - Sequential Circuits II (Finite State Machines revisited) March 14, 2002 John.
CS Fall 2005 – Lec #19: Seq Logic Optimization - 1 Sequential Logic Optimization zState Minimization yAlgorithms for State Minimization zState, Input,
Penn ESE535 Spring DeHon 1 ESE535: Electronic Design Automation Day 12: March 2, 2009 Sequential Optimization (FSM Encoding)
Contemporary Logic Design FSM Optimization © R.H. Katz Transparency No Chapter #9: Finite State Machine 9.4 Choosing Flip-Flops 9.5 Machine Partitioning.
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.
KU College of Engineering Elec 204: Digital Systems Design
B-1 Appendix B - Reduction of Digital Logic Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
L10 – State Machine Design Topics. States Machine Design  Other topics on state machine design Equivalent sequential machines Incompletely specified.
Chapter 8 -- Analysis and Synthesis of Synchronous Sequential Circuits.
1 Lecture 22 State encoding  One-hot encoding  Output encoding State partitioning.
Introduction to Sequential Logic Design Finite State-Machine Design.
1 © 2014 B. Wilkinson Modification date: Dec Sequential Logic Circuits Previously, we described the basic building blocks of sequential circuits,
Module : FSM Topic : types of FSM. Two types of FSM The instant of transition from the present to the next can be completely controlled by a clock; additionally,
Introduction to State Machine
9-1 Introduction Chapter #9: Finite State Machine Optimization.
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah Logic Synthesis: From Specs to Circuits Implementation Styles –Random –Regular Optimization Criteria.
2-1 Introduction Gate Logic: Two-Level Simplification Design Example: Two Bit Comparator Block Diagram and Truth Table A 4-Variable K-map for each of the.
DLD Lecture 26 Finite State Machine Design Procedure.
1 Finite State Machines (FSMs) Now that we understand sequential circuits, we can use them to build: Synchronous (Clocked) Finite State Machines Finite.
1 State Reduction Goal: reduce the number of states while keeping the external input-output requirements unchanged. State reduction example: a: input 0.
CALTECH CS137 Winter DeHon CS137: Electronic Design Automation Day 6: January 26, 2004 Sequential Optimization (FSM Encoding)
CALTECH CS137 Winter DeHon CS137: Electronic Design Automation Day 17: March 11, 2002 Sequential Optimization (FSM Encoding)
FIGURES FOR CHAPTER 16 SEQUENTIAL CIRCUIT DESIGN
Digital Systems Design 1 Signal Expressions Multiply out: F = ((X + Y)  Z) + (X  Y  Z) = (X  Z) + (Y  Z) + (X  Y  Z)
1 CSE370, Lecture 24 Lecture 26 u Logistics n HW8 due Friday n Ant extra credit due Friday n Final exam a week from today, 12/8 8:30am-10:20am here n Review.
Finite state machine optimization
Finite state machine optimization
Lecture 26 Logistics Last lecture Today HW8 due Friday
David Culler Electrical Engineering and Computer Sciences
Lecture 14 Reduction of State Tables
Synthesis of sequential circuits
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 25 Logistics Last lecture Today HW8 posted today, due 12/5
DESIGN OF SEQUENTIAL CIRCUITS
Lecture 25 Logistics Last lecture Today HW8 posted today, due 12/5
Overview Part 2 – Circuit Optimization
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 24 Logistics Last lecture Today HW7 back today
Lecture 22 Logistics Last lecture Today
Lecture 23 Logistics Last lecture Today HW8 due Wednesday, March 11
EGR 2131 Unit 12 Synchronous Sequential Circuits
Announcements Assignment 7 due now or tommorrow Assignment 8 posted
CSE 370 – Winter Sequential Logic-2 - 1
Implementation Strategies
Presentation transcript:

CS Spring 2008 – Lec #24: Seq Logic Optimization - 1 Sequential Logic Optimization zState Minimization yAlgorithms for State Minimization zState, Input, and Output Encodings yMinimize the Next State and Output logic

CS Spring 2008 – Lec #24: Seq Logic Optimization - 2 Optimization in Context zUnderstand the word specification zDraw a picture zDerive a state diagram and Symbolic State Table zDetermine an implementation approach (e.g., gate logic, ROM, FPGA, etc.) zPerform STATE MINIMIZATION zPerform STATE ASSIGNMENT zMap Symbolic State Table to Encoded State Tables for implementation (INPUT and OUTPUT encodings)

CS Spring 2008 – Lec #24: Seq Logic Optimization - 3 Finite State Machine Optimization zState Minimization yFewer states require fewer state bits yFewer bits require fewer logic equations xIn general, one equation per output bit BUT xWhat counts are literals, not numbers of equations zEncodings: State, Inputs, Outputs yState encoding with fewer bits has fewer equations to implement xHowever, each may be more complex yState encoding with more bits (e.g., one-hot) has simpler equations xComplexity directly related to complexity of state diagram yInput/output encoding may or may not be under designer control

CS Spring 2008 – Lec #24: Seq Logic Optimization - 4 Input Next State Output SequencePresent StateX=0X=1X=0X=1 ResetS0S1S200 0S1S3S400 1S2S5S600 00S3S0S000 01S4S0S010 10S5S0S000 11S6S0S010 State Minimization Example zSequence Detector for 010 or 110 S0 S3 S2S1 S5S6S4 1/00/0 1/0 0/1 0/01/00/0 1/0 0/0 1/0 0/1 1/0 0/0 These two states must be identical – why?

CS Spring 2008 – Lec #24: Seq Logic Optimization - 5 Input Next State Output SequencePresent StateX=0X=1X=0X=1 ResetS0S1S200 0S1S3S400 1S2S5S600 00S3S0S000 01S4S0S010 10S5S0S000 11S6S0S010 State Minimization Example zSequence Detector for 010 or 110 S0 S3 S2S1 S5S6S4 1/00/0 1/0 0/1 0/01/00/0 1/0 0/0 1/0 0/1 1/0 0/0 States S3, S5 are identical because can’t detect from here, next step is always S0 States S4, S6 are identical because they detect on 0, next step is always S0

CS Spring 2008 – Lec #24: Seq Logic Optimization - 6 Input Next State Output SequencePresent StateX=0X=1X=0X=1 ResetS0S1S200 0S1S3/5S4/600 1S2S3/5S4/600 00/11S3/5S0S000 01/10S4/6S0S010 State Minimization Example zSequence Detector for 010 or 110 S0 S3/5 S2S1 S4/6 1/00/0 1/00/0 1/0 0/0 1/0 0/1 1/0 0/0 These states are identical – why?

CS Spring 2008 – Lec #24: Seq Logic Optimization - 7 Input Next State Output SequencePresent StateX=0X=1X=0X=1 ResetS0S1/2S1/200 0/1S1/2S3/5S4/600 00/11S3/5S0S000 01/10S4/6S0S010 State Minimization Example zSequence Detector for 010 or 110 S0 S3/5 S1/2 S4/6 0,1/0 1/0 0/0 1/0 0/1 1/0 0/0

CS Spring 2008 – Lec #24: Seq Logic Optimization - 8 Algorithmic Approach to State Minimization zGoal – identify and combine states that have equivalent behavior zEquivalent States: ySame output yFor all input combinations, states transition to same or equivalent states zAlgorithm Sketch y1. Place all states in one set y2. Initially partition set based on output behavior y3. Successively partition resulting subsets based on next state transitions y4. Repeat (3) until no further partitioning is required xstates left in the same set are equivalent yPolynomial time procedure (in size of state set)

CS Spring 2008 – Lec #24: Seq Logic Optimization - 9 Input Next State Output SequencePresent StateX=0X=1X=0X=1 ResetS0S1S200 0S1S3S400 1S2S5S600 00S3S0S000 01S4S0S010 10S5S0S000 11S6S0S010 State Minimization Example zSequence Detector for 010 or 110 S0 S3 S2S1 S5S6S4 1/00/0 1/0 0/1 0/01/00/0 1/0 0/0 1/0 0/1 1/0 0/0

CS Spring 2008 – Lec #24: Seq Logic Optimization - 10 ( S0 S1 S2 S3 S4 S5 S6 ) ( S0 S1 S2 S3 S5 ) ( S4 S6 ) ( S0 S3 S5 ) ( S1 S2 ) ( S4 S6 ) ( S0 ) ( S1 S2 ) ( S3 S5 ) ( S4 S6 ) Input Next State Output SequencePresent StateX=0X=1X=0X=1 ResetS0S1S200 0S1S3S400 1S2S5S600 00S3S0S000 01S4S0S010 10S5S0S000 11S6S0S010 S1 is equivalent to S2 S3 is equivalent to S5 S4 is equivalent to S6 Method of Successive Partitions

CS Spring 2008 – Lec #24: Seq Logic Optimization - 11 Input Next State Output SequencePresent StateX=0X=1X=0X=1 ResetS0S1'S1' S1'S3'S4'00 X0S3'S0S000 X1S4'S0S010 Minimized FSM zState minimized sequence detector for 010 or 110 S0 S1’ S3’ S4’ X/0 1/0 0/1 0/0 X/0 7 States reduced to 4 States 3 bit encoding replaced by 2 bit encoding

CS Spring 2008 – Lec #24: Seq Logic Optimization - 12 Another Example z4-Bit Sequence Detector: output 1 after each 4-bit input sequence consisting of the binary strings 0110 or 1010

CS Spring 2008 – Lec #24: Seq Logic Optimization - 13 State Transition Table zGroup states with same next state and same outputs S’ 10

CS Spring 2008 – Lec #24: Seq Logic Optimization - 14 Iterate the Row Matching Algorithm S’ 7

CS Spring 2008 – Lec #24: Seq Logic Optimization - 15 Iterate One Last Time S’ 3 S’ 4

CS Spring 2008 – Lec #24: Seq Logic Optimization - 16 Final Reduced State Machine 15 states (min 4 FFs) reduced to 7 states (min 3 FFs)

CS Spring 2008 – Lec #24: Seq Logic Optimization - 17 symbolic state transition table present next state output state S0S0S1S2S31 S1S0S3S1S40 S2S1S3S2S41 S3S1S0S4S50 S4S0S1S2S51 S5S1S4S0S50 inputs here More Complex State Minimization zMultiple input example S0 [1] S2 [1] S4 [1] S1 [0] S3 [0] S5 [0] 01

CS Spring 2008 – Lec #24: Seq Logic Optimization - 18 S0-S1 S1-S3 S2-S2 S3-S4 S0-S0 S1-S1 S2-S2 S3-S5 S0-S1 S3-S0 S1-S4 S4-S5 S0-S1 S3-S4 S1-S0 S4-S5 S1-S0 S3-S1 S2-S2 S4-S5 S4-S0 S5-S5 S1-S1 S0-S4 minimized state table (S0==S4) (S3==S5) present next state output state S0'S0'S1S2S3'1 S1S0'S3'S1S3'0 S2S1S3'S2S0'1 S3'S1S0'S0'S3'0 Minimized FSM zImplication Chart Method yCross out incompatible states based on outputs yThen cross out more cells if indexed chart entries are already crossed out S1 S2 S3 S4 S5 S0S1S2S3S4 present next state output state S0S0S1S2S31 S1S0S3S1S40 S2S1S3S2S41 S3S1S0S4S50 S4S0S1S2S51 S5S1S4S0S50

CS Spring 2008 – Lec #24: Seq Logic Optimization - 19 “Polynomial” Algorithm zn (n+1)/2 squares for n states zAt each iteration, must cross off at least one square, or done  ≤ n(n+1)/2 iterations at most zFilling out a square takes O(num input combinations)  Total Running time is O(n 2 * num input combinations) z“Polynomial”?...well yRepresentation of finite state machine is often log number of states x log number of input combinations yConsider a counter zAlgorithm is exponential in this representation

CS Spring 2008 – Lec #24: Seq Logic Optimization - 20 Minimizing Incompletely Specified FSMs zEquivalence of states is transitive when machine is fully specified zBut its not transitive when don't cares are present e.g.,stateoutput S0– 0S1 is compatible with both S0 and S2 S11 –but S0 and S2 are incompatible S2– 1 disagree in output 2 zNo polynomial time algorithm exists for determining best grouping of states into equivalent sets that will yield the smallest number of final states

CS Spring 2008 – Lec #24: Seq Logic Optimization - 21 XQ1Q0Q1+Q –1000XQ1Q0Q1+Q –1000 Q 1 + = X (Q 1 xor Q 0 ) Q 0 + = X Q 1 ’ Q 0 ’ Minimizing States May Not Yield Best Circuit zExample: edge detector - outputs 1 when last two input changes from 0 to 1 00 [0] 11 [0] 01 [1] X’ X X X

CS Spring 2008 – Lec #24: Seq Logic Optimization - 22 XQ1Q0Q1+Q –1000XQ1Q0Q1+Q –1000 Q 1 + = X (Q 1 xor Q 0 ) Q 0 + = X Q 1 ’ Q 0 ’ Edge Detector Implementation 00 [0] 11 [0] 01 [1] X’ X X X

CS Spring 2008 – Lec #24: Seq Logic Optimization - 23 Another Implementation of Edge Detector z"Ad hoc" solution - not minimal but cheap and fast 00 [0] 10 [0] 01 [1] X’X X X X 11 [0] X’

CS Spring 2008 – Lec #24: Seq Logic Optimization - 24 State Assignment zChoose bit vectors to assign to each “symbolic” state yWith n state bits for m states there are 2 n ! / (2 n – m)! [log n <= m <= 2 n ] y2 n codes possible for 1st state, 2 n –1 for 2nd, 2 n –2 for 3rd, … yHuge number even for small values of n and m xIntractable for state machines of any size xHeuristics are necessary for practical solutions yOptimize some metric for the combinational logic xSize (amount of logic and number of FFs) xSpeed (depth of logic and fanout) xDependencies (decomposition)

CS Spring 2008 – Lec #24: Seq Logic Optimization - 25 Key Idea Behind State Assignment zGoal is to minimize the logic realizing a state machine yBut we can’t generate logic and optimize (takes too long) yNeed to get a good proxy for logic complexity zKey insight: If state bits don’t change, don’t need logic yHow many bit changes in one-hot? zOne-hot encoding yOne AND gate per incoming edge to state yOne OR gate per state yLogic is cheap, but far too many bits (one per state!) zTherefore: minimize bit changes subject to number- of-state-bits constraint

CS Spring 2008 – Lec #24: Seq Logic Optimization - 26 Note minimize-changes heuristic doesn’t always work! zConsider a counter zCan get n bit changes (consider counting from -1 to 0) yLogic is very small zBut is generally a good proxy yKey: minimizing number of bit changes (usually) minimizes Karnaugh maps

CS Spring 2008 – Lec #24: Seq Logic Optimization - 27 State Assignment Strategies zPossible Strategies ySequential – just number states as they appear in the state table yRandom – pick random codes yOne-hot – use as many state bits as there are states (bit=1 –> state) yOutput – use outputs to help encode states yHeuristic – rules of thumb that seem to work in most cases zNo guarantee of optimality – another intractable problem

CS Spring 2008 – Lec #24: Seq Logic Optimization - 28 One-hot State Assignment zSimple yEasy to encode, debug zSmall Logic Functions yEach state function requires only predecessor state bits as input zGood for Programmable Devices yLots of flip-flops readily available ySimple functions with small support (signals its dependent upon) zImpractical for Large Machines yToo many states require too many flip-flops yDecompose FSMs into smaller pieces that can be one-hot encoded zMany Slight Variations to One-hot yOne-hot + all-0

CS Spring 2008 – Lec #24: Seq Logic Optimization - 29 State Maps and Counting Bit Changes Bit Change Heuristic S0S0 S1S1 S2S2 S3S3 S4S4 01 S0 -> S1: 2 1 S0 -> S2: 3 1 S1 -> S3: 3 1 S2 -> S3: 2 1 S3 -> S4: 1 1 S4 -> S1: 2 2 Total: 13 7

CS Spring 2008 – Lec #24: Seq Logic Optimization - 30 Equations for Each Assignment S0S0 S1S1 S2S2 S3S3 S4S4 01 State Equations: S 1 + = S 0 X’ + S 4 S 2 + = S 0 X, S 3 + =S 1 + S 2, S 4 + = S 3 Q 2 = S 1 + S 2 Q 1 = S 4 + S 2 + S 3 Q 0 = S 4 + S 2 + S 1 Assignment One: S0000 S1101 S2111 S3010 S4011 Q 2 = S 0 X’ + S 4 + S 0 X Q 1 = S 3 + S 2 + S 1 + S 0 X Q 0 = S 3 + S 0 X’ + S 4 + S 0 X Q 2 = Q 2 ’Q 1 ’Q 0 ’ + Q 2 ’Q 1 Q 0 Q 1 = Q 2 ’Q 1 Q 0 ’ + Q 2 Q 1 Q 0 + Q 2 Q 1 ’Q 0 + Q 2 ’Q 1 ’Q 0 ’ X Q 0 = Q 2 ’Q 1 Q 0 ’ + Q 2 ’Q 1 ’Q 0 ’ + Q 2 ’Q 1 Q 0

CS Spring 2008 – Lec #24: Seq Logic Optimization - 31 Karnaugh Maps Q1Q0Q1Q0 XQ 2 Q1Q Q1Q0Q1Q0 Q2Q2 Q0Q Q1Q0Q1Q0 Q2Q2 Q2Q2 Q 2 = Q 2 ’Q 1 ’Q 0 ’ + Q 2 ’Q 1 Q 0 Q 1 = Q 2 ’Q 1 Q 0 ’ + Q 2 Q 1 Q 0 + Q 2 Q 1 ’Q 0 + Q 2 ’Q 1 ’Q 0 ’ X Q 0 = Q 2 ’Q 1 Q 0 ’ + Q 2 ’Q 1 ’Q 0 ’ + Q 2 ’Q 1 Q 0

CS Spring 2008 – Lec #24: Seq Logic Optimization - 32 Equations for Each Assignment S0S0 S1S1 S2S2 S3S3 S4S4 01 State Equations: S 1 + = S 0 X’ + S 4 S 2 + = S 0 X, S 3 + =S 1 + S 2, S 4 + = S 3 Q 2 = S 4 Q 1 = S 4 + S 2 + S 3 Q 0 = S 4 + S 3 + S 1 Assignment Two: S0000 S1001 S2010 S3011 S4111 Q 2 = S 3 Q 1 = S 3 + S 2 + S 1 + S 0 X Q 0 = S 3 + S 2 + S 1 + S 4 + S 0 X Q 2 = Q 2 ’Q 1 Q 0 Q 1 = Q 2 ’Q 1 Q 0 + Q 2 ‘Q 1 Q 0 ’ + Q 2 ’Q 1 ’Q 0 + Q 2 ’Q 1 ’Q 0 ’ X Q 0 = Q 2 ’Q 1 Q 0 + Q 2 ’Q 1 Q 0 ’ + Q 2 ’Q 1 ’Q 0 + Q 2 Q 1 Q 0 + Q 2 ’Q 1 ’Q 0 ’ X

CS Spring 2008 – Lec #24: Seq Logic Optimization - 33 Karnaugh Maps Q1Q0Q1Q0 XQ 2 Q1Q Q1Q0Q1Q0 Q2Q2 Q2Q2 Q 2 = Q 2 ’Q 1 Q 0 Q 1 = Q 2 ’Q 1 Q 0 + Q 2 ‘Q 1 Q 0 ’ + Q 2 ’Q 1 ’Q 0 + Q 2 ’Q 1 ’Q 0 ’ X Q 0 = Q 2 ’Q 1 Q 0 + Q 2 ’Q 1 Q 0 ’ + Q 2 ’Q 1 ’Q 0 + Q 2 Q 1 Q 0 + Q 2 ’Q 1 ’Q 0 ’ X Q1Q0Q1Q0 XQ 2 Q0Q0

CS Spring 2008 – Lec #24: Seq Logic Optimization - 34 IQQ+OiacjibckIQQ+Oiacjibck IQQ+OiabjkaclIQQ+Oiabjkacl IQQ+OiabjicdjIQQ+Oiabjicdj c = i * a + i * b b = i * a c = k * a j = i * a + i * c b = i * a d = i * c i / j i / k a b c a bc i / j k / l bd i / j a c Adjacency Heuristics for State Assignment zAdjacent codes to states that share a common next state yGroup 1's in next state map zAdjacent codes to states that share a common ancestor state yGroup 1's in next state map zAdjacent codes to states that have a common output behavior yGroup 1's in output map

CS Spring 2008 – Lec #24: Seq Logic Optimization - 35 Heuristics for State Assignment Successor/Predecessor Heuristics z High Priority: S’ 3 and S’ 4 share common successor state (S 0 ) z Medium Priority: S’ 3 and S’ 4 share common predecessor state (S’ 1 ) z Low Priority: y0/0: S 0, S’ 1, S’ 3 y1/0: S 0, S’ 1, S’ 3, S’ 4

CS Spring 2008 – Lec #24: Seq Logic Optimization - 36 Heuristics for State Assignment

CS Spring 2008 – Lec #24: Seq Logic Optimization - 37 Another Example High Priority: S’ 3, S’ 4 S’ 7, S’ 10 Medium Priority: S 1, S 2 2 x S’ 3, S’ 4 S’ 7, S’ 10 Low Priority: 0/0: S 0, S 1, S 2, S’ 3, S’ 4, S’ 7 1/0: S 0, S 1, S 2, S’ 3, S’ 4, S’ 7, S 10

CS Spring 2008 – Lec #24: Seq Logic Optimization - 38 Example Continued z Choose assignment for S0 = 000 z Place the high priority adjacency state pairs into the State Map z Repeat for the medium adjacency pairs z Repeat for any left over states, using the low priority scheme Two alternative assignments at the left

CS Spring 2008 – Lec #24: Seq Logic Optimization - 39 Why Do These Heuristics Work? zAttempt to maximize adjacent groupings of 1’s in the next state and output functions

CS Spring 2008 – Lec #24: Seq Logic Optimization - 40 General Approach to Heuristic State Assignment zAll current methods are variants of this y1) Determine which states “attract” each other (weighted pairs) y2) Generate constraints on codes (which should be in same cube) y3) Place codes on Boolean cube so as to maximize constraints satisfied (weighted sum) zDifferent weights make sense depending on whether we are optimizing for two-level or multi-level forms zCan't consider all possible embeddings of state clusters in Boolean cube yHeuristics for ordering embedding yTo prune search for best embedding yExpand cube (more state bits) to satisfy more constraints

CS Spring 2008 – Lec #24: Seq Logic Optimization - 41 Output-Based Encoding zReuse outputs as state bits - use outputs to help distinguish states yWhy create new functions for state bits when output can serve as well yFits in nicely with synchronous Mealy implementations HG = ST’ H1’ H0’ F1 F0’ + ST H1 H0’ F1’ F0 HY = ST H1’ H0’ F1 F0’ + ST’ H1’ H0 F1 F0’ FG = ST H1’ H0 F1 F0’ + ST’ H1 H0’ F1’ F0’ HY = ST H1 H0’ F1’ F0’ + ST’ H1 H0’ F1’ F0 Output patterns are unique to states, we do not need ANY state bits – implement 5 functions (one for each output) instead of 7 (outputs plus 2 state bits) InputsPresent StateNext StateOutputs CTLTSSTHF 0––HGHG00010 –0–HGHG –HGHY10010 ––0HYHY00110 ––1HYFG –FGFG ––FGFY –1–FGFY ––0FYFY ––1FYHG110 01

CS Spring 2008 – Lec #24: Seq Logic Optimization - 42 Current State Assignment Approaches zFor tight encodings using close to the minimum number of state bits yBest of 10 random seems to be adequate (averages as well as heuristics) yHeuristic approaches are not even close to optimality yUsed in custom chip design zOne-hot encoding yEasy for small state machines yGenerates small equations with easy to estimate complexity yCommon in FPGAs and other programmable logic zOutput-based encoding yAd hoc - no tools yMost common approach taken by human designers yYields very small circuits for most FSMs

CS Spring 2008 – Lec #24: Seq Logic Optimization - 43 Sequential Logic Implementation Summary zImplementation of sequential logic yState minimization yState assignment zImplications for programmable logic devices yWhen logic is expensive and FFs are scarce, optimization is highly desirable (e.g., gate logic, PLAs, etc.) yIn Xilinx devices, logic is bountiful (4 and 5 variable TTs) and FFs are many (2 per CLB), so optimization is not so crucial an issue as in other forms of programmable logic yThis makes sparse encodings like One-Hot worth considering