例子2-1给出了这些转义符的基本使用: // Filename: exe_2_1.v // This module is writen by YiTurn Zhao // Module Purpose : $display 和 $write的基本用法 module exe_2_1(); // reg [7:0] a; initial begin a = 31; abcd = 50; $display(" Using $display, a = ",a, " And 12 = ",12); $displayb(" Using $displayb, a = ",a, " And 12 = ",12); $displayo(" Using $displayo, a = ",a, " And 12 = ",12); $displayh(" Using $displayh, a = ",a, " And 12 = ",12); $writeo(" \\nUsing Formatted $writeh, a = %d And 12 = %H",a,12); $writeh(" Using Formatted $writeh, a = %d",a, " And 12 = %H",12,"\\n"); $display("Print \\"%%\\",\\t\\"%%%%\\" should be used."); $display("Use %%C or %%c: a's value %d %C",a,a); $display("Use %%S or %%s: a's value %d %s",a,a); $display("Use %%E or %%e: 10000.8 can be writen as %e ",10000.8); $display("Use %%F or %%f: 1.023E+8 can be writen as %f ",1.023E+8); $display("Use %%G or %%g: 1.023E+8 can be writen as %g ",1.023E+8); $display("Use \\\\xyz : Character \\101's ASCII value is 3'O101"); $display("Use \\\\xyz : Character \\053's ASCII value is 3'O53"); #200 $finish; end
文章评论(0条评论)
登录后参与讨论