User`s manual

Environment variables
ModelSim Xilinx Users Manual ModelSim Variables A-257
Library mapping with environment variables
Once the MY_PATH variable is set, you can use it with the vmap command
(CR-
147)
to add library mappings to the current modelsim.ini file.
If youre using the vmap command from DOS prompt type:
vmap MY_VITAL %MY_PATH%
If youre using vmap from ModelSim/VSIM prompt type:
vmap MY_VITAL \$MY_PATH
If you used DOS vmap, this line will be added to the modelsim.ini:
MY_VITAL = c:\temp\work
If vmap is used from ModelSim/VSIM prompt, the modelsim.ini will be modified
with this line:
MY_VITAL = $MY_PATH
You can easily add additional hierarchy to the path. For example,
vmap MORE_VITAL %MY_PATH%\more_path\and_more_path
vmap MORE_VITAL \$MY_PATH\more_path\and_more_path
Note: The "$" character in the examples above is Tcl syntax that precedes a variable. The "\" character is
an escape character that keeps the variable from being evaluated during the execution of vmap.)
Referencing environment variables within ModelSim
There are two ways to reference environment variables within ModelSim.
Environment variables are allowed in a FILE variable being opened in VHDL.
For example,
entity test is end;
use std.textio.all;
architecture only of test is
begin
process
FILE in_file : text is in "$ENV_VAR_NAME";
begin
wait;
end process;
end;