题解 | #占空比50%的奇数分频#
占空比50%的奇数分频
https://www.nowcoder.com/practice/ccfba5e5785f4b3f9d7ac19ab13d6b31
`timescale 1ns/1ns
module odo_div_or
(
input wire rst ,
input wire clk_in,
output wire clk_out7
);
reg [3:0] cnt;
always @(posedge clk_in or negedge clk_in or negedge rst)begin
if(!rst)
cnt <= 0;
else if(cnt == 13)
cnt <= 0;
else
cnt <= cnt + 1;
end
assign clk_out7 = (cnt <= 6) ? 0 : 1;
endmodule