`timescale 1ns/1ps
// 小实验: `timescale 1ns / 1ps 前面是刻度(小数点之前),后面是精度(小数点之后);
// 一旦超过了精度,就会四舍五入(modelSim仿真)
仿真代码如下所示
`timescale 1ns/1ps
reg test1;
reg test2;
reg test3;
reg test4;
initial begin
test1 = 0;
#10;
test1 = 1;
end
initial begin
test2 = 0;
#10.001;
test2 = 1;
end
initial begin
test3 = 0;
#10.0027;
test3 = 1;
end
initial begin
test4= 0;
#10.0023;
test4 = 1;
end
可以看到:
#10 对应的是 10ns;
#10.001 对应的是 10.001ns
#10.0023 对应的是 10.002ns
#10.0027 对应的是 10.003ns