configurable latency for programmed IO

fix serialization

dev/etherlink.cc:
    fix serialization

--HG--
extra : convert_revision : 6739001f3f97b745d9874bb4c5729cc4909625c2
This commit is contained in:
Nathan Binkert 2004-02-22 18:09:11 -05:00
parent e067bc751b
commit bc5ed80b32

View file

@ -88,15 +88,17 @@ EtherLink::Link::Link(const std::string &name, double rate, EtherDump *d)
void void
EtherLink::serialize(ostream &os) EtherLink::serialize(ostream &os)
{ {
nameOut(os, name() + ".link1");
link1->serialize(os); link1->serialize(os);
nameOut(os, name() + ".link2");
link2->serialize(os); link2->serialize(os);
} }
void void
EtherLink::unserialize(Checkpoint *cp, const string &section) EtherLink::unserialize(Checkpoint *cp, const string &section)
{ {
link1->unserialize(cp, section); link1->unserialize(cp, section + ".link1");
link2->unserialize(cp, section); link2->unserialize(cp, section + ".link2");
} }
void void
@ -139,36 +141,38 @@ EtherLink::Link::transmit(PacketPtr &pkt)
void void
EtherLink::Link::serialize(ostream &os) EtherLink::Link::serialize(ostream &os)
{ {
bool packetExists = false; bool packet_exists = packet;
if (packet) packetExists = true; SERIALIZE_SCALAR(packet_exists);
SERIALIZE_SCALAR(packetExists);
if (packetExists) {
nameOut(os, csprintf("%s.linkPacket", name()));
packet->serialize(os);
}
bool event_scheduled = event.scheduled(); bool event_scheduled = event.scheduled();
SERIALIZE_SCALAR(event_scheduled); SERIALIZE_SCALAR(event_scheduled);
if (event_scheduled) { if (event_scheduled) {
SERIALIZE_SCALAR(event.when()); Tick event_time = event.when();
SERIALIZE_SCALAR(event_time);
}
if (packet_exists) {
nameOut(os, csprintf("%s.packet", name()));
packet->serialize(os);
} }
} }
void void
EtherLink::Link::unserialize(Checkpoint *cp, const string &section) EtherLink::Link::unserialize(Checkpoint *cp, const string &section)
{ {
bool event_scheduled, packetExists; bool packet_exists;
Tick eventTime; UNSERIALIZE_SCALAR(packet_exists);
UNSERIALIZE_SCALAR(packetExists); if (packet_exists) {
if (packetExists) {
packet = new EtherPacket; packet = new EtherPacket;
packet->unserialize(cp, csprintf("%s.linkPacket", section)); packet->unserialize(cp, csprintf("%s.packet", section));
} }
bool event_scheduled;
UNSERIALIZE_SCALAR(event_scheduled); UNSERIALIZE_SCALAR(event_scheduled);
if (event_scheduled) { if (event_scheduled) {
UNSERIALIZE_SCALAR(eventTime); Tick event_time;
event.schedule(eventTime); UNSERIALIZE_SCALAR(event_time);
event.schedule(event_time);
} }
} }