$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
其他运行结果相同
随机推荐
- SQL注入与burPsuit工具介绍
sql注入原理 原理:用户输入不可控,用户输入导致了sql语义发生了改变 用户输入不可控:网站不能控制普通用户的输入 sql语义发生变化: 动态网页介绍: 网站数据请求 脚本语言:解释类语言,如,后端 ...
- CodeForce-803B Distances to Zero(贪心DP)
Distances to Zero CodeForces - 803B 题意:给定一个数列 a0, a1, ..., an - 1.对于数列中的每一项都要求出与该项最近的0与该项的距离.保证数列中有至 ...
- 性能再提升70%?大咖前瞻带你揭开.NET6的神秘面纱!
本月初微软官宣.NET 6 的RC1即将在11月正式发布,这意味着.NET6正式版跟我们见面的时间又近了一步.在之前的.NET6预览版本中,微软加入了大量新功能特性,而在最终版本中将不再额外加入新的内 ...
- Java基础系列(9)- 数据类型扩展及常见面试题
整数拓展 // 整数拓展: 进制 二进制0b 十进制 八进制0 十六进制0x // 同一个数字在不同进制中,结果是不同的,进制换算 int i = 10; int i2 = 010; // 八进制 i ...
- Linux系列(9) - whoami和whatis
whoami 作用:当前你登录的用户是谁 whatis [命令] 作用:查询[命令]是干嘛的 我们试一下对文件和目录whatis行不行,结果发现不行:但是有没有发现对命令whatis也不行,为什么呢: ...
- Python爬虫之PySpider框架
概述 pyspider 是一个支持任务监控.项目管理.多种数据库,具有 WebUI 的爬虫框架,它采用 Python 语言编写,分布式架构.详细特性如下: 拥有 Web 脚本编辑界面,任务监控器,项目 ...
- P6295-有标号 DAG 计数【多项式求逆,多项式ln】
正题 题目链接:https://www.luogu.com.cn/problem/P6295 题目大意 求所有\(n\)个点的弱联通\(DAG\)数量. \(1\leq n\leq 10^5\) 解题 ...
- 看动画学算法之:doublyLinkedList
目录 简介 doublyLinkedList的构建 doublyLinkedList的操作 头部插入 尾部插入 插入给定的位置 删除指定位置的节点 简介 今天我们来学习一下复杂一点的LinkedLis ...
- win32 TreeCtrl控件通知消息, LVN_SELCHANGED和LVN_ITEMCHANGED用法
今天出了个奇怪的问题,当我在主窗口上创建一个用模板对话框的子窗口时, 在子窗口上放的TreeCtrl控件不响应LVN_SELCHANGED消息,也是晕死了, 我以为是消息捕获的问题,我在主窗口上也捕获 ...
- 硝烟中的Scrum和XP
硝烟中的Scrum和XP 初次接触Scrum和XP(更加准确的说是"看到"),心里不免有些疑问,软件开发为什么会有如此多的方式,难道软件开发.软件工程不就是写写代码的事儿吗?直到后 ...