43 #include "debug/Ethernet.hh" 44 #include "debug/EthernetData.hh" 48 #include "params/EtherBus.hh" 54 :
SimObject(p), ticksPerByte(p->speed), loopback(p->loopback),
55 event([this]{
txDone(); },
"ethernet bus completion"),
63 devlist_t::iterator
i =
devlist.begin();
64 devlist_t::iterator end =
devlist.end();
66 DPRINTF(Ethernet,
"ethernet packet received: length=%d\n",
packet->length);
87 panic(
"Etherbus doesn't work\n");
94 DPRINTF(Ethernet,
"ethernet packet not sent, bus busy\n",
curTick());
98 DPRINTF(Ethernet,
"ethernet packet sent: length=%d\n", pkt->length);
99 DDUMP(EthernetData, pkt->data, pkt->length);
103 int delay = (int)ceil(((
double)pkt->simLength *
ticksPerByte) + 1.0);
104 DPRINTF(Ethernet,
"scheduling packet: delay=%d, (rate=%f)\n",
105 delay, ticksPerByte);
112 EtherBusParams::create()
#define panic(...)
This implements a cprintf based panic() function.
Ports are used to interface objects to each other.
EventFunctionWrapper event
#define DDUMP(x, data, count)
EtherBus(const Params *p)
Overload hash function for BasicBlockRange type.
bool send(EtherInt *sender, EthPacketPtr &packet)
Tick curTick()
The current simulated tick.
void dump(EthPacketPtr &pkt)
std::shared_ptr< EthPacketData > EthPacketPtr
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
virtual void sendDone()=0
void schedule(Event &event, Tick when)
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Abstract superclass for simulation objects.