State Minimization: Completely Specified Machines - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

State Minimization: Completely Specified Machines

Description:

Title: Multi-Valued Logic Synthesis Author: CAD Group Last modified by: CAD Group Created Date: 12/15/1998 12:24:32 AM Document presentation format – PowerPoint PPT presentation

Number of Views:77
Avg rating:3.0/5.0
Slides: 28
Provided by: CADG5
Category:

less

Transcript and Presenter's Notes

Title: State Minimization: Completely Specified Machines


1
State MinimizationCompletely Specified Machines
  • STGs 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.

2
State MinimizationCompletely Specified Machines
  • Two states, si and sj of machine M are
    distinguishable if and only if there exists a
    finite input sequence which when applied to M
    causes different output sequences depending on
    whether M started in si or sj.
  • Such a sequence is called a distinguishing
    sequence for (si, sj).
  • If there exists a distinguishing sequence of
    length k for (si, sj), they are said to be
    k-distinguishable.

3
State MinimizationCompletely Specified Machines
  • Example
  • states A and B are 1-distinguishable, since a 1
    input applied to A yields an output 1, versus an
    output 0 from B.
  • states A and E are 3-distinguishable, since input
    sequence 111 applied to A yields output 100,
    versus an output 101 from E.

4
Completely Specified Machines
States si and sj (si sj ) are said to be
equivalent iff no distinguishing sequence exists
for (si, sj ).
  • If si sj and sj sk, then si sk. So state
    equivalence is an equivalence relation (i.e. it
    is a reflexive, symmetric and transitive
    relation).
  • An equivalence relation partitions the elements
    of a set into equivalence classes.
  • Property If si sj, their corresponding
    X-successors, for all inputs X, are also
    equivalent.
  • Procedure Group states of M so that two states
    are in the same group iff they are equivalent
    (forms a partition of the states).

5
Completely Specified Machines
  • Pi partition using distinguishing sequences of
    length i.
  • Partition Distinguishing Sequence
  • P0 (A B C D E F)
  • P1 (A C E)(B D F) x 1
  • P2 (A C E)(B D)(F) x 1 x 1
  • P3 (A C)(E)(B D)(F) x 1 x 1 x 1
  • P4 (A C)(E)(B D)(F)
  • Algorithm terminates when Pk PK1

6
Completely Specified Machines
  • Outline of state minimization procedure
  • All states equivalent to each other form an
    equivalence class. These may be combined into
    one state in the reduced (quotient) machine.
  • Start an initial partition of a single block.
    Iteratively refine this partition by separating
    the 1-distinguishable states, 2-distinguishable
    states and so on.
  • To obtain Pk1, for each block Bi of Pk, create
    one block of states that not 1-distinguishable
    within Bi , and create different blocks states
    that are 1-distinguishable within Bi .

7
Completely Specified Machines
Theorem The equivalence partition is unique.
  • Theorem If two states, si and sj, of machine M
    are distinguishable, then they are (n-1
    )-distinguishable, where n is the number of
    states in M.
  • Definition Two machines, M1 and M2, are
    equivalent (M1 M2 ) iff, for every state in M1
    there is a corresponding equivalent state in M2
    and vice versa.
  • Theorem. For every machine M there is a minimum
    machine Mred M.
  • Mred is unique up to isomorphism.

8
Completely Specified Machines
  • Reduced machine obtained from previous example

P4 (A C)(E)(B D)(F) ? ? ? ?
9
State Minimization of CSMs Complexity
  • Algorithm DFA DFAmin
  • Input A finite automaton M (Q, ?, ?, q 0, F )
    with no unreachable states.
  • Output A minimum finite automaton M (Q, ?,
    ?, q 0, F ).
  • Method
  • 1. t 2 Q0 undefined Q1F Q2 Q\F.
  • 2. while there is 0 lt i ? t, a ? ? with ?(Qi,a) ?
    Qj, for all j ? t
  • do (a) Choose such an i, a , and j ? t with ?
    (Qi,a) ? Qj ? ?.
  • (b) Qt 1 q ? Qi ? (q,a) ? Qj
  • Qi Qi \ Qt 1
  • t t 1.
  • end.

10
State Minimization of CSMs Complexity
  • 3. ( Denote
  • q the equivalence class of state q , and
    Qi the set of all equivalence classes.
  • )
  • Q Q1, Q2, ..., Qt .
  • q 0 q0.
  • F q ? Q q ? F .
  • ? ( q, a) ?(q,a) for all q ? Q, a ? ?.

