赛灵思
直播中

李骏鹏

7年用户 1215经验值
私信 关注
[问答]

是否必须将主时钟与辅助时钟重新同步?

嗨,
我知道当我使用异步信号时,我必须小心避免(或尽量减少)亚稳态。
在我的设计中,我有以下情况:
- 主要clk  -  20MHz
- 辅助时钟:使用DCM内核(Spartan 3E的数字时钟管理器)获得 -  4,096MHz
如果我想使用“辅助时钟”对使用“主时钟”处理的信号进行采样,是否必须将其与“辅助时钟”重新同步?
从“主时钟”获得所有“辅助时钟”之后?
但他们的频率是不同的。
为了同步,我使用两个FF的简单电路
还有其他一些简单快捷的解决方案吗?
谢谢,
保罗

以上来自于谷歌翻译


以下为原文

Hi,

I know that when I work with asynchronous signals I have to be careful to avoid (or to minimize chances) metastability.

In my design I have the following situation:

- main clk - 20MHz
- secondary clock: obtained using a DCM core (Digital Clock Manager for Spartan 3E) - 4,096MHz

If I want to sample a signal processed with the "main clock" using the "secondary clock" do I have to resynchronize it with the "secondary clock"? After all the "secondary clock" is obtain from the "main clock"? But their frequencies are different.

For synchronizing I use a simple circuit from two FF. Are there some other simple and quick solutions?

Thanks,
Paul

回帖(5)

潘晶燕

2019-1-24 10:11:12
保罗,
亚稳定性不是世界末日。
如果信号很重要(您必须知道它是零还是一个),则需要同步器。
阶段的数量仅使亚稳态的发生频率降低(它永远不会完全消失)。
一个很好的例子是键盘:如果你键入并获得错误的字符,你可以退格,并输入正确的字符。
不需要额外的阶段。
键入的异步性质和系统采样对于偶尔的亚稳状态是好的,并且字符不想要你想要的(因为打碎的位从未稳定,并且产生了一些随机字符)。
不能容忍亚稳态的情况的一个很好的例子是FIFO中的满标志和空标志。
输入上的时钟正在填充FIFO,输出上的时钟正在清空FIFO。
如果满标志变为亚稳态,则可能会尝试将FIFO填满过满(丢失一个值),或者您可能认为FIFO已满,而不是。
对于这种情况,同步器是强制性的良好工程。
通常,满标志几乎已满(一个或多个比实际完全少),以使FIFO在您的设计中更加健壮。
因此发生亚稳态信号。
仅仅因为它可能是'避免它是糟糕的工程。
同步器可以在需要它们的地方使用,并且它的亚稳定频率很重要。
同步器不能消除亚稳态,它只会降低发生率。
Austin Lesea主要工程师Xilinx San Jose
在原帖中查看解决方案

以上来自于谷歌翻译


以下为原文

Paul,

Metastability is not the end of the world.  If the signal is important (you must know if it is zero or one) then a synchronizer is required.  The number of stages only makes the occurence of the metastable condition less frequent (it never goes away completely).

A good example is of a keyboard:  if you type and get the wrong character, you back-space, and type the right one.  No extra stages are required.  The asynchrnous nature of typing, and the system sampling is just fine with the occasional metastable state, and the character being not want you wanted (because the smapled bits never stabalized, and some random character resulted).

A good example of a case where metastability is not to be tolerated is in a FIFO for the full, and empty flags.  The clock on the input is filling the FIFO, the clock on the output is emptying the FIFO.  If the full flag goes metastable, you might try to fill the FIFO to over-full (lose a value), or you might think the FIFO is full, when it isn't.  For this case, the synchronizer is mandatory good engineering.  Often, the full flag is almost full (one or more less than really full), to make the FIFO more robust in your design.
 
So a signal being metastable happens.  Avoiding it just because it 'might be' is poor engineering.  Synchronizers get used where they are needed, and how often it goes metastable is important.  The synchronizer does not eliminate metastability, it only reduces the occurence rate.
 
Austin Lesea
Principal Engineer
Xilinx San JoseView solution in original post
举报

李刚

2019-1-24 10:28:36
对于单个信号,2个FF可以很好地工作。如果你有并行数据总线,你应该使用FIFO。
------------------------------------------“如果它不起作用
模拟,它不会在板上工作。“

以上来自于谷歌翻译


以下为原文

For a single signal, 2 FFs will do nicely.

If you have a parallel data bus, you ought to use a FIFO.

