X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fdev%2Fetherbus.cc;h=c9e9c93ba9895395d2ad878eacbfd532abf50c02;hb=bcb71963ebb3c226f4f36f6d5907c6fb3bc10b64;hp=906e324d391d8032dc6c5729bb16d5d0ded2fd6c;hpb=ba2eae5d528487900d1510fc0a160e660f2c394c;p=gem5.git diff --git a/src/dev/etherbus.cc b/src/dev/etherbus.cc index 906e324d3..c9e9c93ba 100644 --- a/src/dev/etherbus.cc +++ b/src/dev/etherbus.cc @@ -24,6 +24,8 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Nathan Binkert */ /* @file @@ -36,19 +38,20 @@ #include #include "base/trace.hh" +#include "debug/Ethernet.hh" +#include "debug/EthernetData.hh" #include "dev/etherbus.hh" #include "dev/etherdump.hh" #include "dev/etherint.hh" #include "dev/etherpkt.hh" -#include "sim/builder.hh" -#include "sim/root.hh" +#include "params/EtherBus.hh" +#include "sim/core.hh" using namespace std; -EtherBus::EtherBus(const string &name, double speed, bool loop, - EtherDump *packet_dump) - : SimObject(name), ticksPerByte(speed), loopback(loop), - event(&mainEventQueue, this), sender(0), dump(packet_dump) +EtherBus::EtherBus(const Params *p) + : EtherObject(p), ticksPerByte(p->speed), loopback(p->loopback), + event(this), sender(0), dump(p->dump) { } @@ -76,15 +79,17 @@ EtherBus::txDone() packet = 0; } -void -EtherBus::reg(EtherInt *dev) -{ devlist.push_back(dev); } +EtherInt* +EtherBus::getEthPort(const std::string &if_name, int idx) +{ + panic("Etherbus doesn't work\n"); +} bool EtherBus::send(EtherInt *sndr, EthPacketPtr &pkt) { if (busy()) { - DPRINTF(Ethernet, "ethernet packet not sent, bus busy\n", curTick); + DPRINTF(Ethernet, "ethernet packet not sent, bus busy\n", curTick()); return false; } @@ -96,30 +101,13 @@ EtherBus::send(EtherInt *sndr, EthPacketPtr &pkt) int delay = (int)ceil(((double)pkt->length * ticksPerByte) + 1.0); DPRINTF(Ethernet, "scheduling packet: delay=%d, (rate=%f)\n", delay, ticksPerByte); - event.schedule(curTick + delay); + schedule(event, curTick() + delay); return true; } -BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherBus) - - Param loopback; - Param speed; - SimObjectParam packet_dump; - -END_DECLARE_SIM_OBJECT_PARAMS(EtherBus) - -BEGIN_INIT_SIM_OBJECT_PARAMS(EtherBus) - - INIT_PARAM(loopback, "send the packet back to the sending interface"), - INIT_PARAM(speed, "bus speed in ticks per byte"), - INIT_PARAM(packet_dump, "object to dump network packets to") - -END_INIT_SIM_OBJECT_PARAMS(EtherBus) - -CREATE_SIM_OBJECT(EtherBus) +EtherBus * +EtherBusParams::create() { - return new EtherBus(getInstanceName(), speed, loopback, packet_dump); + return new EtherBus(this); } - -REGISTER_SIM_OBJECT("EtherBus", EtherBus)