Lösung vom Drive kopiert und mit ChatGPT korrigieren lassen.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user