基于事件触发器的 SV 断言
SV assertion based on event trigger
假设 SV 接口包含并发断言 属性。
是否可以仅在触发事件时启用此断言?我尝试在接口文件的任务中写入 属性,但最终出现错误:near "property": syntax error, unexpected 属性.
Interface intf;
task e1();
-> e1;
endtask
wait(e1.triggered); // something like this, where property waits for trigger
property prop1;
@(posedge clk) a ##1 b;
endproperty
endinterface
谢谢。
我认为您需要考虑最好同步写入属性,并在每个时钟周期对其进行评估。你 属性 说每个时钟周期后的一个周期 a
发生 b
发生。我猜你想要的是这样的:
if e1
occurs, then a should be true (on the next rising edge of
clk
?) and then b should be true on the rising edge of clk
after
that
因此,一种方法是创建一个 always 块,在 e1
发生时生成一个时钟宽度的脉冲,例如:
always begin
@(e1);
@(posedge clk) e = 1'b1;
@(posedge clk) e = 1'b0;
end
property prop1;
@(posedge clk) e |-> a ##1 b;
endproperty
或它的一些变体。不过,我觉得我应该担心种族问题。
假设 SV 接口包含并发断言 属性。 是否可以仅在触发事件时启用此断言?我尝试在接口文件的任务中写入 属性,但最终出现错误:near "property": syntax error, unexpected 属性.
Interface intf;
task e1();
-> e1;
endtask
wait(e1.triggered); // something like this, where property waits for trigger
property prop1;
@(posedge clk) a ##1 b;
endproperty
endinterface
谢谢。
我认为您需要考虑最好同步写入属性,并在每个时钟周期对其进行评估。你 属性 说每个时钟周期后的一个周期 a
发生 b
发生。我猜你想要的是这样的:
if
e1
occurs, then a should be true (on the next rising edge ofclk
?) and then b should be true on the rising edge ofclk
after that
因此,一种方法是创建一个 always 块,在 e1
发生时生成一个时钟宽度的脉冲,例如:
always begin
@(e1);
@(posedge clk) e = 1'b1;
@(posedge clk) e = 1'b0;
end
property prop1;
@(posedge clk) e |-> a ##1 b;
endproperty
或它的一些变体。不过,我觉得我应该担心种族问题。