11
State Minimization of CSMs Complexity
Standard implementation O (kn 2), where n Q
and k ?
  • Modification of the body of the while loop
  • 1. Choose such an i, a ? ?, and choose j1,j2 ? t
    with j1 ? j2, ? (Qi,a) ? Qj1 ? ?, and ?
    (Qi,a) ? Qj2 ? ?.
  • 2. If q ? Qi ?(q,a) ? Qj1 ? q ? Qi
    ?(q,a) ? Qj2
  • then Qt 1 q ? Qi ?(q,a) ? Qj1
  • else Qt 1 q ? Qi ?(q,a) ? Qj2 fI
  • Qi Qi \ Qt1
  • t t 1.
  • (i.e. put smallest set in t 1 )

12
State Minimization of CSMs Complexity
Note Qt 1 ? 1/2Qi. Therefore, for all q ?
Q, the name of the class which contains a given
state q changes at most log(n ) times.
  • Goal Develop an implementation such that all
    computations can be assigned to transitions
    containing a state for which the name of the
    corresponding class is changed.
  • Suitable data structures achieve an O (kn log n)
    implementation.
  • Details in N. Blum IPL 96
  • Originial O (kn log n) algorithm in Hopcroft
    1971

13
State Minimization of CSMs BDD Implementation
  • X and Y are spaces of all states
  • S
  • E0(x,y) ? (xi yi) (initially all states
    are equivalent)
  • i1
  • Ej 1(x,y)
  • Ej (x,y) ? ?i ?(o,z,w )
  • T (x,i,z,o ) ?T (y,i,w,o ) ?Ej (z,w )
  • (i.e. states x,y continue to be equivalent if
    they are j - equivalent and for
    all inputs the next states are j -
    equivalent )

14
State MinimizationIncompletely Specified
Machines
  • Statement of the problem given an incompletely
    specified machine M, find a machine M such that
  • on any input sequence, M produces the same
    outputs as M, whenever M is specified.
  • there does not exist a machine M with fewer
    states than M which has the same property.

15
State MinimizationIncompletely Specified
Machines
  • Machine M

PS NS, z x0 x1 s1 s3, 0 s2, 0 s2 s2, - s3,
0 s3 s3, 1 s2, 0
  • Attempt to reduce this case to usual state
    minimization of completely specified machines.
  • Brute Force Method Force the dont cares to all
    their possible values and choose the smallest of
    the completely specified machines so obtained.
  • In this example, it means to state minimize two
    completely specified machines obtained from M, by
    setting the dont care to either 0 and 1.

16
State MinimizationIncompletely Specified
Machines
  • Suppose that the - is set to be a 0.
  • Machine M

