|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2014-9-12 19:22:17
|
显示全部楼层
我都是用的异步复位,程序本身不会一直陷入在复位中、、、
比如说这个产生脉冲的小程序
//repeat freq---2kHz pulse width 200ns
module wave_gen(clk,rst,wave_pulse);
input clk;
input rst;
output wave_pulse;
reg wave_pulse;
reg [16:0]count;
parameter n0 = 32'd10 - 1,n1 = 32'd25000 - 1;
always @(posedge clk or negedge rst)
if(!rst)
begin
count<=17'd0;
wave_pulse<=1'b1;
end
else if(count==n0)
begin
count<=count+1'b1;
wave_pulse<=1'b0;
end
else if(count==n1)
begin
count<=17'd0;
wave_pulse<=1'b1;
end
else count<=count+1'b1;
endmodule |
|