Verilog 时间格式

2024 年 8 月 29 日 | 阅读 3 分钟

Verilog timescale 指令指定仿真的时间单位和精度。

Verilog $timeformat 系统函数指定 %t 格式说明符在显示语句 (例如 $display$strobe) 中的报告样式。

语法

  • unit_number 是源代码中所有 `timescale 指令使用的最小时间精度。
  • precision 表示当前 timescale 的小数位数。
  • suffix_string 是一个选项,用于在实际时间值旁边显示比例。
单位数字时间单位
-31ms
-61us
-91ns
-121ps
-151fs

示例 1:1ns/1ps

以下示例说明了 $timeformat 如何影响时间单位显示的格式。

现在执行上面的代码,它将给出以下输出,例如

xcelium> run
[T=10512] a=0
[T=10.51 ns] a=0
[T=10.51200ns] a=0
[T=10512.000 ns] a=0
[T=10512.00 ps] a=0
xmsim: *W,RNQUIE: Simulation is complete.

示例 2:1ns/100ps

我们考虑上面来自相同示例,但具有不同的 timescale。

上面的代码产生以下输出

xcelium> run
[T=105] a=0
[T=10.50 ns] a=0
[T=10.50000ns] a=0
[T=10500.000 ns] a=0
[T=10500.00 ps] a=0
xmsim: *W,RNQUIE: Simulation is complete.

示例 3:100ns/1ns

注意:#1 表示 100ns,因此 #10 产生 1000ns。

输出如下所示

xcelium> run
[T=1051] a=0
[T=1051.00 ns] a=0
[T=1051.00000ns] a=0
[T=1051000.000 ns] a=0
[T=1051000.00 ps] a=0
xmsim: *W,RNQUIE: Simulation is complete.

下一个主题Verilog 调度语义