Super FinSim can save the state of the simulator and restart the
simulator later on. Both save and restart operations are performed at
very high speed (e.g. 5-6 seconds for saving and 2-3 seconds for
restarting simulation images of 256MB).
This feature can be used both to recover after a hardware failure,
or to bring the simulation in a certain state, save it and then
restart it on many machines simultaneously in order to perform various
tests with different stimuli starting from the desired state. This way
one does not need to repeat the part where the simulation is brought
in the desired state. As an example, one may wish to save the state
after the boot cycle is completed and then restart it in order to
perform the various tests.
1. Saving a simulation.
FinSim allows the user to save the state of a simulation in one of two
For both cases the user first edits a file with all the command line options for the simulator
and runs the simulation using "-cf <file>"
a. Using the $save("suffix") system task.
The user inserts in the Verilog design at
the desired time(s) calls to the system task $save. The simulation
is saved in the file(s) finstate.<suffix> on Linux and
<name of original simulator>.<suffix> on Solaris.
b. Using the interactive command save <suffix>
In the interactive mode the user issues the
command save <suffix>. The simulation is saved
in the file(s) finstate.<suffix> on Linux and <name
simulator>.<suffix> on Solaris. To
get to the interactive mode, one can either start the simulation in the
interactive mode from the beginning with the "-i" option
(specified in the command file) , or can insert a $stop in the Verilog source code or can type a CTRL-C while
a batch simulation is running.
The following notes apply to saved simulations regardless of how they
were saved except where noted.
The simulation state is always saved at the end of the current
simulation time. If the design has PLI all misctf routines are invoked
with reason 'reason_save'. All of the user's PLI data structures in
memory are saved and restored automatically by FinSim however, the
user is responsible for saving the state of any file/socket opened
using PLI when the misctf routine is called with reason
In the interactive mode, if the <suffix> is omitted, the state will
saved in finstate.sav on Linux and <name of original simulator>.sav
Solaris. The system task $save requires a string as its only argument.
2. Restarting a saved simulation.
To restart a saved simulation, the user has to set the environment
variable FIN_RESTART_ARGS to "+fin_restart+<suffix> -cf <file>"
setenv FIN_RESTART_ARGS "+fin_restart+<suffix>
set FIN_RESTART_ARGS="+fin_restart+<suffix> -cf
<suffix> is the suffix of the saved simulation and <file> contains
all command line options for TOP.sim. FinSim allows the user to
provide extra plus arguments when the simulation is restarted. This is
useful for instance when the design is written such that it
generates/applies different test vectors based on one or more plus
args provided at runtime. The user can save the state of the
simulation when the initialization sequence is complete and restart
the same saved simulation multiple times each with different plus
arguments causing the test bench to generate/apply different test
vectors for each run. Please note that in order for plus arguments to
be evaluated at runtime, the design must be compiled with the option
+no_plusargs_substitution to finvc. All plus arguments should be
specified in <file>. All other arguments specified when the simulation
is restarted will be ignored since the ones in the original run have
already been evaluated and are therefore part of the saved image.
If the design has PLI all misctf routines are invoked with reason
'reason_restart'. All of the user's PLI data structures in memory are
restored automatically by finsim, however the user is responsible for
restoring the state of any file/socket opened using PLI in the initial
run when his misctf routine is called with reason 'reason_restart'.
IMPORTANT: Please note that in order to run a new simulation, one has
to unsetenv FIN_RESTART_ARGS to avoid restarting a saved one.