module clkdiv #(parameter DIVISOR = 5) (input clk, output reg clk_out=0); reg [19:0] counter = 0; always @(posedge clk) begin if(counter == DIVISOR - 2'b01) begin clk_out = ~clk_out; counter = 0; end else counter = counter + 1; end endmodule