User`s manual
Using the Verilog PLI
ModelSim Xilinx User’s Manual Verilog Simulation 5-85
The callback reason argument
The second argument to a callback function is the reason argument. The values of
the various reason constants are defined in the veriuser.h include file. See Section
17 of the IEEE Std 1364 for a description of the reason constants. The following
details relate to ModelSim Verilog, and may not be obvious in the IEEE Std 1364.
Specifically, the simulator passes the reason values to the misctf callback
functions under the following circumstances:
reason_endofcompile
For the completion of loading the design.
reason_finish
For the execution of the $finish system task or the quit command.
reason_startofsave
For the start of execution of the checkpoint command, but before any of the simulation state
has been saved. This allows the PLI application to prepare for the save, but it shouldn’t save
its data with calls to tf_write_save until it is called with reason_save.
reason_save
For the execution of the checkpoint command. This is when the PLI application must save
its state with calls to tf_write_save.
reason_startofrestart
For the start of execution of the restore command, but before any of the simulation state has
been restored. This allows the PLI application to prepare for the restore, but it shouldn’t
restore its date with calls to tf_read_restart until it is called with reason_restart. The
reason_startofrestart value is passed only for a restore command, and not in the case that
the simulator is invoked with -restore.
reason_restart
For the execution of the restore command. This is when the PLI application must restore its
state with calls to tf_read_restart.
reason_reset
For the execution of the restart command. This is when the PLI application should free its
memory and reset its state.
reason_endofreset
For the completion of the restart command, after the simulation state has been reset but
before the design has been reloaded.