use*_*216 3 verilog system-verilog
我需要获取命令行选项以向 SystemVerilog 中的约束添加条件。
我$value$pluargs("string=%d",val)从函数调用中调用,我需要使用传递给函数的参数作为“字符串”名称。
function(string name);
$value$plusargs("<name>=%d", val)
endfunction
Run Code Online (Sandbox Code Playgroud)
我不知道该怎么做。说会$value$plusargs("%s=%d",name,val)导致“参数过多”错误。
您可以使用字符串连接:
module tb;
int val = 5;
initial begin
$monitor("val=", val);
foo("bar");
end
function void foo (string name);
$value$plusargs({name, "=%d"}, val);
endfunction
endmodule
Run Code Online (Sandbox Code Playgroud)