`timescale 1ns/1ns
module odd_div (
input wire rst ,
input wire clk_in,
output wire clk_out5
);
//*************code***********//
reg [2:0] cnt ; // 不要求占空比 直接一个计数器实现 在对应时钟周期拉高和降低就行 根据评论区大佬所述 高两电平低3电平 占空比百分之40能通过。
reg clk_5;
always@(posedge clk_in or negedge rst)begin
if(!rst)
cnt <= 'd0 ;
else if(cnt == 'd4)
cnt <= 'd0 ;
else
cnt <= cnt + 1'b1 ;
end
always@(posedge clk_in or negedge rst)begin
if(!rst)
clk_5 <= 1'b0 ;
else if(cnt == 'd0 || cnt == 'd2)
clk_5 <= ~clk_5 ;
else
clk_5 <= clk_5 ;
end
assign clk_out5 = clk_5 ;
//*************code***********//
endmodule