什么是亚稳态?What is metastability?

1. 什么是亚稳态?
        1.1 亚稳态发生的原因  
        1.2 亚稳态的危害
         1.3 亚稳态的解决办法
        1.4 亚稳态与系统可行性
2. 你的PLD处于亚稳态吗?
3. What is metastability? [from www.asic-world.com]
======================================================================

1.什么是亚稳态?
亚稳态是指触发器无法在某个规定时间段内达到一个可确认的状态。当一个触发器进入亚稳态时,既无法预测该单元的输出电平,也无法预测何时输出才能稳定在某个正确的电平上。在这个稳定期间,触发器输出一些中间级电平,或者可能处于振荡状态,并且这种无用的输出电平可以沿信号通道上的各个触发器级联式传播下去。

1.1 亚稳态发生的原因  
在同步系统中,如果触发器的setup time / hold time不满足,就可能产生亚稳态,此时触发器输出端Q在有效时钟沿之后比较长的一段时间处于不确定的状态,在这段时间里Q端毛刺、振荡、固定的某一电压值,而不是等于数据输入端D的值。这段之间成为决断时间(resolution time)。经过resolution time之后Q端将稳定到0或1上,但是究竟是0还是1,这是随机的,与输入没有必然的关系。

1.2 亚稳态的危害  
由于输出在稳定下来之前可能是毛刺、振荡、固定的某一电压值,因此亚稳态除了导致逻辑误判之外,输出0~1之间的中间电压值还会使下一级产生亚稳态(即导致亚稳态的传播)。   逻辑误判有可能通过电路的特殊设计减轻危害(如异步FIFO中Gray码计数器的作用),而亚稳态的传播则扩大了故障面,难以处理。  

1.3 亚稳态的解决办法
只要系统中有异步元件,亚稳态就是无法避免的,因此设计的电路首先要减少亚稳态导致错误的发生,其次要使系统对产生的错误不敏感。前者要同步来实现,而后者根据不同的设计应用有不同的处理办法。用同步来减少亚稳态发生机会的典型电路如图所示。左边为异步输入端,经过两级触发器同步,在右边的输出将是同步的,而且该输出基本不存在亚稳态。其原理是即使第一个触发器的输出端存在亚稳态,经过一个CLK周期后,第二个触发器D端的电平仍未稳定的概率非常小,因此第二个触发器Q端基本不会产生亚稳态。注意,这里说的是“基本”,也就是无法“根除”,那么如果第二个触发器Q出现了亚稳态会有什么后果呢?后果的严重程度是由你的设计决定的,如果系统对产生的错误不敏感,那么系统可能正常工作,或者经过短暂的异常之后可以恢复正常工作,例如设计异步FIFO时使用格雷码计数器当读写地址的指针就是处于这方面的考虑。如果设计上没有考虑如何降低系统对亚稳态的敏感程度,那么一旦出现亚稳态,系统可能就崩溃了。  

1.4 亚稳态与系统可行性
使用同步电路以后,亚稳态仍然有发生的可能,与此相连的是MTBF(Mean Time Between Failure),亚稳态的发生概率与时钟频率无关,但是MTBF与时钟有密切关系。有文章提供了一个例子,某一系统在20MHz时钟下工作时,MTBF约为50年,但是时钟频率提高到40MHz时,MTBF只有1分钟!可见降低时钟频率可以大大减小亚稳态导致系统错误的出现,其原因在于,提供较长的resolution time可减小亚稳态传递到下一级的机会,提高系统的MTBF,如图所示。
  

2. 你的PLD处于亚稳态吗?[1999-10-08]
本实例从电路及统计学角度出发,详细地说明了PLD的亚稳态行为。同时还列出了Cypress PLD的亚稳特征信息,以帮助您得到所希望的可靠性。点击此处查看PDF全文

3. What is metastability?

 

 

 

Whenever there are setup and hold time violations in any flip-flop, it enters a state where its output is unpredictable: this state is known as metastable state (quasi stable state); at the end of metastable state, the flip-flop settles down to either '1' or '0'. This whole process is known as metastability. In the figure below Tsu is the setup time and Th is the hold time. Whenever the input signal D does not meet the Tsu and Th of the given D flip-flop, metastability occurs.


When a flip-flop is in metastable state, its output oscillate between '0' and '1' as shown in the figure below (here the flip-flop output settles down to '0') . How long it takes to settle down, depends on the technology of the flip-flop.

 

 

If we look deep inside of the flip-flop we see that the quasi-stable state is reached when the flip-flop setup and hold times are violated. Assuming the use of a positive edge triggered "D" type flip-flop, when the rising edge of the flip-flop clock occurs at a point in time when the D input to the flip-flop is causing its master latch to transition, the flip-flop is highly likely to end up in a quasi-stable state. This rising clock causes the master latch to try to capture its current value while the slave latch is opened allowing the Q output to follow the "latched" value of the master. The most perfectly "caught" quasi-stable state (on the very top of the hill) results in the longest time required for the flip-flop to resolve itself to one of the stable states.

 

 

How long does it stay in this state?

The relative stability of states shown in the figure above shows that the logic 0 and logic 1 states (being at the base of the hill) are much more stable than the somewhat stable state at the top of the hill. In theory, a flip-flop in this quasi-stable hilltop state could remain there indefinitely but in reality it won't. Just as the slightest air current would eventually cause a ball on the illustrated hill to roll down one side or the other, thermal and induced noise will jostle the state of the flip-flop causing it to move from the quasi-stable state into either the logic 0 or logic 1 state.

 

