SystemVerilog 中的 $sformatf 未在标准输出上打印超链接

发布于 2025-01-14 02:53:55 字数 580 浏览 1 评论 0原文

此 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无言温柔 2025-01-21 02:53:55

您的模拟器应在 stdout 上显示格式化字符串。由于没有,因此您使用的模拟器存在错误。

例如,在 EDA Playground 上使用 Synopsys,我在 stdout:

<message ctxt="Ram" kind="Singh" id="ID1" location="test.sv:3" verbosity="High" time="0">some string</message>

但是,使用 Cadence,我看到:

some string

这是 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:

<message ctxt="Ram" kind="Singh" id="ID1" location="test.sv:3" verbosity="High" time="0">some string</message>

However, with Cadence, I see:

some string

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文