题解 | #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
极简。