module decade_counter(input clk, input ena, input reset, output reg[3:0] value, output c); assign c = value == 9; always @(posedge clk) if (reset) value <= 4'b0; else if (ena) value <= value == 9 ? 0 : (value + 1'b1); endmodule