首页 > 解决方案 > SystemVerilog 总是@序列

问题描述

我想创建一个始终使用事件控制序列的块,但我不确定 SystemVerilog 中是否允许这样做,并且在尝试执行此操作时出现内部编译器错误。这是我的代码示例:

sequence ReqValid_s;
  @(posedge clk)
  (ReqValid ##1 1) or (ReqSpec ##1 !ReqCancel);
endsequence

always @(ReqValid_s iff enable) begin
    //do stuff
end

当我尝试编译它时,我得到一个内部编译器错误,没有任何有用的注释。我相当有信心这是由于总是@(ReqValid_s),因为如果我将其更改为总是@(posedge clk),它就可以正常工作。我在 SV LRM 中没有找到任何明确的答案,但我认为这会起作用,因为我能够使用一个序列来进行覆盖组的采样事件。

标签: verilogsystem-verilogsystem-verilog-assertions

解决方案


这应该有效(您永远不会看到内部错误)。我会将iff enable逻辑移到序列中。这样所有信号都将具有相同的采样。

sequence ReqValid_s;
  @(posedge clk)
  (ReqValid ##1 enable) or (ReqSpec ##1 !ReqCancel && enable);
endsequence

always @(ReqValid_s) begin
    //do stuff
end

推荐阅读