My Verilog testbench code defines a module with these parameters:
parameter PHASE_BITS = 32;
parameter real MAX_PHASE = 1 << PHASE_BITS;
I cannot get MAX_PHASE
to have the expected value 4294967296
or its approximation; ModelSim shows me 0
instead. This despite the fact that MAX_PHASE
is declared real.
I guess there's some integer overflow involved, because it works fine if PHASE_BITS
is lowered to 31.
How do I make this parameter be equal to 2 to the power of another parameter?