S
Symon
Guest
Hi,
Before I start, metastability is like death and taxes,
unavoidable! That said, I've read the latest metastability thread. I
thought these points were interesting.
Firstly, A quote from Peter, who has carried out a most thorough
experimental investigation :-
"I have never seen strange levels or oscillations ( well, 25 years ago
we had TTL oscillations). Metastability just affects the delay on the
Q output."
Secondly, from Philip's excellent FAQ :-
"Metastable outputs can be
1) Oscillations from Voh to Vol, that eventually stop.
2) Oscillations that occur (and may not even cross) Voh and Vol
3) A stable signal between Voh and Vol, that eventually resolves.
4) A signal that transitions to the opposite state of the pre
clock
state, and then some time later (without a clock edge)
transitions
back to the original state.
5) A signal that transitions to the oposite state later than the
specified clock-to-output delay.
6) Probably some more that I haven't remembered. "
So, this got me thinking on the best way to mitigate the effects of
metastability. If Peter is correct in his analysis of his experimental
data, and I've no reason to doubt this, then Philip's option 5) is the
form of metastability appearing in Peter's Xilinx FPGA experiments.
So, bearing this in mind, a thought experiment. We have an async
input, moving to a synchronising clock domain at (say) 1000MHz. Say we
have a budget of 5ns of latency to mitigate metastability. The sample
is captured after the metastability mitigation circuit (MMC) with a FF
called the output FF.
My first question is, which of these choices of MMC is least likely
to produce metastability at the output FF?
1) The MMC is a 4 FF long shift register clocked at 1000MHz.
MMC1 : process(clock)
begin
if rising_edge(clock) then
FF1 <= input;
FF2 <= FF1;
FF3 <= FF2;
FF4 <= FF3;
output <= FF4;
end if;
end process;
2) The MMC is 4 FFs, each clock enabled every second clock.
MMC2 : process(clock)
begin
if rising_edge(clock) then
toggle <= not toggle;
if toggle = '1' then
FF1 <= input;
FF3 <= FF1;
output <= FF3;
else
FF2 <= input;
FF4 <= FF2;
output <= FF4;
end if;
end if;
end process;
Option 1) offers extra stages of synchronization between the input
and output, but the 1ns gap between FFs means that metastability is
more likely to propagate. Option 2) waits 2ns for the sample FFs to
make up their mind, vastly decreasing the metastability probability.
My second question is, does the type of metastability, i.e. the
things in Philip's list, affect which is the better choice? For
instance, if the first FF in the MMC exhibits oscillations in
metastability, then the second FF in the MMC would have several
chances, as its input oscillates, to sample at the 'wrong' time. This
might favour MMC option 2). If, however, the first FF in the MMC goes
into option 5) metastability, then there's only one chance for the
second FF to sample at the 'wrong' time. This might confer an
advantage on MMC option 1).
Anyway, I'm still thinking about this. I think the clock frequency
may decide which is better for a given FF type. Any comments?
Cheers, Syms.
Before I start, metastability is like death and taxes,
unavoidable! That said, I've read the latest metastability thread. I
thought these points were interesting.
Firstly, A quote from Peter, who has carried out a most thorough
experimental investigation :-
"I have never seen strange levels or oscillations ( well, 25 years ago
we had TTL oscillations). Metastability just affects the delay on the
Q output."
Secondly, from Philip's excellent FAQ :-
"Metastable outputs can be
1) Oscillations from Voh to Vol, that eventually stop.
2) Oscillations that occur (and may not even cross) Voh and Vol
3) A stable signal between Voh and Vol, that eventually resolves.
4) A signal that transitions to the opposite state of the pre
clock
state, and then some time later (without a clock edge)
transitions
back to the original state.
5) A signal that transitions to the oposite state later than the
specified clock-to-output delay.
6) Probably some more that I haven't remembered. "
So, this got me thinking on the best way to mitigate the effects of
metastability. If Peter is correct in his analysis of his experimental
data, and I've no reason to doubt this, then Philip's option 5) is the
form of metastability appearing in Peter's Xilinx FPGA experiments.
So, bearing this in mind, a thought experiment. We have an async
input, moving to a synchronising clock domain at (say) 1000MHz. Say we
have a budget of 5ns of latency to mitigate metastability. The sample
is captured after the metastability mitigation circuit (MMC) with a FF
called the output FF.
My first question is, which of these choices of MMC is least likely
to produce metastability at the output FF?
1) The MMC is a 4 FF long shift register clocked at 1000MHz.
MMC1 : process(clock)
begin
if rising_edge(clock) then
FF1 <= input;
FF2 <= FF1;
FF3 <= FF2;
FF4 <= FF3;
output <= FF4;
end if;
end process;
2) The MMC is 4 FFs, each clock enabled every second clock.
MMC2 : process(clock)
begin
if rising_edge(clock) then
toggle <= not toggle;
if toggle = '1' then
FF1 <= input;
FF3 <= FF1;
output <= FF3;
else
FF2 <= input;
FF4 <= FF2;
output <= FF4;
end if;
end if;
end process;
Option 1) offers extra stages of synchronization between the input
and output, but the 1ns gap between FFs means that metastability is
more likely to propagate. Option 2) waits 2ns for the sample FFs to
make up their mind, vastly decreasing the metastability probability.
My second question is, does the type of metastability, i.e. the
things in Philip's list, affect which is the better choice? For
instance, if the first FF in the MMC exhibits oscillations in
metastability, then the second FF in the MMC would have several
chances, as its input oscillates, to sample at the 'wrong' time. This
might favour MMC option 2). If, however, the first FF in the MMC goes
into option 5) metastability, then there's only one chance for the
second FF to sample at the 'wrong' time. This might confer an
advantage on MMC option 1).
Anyway, I'm still thinking about this. I think the clock frequency
may decide which is better for a given FF type. Any comments?
Cheers, Syms.