What are the cases in which metastability occurs?

As we have seen that whenever setup and hold violation time occurs, metastability occurs, so we have to see when signals violate this timing requirement:

 

  • When the input signal is an asynchronous signal.
  • When the clock skew/slew is too much (rise and fall time are more than the tolerable values).
  • When interfacing two domains operating at two different frequencies or at the same frequency but with different phase.
  • When the combinational delay is such that flip-flop data input changes in the critical window (setup+hold window)

 

What is MTBF?

MTBF is Mean time between failure, what does that mean? Well MTBF gives us information on how often a particular element will fail or in other words, it gives the average time interval between two successive failures. The figure below shows a typical MTBF of a flip-flop and also it gives the MTBF equation. I am not looking here to derive MTBF equation :-)

 

 

So how do I avoid metastability?

In reality, one cannot avoid metastability and increased clock-to-Q delays in synchronizing asynchronous inputs, without the use of tricky self-timed circuits. So a more appropriate question might be "How do I tolerate metastability?"

 

In the simplest case, designers can tolerate metastability by making sure the clock period is long enough to allow for the resolution of quasi-stable states and for the delay of whatever logic may be in the path to the next flip-flop. This approach, while simple, is rarely practical given the performance requirements of most modern designs.

 

The most common way to tolerate metastability is to add one or more successive synchronizing flip-flops to the synchronizer. This approach allows for an entire clock period (except for the setup time of the second flip-flop) for metastable events in the first synchronizing flip-flop to resolve themselves. This does, however, increase the latency in the synchronous logic's observation of input changes.

 

Neither of these approaches can guarantee that metastability cannot pass through the synchronizer; they simply reduce the probability to practical levels.

 

In quantitative terms, if the Mean Time Between Failure (MTBF) of a particular flip-flop in the context of a given clock rate and input transition rate is 33.33 seconds then the MTBF of two such flip-flops used to synchronize the input would be (33.33* 33.33) = 18.514 Minutes. Well I have taken the worst flip-flop ever designed in history of man kind :-). The figure below shows how to connect two flip-flops in series to achieve this and also the resultant MTBF.

 

 

Normally,

 

  • We can use a metastable hardened flip-flop
  • Cascade two or three D-Flip-Flops (two or three stages synchronizer).

 

METASTABILITY REFERENCES

 

 

 

  • http://www-s.ti.com/sc/psheets/sdya006/sdya006.pdf
  • Thomas J. Chaney, "Measured Flip-Flop Responses to Marginal Triggering", IEEE Transactions on Computers, Vol. C-32. No. 12, December 1983, pp.1207-1209.
  • Lindsay Kleeman and Antonio Cantoni, "On the Unavoidability of Metastable Behavior in Digital Systems", IEEE Transactions on Computers, Vol. C-36. No. 1, January 1987, pp.109-112.
  • Lindsay Kleeman and Antonio Cantoni, "Can Redundancy and Masking Improve the Performance of Synchronizers?", IEEE Transactions on Computers, Vol. C-35, No. 7, July 1986, pp.643-646.
  • Cypress Semiconductor, "Are Your PLDs Metastable?, Fax ID: 6403, May 1992, Revised March 6,1997. http://www.cypress.com/pld/pldappnotes.html#pldmeta
  • http://www.xilinx.com/apps/xapp.htm
  • M. Valencia, M. J. Bellido, J. L. Huertas, A. J. Acosta, and S. Sanchez-Solano, "Modular Asynchronous Arbiter Insensitive to Metastability. IEEE Transactions on Computers, 44(12):1456-1461, December 1995.
    [--- from www.asic-world.com]


什么是亚稳态?
数字电路中的简单双稳态电路就是两个反相器首尾相连组成(加一些控制逻辑变成了锁存器,触发器),然而并不像名字显示的,这种电路其实还有第三种半稳定态——就是当两个反相器都处于中间值得情况——这称之为亚稳态。我们知道反相器在非逻辑值范围的反馈系数是相当大的,一旦因为干扰或者噪音离开了这个中心点,就会很快地进入逻辑值范围(稳态)。数学分析,从亚稳态进入稳态,正如放射元素的衰变,是一个指数的规律(为什么是指数的规律?你要是想不明白,说明你还没有搞明白亚稳态)。

那么,亚稳态的危害到底是什么呢?消耗功率?其实不是(虽然亚稳态消耗很大的功率),亚稳态的问题在于其电平并不处于有效逻辑电平范围内,而且在变化。这就导致与其相连其他数字部件将其作出不同的判断(注意,不同),有的作为'1',有的作为'0',有的也进入了亚稳态,数字部件就会逻辑混乱。

那么究竟如何避免(或者减小)亚稳态的危险呢?注意到亚稳态的触发器继续停留在亚稳态的几率按照指数减少,那么办法就是等——等足够长的时间,直到这个几率变得小的实际上不会发生。到底需要有多长呢?有的厂商有一个数据,有的没有,按照普通的做法,至少等一个时钟周期——这也就是所谓的异步数据要用两个触发器打一下。这一段有点糊涂,不容易说明白,你看了要是觉得云里雾里,不知所云,那们你只有找一本书学习
了。

posted @ 2011-05-22 10:17  Hello Verilog  阅读(2047)  评论(0编辑  收藏  举报