Re: Thinking out loud about metastability

Looking at our recent Virtex-IIPro metastability tests, I figured out

>the metastability capture window: >Using a 300 MHz clock, and a roughly 50 MHz data rate, we get one 1.5 ns >delay ( that is clock-to-Q plus short routing plus set-up time) per >second. And similarily one 2.0 ns delay per million seconds.

Does this mean that, thanks to routing delay, you could just do a 3 flip-flops in parallel for capturing, voting circuit on the other side, and not have to worry about it?

For the 1.5 ns delay, the capture window is thus 3.3 ns / 50 million = >0.07 femtosecond >For the 2.0 ns delay, the capture window is a million times smaller, >and for 2.5 ns it's another million times smaller ... > >Light travels 0.3 m in a ns, 0.3 mm in one ps, and 0.3 micron in one >femtosecond. > >Peter Alfke, Xilinx Applications
--
Nicholas C. Weaver                                 nweaver@cs.berkeley.edu
Reply to
Nicholas C. Weaver
Loading thread data ...

Voting circuits don't work as a metastability cure. Imagine a

2-out-of-3 circuit that's looking at three flip-flops. If one FF is HIGH, another is LOW, and the third is metastable, what's the output of the voting circuit?

Back in the early 80's, UCSD professor Leonard Marino wrote a paper in which he very thoroughly analyzed a number of alleged metastability cures, one of which was the voting circuit. I can't find my copy of the paper, but it must have appeared in IEEE Transactions on Computers.

Bob Perlman Cambrian Design Works

Reply to
Bob Perlman

True on both counts. But how do you do make the output stable? This is the point at which folks have tried adding hysteresis, etc. And we've all been down that road before, I think.

Bob Perlman Cambrian Design Works

Reply to
Bob Perlman

Reply to
Peter Alfke

Well, just because the manufacturer isn't putting the info in the data sheets, and don't test for it, I suspect that you could get a rough description that could be quite helpful. Knowing, for instance, that the strobes will always follow a CPU clock by at least

1 ns, and never change than 5 nS after the clock, would make designing a synchronous memory/peripheral controller running from the same clock a lot simpler.

If you can just get the roughest of descriptions of the clock vs. strobes circuitry, you can improve the system performance greatly, because you don't have to have ranked FFs on every strobe.

Now, on the high speed stuff, with clock multipliers, etc. it can get quite complex, and a CPU swap to the next higher speed can throw everything off due to a change in clock multiplier. But, I gathered from the initial post that this wasn't a clock multiplied CPU.

Jon

Reply to
Jon Elson

I agree.

The odds that one synchronizer will work without error is always better than the odds that two synchronizers will work without error.

The voting circuit only works without error only if two of the three synchronizers work without error.

-- Mike Treseler

Reply to
Mike Treseler

What if one FF says '1', one FF says '0' and the last is someplace inbetween?

--
Phil Hays
Reply to
Phil Hays

This

there

is

tell

--

--Ray Andraka, P.E. President, the Andraka Consulting Group, Inc.

401/884-7930 Fax 401/884-7950 email snipped-for-privacy@andraka.com
formatting link

"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759

Reply to
Ray Andraka

I am embarrassed. I fell into the "fix metastability trap". To quote a German proverb: "Alter schuetzt vor Torheit nicht" (Age is no protection against stupidity).

So, before anybody starts experimenting: Three or more flip-flops with majority voting are no cure for metastability, they just protract the agony. And so do all sorts of other schemes. All of them! But, as Hal wrote, just waiting helps. And you do not have to wait very long. Clocking the synchronizer result at 300 MHz into a second flip-flop gives you the "wrong" result once in a billion years. ( and we can debate what is actually right or wrong ). The uncertainty of 0 or 1 is never the issue in metastability ( either answer is as good as the other), it is the unpredictable timing that is the bummer. Since that range of unpredictability (is that a word?) is statistically less than 2 ns for any reasonable probability, we can ignore metastability in all but the very fastest applications.

But we cannot fix it, not with voting, nor with hysteresis, nor with any other contraptions.

My thanks to Bob Perlman for kicking me in the shins. It's good to have friends. :-) Peter Alfke

Reply to
Peter Alfke

I proposed some time ago that injecting a high frequency signal into the FF feedback path would limit metastabilty maximum duration.

You drop a pin onto a table now and then it will land perfectly balanced on its point, how long it stays upright depends on how well it was balanced.

Vibrate the table and it will stay upright for less time.

Reply to
nospam

I don't think so.

This is another example of a "fix". They don't work. The only question is can you see why they don't work?

In this case, the vibrations will kick some pins that have started to fall back to the ballancing point.

--
The suespammers.org mail server is located in California.  So are all my
other mailboxes.  Please do not send unsolicited bulk e-mail or unsolicited
 Click to see the full signature
Reply to
Hal Murray

Except that you don't know that this won't change if they tweek the chip design. It could very easily be 1 to 5 ns delay now and then change to

5 to 10 ns when they switch to a new process for cost savings. The 5 to 10 ns delay will put it right at the falling edge where I would likely be clocking it in with the old numbers.

Actually, yes the MCU runs at 8x or 4x the input clock. But the output is at the MCU rate and I will be clocking the FPGA with the 8x MCU output clock.

--
Rick "rickman" Collins

rick.collins@XYarius.com
 Click to see the full signature
Reply to
rickman

Reply to
Peter Alfke

Question: When a D-type flip-flop is in meta-stability, is it's output (Q pin) voltage equal to the input (D pin) voltage?

If it's not the same voltage, then a cascaded flip-flop, clocked just after the first one, would not be in meta-stability! Isn't it?

Luiz Carlos

Reply to
Luiz Carlos

The output level of a flip-flop during its metastable time is irrelevant. If it were in the middle ( which it isn't) we could easily fix this with a zener diode. The problem is timing. The Q output can - and will - change to the opposite state at a totally unpredictable time. That's the problem: unpredictable timing, not unknown levels.

Cascading flip-flops is the standard remedy, but it introduces latency.

Remember: Metastability causes an extra 3 ns of unpredictable delay >

Reply to
Peter Alfke

Very well put. I think it is so well said that it sould be added to the FPGA FAQ. There is a comp.arch.fpga FAQ, right?

--
Rick "rickman" Collins

rick.collins@XYarius.com
 Click to see the full signature
Reply to
rickman

Thankyou Philip. But as I said, I don't believe "There is no cure for metastability", or any other problem. It's just a question of time.

Luiz Carlos.

Reply to
Luiz Carlos

Luiz, you need to read up on metastability. There are things even in physics that have no solution. Perpetual motion is one. If you want to get philosophical about metastability, read Heisenberg's Uncertainty papers.

Phil Freid>

Reply to
Peter Alfke

Yep, you are right, it is just a matter of time. In this case it is infinite.

When you do your designs do you

A) Do nothing special for async signals entering a synchronous domain, because some day someone will solve this problem.

or

B) Use multistage synchronizers to move signals from one clock domain to another, because some day someone will solve this problem, but it hasn't happened yet.

or

C) Not sure, because I haven't ever seen this problem.

Philip

Reply to
Philip Freidin

You can make the capture window small, but there is always a finite chance that you will capture the metastable point.

Basic calculus: IF a curve has two local minima (the stable points), there must be one local maximum (the metastable point) between the two. If you happen to capture the input data when it is at the metastable point, metastability/unstable equilibria happens.

--
Nicholas C. Weaver                                 nweaver@cs.berkeley.edu
Reply to
Nicholas C. Weaver

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.