Added kempston, autofire and enable autofire, enable turbo push buttons for GPIO1[32] and GPIO1[33]

This commit is contained in:
2022-04-06 14:01:01 +03:00
parent 114238753f
commit 9966f9a3a6
387 changed files with 564644 additions and 442870 deletions
+30
View File
@@ -0,0 +1,30 @@
module debouncer(input i_Clk, input i_Switch, output o_Switch);
parameter c_DEBOUNCE_LIMIT = 1100000; // 30 ms at 50 MHz
reg [20:0] r_Count = 0;
reg r_State = 1'b0;
always @(posedge i_Clk)
begin
// Switch input is different than internal switch value, so an input is
// changing. Increase the counter until it is stable for enough time.
if (i_Switch !== r_State && r_Count < c_DEBOUNCE_LIMIT)
r_Count <= r_Count + 1;
// End of counter reached, switch is stable, register it, reset counter
else if (r_Count == c_DEBOUNCE_LIMIT)
begin
r_State <= i_Switch;
r_Count <= 0;
end
// Switches are the same state, reset the counter
else
r_Count <= 0;
end
// Assign internal register to output (debounced!)
assign o_Switch = r_State;
endmodule