State Equivalence and Minimization in Finite State Machines, Slides of Digital Systems Design

The importance of removing redundant states in finite state machines (fsms) and provides definitions and algorithms for detecting equivalent states using the second state equivalence definition. The document also covers the partitioning method and implication table method for state minimization.

Typology: Slides

2012/2013

Uploaded on 04/30/2013

patel
patel 🇮🇳

3.8

(15)

80 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
FSM State Minimization for
Completely Specified Machines
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download State Equivalence and Minimization in Finite State Machines and more Slides Digital Systems Design in PDF only on Docsity!

FSM State Minimization for

Completely Specified Machines

State Minimization of Seq. Ckts.

  • Removal of redundant states
  • Important because:
    • Cost(a): # of FFs # of states
    • Cost(b): logic complexity # of states
    • Easier to diagnose faults if there are no redundant states
  • Example: Odd-parity detection

0 (even) 1 (odd)

Reset (^) 1/

A
B
C
0/0 0/1^ D

Minimal FSM (^) Non-minimal FSM

Can this sub- optimal design be corrected by systematic techniques?

Reset

Examples (contd.)

  • Example1 (contd.)

Init. St.

Input sequence 000 001 010 011 100 101 110 111 A 111 110 100 101 011 010 000 001 B 111 110 100 101 000 001 011 010 C 111 110 100 101 000 001 011 010 D 000 001 011 010 111 110 100 101 E 000 001 011 010 111 110 101 100

3-equiv.

Examples (contd.)

  • Example 2: Parity detection
A
B
C
D

Init. st.

Input Sequence 00 01 10 11 A 00 01 11 10 B 00 01 11 10 C 11 10 00 01 D 11 10 00 01

2-equiv.

R

Equivalent State Detection Using the 2 nd^ State

Equiv Defn

  • Idea 1:
    • Using the 2 nd^ defn’s negation, iteratively find non-equiv state pairs
    • Stop when no more non-equiv state pairs cannot be found
    • The remaining state pairs are equivalent
    • This is the partitioning method
  • Idea 2:
    • Bootstrap the equiv state-pair finding process by finding a base pattern that implies equivalency, e.g., see the foll. pattern which implies equiv. of states B and C:
    • Use these initial pair of equiv states to determine other equiv state pairs using defn. 2.
    • This is the implication table method

State pair B C

0/

0/

E

1/

1/

Definitions (Contd.)

  • The second definition is the same as the first one
    • Necessity for (i) is clear
    • Necessity for (ii), let S k , S l not be equivalent => There is an input seq. I 1 ,……,I t that produces different o/p’s starting from states S k and S l => The seq. I p , I 1 ,……,I t produces diff. o/p starting from S i and S j => S i , S j are not equiv.

 Sufficiency

S i

S k^1

I p^1 /O p^1

O/P O^1

S k^2

O^2

S j

S l^1

I p^1 /O p^1

O^1

S l^2

O^2

Same

Equiv.

Equiv.

Equiv.

  • Consider any i/p seq I p , I 1 ,……,I t
  • After recv’ing I p Si & Sj produce the same o/p and fo to equiv states (by defn) S (^) kp^ & Slp
  • Since Skp & Slp are equiv states, seq I 1 ,……,I (^) t will produce identical o/ps from either state
  • Thus Si & Sj produce identical o/ps for any arbitrary seq, and are thus equivalent

Definitions (Contd.)

  • Note 1: If there is an equivalence relation R on a set S, the the elements of S can be partitioned into disjoint subsets called equivalence classes, where elements in each subset are related to each other by relation R: Important concept for completely specified FSMs

 Note 2: If there is a compatibility relation R on a set S, then R defines subsets of S referred to as compatibility classes (the elements in a subset S i are related to each other by R). These subsets are not disjoint, in general. Important concept for incompletely specified FSMs

Equivalent classes are disjoint Compatibiity classes may intersect Docsity.com

Minimization Method for Completely Specified FSMs

  • Two methods. Partitioning and Implication Table
  • Partitioning Method:

Use condition (i) of the alternative equivalency defn to determine initial partition P 1 =subsets/blocks of 1-equiv. states; /* k-equivalency & equivalency are equivalence classes */ i=0; Repeat i=i+1; For each subset/block C j in P i do Begin Two or more states in C j are placed in the same block of P i+1 iff for each I/P value of length 1 their next states lie in the same block of P i. Otherwise the relevant states are separated into diff. blocks. End P i+1 =set of all new blocks created. / each bl. contains (i+1)-equiv states / Until (P i+1 =P i ) /* Note: this uses condition (ii) of the alternative equivalency defn to construct equivalent state sets */

Partitioning Method: Example 1

A
B
C
D

Non-minimal STD

P 1 =(A,B) (C,D)
P 2 =(A,B) (C,D)

No change from P 1 ; stop

A D

Reset (^) 1/

Minimal STD

