$显示在Verilog中,printf在C中显示

Tuy*_*huc 6 c verilog

正如您所知道的那样Verilog,$display,$strobe并且监视那些用于在屏幕上显示文本的内容.并且在C中也printf必须在屏幕上显示文本.

我的问题是如何使用它们(之一$display,$strobe,$monitor等)printfC

a: $display
b:$strobe
c:$monitor
d: all of them
e: other
Run Code Online (Sandbox Code Playgroud)

Lui*_*oza 19

$display("<format>", exp1, exp2, ...);  // formatted write to display
format indication %b %B binary
                  %c %C character (low 8 bits)
                  %d %D decimal  %0d for minimum width field
                  %e %E E format floating point %15.7E
                  %f %F F format floating point %9.7F
                  %g %G G general format floating point
                  %h %H hexadecimal
                  %l %L library binding information
                  %m %M hierarchical name, no expression
                  %o %O octal
                  %s %S string, 8 bits per character, 2´h00 does not print
                  %t %T simulation time, expression is  $time
                  %u %U unformatted two value data  0 and 1 
                  %v %V net signal strength
                %z %Z unformatted four value data  0, 1, x, z

escape sequences, quoted characters in strings \n   newline
                                               \t   tab
                                               \\   backslash
                                               \"   quote
                                               \ddd octal
                                               %%   percent

any other characters between the quotes are displayed
the expressions are taken in order of the format indication
,, in the expression list inserts one space in the output
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,`%d` 看起来很丑,因为它不需要填充就插入了,`%0d` 正是我所需要的。 (3认同)