要回答你的第二個問題:
'的時間表是編譯器指令。使用編譯器指令可能導致編譯順序相關,這是不同的行爲,或者由實際順序編譯你的文件引起的問題假設你有三個文件:
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
是的,我想你應該刪除'時間刻度'中的空格並再次檢查 –