【问题标题】:Assertion to verify a glitch in a signal断言以验证信号中的毛刺
【发布时间】:2015-04-08 01:29:45
【问题描述】:

假设有一个信号 a 。当信号变为高电平时,它必须至少在三个正时钟沿保持高电平。

我们可以把属性写成

property p;
@(posedge clk) $rose(a) -> a[*3];
endproperty

属性在以下情况下失败。

clk _ _ _ | = = = | _ _ _ | = = = | _ _ _ | = = = | _ _ _ | = = = |

一个_ _ | = = = | _ _ | ===================

这不符合规范,其中 a 在中间变低,但会被下一个 posedge 拉高,因此上述断言不会捕捉到这一点。

谁能告诉是否有任何方法可以编写断言来捕获这个错误?

谢谢

【问题讨论】:

    标签: system-verilog assertions system-verilog-assertions


    【解决方案1】:

    你在这里混淆了东西。通过在信号a 上编写时钟断言,您正在验证它是具有特定行为的同步信号。

    同步信号可以在时钟边沿之间产生任何它们想要的毛刺,因为它们永远不会在那里被采样。这正是我们现在使用同步信号的原因,即让信号在采样之前有机会稳定到它的值。

    如果您的信号 a 不应该由于某种原因出现故障(我不是设计师,所以我不知道这在哪里有用),据我所知,您会发现使用对 HDL 代码进行结构分析的某种 linting 工具(例如 Spyglass)。

    【讨论】:

      【解决方案2】:

      Tudor 是的,在大多数情况下,时钟边沿之间发生的事情并不重要。但在 CDC 或异步设计中,我们必须验证设计是否无故障。 有一种由内而外的方法来做到这一点。 (我在http://www.verificationguild.com/modules.php?name=Forums&file=viewtopic&p=20045 找到了这个解决方案)

      property detect_glitch;
          time leading;                  // declare the last edge occurence variable
          @(glitch)                      // At every change of glitch signal
              //The following line saves the current time and check
              // the delay from the previous edge.
              (1, leading = $time) |=> (($time - leading) >= duration);
      endproperty : detect_glitch
      
      DETECT_GLITCH : assert property (detect_glitch)
      else
          $display ("ERROR"); 
      

      【讨论】:

        猜你喜欢
        • 2019-01-25
        • 1970-01-01
        • 2022-08-08
        • 2013-12-09
        • 2020-03-09
        • 1970-01-01
        • 2011-08-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多