Hopefully this is enough of the project files for this to work ...
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
//NOTE: you should drive this with a slow clock to actually debounce input
|
||||
module Debouncer(input logic clk, input reset, input source, output wire out);
|
||||
|
||||
logic pressed;
|
||||
assign out = pressed;
|
||||
|
||||
always_ff @(posedge clk) begin
|
||||
if (reset)
|
||||
pressed <= 0;
|
||||
else if (!pressed && source)
|
||||
pressed <= 1;
|
||||
else if (pressed && !source)
|
||||
pressed <= 0;
|
||||
end
|
||||
|
||||
|
||||
//always_ff (@posedge clk) begin
|
||||
//
|
||||
//end
|
||||
|
||||
|
||||
|
||||
endmodule
|
||||
Reference in New Issue
Block a user