Lösung vom Drive kopiert und mit ChatGPT korrigieren lassen.

This commit is contained in:
2024-02-29 16:33:57 +01:00
parent 673abf9c48
commit 8f9d0cd001
31 changed files with 1313 additions and 107 deletions

View File

@@ -1,13 +1,13 @@
module down_counter #(
parameter CLOCK_DIVIDER = 5
)
module down_counter
(
input [7:0] CLK_DIVIDER;
input CLK,
input RESETn,
output reg [$clog2(CLOCK_DIVIDER)-1 : 0] Q,
output wire SYNC
);
output reg [$clog2(CLK_DIVIDER)-1 : 0] Q,
always @(posedge CLK or negedge RESETn) begin
if(~RESETn) begin
Q <= 1'd0;
@@ -17,7 +17,7 @@ always @(posedge CLK or negedge RESETn) begin
Q <= Q - 1'd1;
end
else if(Q == 1'd0) begin
Q <= CLOCK_DIVIDER;
Q <= CLK_DIVIDER;
end
end
end