I have just started learning Verilog, so I tried writing a simple 4-bit binary counter. However, when I run the behavioural simulation, the output stays undetermined. I will really appreciate if someone can tell me where I am going wrong.
module counter(input clk, input rst, output reg [3:0] count);
always@ (posedge clk)
begin
if(rst)
count <= 4'b0;
else
count <= count + 1'b1;
end
endmodule

module counter(input clk, input rst, output reg [3:0] count = 0);\$\endgroup\$