|Home > SystemC Export with Multiple Instantiation > Scheduler API > sg::SchedulerRunnable class|
This section describes the
This class is a thread interface on the runnable side. The modeling components create and implement
SchedulerRunnable objects and pass a pointer to a
SchedulerRunnable interface to
SchedulerInterfaceForComponents::createThread(). The scheduler uses this interface to run the thread.
This function breaks the quantum. Arm deprecates this function.
This function clears stop request flags.
SchedulerInterfaceForComponents::stopAcknowledge() calls this function,
so calls are always from the simulation thread.
This function returns the name of the instance that owns the object.
const char *getName() const;
By convention, this is the name that
SchedulerRunnable inherits this function from
These functions set and get thread properties.
bool setThreadProperty(ThreadProperty property, uint64_t value); bool getThreadProperty(ThreadProperty property, uint64_t &valueOut);
SchedulerInterfaceForComponents::getNextSyncPoint()gives the next quantum size.
syncLevelto at least
min_sync_levelCADI parameter and the
syncLevel* registers also determine the
syncLevel. If nothing else is set, the default is 0 (
falseand ignore the value. Not for a scheduler to call.
falseor a low value, this field uses the default stack size that the scheduler determines. Not all schedulers use this field. If a scheduler supports setting the stack size, it requests this field from
SchedulerThread::start(). Is to return a constant value.
Schedulers need not use all fields, and runnable objects need not
provide all fields. If a runnable object does not support a property or value, it
This function requests the simulation of the whole system to stop (pause) as soon as possible by setting a request flag. This might be to inspect a runnable, for example to pause at an instruction boundary to inspect a processor component with a debugger.
You can call this function from any host thread, whether the simulation is running or not. The
function returns immediately, before the simulation stops. This function will not
block the caller until the simulation stops. The simulation stops as soon as
possible, depending on the
syncLevel of the runnable.The simulation
calls the function
blocks the simulation thread to pause the simulation. The function must not call
stopAcknowledge() directly but only set up a state such that
the simulation stops at the next sync point, defined by the
syncLevel of this runnable. Reset this state with
stopAcknowledge(), which calls
Modeling components use this function to stop the simulation from within the
simulation thread (for example for external breakpoints) and also asynchronously
from from the debugger thread. Calling this function again (from any host thread)
stopAcknowledge() has reset the stop request using
clearStopRequest() is harmless. The simulation only stops once.
true when the runnable accepts the stop request and will
stop later. Returns
false when the runnable does not accept the
stop request. In this case, the scheduler must stop the simulation when the runnable
returns control to the scheduler (for example, by use of
This is the main thread function, the thread entry point.
threadProc() returns, the thread no longer runs and this
SchedulerThread instance will not call
threadProc() again. The thread usually does not return from
this function while the thread is running.
threadProc() is to call
SchedulerInterfaceForComponents::wait(0, ...) after completing
threadProc() is to call
SchedulerInterfaceForComponents::wait(t>=0, ...) after
t ticks worth of work.
Do not create/destroy any other threads or scheduler objects within the context of this function.