SystemVerilog 中的 $sformatf 未在标准输出上打印超链接
此 SystemVerilog 代码的输出应在 stdout
上打印未出现的超链接,但它正在捕获文件中的这些超链接。
module top;
string res="some string";
string id="ID1";
string name1="Ram";
string name2="Singh";
string filename="test.sv";
int line=3;
string verbocity="High";
int fd1;
initial begin
res=$sformatf("<message ctxt=\"%s\" kind=\"%s\" id=\"%s\" location=\"%s:%0d\" verbosity=\"%s\" time=\"%0t\">%s</message>\n",name1,name2,id,filename,line,verbocity,$realtime,res);
$display(res);
fd1 = $fopen("data_txt", "w");
$fwrite(fd1, "%s\n", res);
$fclose(fd1);
end
endmodule
The output of this SystemVerilog code should print hyperlinks on stdout
that are not appearing, but it is capturing those hyperlinks in the file.
module top;
string res="some string";
string id="ID1";
string name1="Ram";
string name2="Singh";
string filename="test.sv";
int line=3;
string verbocity="High";
int fd1;
initial begin
res=$sformatf("<message ctxt=\"%s\" kind=\"%s\" id=\"%s\" location=\"%s:%0d\" verbosity=\"%s\" time=\"%0t\">%s</message>\n",name1,name2,id,filename,line,verbocity,$realtime,res);
$display(res);
fd1 = $fopen("data_txt", "w");
$fwrite(fd1, "%s\n", res);
$fclose(fd1);
end
endmodule
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的模拟器应在
stdout
上显示格式化字符串。由于没有,因此您使用的模拟器存在错误。例如,在 EDA Playground 上使用 Synopsys,我在
stdout:
但是,使用 Cadence,我看到:
这是
res
的原始值,没有格式化。这是 Cadence 模拟器中的一个错误。其他三个模拟器显示格式(Synopsys、Mentor、Aldec)。Your simulator should show the formatted string on
stdout
. Since it does not, there is a bug in the simulator you are using.For example, with Synopsys on EDA playground, I see the following on
stdout
:However, with Cadence, I see:
This is the original value of
res
, without the formatting. This is a bug in the Cadence simulator. Three other simulators show the formatting (Synopsys, Mentor, Aldec).