1 / 104

CMPUT329 - Fall 2003

CMPUT329 - Fall 2003. Topic C: State Assignment José Nelson Amaral. Reading Assignment. Chapter 7, section 7.4.6. Z. Network A. Sequential Network B. Network C. X. Incompletely Specified State Tables. Assumptions: (i) Network A can only generate sequences X=100 and X = 110.

keegan
Download Presentation

CMPUT329 - Fall 2003

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  3. Z Network A Sequential Network B Network C X Incompletely Specified State Tables 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

  4. Incompletely Specified State Tables S0 1/- S1 CMPUT 329 - Computer Organization and Architecture II

  5. Incompletely Specified State Tables S0 1/- S1 S2 0/- 1/- S3 CMPUT 329 - Computer Organization and Architecture II

  6. Incompletely Specified State Tables S0 1/- 0/0 S1 S2 0/- 1/- S3 CMPUT 329 - Computer Organization and Architecture II

  7. S0 1/- 0/0 S1 0/1 S2 0/- 1/- S3 Incompletely Specified State Tables 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

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

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

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

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

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

  13. Do State Assignments Matter? 00 1 1 S0 0 0 11 00 0 S4 S1 1 0 1 10 01 S3 S2 1 0 CMPUT 329 - Computer Organization and Architecture II

  14. I0 1 1 X X X X Q0 1 1 X X 1 Q2 State and Output Equations for Asgn #1 Q1 D2 = Q1’ I0’ + Q2’ I0’ + Q1Q0’ CMPUT 329 - Computer Organization and Architecture II

  15. State and Output Equations for Asgn #1 I0 1 1 1 X X X X Q0 1 1 Q1 1 X X 1 Q2 D2 = Q1’ I0’ + Q2’ I0’ + Q1Q0’ D1 = Q1Q2’ + Q2Q1’ + Q2’ I0 CMPUT 329 - Computer Organization and Architecture II

  16. State and Output Equations for Asgn #1 I0 1 1 X X X X Q0 1 Q1 1 X X 1 Q2 D2 = Q1’ I0’ + Q2’ I0’ + Q1Q0’ D1 = Q1Q2’ + Q2Q1’ + Q2’ I0 D0 = Q2Q1’I0’ + Q2’Q0’ I0 + Q1Q2’I0’ CMPUT 329 - Computer Organization and Architecture II

  17. State and Output Equations for Asgn #1 I0 1 1 X X X X Q0 1 Q1 1 X X 1 Q2 D2 = Q1’ I0’ + Q2’ I0’ + Q1Q0’ D1 = Q1Q2’ + Q2Q1’ + Q2’ I0 D0 = Q2Q1’I0’ + Q2’Q0’ I0 + Q1Q2’I0’ CMPUT 329 - Computer Organization and Architecture II

  18. State and Output Equations for Asgn #1 1 X X Q0 1 Q1 X Q2 D2 = Q1’ I0’ + Q2’ I0’ + Q1Q0’ D1 = Q1Q2’ + Q2Q1’ + Q2’ I0 D0 = Q2Q1’I0’ + Q2’Q0’ I0 + Q1Q2’I0’ Z0 = Q2’Q0 + Q2Q1’ CMPUT 329 - Computer Organization and Architecture II

  19. 1 X X Q0 Q1 1 X Q2 State and Output Equations for Asgn #1 D2 = Q1’ I0’ + Q2’ I0’ + Q1Q0’ D1 = Q1Q2’ + Q2Q1’ + Q2’ I0 D0 = Q2Q1’I0’ + Q2’Q0’ I0 + Q1Q2’I0’ Z0 = Q2’Q0 + Q2Q1’ Z1 = Q1Q0’ + Q2Q1’ CMPUT 329 - Computer Organization and Architecture II

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

  21. 1 1 X X X X X X State and Output Equations for Asgn #2 I0 Q0 Q1 Q2 D2 = D2 = Q2’Q1’ CMPUT 329 - Computer Organization and Architecture II

  22. 1 1 1 1 1 1 1 State and Output Equations for Asgn #2 I0 X X X X Q0 X X Q1 Q2 D2 = Q2’Q1’ D1 = Q2 + Q0 + Q1’I0 D1 = D1 = Q2 + Q0 D1 = Q2 CMPUT 329 - Computer Organization and Architecture II

  23. 1 1 State and Output Equations for Asgn #2 I0 X X X X Q0 X X Q1 Q2 D2 = Q2’Q1’ D1 = Q2 + Q0 + Q1’I0 D0 = D0 = Q2I0 CMPUT 329 - Computer Organization and Architecture II

  24. 1 1 State and Output Equations for Asgn #2 X X Q0 X Q1 Q2 D2 = Q2’Q1’ D1 = Q2 + Q0 + Q1’I0 D0 = Q2I0 Z0 = Z0 = Q2 CMPUT 329 - Computer Organization and Architecture II

  25. 1 1 State and Output Equations for Asgn #2 X X Q0 X Q1 Q2 D2 = Q2’Q1’ D1 = Q2 + Q0 + Q1’I0 D0 = Q2I0 Z0 = Q2 Z1 = Q0 +Q2Q1’ Z1 = Z1 = Q0 CMPUT 329 - Computer Organization and Architecture II

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

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

  28. 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

  29. 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 2s  r. 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? CMPUT 329 - Computer Organization and Architecture II

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

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

  33. Equivalent State Assignments (Definition 1) How many of these state assigments are equivalent to each other? State Equivalency (McCluskey 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

  34. 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

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

  36. 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 2s  r. How many distinct assignments exist for this machine? CMPUT 329 - Computer Organization and Architecture II

  37. Number of Distinct State Assignments By McCluskey’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

  38. Number of Distinct State Assignments A: State Assignments N1: Distinct State Assign. (McCluskey) N2: Distinct State Assign. (Weiner-Smith-Harrison) CMPUT 329 - Computer Organization and Architecture II

  39. Number of Distinct States Assignments A: State Assignments N1: Distinct State Assignments (McCluskey) N2: Distinct State Assign. (Weiner-Smith-Harrison) CMPUT 329 - Computer Organization and Architecture II

  40. 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 N1 (McCluskey) distinct states. (ii) for machines implemented with flip-flops D, there are N2 (Weiner-Smith-Harrison) distinct states. CMPUT 329 - Computer Organization and Architecture II

  41. 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

  42. 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

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

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

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

  46. Suc(Si) = {Sj ,Sk} Si 1 0 Sj and Sk should be close to each other Sj Sk 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 CMPUT 329 - Computer Organization and Architecture II

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

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

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

  50. The Output Rule 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

More Related