题解 | #时钟分频(偶数)#

时钟分频(偶数)

https://www.nowcoder.com/practice/49a7277c203a4ddd956fa385e687a72e

`timescale 1ns/1ns

module even_div
    (
    input     wire rst ,
    input     wire clk_in,
    output    wire clk_out2,
    output    wire clk_out4,
    output    wire clk_out8
    );
//*************code***********//
reg     clk1 ,clk2,clk3;
always @(posedge clk_in or negedge rst) begin
    if(!rst) begin
        clk1 <=1'b0 ;
    end
    else begin
        clk1 <= ~clk1 ;
    end
end
always @(posedge clk1 or negedge  rst) begin
    if(!rst) begin
        clk2 <= 1'b0 ;
    end
    else  begin
        clk2 <= ~clk2 ;
    end
end
always @(posedge clk2 or negedge  rst) begin
    if(!rst) begin
        clk3 <= 1'b0 ;
    end
    else begin
        clk3 <= ~clk3 ;
    end
end
assign clk_out2 = clk1 ;
assign clk_out4 = clk2 ;
assign clk_out8 = clk3 ;


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

全部评论

相关推荐

2025-12-30 16:42
同济大学 C++
仁狂躁使者:哎呀,不用担心,我当时配环境配了两天,项目捋不清就问问导师能不能用ai,慢慢就清了,会好起来的
点赞 评论 收藏
分享
01-11 08:47
门头沟学院 Java
羊村你懒哥1:如果不放毕业,我只能说导师是自己选的,错在你选了个垃圾导师,不在你实习
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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