From 373d70980eabb4598ee1fcc9429e38ef15950e04 Mon Sep 17 00:00:00 2001 From: Ron Dreslinski Date: Fri, 20 Feb 2004 12:44:41 -0500 Subject: Add serialization for packets on the ethernet link, and for link events --HG-- extra : convert_revision : 0054dbc4a42dd38ff8bbf64af303bc509dd5aa8a --- dev/etherlink.hh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'dev/etherlink.hh') 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 §ion); }; /* @@ -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 §ion); + }; #endif // __ETHERLINK_HH__ -- cgit v1.2.3 From c74cb77fa40b09089a383fb961c5fb0ec030f3c7 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 5 Mar 2004 05:47:05 -0500 Subject: Add support for a propagation delay on the link. The electrical delay is more or less folded into the packet time, but an additional delay is possible representing crossing a long haul link, or some switches, etc. --HG-- extra : convert_revision : 8fd689c2a7e3051e77f47a4cd5f51c6999d92c8f --- dev/etherlink.hh | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'dev/etherlink.hh') diff --git a/dev/etherlink.hh b/dev/etherlink.hh index 8505570a6..3b1dd21bc 100644 --- a/dev/etherlink.hh +++ b/dev/etherlink.hh @@ -49,6 +49,7 @@ class EtherLink : public SimObject protected: class Interface; + friend class LinkDelayEvent; /* * Model for a single uni-directional link */ @@ -59,34 +60,26 @@ class EtherLink : public SimObject Interface *txint; Interface *rxint; - double ticks_per_byte; + double ticksPerByte; + Tick linkDelay; EtherDump *dump; protected: /* * Transfer is complete */ - class DoneEvent : public Event - { - protected: - Link *link; - - public: - DoneEvent(EventQueue *q, Link *l) - : Event(q), link(l) {} - virtual void process() { link->txDone(); } - virtual const char *description() - { return "ethernet link completion"; } - }; - - friend class DoneEvent; - DoneEvent event; PacketPtr packet; - void txDone(); + typedef EventWrapper DoneEvent; + friend class DoneEvent; + DoneEvent doneEvent; + + friend class LinkDelayEvent; + void txComplete(PacketPtr &packet); public: - Link(const std::string &name, double rate, EtherDump *dump); + Link(const std::string &name, double rate, Tick delay, + EtherDump *dump); ~Link() {} virtual const std::string name() const { return objName; } @@ -123,7 +116,7 @@ class EtherLink : public SimObject public: EtherLink(const std::string &name, EtherInt *i1, EtherInt *i2, - Tick speed, EtherDump *dump); + Tick speed, Tick delay, EtherDump *dump); virtual ~EtherLink(); virtual void serialize(std::ostream &os); -- cgit v1.2.3