Presentation is loading. Please wait.

Presentation is loading. Please wait.

Synthesis and Verification of Finite State Machines

Similar presentations


Presentation on theme: "Synthesis and Verification of Finite State Machines"— Presentation transcript:

1 Synthesis and Verification of Finite State Machines
Sungho Kang Yonsei University

2 Outline Minimization of Incompletely Specified Machines
Binate Covering Problem State Encoding Decomposition and Encoding

3 Synthesis of Practical FSMs
Minimization We have learned basic methods for minimizing, encoding, checking equivalence, and synthesizing circuits for realizing completely specified FSMs Now we must learn to deal with the more practical case of incomplete specification Our goal is thus to find a least cost circuit that satisfies a partial specification

4 Flow Table Compatibility Table
Incomplete specification and Compatibility MInimization Use don’t-cares to merge states. Merged states must have same output sequences. Flow Table Compatibility Table Note each constraint represents pair (incompatibility)

5 Strategy Derive all prime sets of compatible states
MInimization Derive all prime sets of compatible states Solve a covering problem to obtain minimum states.

6 Note each constraint represents pair (incompatibility)
Compatibility Constraints MInimization Compatibility relation: conjunction of constraints (one for each “X”) Note each constraint represents pair (incompatibility)

7 Computing the Maximal Compatibles
MInimization By recursive multiplication method, like computing the Complete Sum: The (complete) constraint sums are multiplied out, dropping absorbed terms when they arise.

8 Maximal compatibles are “Prime”.
Computing the Maximal Compatibles MInimization Maximal compatibles are “Prime”. ( No superset of these state sets are also pairwise compatible).

9 Prime Compatibles MInimization Unfortunately, some subsets of the maximal compatibles pairs are also prime compatibles. Because, selection of one compatible pair may imply selection of other compatible pairs.

10 Defining Prime Compatibles
MInimization A compatible is prime if and only if there is no other compatible which contains it or whose class set contains class set of That is, is prime if and only if Subsets with smaller class sets are acceptable. (Bigger compatible, smaller class set)

11 Class Sets and Prime Compatibles
MInimization In minimization, we desire a minimum number of compatible sets that cover all original states. Pick from primes. Choice of conditionally compatible set implies choosing all implied pairs. Set of implied compatibles pairs is called the class set, is the class set of

12 We just derived maximal compatibles that are prime
Update and Strategy MInimization We just derived maximal compatibles that are prime Derive remaining prime compatibles Solve a covering problem

13 Class Sets x1 x2 x3 x4 x5 x6 x7 a a,0 -- d,0 e,1 b,0 a,-- --
MInimization x1 x2 x3 x4 x5 x6 x7 a a, d,0 e,1 b,0 a, b b,0 d,1 a, a,-- a, c b,0 d,1 a, g,0 d e, b,-- b, a,-- e b,-- e,-- a, b,-- e,-- a,1 f b,0 c, ,1 h,1 f,1 g,0 -- g c, e, g,0 f,0 h a,1 e,0 d,1 b,0 b,-- e,-- a,1 b a,d c X ~ d b,e a,b d,e d,e a,g e a,b a,d d,e a,b a,e X ~ f X X c,d X X g ~ X c,d f,g X X e,h h X X X ~ a,b a,d X X a b c d e f g

14 Note is prime: although
Class Sets and Primes MInimization Note is prime: although b a,d c X ~ d b,e a,b d,e d,e a,g e a,b a,d d,e a,b a,e X ~ f X X c,d X X g ~ X c,d f,g X X e,h h X X X ~ a,b a,d X X a b c d e f g

15 Class Sets and Primes Note is not prime: b a,d c X ~
MInimization Note is not prime: b a,d c X ~ d b,e a,b d,e d,e a,g e a,b a,d d,e a,b a,e X ~ f X X c,d X X g ~ X c,d f,g X X e,h h X X X ~ a,b a,d X X a b c d e f g

