Lecture 13 State Minimization of Sequential Machines

download Lecture 13 State Minimization of Sequential Machines

of 42

description

State Reduction

Transcript of Lecture 13 State Minimization of Sequential Machines

Number Systems and Codes

VLSI Circuits & Systems

Lecture 13State Minimization of Sequential Machines2State Minimization

State machines may contain redundant states, i.e. states whose function can be accomplished by other states.

State minimization is the transformation of a given machine into an equivalent machine with no redundant states.Removal of redundant states is important becauseCost: the number of memory elements is directly related to the number of statesComplexity: the more states the circuit contains, the more complex the design and implementation becomesAids failure analysis: diagnostic routines are often predicated on the assumption that no redundant states existState Minimization Procedure3If Si and Sj are equivalent states, their corresponding X-successors, for all X, are also equivalent: since otherwise it would be trivial to construct a distinguishing sequence for (Si,Sj) by first applying an input sequence that transfers the machine to the distinguishable successors of Si and SjExample: For machine M1P0, P1: 0-distinguishable, 1-distinguishableP2: two states placed in the same block if and only if they are in the same block of P1, and for each possible Ii, their Ii-successor is also contained in a common block of P10- and 1-successor of (ACE): (CE), (BDF)Since both are contained in common blocks of P1: states in (ACE) are 2-equivalent0- and 1-successor of (BDF): (FB), (DBC)Since (DB) and (C) are not contained in a single block of P1: (BDF) must be split into (BD) and (F), and so onSince P3 = P4: P3 is the equivalence partitionMachine M1

3Equivalence PartitionIf Pn = Pn+1, i.e. next partition is same as present partition, then all states contained in same class of Pn are equivalent. Pn is called equivalence partition.Theorems5Theorem 10.1: The equivalence partition is uniqueProof: Suppose there exist two partitions, Pa and Pb, and that Pa /= Pb.Then there exist two states, Si and Sj, which are in the same block of one partition and not in the same block of the otherPa = (S1,S2)(S3, Si, Sj) (Sk)Pb = (S1,S2) (S3, Si) (Sj) (Sk)Since Si and Sj are in different blocks of (say) Pb, there exists at least one input sequence which distinguishes Si from Sj and, therefore, cannot be in the same block of Pa5Theorems6Theorem 10.2: If two states, Si and Sj, of machine M of n states are distinguishable, then they are distinguishable by a sequence of length n-1 or smallerProof: P1 contains at least two blocks, else M is reducible to a combinational circuit with a single stateAt each step, partition Pk+1 is smaller than or equal to PkIf Pk+1 is smaller than Pk, then it contains at least one more block than PkHowever, since the number of blocks is limited to n, at most n-1 partitions can be generatedThus, if Si and Sj are distinguishable, they are distinguishable by a sequence of length n-1 or smaller6Two machines, M1 and M2, are said to be equivalent if and only if, for every state in M1, there is a corresponding state in M2, and vice versaThe machine that contains no equivalence states and is equivalent to M is called the minimal, or reduced, form of M

Example: Machine M1 Machine M1*

Machine Equivalence7

7Machine Equivalence (Contd.)8Example: Machine M2 Machine M2

8Determine the minimal state table equivalent to the following:

Determine the minimal state table equivalent to the following one.

P0 = (ABCDEFGH)P1 = (ACGH)(BDE)(F)

P2=(AH)(CG)(BDE)(F)

P3 = (AH)(CG)(BDE)(F)

(AH)A, (BDE)B, (CG)C, (F) F

Find the shortest input sequence that takes the machine from state A to state G. State table is given below.

Incompletely Specified MachinesNext states and/or outputs are not specified for all statesApplicable input sequences: an input sequence is applicable to state, Si, of an incompletely specified circuit if and only if when the circuit is in state Si and the input sequence is applied, all next states are specified except for possible the last input of the sequence.Compatible states: two states Si and Sj are compatible if and only if for each input sequence applicable to both states the same output sequence will be produced when the outputs are specified.Compatible states: two states Si and Sj are compatible if and only if the following conditions are satisfied for any possible input IpThe outputs produced by Si and Sj are the same, when both are specifiedThe next states Sk and Sl are compatible, when both are specified.Incompatible states: two states are said to be incompatible if they are not compatible.

