$Verilog显示,C打印
正如您所知,在$Verilog显示,C打印,c,verilog,C,Verilog,正如您所知,在Verilog中,有$display、
Verilog
中,有$display、
和$monitor用于在屏幕上显示文本。
在C中,还有printf
在屏幕上显示文本
我的问题是如何使用它们中的一个($display,$strobe,$monitor
),比如C
中的printf
a: $display
b:$strobe
c:$monitor
d: all of them
e: other
$display(“,exp1,exp2,…);//格式化写入显示
格式指示%b%b二进制文件
%c%c字符(低8位)
%d%d个小数点%0d用于最小宽度字段
%e%e格式浮点%15.7E
%f%f格式浮点%9.7F
%g%g通用格式浮点
%h%h十六进制
%l%l个库绑定信息
%m%m分层名称,无表达式
%o%o八进制
%s%s字符串,每个字符8位,2'h00不打印
%t%t模拟时间,表达式为$time
%u%u未格式化的两值数据0和1
%v%v净信号强度
%z%z未格式化的四值数据0、1、x、z
转义序列,字符串中带引号的字符\n换行符
\t形标签
\\反斜杠
\“引用
\八进制
%%百分比
将显示引号之间的任何其他字符
表达式按格式指示的顺序进行
表达式列表中的、、在输出中插入一个空格
$display(“将您的文本放在这里,或者您可以这样做%s,%d”字符串,值);谢谢,%d
看起来很难看,因为它插入了未指定的填充,%0d
正是我需要的。
$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