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

时钟分频(偶数)

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 clk_out2_reg;
always @(posedge clk_in or negedge rst) begin
    if(!rst) begin
        clk_out2_reg <= 0;
    end
    else begin
        clk_out2_reg <= ~clk_out2_reg;
    end
end
assign clk_out2 = clk_out2_reg;

reg clk_out4_reg;
always @(posedge clk_out2 or negedge rst) begin
    if(!rst) begin
        clk_out4_reg <= 0;
    end
    else begin
        clk_out4_reg <= ~clk_out4_reg;
    end
end
assign clk_out4 = clk_out4_reg;

reg clk_out8_reg;
always @(posedge clk_out4 or negedge rst) begin
    if(!rst) begin
        clk_out8_reg <= 0;
    end
    else begin
        clk_out8_reg <= ~clk_out8_reg;
    end
end
assign clk_out8 = clk_out8_reg;

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

全部评论

相关推荐

asdasdasdasdas:19岁,不容易啊可能升个本会好点,现在学历歧视太严重了
点赞 评论 收藏
分享
frutiger:逆天,我家就安阳的,这hr咋能说3k的,你送外卖不比这工资高得多?还说大厂来的6k,打发叫花子的呢?这hr是怎么做到说昧良心的话的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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