$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
其他运行结果相同
随机推荐
- 简单操作:10分钟实现在kubernetes(k8s)里面部署服务器集群并访问项目(docker三)
前言 经过docker安装.k8s开启并登录,我们终于到 "部署k8s服务器集群并访问项目" 这一步了,实现的过程中有太多坑,好在都填平了,普天同庆. 在进行当前课题之前,我们需要 ...
- Python中“if __name__=='__main__':”
在Python当中,如果代码写得规范一些,通常会写上一句"if name=='main:"作为程序的入口,但似乎没有这么一句代码,程序也能正常运行.这句代码多余吗?原理又在哪里? ...
- libcurl 概述(翻译)
l名称 libcurl 客户端 URL 传输 描述 这是一个如何使用libcurl进行C语言编程的简短概述.这里提到的每个功能都有特定的手册页.还有 libcurl-easy 手册页,libcurl- ...
- hadoop生态之面试题篇
一.hdfs的高可用 1.先说下自己的理解, 正常的hdfs有namenode,datanode,secondnamenode,但是second name node 不是真正意义上的namenode备 ...
- python二级 第七套
第一部分 基本操作 第一题 1.format() 故名思意 就是格式化什么东西.所以你就是将你 需要格式化的东西 放在里面就行了 . format(s) 对s 有要求 就是 int(s) ...
- HTML 网页开发、CSS 基础语法——十.CSS语法
CSS代码书写位置 • CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明 1.内联式 ① 内联式简介 •内联式,也被习惯叫做行内式. •书写位置:在 HTML 标签之上的 style 属性 ...
- 鸿蒙内核源码分析(自旋锁篇) | 当立贞节牌坊的好同志 | 百篇博客分析OpenHarmony源码 | v26.02
百篇博客系列篇.本篇为: v26.xx 鸿蒙内核源码分析(自旋锁篇) | 当立贞节牌坊的好同志 | 51.c.h .o 进程通讯相关篇为: v26.xx 鸿蒙内核源码分析(自旋锁篇) | 当立贞节牌坊 ...
- Google Chrome打开权限设置开关(摄像头,录音等)
在搜索框输入以下字符 chrome://flags/#unsafely-treat-insecure-origin-as-secure
- Python标准库模块之heapq – 堆构造
Python标准库模块之heapq – 堆构造 读前福利:几百本经典书籍https://www.johngo689.com/2158/ 原文链接:https://www.johngo689.com/2 ...
- 使用CEF(一)— 起步
使用CEF(一)- 起步 介绍 Chromium Embedded Framework (CEF)是个基于Google Chromium项目的开源Web browser控件,支持Windows, Li ...