Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add knob to turn off auto precedence for Events #537

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions sparta/sparta/events/EventNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,42 @@ namespace sparta
//! Get the scheduleable associated with this event node
virtual Scheduleable & getScheduleable() = 0;

/**
* \brief Turn on/off auto precedence for this EvendNode
* \param participate Set to true [default] if the EventNode is to
* participate in auto precedence establishment
* in sparta::Unit
*
* In sparta::Unit, registered sparta::Event types and Ports will
* have auto precedence established between them if the user
* of sparta::Unit allows it to do so. However, this might not
* be desired for some Events that are created by the modeler
* and internally bound before the sparta::Unit performs this
* setup. Calling this method with participate set to false,
* will prevent the assertion that the EventNode is be being
* registered after port binding.
*/
virtual void participateInAutoPrecedence(bool participate) {
participate_in_auto_precedence_ = participate;
}

//! \brief Does this EventNode participate in auto-precedence
//! establishment by sparta::Unit?
//! \return true if so, false otherwise
virtual bool doesParticipateInAutoPrecedence() const {
return participate_in_auto_precedence_;
}

private:

//! Make sure the parent is an EventNodeSet
void ensureParentIsEventSet_(sparta::TreeNode* parent);

//! Scheduling phase of this node
const sparta::SchedulingPhase sched_phase_;

//! Does this EventNode participate in auto precedence?
bool participate_in_auto_precedence_ = true;
};
}

Expand Down
6 changes: 6 additions & 0 deletions sparta/sparta/simulation/Unit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ namespace sparta {

for(auto & event_node : unit_event_set_.getEvents(sparta::SchedulingPhase::Tick))
{
// This EventNode does not participate auto precedence
// between InPorts and OutPorts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment needs updating

furuame marked this conversation as resolved.
Show resolved Hide resolved
if(!event_node->doesParticipateInAutoPrecedence()) {
continue;
}

// Go through all of the registered InPorts and set these
// ports to precede any events that are on the Tick phase.
// This is for 0-cycle precedence only.
Expand Down
Loading