Loops get unrolled in synthesis and are implemented as parallel hardware. They are not used the same way you would use them in software. They are used to generate multiple instances of a circuit. Therefore, the bounds on the loop must be known at 'build time'.