| |||
| Home > SystemC Export > Scheduling of Fast Models and SystemC > Simulation with a debug server | |||
A debug server with a CADI 2.0 interface can be started with
the exported model. The initialization is done in the simulation
phase before_end_of_elaboration(). The debug server
is therefore ready to accept incoming requests after sc_start()
is called. The scheduler executed for this case is shown in Figure 5.14.
After the simulation starts:
The wait() callback
is initiated with mode parameter set to SG_MODE_INIT.
A check is made to determine whether a debugger command must be processed. Such commands are typically:
Run to
changes the simulation state from stop to running
Stop to change the state from
running to stop.
The simulation state is tested to determine if the simulation is still running:
The following steps are executed. These steps are equivalent to the case where no debug server is started:
If a previous quantum
has executed, the start_of_quantum() callback
is executed with parameter SG_MODE_RUN.
If the previous quantum was interrupted by a breakpoint or stop command, the callback is not executed.
Because a single step causes a breakpoint to be hit, the callback is not typically executed after a single step.
The proceed_quantum() callback
is executed before each execution of the Fast Models scheduler.
This callback is especially useful for debugger integration that requires a notification before each start of simulation from the Fast Models subsystem.
EVS is simulated for a time quantum equivalent to
the time specified by set_quantum_seconds().
The wait() callback is issued
with the time parameter equal to the actual simulated time in Fast
Models. This is typically used to issue a SystemC wait() to
cause the SystemC model to simulate the same amount of time and
synchronize the two models. This is the default implementation.
A custom simulation environment can reimplement this callback.
The following steps are executed:
A wait() callback
is issued with the time parameter zero and the mode set to SG_MODE_STOP.
The simulation is then suspended for 20ms to allow other simulators to catch up.
The simulation resumes with the check for a pending debugger command that might have arrived.
The following callback functions can be used to notify the end of simulation:
simulation_quit()Called before the simulation quits because of a
user event such as, for example, pushing the close button of the visualization
component in the LinuxSystem example.
The default implementation calls sc_stop(),
but this can be overloaded by the SystemC user.
simulation_stop()Called after the simulation stops because of, for
example, application exit (_sys_exit).
The default implementation does nothing, but this can be overloaded by the SystemC user.
See also Simulation control functions.