在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2234|回复: 4

[求助] 关于$timeformat()

[复制链接]
发表于 2015-4-29 20:43:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
$timeformat(-9,3,"ns",8);#1 $display("%t",$realtime);//1.000ns
1.000ns宽度不是7吗?timeformat显示数值最小宽度是8,这样不是不符合要求吗?,sysytemverilog验证中的内容
发表于 2015-4-30 09:57:22 | 显示全部楼层
参考语法解释。。。
发表于 2015-5-5 11:21:06 | 显示全部楼层
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.
 楼主| 发表于 2015-5-7 21:55:39 | 显示全部楼层
回复 3# 出尘入世
大哥,我问这么简单的一个问题,你给我这么一大段东东,也没解决我的回答,求你给我讲得浅显点,就关于那个8,联系那个结果讲解一下吧
发表于 2020-5-20 15:54:50 | 显示全部楼层
大哥很忙,没有义务解答你的问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-26 21:56 , Processed in 0.025172 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表