CMPUT 329 Fall 2003 Topic C State Assignment

  • Slides: 104
Download presentation
CMPUT 329 - Fall 2003 Topic C: State Assignment José Nelson Amaral CMPUT 329

CMPUT 329 - Fall 2003 Topic C: State Assignment José Nelson Amaral CMPUT 329 - Computer Organization and Architecture II 1

Reading Assignment Chapter 7, section 7. 4. 6 CMPUT 329 - Computer Organization and

Reading Assignment Chapter 7, section 7. 4. 6 CMPUT 329 - Computer Organization and Architecture II 2

Incompletely Specified State Tables Network A X Sequential Network B Z Network C Assumptions:

Incompletely Specified State Tables Network A X Sequential Network B Z Network C Assumptions: (i) Network A can only generate sequences X=100 and X = 110. (ii) Network B produces output Z=1 when it receives X=110 and output Z=0 for X=100 (iii) Network C ignores values of Z at other times. CMPUT 329 - Computer Organization and Architecture II 3

Incompletely Specified State Tables S 0 1/- S 1 CMPUT 329 - Computer Organization

Incompletely Specified State Tables S 0 1/- S 1 CMPUT 329 - Computer Organization and Architecture II 4

Incompletely Specified State Tables S 0 S 2 0/- S 3 1/- S 1

Incompletely Specified State Tables S 0 S 2 0/- S 3 1/- S 1 1/- CMPUT 329 - Computer Organization and Architecture II 5

Incompletely Specified State Tables S 0 0/0 S 2 0/- S 3 1/- S

Incompletely Specified State Tables S 0 0/0 S 2 0/- S 3 1/- S 1 1/- CMPUT 329 - Computer Organization and Architecture II 6

Incompletely Specified State Tables S 0 0/1 S 2 0/- S 3 1/- S

Incompletely Specified State Tables S 0 0/1 S 2 0/- S 3 1/- S 1 1/- Whenever there is a don’t care state or a don’t care output, I can fill it with any value. CMPUT 329 - Computer Organization and Architecture II 7

Incompletely Specified State Tables S 0 0/1 S 2 0/- S 3 1/- S

Incompletely Specified State Tables S 0 0/1 S 2 0/- S 3 1/- S 1 1/- Therefore, I should fill it in a way that allows minimization of the state machine. CMPUT 329 - Computer Organization and Architecture II 8

Incompletely Specified State Tables 0/0 S 0 1/0/- 0/1 S 2 0/- S 3

Incompletely Specified State Tables 0/0 S 0 1/0/- 0/1 S 2 0/- S 3 S 1 1/- Therefore, I should fill it in a way the allows minimization of the state machined. CMPUT 329 - Computer Organization and Architecture II 9

Incompletely Specified State Tables 0/0 S 0 1/0/- 0/1 S 2 0/- S 3

Incompletely Specified State Tables 0/0 S 0 1/0/- 0/1 S 2 0/- S 3 S 1 1/- Therefore, I should fill it in a way the allows minimization of the state machined. CMPUT 329 - Computer Organization and Architecture II 10

Incompletely Specified State Tables 0/0 S 0 1/- 0/1 S 2 0/- S 3

Incompletely Specified State Tables 0/0 S 0 1/- 0/1 S 2 0/- S 3 S 1 1/- Therefore, I should fill it in a way the allows minimization of the state machined. CMPUT 329 - Computer Organization and Architecture II 11

Incompletely Specified State Tables 0/0 S 0 1/0/1 1/- S 1 CMPUT 329 -

Incompletely Specified State Tables 0/0 S 0 1/0/1 1/- S 1 CMPUT 329 - Computer Organization and Architecture II 12

Do State Assignments Matter? 00 1 S 4 1 1 S 0 0 00

Do State Assignments Matter? 00 1 S 4 1 1 S 0 0 00 0 1 0 S 3 01 1 0 11 S 2 10 0 CMPUT 329 - Computer Organization and Architecture II 13

State and Output Equations for Asgn #1 I 0 Q 1 1 1 X

State and Output Equations for Asgn #1 I 0 Q 1 1 1 X X X 1 1 1 Q 0 Q 2 D 2 = Q 1 ’ I 0 ’ + Q 2 ’ I 0 ’ + Q 1 Q 0 ’ CMPUT 329 - Computer Organization and Architecture II 14

State and Output Equations for Asgn #1 I 0 X Q 1 1 X

State and Output Equations for Asgn #1 I 0 X Q 1 1 X X X 1 1 1 X X Q 0 1 Q 2 D 2 = Q 1 ’ I 0 ’ + Q 2 ’ I 0 ’ + Q 1 Q 0 ’ D 1 = Q 1 Q 2 ’ + Q 2 Q 1 ’ + Q 2 ’ I 0 CMPUT 329 - Computer Organization and Architecture II 15

