just took this example from the net. I'm just starting with the basics so i don't know much abt the entire code but my doubt here is reg is a variable data type right and it should be within a procedure which in this case should be inside always block but why is it not der. can someone pls explain me why reg is used outside and if we can use variable data types outside in wat cases do we use it (i mean to describe wat)
With above statement i conclude that you have confusion about vhdl and verilog.First of all there are no procedures in verilog only procedural blocks initial,always blocks (vhdl has procedures).Similarly in vhdl there are no tasks (vhdl has functions and procedures)..for verilog you can not declare variables inside procedural blocks ,initial and always.You can declare them inside functions and tasks.