Document Sample

```					Sequential System Synthesis
-- State Encoding
The State Encoding Problem
 Goal: Given n states, assign a unique code (of
length of at least log n) to each state such that
the cost of binary logic level implementation is
minimized. (state assignment problem)

 Cost of the implementation:
 Number of literals
 Speed
 Testability

ENEE 644                       2
Example: Why State Encoding Matters?
 Consider a fragment of the cube        x   CS NS       O
table for an FSM:                      0   A C         1
 Let y1y2 and Y1Y2 be the current     0   B C         1
state and next state. We want to
x   y1y2 Y1Y2   O
represent Y1,Y2, and output O as a
function of y1,y2, and input x.      0   01   11     1
0   10   11     1
 Assignment 1: A=01, B=10, C=11
Y1=…+x’y1’y2+…+x’y1y2’+…
x y1y2 Y1Y2 O
Y2=…+x’y1’y2+…+x’y1y2’+…
O=…+x’y1’y2+…+x’y1y2’+…           0 00 11 1
0 10 11 1
 Assignment 2: A=00, B=10, C=11
Y1=…+x’y1’y2’+…+x’y1y2’+…=…+x’y2’+…
ENEE 644                            3
Lessons We Have Learned
 Two codes are adjacent if they only differ in one
bit. (e.g. 00 and 01 are adjacent, 01 and 10 are not.)
 Any k-bit code has k adjacent codes.
 If two states are given adjacent codes, we will be
able to extract common cubes from the next state
and output functions.
 Common fanout (next) state       x   CS NS    O
 Common fanin (current) state     a    A  B    1
b    A C     1

ENEE 644                      4
Attraction Graph
 The attraction graph of a FSM is a weighted,
undirected, complete graph that represents the
attraction between each pair of states.
 Node: state
 Edge: the attraction between the two states
 If two states share a common fanout/fanin state,
their attraction should increase.
 Two states that have a strong attraction should
 How to measure the attraction quantitatively?
ENEE 644                    5
Fanout-Oriented Algorithm
 State Transition Matrix S|s|x|s|:                                        0/0
 Row: one per (current) state                                               A
 Column: one per (next) state                                                     1/1
 Entry: (non-negative) number of arcs going from state si         1/1
0/0
(row) to state sj (column)
 Output Matrix Z|s|x|O|:                                              C         1/0
B
 Row: one per (current) state                                         0/0
 Column: one per output
1 1 0 
 Entry: (non-negative) number of arcs going out of state si                       
(row) with output zj (column)
1 0 1 
 Let Nb be the number of encoding bits, then the                                1 0 1 
attraction between states si and sj is given                                        
by Nb•Si•SjT+Zi•ZjT
A                     1
 W(1,2) = 2(1 1 0)(1 0 1)T+(1)(0)T=2
2
 
 W(1,3) = 2(1 1 0)(1 0 1)T+(1)(1)T=3                     3                           0
 W(2,3) = 2(1 0 1)(1 0 1)T+(0)(1)T=4                   C          B                 1
4                      
ENEE 644                                                 6
Fanin-Oriented Algorithm
^
 State Transition Matrix S|s|x|s|:                                        0/0
 Row: one per (next) state                                                  A
 Column: one per (current) state                                                  1/1
 Entry: (non-negative) number of arcs going from state sj         1/1
0/0
(column) to state si (row)
 Input Matrix X|s|x|I|:                                               C         1/0
B
 Row: one per (current) state                                         0/0
 Column: |I| per input
1 1 1
 Entry: (non-negative) number of arcs entering state si                           
(row) with input xj (column)
 1 0 0
 Let Nb be the number of encoding bits, then the                                 0 1 1
attraction between states si and sj is given                                        
^ ^
by Nb•Si•SjT+Xi•XjT
A                    2 1
 W(1,2) = 2(1 1 1)(1 0 0)T+(2 1)(0 1)T=3
3
    
 W(1,3) = 2(1 1 1)(0 1 1)T+(2 1)(1 1)T=7                  7                        0 1
 W(2,3) = 2(1 0 0)(0 1 1)T+(0 1)(1 1)T=1                  C       B                1 1
1                       
ENEE 644                                                  7
The Encoding Algorithm
 Given the attraction graph (matrix W(i,j)), assign
a unique Nb-bit code to each state.
 For each node si, find the Nb largest attractions W(i,j)
and sum them up;
 Pick the one with the largest sum and assign it code
0…0;
 Assign the Nb adjacent codes of 0…0 to the Nb
neighbor states that have the Nb largest attractions;
 Remove the Nb+1 node and repeat until all nodes get
a Nb-bit code;

ENEE 644                             8
Example: The Encoding Algorithm
0/0
A
1/1
1/1
0/0
C         1/0
B
0/0
Fanout-Oriented Algorithm:                                      Fanin-Oriented Algorithm:
01                                                      00
A                  A                                       A               A
3        2         3        2                             7        3       7        3
C         B        C         B                           C          B     C          B
4                 4                                       1               1
00         10                                           10         01

Y1=y1’y2x                                                Y1=y1’y2x’ + y1’y2x
Y2=y1’y2x + y1y2’x’ + y1’y2’x                            Y2=y1’y2’x
Z = y1’x          (13 literals)                          Z = y2’x          (11 literals)

ENEE 644                                           9
Decomposition and Encoding: Motivation
 There are many different ways to encode a FSM
with four states: {A,B,C,D}.
 If we know that pairs (A,B),(C,D); (A,C),(B,D)
only 8 different assignments:
   A=00, B=01, C=10, D=11
   A=00, B=10, C=01, D=11
   A=01, B=00, C=11, D=10
   A=01, B=11, C=00, D=10
   A=10, B=11, C=00, D=01
   A=10, B=00, C=11, D=01
   A=11, B=01, C=10, D=00
   A=11, B=10, C=01, D=00

ENEE 644            10
Notations on Partitions
 A partition  on a set S is a collection of disjoint subsets
(called blocks) of S whose union is S.
 ={(1,2),(3,4,6),(5,8),(7)} is a partition of S={1,2,3,4,5,6,7,8}
 0={(1),(2),(3)} and 1={(1,2,3)} are two trivial partitions of S={1,2,3}
 For s,t S, st () means that they belong to the same block of
partition 
 For two partitions 1 and 2, their meet 1•2 is also a partition
where st (1•2) iff st (1) and st (2); their join 1+2 is the
partition where st (1+2) iff there exists a sequence in S:
s=s0,s1,…,sn=t, such that for all i=0,…n-1, either si si+1(1) or si
si+1(2).
 Given 1={(1,2),(3,4,6),(5,8),(7)}, 2={(1,6),(2,5,8),(3,4,7)},
1•2={(1),(2),(3,4),(5,8),(6),(7)}, 1+2={(1,2,3,4,5,6,7,8)}

ENEE 644                                  11
Substitution Property
 A partition  on set S of machine M=<I,S,,S0,O,>
has the substitution property (S.P.) iff st()
implies that (s,a)(t,a)() for all aI.
 Theorem. A sequential machine M has a non-
trivial parallel decomposition of its states iff there
exist two non-trivial S.P. partitions 1 and 2 on M
such that meet 1•2=0.
 Theorem. IF a sequential machine has one non-
trivial S.P. partition, then it has a non-trivial serial
decomposition.

ENEE 644                       12
Parallel Decomposition
0       1
 1 = {(0,1,2),(3,4,5)} and           0        3       2           0
2={(0,5),(1,4),(2,3)} are two       1        5       2           0

S.P. partitions and 1•2=0.         2        4       1           0
3        1       4           1
 Let A=(0,1,2), B=(3,4,5), and        4        0       3           0
X=(0,5),Y=(1,4),Z=(2,3), we          5        2       3           0

can build two machines.               0   1               0   1
X       Z   Z       0
 The output, in this case, is     A    B   A   0
Y       X   Z       0
B    A   B   1
the product of the outputs of                     Z       Y   Y       1

the two newly built machines.
G1

G2

ENEE 644                                        13
Serial Decomposition
 1 = {(1,2,3),(4,5)} is the only            1
0
1
1
4
0
1
1
0
S.P. partition.                             2     3   5    1   0
3     2   4    0   0
 We choose another partition                 4     3   1    1   1
2={(1,4),(2,5),(3)} s.t. 1•2=0.          5     2   2    0   1
 Let A=(1,2,3), B=(4,5), and                       0   1    0   1
X=(1,4),Y=(2,5),Z=(3), we can               A,X   X   X    1   0
A,Y   Z   Y    1   0
rebuild this machine as                     A,Z   Y   X    0   0
A   A   B   B   A   A   B   B               B,X   Z   X    1   1
0   1   0   1   0   1   0   1               B,Y   Y   Y    0   1
X X   X   Z   X   1   0   1   1
Y Z   Y   Y   Y   1   0   0   1              G1
G2
Z Y   X   -   -   0   0   -   -

ENEE 644                           14
Computation of the S.P. Partition
 Recall that “A partition  on set S of machine
M=<I,S,,S0,O,> has the substitution property (S.P.) iff
st() implies that (s,a)(t,a)() for all aI.”
 So S.P. partition is independent of output.
   If (1,2)(1,4),(2,3)(1,2,3,4) (transitivity){(1,2,3,4,5)} trivial.
0   1        If (1,3)(1,5)(1,3,5)(2,3)(1,2,3,5) (1,2,3,4,5) trivial.
1   1   2        If (1,4), form a block.
 If (2,3) (4,5) (1,4,5) {(1,4,5),(2,3)}
2   4   3            If (2,5) (1,4) {(1,4),(2,5),(3)}
3   5   2            If (2)
4   1   2                  if (3,5) (1,5),(2,3), contradiction.
 If (3) {(1,4),(2),(3),(5)}
5   1   3        Another partition: {(1),((2,3),(4,5)}

ENEE 644                                             15
Decomposition and State Encoding
 We need two bits xy to encode a sequential state
machine M with four states: A,B,C,D.
   Suppose 1={(A,B), (C,D)} and 2={(A,C),(B,D)} are two
non-trivial S.P. partitions.
   Clearly 1•2=0 so we have a non-trivial parallel
decomposition, M1={ab,cd} and M2={ac,bd}, both with
only two states.
   If we use bit x to encode M1 and bit y to encode M2 as
ab=0, cd=1; and ac=0, bd=1.
   Then M can be encoded as A=00,B=01,C=10,D=11.
   SE problem becomes finding S.P. partitions and applying
parallel/serial decompositions.
ENEE 644                       16

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 15 posted: 3/13/2012 language: English pages: 16
How are you planning on using Docstoc?