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. 基于Typora的Latex代码书写并移植到word中

    如何使用Markdown编译器 编辑Latex公式 并嵌入word内 ​ 前言:对于科研党来讲,在论文中数学公式的展示是必不可少的一环,但是如果不使用公式的格式去敲,那么公式就会过于难看,会大大降低你 ...

  2. ECSHOP产品内容页新增上传功能

    第一步:在 admin\templates\goods_info.htm中 <span class="tab-back" id="article-tab" ...

  3. Docker系列(6)- 常用命令(2) | 镜像命令

    准备工作 知道查看官方文档,官方文档描述的很详细,并且每一种类型.每一个命令的选项都有例子 会使用docker --help查看 镜像命令 docker images 查看所有本地主机上的镜像 [ro ...

  4. Expression Tree 遍历集合

    场景 从接口返回的数据是集合,却是 object 类型的.这个时候需要遍历这个集合.现提供两种方法. 方法一: 因为集合是可枚举的,所以可以尝试转为 IEnumerable 类型,然后遍历即可. st ...

  5. ssh 登录远程服务器--config配置

    一.config 配置案列 Host master HostName: 39.105.61.1 Port 22 User root IdentityFile <id_rsa> 二.配置讲解 ...

  6. PYTHON django 关于时间转换

    在安装django.默认会pytz时区库,import pytzpytz.timezone("UTC")now.astimezone("要转换的aware类型" ...

  7. SVN基本配置--创建版本库(图文并茂)

    SVN基本配置简 上一篇介绍了VisualSVN Server和TortoiseSVN的下载,安装,汉化.这篇介绍一下如何使用VisualSVN Server建立版本库,以及TortoiseSVN的使 ...

  8. .Net Core 实现 自定义Http的Range输出实现断点续传或者分段下载

    一.Http的Range请求头,结合相应头Accept-Ranges.Content-Range 可以实现如下功能: 1.断点续传.用于下载文件被中断后,继续下载. 2.大文件指定区块下载,如视频.音 ...

  9. 单机百万连接调优和Netty应用级别调优

    作者:Grey 原文地址:单机百万连接调优和Netty应用级别调优 说明 本文为深度解析Netty源码的学习笔记. 单机百万连接调优 准备两台Linux服务器,一个充当服务端,一个充当客户端. 服务端 ...

  10. Java实现两数之和等于二十

    找出数组中两个数字之和为20的两个数 代码实现 public static void main(String[] args) { // TODO Auto-generated method stub ...