7.7.4 sg::SchedulerRunnable class

This section describes the SchedulerRunnable class.

sg::SchedulerRunnable - about

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 v0 function.


This function clears stop request flags.

void clearStopRequest();

Only 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 createThread() received. SchedulerRunnable inherits this function from sg::SchedulerObject.

sg::SchedulerRunnable::setThreadProperty, sg::SchedulerRunnable::getThreadProperty

These functions set and get thread properties.

bool setThreadProperty(ThreadProperty property, uint64_t value);
bool getThreadProperty(ThreadProperty property, uint64_t &valueOut);
Scheduler-configures-runnable properties
ARM deprecates this property. SchedulerInterfaceForComponents::getNextSyncPoint() gives the next quantum size.
ARM deprecates this property. Use SchedulerInterfaceForComponents::set/getGlobalQuantum().
Compiler latency, the maximum interval in which generated straight-line code checks for signals and the end of the quantum.
Compiler latency.
1024 instructions.
Synchronization latency, the minimum interval in which generated straight-line code inserts synchronization points.
Synchronization latency.
64 instructions.
syncLevel to at least N (0-3).
Minimum syncLevel.
min_sync_level CADI parameter and the syncLevel* registers also determine the syncLevel. If nothing else is set, the default is 0 (SL_OFF).
Local time of temporally decoupled thread.
Current local time.
Local quantum of temporally decoupled thread.
Current local quantum.


The temporally decoupled thread usually retrieves the local quantum by calling SchedulerInterfaceForComponents::getNextSyncPoint().
Runnable-configures-scheduler properties
Return false and ignore the value. Not for a scheduler to call.
Intended stack size for the thread in bytes. If this field returns false or 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 SchedulerInterfaceForComponents::createThread() or 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 must return false.


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.

bool stopRequest();

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 SchedulerInterfaceForComponents::stopAcknowledge(), which 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 clearStopRequest().

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) before stopAcknowledge() has reset the stop request using clearStopRequest() is harmless. The simulation only stops once.

Returns 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 wait()).


This is the main thread function, the thread entry point.

void threadProc();

When 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 initialization. threadProc() is to call SchedulerInterfaceForComponents::wait(t>=0, ...) after completing t ticks worth of work.

Do not create/destroy any other threads or scheduler objects within the context of this function.

Non-ConfidentialPDF file icon PDF versionARM 100965_1101_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.