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

时钟分频(偶数)

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 cnt2;
reg [2:0] cnt8;
reg [1:0] cnt4;
always @(posedge clk_in or negedge rst)
begin
if(!rst)
begin
cnt4=2'b01;
cnt8=3'b011;
cnt2=1'b0;
end
else
begin
cnt2=cnt2+1'b1;
cnt4=cnt4+2'b01;
cnt8=cnt8+3'b001;
end
end

assign clk_out2=cnt2;
assign clk_out4=cnt4[1];
assign clk_out8=cnt8[2];


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

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-08 13:15
点赞 评论 收藏
分享
06-14 19:09
门头沟学院 Java
darius_:给制造业搞的,什么物料管理生产管理,设备管理点检,最最关键的就是一堆报表看板。个人觉得没啥技术含量都是些基本的crud,但是业务很繁琐那种
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-08 17:10
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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