summaryrefslogtreecommitdiff
path: root/dev/etherlink.hh
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-03-08 12:47:55 -0500
committerNathan Binkert <binkertn@umich.edu>2005-03-08 12:47:55 -0500
commitb9c847563d9c10164e015feef8ef25ce76551843 (patch)
treef9a4242c6f15451c34ddbf2af05fa1189010b093 /dev/etherlink.hh
parent47dec0f411c041c05b35a3b1a8c5b050845ce9e0 (diff)
downloadgem5-b9c847563d9c10164e015feef8ef25ce76551843.tar.xz
Fix serialization of the EtherLink object
dev/etherlink.cc: - The EtherLink::Link object is no lonver serializable, so it is now necessary to prepend the object's name (as determined by the parent) to all parameters. - Fix the serialization of the LinkDelayEvent so it actually works - Rename some variables to make serialization simpler dev/etherlink.hh: - Make the EtherLink::Link object *not* derive from serializeable. Instead, the serialize function will take a base name from the parent EtherLink object and prepend that base name to each of its variable names when serializing. This is similar to the PacketData and PacketFifo classes. - Make the EtherLink::Link object keep a pointer to its parent and its link number so the LinkDelayEvent can be properly serialized. - Rename some variables to make serialization simpler. --HG-- extra : convert_revision : e5aa54cd9e07b5e033989809100e1640abfb8bed
Diffstat (limited to 'dev/etherlink.hh')
-rw-r--r--dev/etherlink.hh28
1 files changed, 15 insertions, 13 deletions
diff --git a/dev/etherlink.hh b/dev/etherlink.hh
index d5cd7d7c8..28ab61301 100644
--- a/dev/etherlink.hh
+++ b/dev/etherlink.hh
@@ -40,7 +40,7 @@
#include "sim/sim_object.hh"
class EtherDump;
-
+class Checkpoint;
/*
* Model for a fixed bandwidth full duplex ethernet link
*/
@@ -53,10 +53,14 @@ class EtherLink : public SimObject
/*
* Model for a single uni-directional link
*/
- class Link : public Serializable {
+ class Link
+ {
protected:
std::string objName;
+ EtherLink *parent;
+ int number;
+
Interface *txint;
Interface *rxint;
@@ -78,11 +82,11 @@ class EtherLink : public SimObject
void txComplete(PacketPtr packet);
public:
- Link(const std::string &name, double rate, Tick delay,
- EtherDump *dump);
+ Link(const std::string &name, EtherLink *p, int num,
+ double rate, Tick delay, EtherDump *dump);
~Link() {}
- virtual const std::string name() const { return objName; }
+ const std::string name() const { return objName; }
bool busy() const { return (bool)packet; }
bool transmit(PacketPtr packet);
@@ -90,8 +94,9 @@ class EtherLink : public SimObject
void setTxInt(Interface *i) { assert(!txint); txint = i; }
void setRxInt(Interface *i) { assert(!rxint); rxint = i; }
- virtual void serialize(std::ostream &os);
- virtual void unserialize(Checkpoint *cp, const std::string &section);
+ void serialize(const std::string &base, std::ostream &os);
+ void unserialize(const std::string &base, Checkpoint *cp,
+ const std::string &section);
};
/*
@@ -108,14 +113,11 @@ class EtherLink : public SimObject
void sendDone() { peer->sendDone(); }
};
- Link *link1;
- Link *link2;
-
- EtherInt *int1;
- EtherInt *int2;
+ Link *link[2];
+ EtherInt *interface[2];
public:
- EtherLink(const std::string &name, EtherInt *i1, EtherInt *i2,
+ EtherLink(const std::string &name, EtherInt *peer0, EtherInt *peer1,
Tick speed, Tick delay, EtherDump *dump);
virtual ~EtherLink();