Presentation is loading. Please wait.

Presentation is loading. Please wait.

EECS 20 Lecture 10 (February 7, 2001) Tom Henzinger Product Machines.

Similar presentations


Presentation on theme: "EECS 20 Lecture 10 (February 7, 2001) Tom Henzinger Product Machines."— Presentation transcript:

1 EECS 20 Lecture 10 (February 7, 2001) Tom Henzinger Product Machines

2 Composition of State Machines

3 Transition Diagram of the Parity System truefalse true / true true / false false / true false / false States = Bools Inputs = Bools Outputs = Bools

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

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 Nats 0  Bools D true Nats 0  Bools Block Diagram of Parity System nextState output Parity No path without delay from input to output. 

7 Nats 0  Bools D true Nats 0  Bools Block Diagram of LastThree System nextState output LastThree Path without delay from input to output !

8 Parity LastThree Nats 0  Bools dependency without delay

9 Parity LastThree  ParityOrLastThree Nats 0  Bools

10 Parity LastThree  ParityOrLastThree Nats 0  Bools t, t, t, …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 t, 0 f, 0f, 1f, 2 t, 2 t, 1 f/tf/t t/tt/tt/ft/f f/ff/f t/ft/f f/ff/f t/tt/t f/tf/t t/tt/t f/tf/t t/tt/t f/ff/f

14 Parity LastThree  ParityAndLastThree Nats 0  Bools

15 Parity LastThree  ParityAndLastThree Nats 0  Bools t, t, t, …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 t, 0 f, 0f, 1f, 2 t, 2 t, 1 f/ff/f t/ft/ft/ft/f f/ff/f t/ft/f f/ff/f t/ft/f f/ff/f t/tt/t f/ff/f t/ft/f f/ff/f

19 Parity LastThree  InputPairs Nats 0  Bools 1 2

20 Parity LastThree  InputPairs Nats 0  Bools t, t, f, … t, t, t, … f, f, t, … 1 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 f, 0f, 1f, 2 t, 2 t, 1

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

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

26 Parity LastThree OutputPairs Nats 0  Bools 1 2

27 Parity LastThree OutputPairs Nats 0  Bools t, f, t, … Nats 0  Bools f, f, f, … t, f, f, … 1 2

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 t, 0 f, 0f, 1f, 2 t, 2 t, 1 f/(t,f) t/(t,f) t/(f,f) f/(f,f) t/(f,f) f/(f,f) t/(t,f) f/(t,f) t/(t,t) f/(t,f) t/(f,t) 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 Parity LastThree FeedbackLoop Nats 0  Bools  This block diagram is ok, because every cycle contains a delay.

33 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t  t

34 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t  tf

35 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t  tf f

36 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t, t  f f

37 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t, t  f, f f

38 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t, t  f, f

39 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t, t, t  f, f

40 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t, t, t  f, f, t f, f

41 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t, t, t  f, f, t

42 Parity LastThree FeedbackLoop Nats 0  Bools t, f, t, … Nats 0  Bools t, t, t, f  t, t, tf, f, t

43 Example: Vending Machine

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

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

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

47 Finite-State Coin Collector 010525201530 D/(0,  )  /(0,  ) N/(0,  ) Q/(0,  )

48 Finite-State Coin Collector 010525201530 D/(0,  )  /(0,  ) N/(0,  ) Q/(0,  ) D/(25,D)  /(25,  ) N/(25,  ) Q/(25,Q)

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

50 Coin Collector with Reset 010525201530 (D,f)/(15,  ) ( ,f)/(15,  ) (N,f)/ (15,  ) ( ,t)/(15,  ) (Q,f)/(15,Q)

51 Coin Collector with Reset 010525201530 (D,f)/(15,  ) ( ,f)/(15,  ) (N,f)/ (15,  ) ( ,t)/(15,  ) (Q,f)/(15,Q) (Q,t)/(15,  ) (N,t)/(15,  ) (D,t)/ (15,  )

52 Coin Collector with Reset CollectFR Nats 0  {0, … 30 } Nats 0  Coins  1 2 Nats 0  Bools 1 2

53 Soda Dispenser Disp Nats 0  Dispense  Nats 0  Select  Nats 0  Bools 1 2 Nats 0  { 0, … 30 } 1 2 Let Select = { selectCoke, selectDiet }. Let Dispense = { dispenseCoke, dispenseDiet }. fundsreset

54 Soda Dispenser none Diet Coke

55 Soda Dispenser none Diet Coke {(C,x)|x<25} / ( ,f) {(D,x)|x  20} / (D,t) {(C,x)|x  25} / (C,t) {(D,x)|x<20} / ( ,f) {( ,x)|x  0} / ( ,f)

56 Soda Dispenser none Diet Coke {( ,x)|x  25} / (C,t) {(C,x)|x<25} / ( ,f) {( ,x)|x<25} / ( ,f) {(C,x)|x  25} / (C,t) {(D,x)|x  20} / (D,t) {(D,x)|x<20} / ( ,f)

57 Soda Dispenser with Change DispC Nats 0  Dispense  Nats 0  Select  Nats 0  Bools 1 2 Nats 0  { 0, … 30 } 1 2 funds reset 3 Nats 0  Coins  change

58 Soda Dispenser with Change none Diet Coke {(C,x)|x<25} / ( ,f,  ) (C,25) / (C,t,  ) (C,30) / (C,t,N) (D,20) / (D,t,  ) (D,25) / (D,t,N) (D,30) / (D,t,D) {(C,x)|x<20} / ( ,f,  ) {( ,x)|x  0} / ( ,f,  )

59 Soda Dispenser with Change DispC Nats 0  Dispense  Nats 0  Select  Nats 0  Bools 1 2 Nats 0  { 0, … 30 } 1 2 3 Nats 0  Coins 

60 Vending Machine DispC Nats 0  Dispense  Nats 0  Select  Nats 0  Bools 1 3 Nats 0  { 0, … 30 } 1 2 2 Nats 0  Coins  CollectFR Nats 0  Coins  2 1 1 2 resetfunds

61 State Space of Vending Machine { 0, 5, 10, 15, 20, 25, 30 }  { none, Coke, Diet } 21 states


Download ppt "EECS 20 Lecture 10 (February 7, 2001) Tom Henzinger Product Machines."

Similar presentations


Ads by Google