plusagrs
systemverilog 中$test$plusargs("cfg_rand"); 和$test$plusargs("cfg");会冲突
initial begin
if($test$plusargs("cfg")) cfg = 1;
if($test$plusargs("cfg_rand")) cfg_rand = 1;
$display("cfg = %0d, cfg_rand =%0d",cfg, cfg_rand);
end
endmodule
cmd: simv +cfg
cfg=1, cfg_rand=0
simv +cfg_rand
cfg=1, cfg_rand=1
simv +cfg_rand_abcxxx*
cfg=1, cfg_rand=1
VCS version:H-2013.06
所以plus_command 只要包含plusargs就是有效的。
DPI
如果调用dpi,可以先将cpp编译成.so,然后再vcs compile simulation, 好处就是cpp改动,不需要重新编译sv,直接simulation就行
1. g++ -fPIC -I${VCS_HOME}/include dpi.cpp -shared -o dpi.o
2. g++ -shared dpi.o -dpi.so
vcs -sverilog -timescale=1ns/1ns +acc +vpi -Wall -m64 -CFLAGS -DVCS dpi.so
本文探讨了SystemVerilog中$test$plusargs函数的使用方法及其在命令行参数处理中的作用。通过实例展示了如何定义和读取不同的plusarg,并讨论了plusarg之间的优先级与冲突处理。同时介绍了如何利用DPI(C)机制实现C++与SystemVerilog的交互,提高开发效率。
89

被折叠的 条评论
为什么被折叠?



