The Sparta Modeling Framework
|
Class that "connects" Sparta to SystemC. More...
#include <SysCSpartaSchedulerAdapter.hpp>
Public Member Functions | |
SC_HAS_PROCESS (SysCSpartaSchedulerAdapter) | |
Register the process for SystemC. | |
SysCSpartaSchedulerAdapter (Scheduler *scheduler) | |
Initialized the sc_module this adapter is part of. | |
void | run (Scheduler::Tick num_ticks=Scheduler::INDEFINITE) |
Run simulation – all of it including SystemC. | |
void | setSystemCSimulationDone () |
Set simulation complete on the SystemC side via the SC_Sparta_STOP_EVENT_NAME sc_event. Can be called directly if need be. | |
void | registerSysCFinishQueryEvent (sparta::Scheduleable *sysc_query_event, const Scheduler::Tick interval) |
Register a sparta::Event that is used to determine if the SystemC components are finished. | |
bool | wasScStopCalled () const |
Return whether the schedule called sc_stop() | |
Class that "connects" Sparta to SystemC.
This class will allow a Sparta developer to interoperate a Sparta-based simulator with the SystemC kernel. The general rule of thumb is that the Sparta scheduler is either always equal to or 1 cycle ahead of the SystemC scheduler. The Sparta Scheduler will "sleep" waiting for SysC to catch up the next scheduled Sparta event.
There are two ways to stop simulation using this adapter:
There are some caveats to know about this adapter. See the todo.
Definition at line 130 of file SysCSpartaSchedulerAdapter.hpp.
|
inline |
Initialized the sc_module this adapter is part of.
Definition at line 148 of file SysCSpartaSchedulerAdapter.hpp.
|
inline |
Register a sparta::Event that is used to determine if the SystemC components are finished.
sysc_query_event | The sparta::Event to schedule at the given interval |
interval | The time to schedule the query event |
Since there are two schedulers running with this adapter, there are interesting scenarios that must be acknowledged. One scenario is that the SysC clock is finished (no events), but the Sparta Scheduler is still busy (and injecting events) into the SystemC side. Likewise, Sparta could be idle, but SystemC still running. The best way to handle this (as most SystemC users have continuous events and force simulation stop using sc_stop), is to have a Sparta Event that queries the SystemC side to see if it's truly complete. If so, then we drain Sparta and this adapter terminiates simulation.
Definition at line 225 of file SysCSpartaSchedulerAdapter.hpp.
|
inline |
Run simulation – all of it including SystemC.
num_ticks | The number of ticks to run simulation (both SysC and Sparta) |
Run simulation using the Sparta command line infrastructure and world. This method is typically called from derivatives of sparta::Simulator via the runRaw_() overridden method.
Definition at line 185 of file SysCSpartaSchedulerAdapter.hpp.
|
inline |
Set simulation complete on the SystemC side via the SC_Sparta_STOP_EVENT_NAME sc_event. Can be called directly if need be.
Definition at line 199 of file SysCSpartaSchedulerAdapter.hpp.
|
inline |
Return whether the schedule called sc_stop()
Definition at line 238 of file SysCSpartaSchedulerAdapter.hpp.