User guide

4-6
Simulating Your Design
four
Save and Restart File I/O
VCS remembers the files you opened via $fopen and reopens them
when you restart the simulation. If no file with the old file name exists,
VCS opens a new file with the old file name. If a file exists having the
same name and length at time of save as the old file, then VCS
appends further output to that file. Otherwise, VCS attempts to open
a file with file name equal to the old file name plus the suffix .N. If a
file with this name exists, VCS exits with an error.
If your simulation contains PLI routines that do file I/O, the routines
must detect both the save and restart events, closing and reopening
files as needed. You can detect save and restart calls using misctf
callbacks with reasons reason_save and reason_restart.
When running the saved checkpoint file, be sure to rename it so that
further $save calls do not overwrite the binary you are running. There
is no way from within the Verilog source code to determine if you are
in a previously saved and restarted simulation, so you cannot
suppress the $save calls in a restarted binary.
Save and Restart With Runtime Options
If your simulation behavior depends on the existence of runtime
plusargs or any other runtime action (such as reading a vector file),
be aware that the restarted simulation uses the values from the
original run unless you add special code to process runtime events
after the restart action. Depending on the complexity of your
environment and your usage of the save and restart feature, this can
be a significant task.