Format specifications:
Argument Description
%h or %H
%x or %X Display in hexadecimal format
%d or %D Display in decimal format
%o or %O Display in octal format
%b or %B Display in binary format
%c or %C Display in ASCII character format
%l or %L Display library binding information
%v or %V Display net signal strength
%m or %M Display hierarchical name
%p or %P Display as an assignment pattern
%s or %S Display as a string
%t or %T Display in current time format
%u or %U Unformatted 2 value data
%z or %Z Unformatted 4 value data
So the example about display enum
module top;
typedef enum {ON, OFF} switch_e;
switch_e s;
initial begin
s=ON;
$display(“the enum of switch_e is %p.”,s);
endmodule : top
resule: the enum of switch_e is ON.
本文介绍了Verilog语言中用于格式化输出的各种格式说明符,包括十六进制、十进制、八进制和二进制等数值格式,以及字符串、ASCII字符等非数值格式,并通过一个枚举类型的示例展示了如何使用这些格式化选项。
2278

被折叠的 条评论
为什么被折叠?



