Insert line or comment into dc dcd file
Is there any general way to insert a comment (or possibly any line) into a vcd dump? For example, in the code below, I want to insert a comment when it a
changes to 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
source to share
There is no standard system task for writing a comment line to a vcd file, although it $comment
is the vcd keyword for creating comment sections:
From IEEE Std 1800-2012 LRM :
$comment This is a single-line comment $end
$comment This is a
multiple-line comment
$end
I would experiment with $ dumpoff, $ dumpflush and $ dumpon. $ dumpoff and $ dumpoon leave a time stamp in the vcd file i.e. #time $dumpoff ... $end
:
Example from 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
You can switch between dumpoff / on when a
changed to 1
, and post-process the vcd file to insert in $comment ... $end
between.
source to share
IEEE Std 1800-2012 does not specify any function for inserting a comment into a VCD file.
You can resort to something like creating a variable with a long name that looks like your string, but this will only show up in the header section, not at any specific time. For example, in Verilog code:
reg here_is_my_string;
This will show up in your VCD file something like:
$var reg 1 " here_is_my_string $end
source to share
If you are using Modelsim / Questa you can do
initial begin
a = 0;
#10;
mti_fli::mti_Command("vcd comment MY_STRING");
a = 1;
#10;
end
or since you are already using SystemVerilog
import mti_fli::*;
string comment;
initial begin
a = 0;
#10;
comment = "MY_STRING";
mti_Command({"vcd comment ",comment});
a = 1;
#10;
end
source to share