// Synthesizable generic design.

module decade_counter
(
    input              clk,
    input              rst,
    input              inhibit,
    output       [9:0] q,
    output             carry
);

    logic [3:0] state;
    always_ff @ (posedge clk or posedge rst)
        if (rst)
            state <= '0;
        else if (~ inhibit)
            state <= state == 4'd9 ? 4'd0 : state + 1'b1;
    assign q     = 10'b1 << state;
    assign carry = state < 4'd5;

endmodule