P 1 =(A,B) (C,D)
X=0: NS: B A C D
X=1: NS: C D A B

Partitioning Method: Example 2

E E/0 A/
D D/0 B/
C B/1 E/
B C/1 E/
A C/1 B/
0 1 P 1 =(A,B,C) (D,E)
X=0 C C B D E
X=1 B E E B A

N.S.’s Need to check for each I/P of length 1

P 2 =(A) (B,C) (D,E)
X=0 C B D E
X=1 E E B A

N.S. will not change, but whether N.S.’s belong to same blocks will

P 4 =(A) (B,C) (D) (E)
= P 3
X=0 C B
X=1 E E
P 3 =(A) (B,C) (D) (E)
E E/0 A/
D D/0 B/
B B/1 E/
A B/1 B/

Partitioning Method—Why It works (detailed proofs)?

  • Lemma 1: If there are two states that are k-equiv. but not (k+1)-equiv then the algorithm will detect this in iteration k
  • Proof by induction
    • Basis (k=0): Not 1-equiv. is caught at iteration 0 (before iteration 1, i.e., when forming P 1 )
    • Hypothesis: True for k=m
    • To prove for k=m+1: Use property: If two states A 1 and B 1 are (m+1)- equiv but not (m+2)-equiv., at least one of their N.S. pairs (A 2 , B 2 ) has to be m-equiv. but not (m+1)-equiv. Can be easily proved by contradiction—do as an exercise. A 1
A 2

A m+

A m+

B 1
B 2

B m+

B m+

m equiv.

1 equiv.

m

 Hence, by ind. hypothesis, A 2 and B 2 are in diff. blocks of P m+1 (i.e., their non-(m+1)-equiv. is detected in iter m) according to the hypothesis  Thus, by the procedure, A 1 and B 1 will be in diff. blocks of P m+2 at the end of iteration m+1, i.e., their non-(m+2)- equiv is detected in iter m+

not 1 equiv.

Partitioning Method (contd)

  • Theorem 1 : All blocks contain equivalent states after the algorithm terminates. - Proof : Assume the program terminates at iteration m - Following lemma 1, if two states are not i-equiv. for I ≤ m, they are put into different blocks. - Since P m+1 =P m , for any future iteration j (j>m), i.e., if we were to run the procedure up to iteration j, the partition will not change: we will get P m = P m+1 = P m+2 = …… = P j - If any two states in P (^) k are not equiv  they are not j-equiv. for j > m, they will be put in two blocks in iteration j > m  procedure will continue till at least iteration j >m  Pm+1 != Pm , (otherwise the partitions will never change after P m) and we reach a contradiction. Thus all states in a block are equivalent.

Theorem 2 : All equivalent states are in the same blocks, i.e., two equivalent states will not be in different blocks.  Proof Outline: Follows from the procedure: If two states are in different blocks, then they were detected as not k-equivalent for some k, and thus are not equivalent. Thus no 2 equivalent states can be in different blocks after the procedure terminates. Hence each block will contain the maximal set of equivalence states, i.e., each block is an equivalence class

Implication Table Procedure

  • Step 3: Use cond. (ii) of defn. 2 for equiv. states for other squares.
E E/0 A/
D D/0 B/
C B/1 E/
B C/1 E/
A C/1 B/
A B C D
E
D
C
AB
BC
BE
B BE

 Step 3:

 a) Put a ‘ ** /’ mark if the implied pairs in a cell:

 either contains only the states that define the cell  or is the same state (e.g., (E,E))— singleton states  b) For the remaining cells, write all implied pairs (incl. the same state pair and singleton states) of the states defining the cell that not meet the above two conditions

State pair B C

0/

0/

E

1/

1/

Implication Table Procedure (contd)

  • Step 4:
    • Repeat
      • Put a mark ‘\ / ’ if all implied pairs have the mark ‘/ ’ in their cell
      • Put a X if any implied pair has an X in its cell
    • Until no change.
  • Step 5: Remaining cells (w/ only implied states or ‘\ / ’) are equiv.
  • Note: Cells w/ only implied pairs form closed systems (see defn in next slide) of implied pairs w/ neither ‘\ / ’ nor X marks in them. I/Ps to any state pairs in this system will either: - remain in the closed system producing identical o/ps (since these state pairs are at least 1-equivalent) - or go out of the system to either: - (a) singleton states o - (b) equivalent states, - and from thereon also produce identical o/ps. Thus these state pairs are equivalent.
  • Form the largest equivalent sets by transitivity: (S i , S j ) and (S j , S k )=>(S i , S j , S k )
  • Note: (S i , S k ) will also be equivalent from the implication table, since “state equivalence” is an equivalence relation

A 3 B 3

AB

A 1 B 1

Equiv. states^ A^2 B^2

(a)

Equiv. states Non-equivstates

UV

U 1 V 1 U^2 V^2 X

(b)

AB EE

CD

Closed System

Equiv. states

Singleton state

Implication arc

(c)

Docsity.com