summaryrefslogtreecommitdiff
path: root/dev/etherbus.cc
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2005-04-14 16:06:34 -0400
committerKevin Lim <ktlim@umich.edu>2005-04-14 16:06:34 -0400
commit26d6d97f5d46bfe2cc5734eb632bec0bc67aed19 (patch)
treeed8a33f234ee4d85bc79f6179ea8907976ee3e70 /dev/etherbus.cc
parentdcedd7866e35adc1e0fbc081188b259ffc7bbdf5 (diff)
parent5e67b78af7f74d7223ced5b54978ca9fa29606c5 (diff)
downloadgem5-26d6d97f5d46bfe2cc5734eb632bec0bc67aed19.tar.xz
Merge ktlim@zizzer.eecs.umich.edu:/bk/m5
into zamp.eecs.umich.edu:/z/ktlim2/m5 --HG-- extra : convert_revision : 0baadd8d68bfa6f8e96307eb2d4426b0d9e0b8b4
Diffstat (limited to 'dev/etherbus.cc')
-rw-r--r--dev/etherbus.cc27
1 files changed, 12 insertions, 15 deletions
diff --git a/dev/etherbus.cc b/dev/etherbus.cc
index 82722383c..ab2314c02 100644
--- a/dev/etherbus.cc
+++ b/dev/etherbus.cc
@@ -45,12 +45,12 @@
using namespace std;
-EtherBus::EtherBus(const string &name, double rate, bool loop,
+EtherBus::EtherBus(const string &name, double speed, bool loop,
EtherDump *packet_dump)
- : SimObject(name), ticks_per_byte(rate), loopback(loop),
- event(&mainEventQueue, this),
- sender(0), dump(packet_dump)
-{ }
+ : SimObject(name), ticksPerByte(speed), loopback(loop),
+ event(&mainEventQueue, this), sender(0), dump(packet_dump)
+{
+}
void
EtherBus::txDone()
@@ -93,9 +93,9 @@ EtherBus::send(EtherInt *sndr, PacketPtr &pkt)
packet = pkt;
sender = sndr;
- int delay = (int)ceil(((double)pkt->length * ticks_per_byte) + 1.0);
+ int delay = (int)ceil(((double)pkt->length * ticksPerByte) + 1.0);
DPRINTF(Ethernet, "scheduling packet: delay=%d, (rate=%f)\n",
- delay, ticks_per_byte);
+ delay, ticksPerByte);
event.schedule(curTick + delay);
return true;
@@ -104,25 +104,22 @@ EtherBus::send(EtherInt *sndr, PacketPtr &pkt)
BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherBus)
Param<bool> loopback;
- Param<int> speed;
+ Param<double> speed;
SimObjectParam<EtherDump *> packet_dump;
END_DECLARE_SIM_OBJECT_PARAMS(EtherBus)
BEGIN_INIT_SIM_OBJECT_PARAMS(EtherBus)
- INIT_PARAM_DFLT(loopback,
- "send the packet back to the interface from which it came",
- true),
- INIT_PARAM_DFLT(speed, "bus speed in bits per second", 100000000),
- INIT_PARAM_DFLT(packet_dump, "object to dump network packets to", NULL)
+ 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)
{
- double rate = ((double)ticksPerSecond * 8.0) / (double)speed;
- return new EtherBus(getInstanceName(), rate, loopback, packet_dump);
+ return new EtherBus(getInstanceName(), speed, loopback, packet_dump);
}
REGISTER_SIM_OBJECT("EtherBus", EtherBus)