# Finding simulator-specific range for user-defined physical type

I want to find out the maximum range for user-defined physical types like the following:

type resistance is range 0 to 1_000_000
units
Ohm;
kOhm = 1000 Ohm;
MOhm = 1000 kOhm;
end units resistance;


Documentation for physical types (VHDL LRM sections 3.1.3 and 3.1.2) says that the range is of integer type, so I could write range integer'low to integer'high which is the same as range -2_147_483_648 to 2_147_483_647. However, my simulator seems to use 64-bit arithmetic here, and range -40_000_000_000_000 to 40_000_000_000_000 also works, as does range -2**62 to 2**62 (while 2**63 does not).

Is there a canonical way to find out the simulator-supported range? If not, how would I put the empirically-found 2**62 into a constant (for externalizing such simulator-specific code)? An integer constant won't cut it :)

• To answer my last question myself, a workaround is to define e.g. constant c_simulator_physical_type_wid : positive := 64; in a package and then use it like range -2**(c_simulator_physical_type_wid-2) to 2**(c_simulator_physical_type_wid-1) (which is what my simulator will accept). – cmarqu Sep 7 '11 at 11:08
• Interestingly enough, our tool vendor didn't reply to my now months-old support request yet. :) – cmarqu Jan 4 '12 at 9:50