在verilog或者systemverilog中怎么打印timescale信息

有时,需要确保在实例树下为每个模块应用正确的时间单位和精度,尤其是当不同模块使用不同时间刻度并使用时间刻度参数时。

在Verilog, SystemVerilog中打印 `timescale 

使用$printtimescale(path)仿真器指令

// timescale
`timescale 1ns/10ps

// top testbench module
module tb();

   // DUT instance
   dut dut_i();

   initial begin
      $printtimescale($root.tb); // prints the timescale of this module
      $printtimescale($root.tb.dut_i);// prints the timescale dut_i module instance
      $printtimescale($root.tb.dut_i.cpu_i);// prints the timescale dut_i.cpu_i module instance
   end 

endmodule

results:

Time scale of (tb) is  1ps /  1fs
Time scale of (tb.dut_i) is  1ps /  1ps
Time scale of (tb.dut_i.cpu_i) is  1ns /  10ps

在systemverilog类中,可以直接使用这个指令

该条指令,帮助我解决了,一个奇怪的问题。在我的一个package有一个类,假设是a,我加入打印信息或者delay,总是显示不正确,后来加入printtimescale来debug,发现timescale和我想要的不一致。

另外 $timeformat 系统任务也会影响display中%t的格式。调用一次即可。多次调用,最后一次调用生效。

$timeformat(<units>, <precision>, <suffix>, minimum field width>);

units               : log base 10 of the unit (eg -9 is ns)
precision           : the number of decimal places
suffix              : a string (eg "ns")
minimum field width : the minimum field width

如果没有调用过这个系统任务,将会使用默认值(即`timescale设置的值)

units               : the simulation precision (10ps in your case)
precision           : 0
suffix              : null string
minimum field width : 20

 

  • 0
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值