// Synthesizable generic design.

module johnson_counter
(
    input              clk,
    input              rst,
    output logic [3:0] q
);

    always_ff @ (posedge clk or posedge rst)
        if (rst)
            q <= '0;
        else
            q <= { q [2:0], ~ q [3] };

endmodule
