Clock Divider Verilog 50 Mhz 1hz Jun 2026
| Resource | Counter-based divider | Clock Enable | |----------|----------------------|--------------| | Flip-flops | 25-26 | 26-27 | | LUTs | ~2 (comparator) | ~2 (comparator) | | Clock buffers | 0 (if used internally) | 0 | | Maximum frequency | 50 MHz+ | 50 MHz+ |
module clock_divider #( parameter INPUT_FREQ = 50_000_000, // Hz parameter OUTPUT_FREQ = 1 // Hz ) ( input wire clk_in, input wire rst_n, output reg clk_out ); localparam MAX_COUNT = (INPUT_FREQ / OUTPUT_FREQ) / 2 - 1; // For 50 MHz to 1 Hz: MAX_COUNT = 24,999,999 clock divider verilog 50 mhz 1hz
module clk_div_50M_to_1Hz ( input wire clk_50M, // 50 MHz master clock input wire rst_n, // Active-low asynchronous reset output reg clk_1Hz // 1 Hz output clock ); // 50,000,000 / 2 = 25,000,000 counts needed for half period // Counter ranges from 0 to 24,999,999 localparam HALF_PERIOD_COUNT = 25_000_000; reg [24:0] counter; // 25 bits needed (2^25 = 33,554,432 > 25M) | Resource | Counter-based divider | Clock Enable
You need a register large enough to hold the number 25,000,000. A 25-bit or 26-bit register is required ( Verilog Implementation input wire rst_n
Therefore, we need a counter that counts from 0 to (50,000,000 / 2) - 1 = 24,999,999 and then toggles the output.
