icicle/clk_div.sv

19 lines
273 B
Systemverilog
Raw Normal View History

2017-12-02 20:26:56 +00:00
`ifndef CLK_DIV
`define CLK_DIV
module clk_div #(
parameter LOG_DIVISOR = 1
) (
input clk_in,
output logic clk_out
2017-12-02 20:26:56 +00:00
);
2017-12-03 19:23:42 +00:00
logic [LOG_DIVISOR-1:0] q;
2017-12-02 20:26:56 +00:00
always_ff @(posedge clk_in)
q <= q + 1;
assign clk_out = q[LOG_DIVISOR-1];
endmodule
`endif