问题在于您的代码,而不是 Cadence 模拟器。
一个问题是wait
Verilog 关键字,它不应该用作task
名称。请参阅 IEEE Std 1800-2017,第 9.4 节程序时序控制;它也是 1364 标准的一部分。Questa 应该给你一个错误。
您需要将名称更改为其他名称,例如wait_clk
. 您还需要在endtask
关键字之后更改它。
另一个问题是,Cadence 也会给我使用ref
.
task wait_clk (ref logic clock, int cycl_num);
|
xmvlog: *E,REFANA : reference argument is illegal inside static task-function declaration.
task wait_clk (ref logic clock, int cycl_num);
|
xmvlog: *E,REFANA : reference argument is illegal inside static task-function declaration.
我认为您不需要这些输入作为参考。如果是这种情况,那么您可以简单地删除它:
package test_pkg;
task wait_clk (logic clock, int cycl_num);
for (int k = 0; k < cycl_num; k++) begin
@(posedge clock);
end
endtask : wait_clk
endpackage
但是,如果您确实想要一个ref
,您可以使用以下方法获取更多详细信息nchelp
:
nchelp xmvlog REFANA
xmhelp: 20.09-s009: (c) Copyright 1995-2021 Cadence Design Systems, Inc.
xmvlog/REFANA =
A SystemVerilog reference argument, declared in the formal argument list
of a task or function, must always be an automatic variable. The enclosing
task or function declaration must therefore use the 'automatic' keyword
to promote all of its formal arguments into automatic variables.
如果您只想clock
成为ref
:
package test_pkg;
task automatic wait_clk (ref logic clock, input int cycl_num);
for (int k = 0; k < cycl_num; k++) begin
@(posedge clock);
end
endtask : wait_clk
endpackage
你不应该void
使用task
. 这样做并没有真正解决任何问题。它只是让编译器走上了不同的道路。