State and Output Equations for Asgn #1 I 0 1 X Q 1 1

State and Output Equations for Asgn #1 I 0 1 X Q 1 1 X X X 1 1 1 Q 0 Q 2 D 2 = Q 1 ’ I 0 ’ + Q 2 ’ I 0 ’ + Q 1 Q 0 ’ D 1 = Q 1 Q 2 ’ + Q 2 Q 1 ’ + Q 2 ’ I 0 D 0 = Q 2 Q 1’I 0’ + Q 2’Q 0’ I 0 + Q 1 Q 2’I 0’ CMPUT 329 - Computer Organization and Architecture II 16

State and Output Equations for Asgn #1 I 0 1 X Q 1 1

State and Output Equations for Asgn #1 I 0 1 X Q 1 1 X X X 1 1 1 Q 0 Q 2 D 2 = Q 1 ’ I 0 ’ + Q 2 ’ I 0 ’ + Q 1 Q 0 ’ D 1 = Q 1 Q 2 ’ + Q 2 Q 1 ’ + Q 2 ’ I 0 D 0 = Q 2 Q 1’I 0’ + Q 2’Q 0’ I 0 + Q 1 Q 2’I 0’ CMPUT 329 - Computer Organization and Architecture II 17

State and Output Equations for Asgn #1 1 X Q 1 X 1 Q

State and Output Equations for Asgn #1 1 X Q 1 X 1 Q 0 X Q 2 D 2 = Q 1 ’ I 0 ’ + Q 2 ’ I 0 ’ + Q 1 Q 0 ’ D 1 = Q 1 Q 2 ’ + Q 2 Q 1 ’ + Q 2 ’ I 0 D 0 = Q 2 Q 1’I 0’ + Q 2’Q 0’ I 0 + Q 1 Q 2’I 0’ Z 0 = Q 2’Q 0 + Q 2 Q 1’ CMPUT 329 - Computer Organization and Architecture II 18

State and Output Equations for Asgn #1 1 Q 1 X X 1 X

State and Output Equations for Asgn #1 1 Q 1 X X 1 X Q 0 Q 2 D 2 = Q 1 ’ I 0 ’ + Q 2 ’ I 0 ’ + Q 1 Q 0 ’ D 1 = Q 1 Q 2 ’ + Q 2 Q 1 ’ + Q 2 ’ I 0 D 0 = Q 2 Q 1’I 0’ + Q 2’Q 0’ I 0 + Q 1 Q 2’I 0’ Z 0 = Q 2’Q 0 + Q 2 Q 1’ Z 1 = Q 1 Q 0 ’ + Q 2 Q 1 ’ CMPUT 329 - Computer Organization and Architecture II 19

State and Output Equations for Asgn #1 same term, only pay for it once

State and Output Equations for Asgn #1 same term, only pay for it once CMPUT 329 - Computer Organization and Architecture II 20

State and Output Equations for Asgn #2 I 0 1 X Q 1 1

State and Output Equations for Asgn #2 I 0 1 X Q 1 1 X X X Q 0 Q 2 D 2 = Q 2’Q 1’ CMPUT 329 - Computer Organization and Architecture II 21

State and Output Equations for Asgn #2 I 0 Q 1 1 X X

State and Output Equations for Asgn #2 I 0 Q 1 1 X X 1 1 1 Q 0 Q 2 D 2 = Q 2’Q 1’ D 1 = Q 2 + Q 0 + Q 1’I 0 CMPUT 329 - Computer Organization and Architecture II 22

State and Output Equations for Asgn #2 I 0 1 X Q 1 X

State and Output Equations for Asgn #2 I 0 1 X Q 1 X X X Q 0 1 Q 2 D 2 = Q 2’Q 1’ D 1 = Q 2 + Q 0 + Q 1’I 0 D 0 = Q 2 I 0 CMPUT 329 - Computer Organization and Architecture II 23

State and Output Equations for Asgn #2 1 X Q 1 X X Q

State and Output Equations for Asgn #2 1 X Q 1 X X Q 0 1 Q 2 D 2 = Q 2’Q 1’ D 1 = Q 2 + Q 0 + Q 1’I 0 D 0 = Q 2 I 0 Z 0 = Q 2 CMPUT 329 - Computer Organization and Architecture II 24

State and Output Equations for Asgn #2 1 Q 1 X X 1 X

State and Output Equations for Asgn #2 1 Q 1 X X 1 X Q 0 Q 2 D 2 = Q 2’Q 1’ D 1 = Q 2 + Q 0 + Q 1’I 0 D 0 = Q 2 I 0 Z 0 = Q 2 Z = Q + Q 2 Q 1’ CMPUT 329 - Computer 1 0 Organization and Architecture II 25

State and Output Equations for Asgn #2 CMPUT 329 - Computer Organization and Architecture

