微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微电子和IC设计 > IC验证交流 > 关于$timeformat()

关于$timeformat()

时间:10-02 整理:3721RD 点击:
$timeformat(-9,3,"ns",8);#1 $display("%t",$realtime);//1.000ns
1.000ns宽度不是7吗?timeformat显示数值最小宽度是8,这样不是不符合要求吗?,sysytemverilog验证中的内容

参考语法解释。

The following example shows the use of %t with the $timeformat system task to specify a uniform time unit, time precision, and format for timing information.
The contents of file a1.dat are as follows:
a1_dat: 0.00000 ns in1= x o1=x
a1_dat: 10.00000 ns in1= 0 o1=x
a1_dat: 20.00000 ns in1= 1 o1=0
a1_dat: 30.00000 ns in1= 1 o1=1
The contents of file a2.dat are as follows:
a2_dat: 0.00000 ns in2=x o2=x
a2_dat: 10.00000 ns in2=0 o2=x
a2_dat: 20.00000 ns in2=1 o2=0
a2_dat: 30.00000 ns in2=1 o2=1
‘timescale 1 ms / 1 ns
module cntrl;
initial
$timeformat(-9, 5, " ns", 10);
endmodule
‘timescale 1 fs / 1 fs
module a1_dat;
reg in1;
integer file;
buf #10000000 (o1,in1);
initial begin
file = $fopen("a1.dat");
#00000000 $fmonitor(file,"%m: %t in1=%d o1=%h", $realtime,in1,o1);
#10000000 in1 = 0;
#10000000 in1 = 1;
end
endmodule
‘timescale 1 ps / 1 ps
module a2_dat;
reg in2;
integer file2;
buf #10000 (o2,in2);
initial begin
file2=$fopen("a2.dat");
#00000 $fmonitor(file2,"%m: %t in2=%d o2=%h", $realtime,in2,o2);
#10000 in2 = 0;
#10000 in2 = 1;
end
endmodule
In this example, the times of events written to the files by the $fmonitor system task in modules a1_dat and a2_dat are reported as multiples of 1 ns even though the time units for these modules are 1 fs and 1 ps respectively because the first argument of the $timeformat system task is -9 and the %t format specification is included in the arguments to $fmonitor.This time information is reported after themodule names with five fractional digits, followed by an ns character string in a space wide enough for 10ASCII characters.

大哥,我问这么简单的一个问题,你给我这么一大段东东,也没解决我的回答,求你给我讲得浅显点,就关于那个8,联系那个结果讲解一下吧

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top