assertion 问题
时间:10-02
整理:3721RD
点击:
本人才开始学习assertion,今天编写一个assertion的时候,老是编译通不过,具体代码如下:
`timescale 1ns / 1ns
module ldo_1p8_assertion(
inputldo_pd,
inputrstb_3v,
inputrealldo_out
);
parameter delay_ldo_pd_check = 5;
reg sample_clk;
always#100sample_clk= ~ sample_clk;
initial begin
sample_clk = 1'b0;
end
property ldo_pd_assert;
@(posedge sample_clk )
(rstb_3v) |->
if (ldo_pd)
( ##delay_ldo_pd_check (ldo_out < 0.005))
else
( ##delay_ldo_pd_check ((ldo_out > 1.795) && (ldo_out < 1.805)));
endproperty
ldo_pd: assert property (ldo_pd_assert)
else
$display("Assertion ERROR: the ldo_pd_assert has been failed at the time @%t",$time);
cover_ldo_pd_assert: cover property (ldo_pd_assert);
endmodule
用irun 来进行编译的时候,老是报错:
file: ldo_1p8_assertion.sv
if (ldo_pd)
|
ncvlog: *E,BOOLOP (ldo_1p8_assertion.sv,23|13): Expected a verilog expression as operand to property if/else operator.
module worklib.ldo_1p8_assertion:sv
errors: 1, warnings: 0
这是怎么回事啊?更改了代码好多遍,试验了好多次,都要报错。
急求高人指点啊。
你的if别写在里面啊, 他们认不出来啊, 试试:
if (ldo_pd)
(rstb_3v)|->( ##delay_ldo_pd_check (ldo_out < 0.005))
else
(rstb_3v)|->( ##delay_ldo_pd_check ((ldo_out > 1.795) && (ldo_out < 1.805)));
##delay_ldo_pd_check 放到if/else 前面去
如果把延迟放到前面去,功能就有点变化了。
还是不行。
用括号把if else里面的括起来,就可以了,谢谢啦!太感谢了!