是否有任何通用方法可以将注释(或任何字符串)插入 vcd 转储中?例如,在下面的代码中,我想在a
更改为1
时插入一些注释:
module test;
reg a;
initial begin
$dumpfile("dump.vcd");
$dumpvars(1,test.a);
end
initial begin
a = 0;
#10;
// insert_vcd_string("MY_STRING", dump.vcd);
a = 1;
#10;
end
endmodule
标准的系统任务将注释字符串写入 vcd 文件,尽管 $comment
是用于创建注释部分的 vcd 关键字:
来自IEEE Std 1800-2012 LRM:
$comment This is a single-line comment $end
$comment This is a
multiple-line comment
$end
我会尝试$dumpoff、$dumpflush和$dumpon$dumpoff,$dumpoon vcd 文件中留下带有时间戳的标记,即 #time $dumpoff ... $end
:
IEEE Std 1800-2012 LRM示例:
#1000
$dumpoff
x*@
x*#
x*$
bx (k
bx {2
$end
#2000
$dumpon
z*@
1*#
0*$
b0 (k
bx {2
$end
您可以在a
更改为1
时在转储/打开之间切换,并对 vcd 文件进行后处理以在它们之间插入$comment ... $end
。
如果你使用的是Modelsim/Questa,你可以这样做
initial begin
a = 0;
#10;
mti_fli::mti_Command("vcd comment MY_STRING");
a = 1;
#10;
end
或者因为您已经在使用系统Verilog
import mti_fli::*;
string comment;
initial begin
a = 0;
#10;
comment = "MY_STRING";
mti_Command({"vcd comment ",comment});
a = 1;
#10;
end
IEEE Std 1800-2012 没有指定任何用于将注释插入 VCD 文件的功能。
你可以求助于创建一个长名称的变量,看起来像你的字符串,但这只会出现在标题部分,而不是在任何指定的时间。 例如,在您的 Verilog 代码中:
reg here_is_my_string;
这将在您的VCD文件中显示为以下内容:
$var reg 1 " here_is_my_string $end