summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Dreslinski <rdreslin@umich.edu>2004-02-20 12:45:11 -0500
committerRon Dreslinski <rdreslin@umich.edu>2004-02-20 12:45:11 -0500
commitee799f47d5ae2ce10bd8b307cfd74c483ec86a94 (patch)
tree8755cf0c5a49e3627390545f0c3f34beaa4c08e1
parent5e494f0c5910d91d50e49e50c60f88e85d373e41 (diff)
parent373d70980eabb4598ee1fcc9429e38ef15950e04 (diff)
downloadgem5-ee799f47d5ae2ce10bd8b307cfd74c483ec86a94.tar.xz
Merge zizzer:/bk/m5 into zamp.eecs.umich.edu:/z/rdreslin/m5bk/clean
--HG-- extra : convert_revision : b8e4d9c2901c4c784ecca351fd34a3f5a2845473
-rw-r--r--dev/etherlink.cc51
-rw-r--r--dev/etherlink.hh7
2 files changed, 58 insertions, 0 deletions
diff --git a/dev/etherlink.cc b/dev/etherlink.cc
index 676b1da1c..7c70b82ce 100644
--- a/dev/etherlink.cc
+++ b/dev/etherlink.cc
@@ -42,6 +42,7 @@
#include "dev/etherpkt.hh"
#include "sim/builder.hh"
#include "sim/universe.hh"
+#include "sim/system.hh"
using namespace std;
@@ -85,6 +86,20 @@ EtherLink::Link::Link(const std::string &name, double rate, EtherDump *d)
{}
void
+EtherLink::serialize(ostream &os)
+{
+ link1->serialize(os);
+ link2->serialize(os);
+}
+
+void
+EtherLink::unserialize(Checkpoint *cp, const string &section)
+{
+ link1->unserialize(cp, section);
+ link2->unserialize(cp, section);
+}
+
+void
EtherLink::Link::txDone()
{
if (dump)
@@ -121,6 +136,42 @@ EtherLink::Link::transmit(PacketPtr &pkt)
return true;
}
+void
+EtherLink::Link::serialize(ostream &os)
+{
+ bool packetExists = false;
+ if (packet) packetExists = true;
+ SERIALIZE_SCALAR(packetExists);
+ if (packetExists) {
+ nameOut(os, csprintf("%s.linkPacket", name()));
+ packet->serialize(os);
+ }
+
+ bool event_scheduled = event.scheduled();
+ SERIALIZE_SCALAR(event_scheduled);
+ if (event_scheduled) {
+ SERIALIZE_SCALAR(event.when());
+ }
+}
+
+void
+EtherLink::Link::unserialize(Checkpoint *cp, const string &section)
+{
+ bool event_scheduled, packetExists;
+ Tick eventTime;
+ UNSERIALIZE_SCALAR(packetExists);
+ if (packetExists) {
+ packet = new EtherPacket;
+ packet->unserialize(cp, csprintf("%s.linkPacket", section));
+ }
+
+ UNSERIALIZE_SCALAR(event_scheduled);
+ if (event_scheduled) {
+ UNSERIALIZE_SCALAR(eventTime);
+ event.schedule(eventTime);
+ }
+}
+
BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherLink)
SimObjectParam<EtherInt *> interface1;
diff --git a/dev/etherlink.hh b/dev/etherlink.hh
index e1a7957ee..8505570a6 100644
--- a/dev/etherlink.hh
+++ b/dev/etherlink.hh
@@ -96,6 +96,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);
};
/*
@@ -122,6 +125,10 @@ class EtherLink : public SimObject
EtherLink(const std::string &name, EtherInt *i1, EtherInt *i2,
Tick speed, EtherDump *dump);
virtual ~EtherLink();
+
+ virtual void serialize(std::ostream &os);
+ virtual void unserialize(Checkpoint *cp, const std::string &section);
+
};
#endif // __ETHERLINK_HH__