I am trying to generate multiple VCD file inside the same initial begin
in QuestaSim 2021.3 (latest).
I found this section in the QuestaSim user manual:
But, I am only able to pass a "/hardcoded/path/to/vcdfile.vcd" as filename, and this is true for a single VCD file.
Here's my code:
module adder(
input logic clk,
input logic rstn,
input logic [31:0] a, b,
output logic [31:0] sum
) ;
always_ff @ (posedge clk or negedge rstn)
if (!rstn) sum <=0;
else sum <= a + b;
endmodule: adder
module tb;
logic clk;
logic rstn;
logic [31:0] a, b;
logic [31:0] sum;
adder i_adder (
.clk (clk),
.rstn (rstn),
.a (a),
.b (b),
.sum (sum)
);
always begin
#1us clk = ~clk;
end
initial begin
string dump1 = "dump1.vcd";
string dump2 = "dump2.vcd";
$fdumpfile(dump1);
$fdumpvars(1, i_adder.a, dump1);
clk = 0;
rstn = 0;
a = 4;
b = 2;
#10us
rstn = 1;
#10us
$display("Sum: %d",i_adder.sum);
$fdumpoff(dump1);
$fdumpall(dump1);
$exit;
end
No VCD file is exported, and QuestaSim throws an error:
# ** Error (suppressible): (vsim-PLI-3111) $fdumpvars : Last argument must be a filename.
I have a playground with this code on EdaPlayground.
To be clear, I tried:
$typename(dump1); // returns string
$typename("path/to/vcdfile.vcd"); // returns string
So for Questa they are both strings, but the first can not be passed to $fdumpvars()