The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::GlobalEvent< sched_phase_T > Class Template Reference

A type of "global" reusable event. More...

#include <GlobalEvent.hpp>

Public Member Functions

 GlobalEvent (const Clock *clk, const SpartaHandler &event_handler)
 Create a GlobalEvent.
 
 GlobalEvent (const GlobalEvent &rhs)
 
 GlobalEvent (GlobalEvent &&rhs)
 
GlobalEventoperator= (const GlobalEvent &rhs)
 
GlobalEventoperator= (GlobalEvent &&rhs)
 
void schedule (const Clock::Cycle &delay, const Clock *clk)
 
void schedule (const Clock::Cycle &delay)
 
void resetHandler (const SpartaHandler &event_handler)
 

Friends

class GlobalEventProxy
 

Detailed Description

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
class sparta::GlobalEvent< sched_phase_T >

A type of "global" reusable event.

This is to support dynamically created objects that require event semantics, but cannot create events. The original requirement comes from sparta::CoreExample: On the one hand, each dummy instruction contains a sparta::SharedData instance to represent and update its status. sparta::SharedData contains event handler to support "delayed update (from present-state to next-state)" semantics. On the other hand, the sparta::SharedData instance is required to be "copyable", since dummy instructions are created dynamically in the fetch unit. However, the original implementation of sparta::SharedData uses sparta::UniqueEvent, which is not copyable at run time.

To support this, the concept of "global" reusable events can be created, but with certain cautions in place: #. The Scheduleable being scheduled will be unique to a specific object requiring a timed call. #. The Scheduleable being scheduled might point to a dead callback (the originator of the event might be deallocated). #. The Scheduleable can be scheduled immediately, in the immediate future, or far into the future.

Definition at line 93 of file GlobalEvent.hpp.

Constructor & Destructor Documentation

◆ GlobalEvent() [1/3]

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
sparta::GlobalEvent< sched_phase_T >::GlobalEvent ( const Clock clk,
const SpartaHandler &  event_handler 
)
inline

Create a GlobalEvent.

Parameters
clkThe clock to which synchronized by this global event
event_handlerThe event handler of this global event

Definition at line 102 of file GlobalEvent.hpp.

◆ GlobalEvent() [2/3]

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
sparta::GlobalEvent< sched_phase_T >::GlobalEvent ( const GlobalEvent< sched_phase_T > &  rhs)
inline

Definition at line 109 of file GlobalEvent.hpp.

◆ GlobalEvent() [3/3]

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
sparta::GlobalEvent< sched_phase_T >::GlobalEvent ( GlobalEvent< sched_phase_T > &&  rhs)
inline

Definition at line 117 of file GlobalEvent.hpp.

◆ ~GlobalEvent()

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
sparta::GlobalEvent< sched_phase_T >::~GlobalEvent ( )
inline

Definition at line 164 of file GlobalEvent.hpp.

Member Function Documentation

◆ operator=() [1/2]

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
GlobalEvent & sparta::GlobalEvent< sched_phase_T >::operator= ( const GlobalEvent< sched_phase_T > &  rhs)
inline

Definition at line 126 of file GlobalEvent.hpp.

◆ operator=() [2/2]

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
GlobalEvent & sparta::GlobalEvent< sched_phase_T >::operator= ( GlobalEvent< sched_phase_T > &&  rhs)
inline

Definition at line 135 of file GlobalEvent.hpp.

◆ resetHandler()

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
void sparta::GlobalEvent< sched_phase_T >::resetHandler ( const SpartaHandler &  event_handler)
inline

Definition at line 160 of file GlobalEvent.hpp.

◆ schedule() [1/2]

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
void sparta::GlobalEvent< sched_phase_T >::schedule ( const Clock::Cycle &  delay)
inline

Definition at line 153 of file GlobalEvent.hpp.

◆ schedule() [2/2]

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
void sparta::GlobalEvent< sched_phase_T >::schedule ( const Clock::Cycle &  delay,
const Clock clk 
)
inline

Definition at line 146 of file GlobalEvent.hpp.

Friends And Related Symbol Documentation

◆ GlobalEventProxy

template<SchedulingPhase sched_phase_T = SchedulingPhase::Update>
friend class GlobalEventProxy
friend

Definition at line 168 of file GlobalEvent.hpp.


The documentation for this class was generated from the following file: