keypad working

This commit is contained in:
Nicholas Orlowsky 2024-04-15 09:32:48 -05:00
parent 55adbcf90a
commit 4855bbc42d
Signed by: nickorlow
GPG key ID: 838827D8C4611687
10 changed files with 526 additions and 213 deletions

View file

@ -1,21 +1,23 @@
module downclocker #(parameter DC_BITS = 21) (
input wire clk_in,
module downclocker #(
parameter DC_BITS = 21
) (
input wire clk_in,
output logic clk_out
);
logic [DC_BITS-1:0] counter;
logic [DC_BITS-1:0] counter;
initial begin
counter = 0;
clk_out = 0;
end
initial begin
counter = 0;
clk_out = 0;
end
always_ff @(posedge clk_in) begin
if (counter[DC_BITS-1] == 1) begin
clk_out <= !clk_out;
counter <= 0;
end else begin
counter <= counter + 1;
end
always_ff @(posedge clk_in) begin
if (counter[DC_BITS-1] == 1) begin
clk_out <= !clk_out;
counter <= 0;
end else begin
counter <= counter + 1;
end
end
endmodule