12#include <unordered_map>
69 bool presume_zero_delay =
true) :
70 OutPort(portset, name, presume_zero_delay)
72 sparta_assert(name.length() != 0,
"You cannot have an unnamed port.");
101 void send(sparta::Clock::Cycle rel_time = 0);
112 std::vector <SignalInPort*> bound_in_ports_;
160 InPort(portset, name, phase),
169 "SignalInPort " << name <<
" does not have a clock");
170 sparta_assert(name.length() != 0,
"You cannot have an unnamed port.");
171 user_signal_delivery_.
227 user_signal_delivery_->setContinuing(continuing);
233 return user_signal_delivery_->getScheduleable();
236 void setProducerPrecedence_(Scheduleable * pd)
override final {
237 if(pd->getSchedulingPhase() == user_signal_delivery_->getSchedulingPhase()) {
238 pd->precedes(*user_signal_delivery_,
"Port::bind of OutPort to " +
getName() +
": '" +
239 pd->getLabel() +
"' is a registered driver");
243 void registerConsumerHandler_(
const SpartaHandler & handler)
override final {
246 <<
": The handler associated with the SignalInPort must not expect an argument: "
247 << handler.getName());
250 user_signal_delivery_->setLabel(handler_name_.c_str());
254 friend class SignalOutPort;
257 void bind_(Port * out)
override final
262 if(consumer->getSchedulingPhase() == user_signal_delivery_->getSchedulingPhase()) {
263 user_signal_delivery_->precedes(consumer,
"Port::bind(" +
getName() +
"->" + out->getName() +
"),'"
264 + consumer->getLabel() +
"' is registered driver");
283 void send_(sparta::Clock::Cycle rel_time)
285 const uint32_t total_delay = rel_time + port_delay_;
300 const Clock::Cycle port_delay_;
303 void receiveSignal_() {
312 std::string handler_name_;
321 std::unique_ptr<PhasedUniqueEvent> user_signal_delivery_;
332 throw SpartaException(
"ERROR: Attempt to bind to something that isn't a SignalOutPort: '" +
342 throw SpartaException(
"ERROR: Attempt to bind to something that isn't a SignalInPort: '" +
346 bound_in_ports_.push_back(inp);
352 "ERROR! Attempt to send data on unbound port: " <<
getLocation());
354 itr->send_(rel_time);
File that defines the DataContainer class.
File that defines the EventSet class.
File that defines the Port base class.
File that defines Precedence operator>> rules between EventNode types.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
#define SPARTA_EXPECT_TRUE(x)
A macro for hinting to the compiler a particular condition should be considered most likely true.
#define SPARTA_EXPECT_FALSE(x)
A macro for hinting to the compiler a particular condition should be considered most likely false.
#define CREATE_SPARTA_HANDLER(clname, meth)
File that defines the UniqueEvent class.
Scheduler * getScheduler() const
Used by DataInPort and SyncInPort, this class holds received data from these ports and remembers the ...
void setData_(const DataT &dat)
Set the data received.
Set of Events that a unit (or sparta::TreeNode, sparta::Resource) contains and are visible through a ...
Base class for all InPort types.
Scheduler * scheduler_
The scheduler used.
void bind(Port *out) override
Bind to an OutPort.
void checkSchedulerPhaseForZeroCycleDelivery_(const sparta::SchedulingPhase &user_callback_phase)
Common method for checking phasing.
virtual void bind_(Port *outp)
Called by the OutPort, remember the binding.
ScheduleableList port_consumers_
const Clock * receiver_clock_
The receiving clock.
Base class for all OutPort types.
void bind(Port *in) override
Bind to an InPort.
A type of Event that uniquely schedules itself on the schedule within a single time quantum....
The port interface used to bind port types together and defines a port behavior.
virtual void bind(Port *port)=0
Method to bind this Port to another, pointer style.
SpartaHandler explicit_consumer_handler_
Explicit consumer handler registered via registerConsumerHandler.
A class that defines the basic scheduling interface to the Scheduler. Not intended to be used by mode...
SchedulingPhase getCurrentSchedulingPhase() const
SignalInPort receives data from sender using a SignalOutPort.
Clock::Cycle getPortDelay() const override final
Get the port delay associated with this port.
SignalInPort(const SignalInPort &)=delete
No making copies.
SignalInPort(TreeNode *portset, const std::string &name, sparta::SchedulingPhase phase, sparta::Clock::Cycle delay)
Create an SignalInPort with the given name.
void bind(Port *out) override
Bind to an SignalOutPort.
SignalInPort(TreeNode *portset, const std::string &name, sparta::Clock::Cycle delay=0)
Construct a SignalInPort with a default delivery phase based on the delay.
void setContinuing(bool continuing) override final
SignalInPort & operator=(const SignalInPort &)=delete
No assignments.
SignalOutPort is used for transferring a simple signal to another module.
SignalOutPort & operator=(const SignalOutPort &)=delete
No assignments.
SignalOutPort(TreeNode *portset, const std::string &name, bool presume_zero_delay=true)
Construct an param.
void send(sparta::Clock::Cycle rel_time=0)
Send data to bound receivers.
void bind(Port *in) override
Bind to an SignalInPort.
SignalOutPort(const SignalOutPort &)=delete
No making copies!
Used to construct and throw a standard C++ exception. Inherits from std::exception.
Node in a composite tree representing a sparta Tree item.
std::string getLocation() const override final
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)
@ PortUpdate
N-cycle Ports are updated in this phase.
@ Tick
Most operations (combinational logic) occurs in this phase.