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

其他运行结果相同

随机推荐

  1. TP5数据库数据变动日志记录设计

    根据网友的设计进行了部分调整: 用户分为管理员admin表和用户user表 记录操作表数据 增删改: insert/delete/update <?php /** * OperateLog.ph ...

  2. 搞不定 NodeJS 内存泄漏?先从了解垃圾回收开始

    通常来说,内存管理有两种方式,一种是手动管理,一种是自动管理. 手动管理需要开发者自己管理内存,什么时候申请内存空间,什么时候释放都需要小心处理,否则容易形成内存泄漏和指针乱飞的局面.C 语言开发是典 ...

  3. 给你一个app,怎么测试

    安装卸载 安装卸载路径是否能自己选择,在不同操作系统下(Android.ios)安装是否正常,能正常运行,安装的文件及文件夹是否写入了指定的目录里,安装来自不同来源的(应用宝.360助手)下是否正常. ...

  4. windows 创建cmd alias

    windows cmd bat alias 命令 别名 1. 创建文件 C:\cmd-alias.bat @doskey sayhello=echo Hello $* @doskey cattxt=t ...

  5. 鸿蒙内核源码分析(双向链表篇) | 谁是内核最重要结构体? | 开篇致敬鸿蒙内核开发者 | v1.11

    子曰:"见贤思齐焉,见不贤而内自省也."<论语>:里仁篇 百篇博客系列篇.本篇为: v01.xx 鸿蒙内核源码分析(双向链表篇) | 谁是内核最重要结构体 | 51.c ...

  6. python接口自动化--json解析神器jsonpath

    前言 做接口测试的时候,大部分情况下返回的是json数据,我们需要对返回的json断言. 当返回的数据量比较大,并且嵌套的层级很深的时候,很多小伙伴不会取值,往往在返回结果取值上浪费很多时间.一直在寻 ...

  7. 【vue】生成接口模拟数据

    目录 方案一:自定义模拟数据 Step1 创建json文件 Step2 在 vue.config.js 中配置 Step3 在组件中使用 (方式一) Step3 封装api (方式二) Step4 在 ...

  8. CSP初赛考点汇总

    qwq 为SCP初赛选手(我)收集的各种定理qwq 更新: 1.为了初赛都能用,不限于定理了 2.主旨为在短时间内复习各算法,备初赛 3.请确定你学习(学懂了)了 \(\texttt{oi}\) 的基 ...

  9. mysql安装教程,mysql安装配置教程

    MySQL的安装教程 一.MYSQL的安装 首先登入官网下载mysql的安装包,官网地址:https://dev.mysql.com/downloads/mysql/ 一般下载这个就好,现在的最新版本 ...

  10. windwos10安装mysql8.0.20详细图文教程

    windwos10安装mysql8.0.20详细图文教程 1.浏览器搜索mysql下载安装 地址:https://dev.mysql.com/downloads/mysql/ 2.登录或者不登录下载 ...