16 Note is prime: Class Sets b a,d c X ~ d b,e a,b d,e d,e a,g
MInimization Note is prime: b a,d c X ~ d b,e a,b d,e d,e a,g e a,b a,d d,e a,b a,e X ~ f X X c,d X X g ~ X c,d f,g X X e,h h X X X ~ a,b a,d X X a b c d e f g

17 through are added to the list of prime compatibles
Maximal compatibles are prime MInimization maximal class compatibles set 1 {a,b,d,e} {} 2 {b,c,d} {{a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} other PCs 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} 8 {c,g} {{c,d}, {f,g}} 9 {f,g} {{e,h}} 10 {d,h} {} 12 {f} {} Note sub-compatibles through are added to the list of prime compatibles before maximal compatible

18 which has an empty class set
Maximal compatibles are prime MInimization maximal class compatible set 1 {a,b,d,e} {} 2 {b,c,d} {a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} other PCs 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} 8 {c,g} {{c,d}, {f,g}} 9 {f,g} {{e,h}} 10 {d,h} {} 12 {f} {} Note that subsets and are not prime because they are contained in , which has an empty class set

19 prime because it is contained in , whose class set is the same.
Maximal compatibles are prime MInimization maximal class compatible set 1 {a,b,d,e} {} 2 {b,c,d} {a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} other PCs 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} 8 {c,g} {{c,d}, {f,g}} 9 {f,g} {{e,h}} 10 {d,h} {} 12 {f} {} Note that subset , with class set , is not prime because it is contained in , whose class set is the same.

20 are all contained in primes with empty class sets, so they
Maximal compatibles are prime MInimization maximal class compatible set 1 {a,b,d,e} {} 2 {b,c,d} {a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} other PCs 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} 8 {c,g} {{c,d}, {f,g}} 9 {f,g} {{e,h}} 10 {d,h} {} 12 {f} {} After treating subsets of size 2, we still have to check all subsets of size 1, which have empty class sets. Note are all contained in primes with empty class sets, so they are not prime. But is not, so it is prime.

21 Goal: To Find Prime Compatibles
MInimization maximal class compatible set 1 {a,b,d,e} {} 2 {b,c,d} {a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} other PCs 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} 8 {c,g} {{c,d}, {f,g}} 9 {f,g} {{e,h}} 10 {d,h} {} 12 {f} {} Maximal Compatibles are prime. Other prime compatibles are subsets of primes such that: is prime iff its class set does not contain the class set of a larger prime

22 Finding Prime Compatibles
MInimization Enqueue known primes of size k Test subcompatibles for primality

23 For , only is enqueued For , are enqueued Finding Prime Compatibles
MInimization For each value of k, the for-loop of Line 1 puts the maximal compatibles of size k onto the queue of primes, P. For , only is enqueued For , are enqueued

24 is a prime compatible if and only if
Finding Prime Compatibles MInimization For each enqueued prime (of size ), we check every subset of size is a prime compatible if and only if

25 Building the Reduced Machine
MInimization x1 x2 x3 x4 x x6 x7 a a, d,0 e,1 b,0 a, b b,0 d,1 a, a, a, c b,0 d,1 a, g,0 d e, b,-- b, a,-- e b,-- e,-- a, b, e,-- a,1 f b,0 c, ,1 h,1 f, g, g c, e, g,0 f,0 h a,1 e,0 d,1 b,0 b,-- e, a,1 x 1 2 3 4 5 6 7 9 ,

26 x 1 2 3 4 5 6 7 9 , x1 x2 x3 x4 x5 x6 x7 a a,0 -- d,0 e,1 b,0 a,-- --
Reduced Machine MInimization x1 x2 x3 x4 x x6 x7 a a, d,0 e,1 b,0 a, b b,0 d,1 a, a, a, c b,0 d,1 a, g,0 d e, b,-- b, a,-- e b,-- e,-- a, b, e,-- a,1 f b,0 c, ,1 h,1 f, g, g c, e, g,0 f,0 h a,1 e,0 d,1 b,0 b,-- e, a,1 Where there is a choice, choose 1 (as in x2-successor of compatible 1): {d,e} contained in or . x 1 2 3 4 5 6 7 9 ,

