簡體   English   中英

SystemVerilog字符串化(`“)運算符和換行符

[英]SystemVerilog stringify (`") operator and line breaks

如下所示,我在宏中使用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

為什么有` S IN的輸出,但只從println
這是規范中記錄的行為,還是模擬器中的錯誤(Aldec Active-HDL)?

這是您工具中的錯誤。 但是,不需要第二個`" ,它會為您提供所需的結果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM