1 minimization of automata it is very likely that problems like this will appear on midterm or final...
Post on 15-Jan-2016
214 views
TRANSCRIPT
1
Minimization of Automata
It is very likely that problems like this will appear on midterm or final exam.
Slides from Tadeusz LubaSlides from Tadeusz Luba
2
Minimalisation of an automaton
a b c d a b c d
A C B C A 0 1 1 1
B C C A – 0 1 1 –
C B C A B 0 0 0 1
x
S a b c d a b c d
S1 – S3 S4 S2 – 1 1 1
S2 S4 – – – 0 – – –
S3 S6 S6 – – 0 1 – –
S4 – S6 S1 S5 – 0 0 1
S5 – – S2 – – – 1 –
S6 S3 – S2 S3 0 – 0 1
Minimalisation of number of states
We reduce the number of flip-flopsWe reduce the number of flip-flops
Minimalization of number of statesMinimalization of number of states
Automata are equivalentOften initial specification is not minimal
Automata are equivalentOften initial specification is not minimal
3
Compatibility relation on set of states S:
(pairs of compatible states)
Compatibility relation on set of states S:
(pairs of compatible states)
Maximal compatibles (Maximal sets of compatible pairs)
Maximal compatibles (Maximal sets of compatible pairs)
Selection of sets satisfying the following:
Closure condition Completeness condition
Selection of sets satisfying the following:
Closure condition Completeness condition
Minimalisation of FM
4
Basic Concepts
x
Sa b c d a b c d
1 – 3 4 2 – 1 1 1
2 4 – – – 0 – – –
3 6 6 – – 0 1 – –
4 – 6 1 5 – 0 0 1
5 – – 2 – – – 1 –
6 3 – 2 3 0 – 0 1
Two internal states Si, Sj are Compatible, if for each input v they have consistent output states, and their successors are the same or compatible.
Two internal states Si, Sj are Compatible, if for each input v they have consistent output states, and their successors are the same or compatible.
Two internal states Si, Sj are conditionally compatible, if their output states are consistent and for some v V pairs of successors of Si, Sj (denote Sk, Sl):
(Si, Sj) (Sk, Sl)
Two internal states Si, Sj are conditionally compatible, if their output states are consistent and for some v V pairs of successors of Si, Sj (denote Sk, Sl):
(Si, Sj) (Sk, Sl)
States Si, Sj are incompatible, if for some v V the states of their outputs are inconsistent.
States Si, Sj are incompatible, if for some v V the states of their outputs are inconsistent.
States conditionally compatible
Compatible states
Incompatible states
5
Compatibility relation
Because of conditional compatibility we use triangular table in all calculations
Because of conditional compatibility we use triangular table in all calculations
Triangular table has as many cells are there are possible pairs of states.
Triangular table has as many cells are there are possible pairs of states.
6
Triangular table
2
3
4
5
1 2 3 4
We fill the cells of triangular table as follows: We fill the cells of triangular table as follows:
v – if pair of states is compatible,v – if pair of states is compatible,
vv
x – if pair of states in incompatible, x – if pair of states in incompatible,
x x
(i,j) – pair (pair of successors), if the pair is conditionally compatible.
(i,j) – pair (pair of successors), if the pair is conditionally compatible.
(i,j)(i,j)
7
Triangular table – example
a b c d a b c d
1 – 3 4 2 – 1 1 1
2 4 – – – 0 – – –
3 6 6 – – 0 1 – –
4 – 6 1 5 – 0 0 1
5 – – 2 – – – 1 –
6 3 – 2 3 0 – 0 1
2
3
4
5
6
1 2 3 4 5
1,2; 3,5
vv
v
vv
v
3636 46
2424
34
8
Triangular table - example
2
3 3,6 4,6
4
5 2,4
6 3,4 1,2; 3,5
1 2 3 4 5
After filling the table we check if the pairs of incompatible states (denoted by ) do exist as pairs of successor states.
After filling the table we check if the pairs of incompatible states (denoted by ) do exist as pairs of successor states.
All non-crossed cells correspond to compatible pairs:
All non-crossed cells correspond to compatible pairs:
If there are such pairs, they should be crossed out (i.e. denote by ). This process should be repeated until all crosses are checked out.
If there are such pairs, they should be crossed out (i.e. denote by ). This process should be repeated until all crosses are checked out.
(1,2); (1,3); (1,5); (2,3); (2,4); (2,5); (3,5); (3,6); (4,6).
(1,2); (1,3); (1,5); (2,3); (2,4); (2,5); (3,5); (3,6); (4,6).
9
Calculating MCC
After calculating the set of pairs of compatible states, weCalculate the following:
After calculating the set of pairs of compatible states, weCalculate the following:
Maximal sets of compatible states.Maximal sets of compatible states.
Maximal classes of compatibility (MCC)Maximal classes of compatibility (MCC)
...we know at least three methods to calculate MCC! ...we know at least three methods to calculate MCC!
10
...we return to the example
1,2 1,3 1,5 2,3 2,42,5 3,5 3,64,6
1,2,3 MCC:
1,2,3,5
MCC = {{1,2,3,5}, {2,4}, {3,6}, {4,6}} MCC = {{1,2,3,5}, {2,4}, {3,6}, {4,6}}
1,2,5 1,3,5 2,3,5 2,4
3,64,6
vvv v
vv
Compatible pairs: (1,2); (1,3); (1,5); (2,3); (2,4); (2,5); (3,5); (3,6); (4,6)Compatible pairs: (1,2); (1,3); (1,5); (2,3); (2,4); (2,5); (3,5); (3,6); (4,6)
11
Minimization Algorithm
1) Find all pairs of compatible states,1) Find all pairs of compatible states,
2) Calculate maximal sets of compatible states (MCC),
2) Calculate maximal sets of compatible states (MCC),
3) Select sets that satisfy the so-called Covering condition (a) and closure condition (b):
3) Select sets that satisfy the so-called Covering condition (a) and closure condition (b):
a) Each state must be in at least one class;a) Each state must be in at least one class;
b) For each input symbol all succesors (next states) of each class must be included into one class.
b) For each input symbol all succesors (next states) of each class must be included into one class.
12
Covering Condition - example
a b c d a b c d
1 – 3 4 2 – 1 1 1
2 4 – – – 0 – – –
3 6 6 – – 0 1 – –
4 – 6 1 5 – 0 0 1
5 – – 2 – – – 1 –
6 3 – 2 3 0 – 0 1
MCC = {{1,2,3,5}, {3,6}, { 2,4}, 4,6}}
To satisfy covering condition we should select :
To satisfy covering condition we should select :
{1,2,3,5}, {4,6}
13
Closure condition - example
a b c d a b c d
1 – 3 4 2 – 1 1 1
2 4 – – – 0 – – –
3 6 6 – – 0 1 – –
4 – 6 1 5 – 0 0 1
5 – – 2 – – – 1 –
6 3 – 2 3 0 – 0 1
For selected classes {1,2,3,5},{4,6}} we calculate their successors
a b c d
1,2,3,5
4,6
Closure condition is not satisfied!Closure condition is not satisfied!
4,64,6 3,63,6 2,42,4 22
33 66 1,21,2 3,53,5
3,6!3,6! 2,4!2,4!
14
Condition of covering and closure – second try
a b c d a b c d
1 – 3 4 2 – 1 1 1
2 4 – – – 0 – – –
3 6 6 – – 0 1 – –
4 – 6 1 5 – 0 0 1
5 – – 2 – – – 1 –
6 3 – 2 3 0 – 0 1
a b c d a b c d
A 1,2
B 3,5
C 4,6
MCC = {{1,2,3,5}, {3,6}, { 2,4}, {4,6}}
Selection:
a b c d a b c d
A C B C A 0 1 1 1
B C C A – 0 1 1 –
C B C A B 0 0 0 1
{1,2}, {3,5}, {4,6}
3 6 1,2 3,5
6 6 2 –
4 3 4 2 0 1 1 1
0 1 1 –
0 0 0 1
O.K.O.K.
15
One more example 0 1 0 1
1 2 6 0 0
2 3 1 1 1
3 – 4 – 0
4 – 5 – 0
5 3 – 1 –
6 7 – 1 –
7 – 8 – 0
8 – – – 1
2
3
4
5
6
7
8
1 2 3 4 5 6 7
3737
4646
5656
6868
4545
4848 5858
vv vv vv
vv vv
vv
vv vv
vvvv
3737
16
One more example continued
2
3
4
5
6
7
8
1 2 3 4 5 6 7
3737
4646
5656
6868
4545
4848 5858
vv vv vv
vv vv
vv
vv vv
vvvv
3737
1,31,72,52,83,43,53,64,54,64,75,75,86,76,8
1,31,72,52,83,43,53,64,54,64,75,75,86,76,8
Compatibles:Compatibles:
3,4,64,5,74,6,71,31,76,8
3,4,64,5,74,6,71,31,76,8
MCC:MCC:
3,4,53,4,52,5,82,5,8
17
One more example continued 0 1 0 1
1 2 6 0 0
2 3 1 1 1
3 – 4 – 0
4 – 5 – 0
5 3 – 1 –
6 7 – 1 –
7 – 8 – 0
8 – – – 1
2,5,8 3,4,5 3,4,6 4,5,7 4,6,7 1,3 1,7 6,8
(0,Si)
(1,Si)
2,5,83,4,53,4,64,5,74,6,71,31,76,8
2,5,83,4,53,4,64,5,74,6,71,31,76,8
MCC:MCC:
33–33–
1– –1– –
– –3– –3
45–45–– –7– –7
45–45– 5–85–8 5–85–8 6464 6868
7–7–
– –– –
2–2––3––3– –7––7– 2–2–
Table of successorsTable of successors
18
One more example continued 0 1 0 1
1 2 6 0 0
2 3 1 1 1
3 – 4 – 0
4 – 5 – 0
5 3 – 1 –
6 7 – 1 –
7 – 8 – 0
8 – – – 1
2,5,8 3,4,5 3,4,6 4,5,7 4,6,7 1,3 1,7 6,8
(0,Si) 3 3 7 3 7 2 2 7
(1,Si) 1 45 45 58 58 46 68 –
XS
0 1 0 1
A C C 1 1
B B A 1 0
C A B 0 0
AA BB CC
19
Sequence DetectorSequence Detector
The input symbol that arises in the third pulse should be 1, when „triplet” has the form 001, and 0, when „triplet” is of a differnt form. The signal that occurs during the first and second pulse may be unspecified.
The input symbol that arises in the third pulse should be 1, when „triplet” has the form 001, and 0, when „triplet” is of a differnt form. The signal that occurs during the first and second pulse may be unspecified.
1
2
3
4
5
6
7
0/-
1/-
0/-
0/0
0/0
0/0
0/0
1/0
1/0
1/0
1/1
0/-
1/-
1/-
0110010011010100101100100110101001
- - 0- - 0 - - 1- - 1- - 1- - 1 - - 0- - 0 - - 0- - 0
Design a Mealy machine with one input and one output (binary). The machine should analyze the successive „triplets” of input symbols.
Design a Mealy machine with one input and one output (binary). The machine should analyze the successive „triplets” of input symbols.
20
Sequence detector
0/-1/-
0/0
1
2
3
4
5
6
7
0/-
1/-
0/-
0/0
0/0
0/0
1/0
1/0
1/0
1/1
0/-
1/-
1/-
0/0
0/-1/-1
2
3
4
50/-
1/-
0/-
0/0
1/0
1/1
1/-
S 0 1 0 1
1 2 3 - -
2 4 5 - -
3 5 5 - -
4 1 1 0 1
5 1 1 0 0
S 0 1 0 1
1 2 3 - -
2 4 5 - -
3 6 7 - -
4 1 1 0 1
5 1 1 0 0
6 1 1 0 0
7 1 1 0 0
21
Minimalisation of sequence detector
XS
0 1 0 1
1 2 3 – –
2 4 5 – –
3 5 5 – –
4 1 1 0 1
5 1 1 0 0
2 2 4, 3 5
3 2 5, 3 5 45
4 1 2, 1 3 1 4, 1 5 1 5
5 1 2, 1 3 1 4, 1 5 1 5
1 2 3 4
Many compatiblesMany compatibles
We use incompatible pairs to find MCC, since there is few of them, only two.
We use incompatible pairs to find MCC, since there is few of them, only two.
22
Minimalisation of sequence detector
Incompatible pairs we write as a Boolean expression being a product of logic sums:
Incompatible pairs we write as a Boolean expression being a product of logic sums:
Based on this we write the expression: (2 3) (4 5),which after multiplication obtains the form:
(2 3) (4 5) = 2 4 2 5 3 4 3 5
Based on this we write the expression: (2 3) (4 5),which after multiplication obtains the form:
(2 3) (4 5) = 2 4 2 5 3 4 3 5
In sequence detector the incompatibles are: (2, 3); (4, 5). In sequence detector the incompatibles are: (2, 3); (4, 5).
Subtracting from set S = {1, 2, 3, 4, 5} of all states those sets of states that are written in separate products we obtain
the family of all MCC
Subtracting from set S = {1, 2, 3, 4, 5} of all states those sets of states that are written in separate products we obtain
the family of all MCC
{1, 2, 3, 4, 5} – {2, 4} = {1, 3, 5}{1, 2, 3, 4, 5} – {2, 5} = {1, 3, 4} {1, 2, 3, 4, 5} – {3, 4} = {1, 2, 5}{1, 2, 3, 4, 5} – {3, 5} = {1, 2, 4}
23
Minimalisation of sequence detectorX
S0 1 0 1
1 2 3 - -
2 4 5 - -
3 5 5 - -
4 1 1 0 1
5 1 1 0 0
XS
0 1
135 125 135
134 125 135
125 124 135
124 124 135
MCC: {1, 3, 5}, {1, 3, 4}, {1, 2, 5}, {1, 2, 4}
Transition function for all MCCTransition function for all MCC
We add the class {1,2,5}We add the class {1,2,5}
XS
0 1 0 1
A 135 125 135 0 0
B 125 124 135 0 0
C 124 124 135 0 1
XS
0 1 0 1
A B A 0 0
B C A 0 0
C C A 0 1
Classes: {1,3,5}, {1, 2, 4}, {1, 2, 5} satisfy closure and covering conditions Classes: {1,3,5}, {1, 2, 4}, {1, 2, 5} satisfy closure and covering conditions
But do not satisfy the closure condition – the next states: {1,2,5} !
But do not satisfy the closure condition – the next states: {1,2,5} !
Classes {1, 3, 5}, {1, 2, 4} satisfy covering condition, Classes {1, 3, 5}, {1, 2, 4} satisfy covering condition,
Minimal automaton
Minimal automaton
24
...this is next realizedX
S0 1 0 1
A B A 0 0
B C A 0 0
C C A 0 1
T1Q1
Q1
Q1
Q1
T0Q0
Q0
CLK
x x Y
Formulation of sequence detector problem
Formulation of sequence detector problem
Whole synthesis process ! Whole synthesis process !