题解 | #占空比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
    );

//*************code***********//
reg [3:0] cnt;
always @(posedge clk_in or negedge clk_in or negedge rst) begin  
    if(~rst) begin
        cnt <= 0;
    end
    else if(cnt == 13)begin
        cnt <= 0;
    end 
    else begin
        cnt <= cnt + 1;
    end
end
assign clk_out7 = (cnt < 7)? 0: 1;
//*************code***********//
endmodule

#FPGA#
全部评论
这个思路巧
点赞 回复 分享
发布于 2022-08-28 17:48 山东

相关推荐

算法丰川祥:实际就两个人给他投,它这么说好显得自己比较抢手
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务