要回答你的第二个问题:
'的时间表是编译器指令。使用编译器指令可能导致编译顺序相关,这是不同的行为,或者由实际顺序编译你的文件引起的问题假设你有三个文件:
fileA.v `timescale 1ns/1ps
fileB.v `timescale 10ns/10ps
fileC.v // no timescale directive
如果按此顺序
编译
fileA.v fileB.v fileC.v
则精度会1PS - 最小发现编译 - 每个文件的TIMEUNIT将是:
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 fileC.v fileB.v
则精度会1ps的编译 - 最小发现编译 - 的TIMEUNIT每个文件将是:
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
如果按此顺序编译
fileC.v fileA.v fileB.v
然后你会得到一个错误,因为它没有timescale directive appearing before any file with a
timescale指令是非法的。 (尽管如果没有文件具有`timescale指令),那就没问题了。
timeunit
和timeprecision
是较新的System-Verilog实现相同的方法。由于它们不是编译器指令,它们不会遇到相关问题。它们只适用于它们用于的范围($ unit/package/module/program/interface)(并且必须在该范围内首先出现)。
如果您使用timeunit
和timeprecision
以及timescale directive then
时间单元and
timeprecision`优先。
要不回答您的第一个问题:我无法重现您的问题。这是[我的尝试](https://www.edaplayground.com/x/aP_)。请你可以发布[MCVE](http://stackoverflow.com/help/mcve)。不过,我注意到你已经写了'时间刻度1 ns/1 ps。这应该是'timescale 1ns/1ps。也许这是你的问题? –
这些术语在免费的IEEE Std 1800-2012中有完整描述。 – toolic
是的,我想你应该删除'时间刻度'中的空格并再次检查 –