Metastability
K2
Posts: 693
As a result of a paper I read years ago, I've been on edge regarding metastability (no pun intended). Sometimes it amazes me that computers work at all.
Suppose one were to devote a cog to reading the current state of a pin several million times a second. Suppose further that the pin in question is driven by an external asynchronous signal that changes state approximately every microsecond. (I'm describing essentially a high speed counter application.)
Over time, the chances that the external signal will change state at the very same instant that the pin is sampled by the cog, is very high. Is the VLSI process in which the Propeller was implemented designed to handle this gracefully? Is there any guarantee against a protracted metastable state that would result in inaccurate sampling?
I'm seeking some sort of warm fuzzy before proceeding with a particular application.
Suppose one were to devote a cog to reading the current state of a pin several million times a second. Suppose further that the pin in question is driven by an external asynchronous signal that changes state approximately every microsecond. (I'm describing essentially a high speed counter application.)
Over time, the chances that the external signal will change state at the very same instant that the pin is sampled by the cog, is very high. Is the VLSI process in which the Propeller was implemented designed to handle this gracefully? Is there any guarantee against a protracted metastable state that would result in inaccurate sampling?
I'm seeking some sort of warm fuzzy before proceeding with a particular application.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Searider
Device frequency = 10 kHz, Sample at better than 20 kHz
Though if you were running in a dedicated cog flat out how you would combat that (without going to an external high speed counter chip) is a mystery to me....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=================
The future is in our hands.
Which way to the future?
=================
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
very slightly out of time sync couldn't you track the pins changing state without worrying about taking
a reading just as the pin state changed?
One processor might take a reading just as the state changed but there would be no way all
of the processors could as they each would read at slightly different times.
It would be kind of like looking at an analog recording of the pin changes instead of a purely binary
recording from a single source. You could figure out from the multiple readings that were taken
just exactly how the pin is being set... I can't see how this scheme would ever give a false read.
Does that make any sense?
That's just a way of oversampling the input state but once again, it doesn't make any difference. Metastability has been presented as a "problem" by the OP yet no evidence is furnished as to how this is or could be a problem with the Prop and the way it is used.
When actual digital logic circuits are designed then metastability/race conditions are always a consideration but this is also why practically all digital logic systems are clocked so as to synchronize the signals. So systems are actually slowed down to the lowest common speed.
I repeat "how is it a problem?" No, it isn't. So it's not a problem to be solved.
We get a lot of these types of perceived problems on the forum and I am always amazed at how because it has been labeled as such that people try to solve it without question. The problem is in perceiving it as a problem to be solved.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
-Phil
0000010000100101101011101111011111111111111111111111111111111
You can fix that with a latch in software - eg as soon as you get that first 1 you latch the state of a software flipflop that now cannot change state for a short period of time (short relative to the shortest pulse you expect to measure).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller
http://forums.parallax.com/showthread.php?p=632513
about halfway down the page. He verifies what Phil mentioned, that there is no synchronizer on the prop input, but neither is there the kind of fan-out directly from the inputs that could lead to missynch of internal states.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
> You might be reassured by Chip Gracey's comments on metastability in relation to design of the prop in this thread,
> forums.parallax.com/forums/default.aspx?f=25&p=1&m=172375
Tracy, you and rokicki, back in 2007, articulated precisely what I was concerned about...oscillations that would result in an inaccurate (ie, high) count. Thank you very much for the link to this discussion.
While I appreciate Chip's point about the penny falling on the razor's edge, I'm not entirely certain that the metaphor (or analog) holds. I'll have to give the matter more thought. I still can't shake off my concerns...
Meanwhile, an external counter that is clocked by the signal in question wouldn't cost much and might pay off in peace-of-mind, if nothing else.
This may be a case where an actual test is in order. One trillion counts later I might find the peace-of-mind I seek.
Post Edited (David Jensen) : 3/25/2010 7:25:33 AM GMT