| |||
| Home > Components > Behavior sections > Controlling simulation from behaviors | |||
See also Special-purpose behaviors.
Any LISA+ behavior can use the following function calls to detect and control the simulation environment:
simRun()Start the simulation. This might be used from, for
example, the gui_callback() function.
simHalt()Stop the simulation. This might be used if, for example, an error is detected.
The simulation does not stop immediately. The actual shutdown
might be as much as 200 cycles after the call to simHalt().
simShutdown()Stop the simulation and exit.
simIsRunning()Returns true if the simulation is currently running.
This might be used from, for example, the gui_callback() function.
cadiRefresh()Notifies attached debuggers to refresh their state.
The parameter is an int that combines one or more of the CADI_REFRESH_REASON_ flags
(see the XCADITypes.h file for details). For
example:
behavior myBehavior()
{
// do something that changes model state when in stop mode
// ...
cadiRefresh(eslapi::CADI_REFRESH_REASON_REGISTERS
| eslapi::CADI_REFRESH_REASON_OTHER);
}
Do not call this function from behaviors that can be triggered as a response for refresh such as, for example, a register read. If called from the behavior, an endless loop results.
This function only has effect if the simulation is stopped.