module counter(input CLK, RST, output [3:0] Q); reg [3:0] count; always @(posedge CLK) if(RST) count <= 0; else count <= count + 1; assign Q = count; endmodule