[time-nuts] Metastability?
Hal Murray
hmurray at megapathdsl.net
Sun May 20 17:42:25 UTC 2007
Metastability is simple after you get it. Lots of people, including some who
should know better get it wrong.
The best real world analogy that I know of is rolling a ball over a bump. If
the ball has lots of energy, it goes over over the bump and down the other
side. If it doesn't have much energy, it only gets partway up the bump and
then goes back to the side it started on. If it has just the right amount of
energy, it gets to the top and stops there, wobbles around a bit, and then
falls off on one side or the other.
In terms of a flip-flop, you have to meet setup and hold times. If not, you
get a runt pulse. The size of that pulse is similar to the energy of the
ball. If it's big the FF cleanly changes state. If it's tiny, nothing
happens. If it's in the middle you get in trouble.
With older technology, you could get good scope pictures. I think there is a
good section in Johnson and Graham's Black Magic. (Highly recommended but my
copy isn't handy so I can't give you a page number.)
One way to look at things is that the clock to out time gets longer. How
much longer has an exponential tail.
The only cure is to wait long enough. The key parameter is the excess time:
the clock period less clock to out, less prop time, less setup time... If
you put logic in there, that adds to the prop time or subtracts from the
excess/settling time. That's why the classic pair of flip-flops is so simple.
The other way to screwup the simple case is to put the two FFs on opposite
sides of the board or chip. Then the prop time becomes significant.
Note that the excess time is in a negative exponent on the probability of
going metastable. It's often reasonable to make the MTBF greater than the
age of the universe. Exponents are good! (at least in this case)
Using a faster technology helps too. The key parameter is the gain-bandwidth
of the inner loop of the flip-flop.
It's reasonable to build a test circuit and measure things. You end up with
two parameters. One is the size of the window. The other is the settling
rate, the exponent.
Xilinx has good app notes. Note that most manufacturers don't publish data
and the data they do publish isn't in the data sheet where it would mean
something.
Many years ago, there was a flurry of stupid ideas/circuits for "fixing" the
metastability problem. They just made things worse by moving the problem to
a place where you didn't look for it. That sort of junk is actually a good
test for understanding metastability. Anything other than wait long enough
is a sign of not understanding.
You can help/fix things by redesigning the circuit at a higher level. For
example, batch things so rather than needing to cross clock domains every
byte you only cross once per packet and can wait longer for that signal.
--
These are my opinions, not necessarily my employer's. I hate spam.
More information about the Time-nuts_lists.febo.com
mailing list