将字符串或注释插入vcd转储文件

时间:2014-12-04 07:46:59

标签: verilog system-verilog

是否有任何通用的方法将注释(或可能是任何字符串)插入到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

3 个答案:

答案 0 :(得分:0)

IEEE Std 1800-2012未指定任何将注释插入VCD文件的功能。

你可以采取类似创建一个看起来像你的字符串的长名称的变量,但这只会出现在标题部分,而不是在任何指定的时间。例如,在您的Verilog代码中:

reg here_is_my_string;

这将在您的VCD文件中显示为:

$var reg       1 "    here_is_my_string  $end

答案 1 :(得分:0)

将注释字符串写入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,您就可以在dumpoff / on之间切换,并对vcd文件进行后处理以在它们之间插入$comment ... $end

答案 2 :(得分:0)

如果您使用的是Modelsim / Questa,则可以

 initial begin
        a = 0;
        #10;
        mti_fli::mti_Command("vcd comment MY_STRING");
        a = 1;
        #10;
        end

或者您已经在使用SystemVerilog

    import mti_fli::*;
    string comment;
     initial begin
                a = 0;
                #10;
                comment = "MY_STRING";
                mti_Command({"vcd comment ",comment});
                a = 1;
                #10;
                end