源自
module PushButton_Debouncer (Do, Di, clk, rst);
output Do;
input Di;
input clk,rst;
reg [24:0] buff;
reg Do;
always @ (posedge clk or posedge rst)
begin
if(rst)
begin
buff=0;
end
else
begin
if(Di)
begin
if (buff>25'd10_000_000)
buff=buff;
else
buff=buff+25'd1;
end
else
begin
buff=0;
end
end
end
always @ (posedge clk)
begin
if (buff>25'd5_000_000)
Do=1;
else
Do=0;
end
endmodule
沒有留言:
張貼留言