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. PTA 面向对象程序设计 6-3 面积计算器(函数重载)

    6-3 面积计算器(函数重载) 实现一个面积计算器,它能够计算矩形或长方体的面积. 函数接口定义: int area(int x, int y); int area(int x, int y, int ...

  2. PHP中使用PDO操作事务的一些小测试

    关于事务的问题,我们就不多解释了,以后在学习 MySQL 的相关内容时再深入的了解.今天我们主要是对 PDO 中操作事务的一些小测试,或许能发现一些比较好玩的内容. 在 MyISAM 上使用事务会怎么 ...

  3. webrtc源码阅读理解一

    webrtc是一个比较成熟的实时音视频处理开源项目,一上来老大就扔给我一本webrtc native实践,虽然狠下心"翻"完了一遍,但是还是云里雾里的,在经过几个月的摸索之后,我大 ...

  4. 手把手教你 Docker搭建nacos单机版

    Docker搭建nacos单机版步骤 一.使用 docker pull nacos/nacos-server 拉取nacos镜像 我这里没有指定版本所以是拉取latest,你也可以使用 docker ...

  5. ubuntu系统安装docker

    系统版本:Ubuntu 18.04 # 更新apt update # 安装依赖apt install apt-transport-https ca-certificates curl software ...

  6. python之jsonpath

    json 官方文档:http://docs.python.org/library/json.html JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,它使 ...

  7. python继承细节

    不要子类化内置类型 内置类型(由C语言编写)不会调用用户定义的类覆盖的特殊方法. 例如,子类化dict作为测验: class DoppeDict(dict): def __setitem__(self ...

  8. mybatis多条件多值批量更新

    mysql并没有提供直接的方法来实现批量更新,但是可以用点小技巧来实现. 这里使用了case when 这个小技巧来实现批量更新. 举个例子: UPDATE 表名 SET    display_ord ...

  9. 密码学系列之:1Password的加密基础PBKDF2

    目录 简介 PBKDF2和PBKDF1 PBKDF2的工作流程 详解PBKDF2的key生成流程 HMAC密码碰撞 PBKDF2的缺点 总结 简介 1password是一个非常优秀的密码管理软件,有了 ...

  10. Git提交时默认编辑器Vim换成Notepad++

    在使用GIT进行commit时,会默认使用Vim,其使用较为笨重,改为Notepad++编辑器较为简便. git commit 默认打开Notepad++编辑器配置: 打开git --- bash,输 ...