States s1 and s2 are equivalent if s3 and s2 are
equivalent, but s3 and s2 assert different
outputs under input 0, so s1 and s2 are not
equivalent. States s1 and s3 are not equivalent
either. So this completely specified machine
cannot be reduced further (3 states is the
minimum).
17
Incompletely Specified Machines
Suppose that the - is set to be a 1. Machine M
States s1 is incompatible with both s2 and
s3. States s3 and s2 are equivalent. So number of
states is reduced from 3 to 2. Machine Mred
18
State MinimizationIncompletely Specified
Machines
Can this always be done? Machine M
19
State MinimizationIncompletely Specified
Machines
Machine M2
Machine M3
Machine M2 and M3 are formed by filling in the
unspecified entry in M with 0 and 1,
respectively. Both machines M2 and M3 cannot be
reduced. Conclusion? M cannot be minimized
further! But is it a correct conclusion?
20
State MinimizationIncompletely Specified
Machines
Note that we want to merge two states when,
for any input sequence, they generate the same
output sequence, but only where both outputs are
specified. Definition A set of states is
compatible if they agree on the outputs where
they are all specified. Machine M
In this case we have two compatible sets A
(s1, s2) and B (s3, s2). A reduced
machine Mred can be built as follows. Machine
Mred
21
Incompletely Specified Machines
Can we simply look for a set of compatibles of
minimum cardinality, such that every original
state is in at least one compatible? (This would
be nice since it would lead to a simple unate
covering problem.) No. To build a reduced
machine we must be able to send compatibles into
compatibles. So choosing a given compatible may
imply that some other compatibles must be chosen
too.
22
Incompletely Specified Machines
A set of compatibles that cover all states is
(s3s6), (s4s6), (s1s6), (s4s5), (s2s5). But
(s3s6) requires (s4s6), (s4s6) requires(s4s5),
(s4s5) requires (s1s5), (s1s6) requires
(s1s2), (s1s2) requires (s3s6), (s2s5)
requires (s1s2). So, this selection of
compatibles requires too many other compatibles...
23
Incompletely Specified Machines
PS NS, z I1 I2 I3 I4 s1 s3,0 s1,- - - s2 s6,-
s2,0 s1,- - s3 -,1 -,- s4,0 - s4 s1,0 -,- - s5,1
s5 -,- s5,- s2,1 s1,1 s6 -,- s2,1 s6,- s4,1
Another set of compatibles that covers all states
is (s1s2s5), (s3s6), (s4s5). But (s1s2s5)
requires (s3s6) (s3s6) requires (s4s6) (s4s6)
requires (s4s5) (s4s5) requires (s1s5). So
must select also (s4s6) and (s1s5). Selection of
minimum set is a binate covering problem !!!
24
Incompletely Specified Machines
More formally When a next state is unspecified,
the future behavior of the machine is
unpredictable. This suggests the definition of
admissible input sequence.
  • Definition. An input sequence is admissible, for
    a starting state of a machine if no unspecified
    next state is encountered, except possibly at the
    final step.
  • Definition. State si of machine M1 is said to
    cover, or contain, state sj of M2 provided
  • every input sequence admissible to sj is also
    admissible to si , and
  • its application to both M1 and M2 (initially is
    si and sj, respectively) results in identical
    output sequences whenever the outputs of M2 are
    specified.

25
State MinimizationIncompletely Specified
Machines
  • Definition. Machine M1 is said to cover machine
    M2 iff
  • for every state sj in M2, there is a
    corresponding state si in M1 such that si covers
    sj.
  • The problem of state minimization for an
    incompletely specified machine M is
  • find a machine M which covers M such that for
    any other machine M covering M, the number of
    states of M does not exceed the number of
    states of M.

26
Short summary of rest of section
  • Definition of compatible states
  • Method to compute when two states are
    incompatible
  • Definition of maximal compatible sets
  • A set is compatible iff all pairs in the set are
    compatible
  • Definition of prime compatibles
  • Solve Quine-McCluskey type problem
  • Generate all prime compatibles
  • Solve binate covering problem
  • We will not go into the details of this. See book
    Kam, Villa, Brayton, Sangiovanni, xxx

27
End of section
28
State MinimizationIncompletely Specified
Machines
Machine M
Machine M
State A of M covers states s1 and s2 of M and
state B of M covers states s2 and s3 of M.
Therefore M covers M. Note that M started in s1
under input sequence 1 0 0 generates 0 - -, while
M started in A under input sequence 1 0 0
generates 0 0 1. The output generated by M
corresponding to the dont care entry in M is not
always the same !!!
29
State MinimizationIncompletely Specified
Machines
Machine M2
Machine M3
M2 and M3 are formed by filling in the
unspecified entry in M with 0 and 1,
respectively, Neither state A nor B of M covers
state s2 of M2 or M3 and hence M would not cover
M2 or M3.
30
State MinimizationIncompletely Specified
Machines
Definition Let M can be covered by M containing
fewer states. A set of states of M covered by the
same state of M, is called a compatible
set. Intuitively the states in a compatible set
can be combined into a single state in the
reduced machine. Definition States si and sj
are compatible iff they never generate different
specified output sequences for any admissible
input sequence. Example
(A C ) is a compatible pair. (A D ) is a
compatible pair if and only if (B E ) is a
compatible pair. (A C D ) is a compatible set.
31
State MinimizationIncompletely Specified
Machines
  • A set of states is compatible if and only if
    every pair of states in that set is compatible.
  • (B C ) is a compatible pair, (AC ) is a
    compatible pair, but (AB ) is not compatible
    pair, so (A B C ) is not a compatible set.
  • The compatibility relation is not an equivalence
    relation!

