EECS 20 Lecture 11 (February 9, 2001) Tom Henzinger Feedback.

51
EECS 20 Lecture 11 (February 9, 2001) Tom Henzinger Feedback
  • date post

    18-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    1

Transcript of EECS 20 Lecture 11 (February 9, 2001) Tom Henzinger Feedback.

EECS 20

Lecture 11 (February 9, 2001)

Tom Henzinger

Feedback

Parity

LastThree

Nats0 Bools

Nats0 Bools

Nats0 Bools

Nats0 Bools

path without delay

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{

Parity System

true false

true / true

true / false

false / true false / false

States = Bools Inputs = Bools Outputs = Bools

LastThree System

States = { 0, 1, 2 } Inputs = Bools Outputs = Bools

0 21

true / false

false / false

false / false false / false true / true

true / false

A Run of the LastThree System

Time 0 1 2 3 4

Input t t t t f

Output

State

A Run of the LastThree System

Time 0 1 2 3 4

Input t t t t f

Output

State 0

A Run of the LastThree System

Time 0 1 2 3 4

Input t t t t f

Output f

State 0 1

A Run of the LastThree System

Time 0 1 2 3 4

Input t t t t f

Output f f

State 0 1 2

A Run of the LastThree System

Time 0 1 2 3 4

Input t t t t f

Output f f t

State 0 1 2 2

A Run of the LastThree System

Time 0 1 2 3 4

Input t t t t f

Output f f t t

State 0 1 2 2 2

A Run of the LastThree System

Time 0 1 2 3 4

Input t t t t f

Output f f t t f

State 0 1 2 2 2 0

Parity

LastThree

FeedbackLoop

Nats0 Bools

Nats0 Bools

This block diagram is ok, because every cycle contains a delay.

Parity

LastThree

FeedbackLoop

Nats0 Bools

Nats0 Boolsx

y

z

u

q1

q2

Parity

LastThree

FeedbackLoop

Nats0 Bools

Nats0 Bools 1

2

31

xy

z

u

q1

q2

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y

Aux z

Aux u

State q1

State q2

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y

Aux z

Aux u

State q1 t

State q2 0

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t

Aux z

Aux u

State q1 t

State q2 0

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t

Aux z f

Aux u

State q1 t

State q2 0

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t

Aux z f

Aux u f

State q1 t

State q2 0

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t

Aux z f

Aux u f

State q1 t t

State q2 0 1

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t t

Aux z f

Aux u f

State q1 t t

State q2 0 1

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t t

Aux z f f

Aux u f

State q1 t t

State q2 0 1

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t t

Aux z f f

Aux u f f

State q1 t t

State q2 0 1

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t t

Aux z f f

Aux u f f

State q1 t t t

State q2 0 1 2

1

2

3

A Run of the FeedbackLoop System

Time 0 1 2 3 4

Input x t t f t f

Output y t t t t f

Aux z f f t t f

Aux u f f f t f

State q1 t t t t f f

State q2 0 1 2 2 2 0

The FeedbackLoop System

Inputs [ FeedbackLoop ] = Bools

Outputs [ FeedbackLoop ] = Bools

States [ FeedbackLoop ]

= States [ Parity ] States [ LastThree ]

= { true, false } { 0, 1, 2 }

initialState [ FeedbackLoop ]

= ( initialState [ Parity ], initialState [ LastThree ] )

= ( true, 0 )

The FeedbackLoop System, continued

output [ FeedbackLoop ] ( ( q1, q2 ) , x )

= output [ Parity] ( q1, any )

The value of this does not matter !

The FeedbackLoop System, continued

output [ FeedbackLoop ] ( ( q1, q2 ) , x )

= output [ Parity] ( q1, any )

Let this be y .

nextState [ FeedbackLoop ] ( ( q1, q2 ) , x )

2

= nextState [ LastThree ] ( q2, y )

The FeedbackLoop System, continued

output [ FeedbackLoop ] ( ( q1, q2 ) , x )

= output [ Parity] ( q1, any )

Let this be y .

nextState [ FeedbackLoop ] ( ( q1, q2 ) , x )

2

= nextState [ LastThree ] ( q2, y )

Let z = output [ LastThree ] ( q2, y ) .

The FeedbackLoop System, continued

output [ FeedbackLoop ] ( ( q1, q2 ) , x )

= output [ Parity] ( q1, any )

Let this be y .

nextState [ FeedbackLoop ] ( ( q1, q2 ) , x )

2

= nextState [ LastThree ] ( q2, y )

Let z = output [ LastThree ] ( q2, y ) .

nextState [ FeedbackLoop ] ( ( q1, q2 ) , x )

1

= nextState [ Parity ] ( q1, x z )

If every cycle contains a delay, then all values can be computed.

If there is a cycle without delay, then some values may not be well-defined.

An Ill-Defined System

Nats0 Bools Nats0 Bools

An Ill-Defined System

Nats0 Bools Nats0 Bools

f fX

An Ill-Defined System

Nats0 Bools Nats0 Bools

f tX

No legal output !

Another Ill-Defined System

id

Nats0 Bools Nats0 Bools

Another Ill-Defined System

id

Nats0 Bools Nats0 Bools

f t

Another Ill-Defined System

id

Nats0 Bools Nats0 Bools

f f

Multiple legal outputs !

Example: Vending Machine

Coin Collector

CollectNats0 {0, … 30 }

Nats0 Coins

Nats0 Coins

1

2 Nats0 Bools

1

2reset

funds

Let Coins = { Nickel, Dime, Quarter } .

cin

cthru

Coin Collector

0 10

5 25 20 15

30

(D,f)/(15,)

(,f)/(15,)

(N,f)/(15,)

(,t)/(15,)

(Q,f)/(15,Q)

(Q,t)/(15,)

(N,t)/(15,)

(D,t)/(15,)

Coin Collector

CollectNats0 {0, … 30 }

Nats0 Coins

Nats0 Coins

1

2 Nats0 Bools

1

2reset

fundscin

cthru

Soda Dispenser

DispNats0 Dispense

Nats0 Select Nats0 Bools

1

2 Nats0 { 0, … 30 }

1

2funds

reset3 Nats0 Coinschang

e

select

soda

Let Select = { selectCoke, selectDiet } .

Let Dispense = { dispenseCoke, dispenseDiet } .

Soda Dispenser

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)|x0} / (,f,)

