1 / 61

State Machine Composition and Feedback Loop

Learn about the composition of state machines and how to create a feedback loop in a product machine. Discover the implementation possibilities and benefits of combining state machines.

flowe
Download Presentation

State Machine Composition and Feedback Loop

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. Product Machines EECS 20 Lecture 10 (February 7, 2001) Tom Henzinger

  2. Composition of State Machines

  3. Transition Diagram of the Parity System true / true true false true / false false / false false / true States = Bools Inputs = BoolsOutputs = Bools

  4. Transition Diagram of the LastThree System true / false true / false 1 2 0 false / false true / true false / false false / false States = { 0, 1, 2 } Inputs = BoolsOutputs = Bools

  5. The Parity System : States [ Parity] = { true, false } initialState [ Parity ] = true nextState [ Parity ] (q,x) = (q  x) output [ Parity ] (q,x) = q The LastThree System : States [ LastThree] = { 0, 1, 2 } initialState [ LastThree ] = 0 nextState [ LastThree ] (q,x) = output [ LastThree ] (q,x) = ( ( q = 2 )  x ) 0 if x min (q+1, 2) if x {

  6. Block Diagram of Parity System Parity output Nats0 Bools Nats0 Bools nextState  Dtrue Nats0 Bools Nats0 Bools No path without delay from input to output.

  7. Block Diagram of LastThree System LastThree output Nats0 Bools Nats0 Bools nextState Dtrue Nats0 Bools Nats0 Bools Path without delay from input to output !

  8. Parity Nats0  Bools Nats0  Bools LastThree Nats0  Bools Nats0  Bools dependency without delay

  9. ParityOrLastThree Parity Nats0  Bools Nats0  Bools  LastThree

  10. ParityOrLastThree Parity Nats0  Bools Nats0  Bools  t, t, t, … LastThree t, f, t, …

  11. The ParityOrLastThree System Inputs [ ParityOrLastThree ] = Bools Outputs [ ParityOrLastThree ] = Bools States [ ParityOrLastThree ] = States [ Parity ]  States [ LastThree ] = { true, false }  { 0, 1, 2 } initialState [ ParityOrLastThree ] = ( initialState [ Parity ], initialState [ LastThree ] ) = ( true, 0 )

  12. The ParityOrLastThree System, continued nextState [ ParityOrLastThree ] ( ( q1, q2 ) , x ) = ( nextState [ Parity ] (q1, x) , nextState [ LastThree ] (q2, x) ) output [ ParityOrLastThree ] ( ( q1, q2 ) , x ) = output [ Parity ] (q1, x)  output [ LastThree ] (q2, x)

  13. f/t f/t f/t t, 0 t, 1 t, 2 t/t t/f t/f t/t t/t t/t f, 0 f, 1 f, 2 f/f f/f f/f

  14. ParityAndLastThree Parity Nats0  Bools Nats0  Bools  LastThree

  15. ParityAndLastThree Parity Nats0  Bools Nats0  Bools  t, t, t, … LastThree f, f, t, …

  16. The ParityAndLastThree System Inputs[ ParityAndLastThree ] = Bools Outputs [ ParityAndLastThree ] = Bools States [ ParityAndLastThree ] = States [ Parity ]  States [ LastThree ] = { true, false }  { 0, 1, 2 } initialState [ ParityAndLastThree ] = ( initialState [ Parity ], initialState [ LastThree ] ) = ( true, 0 )

  17. The ParityAndLastThree System, continued nextState[ ParityAndLastThree ] ( ( q1, q2 ) , x ) = ( nextState [ Parity ] (q1, x) , nextState [ LastThree ] (q2, x) ) output [ ParityAndLastThree ] ( ( q1, q2 ) , x ) = output [ Parity ] (q1, x)  output [ LastThree ] (q2, x)

  18. f/f f/f f/f t, 0 t, 1 t, 2 t/f t/f t/f t/f t/t t/f f, 0 f, 1 f, 2 f/f f/f f/f

  19. InputPairs Nats0  Bools Parity 1 Nats0  Bools  Nats0  Bools LastThree 2

  20. InputPairs Nats0  Bools Parity 1 t, t, f, … Nats0  Bools  f, f, t, … Nats0  Bools LastThree t, t, t, … 2

  21. The InputPairs System Inputs [ InputPairs ] = Bools  Bools Outputs [ InputPairs ] = Bools States [ InputPairs ] = States [ Parity ]  States [ LastThree ] = { true, false }  { 0, 1, 2 } initialState [ InputPairs ] = ( initialState [ Parity ], initialState [ LastThree ] ) = ( true, 0 )

  22. The InputPairs System, continued nextState[ InputPairs ] ( ( q1, q2 ) , (x1, x2) ) = ( nextState [ Parity ] (q1, x1) , nextState [ LastThree ] (q2, x2) ) output [ InputPairs ] ( ( q1, q2 ) , (x1, x2) ) = output [ Parity ] (q1, x1)  output [ LastThree ] (q2, x2)

  23. t, 0 t, 1 t, 2 f, 0 f, 1 f, 2

  24. (f,f)/t t, 0 t, 1 t, 2 (t,t)/t f, 0 f, 1 f, 2

  25. (f,f)/f (f,t)/f t, 0 t, 1 t, 2 (t,f)/f (t,t)/f f, 0 f, 1 f, 2

  26. OutputPairs Parity Nats0  Bools Nats0  Bools 1 Nats0  Bools LastThree 2

  27. OutputPairs Parity Nats0  Bools Nats0  Bools 1 t, f, f, … t, f, t, … LastThree Nats0  Bools 2 f, f, f, …

  28. The OutputPairs System Inputs [ OutputPairs ] = Bools Outputs [ OutputPairs ] = Bools  Bools States [ OutputPairs ] = States [ Parity ]  States [ LastThree ] = { true, false }  { 0, 1, 2 } initialState [ OutputPairs ] = ( initialState [ Parity ], initialState [ LastThree ] ) = ( true, 0 )

  29. The OutputPairs System, continued nextState[ OutputPairs ] ( ( q1, q2 ) , x ) = ( nextState [ Parity ] (q1, x) , nextState [ LastThree ] (q2, x) ) output [ OutputPairs ] ( ( q1, q2 ) , x ) = ( output [ Parity ] (q1, x) , output [ LastThree ] (q2, x) )

  30. f/(t,f) f/(t,f) f/(t,f) t, 0 t, 1 t/(t,f) t, 2 t/(t,f) t/(f,f) t/(t,t) t/(f,t) t/(f,f) f, 0 f, 1 f, 2 f/(f,f) f/(f,f) f/(f,f)

  31. Any block diagram of N state machines with the state spaces States1, States2, … StatesN can be implemented by a single state machine with the state space States1  States2  …  StatesN . This is called a “product machine”.

  32. FeedbackLoop Nats0  Bools Parity Nats0  Bools  LastThree This block diagram is ok, because every cycle contains a delay.

  33. FeedbackLoop Nats0  Bools Parity Nats0  Bools  t, f, t, … t LastThree t

  34. FeedbackLoop Nats0  Bools Parity Nats0  Bools  t, f, t, … t LastThree f t

  35. FeedbackLoop Nats0  Bools Parity Nats0  Bools f  t, f, t, … t LastThree f t

  36. FeedbackLoop Nats0  Bools Parity Nats0  Bools f  t, f, t, … t, t LastThree f t, t

  37. FeedbackLoop Nats0  Bools Parity Nats0  Bools f  t, f, t, … t, t LastThree f, f t, t

  38. FeedbackLoop Nats0  Bools f, f Parity Nats0  Bools  t, f, t, … t, t LastThree f, f t, t

  39. FeedbackLoop Nats0  Bools f, f Parity Nats0  Bools  t, f, t, … t, t, t LastThree f, f t, t, t

  40. FeedbackLoop Nats0  Bools f, f Parity Nats0  Bools  t, f, t, … t, t, t LastThree f, f, t t, t, t

  41. FeedbackLoop Nats0  Bools f, f, t Parity Nats0  Bools  t, f, t, … t, t, t LastThree f, f, t t, t, t

  42. FeedbackLoop Nats0  Bools f, f, t Parity Nats0  Bools  t, f, t, … t, t, t, f LastThree f, f, t t, t, t

  43. Example: Vending Machine

  44. Coin Collector Nats0  Coins Collect Nats0  Nats0 Let Coins = { Nickel, Dime, Quarter} . Let Coins = Coins  {  } . (  stands for “no input.” )

  45. Coin Collector D/5 D/10 D/15 D/0 D/20 D/25 /0 /5 /10 /15 /20 /25 /30 0 5 10 15 20 25 30 N/0 N/5 N/10 N/15 N/20 N/25 Q/0 Q/5 Q/10

  46. Finite-State Coin Collector 1 Nats0  {0, … 30 } Nats0  Coins CollectF Nats0  Coins 2

  47. Finite-State Coin Collector D/(0,) /(0,) N/(0,) 0 5 10 15 20 25 30 Q/(0,)

  48. Finite-State Coin Collector D/(0,) Q/(25,Q) D/(25,D) /(0,) /(25,) N/(0,) N/(25,) 0 5 10 15 20 25 30 Q/(0,)

  49. Coin Collector with Reset Nats0  Coins 1 1 Nats0  {0, … 30 } CollectFR Nats0  Bools Nats0  Coins 2 2 reset

  50. Coin Collector with Reset (D,f)/(15,) (Q,f)/(15,Q) (,f)/(15,) 0 5 10 15 20 25 30 (N,f)/(15,) (,t)/(15,)

More Related