Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sequential System Synthesis -- State Encoding. ENEE 6442 The State Encoding Problem > Goal: Given n states, assign a unique code (of length of at least.

Similar presentations


Presentation on theme: "Sequential System Synthesis -- State Encoding. ENEE 6442 The State Encoding Problem > Goal: Given n states, assign a unique code (of length of at least."— Presentation transcript:

1 Sequential System Synthesis -- State Encoding

2 ENEE 6442 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

3 ENEE 6443 Example: Why State Encoding Matters? > Consider a fragment of the cube table for an FSM: =Let y 1 y 2 and Y 1 Y 2 be the current state and next state. We want to represent Y 1,Y 2, and output O as a function of y 1,y 2, and input x. 1CB0 1CA0ONSCSx =Assignment 1: A=01, B=10, C=11 Y 1 =…+x’y 1 ’y 2 +…+x’y 1 y 2 ’+… Y 2 =…+x’y 1 ’y 2 +…+x’y 1 y 2 ’+… O=…+x’y 1 ’y 2 +…+x’y 1 y 2 ’+… 111100 111010O Y1Y2Y1Y2Y1Y2Y1Y2 y1y2y1y2y1y2y1y2x 111100 111000O Y1Y2Y1Y2Y1Y2Y1Y2 y1y2y1y2y1y2y1y2x =Assignment 2: A=00, B=10, C=11 Y 1 =…+x’y 1 ’y 2 ’+…+x’y 1 y 2 ’+…=…+x’y 2 ’+…

4 ENEE 6444 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 =Common fanin (current) state > Identify pairs that should receive adjacent codes. 1CAb 1BAaONSCSx

5 ENEE 6445 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 be assigned adjacent codes. > How to measure the attraction quantitatively?

6 ENEE 6446 Fanout-Oriented Algorithm > State Transition Matrix S |s|x|s| : =Row: one per (current) state =Column: one per (next) state =Entry: (non-negative) number of arcs going from state s i (row) to state s j (column) > Output Matrix Z |s|x|O| : =Row: one per (current) state =Column: one per output =Entry: (non-negative) number of arcs going out of state s i (row) with output z j (column) > Let N b be the number of encoding bits, then the attraction between states s i and s j is given by N b S i S j T +Z i Z j T =W(1,2) = 2(1 1 0)(1 0 1) T +(1)(0) T =2 =W(1,3) = 2(1 1 0)(1 0 1) T +(1)(1) T =3 =W(2,3) = 2(1 0 1)(1 0 1) T +(0)(1) T =4 A C B 1/1 1/0 0/0 1/1 0/0 0/0 A C B 3 4 2

7 ENEE 6447 Fanin-Oriented Algorithm > State Transition Matrix S |s|x|s| : =Row: one per (next) state =Column: one per (current) state =Entry: (non-negative) number of arcs going from state s j (column) to state s i (row) > Input Matrix X |s|x|I| : =Row: one per (current) state =Column: |I| per input =Entry: (non-negative) number of arcs entering state s i (row) with input x j (column) > Let N b be the number of encoding bits, then the attraction between states s i and s j is given by N b S i S j T +X i X j T =W(1,2) = 2(1 1 1)(1 0 0) T +(2 1)(0 1) T =3 =W(1,3) = 2(1 1 1)(0 1 1) T +(2 1)(1 1) T =7 =W(2,3) = 2(1 0 0)(0 1 1) T +(0 1)(1 1) T =1 A C B 1/1 1/0 0/0 1/1 0/0 0/0 A C B 7 1 3 ^^^

8 ENEE 6448 The Encoding Algorithm > Given the attraction graph (matrix W(i,j)), assign a unique N b -bit code to each state. =For each node s i, find the N b largest attractions W(i,j) and sum them up; =Pick the one with the largest sum and assign it code 0…0; =Assign the N b adjacent codes of 0…0 to the N b neighbor states that have the N b largest attractions; =Remove the N b +1 node and repeat until all nodes get a N b -bit code;

9 ENEE 6449 Example: The Encoding Algorithm A C B 3 4 2 A C B 7 1 3 Fanout-Oriented Algorithm: A C B 3 4 2 001001 A C B 7 1 3 100100 Fanin-Oriented Algorithm: Y 1 =y 1 ’y 2 x Y 2 =y 1 ’y 2 x + y 1 y 2 ’x’ + y 1 ’y 2 ’x Z = y 1 ’x (13 literals) A C B 1/1 1/0 0/0 1/1 0/0 0/0 Y 1 =y 1 ’y 2 x’ + y 1 ’y 2 x Y 2 =y 1 ’y 2 ’x Z = y 2 ’x (11 literals)

10 ENEE 64410 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) should receive adjacent codes, then there are 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

11 ENEE 64411 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=s 0,s 1,…,s n =t, such that for all i=0,…n-1, either s i  s i+1 (  1 ) or s i  s i+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)}

12 ENEE 64412 Substitution Property > A partition  on set S of machine M= 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.

13 ENEE 64413 Parallel Decomposition >  1 = {(0,1,2),(3,4,5)} and  2 ={(0,5),(1,4),(2,3)} are two S.P. partitions and  1  2 =0. > Let A=(0,1,2), B=(3,4,5), and X=(0,5),Y=(1,4),Z=(2,3), we can build two machines. > The output, in this case, is the product of the outputs of the two newly built machines. 0325 0304 1413 0142 0251 023010 1BAB 0ABA101YYZ 0ZXY 0ZZX10 G1G1G1G1 G2G2G2G2

14 ENEE 64414 Serial Decomposition >  1 = {(1,2,3),(4,5)} is the only S.P. partition. > We choose another partition  2 ={(1,4),(2,5),(3)} s.t.  1  2 =0. > Let A=(1,2,3), B=(4,5), and X=(1,4),Y=(2,5),Z=(3), we can rebuild this machine as 10225 11134 00423 01532 014111010 G1G1G1G1 G2G2G2G2 10YYB,Y 11XZB,X 00XYA,Z 01YZA,Y 01XXA,X1010 --00--XYZ 1001YYYZY 1101XZXXX B1B1B1B1 B0B0B0B0 A1A1A1A1 A0A0A0A0 B1B1B1B1 B0B0B0B0 A1A1A1A1 A0A0A0A0

15 ENEE 64415 Computation of the S.P. Partition > Recall that “ A partition  on set S of machine M= 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. 315 214 253 342 21110 > If (1,2)  (1,4),(2,3)  (1,2,3,4) (transitivity)  {(1,2,3,4,5)} trivial. > If (1,3)  (1,5)  (1,3,5)  (2,3)  (1,2,3,5)  (1,2,3,4,5) trivial. > If (1,4), form a block. > If (2,3)  (4,5)  (1,4,5)  {(1,4,5),(2,3)} > If (2,5)  (1,4)  {(1,4),(2,5),(3)} > If (2) > if (3,5)  (1,5),(2,3), contradiction. > If (3)  {(1,4),(2),(3),(5)} > Another partition: {(1),((2,3),(4,5)}

16 ENEE 64416 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, M 1 ={ab,cd} and M 2 ={ac,bd}, both with only two states. > If we use bit x to encode M 1 and bit y to encode M 2 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.


Download ppt "Sequential System Synthesis -- State Encoding. ENEE 6442 The State Encoding Problem > Goal: Given n states, assign a unique code (of length of at least."

Similar presentations


Ads by Google