State and Output Equations for Asgn #2 CMPUT 329 - Computer Organization and Architecture II 26

State and Output Equations for Asgn #2 13 CMPUT 329 - Computer Organization and

State and Output Equations for Asgn #2 13 CMPUT 329 - Computer Organization and Architecture II 36 27

How to choose a state assignment? What makes one assignment yield a set of

How to choose a state assignment? What makes one assignment yield a set of equations with a cost of 36 and another assignment result in a set of equations with a cost of 13? How can we choose the best state assignment for a given state machine? Could we try all assignments by enumeration? CMPUT 329 - Computer Organization and Architecture II 28

Number of State Assignments Given a finite state machine M with r states. Assume

Number of State Assignments Given a finite state machine M with r states. Assume that we use s bits to encode the states, where s is the smallest integer such that 2 s r. How many state assigments can be made to this machine? CMPUT 329 - Computer Organization and Architecture II 29

Number of State Assignments How many state assigments can be made to this machine?

Number of State Assignments How many state assigments can be made to this machine? CMPUT 329 - Computer Organization and Architecture II 30

Number of State Assignments How many state assigments can be made to this machine?

Number of State Assignments How many state assigments can be made to this machine? CMPUT 329 - Computer Organization and Architecture II 31

Number of State Assignments How many state assigments can be made to this machine?

Number of State Assignments How many state assigments can be made to this machine? CMPUT 329 - Computer Organization and Architecture II 32

Equivalent State Assignments (Definition 1) How many of these state assigments are equivalent to

Equivalent State Assignments (Definition 1) How many of these state assigments are equivalent to each other? State Equivalency (Mc. Cluskey and Unger, 1959): State assignments are equivalent if they differ only by the re-ordenation of the columns of bits in each assignment, or if they differ by complementing a columns of the matrix. CMPUT 329 - Computer Organization and Architecture II 33

Equivalent State Assignments (Definition 2) But, in 1967 Weiner and Smith showed that assignments

Equivalent State Assignments (Definition 2) But, in 1967 Weiner and Smith showed that assignments that result from complementing a column of bits are not equivalent to each other. Therefore their definition of state equivalency is: State Equivalency (Weiner and Smith, 1967): State assignments are equivalent if they differ only by the re-ordenation of columns. CMPUT 329 - Computer Organization and Architecture II 34

Equivalent State Assignments (Example) Which of the following state assignments are equivalent? (a) (c)

Equivalent State Assignments (Example) Which of the following state assignments are equivalent? (a) (c) (b) CMPUT 329 - Computer Organization and Architecture II (d) 35

Number of Distinct State Assignments Given a finite state machine M with r states.

Number of Distinct State Assignments Given a finite state machine M with r states. Assume that we use s bits to encode the states, where s is the smallest integer such that 2 s r. How many distinct assignments exist for this machine? CMPUT 329 - Computer Organization and Architecture II 36

Number of Distinct State Assignments By Mc. Cluskey’s definition (1959), the number of equivalent

Number of Distinct State Assignments By Mc. Cluskey’s definition (1959), the number of equivalent state assignments is given by: Using Weiner-Smith’s definition (1967), Harrison found (in 1968) that the number of equivalent state assignments is: CMPUT 329 - Computer Organization and Architecture II 37

