What does #1 mean in verilog?
本问题已经有最佳答案,请猛点这里访问。
我知道verilog中的
1 2 3 | input ld; reg ld_r; always @(posedge clk) ld_r <= #1 ld; |
1 2 3 4 5 6 7 8 9 10 | always @(posedge clk) if(!rst) dcnt <= #1 4'h0; else if(ld) dcnt <= #1 4'hb; else if(|dcnt) dcnt <= #1 dcnt - 4'h1; always @(posedge clk) done <= #1 !(|dcnt[3:1]) & dcnt[0] & !ld; always @(posedge clk) if(ld) text_in_r <= #1 text_in; always @(posedge clk) ld_r <= #1 ld; |
由于您提到
这些延迟在综合中将被忽略,因此,如果在设计代码中使用它们,则会冒仿真与硬件不匹配的风险。
这里是描述您为什么要增加延迟的论文:http://sunburst-design.com/papers/CummingsSNUG2002Boston_NBAwithDelays.pdf
1 2 3 | $printtimescale; > Time scale of (test) is 1ns / 1ns |
仅使用
因此,添加文件或更改加载顺序时,
1 2 | //Delay 1001ns #(1us + 1ns); |
内部分配
1 | ld_r <= #1 ld; |
等同于:
1 2 | temp = ld; #1 ld_r <= temp; // Delay execution of ld_r <= temp by 1 timestep |
即立即获取一个副本ld,并将其值分配回
在SystemVerilog IEEE 1800-2012 Standard的9.4.5内部分配时序控制中对此用途进行了解释: