///////////////////////////////////////////////////////////////////////////////
//
// Pushbutton Debounce Module
//
///////////////////////////////////////////////////////////////////////////////
![[Up: filter_sample dbreset]](v2html-up.gif)
![[Up: user_updown3 dbu]](v2html-up.gif)
module debounce
(reset, clk, noisy, clean);
input reset, clk, noisy;
output clean;
parameter NDELAY = 650000;
parameter NBITS = 20;
reg [NBITS-1:0] count;
reg xnew, clean;
always @(posedge clk)
if (reset) begin xnew <= noisy; clean <= noisy; count <= 0; end
else if (noisy != xnew) begin xnew <= noisy; count <= 0; end
else if (count == NDELAY) clean <= xnew;
else count <= count+1;
endmodule
This page: |
Created: | Sun Dec 11 13:11:08 2005 |
|
From: |
./debounce.v |