This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/Quartus/v4/jyh_4490_4_divider.v

19 lines
379 B
Coq
Raw Normal View History

2022-04-12 09:03:50 +00:00
module jyh_4490_4_divider(clk,clk_out);
input clk;
output reg clk_out;
2022-04-19 07:19:04 +00:00
localparam TARGET=50000;
// localparam TARGET=1;
2022-04-12 14:26:39 +00:00
reg [19:0]counter=0;
2022-04-12 09:03:50 +00:00
initial begin
clk_out=0;
end
always @(posedge clk)
begin
counter=counter+1;
if(counter==TARGET)
begin
counter=0;
clk_out=!clk_out;
end
end
endmodule