27 Closed Cover : Choosing Compatibles
MInimization Closed Cover : Choosing Compatibles Every state of the original machine must be covered Every implied compatible must be present in the solution

28 Coverage: Closure: Closed Cover maximal class
MInimization maximal class compatibles set 1 {a,b,d,e} {} 2 {b,c,d} {{a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} other PCs 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} 8 {c,g} {{c,d}, {f,g}} 9 {f,g} {{e,h}} 10 {d,h} {} 12 {f} {} Let’s check if the following set of compatibles forms a closed cover: Coverage: Closure:

29 Covering Constraints--POS FORM
MInimization maximal class compatibles set 1 {a,b,d,e} {} 2 {b,c,d} {{a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} other PCs 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} 8 {c,g} {{c,d}, {f,g}} 9 {f,g} {{e,h}} 10 {d,h} {} 12 {f} {} Every state of the original machine must be covered.

30 Covering Constraints--POS FORM
MInimization maximal class compatibles set 1 {a,b,d,e} {} 2 {b,c,d} {{a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} other PCs 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} 8 {c,g} {{c,d}, {f,g}} 9 {f,g} {{e,h}} 10 {d,h} {} 12 {f} {} Every state of the original machine must be covered. c a b d e f g h

31 Finding a Minimum Closed Cover
MInimization Associate a variable to the prime compatible For each , form the coverage constraint 1 {a,b,d,e} {} 2 {b,c,d} {{a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} This cover is not closed, since is excluded

32 is the set of prime compatibles with non-empty class sets
Closure Constraints MInimization is the set of prime compatibles with non-empty class sets Note class sets 1 {a,b,d,e} {} 2 {b,c,d} {{a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}}

33 Covering and Closure Constraints--POS FORM
MInimization

34 Covering Constraints--Matrix FORM
MInimization Row Dominance Col Dominance? (see below)

35 Closure Constraints--Matrix FORM
MInimization class sets 1 {a,b,d,e} {} 2 {b,c,d} {{a,b},{a,g},{d,e}} 3 {c,f,g} {{c,d}, {e,h}} 4 {d,e,h} {{a,b}, {a,d}} 11 {a,g} {} 5 {b,c} {} 6 {c,d} {{a,g}, {d,e}} 7 {c,f} {{c,d}} For each pair in the class set of each compatible , form the clause where ranges over the indices of compatibles that contain .

36 Closure Constraints--Matrix FORM
MInimization Cover rows by including a 1-col OR excluding a 0-col

37 Covering Constraints Closure Constraints Closed Covering Problem
Minimization Find a minimum set of columns which cover all rows: {1,4,5,9} Covering Constraints A row is covered by either including a 1-col or excluding a 0-col. Closure Constraints

38 Binate Covering Problem
Similar to unate covering Matrix Variables on columns Sum expressions on the rows Solution may not exist when product is 0

39 The Binate Covering Problem
Note: replaced by to emphasize POS semantics Also there is one addition (for empty solution space)

40 Unacceptable (anti-essential)Variables
Binate Covering When is essential we say that is unacceptable When is essential, we may delete all rows of the matrix which has a zero in the column

41 Formally: Row dominates row if is satisfied,
Row Dominance Binate Covering Row 1 ( ) dominates row 2 ( ) since row 2 matches row 1 at all care entries. Row 1 may be deleted. Formally: Row dominates row if is satisfied, in a Boolean sense, whenever is satisfied, that is,

42 Let and be two columns of . We say that
Column Dominance Binate Covering Let and be two columns of We say that dominates if, for each row of , one of the following conditions hold: Example: reduced column dominates

43 Maximal Independent Set
Binate Covering Two rows are independent if it is not possible to satisfy both clauses by assigning one variable to 1 Thus in finding the MIS, we ignore rows (clauses) that contain 0s, since these are satisfied by assigning variables to 0

44 Infeasible Subproblems
Binate Covering cannot occur in original problem (first call to the recursive procedure). But it can happen after one or more recursions: This is detected by REDUCTION, which discovers that both and are essential

45 dominates dominates is essential dominates Solution: x x x x x x x x x
Reduction Binate Covering dominates dominates x x x x x x x x x x x x 1 2 3 4 1 2 3 4 1 2 3 4 1 - f 1 - f 1 - f 1 1 1 - 1 - f - 1 - f - 1 - f 2 2 2 1 - - 1 f 1 - - 1 f 1 - - 1 f 3 3 3 1 1 f 1 1 f 1 1 f 4 4 4 is essential dominates x x x x x x x x 1 2 3 4 1 2 3 4 Solution: 1 - f 1 - f 1 1 - 1 - f - 1 - f 2 2 1 - - 1 f 1 - - 1 f 3 3 1 1 f 1 1 f 4 4

46 State Encoding The number of possible assignments is very high
If one uses k bits to encode p states, there are (2k)!/(2k - p)! possible assignments If one considers two assignments obtained by permutation or complementation of some of the bits as essentially the same assignment, then there are (2k -1)! / (2k - p)! k! distinct assignments

47 Practical Encoding Algorithms
State Encoding Mustang tries to identify pairs of states by receiving adjacent pairs Two codes are adjacent if they only differ in one bit The first objective is to build a graph representing the attraction between each pair of states Two states that have a strong attraction should be given adjacent codes How to build attraction graph In the fanout-oriented algorithm, whenever two states, si and sj have a common fanout state, the weight of the edge (si, sj) of the attraction graph is increased In the fanin-oriented algorithm, if si and sj have a common fanin state, the weight of the edge (si, sj) of the attraction graph is increased Once the graph of the attractions is found, we try to assign codes to pairs of states that have strong attractions

48 Fanout Oriented Algorithm
State Encoding Build two matrices The first with one row for each present state and one column for each next state The second with one row for each present state and one column for each output

49 Embedding Algorithm Assign codes to states
State Encoding Assign codes to states Select first the node for which the sum of the weights of the Nb heaviest incident edges is maximum

50 Fanin Oriented Algorithm
State Encoding Build two matrices The first with one row for each next state and one column for each present state The second with one row for each next state and two columns for each output One column is for the true input and the other is for the complement

51 Decomposition and Encoding
Rather than aiming directly at minimizing the number of literals in the next-state functions, one may actually try to minimize the support of the functions Reduction of the number of literals and simplification of the interconnections

52 Partitions Decomposition A partition  is on a set S is a collection of disjoint subsets of S whose set union is S, i.e.  = { Ba } such that Ba  Bb =  for a  b and  { Ba } = S Each subset is called a block of the partition If 1 and 2 are partitions on S, then 1 2 is the partition on S such that s  t(1 2 ) if and only if s  t(1 ) and s  (2 ), whereas, 1 + 2 is the partition on S such that s  t(1 + 2 ) if and only if there exists a sequence in S s=s0 s1 s2… sn = t for which either si  si+1 (1) or si  si+1 (2), 0  i  n-1

53 Partitions with Substitution Property
Decomposition A partition  on the set of states of the machine is said to have the substitution property if and only if s  t() implies that (s,a)  (t,a) () a  I A sequential machine M has a non-trivial parallel decomposition of its state behavior if and only if there exist two nontrivial S.P. partitions 1 and 2 on M such that 1 2 = 0 Independent component Dependent component

54 Computation of SP Partitions
Decomposition First generate the minimal SP partitions and then sum them until considering all possible sums The minimal partitions are those obtained by requiring that two states only are included in a block

55 General Decomposition and Encoding
Need to resort to something more general than SP partitions, namely, partition pairs A partition pair (, ’) on the machine is an ordered pair of partitions on S such that s  t() implies that (s,a)  (t,a) (’) a  I The knowledge of the block of  containing the present state and of the current input allows one to compute the block ’ of that will contain the next state. It is evident that if (, ) is a partition pair, then  has substitution property Partition pairs generalize SP partitions


Download ppt "Synthesis and Verification of Finite State Machines"

Similar presentations


Ads by Google