Compatibility RelationsCompatibility relation: let R be a relation on a set S. R is a compatibility relation on S if and only if it is reflexive and symmetric. A compatibility relation on a set partitions the set into compatibility classes. They are typically not disjoint.Example: let S = {A,B,C,D,E} and R = {A,A),(B,B),(C,C),(D,D),(E,E),(A,B),(B,A),(A,C),(C,A), (A,D), (D,A),(A,E),(E,A),(B,D),(D,B),(C,D),(D,C),(C,E),(E,C)}Then the compatibility classes are (AB)(AC)(AD)(AE)(BD)(CD)(CE)(ABD)(ACD)(ACE)The incompatibility classes are (BC)(BE)(DE)Compatible pairs may be found using implication tablesMaximal compatibles may be found using merger diagrams

Nonuniqueness of Reduced Machines24Example: Machine M4

If we replace both dashes by 1s: A and B become equivalentIf we replace both dashes by 0s: States A and E become equivalent; also, B, C, and D become equivalent

Both reduced machines cover M4: thus reduced machines are nonuniqueStates A and B of M4 are compatible, C and D are also compatible, so are A and E. However, B and E are 1-distinguishable, hence incompatible: thus compatibility relation is not an equivalence relation

2425Implication Table MethodThe implication table method of determining state equivalence can be summarized as follows:1. Construct a chart which contains a square for each pair of states.

2. Compare each pair of rows in the state table. If the outputs associated with states i and j are different, place an X in square i-j to indicate that i j. If the outputs are the same, place the implied pairs in square i-j. (If the next states of i and j are m and n for some input x, then m-n is an implied pair.) If the outputs and next states are the same (or if i-j only implies itself), place a check () in square i-j to indicate that i j.

2526Implication Table Method3.Go through the table square-by-square. If square i-j contains the implied pair m-n, and square m-n contains an X, then i j, and an X should be placed in square i-j.4.If any Xs were added in step 3, repeat step 3 until no more Xs are added.5.For each square i-j which does not contain an X, i j.26Merger Table27Merger table: more convenient alternative to the merger graph

Example: Machine M8 Merger table

27Finding the Set of Maximal Compatibles28Tabular counterpart to finding complete polygons in the merger graph:Start in the rightmost column of the merger table and proceed left until a column containing a compatible pair is encountered list all compatible pairs in that columnProceed left to the next column containing at least one compatible pair. If the state to which this column corresponds is compatible with all members of some previously determined compatible, add this state to that compatible to form a larger compatible. If the state is not compatible with all members, but is compatible with some, form a new compatible that includes those members and the state in question. Next, list all compatible pairs not included in any previously derived compatibleRepeat step 2 until all columns have been considered. The final set of compatibles constitutes the set of maximal compatibles28Maximal Compatibles (Contd.)29Example:

Set of maximal compatibles indicates that M8 can be covered by a four-state machine, but not by a two-state machine

Column E: (EF)Column D: (EF), (DE)Column C: (CEF), (CDE)Column B: (CEF), (CDE), (BC)Column A: (CEF), (CDE), (ABC), (AF)2930Implication Table Method / Merger Table method

a b iffd f andc ha d iffa d andc e3031Implication Chart

3132Implication Chart

3233Implication Chart

3334Determination of Equivalent States

