Is it necessary to declare reg before assignment in Verilog? Or does Verilog-2001 allow to declare reg after assignment?
For example this code is synthesized by Quartus and simulated by ModelSim without errors
module my_module(output out_my_reg);
reg my_reg;
assign out_my_reg = my_reg;
endmodule
And this code is synthesized by Quartus without errors but in ModelSim its simulate leds to an error Undefined variable: 'my_reg'
module my_module(output out_my_reg);
assign out_my_reg = my_reg;
reg my_reg;
endmodule