时间值的数学运算

Math operations on time values

我需要将 ps 中的两个延迟参数值相除。结果必须是整数值。我试过下面的代码,但结果不正确。 N,我在compile/elaboration时需要的一个参数,需要计算到60。 Link 在 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