我在宏中使用SystemVerilog字符串运算符`",如下所示。这个案件是故意捏造的,以显示这一缺陷:
module my_test();
`define print(x) $fwrite(log_file, `"x`")
`define println(x) $fwrite(log_file, `"x\n`")
integer log_file;
initial begin
log_file = $fopen("result.txt", "w");
`print(A);
`print(B);
`println(C);
`println(D);
`print(E);
`print(F);
end
endmodule这将给出输出(没有尾随换行符):
ABC
`D
`EF为什么输出中有`,但只来自println
这是规范中记录的行为,还是我的模拟器(Aldec Active-HDL)中的一个bug?
发布于 2017-09-27 21:26:11
这是你工具中的一个bug。但是,第二个`"是不需要的,它给出了您正在寻找的结果。
https://stackoverflow.com/questions/46456716
复制相似问题