Top Banner
How Computers Work Lecture 8 Page 1 How Computers Work Lecture 8 Asynchronous State Machines and Metastability
29

How Computers Work Lecture 8 Asynchronous State Machines and Metastability

Jan 17, 2016

Download

Documents

baxter

How Computers Work Lecture 8 Asynchronous State Machines and Metastability. Edge Triggered Flip-Flop. 1. clk. in. out. 3. 4. C.L. current state. current state. next state. 5. 6. next state. Q. D. Tcd C-Q < t____ Tpd C-Q > t____. Tcd C.L. < t____ Tpd C.L. > t____. clk. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 1

How Computers Work

Lecture 8

Asynchronous State Machinesand Metastability

Page 2: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 2

Review:Edge-Triggered Timing

Constraints Edge Triggered Flip-Flop

in outC.L.

Q D

clk

nextstate

currentstate

1

3

5

4

6

clk

next state

current state

TcdC-Q < t____TpdC-Q > t____

TcdC.L. < t____TpdC.L. > t____

_________________ < TcdC-Q + TcdC.L.

1 31 3

1 41 4

3 53 5

4 64 6

TholdThold

Page 3: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 3

Maximum Frequency

in outC.L.

nextstate

currentstate

clk

next state

current state

Clock Period > ___________

Q D

clk Tpd c-q + Tpd cl + TsetupTpd c-q + Tpd cl + Tsetup

Page 4: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 4

Skew

QD

clk1

QD

clk2

C.L.

_______________________< _______________________________

Clock Period > _______________________________

Thold + TskewThold + TskewTcd c-q + tcd clTcd c-q + tcd cl

Tpd c-q + Tpd cl + Tsetup + TskewTpd c-q + Tpd cl + Tsetup + Tskew

Page 5: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 5

What we will cover today:The Trouble with Asynchronous

Inputs

in

nextstate

currentstate Q D

clk

QD

clk

out

QD

clk

Page 6: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 6

A Synchronizer as Arbiter

D Q

clock

DQ

DQ

clock

Page 7: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 7

What Happens Now?

Ts ThCLOCK

D

Flip-Flop Specification Says:______________________NothingNothing

Page 8: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 8

Buridan’s Ass

Buridan, Jean Buridan, Jean (1300-58), French Scholastic philosopher, who held a theory of determinism, contending that the will must choose the greater good. Born in Bethune, he was educated at the University of Paris, where he studied with the English Scholastic philosopher William of Ockham. After his studies were completed, he was appointed professor of philosophy, and later rector, at the same university. Buridan is traditionally but probably incorrectly associated with a philosophical dilemma of moral choice called "Buridan's ass." In the problem an ass starves to death between two alluring bundles of hay because it does not have the will to decide which one to eat.

Page 9: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 9

The Game Show Arbiter

Arbiter

A wins B Wins

A B

Page 10: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 10

A Simpler Arbiter

AA

BBB winsB wins

A winsA wins

Page 11: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 11

With Both Inputs High

H

H

Page 12: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 12

Static Metastability

AR

Ci

VoutVin

Vin Vout

Vin

Vout

Vout = Vin

Vout < Vin

Vout > Vin

Page 13: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 13

Static Metastability:Inverted Pendulum Analogy

h

m(mgh)

Potential Energy

angle

upleft right

Page 14: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 14

What does Heisenberg Say ?

hpx

Page 15: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 15

What if we relax accuracy?

0 Ta - Tb

Arbiter output perfectly correct if | Ta - Tb | > Tmarginif | Ta - Tb | <= Tmargin, output can be RANDOM

Who Won

Page 16: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 16

The Remarkable Fact

The perfect arbiter:

Tmargin and Tpd finite and constantCorrect Ouput if | Ta - Tb | > Tmargin

Any Output if | Ta - Tb | <= Tmargin

Answer valid and stable after Tpd

IT IS IMPOSSIBLE TO BUILD ! ! ! !

Page 17: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 17

Dynamic Metastability(More Stupid Classroom

Tricks)

Page 18: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 18

Lecture Demonstration Circuit

delay

delay

D Q

To Scope

Page 19: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 19

Is It Possible to Build This?

A B

Winner Done

TheAsynchronousArbiter:

Answer:

__________YesYes

Page 20: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 20

Practical Metastability

FSM

Clock

Async.Inputs

Page 21: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 21

A Simple Model of Static Metstability

A

R

Ci

VoutVin

Assume Vout = A Vin (i.e. not saturated)

i =

Vin(t) =1

-1

Vout

Vin

(A - 1) Vin / R(A - 1) Vin / R

E t (A - 1) / ( R C )E t (A - 1) / ( R C )

Page 22: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 22

Evolution of Vout

time

Vout

-1

1

Page 23: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 23

How Small must Vin(0) beto make time to saturation take longer

than time t?

V t V eA

V

in int

in

( ) ( )

( )

/

01

0

1/(A e t/tau) = e -t/tau / A1/(A e t/tau) = e -t/tau / A

Page 24: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 24

If Vin(0) is uniformly distributed:

Vin

But if Vin is in linear rise/fall a certain fraction(p transition) of the time:

p metastable (t) = __________________________

p metastable (t) = __________________________

Vin

1/(A e t/tau) = e -t/tau / A1/(A e t/tau) = e -t/tau / A

p transition /(A e t/tau) = (p transition / A) e -t/taup transition /(A e t/tau) = (p transition / A) e -t/tau

Page 25: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 25

How much time do we needto achieve a certain pmetastable?

))(

ln(

)(

)(

/

/

tPA

Pt

tPA

Pe

eA

PtP

metstable

transition

metstable

transitiont

ttransitionmetstable

Page 26: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 26

Example:How Long for 1 failure / year?

100 MHz Clock (t = 10 ns)ptransition = 0.1A = 10 = 1 nsPmetstable = 1 / (100MHz . 1 year) = 1 / (108 x x 10 7 ) = x 10 -16

t = 10 -9 ln( 0.1 / (10 x x 10 -16 ) ) = about 31 ns

How about 10 years instead of 1?

PP

Ae

tP

A P

metstabletransition t

transition

metstable

/

ln( )

t = (10^-9)ln(pi x 10^(-15)) = 33nst = (10^-9)ln(pi x 10^(-15)) = 33ns

Page 27: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 27

How often will failuresoccur if we wait 100 ns?

4.45

)10ln(

100

2100

/

10

101010

1.0

)(

e

eA

PtP ttransition

metstable

At 100 MHz, this is about 1 failure every 1030 YEARS!Age of Hominids:Age of Earth:Age of Universe:

10 710 7

10 910 9

10 1010 10

Page 28: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 28

Is this a Good ExcuseFor Cruising a Light?

You get 10 30 Years!You get 10 30 Years!

Page 29: How Computers Work Lecture 8 Asynchronous State Machines and Metastability

How Computers Work Lecture 8 Page 29

What did we Learn Today?• If we violate setup or hold times, a flip-flop can give a random

digital output.• If we violate setup or hold times, we can’t bound the

propagation delay of a flip-flop.• Metastability usually causes strange outputs, but flip-flops are

sold that have valid, stable, outputs while internal nodes are metastable. They can still change their minds when coming out of metastability.

• In practice, we can choose a propagation time that will have a forever stable output “most” of the time.

• If we wait long enough (typ. 10-100 ns) “most of the time” is almost all of the time.

• We can easily detect when settling happens, but we can’t say how long it will take.