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

无占空比要去的奇数分频

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[2:0]cnt;
reg out;

always@(posedge clk_in or negedge rst)
begin
if(!rst)
begin
cnt=3'd0;
end
else
begin
cnt= (cnt==3'd5)?3'd1:cnt+3'd1;
end
end
always@(*)
begin
if(!rst)
begin
out = 1'b0;
end
else if(cnt==1||cnt==3)
begin
out=~out;
end
end
assign clk_out5=out;
//*************code***********//
endmodule

全部评论

相关推荐

点赞 评论 收藏
分享
06-23 11:43
门头沟学院 Java
allin校招的烤冷...:我靠,今天中午我也是这个hr隔一个星期发消息给我。问的问题还是一模一样的😅
点赞 评论 收藏
分享
码农索隆:想看offer细节
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-11 11:30
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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