e HVL (IEEE 1647):期望表达式意外失败

e HVL (IEEE 1647): expect expression fails unexpectedly

我正在尝试验证两个模块之间非常简单的握手。一个模块处于慢速时钟并升高 "req",较快的模块应在下一个快速时钟上升高 "ack" 并保持它直到下一个慢速时钟出现。最终结果如下所示:

我是这样写期望的:

expect expect_ack_when_req_go is
      (@req_rise_e) => @ack_rise_e
      else dut_error("ERROR: ack expected to be asserted when req rises!");

*@req_rise_e 和@ack_rise_e 都是在慢速时钟上采样的。

运行 模拟器产生错误,因为第一个表达式似乎成功但第二个表达式没有。尽管事实上在跟踪事件到 wave 时,我可以看到两个事件同时发生(如 wave 中所示:event_req、event_ack)。

您正在尝试进行重叠蕴涵,即您的两个事件都发生在同一个周期中。 => 运算符所做的是检查结果是否发生在下一个采样事件上,在本例中是下一个慢时钟边沿。这在 SystemVerilog 断言用语中称为非重叠蕴涵。

您可以通过编写以下内容来获得您想要的行为:

expect expect_ack_when_req_go is
  (@req_rise_e) => detach({@ack_rise_e; ~[1]})
  else dut_error("ERROR: ack expected to be asserted when req rises!");

完整解释 here.

在方法论上,我建议不要以不同的方式编写时间表达式。我假设您正在验证驱动 ack 的模块,并且该模块在两个时钟上都可以工作。我还假设此模块使用快速时钟采样 req。将支票表述为:

会更清楚
expect expect_ack_when_req_go is
  (@req_rise_at_fast_clock_e) => @ack_rise_at_slow_clock_e
  else dut_error("ERROR: ack expected to be asserted when req rises!");

这样您就不必乱用 detach(...) 并且 expect 更接近于您所需行为的自然语言描述。