verilog always中如何延时

来源:百度知道 编辑:UC知道 时间:2024/06/04 16:29:01
急!!!用verilog写的程序烧进fpga后,希望在always进程中执行一段程序后延时100ns(无需太精确)左右后
再执行后续程序。各位大虾帮帮忙。

你的时钟如果是50M的话,在5个周期后再继续主体程序就可以了
如果是其他频率时钟,执行f/10个空周期就行

always@(posedge clk50)begin
...
case()
4'd0: ..//主体
...
4'd3:state<=4'd4; //空语句延时
4'd4:state<=4'd5;
4'd5:state<=4'd6;
4'd6:state<=4'd7;
4'd7:state<=4'd8;
4'd8:...//主体
...
...

如果你不是用case的话,就简单的再写个计数延时模块,用两个使能信号连接主体也可以

在模块中,源管脚(input or inout)到目的管脚(output or inout)之间的延迟叫做模块路径延迟(module path delay)。在verilog中,路径延迟用关键字specify和endspecify表示。在这两个关键字之间的部分构成一个specify块。
specify块包含以下内容:
在模块交叉路径上定义管脚与管脚之间的延迟
在电路中进行set up time的检查
定义specparam 常量
例如:
//Pin-to-pin delays
module M (out,a,b,c,d);
output out;
input a,b,c,d;
wire e,f;
//specify block with path delay statements
specify
(a => out) = 9;
(b => out) = 9;
(c => out) = 11;
(d => out) = 11;
endspecify
//gate instantiations