Systemverilog QuestAsim-将字符串传递给$ fdumpvars以保存多个VCD文件
我正在尝试在QuestAsim 2021.3(最新)中的相同初始开始
中生成多个VCD文件。
但是,我只能通过“/hardcoded/path/to/vcdfile.vcd”作为 fileName ,对于单个VCD文件是正确的。
这是我的代码:
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
无VCD文件被导出,QuestAsim会引发错误:
#**错误(抑制):( vsim-pli-3111)$ fdumpvars:最后一个参数必须是文件名。
我有a Playground 在Edaplayground上使用此代码。
需要明确的是,我尝试了:
$typename(dump1); // returns string
$typename("path/to/vcdfile.vcd"); // returns string
因此,对于Questa,它们都是字符串,但是第一个不能传递给$ fdumpvars()
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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题。这似乎是QuestAsim进行一些不必要的静态代码检查的情况。
幸运的是,该错误是“可抑制的”,可以使用VSIM命令行选项
-suppress 3111
禁用。使用此选项,我能够从QuestAsim编写多个动态命名的VCD文件。I encountered the same problem. This seems to be a case where QuestaSim does some unnecessary static code checking.
Luckily, the error is "suppressible" and can be disabled using the vsim command line option
-suppress 3111
. With this option, I was able to write multiple dynamically-named VCD files from QuestaSim.$ fdumpvars
不是标准Verilog系统任务。它未在IEEE STD 1800-2017中定义,这意味着它的行为是特定于实施供应商的特定于Questasim的。如果您希望任务接受
String
变量类型作为参数,则应直接从供应商请求该功能。也许其他人已经报告了这一点,并且有一个较新的QuestAsim版本已经具有此功能。同样,请联系供应商。
为了进行比较,倾倒VCD文件的标准Verilog任务,
$ dumpfile
,确实接受string
变量类型:$fdumpvars
is not a standard Verilog system task. It is not defined in IEEE Std 1800-2017, which means that it's behavior is specific to the vendor that implemented it, namely QuestaSim.If you want the task to accept a
string
variable type as an argument, you should request that functionality directly from the vendor.Perhaps someone else has already reported this, and there is a newer version of QuestaSim that already has this feature. Again, contact the vendor.
For comparison, the standard Verilog task for dumping a VCD file,
$dumpfile
, does accept astring
variable type: