我需要除以ps
中的两个延迟参数值。结果必须是整数值。我已经尝试了下面的代码,但结果不正确。 N
是我在编译/精化时需要的参数,需要计算为 60
。链接 edaplayground 。
module test #(parameter delay=3000ps, unitDelay = 50ps, integer N=$ceil(delay/unitDelay))
(input logic L, output logic R);
initial begin
$display ("delay=%d, unitDelay=%d, N=%d", delay, unitDelay, N);
$display ("delay=%t, unitDelay=%t, N=%d", delay, unitDelay, N);
end
endmodule
最佳答案
问题是您的全局时间尺度为 1ns
,因此 unitDelay
将为 0。因此您需要将时间尺度设置为 1ps
,或者将参数类型更改为 real
关于verilog - 对时间值的数学运算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28573999/