50 #ifndef __DEV_DIST_ETHERLINK_HH__ 51 #define __DEV_DIST_ETHERLINK_HH__ 56 #include "params/DistEtherLink.hh" 89 objName(name), parent(p), localIface(nullptr), dump(d),
90 distIface(nullptr), event(e) {}
126 Link(name, p, d, &doneEvent), ticksPerByte(invBW),
127 delayVar(delay_var), doneEvent([this]{ txDone(); },
name) {}
166 Link(name, p, d, &_doneEvent), linkDelay(delay),
167 _doneEvent([this]{ rxDone(); },
name) {}
223 return dynamic_cast<const Params *
>(
_params);
229 virtual void init()
override;
230 virtual void startup()
override;
236 #endif // __DEV_DIST_ETHERLINK_HH__ Model for a receive link.
Ports are used to interface objects to each other.
const Params * params() const
bool recvPacket(EthPacketPtr pkt)
const PortID InvalidPortID
void serialize(CheckpointOut &cp) const override
Serialize an object.
Tick linkDelay
Transmission delay for the simulated Ethernet link.
DistEtherLink(const Params *p)
TxLink * txLink
Send link.
const std::string name() const
DistEtherLinkParams Params
Tick delayVar
Random component of the send delay.
DistIface * distIface
Interface to talk to the peer gem5 processes.
void setLocalInt(LocalIface *i)
uint64_t Tick
Tick count type.
Link(const std::string &name, DistEtherLink *p, EtherDump *d, Event *e)
const EventFunctionWrapper * doneEvent() const
Done events will be scheduled by DistIface (so we need the accessor)
EventFunctionWrapper _doneEvent
void setDistInt(DistIface *m)
Register the dist interface to be used to talk to the peer gem5 processes.
Model for a fixed bandwidth full duplex ethernet link.
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
RxLink(const std::string &name, DistEtherLink *p, Tick delay, EtherDump *d)
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
std::shared_ptr< EthPacketData > EthPacketPtr
Model base class for a single uni-directional link.
Basic support for object serialization.
virtual void startup() override
startup() is the final initialization call before simulation.
Interface to the local simulated system.
std::ostream CheckpointOut
const SimObjectParams * _params
Cached copy of the object parameters.
RxLink * rxLink
Receive link.
double ticksPerByte
Per byte send delay.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
EventFunctionWrapper doneEvent
The interface class to talk to peer gem5 processes.
TxLink(const std::string &name, DistEtherLink *p, double invBW, Tick delay_var, EtherDump *d)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Abstract superclass for simulation objects.
bool transmit(EthPacketPtr packet)
Initiate sending of a packet via this link.