The Sparta Modeling Framework
|
A class that defines the basic scheduling interface to the Scheduler. Not intended to be used by modelers directly, but certainly can be. More...
#include <Scheduleable.hpp>
Classes | |
class | PrecedenceSetup |
An internal class used in Scheduleble to cache a pointer to the scheduler. More... | |
Public Types | |
typedef uint32_t | PrecedenceGroup |
Typedef defining the precedence group ID. | |
Public Member Functions | |
Scheduleable (const SpartaHandler &consumer_event_handler, Clock::Cycle delay, SchedulingPhase sched_phase, bool is_unique_event=false) | |
Construct a Scheduleable object. | |
virtual | ~Scheduleable ()=default |
Destructor. | |
Scheduleable (const Scheduleable &)=default | |
Allow copies. | |
Scheduleable (Scheduleable &&) noexcept=default | |
Allow moves. Marked as noexcept to force containers to use it. | |
Scheduler * | getScheduler (const bool must_exist=true) |
Get the scheduler this Scheduleable is assigned to. | |
const Scheduler * | getScheduler (const bool must_exist=true) const |
Get the scheduler this Scheduleable is assigned to. | |
void | setDelay (Clock::Cycle delay) |
Set a fixed delay for this event. | |
void | addDelay (Clock::Cycle delay) |
Add to the delay for this event. | |
Clock::Cycle | getDelay () const |
Get the delay associated with this event. | |
void | setContinuing (bool continuing) |
This event, if continuing == true, will keep the simulation running. | |
bool | isContinuing () const |
Is this Event continuing? | |
const SpartaHandler & | getHandler () const |
Get the consumer handler/callback associated with this event. | |
SpartaHandler & | getHandler () |
Get the consumer handler/callback associated with this event. | |
void | setHandler (const SpartaHandler &handler) |
Set the consumer handler/callback associated with this event. | |
void | schedule () |
Schedule this event with its pre-set delay using the pre-set Clock. | |
void | schedule (const Clock *clk) |
Schedule this event with its pre-set delay using the given clock. | |
void | schedule (Clock::Cycle delay) |
Schedule an event in the future using the pre-set Clock. | |
virtual void | scheduleRelativeTick (const Scheduler::Tick rel_tick, Scheduler *const scheduler) |
Schedule this event on a relative scheduler tick. | |
void | schedule (Clock::Cycle delay, const Clock *clk) |
Schedule an event in the future using the given Clock. | |
bool | isScheduled () const |
Return true if this scheduleable was scheduled at all. | |
bool | isOrphan () const |
Return true if this scheduleable is not associated with a vertex. | |
bool | isScheduled (Clock::Cycle rel_cycle) const |
Return true if this Scheduleable was scheduled on the given relative cycle. | |
SchedulingPhase | getSchedulingPhase () const |
Get the internal phase number. | |
const char * | getLabel () const |
Get the internal label. | |
void | setLabel (const char *label) |
Set a new label for this Scheduleable – used in debugging. | |
Vertex * | getVertex () |
get the internal Vertex of this scheduleable | |
void | precedes (Scheduleable &consumer, const std::string &reason="") |
Have this Scheduleable precede another. | |
void | precedes (Vertex &consumer, const std::string &reason="") const |
Have this Scheduleable precede a Vertex. | |
void | precedes (Scheduleable *consumer, const std::string &reason="") |
Have this Scheduleablee precede another. | |
void | precedes (Vertex *consumer, const std::string &reason="") const |
Have this Scheduleable precede a Vertex. | |
void | setGOP (bool gop) |
void | setGroupID (const PrecedenceGroup gid) |
bool | unlink (Scheduleable *w) |
Unlink this scheduleables vertex from another scheduleables vertex. | |
PrecedenceGroup | getGroupID () const |
Get the group ID. | |
void | cancel () |
Cancel all the times that this Scheduleable was placed on the Scheduler. | |
void | cancel (Clock::Cycle rel_cycle) |
Cancel this Scheduleable at the given time, if placed on the Scheduler. | |
void | setScheduleableClock (const Clock *clk) |
Set the clock and scheduler of this Scheduleable. | |
void | setScheduler (Scheduler *sched) |
Set the Scheduler of this Scheduleable, and set the local vertex_ to a new vertex from the Vertex Factory. | |
void | setVertex () |
Set the local vertex_ to a new vertex from the Vertex Factory. This needs to happen before the Scheduleable goes through the DAGs linking process in onSchedulerAssignment. | |
Static Public Attributes | |
static const PrecedenceGroup | INVALID_GROUP |
Protected Member Functions | |
uint32_t | getScheduleableHandleCount_ () const |
virtual void | setGroupID_ (const PrecedenceGroup gid) |
Set the group ID of this Scheduleable's derivatives. | |
virtual void | eventCancelled_ () |
Protected Attributes | |
SpartaHandler | consumer_event_handler_ |
The Consumer callback registered with the Event. | |
const Clock * | local_clk_ = nullptr |
A local clock for speed. | |
PrecedenceSetup | scheduler_ {this} |
Cache a pointer to the scheduler used. | |
Friends | |
class | Scheduler |
class | DAG |
class | Unit |
class | ScheduleableHandle |
A class that defines the basic scheduling interface to the Scheduler. Not intended to be used by modelers directly, but certainly can be.
This class is used by Event, PayloadEvent, UniqueEvent, etc to schedule an event on the SPARTA scheduler. The main goal of this class is to remain as light-weight as possible to allow a developer to possibly copy derivatives of this class for scheduling (like PayloadEvent proxy classes).
Definition at line 37 of file Scheduleable.hpp.
typedef uint32_t sparta::Scheduleable::PrecedenceGroup |
Typedef defining the precedence group ID.
Definition at line 42 of file Scheduleable.hpp.
sparta::Scheduleable::Scheduleable | ( | const SpartaHandler & | consumer_event_handler, |
Clock::Cycle | delay, | ||
SchedulingPhase | sched_phase, | ||
bool | is_unique_event = false |
||
) |
Construct a Scheduleable object.
consumer_event_handler | The scheduled callback placed on the Scheduler |
delay | Any delay of scheduling |
sched_phase | The scheduling phase for this Scheduleable |
is_unique_event | Is this Scheduleable uniquely scheduled (not scheduled more than once per tick)? |
|
inline |
Add to the delay for this event.
delay | The additional clock cycle delay |
Definition at line 95 of file Scheduleable.hpp.
|
inline |
Cancel all the times that this Scheduleable was placed on the Scheduler.
Definition at line 327 of file Scheduleable.hpp.
|
inline |
Cancel this Scheduleable at the given time, if placed on the Scheduler.
rel_cycle | The relative time to look for the event |
This will cancel all instances of this event at the given time.
Definition at line 339 of file Scheduleable.hpp.
|
inlineprotectedvirtual |
Called by the Scheduler to let this Scheduleable know it was canceled.
Definition at line 417 of file Scheduleable.hpp.
|
inline |
Get the delay associated with this event.
Definition at line 103 of file Scheduleable.hpp.
|
inline |
|
inline |
Get the consumer handler/callback associated with this event.
Definition at line 139 of file Scheduleable.hpp.
|
inline |
Get the consumer handler/callback associated with this event.
Definition at line 131 of file Scheduleable.hpp.
|
inline |
Get the internal label.
Definition at line 237 of file Scheduleable.hpp.
|
inlineprotected |
Return the number of outstanding handles pointing to this Scheduleable
Definition at line 397 of file Scheduleable.hpp.
|
inline |
Get the scheduler this Scheduleable is assigned to.
Definition at line 72 of file Scheduleable.hpp.
|
inline |
Get the scheduler this Scheduleable is assigned to.
Definition at line 78 of file Scheduleable.hpp.
|
inline |
Get the internal phase number.
Definition at line 232 of file Scheduleable.hpp.
|
inline |
get the internal Vertex of this scheduleable
Definition at line 246 of file Scheduleable.hpp.
|
inline |
Is this Event continuing?
Definition at line 123 of file Scheduleable.hpp.
|
inline |
Return true if this scheduleable was scheduled at all.
This is an expensive call as it searches all time quantums for instances of this Scheduleable object. Use with care.
Definition at line 214 of file Scheduleable.hpp.
|
inline |
Return true if this Scheduleable was scheduled on the given relative cycle.
rel_cycle | The relative clock cycle to check |
Definition at line 226 of file Scheduleable.hpp.
void sparta::Scheduleable::precedes | ( | Scheduleable & | consumer, |
const std::string & | reason = "" |
||
) |
Have this Scheduleable precede another.
consumer | The Scheduleable to follow this Scheduleable |
reason | The reason for the precedence |
this will preceed, or come before, the consumer
|
inline |
Have this Scheduleablee precede another.
consumer | The Scheduleable to follow this Scheduleable |
reason | The reason for the precedence |
this will preceed, or come before, the consumer
Definition at line 278 of file Scheduleable.hpp.
void sparta::Scheduleable::precedes | ( | Vertex & | consumer, |
const std::string & | reason = "" |
||
) | const |
Have this Scheduleable precede a Vertex.
consumer | The Vertex to follow this Scheduleable |
reason | The reason for the precedence |
this will preceed, or come before, the consumer
|
inline |
Have this Scheduleable precede a Vertex.
consumer | The Vertex to follow this Scheduleable |
reason | The reason for the precedence |
this will preceed, or come before, the consumer
Definition at line 290 of file Scheduleable.hpp.
|
inline |
Schedule this event with its pre-set delay using the pre-set Clock.
Definition at line 156 of file Scheduleable.hpp.
|
inline |
Schedule an event in the future using the pre-set Clock.
delay | The relative time (in Clock::Cycle) to schedule from "now" |
Definition at line 176 of file Scheduleable.hpp.
|
inline |
Schedule an event in the future using the given Clock.
delay | The relative time (in Ticks) to schedule from "now" |
clk | The clock this Event will use to schedule itself |
Definition at line 201 of file Scheduleable.hpp.
|
inline |
Schedule this event with its pre-set delay using the given clock.
clk | Pointer to the clock to use |
Definition at line 166 of file Scheduleable.hpp.
|
inlinevirtual |
Schedule this event on a relative scheduler tick.
rel_tick | A relative Scheduler::Tick in the future |
This method is typically not used in user-end models. Use the schedule methods instead.
Reimplemented in sparta::AsyncEvent< sched_phase_T >, and sparta::PhasedUniqueEvent.
Definition at line 188 of file Scheduleable.hpp.
|
inline |
This event, if continuing == true, will keep the simulation running.
If this event is NOT a continuing event, just simply scheduling it will NOT keep simulation running. This is useful for events like heartbeats, etc.
Definition at line 115 of file Scheduleable.hpp.
|
inline |
Set a fixed delay for this event.
delay | The clock cycle delay |
Definition at line 87 of file Scheduleable.hpp.
|
inline |
gop | Whether this Scheduleable is a GOP or not. A Scheduleable is never a GOP, this is a hack to get around code in Unit.cpp. TODO: elminate Unit.cpp code that used this. |
Definition at line 299 of file Scheduleable.hpp.
|
inline |
gid | Internal Group ID of this Scheduleable. |
Definition at line 305 of file Scheduleable.hpp.
|
inlineprotectedvirtual |
Set the group ID of this Scheduleable's derivatives.
gid | The group ID within the DAG this event should use |
Called by the DAG when setting up precedence.
Definition at line 408 of file Scheduleable.hpp.
|
inline |
Set the consumer handler/callback associated with this event.
handler | Reference to the new handler |
Definition at line 147 of file Scheduleable.hpp.
|
inline |
Set the clock and scheduler of this Scheduleable.
clck | The clock to be associated with this Scheduleable |
Definition at line 354 of file Scheduleable.hpp.
|
inline |
Set the Scheduler of this Scheduleable, and set the local vertex_ to a new vertex from the Vertex Factory.
sched | The Scheduler to be associated with this Scheduleable |
Definition at line 366 of file Scheduleable.hpp.
void sparta::Scheduleable::setVertex | ( | ) |
Set the local vertex_ to a new vertex from the Vertex Factory. This needs to happen before the Scheduleable goes through the DAGs linking process in onSchedulerAssignment.
sched | The Scheduler to be associated with this Scheduleable |
|
friend |
Definition at line 468 of file Scheduleable.hpp.
|
friend |
Definition at line 472 of file Scheduleable.hpp.
|
friend |
Definition at line 413 of file Scheduleable.hpp.
|
friend |
Definition at line 470 of file Scheduleable.hpp.
|
protected |
The Consumer callback registered with the Event.
Definition at line 390 of file Scheduleable.hpp.
|
static |
Definition at line 44 of file Scheduleable.hpp.
|
protected |
A local clock for speed.
Definition at line 393 of file Scheduleable.hpp.
|
protected |
Cache a pointer to the scheduler used.
Definition at line 465 of file Scheduleable.hpp.