Soda Dispenser

none

Diet

Coke

{(C,x)|x<25} / (,f, )

{(,x)|x<25} / (,f, )

{(D,x)|x<20} / (,f, )

(,25) / (C,t,) (,30) / (C,t,N) (C,25) / (C,t,) (C,30) / (C,t,N) (D,20) / (D,t,) (D,25) / (D,t,N) (D,30) / (D,t,D)

Soda Dispenser

Disp Nats0 Dispense

Nats0 Select Nats0 Bools

1

2 Nats0 { 0, … 30 }

1

2 3 Nats0 Coinsfunds

reset

change

select

soda

Vending Machine

DispNats0 Dispense

Nats0 Select

Nats0 Bools

1

3

Nats0 { 0, … 30 }

1

2 2Nats0 Coins

Collect

Nats0 CoinsNats0 Coins

2

1

1

2

resetfunds

select

sodachange

cincthru

Vending Machine

DispCNats0 Dispense

Nats0 Select

Nats0 Bools

1

3

Nats0 { 0, … 30 }

1

2 2Nats0 Coins

Collect

Nats0 CoinsNats0 Coins

2

1

1

2

resetfunds

1 2

1

1

22

3

select

sodachange

cincthru

Time 0 1 2 3 4

cin N Q Q D

select C D C

funds

soda

change

reset

cthru

State Coll 0

State Disp n

1

2

2

2

3

Time 0 1 2 3 4

cin N Q Q D

select C D C

funds 0 5 5 0 0

soda C D

change N N

reset f f t t f

cthru

State Coll 0 5 5 0 0 10

State Disp n n C n n C

Quiz

1. Draw the transition diagram of the system

Delay0 : [ Nats0 Bins ] [ Nats0 Bins ]

x [ Nats0 Bins ] , y Nats0 ,

( Delay0 (x)) (y) =

2. Draw the transition diagram of the system

0 if y = 0

x (y-1) if y > 0{

Delay0 Delay0