41#include "debug/Ethernet.hh"
42#include "debug/EthernetData.hh"
46#include "params/EtherBus.hh"
53 :
SimObject(
p), ticksPerByte(
p.speed), loopback(
p.loopback),
54 event([this]{
txDone(); },
"ethernet bus completion"),
55 sender(0),
dump(
p.dump)
62 devlist_t::iterator
i =
devlist.begin();
63 devlist_t::iterator end =
devlist.end();
65 DPRINTF(Ethernet,
"ethernet packet received: length=%d\n",
packet->length);
86 panic(
"Etherbus doesn't work\n");
93 DPRINTF(Ethernet,
"ethernet packet not sent, bus busy\n",
curTick());
97 DPRINTF(Ethernet,
"ethernet packet sent: length=%d\n", pkt->length);
98 DDUMP(EthernetData, pkt->data, pkt->length);
102 int delay = (int)ceil(((
double)pkt->simLength *
ticksPerByte) + 1.0);
103 DPRINTF(Ethernet,
"scheduling packet: delay=%d, (rate=%f)\n",
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
EventFunctionWrapper event
EtherBus(const Params &p)
bool send(EtherInt *sender, EthPacketPtr &packet)
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void dump(EthPacketPtr &pkt)
virtual void sendDone()=0
Ports are used to interface objects to each other.
Abstract superclass for simulation objects.
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
void dump()
Dump all statistics data to the registered outputs.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick curTick()
The universal simulation clock.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
std::shared_ptr< EthPacketData > EthPacketPtr