21 lines
442 B
Coq
21 lines
442 B
Coq
|
module div_clk(input clk, rst_n, output reg clk_div);
|
||
|
|
||
|
parameter DIV = 10;
|
||
|
parameter COUNT_WITH = 10;
|
||
|
reg [COUNT_WITH-1:0] count;
|
||
|
|
||
|
always @(posedge clk or negedge rst_n) begin
|
||
|
if (!rst_n) begin
|
||
|
count <= 0;
|
||
|
clk_div <= 0;
|
||
|
end else begin
|
||
|
if (count == (DIV-1)) begin
|
||
|
count <= 0;
|
||
|
clk_div <= ~clk_div;
|
||
|
end else begin
|
||
|
count <= count + 1;
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
endmodule
|