在非时钟信号上使用“事件属性”是不好的做法吗?

Is the use of 'event attribute on non-clock signal bad practice?

有一个类似的问题 ,已用

回答

Yes, rising_edge()/falling_edge() should only be used for clock signal. While it works in simulation it can cause problems and unintended hardware in synthesis.

使用 'event 属性来检测非时钟信号的边沿是否与以下示例相同?

process (rndm_sig)
begin
    if (rndm_sig'event and rndm_sig = 1) then
    -- do something.
    end if;
end process;

任何用作 X'event and X= 1rising_edge.(X) 的信号都将被综合工具视为时钟。

在 FPGA 中,这意味着路由工具将尝试为信号分配一个专用时钟网络,以及它所需要的一切。例如信号必须路由到专用时钟输入,这可能会导致明显的延迟和对其他信号的偏斜。

另外信号最好是'clean'。这意味着如果信号上有最微小的尖峰,FF 就会计时。这也意味着,如果您的信号不是 'clean',则某些 FF 可能会触发,而有些则不会。

计时工具需要知道周期和 high/low 时间,并尝试使建立和保持时间与所有其他时钟相适应。这可能会在设计中导致严重问题 and/or 额外的逻辑。如果信号与其他时钟完全异步,您可以获得元稳定性,并且可能需要在时钟寄存器之后添加同步器。

因此归结为:强烈建议仅使用 'real' 时钟信号 X'event and X= 1rising_edge.(X) 结构。

同时在数字设计中有一个规则说:如果没有其他解决方案,所有规则都是无效的。

在我所在的 ASIC 行业,你必须在打破基本规则之前与一些高级设计师交谈。然后你必须在代码周围添加一些强调注释 "Yes this breaks the rule but there was no other way because we had this and this and this and it has been reviewed and signed of by X and Y " 是的,我曾经在设计中使用过锁存器。