System verilog 模拟计时问题

System verilog 模拟计时问题,system-verilog,System Verilog,请帮助我了解一些与时间刻度相关的模拟器行为。 这是我的顶级模块:   这是我的模拟脚本: irun \ … -timescale 1ns/1ps \ … 当我运行模拟时,我看到clk_62p5时钟周期是16ps而不是16ns。你能解释我为什么有这种行为吗 第二个问题:时间单位、时间精度和时间刻度之间有什么区别?回答第二个问题: `timescale是一个编译器指令。使用编译器指令可能会导致编译顺序依赖关系,即编译文件的实际顺序所导致的不同行为或问题。假设您有三个文件: fil

请帮助我了解一些与时间刻度相关的模拟器行为。 这是我的顶级模块:  

这是我的模拟脚本:

irun \
 …
    -timescale 1ns/1ps \
    …
当我运行模拟时,我看到clk_62p5时钟周期是16ps而不是16ns。你能解释我为什么有这种行为吗


第二个问题:时间单位、时间精度和时间刻度之间有什么区别?

回答第二个问题:

`timescale是一个编译器指令。使用编译器指令可能会导致编译顺序依赖关系,即编译文件的实际顺序所导致的不同行为或问题。假设您有三个文件:

fileA.v   `timescale 1ns/1ps
fileB.v   `timescale 10ns/10ps
fileC.v   // no timescale directive
如果你按照这个顺序编译

fileA.v fileB.v fileC.v
fileA.v fileC.v fileB.v
fileC.v fileA.v fileB.v
然后,精度将为1ps(编译时发现的最小值),每个文件的时间单位为:

fileA.v  1ns   because of the `timescale directive
fileB.v  10ns  because of the `timescale directive
fileC.v  10ns  because the `timescale directive from fileB.v continues to have an effect
fileA.v  1ns   because of the `timescale directive
fileB.v  10ns  because of the `timescale directive
fileC.v  1ns   because the `timescale directive from fileA.v continues to have an effect
如果你按照这个顺序编译

fileA.v fileB.v fileC.v
fileA.v fileC.v fileB.v
fileC.v fileA.v fileB.v
然后,精度将为1ps(编译时发现的最小值),每个文件的时间单位为:

fileA.v  1ns   because of the `timescale directive
fileB.v  10ns  because of the `timescale directive
fileC.v  10ns  because the `timescale directive from fileB.v continues to have an effect
fileA.v  1ns   because of the `timescale directive
fileB.v  10ns  because of the `timescale directive
fileC.v  1ns   because the `timescale directive from fileA.v continues to have an effect
如果你按照这个顺序编译

fileA.v fileB.v fileC.v
fileA.v fileC.v fileB.v
fileC.v fileA.v fileB.v
然后您将得到一个错误,因为在任何带有timescale指令的文件之前出现一个没有timescale指令的文件是非法的。但如果没有文件具有` timescale指令,则可以

timeunit和timeprecision是实现相同功能的较新的系统Verilog方法。由于它们不是编译器指令,因此不会出现相关问题。它们仅适用于使用它们的作用域$unit/package/module/program/interface,并且必须在该作用域中位于第一位


如果您使用timeunit和timeprecision以及timescale指令,则timeunit和timeprecision优先。

不回答您的第一个问题:我无法重现您的问题。这是。请你发封邮件好吗。但是,我注意到您编写的时间刻度为1ns/1ps。这应该是1ns/1ps的时间刻度。也许这就是你的问题?是的,我认为你应该删除时间刻度中的空格,然后再次检查