13#include "sparta/events/GlobalOrderingPoint.hpp"
136 template<
class ScheduleableTypeA>
137 typename std::enable_if<std::is_base_of<EventNode, ScheduleableTypeA>::value,
const GlobalOrderingPoint>::
140 producer.getScheduleable().precedes(*consumer.
getGOPoint());
171 template<
class ScheduleableTypeA>
172 typename std::enable_if<std::is_base_of<EventNode, ScheduleableTypeA>::value, ScheduleableTypeA>::
175 producer.
getGOPoint()->precedes(consumer.getScheduleable());
243#ifndef DO_NOT_DOCUMENT
244#define __SPARTA_PHASE_ERROR_MSG \
245 "\nERROR: You cannot set a precedence on two Scheduleable types" \
246 " that are on different phases. This will happen automatically by the framework."
298 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
330 template<
class DataT1,
336 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
368 template<
class DataT1,
374 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
406 template<
class DataT1,
412 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
450 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
488 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
526 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
571 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
608 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
645 static_assert(PayloadPhaseT1 == PayloadPhaseT2, __SPARTA_PHASE_ERROR_MSG);
680 template<SchedulingPhase PhaseT1, SchedulingPhase PhaseT2>
684 static_assert(PhaseT1 == PhaseT2, __SPARTA_PHASE_ERROR_MSG);
719 template<SchedulingPhase PhaseT1, SchedulingPhase PhaseT2>
722 static_assert(PhaseT1 == PhaseT2, __SPARTA_PHASE_ERROR_MSG);
762 template<
class EventT1,
class EventT2>
763 std::unique_ptr<EventT2> &
operator>>(std::unique_ptr<EventT1> & producer,
764 std::unique_ptr<EventT2> & consumer)
766 (*producer) >> (*consumer);
797 template<
class EventT1,
class EventT2>
798 std::unique_ptr<EventT2> &
operator>>(EventT1 & producer, std::unique_ptr<EventT2> & consumer)
800 producer >> (*consumer);
831 template<
class EventT1,
class EventT2>
832 EventT2 &
operator>>(std::unique_ptr<EventT1> & producer, EventT2 & consumer)
834 (*producer) >> consumer;
869 template<
class DataT2, SchedulingPhase phase>
874 __SPARTA_PHASE_ERROR_MSG);
906 template<
class DataT1, SchedulingPhase phase>
911 __SPARTA_PHASE_ERROR_MSG);
950 template<
class ScheduleableType>
952 std::enable_if<std::is_base_of<Scheduleable, ScheduleableType>::value, Bus>::
992 template<
class ScheduleableType>
994 std::enable_if<std::is_base_of<Scheduleable, ScheduleableType>::value, ScheduleableType>::
1046 typename std::enable_if<std::is_base_of<Port, ScheduleableT>::value,
void>::
1047 type addScheduable_(ScheduleableT & , ArgsT&... ) {
1048 static_assert(std::is_base_of<Port, ScheduleableT>::value,
1049 "\nERROR: You cannot set up a precedence between an Scheduleable type and a Port. "
1050 "\n\tIf you want to do this, register the Scheduleable with the Port using the "
1051 "registerConsumerEvent/registerProducingEvent method on the Port."
1052 "\n\tSee the SPARTA documentation for more information."
1053 "\n\tBTW, in this particular error, there is a Port type in the EventGroup that's bad");
1058 typename std::enable_if<std::is_base_of<sparta::Scheduleable, ScheduleableT>::value,
void>::
1059 type addScheduable_(ScheduleableT & sched, ArgsT&... scheds) {
1060 static_assert(phase == ScheduleableT::event_phase,
1061 "\nERROR: You cannot set a precedence on two Scheduleable types"
1062 " that are on different phases. This will happen automatically by the framework."
1063 "\n\tIn this particular error, there is a Scheduleable type in the EventGroup that's bad");
1064 emplace_back(&sched);
1065 addScheduable_<ScheduleableT::event_phase>(scheds...);
1071 static_assert(phase == PLEPhase,
1072 "\nERROR: You cannot set a precedence on two Scheduleable types"
1073 " that are on different phases. This will happen automatically by the framework."
1074 "\n\tIn this particular error, there is a PayloadEvent type in the EventGroup that's bad");
1075 emplace_back(&sched.getScheduleable());
1076 addScheduable_<PLEPhase>(scheds...);
1080 template<SchedulingPhase phase>
1081 void addScheduable_() {}
1098 template<
class ScheduleableT,
class ...ArgsT>
1100 static_assert(std::is_same<Port, ScheduleableT>::value ==
false,
1101 "\nERROR: You cannot add Ports to a precedence group as Ports do not support precedence. "
1102 "If you have a zero-cycle Port and a receiving event, register that event with the Port instead."
1103 "\n\tIn this particular error, there is a Port type in the EventGroup that's bad");
1104 static_assert(std::is_same<Bus, ScheduleableT>::value ==
false,
1105 "\nERROR: You cannot add a Bus to a precedence group as Buses do not support precedence directly. "
1106 "\n\tInstead, use Bus' inportsPrecede(event) or outportsSucceed(event) methods OR the >> operator.");
1107 addScheduable_<ScheduleableT::event_phase>(sched, scheds...);
1125 addScheduable_<PhaseT>(sched, scheds...);
1143 template<
class ScheduleableTypeB>
1145 ScheduleableTypeB & consumer)
1147 for(
auto & prod : producers) {
1148 prod->precedes(consumer);
1164 template<
class ScheduleableTypeA>
1168 for(
auto & cons : consumers) {
1169 producer.precedes(*cons);
1191 for(
auto & prod : producers) {
1192 for(
auto & cons : consumers) {
1193 sparta_assert(prod->getSchedulingPhase() == cons->getSchedulingPhase(),
1194 "The scheduling phase of '"
1195 << prod->getLabel() <<
"' phase '" << prod->getSchedulingPhase()
1196 <<
"' does not equal the scheduling phase of '"
1197 << cons->getLabel() <<
"' phase '" << cons->getSchedulingPhase()
1200 prod->precedes(cons);
File that defines the Bus, BusSet and helper binding classes.
File that defines the Event class.
File that defines the PayloadEvent class.
File that defines the Port base class.
File that defines the Scheduleable class.
File that defines the SingleCycleUniqueEvent class.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
File that defines the UniqueEvent class.
Class that defines a Bus type.
void inportsPrecede(EventT &event)
Make all inports precede the given event.
void outportsSucceed(EventT &event)
Make all outports succeed the given event.
Group a series of events together for precedence establishment.
EventGroup(ScheduleableT &sched, ArgsT &...scheds)
Construct the EventGroup.
EventGroup(PayloadEvent< DataT, PhaseT > &sched, ArgsT &...scheds)
Construct the EventGroup.
sparta::SchedulingPhase getSchedulingPhase() const
Get the scheduling phase of this event node.
virtual Scheduleable & getScheduleable()=0
Get the scheduleable associated with this event node.
Event is a simple class for scheduling random events on the Scheduler.
Scheduleable & getScheduleable() override
Get the scheduleable associated with this event node.
Used to set precedence between Scheduleable types across simulation.
DAG::GOPoint * getGOPoint() const
Used by the precedence rules.
Base class for all InPort types.
virtual Scheduleable & getScheduleable_()=0
Return the internally used Scheduleable for precedence.
Class to schedule a Scheduleable in the future with a payload, typed on both the data type and the sc...
Scheduleable & getScheduleable() override
Get the scheduleable associated with this event node.
void precedes(ScheduleableT &consumer, const std::string &reason="")
Have this SingleCycleUniqueEvent precede another.
A class that defines the basic scheduling interface to the Scheduler. Not intended to be used by mode...
void precedes(Scheduleable &consumer, const std::string &reason="")
Have this Scheduleable precede another.
SchedulingPhase getSchedulingPhase() const
Get the internal phase number.
An event that can only be schedule one cycle into the future.
A type of Event that uniquely schedules itself on the schedule within a single time quantum....
Macros for handling exponential backoff.
std::enable_if< std::is_base_of< EventNode, ScheduleableTypeA >::value, constGlobalOrderingPoint >::type & operator>>(ScheduleableTypeA &producer, const GlobalOrderingPoint &consumer)
Place a precedence between a Scheduleable object and a GlobalOrderingPoint.
SchedulingPhase
The SchedulingPhases used for events (Tick, Update, PortUpdate, etc)