32
State MinimizationIncompletely Specified
Machines
  • Compatible sets are those sets of states that do
    not contain any incompatible pair of states.
  • States si and sj are incompatible iff they are
    not compatible.
  • Definition States si and sj are output
    incompatible iff ?ik, ?(ik,si) ? ?(ik,sj), if
    both ? are specified.
  • The set of all pairs of incompatible states can
    be computed as follows
  • Compute output incompatible pairs.
  • Add any pair of states (si,sj) if
  • ?ik such that (?(ik,si ), ?(ik,sj))
  • is a previously determined incompatible pair of
    states.
  • Repeat 2 until no new pairs can be added to the
    incompatible state pairs set.

33
State MinimizationIncompletely Specified
Machines
Example
Compatibles C1 (BE), C2 (AD), C3 (CD), C4
(BC), C5 (ACD), C6 (DE),
C7 (AC), C8 (A), C9 (B), C10 (C), C11
(D), C12 (E).
34
State MinimizationIncompletely Specified
Machines
  • A class of compatibles is of special interest
    maximal compatibles.
  • Definition A sets of compatible states which is
    not a subset of any other compatible set of
    states is called a maximal compatibles.
  • In the case of completely specified machines,
    each equivalence class is a maximal compatible.
  • Maximal compatibles of previous example
  • (BE), (BC), (ACD), (DE).
  • If machine M is to be reduced to M
  • The states of M must correspond to compatible
    sets of states of M.
  • If a state of M corresponds to a compatible set
    Ci, then the next state of M under input Ij
    must correspond to some compatible set Cm such
    that the next state entries in M under Ij of all
    states in Cj are contained in Cm. (Why is this?)

35
State MinimizationIncompletely Specified
Machines
Definition Ci is a set of compatible states
and Cij sk sk ?(Ij, si ), and si ? Ci
i.e. Cij is the set of next states of the
states in Ci for input Ij, Cij is said to be
implied by the set Ci for input Ij. Definition
Let Ci be a compatible set of states and Cij be
the set of next states implied by Ci for input
Ij Cij sk sk ?(Ij, sl ), and sl ? Ci
The sets Cij implied by Ci for all inputs Ii
are the implied classes of Ci. Definition A
set of compatible sets C C1, C2, is closed
if for every Ci ? C all the implied sets Cij are
contained in some element of C for all inputs Ij.
36
State MinimizationIncompletely Specified
Machines
Minimizing the number of states find a closed
set C of compatible states, of minimum
cardinality, which covers every state of the
original machine, i.e. a minimum closed cover.
Note 1. The set of all maximal compatibles of a
completely specified FSM is the unique minimum
closed cover. 2. For an incompletely specified
FSM, a closed cover consisting of maximal
compatibles only, may be a larger cover than a
closed cover in which some or all of the
compatibles are not maximal. This is because each
compatible has a different set of implied
compatibles, and removing a state from a
compatible may result in an implied compatible
that is already there, rather than a new
one. This means that we may have to search over
the set of all compatibles to find the minimum
cover.
37
State MinimizationIncompletely Specified
Machines
But the set of all compatibles is a very large
set. Is there a smaller set of compatibles
(larger than the set of all maximal compatibles)
that guarantees finding a minimum closed cover?
Yes, Prime compatibles (Grasselli and Luccio,
1965) Definition A compatible set of states
that is not dominated by any other compatible
set is called a prime compatible set. Definition
similar to that for prime implicants of logic
functions. Of course here one must specify what
is meant by dominance of a compatible.
38
State MinimizationIncompletely Specified
Machines
Let Ci be a compatible set of states, and Cij be
the set of next states implied by Ci for input Ij
.
Definition The class set Pi implied by Ci is
the set of all Cij implied by Ci for all inputs
Ij such that 1. Cij has more than one element 2.
Cij ? Ci 3. Cij ? Cik if Cik ? Pi Definition A
compatible Ci dominates a compatible Cj if 1. Ci
? Cj, and 2. Pi ? Pj i.e. Ci dominates Cj if Ci
covers all states covered by Cj and the
conditions on the closure of Cj are a subset of
the conditions on the closure of Cj. Definition
A compatible set of states that is not dominated
by any other compatible set is called a prime
compatible set.
39
Edited to here
40
State MinimizationIncompletely Specified
Machines
Example
Prime compatibles and respective class sets
p1 (BE), (CB) p2 (AD), (BE) p3
(CD), (ED) p4 (BC), (DA) p5
(ACD), (ED)(BE) p6 (DE), (BC) p7
(AC), p9 (B), p11 (D), p12
(E),
41
State MinimizationIncompletely Specified
Machines
The following procedure computes all prime
compatibles. At the beginning, the set of prime
compatibles is empty.
1. Order the maximal compatibles by decreasing
size, say n is the size of the largest. 2. Add to
the set of prime compatibles the maximal
compatibles of size n. 3. For i1 to n-1 (a)
Generate all compatibles of size n-i and compute
their implied classes. The compatibles of size
n-i are generated starting from the maximal
compatibles of size n to n-i1 (only those that
do not have a void class set). (b) Add to the set
of primes the compatibles of size n-i not
dominated by any prime already in the set. (c)
Add to the set of primes all maximal compatibles
of size n-i
42
State MinimizationIncompletely Specified
Machines
  • p1(BE), (CB)
  • p2(AD), (BE)
  • p3(CD), (ED)
  • p4(BC), (DA)
  • p5(ACD), (ED)(BE)
  • p6(DE), (BC)
  • p7(AC),
  • p9(B),
  • p11(D),
  • p12(E),
  • Computation of clauses in previous example.

Clauses due to closure p1 ? p4 (p1p4) p2 ?
p1 (p2p1) p3 ? p6 (p3p6) p4 ? (p2p5)
(p4p2p5) p5 ? (p1p6) (p5p1)(p5p6) p6 ?
p4 (p6p4)
Clauses due to coverage A(p5p2p7) B(p1p4p9)
C(p3p4p5p7) D(p2p3p5p6p11) E(p1p6p12)
43
State MinimizationIncompletely Specified
Machines
  • Need to find a satisfying assignment for the
    following expression with the fewest TRUE
    assignments.
  • C (p5 p2 p7) (p1 p4 p9) (p3 p4 p5
    p7)
  • (p2 p3 p5 p6 p11) (p1 p6 p12)
  • (p1 p4) (p2 p1) (p3 p6) (p4 p2
    p5)
  • (p5 p1) (p5 p6) (p6 p4)
  • The assignment p1 p2 p4 TRUE and all other
    pj FALSE is a satisfying assignment with the
    fewest TRUE assignments.

44
State MinimizationIncompletely Specified
Machines
  • This corresponds to Mred (B E), (A D), (B C)
    givin the following reduced machine.

Note 1. Minimum form not unique. 2. A state in
the original machine may be split between two
states in the reduced machine. 3. Resulting
machine may still be incompletely specified.
45
State MinimizationIncompletely Specified
Machines
0 A C 1 1 A E - 0 B C - 1 B E 1 0 C B 0 1
C A 1 0 D D 0 1 D E 1 0 E D 1 1 E A 0 (a)
  • An incompletely-specified machine and its
    implication table.

0 (A,B) C 1 1 (A,B) E 1 0 C (A,B) 0 1
C (A,B) 1 0 D D 0 1 D E 1 0 E D 1 1
E (A,B) 0 (a)
0 (A,E) (B,C,D) 1 1 (A,R) (A,E) 0 0
(B,C,D) (B,C,D) 0 1 (B,C,D) (A,E) 1 (b)
  • Two minimal realizations of an incompletely-specif
    ied machine.

46
State MinimizationIncompletely Specified
Machines
Problem An implied class can be contained by
more than one compatible. Choose as next state
in the reduced machine the compatible that
optimizes some cost function, for instance the
number of rows of the state transition table of
the reduced machine. In general, define a
mapping problem given a closed set of
compatibles which covers all the states of the
original machine, find a mapping of the implied
classes into the compatibles, so as to minimize
the cost of the resulting machine. The problem
can be modeled as the one of determining the set
of unique representatives which minimizes row
count after minimization of a symbolic relation
(analogous to a boolean relation with symbolic
input and output fields).
47
State MinimizationIncompletely Specified
Machines
  • Complexity of the problem
  • Problem is NP-hard Pfleeger 1973
  • Exact solution requires computing prime
    compatibles (in the worst-case, order of 3n/3)
    and then a binate covering step.
  • Existing tools perform well on examples with few
    prime compatibles. Are inadequate for examples
    with many prime compatibles.
  • Newly developed tools use BDDs and implicit
    methods (Dam and Villa). They have been shown to
    be able to handle some problems with trillions of
    prime compatibles. Kam and Villa have developed
    a package called SILK
Write a Comment
User Comments (0)
About PowerShow.com