module counter2(input clk, input rst, output [1:0] q); reg [1:0] q; always @(posedge clk) q <= rst ? 2'b0 : q + 1; endmodule