题解 | #Johnson Counter#

Johnson Counter

https://www.nowcoder.com/practice/7ee6e9ed687c40c3981d7586a65bc22d

`timescale 1ns/1ns

module JC_counter(
   input                clk ,
   input                rst_n,
 
   output reg [3:0]     Q  
);
reg [7:0]temp;

always@(posedge clk or negedge rst_n)begin
    if(!rst_n)begin
        temp<= 8'b0111_1000;
        Q <= 4'b0000;
    end
    else begin
        temp<={temp[0],temp[7:1]};
        Q <= temp[3:0];
    end
end
endmodule

极简。

全部评论

相关推荐

牛客83700679...:简历抄别人的,然后再投,有反馈就是简历不行,没反馈就是学历不行,多投多改只要技术不差机会总会有的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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