1 Metastability
1 Metastability
1 Metastability
Contents
Definition of metastability
Entering metastability
Control signal synchronizers
Reliability of synchronization
Mesonchronous and multisynchronous systems
Main reference: Metastability and Synchronizers: A Tutorial,
Metastable point
alone
Noise alone is enough to do this
Metastability in logic
As far as inverters are concerned:
Metastability is being in the high gain region, particularly close
of 100ps
The closer the waveform, the longer it takes the output to
settle
All must eventually settle
of 1ps
Again takes longer to settle the closer we are
Which direction we settle depends on noise and how close to
inverter threshold we are
baseband demodulator
Both use different and unrelated clocks
Because the frequencies are independent there will be
periodic instances where data and clock edges are too close
together
Setup and hold times are periodically violated for the
receiver
Probability of metastability
First we need to know how often the latch enters
metastability
Assume that for metastability to occur a change in signal
must happen in a certain window around the edge (e.g.
Setup+hold times) Tw.
Now lets assume a uniform distribution of change within the
clock period (assuming e.g. Two independent clock domains)
Tc
Thus probability of entering metastability is Tw/Tc=TwFc
Rate of metastability
D does not change every cycle
Assume D changes at a rate Fd < Fc
Then rate of metastability is FdTwFc
Consider the following example:
Fc=1GHz
Fd=100MHz (D changes on every tenth cycle)
Tw=20ps (typical value)
expected delay
Thus the following registers store the wrong values
This error propagates and the circuit completely fails
If this happens twice per microsecond, then the circuit is
completely useless
Three dimensional effect and wiring caps are affecting this trend
entering voltage Vo
V1 is a constant
The larger the Vo, the shorter the time
If Vo = V1 then time=0 (there is no metastability
If Vo=0 time=infinity (impossible due to noise)
Thus metastability is NOT being exactly in the middle and
exiting randomly, it is entering the high gain region and
exiting in a known but long time
Probability of remaining in
metastability
In general we have no idea how large Vo is
It is affected by the exact conditions when the edge occured
Also depends on noise and coupled signals!
exponentially
So we can obtain a value for the PROBABILITY that the latch
or flip flop is still metastable at a time S
If a flip-flop enters metastability
the probability it is still metastable at a time
t>0 later is:
e t /
Synchronization
We can NEVER guarantee that asynchronous signals will not
cause metastability
In fact we can GUARANTEE they will cause metastability at
a certain rate
The best we can do is design a scheme that makes the
probability of metastability extremely low
MTBF
The inverse of rate is time
The inverse of rate of failure is Mean Time Between Failures
(MTBF)
Our aim is thus to increase MTBF as much as we can
Solution to metastability?
Lets assume we give the circuit one full cycle to resolve
S=complete cycle
MTBF=4X10^29 years
If the circuit fails due to metastability, the next failure
correct value
It will take longer than Tcq for the correct value to appear on
Q
This is the true definition of metastability at output port
Scenario a:
FF1 catches the correct value of D1 in cycle 1
FF2 samples this value in cycle 2
The value appears at the output of FF2 in cycle 2
Q2 is correct in cycle 3
Scenario b:
FF1 completely misses the 1 on D1
Q1 remains at 0
FF1 samples correct D1 in cycle 2
Q2 is correct in cycle 3
Scenario c:
FF1 goes metastable
Q1 resolves to correct value but very slowly
However, there is negligible probability it will fail to resolve
Scenario d:
FF1 goes metastable
Q1 resolves to incorrect value (logic low)
Difference between cases b and d? (missing the value or
Scenario e:
FF1 goes metastable and goes high
FF1 glitches and resolves metastability at 0
FF1 samples correct value comfortably in cycle 2
Q2 is correct in cycle 3
Scenario f:
FF1 goes metastable and its output shoots to high
Q1 resolves to correct value (maintaining high)
FF2 samples correct value in cycle 2
Q2 is correct in cycle 3
Scenarios
Data can be:
Missed
Caught
Metastably sampled
Resolves to correct value
Resolves to wrong value
Shoots to either values then resolves to either values
control signal
The receiver sees the request and reads the data, raising
acknowledge. Sender can now change data and re-raise req
manage to synchronize
Overhead of synchronization
It takes 2 cycles (always consider worst case) to synchronize
req
2 cycles to synchronize ack
1 cycle at each side (at least) to read data
Now if another transfer requires a similar change in controls
then req and ack must be lowered to get ready for the next
cycle
Transmitter reads ack high (2 cycles) and lowers req (1 cycle)
Receiver sees req going low (2 cycles) and lowers ack (1
cycle)
Overhead is 2+2+1+1+2+2+1+1=12 cycles to transmit
one word!!
full!!
WRITTEN
word
Write is incremented by the transmitter whenever it writes a
new word
Full and Empty = NOT(Read-Write)
Thus calculating both Full and Empty requires reading
pointers from two clock domains!
Synchronizing pointers
Going EMPTY
stopped writing
The receiver increments read pointer
It reads write pointer through synch
It raises empty flag and stops reading
Going FULL
stopped reading
The transmitter increments write pointer
It reads Read pointer through synch
It raises Full flag and stops Writing
Advantages of FIFO
Much lower latency than normal synchronizers
We have at most 2 cycles of being held up if the empty or full
words
Pointers are not single bit controls, they are data busses
The pointer counters are Grey encoded, they do not simply
increment
With Grey encoding only one bit changes every cycle
Even if the synchronizer fails to synchronize one bit, it is
highly unlikely that the failed bit is the bit that has changed
Usually works well