User`s manual

Simulator state variables
ModelSim Xilinx Users Manual ModelSim Variables A-283
Simulator state variables
Unlike other variables that must be explicitly set, simulator state variables return
a value relative to the current simulation. Simulator state variables can be useful
in commands, especially when used within a ModelSim DO files (macros).
Referencing simulator state variables
Variable values may be referenced in simulator commands by preceding the
variable name with a $ sign. For example, to use the now and resolution variables
in an echo command type:
echo "The time is $now $resolution."
Depending on the current simulator state, this command could result in:
The time is 12390 10ps.
If you do not want the dollar sign to denote a simulator variable, precede it with a
"\". For example, \$now will not be interpreted as the current simulator time.
Variable Result
argc returns the total number of parameters passed to the current macro
architecture returns the name of the top-level architecture currently being simulated; for a
configuration or Verilog module, this variable returns an empty string
configuration returns the name of the top-level configuration currently being simulated; returns
an empty string if no configuration
delta returns the number of the current simulator iteration
entity returns the name of the top-level VHDL entity or Verilog module currently being
simulated
library returns the library name for the current region
MacroNestingLevel returns the current depth of macro call nesting
n represents a macro parameter, where n can be an integer in the range 1-9
Now returns the current simulation time expressed in the current time resolution, i.e.,
1000 ns
now returns the current simulation time as an absolute number of time steps, i.e., 1000
resolution returns the current simulation time resolution