Eliminates meta stability (yes or no)?

I new idea?

What do you experts think of the following entity I wrote? It?s purpose is to eliminate metastability of the q signal.

The d signal is synchronous to a 1.8 MHz clock and the q will be synchronous to a new 24 MHz clock. That means that at worst the entity will sample ?one? meta stable bit-value surrounded by many non meta stable bits.

For example (sampled values)

d: 00000X111111X00000X111111X00000 (X = meta stable bit-level)

From the initial state it need to interpret two neighbor samples as ones, only then it gives a one on the q output. Then after that to get a zero on the q output it must interpret two neighbor samples as zeros, then it gives a zero on the q output.

And if you don?t think it will work please explain why. :-)

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity sync_to_new_clock is

Port ( new_clk : in std_logic;

d : in std_logic;

q : out std_logic);

end sync_to_new_clock;

architecture beh of sync_to_new_clock is

signal state : std_logic := '0';

begin

process(new_clk)

begin

if rising_edge(new_clk) then

case state is

when '0' => if d = '1' then -- a "real" 1 or a "fake-mata-stable" '1'

state

Reply to
Bill
Loading thread data ...

Bill -

What if d is not a 1 or a 0, then what does your logic do?

Remember, when a signal goes metastable, it may have an indeterminate value, ie, it may hover in the transition region somewhere between a 0 and a 1.

Also - since you're using the d signal as input to multiple flops, because of routing and gate delays some flip-flops might see the d signal after it transitions, others might miss the transition.

I think you're fighting a losing battle here. Synchronize the signal!

John Providenza

Reply to
johnp

OK. I will go with this instead. The signals a and b is left to settle for 2 clock cycles to minimize the meta stable risk.

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity sync_to_new_clock is Port ( new_clk : in std_logic; d : in std_logic; q : out std_logic); end sync_to_new_clock;

architecture beh of sync_to_new_clock is

signal a, b, t : std_logic := '0'; attribute maxdelay: string; attribute maxdelay of a: signal is "1 ns"; attribute maxdelay of b: signal is "1 ns"; begin process(new_clk) begin if rising_edge(new_clk) then if t = '0' then q indeterminate value, ie, it may hover in the transition region

Reply to
Bill

"johnp" skrev i meddelandet news: snipped-for-privacy@g49g2000cwa.googlegroups.com...

The idea was that the state machine wolud jump to the other state or stay at the present state.

:-(

I know, but it's an interesting topic :-)

Reply to
Bill

Not new.

State: 000000X111111X00000X111111X0000 Q: 0000000X111111X00000X111111X000

But if the state is not one or zero, then with a zero input it might output a zero, and it might output a one. And with a one input it might output a zero, and it might output a one.

While this case doesn't exist for binary logic, it does exist if "state" is not at '1' or '0', or metastable. The problem is that null isn't a physically realistic choice. The circuit is going to do something.

--
Phil Hays to reply solve: phil_hays at not(coldmail) dot com  
 If not cold then hot
Reply to
Phil Hays

Haven't we beaten this to death? Just keep it simple, double-synchronize the asynchronous input in two cascaded flip-flops, and keep the delay between the two flip-flops to a minimum. At 24 MHz you will have more than 30 ns slack, and the MTBF will be more than 10e180 years. Call it an eternity. What more do you want ? Peter Alfke

Reply to
Peter Alfke

...

Because the example you give is in VHDL, not in electronic circuitry. Metastability is a problem of real logic hardware, not VHDL. Any circuitry implementing actual gates and flip-flops will behave differently from your VHDL, given that physical components have an analog behavior with a finite gain and load capacitance that is not completely described in a digital VHDL model.

The problem is the wire capacitance on the "q" output. Any solution has to drive that capacitance to a legal voltage clearly representing either a "1" or a "0" using finite gain circuitry.

The solution is simple: put a positive gain feedback amplifier in the path and wait for it to resolve... and the fastest and simplest to characterize feedback device almost always turns out to be the output stage of a flip-flop/register chosen by your technology provider. Use it; minimize the load by driving only a single nearby following flop-flop; and wait the prescribed number of pS/nS/uS/fortnights sufficient for a resolution with a probability matching your choosen reliability level. Done.

IMHO. YMMV.

--
rhn A.T nicholson d.O.t C-o-M
Reply to
rhnlogic

I'm not an expert, but I think I understand the issues.

Whenever I see "eliminate" and "metastability" in the same sentence, I assume somebody doesn't understand metastability.

It's like quantum mechanics. A lot of very smart people have worked on it. You are better off trusting them rather than inventing kludges - at least until you really understand what they have discovered.

One of the problems with shooting down proposals like this is that it takes time. After a while the experts get tired of that.

This one is easy on two grounds.

First:

You need a gate that can detect 3 states: 0, X, and 1. They don't make them.

Second:

The other problem is that the best fix for metastability is to wait longer. You need time above the normal setup times. The more the better. The probability of badness decays exponentially with the excess time. Putting a gate in there reduces the excess time by the prop time of the gate. You are much better off to just use the old fashioned 2-FF synchronizer.

--
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
commercial e-mail to my suespammers.org address or any of my other addresses.
These are my opinions, not necessarily my employer's.  I hate spam.
Reply to
Hal Murray

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.