$time $stime $realtime
1,$time
The $time system function returns an integer that is a 64-bit time, scaled to the timescale unit of the module that invoked it.
1 `timescale 10 ns / 1 ns
2 module test;
3 reg set;
4 parameter p = 1.55;
5 initial begin
6 $monitor($time,,"set=",set);
7 #p set = 0;
8 #p set = 1;
9 end
10 endmodule
结果:
0 set=x
2 set=0
3 set=1
V C S S i m u l a t i o n R e p o r t
Time: 32 ns

分析:
a) The simulation times 16 ns and 32 ns are scaled to 1.6 and 3.2 because the time unit for the module is 10 ns; therefore, time values reported by this module are multiples of 10 ns.
b) The value 1.6 is rounded to 2, and 3.2 is rounded to 3 because the $time system function returns an integer. The time precision does not cause rounding of these values
因为精度是1ns,1.55*10=15.5ns,四舍五入,取16ns
假如将精度设置为
`timescale 10 ns / 1ps 那么,结果将是15.5和31

2,$stime
The $stime system function returns an unsigned integer that is a 32-bit time, scaled to the timescale unit of the module that invoked it. If the actual simulation time does not fit in 32 bits, the low order 32 bits of the current simulation time are returned.
对于$time的example,$stime和$time是一样的。
3,$realtime
The $realtime system function returns a real number time that, like $time, is scaled to the time unit of the module that invoked it.
将上述example改为$realtime之后,结果如下所示:
0 set=x
1.6 set=0
3.2 set=1
V C S S i m u l a t i o n R e p o r t
Time: 32 ns
其他运行结果相同
随机推荐
- Linux 文本相关命令(1)
Linux 文本相关命令(1) 前言 最近线上环境(Windows Server)出现了一些问题,需要分析一下日志.感觉 Windows 下缺少了一些 Linux 系统中的小工具,像在这波操作中用到的 ...
- 自制计算器 v1.1
之前的v1.0版本功能还不够完善,这个版本一并做了修改. 代码,每个sub表示哪个按钮做了注释. Dim a, temp, ans As Integer Dim op As String Sub sh ...
- eclipse中的一些快捷键
1.内容提示 Alt+/ 2.快速修复 ctrl+/ 3.导包 ctrl+shift+o 4.格式代码块 ctrl+shift+o 5.向前向后 Alt+方向键 6.添加注释 ctrl+shift+/ ...
- 浏览器缓存旧的js文件或css文件导致没出现预期效果
最好在加载的js或css文件后加上 ?v=1.0.0 版本号,更新js后就更改一下版本号即可
- ecshop刷新页面出现power by ecshop和链接的解决办法
当小伙伴在使用echop模板进行修改的时候,如果你删掉底部自带版权后,再调试程序刷新界面的时候,时不时就会冒出一个power by ecshop,而且是带有链接的,很不舒服,所以需要去掉,下面是最简单 ...
- jQuery has been removed
jQuery has been removed, 新的项目不要用jQuery了 这些问题都已经有了解决方案 * $()选择器, * $.ajax, * $dom.on("click" ...
- cgroup配置
待续... https://docs.hortonworks.com/HDPDocuments/HDP3/HDP-3.1.0/data-operating-system/content/enablin ...
- P3306-[SDOI2013]随机数生成器【BSGS】
正题 题目链接:https://www.luogu.com.cn/problem/P3306 题目大意 给出一个\(p,a,b,x_1,t\),有\(x_i=ax_{i-1}+b\) 求一个最小的\( ...
- P7443-加边【博弈论】
正题 题目链接:https://www.luogu.com.cn/problem/P7443?contestId=41429 题目大意 \(n\)个点的一棵有根树,两个人从一号点开始进行有向图博弈. ...
- 解决Pycharm无法显示matplotlib绘图问题
最近开始接触matplotlib, 1.首先安装matplotlib库和其依赖的一些其他库,例如:numpy,scipy和pandas等 2.开始进行简单的编码工作,并在PyCharm中运行,出现如下 ...