d is replaced with ae is replaced with cd and e are removed34Minimize the machine using implication table method.Prepared by Shiraz HusainN.S.PSX=0X=1OUTPUTAEE1BCE1CIH0DHA1EIF0FEG0GHB1HCD0IFB1Prepared by Shiraz HusainBE-CCxDE-HE-AExFxGE-HE-BHxIE-FE-BABCDEFGHMinimize the machine using implication table method.Prepared by Shiraz HusainN.S.PSX=0X=1AF,0B,0BF,0G,0CC,0G,0DA,1B,0EE,0D,0FA,0B,0GF,1B,0DifferencesPrepared by Shiraz HusainCSMICSMReduced machine is unique.Reduced machine is not unique.Classes of partition have no common state.Subsets of compatibles may be overlapping.Merger graph of an n-state machine M is an undirected graph defined as follows:It consists of n vertices, each of which corresponds to a state of MFor each pair of states (SiSj) in M, whose next-state and output entries are not conflicting, an undirected arc is drawn between vertices Si and SjIf, for a pair of states (SiSj), the corresponding output symbols under all input symbols are not conflicting, but the successors are not the same, an interrupted arc is drawn between Si and Sj, and the implied pairs are entered in the spaceExample: Machine M6 Merger graph

Nine compatible pairs: (AB), (AC), (AD), (BC), (BD), (BE), (CD), (CF), (EF)Set of maximal compatibles: {(ABCD), (BE), (CF), (EF)} complete polygonsMerger Graph39

39Closed Sets of Compatibles40A set of compatibles for machine M is said to be closed if: for every compatible contained in the set, all its implied compatibles are also contained in the setA closed set of compatibles, which contains all states of M, is called a closed coveringExample: {(ABCD), (EF)} has the minimal number of compatibles covering all states of M6It defines a lower bound on the number of states in the minimal machine that covers M6However, if we select maximal compatible (ABCD) to be a state in the reduced machine: then its I2- and I3-successors, (CF) and (BE), must also be selected since these are not in the above set, set {(ABCD), (EF)} cannot be used to define the states of a minimal machine for M6

40Closed Covering41Example (contd.): Closed covers:{(AD), (BE), (CF)}{(AB), (CD), (EF)}

Closed covering is not uniqueAim is to find a closed covering that with a minimum number of compatiblesSet of all maximal compatibles: clearly a closed coveringThis defines an upper bound on the number of states in the machine that covers the original one:The upper bound is meaningless when the number of maximal compatibles is larger than the number of states in the original machineFor the example: the lower bound is 2 and upper bound 4Thus, a closed covering with three compatibles defines a minimal machine

41Compatibility Graph42Compatibility graph: a directed graph whose vertices correspond to all compatible pairs, and an arc leads from (SiSj) to (SpSq) if and only if (SiSj) implies (SpSq)Example: Machine M7 Merger graph Compatibility graph

A subgraph of the compatibility graph is closed: if, for every vertex in the subgraph, all outgoing arcs and their terminating vertices also belong to itIf every state of the machine is covered by at least one vertex of the subgraph: then the subgraph forms a closed covering{(BC), (AD), (BE)}; {(AC), (BC), (AD), (BE)}; {(DE), (BC), (AD), (BE)}

Minimal machine42Maximal Compatibles (Contd.)43Example (contd.): Compatibility graph

Add (AB) to closed subgraph {(AC), (BC), (EF), (CD)}Reduces to the following closed covering: {(ABC), (CD), (EF)}Minimal machine:

43text

BC,DE

AB,DF

BD

BC,CD

CD,CF

AC,EF

EF

DE

EF

B

BC

E

D

C

B

A

F

E

D

C

text

BC,DE

AB,DF

BD

BC,CD

CD,CF

AC,EF

EF

DE

EF

B

BC

E

D

C

B

A

F

E

D

C

C

(AB)(CD)

D

(BE)

(CE)

(CF)

(EF)

E

B

A

F

C

(AB)(CD)

D

(BE)

(CE)

(CF)

(EF)

E

B

A

F

C

(AB)(CD)

D

(BE)

(CE)

(CF)

(EF)

E

B

A

F

C

(AD)

(BC)(AB)

D

(BC)

(CE)

(BC)

(AE)

(DE)

(BE)

E

B

A

(AD)

(BC)

(AC)

(CD)

(DE)

(BE)

(CF)

(BC)

(AC)

(CD)

(DE)

(AF)

(AB)

(EF)

(CE)