------------------------------------------
"If it don't work in simulation, it won't work on the board."
举报

潘晶燕

2019-1-24 10:37:28
保罗,
亚稳定性不是世界末日。
如果信号很重要(您必须知道它是零还是一个),则需要同步器。
阶段的数量仅使亚稳态的发生频率降低(它永远不会完全消失)。
一个很好的例子是键盘:如果你键入并获得错误的字符,你可以退格,并输入正确的字符。
不需要额外的阶段。
键入的异步性质和系统采样对于偶尔的亚稳状态是好的,并且字符不想要你想要的(因为打碎的位从未稳定,并且产生了一些随机字符)。
不能容忍亚稳态的情况的一个很好的例子是FIFO中的满标志和空标志。
输入上的时钟正在填充FIFO,输出上的时钟正在清空FIFO。
如果满标志变为亚稳态,则可能会尝试将FIFO填满过满(丢失一个值),或者您可能认为FIFO已满,而不是。
对于这种情况,同步器是强制性的良好工程。
通常,满标志几乎已满(一个或多个比实际完全少),以使FIFO在您的设计中更加健壮。
因此发生亚稳态信号。
仅仅因为它可能是'避免它是糟糕的工程。
同步器可以在需要它们的地方使用,并且它的亚稳定频率很重要。
同步器不能消除亚稳态,它只会降低发生率。
Austin Lesea主要工程师Xilinx San Jose

以上来自于谷歌翻译


以下为原文

Paul,

Metastability is not the end of the world.  If the signal is important (you must know if it is zero or one) then a synchronizer is required.  The number of stages only makes the occurence of the metastable condition less frequent (it never goes away completely).

A good example is of a keyboard:  if you type and get the wrong character, you back-space, and type the right one.  No extra stages are required.  The asynchrnous nature of typing, and the system sampling is just fine with the occasional metastable state, and the character being not want you wanted (because the smapled bits never stabalized, and some random character resulted).

A good example of a case where metastability is not to be tolerated is in a FIFO for the full, and empty flags.  The clock on the input is filling the FIFO, the clock on the output is emptying the FIFO.  If the full flag goes metastable, you might try to fill the FIFO to over-full (lose a value), or you might think the FIFO is full, when it isn't.  For this case, the synchronizer is mandatory good engineering.  Often, the full flag is almost full (one or more less than really full), to make the FIFO more robust in your design.
 
So a signal being metastable happens.  Avoiding it just because it 'might be' is poor engineering.  Synchronizers get used where they are needed, and how often it goes metastable is important.  The synchronizer does not eliminate metastability, it only reduces the occurence rate.
 
Austin Lesea
Principal Engineer
Xilinx San Jose
举报

李贞

2019-1-24 10:54:48
嗨奥斯汀,
谢谢你的好解释。
我还有一个问题。
在必须检测起始位的下降沿/上升沿的异步通信中会发生什么?
有一些接口,如RS232,可以使用错误处理功能,如果出现错误,则重新发送数据。
RS232不是一个实时接口,所以几毫秒或更少,这不是什么大不了的事。
另一方面,存在一些异步接口(例如,实时,用于运动控制),其中必须高度重视传输中的一个错误并且必须关闭整个机器。
通信失败的后果可能非常严重。
人们(我的意思是专家,而不是像我这样的设计师:笑脸快乐:)处理这种情况 - 我的意思是他们如何处理/避免/最小化关键应用中的亚稳态。
您能否给我一些链接或指示,从中可以了解更多有关Xilinx FPGA中亚稳态的信息?
谢谢,
保罗

以上来自于谷歌翻译


以下为原文

Hi Austin,
 
Thanks for the nice explanation.
 
I still have one question. What happens in an asynchronous communication where the falling/rising edge of a start bit must be detected?
There are interfaces like RS232 where error handling functions can be used and in case of error, data is resent. RS232 is not a real time interface so several milliseconds less or more it's not a big deal.
 
On the other side there are some asynchronous interfaces (e.g. real-time, used in motion control) where one error in the transmission must be treated with high importance and the entire machine must be shut-down. The consequences of a communication failure could be pretty severe. 
 
How people (I mean experts and not designers like me :smileyhappy: ) handle this kind of situation - I mean how do they treat/avoid/minimize metastability in critical applications.
 
Can you please give me some links or directions from where I can learn more about metastability in Xilinx FPGAs?
 
Thanks,
Paul
举报

更多回帖

发帖
×
20
完善资料,
赚取积分