题解 | #无占空比要去的奇数分频#

无占空比要去的奇数分频

https://www.nowcoder.com/practice/12d0615157a04e43bb7f41debc3cfa5b

`timescale 1ns/1ns

module odd_div (    
    input     wire rst ,
    input     wire clk_in,
    output    wire clk_out5
);
//*************code***********//
    reg outs;
    reg[2 : 0] cnt;
    assign clk_out5 = outs;

    always @(posedge clk_in or negedge rst) begin
        if (!rst) cnt <= 0;
        else if (cnt == 4) cnt <= 0;
        else cnt <= cnt + 1;
    end

    always @(posedge clk_in or negedge rst) begin
        if (!rst) outs <= 0;
        else if (cnt == 0) outs <= ~outs;
        else if (cnt == 2) outs <= ~outs;
        else outs <= outs;
    end

//*************code***********//
endmodule


全部评论

相关推荐

但听说转正率很低,我现在有在实习了,好纠结要不要去
熬夜脱发码农:转正率低归低,但是实习的经历你可以拿着,又不是说秋招不准备了
点赞 评论 收藏
分享
龙珠传说:nb,公务员解约不需要支付违约金吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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