The Sparta Modeling Framework
Loading...
Searching...
No Matches
Event.hpp
Go to the documentation of this file.
1// <Event.h> -*- C++ -*-
2
3
10#pragma once
11
12#include <set>
13#include <memory>
14
17
18namespace sparta
19{
20
40 template<SchedulingPhase sched_phase_T = SchedulingPhase::Tick>
41 class Event : public EventNode, public Scheduleable
42 {
43 public:
44 // The phase this Event was defined with
45 static constexpr SchedulingPhase event_phase = sched_phase_T;
46
47 // Bring in the Scheduleable's schedule methods
49
96 Event(TreeNode * event_set,
97 const std::string & name,
98 const SpartaHandler & consumer_event_handler,
99 Clock::Cycle delay = 0) :
100 EventNode(event_set, name, sched_phase_T),
101 Scheduleable(consumer_event_handler, delay, sched_phase_T),
102 fancy_name_(name + "[" + consumer_event_handler.getName() + "]")
103 {
106 setLabel(fancy_name_.c_str());
107 }
108
109 // Used by EventNode and auto-precedence. Return the
110 // Scheduleable (this)
112 return *this;
113 }
114
115 private:
116
118 void createResource_() override {
121 }
122
124 std::string fancy_name_;
125
126 };
127}
128
129
File that defines the EventNode class.
File that defines the Scheduleable class.
EventNode is the base class for all event types in SPARTA. Not to be used by the modeler....
Definition EventNode.hpp:36
static Scheduler * determineScheduler(const Clock *clk)
Center point of Scheduler location.
Definition EventNode.hpp:71
Event is a simple class for scheduling random events on the Scheduler.
Definition Event.hpp:42
Event(TreeNode *event_set, const std::string &name, const SpartaHandler &consumer_event_handler, Clock::Cycle delay=0)
Create a generic Event. This type of class is hardly used, but available.
Definition Event.hpp:96
Scheduleable & getScheduleable() override
Get the scheduleable associated with this event node.
Definition Event.hpp:111
A class that defines the basic scheduling interface to the Scheduler. Not intended to be used by mode...
void schedule()
Schedule this event with its pre-set delay using the pre-set Clock.
void setLabel(const char *label)
Set a new label for this Scheduleable – used in debugging.
PrecedenceSetup scheduler_
Cache a pointer to the scheduler used.
const Clock * local_clk_
A local clock for speed.
Node in a composite tree representing a sparta Tree item.
Definition TreeNode.hpp:205
const Clock * getClock() override
Walks up parents (starting with self) until a parent with an associated local clock is found,...
const std::string & getName() const override
Gets the name of this node.
Macros for handling exponential backoff.
SchedulingPhase
The SchedulingPhases used for events (Tick, Update, PortUpdate, etc)