Number of Distinct State Assignments A: State Assignments N 1: Distinct State Assign. (Mc.

Number of Distinct State Assignments A: State Assignments N 1: Distinct State Assign. (Mc. Cluskey) N 2: Distinct State Assign. (Weiner-Smith-Harrison) CMPUT 329 - Computer Organization and Architecture II 38

Number of Distinct States Assignments A: State Assignments N 1: Distinct State Assignments (Mc.

Number of Distinct States Assignments A: State Assignments N 1: Distinct State Assignments (Mc. Cluskey) N 2: Distinct State Assign. (Weiner-Smith-Harrison) CMPUT 329 - Computer Organization and Architecture II 39

The Right Number of Distinct States In 1977, Rhyne and Noe showed that: (I)

The Right Number of Distinct States In 1977, Rhyne and Noe showed that: (I) for circuits built with flip-flops SR, JK, and T, there are N 1 (Mc. Cluskey) distinct states. (ii) for machines implemented with flip-flops D, there are N 2 (Weiner-Smith-Harrison) distinct states. CMPUT 329 - Computer Organization and Architecture II 40

Finding an Optimal State Assignment It seems that we will not be able to

Finding an Optimal State Assignment It seems that we will not be able to enumerate all possible state assignments, generate the next state and output equations, compute the cost and then choose the best one. As a matter of fact, the State Assignment Problem (SAP) is a well-known NP-complete problem. Therefore we must settle for “good” state assignments. CMPUT 329 - Computer Organization and Architecture II 41

Distance Between States The distance between two states Sa and Sb, D(Sa, Sb) is

Distance Between States The distance between two states Sa and Sb, D(Sa, Sb) is defined as the Hamming distance between the code assigned to Sa, A(Sa), and the code assinged to Sb, A(Sb). CMPUT 329 - Computer Organization and Architecture II 42

Distance Between States (Example) As an example lets compute the distance to state S

Distance Between States (Example) As an example lets compute the distance to state S 0 of every other state in our example CMPUT 329 - Computer Organization and Architecture II 43

Distance Between States (Example) As an example lets compute the distance to state S

Distance Between States (Example) As an example lets compute the distance to state S 0 of every other state in our example CMPUT 329 - Computer Organization and Architecture II 44

State Distance Graph(Asgn #1) State Distance CMPUT 329 - Computer Graph(Asgn #2) Organization and

State Distance Graph(Asgn #1) State Distance CMPUT 329 - Computer Graph(Asgn #2) Organization and Architecture II 45

The Successor Rule Good state assignments result when the following set of empirical rules

The Successor Rule Good state assignments result when the following set of empirical rules are followed in the selection of the state assignment: Rule 1: States that are the next states of a given state should be close to each other 1 Sj Si 0 Sk Suc(Si) = {Sj , Sk} Sj and Sk should be close to each other CMPUT 329 - Computer Organization and Architecture II 46

The Successor Rule (Example) Assign #2 better satisfies the successor rule than Assign #1

The Successor Rule (Example) Assign #2 better satisfies the successor rule than Assign #1 State Distance Graph(Asgn #1) State Distance CMPUT 329 - Computer Graph(Asgn #2) Organization and Architecture II 47

The Predecessor Rule 2: States that have the same next state, for a given

The Predecessor Rule 2: States that have the same next state, for a given input, should be close to each other. Sa Sb I 0=1 Sc Pred(Sc, I 0=1) = {Sa , Sb} Sa and Sb should be close to each other CMPUT 329 - Computer Organization and Architecture II 48

The Predecessor Rule (Example) Assign #2 better follows the predecessor rule than Assign #1

The Predecessor Rule (Example) Assign #2 better follows the predecessor rule than Assign #1 State Distance Graph(Asgn #1) State Distance CMPUT 329 - Computer Graph(Asgn #2) Organization and Architecture II 49

The Output Rule 3: States that have the same output for a given input

The Output Rule 3: States that have the same output for a given input should be close to each other. For a Moore machine we say that each output partitions the states into two subsets. CMPUT 329 - Computer Organization and Architecture II 50

The Output Rule (Example) For a Moore machine we say that each output partitions

The Output Rule (Example) For a Moore machine we say that each output partitions the states into two subsets. In our example: O(Z 0) = {(S 0, S 3, S 4), (S 1, S 2)} O(Z 1) = {(S 0, S 2, S 4), (S 1, S 3)} CMPUT 329 - Computer Organization and Architecture II 51

The Output Rule (Example) O(Z 0) = {(S 0, S 3, S 4), (S

The Output Rule (Example) O(Z 0) = {(S 0, S 3, S 4), (S 1, S 2)} O(Z 1) = {(S 0, S 2, S 4), (S 1, S 3)} Assign #2 better follows the output rule for Z 0 State Distance Graph(Asgn #1) State Distance CMPUT 329 - Computer Graph(Asgn #2) Organization and Architecture II 52

The Output Rule (Example) O(Z 0) = {(S 0, S 3, S 4), (S

The Output Rule (Example) O(Z 0) = {(S 0, S 3, S 4), (S 1, S 2)} O(Z 1) = {(S 0, S 2, S 4), (S 1, S 3)} Assign #2 better follows the output rule for Z 1 State Distance Graph(Asgn #1) State Distance CMPUT 329 - Computer Graph(Asgn #2) Organization and Architecture II 53

The Transition Rule 4: If there is a state transition between two states, the

The Transition Rule 4: If there is a state transition between two states, the states should be close to each other. Typically this rule is used to decide a tie between the other rules. CMPUT 329 - Computer Organization and Architecture II 54

The Transition Rule (Example) Assign #2 better follows the transition rule State Distance Graph(Asgn

The Transition Rule (Example) Assign #2 better follows the transition rule State Distance Graph(Asgn #1) State Distance CMPUT 329 - Computer Graph(Asgn #2) Organization and Architecture II 55

The State “ 0” Guideline: The cost of the circuit will not be affected

The State “ 0” Guideline: The cost of the circuit will not be affected by the choice of which state receives the state “ 0” (according to Mc. Cluskey). Therefore to simplify reset generating circuits, the state “ 0” should always be assigned to the reset state. CMPUT 329 - Computer Organization and Architecture II 56

Successor Sets Using our definitions, we can compute the set of successors of each

Successor Sets Using our definitions, we can compute the set of successors of each state in our example: S(S 0) S(S 1) S(S 2) S(S 3) S(S 4) CMPUT 329 - Computer Organization and Architecture II = = = {S 1, S 2} {S 3, S 4} {S 0} 57

Predecessor Sets We can also compute the set of predecessors of each state in

Predecessor Sets We can also compute the set of predecessors of each state in our example: P P P P (S 1, I 0=0) (S 4, I 0=0) (S 0, I 0=0) (S 2, I 0=1) (S 3, I 0=1) (S 4, I 0=1) (S 0, I 0=1) CMPUT 329 - Computer Organization and Architecture II = = = = {S 0} {S 1, S 2 , S 3} {S 4} {S 0} {S 1, S 2} {S 3} {S 0} 58

Sets and Output Partition (Example) Thus for our example we have: Output Partitions: O(Z

Sets and Output Partition (Example) Thus for our example we have: Output Partitions: O(Z 0) = {(S 0, S 3, S 4), (S 1, S 2)} O(Z 1) = {(S 0, S 2, S 4), (S 1, S 3)} Successor Sets: S(S 0) = {S 1, S 2} S(S 1) = {S 3, S 4} S(S 2) = {S 3, S 4} S(S 3) = {S 4} S(S 4) = {S 0} Predecessor Sets: P (S 1, I 0=0) = {S 0} P (S 4, I 0=0) = {S 1, S 2 , S 3} P (S 0, I 0=0) = {S 4} P (S 2, I 0=1) = {S 0} P (S 3, I 0=1) = {S 1, S 2} P (S 4, I 0=1) = {S 3} P (S 0, I 0=1) = {S 0} But we are only interested in sets with multiple elements. CMPUT 329 - Computer Organization and Architecture II 59

Sets and Output Partition (Example) Thus for our example we have: Output Partitions: O(Z

Sets and Output Partition (Example) Thus for our example we have: Output Partitions: O(Z 0) = {(S 0, S 3, S 4), (S 1, S 2)} O(Z 1) = {(S 0, S 2, S 4), (S 1, S 3)} Predecessor Sets: P (S 4, I 0=0) = {S 1, S 2 , S 3} P (S 3, I 0=1) = {S 1, S 2} Successor Sets: S(S 0) = {S 1, S 2} S(S 1) = {S 3, S 4} S(S 2) = {S 3, S 4} CMPUT 329 - Computer Organization and Architecture II 60

Obtaining Good State Assignments (Example) Successor Sets: S(S 0) = {S 1, S 2}

Obtaining Good State Assignments (Example) Successor Sets: S(S 0) = {S 1, S 2} S(S 1) = {S 3, S 4} S(S 2) = {S 3, S 4} Predecessor Sets: P (S 4, I 0=0) = {S 1, S 2 , S 3} P (S 3, I 0=1) = {S 1, S 2} Problem: Choose a good state assignment for this machine. Output Partitions: O(Z 0) = {(S 0, S 3, S 4), (S 1, S 2)} O(Z 1) = {(S 0, S 2, S 4), (S 1, S 3)} CMPUT 329 - Computer Organization and Architecture II 61

The Desired Adjacency Graph (DAG) Based on early work of Armstrong (1962), Amaral (1990)

The Desired Adjacency Graph (DAG) Based on early work of Armstrong (1962), Amaral (1990) incorporated the state assignment rules of Miller (1965) into a “Desired Adjacency Graph” that can be used to translate the state assignment rules into a graph that encodes the strenght of the connection between states. J. N. Amaral and W. C. Cunha, “State Assignment Algorithm for Incompletely Specified Finite State Machines, ” in Fifth Congress of the Brazilian Society for Microelectronics, pp. 174 -183, 1990. J. N. Amaral, K. Tumer, and J. Ghosh, “Designing Genetic Algorithms for the State Assignment Problem, ” IEEE Transactions on Systems, Man, and Cybernetics, vol. 25, No. 4, April, 1995. CMPUT 329 - Computer Organization and Architecture II 62

The Successor DAG To create the successor DAG, we start with a graph with

The Successor DAG To create the successor DAG, we start with a graph with zero associated to all edges and add 1 to the edge (Sa, Sb) whenever Sa and Sb are elements of the successor set of a state. Successor Sets: S(S 0) = {S 1, S 2} S(S 1) = {S 3, S 4} S(S 2) = {S 3, S 4} Successor Desired Adjacency Graph CMPUT 329 - Computer Organization and Architecture II 63

The Predecessor DAG To create the predecessor DAG, we start with a graph with

The Predecessor DAG To create the predecessor DAG, we start with a graph with zero associated to all edges and add 1 to the edge (Sa, Sb) whenever Sa and Sb are elements of the predecessor set of a state. Predecessor Sets: P (S 4, I 0=0) = {S 1, S 2 , S 3} P (S 3, I 0=1) = {S 1, S 2} Predecessor Desired Adjacency Graph CMPUT 329 - Computer Organization and Architecture II 64

The Output DAG To create the output DAG, we start with a graph with

The Output DAG To create the output DAG, we start with a graph with zero associated to all edges and add 1 to the edge (Sa, Sb) whenever Sa and Sb are in the same partition for an output Zp. Output Partitions: O(Z 0) = {(S 0, S 3, S 4), (S 1, S 2)} O(Z 1) = {(S 0, S 2, S 4), (S 1, S 3)} Output Desired Adjacency Graph CMPUT 329 - Computer Organization and Architecture II 65

The Transition DAG To create the transition DAG, we start with a graph with

The Transition DAG To create the transition DAG, we start with a graph with zero associated to all edges and add 1 to the edge (Sa, Sb) whenever there is a transition from state Sa to state Sb. Transition Desired Adjacency Graph CMPUT 329 - Computer Organization and Architecture II 66

Combining DAGS Successor DAG Predecessor DAG Output DAG How do we combine these four

Combining DAGS Successor DAG Predecessor DAG Output DAG How do we combine these four DAGs to obtain a single one? Transition DAG CMPUT 329 - Computer Organization and Architecture II 67

The Weight of the Rules If all the rules were equally important, we could

The Weight of the Rules If all the rules were equally important, we could just add the values in the vertices. Comer [1984] suggests that Rule 2 (the predecessor rule) is the most important, followed by Rule 1 (the successor rule), and by Rule 3 (the output rule). Rule 4 (the transition rule) should be used only as a tie breaker. Amaral [1990] proposes the following weights for the combination of the Rule DAGs into a single DAG: DAG = 3 x. Successor + 4 x. Predecessor + 2 x. Output + Transition CMPUT 329 - Computer Organization and Architecture II 68

DAG = 3 x. Successor + 4 x. Predecessor + 2 x. Output +

DAG = 3 x. Successor + 4 x. Predecessor + 2 x. Output + Transition Successor DAG Predecessor DAG Transition DAG CMPUT 329 - Computer Organization and Architecture II Output DAG 69

How Asgn #2 and Asgn #2 measure up? DAG State Distance Graph(Asgn #1) State

How Asgn #2 and Asgn #2 measure up? DAG State Distance Graph(Asgn #1) State Distance CMPUT 329 - Computer Graph(Asgn #2) Organization and Architecture II 70

Matching Code Distances with the DAG Code Distances CMPUT 329 - Computer Organization and

Matching Code Distances with the DAG Code Distances CMPUT 329 - Computer Organization and Architecture II 71

Where to Start the State Assignment? DAG First we compute the Weight of each

Where to Start the State Assignment? DAG First we compute the Weight of each state Sa by adding the values associated with the edges (Sa, S? ) in the DAG. This weight vector indicates which states should be given priority during the state assignment process. Weight CMPUT 329 - Computer Organization and Architecture II 72

Matching Code Distances with the DAG CMPUT 329 - Computer Organization and Architecture II

Matching Code Distances with the DAG CMPUT 329 - Computer Organization and Architecture II 73

The Weight of the States We start with the state with the largest weight.

The Weight of the States We start with the state with the largest weight. DAG Weight CMPUT 329 - Computer Organization and Architecture II 74

The First State Assignment We start with the state with the largest weight. DAG

The First State Assignment We start with the state with the largest weight. DAG If there is a tie, we start with the state (among the ones that tie) that has an edge with maximum value in the DAG. We assign “ 0” to this state. Weight CMPUT 329 - Computer Organization and Architecture II 75

The Second State Assignment We start with the state with the largest weight. DAG

The Second State Assignment We start with the state with the largest weight. DAG If there is a tie, we start with the state (among the ones that tie) that has an edge with maximum value in the DAG. We assign “ 0” to this state. Weight Then find the state with the strongest connection with that first state in the DAG and assign “ 1” to this second state. CMPUT 329 - Computer Organization and Architecture II 76

Incomplete Assignment Table DAG Each cell of the table contains how much would be

Incomplete Assignment Table DAG Each cell of the table contains how much would be added to the expression If the state of the row would be given CMPUT 329 -of Computer the code the column Organization and Architecture II 77

Incomplete Assignment Table DAG Thus the value at cell (S 0, 010) is: CMPUT

Incomplete Assignment Table DAG Thus the value at cell (S 0, 010) is: CMPUT 329 - Computer Organization and Architecture II 78

Incomplete Assignment Table DAG The value in the other cells is computed in the

Incomplete Assignment Table DAG The value in the other cells is computed in the same way CMPUT 329 - Computer Organization and Architecture II 79

Incomplete Assignment Table DAG Then we add the values in each row. CMPUT 329

Incomplete Assignment Table DAG Then we add the values in each row. CMPUT 329 - Computer Organization and Architecture II 80

Selecting a State in the IAT DAG The state that has the heighest sum

Selecting a State in the IAT DAG The state that has the heighest sum in the table is the one that can cause the most damage (increase the cost of the circuit). Therefore it should be assigned first. CMPUT 329 - Computer Organization and Architecture II 81

Selecting States in the IAT DAG Thus we look for the row with maximum

Selecting States in the IAT DAG Thus we look for the row with maximum sum in the Incomplete Assignment Table, and we pick the cell with the minimum weight. If there is a tie, we break it arbitrarily. CMPUT 329 - Computer Organization and Architecture II 82

Incomplete Assignment Table DAG Now we have to recompute the values in the table.

Incomplete Assignment Table DAG Now we have to recompute the values in the table. Again we pick the minimum cell in the row with the maximum sum. CMPUT 329 - Computer Organization and Architecture II 83

Incomplete Assignment Table DAG Again we recompute the values in the table. We pick

Incomplete Assignment Table DAG Again we recompute the values in the table. We pick the minimum cell in the row. CMPUT 329 - Computer Organization and Architecture II 84

Checking the State Distance Graph DAG State Distance Graph Does this assignment make sense?

Checking the State Distance Graph DAG State Distance Graph Does this assignment make sense? To make checking it easier, we can build a state distance graph. CMPUT 329 - Computer Organization and Architecture II 85

Incomplete Assignment Table But this assignment does not follow the guideline that says that

Incomplete Assignment Table But this assignment does not follow the guideline that says that the reset state (S 0) should be state “ 0”. To fix that, we have to complement the two first columns. Would that change the state distance graph? CMPUT 329 - Computer Organization and Architecture II 86

Incomplete Assignment Table DAG State Distance Graph Assign #3 CMPUT 329 - Computer Organization

Incomplete Assignment Table DAG State Distance Graph Assign #3 CMPUT 329 - Computer Organization and Architecture II 87

Comparing Assignments #1, #2, and #3 Assign #3 DAG Assign #2 Assign #1 CMPUT

Comparing Assignments #1, #2, and #3 Assign #3 DAG Assign #2 Assign #1 CMPUT 329 - Computer Organization and Architecture II 88

State and Output Equations for Asgn #3 CMPUT 329 - Computer Organization and Architecture

State and Output Equations for Asgn #3 CMPUT 329 - Computer Organization and Architecture II 89

D 2 Equations for Asgn #3 I 0 Asgn #3 1 X X X

D 2 Equations for Asgn #3 I 0 Asgn #3 1 X X X X Q 0 Q 1 Q 2 D 2 = Q 1 ’ CMPUT 329 - Computer Organization and Architecture II 90

Comparing D 2 Equation for Asgn #3 and Asgn #1 I 0 Asgn #3

Comparing D 2 Equation for Asgn #3 and Asgn #1 I 0 Asgn #3 1 X X X X Q 0 Q 1 I 0 Asgn #1 1 X Q 1 Q 2 D 2 = Q 1 ’ 1 X X X Q 0 D 2 = Q 2’Q 1’ Q 2 CMPUT 329 - Computer Organization and Architecture II 91

D 1 Equations for Asgn #3 I 0 Asgn #3 Q 1 1 X

D 1 Equations for Asgn #3 I 0 Asgn #3 Q 1 1 X X X X 1 1 1 Q 0 Q 2 D 2 = Q 1 ’ D 1 = Q 2 + Q 0 + Q 1 ’ CMPUT 329 - Computer Organization and Architecture II 92

Comparing D 1 Equation for Asgn #3 and Asgn #1 I 0 Asgn #3

Comparing D 1 Equation for Asgn #3 and Asgn #1 I 0 Asgn #3 Q 1 I 0 Asgn #1 Q 1 X X X X 1 1 1 Q 0 Q 2 1 1 1 X X 1 1 1 Q 2 1 Q 0 D 2 = Q 1 ’ D 1 = Q 2 + Q 0 + Q 1 ’ D 1 = CMPUT Q 2 +329 Q 0 - Computer + Q 1’I 0 Organization and Architecture II 93

D 0 Equations for Asgn #3 I 0 Asgn #3 1 X X X

D 0 Equations for Asgn #3 I 0 Asgn #3 1 X X X 1 Q 0 1 Q 2 D 2 = Q 1 ’ D 1 = Q 2 + Q 0 + Q 1 ’ D 0 = Q 2 I 0 + Q 1 ’ I 0 ’ CMPUT 329 - Computer Organization and Architecture II 94

Comparing D 0 Equation for Asgn #3 and Asgn #1 I 0 Asgn #3

Comparing D 0 Equation for Asgn #3 and Asgn #1 I 0 Asgn #3 1 X X X 1 Q 1 I 0 Asgn #1 Q 1 X X 1 Q 2 Q 0 1 Q 2 D 2 = Q 1 ’ D 1 = Q 2 + Q 0 + Q 1 ’ D 0 = Q 2 I 0 + Q 1 ’ I 0 ’ 1 X X X Q 0 D 0 = Q 2 I 0 CMPUT 329 - Computer Organization and Architecture II 95

Z 0 Equations for Asgn #3 X Q 1 X 1 Q 0 1

Z 0 Equations for Asgn #3 X Q 1 X 1 Q 0 1 Q 2 D 2 = Q 1 ’ D 1 = Q 2 + Q 0 + Q 1 ’ D 0 = Q 2 I 0 + Q 1 ’ I 0 ’ Z 0 = Q 2 CMPUT 329 - Computer Organization and Architecture II 96

Comparing D 0 Equation for Asgn #3 and Asgn #1 X Asgn #3 X

Comparing D 0 Equation for Asgn #3 and Asgn #1 X Asgn #3 X Q 1 X 1 Q 0 1 Q 2 Asgn #1 1 X Q 1 X X 1 Q 2 Q 0 Z 0 = Q 2 D 2 = Q 1 ’ D 1 = Q 2 + Q 0 + Q 1 ’ D 0 = Q 2 I 0 + Q 1 ’ I 0 ’ Z 0 = Q 2 CMPUT 329 - Computer Organization and Architecture II 97

Z 1 Equations for Asgn #3 X Asgn #3 Q 1 X X 1

Z 1 Equations for Asgn #3 X Asgn #3 Q 1 X X 1 1 Q 0 Q 2 D 2 = Q 1 ’ D 1 = Q 2 + Q 0 + Q 1 ’ D 0 = Q 2 I 0 + Q 1 ’ I 0 ’ Z 0 = Q 2 Z 1 = Q 0 CMPUT 329 - Computer Organization and Architecture II 98

Comparing D 0 Equation for Asgn #3 and Asgn #1 X Asgn #3 Q

Comparing D 0 Equation for Asgn #3 and Asgn #1 X Asgn #3 Q 1 X X 1 1 Q 0 Q 2 Asgn #1 Q 1 1 X X 1 X Q 2 D 2 = Q 1 ’ Q 0 D 1 = Q 2 + Q 0 + Q 1 ’ D 0 = Q 2 I 0 + Q 1 ’ I 0 ’ Z 0 = Q 2 Z 1 = Q 0 + Q 2 Q 1 ’ Z 1 = Q 0 CMPUT 329 - Computer Organization and Architecture II 99

State and Output Equations for Asgn #3 D 2 = Q 2’Q 1’ D

State and Output Equations for Asgn #3 D 2 = Q 2’Q 1’ D 1 = Q 2 + Q 0 + Q 1 ’ D 0 = Q 2 I 0 + Q 1 ’ I 0 ’ Z 0 = Q 2 Z 1 = Q 0 CMPUT 329 - Computer Organization and Architecture II 100

Comparing Equations for Asgns #1, #2, and #3 36 13 CMPUT 329 - Computer

Comparing Equations for Asgns #1, #2, and #3 36 13 CMPUT 329 - Computer Organization and Architecture II 9 101

State of the Art for State Assignment G. De Micheli, R. K. Brayton, and

State of the Art for State Assignment G. De Micheli, R. K. Brayton, and A. Sangiovanni. Vicentelli, “Optimal State Assignment for Finite State Machines, ” IEEE Transactions on Computer Aided Design of Integrated Circuit Systems, vol. 4, pp. 269 -284, July 1985. S. Devadas, H. -K. T. Ma, A. R. Newton, and A. Sangiovanni-Vicentelli, “Mustang: State Assignment of finite state machines for optimal multi-level logic implementations, ” in International Conference on Computer Aided Design, pp. 16 -19, 1987. (KISS - Keep Internal State Simple) CMPUT 329 - Computer Organization and Architecture II 102

State of the Art for State Assignment D. Varma and E. A. Trachtenberg, “A

State of the Art for State Assignment D. Varma and E. A. Trachtenberg, “A fast algorithm for the optimal assignment of large finite state machines, ” in International Conference on Computer Aided Design, pp. 152 -155, 1988. T. Villa and A. Sangiovanni-Vicentelli, “NOVA: State assignment of finite state machines for optimal two-level logic implementation, ” IEEE Transactions on Computer Aided Design of Integrated Circuit Systems, vol. 9, pp. 905 -924, Sept. 1990. CMPUT 329 - Computer Organization and Architecture II 103

Where to find papers? To find papers on the subject, search for the keyword

Where to find papers? To find papers on the subject, search for the keyword “state assignment” in citations of the site: http: //www. scienceindex. com You can use this site for any subject of your interest within Computing Science. CMPUT 329 - Computer Organization and Architecture II 104