![]() |
![]() |
![]() |
![]() |
The effect of restart on FLI application code
When a simulator restart command is given, the simulator by default reloads shared libraries under the following conditions:
- A shared library loaded due to a foreign attribute on a VHDL architecture is reloaded.
- A shared library loaded due to the -foreign option to vsim is reloaded.
- A shared library loaded due to a foreign attribute on a VHDL subprogram is not reloaded, even if the shared library also contains code for a foreign architecture.
This default behavior can be overridden in two ways. First, an FLI application can prevent reloading of the shared library in which it is contained by calling mti_KeepLoaded() during execution of its initialization function. Second, the reloading of all shared libraries can be controlled by the vsim options -keeploaded and -keeploadedrestart, both of which prevent any shared libraries from being reloaded during a restart.
When a shared library is reloaded, the internal state of any FLI application which it contains is automatically reset to its initial state. But when a shared library is not reloaded, if any FLI application which it contains does not specifically check for a restart and reset its internal state to its initial state, then the internal state of that FLI application will remain in its last simulation state even though time has been reset to zero.
Because FLI shared libraries might or might not be reloaded during a restart, it is wise to always include a restart callback function (see mti_AddRestartCB()) in your FLI application that frees any memory that your code has allocated and resets the internal state of your application. It is also a good idea to avoid the use of static local variables.
![]() Model Technology Inc. Voice: (503) 641-1340 Fax: (503)526-5410 http://www.model.com sales@model.com |
![]() |
![]() |
![]() |
![]() |