changeset a51ef09e3a78 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=a51ef09e3a78
description:
        ruby: simple network: store Switch* in PerfectSwitch and Throttle
        There are two reasons for doing so:

        a. provide a source of clock to PerfectSwitch. A follow on patch 
removes sender
        and receiver pointers from MessageBuffer means that the object owning 
the
        buffer should have some way of providing timing info.

        b. schedule events.  A follow on patch removes the consumer class.  So 
the
        PerfectSwitch needs some EventManager object to schedule events on its 
own.

diffstat:

 src/mem/ruby/network/simple/PerfectSwitch.cc |   3 +--
 src/mem/ruby/network/simple/PerfectSwitch.hh |   3 ++-
 src/mem/ruby/network/simple/Throttle.cc      |  26 +++++---------------------
 src/mem/ruby/network/simple/Throttle.hh      |  12 ++++++------
 4 files changed, 14 insertions(+), 30 deletions(-)

diffs (117 lines):

diff -r 4808f8c4a47e -r a51ef09e3a78 
src/mem/ruby/network/simple/PerfectSwitch.cc
--- a/src/mem/ruby/network/simple/PerfectSwitch.cc      Tue Sep 08 19:32:04 
2015 -0500
+++ b/src/mem/ruby/network/simple/PerfectSwitch.cc      Sat Sep 12 16:16:03 
2015 -0500
@@ -49,9 +49,8 @@
 }
 
 PerfectSwitch::PerfectSwitch(SwitchID sid, Switch *sw, uint32_t virt_nets)
-    : Consumer(sw)
+    : Consumer(sw), m_switch_id(sid), m_switch(sw)
 {
-    m_switch_id = sid;
     m_round_robin_start = 0;
     m_wakeups_wo_switch = 0;
     m_virtual_networks = virt_nets;
diff -r 4808f8c4a47e -r a51ef09e3a78 
src/mem/ruby/network/simple/PerfectSwitch.hh
--- a/src/mem/ruby/network/simple/PerfectSwitch.hh      Tue Sep 08 19:32:04 
2015 -0500
+++ b/src/mem/ruby/network/simple/PerfectSwitch.hh      Sat Sep 12 16:16:03 
2015 -0500
@@ -86,7 +86,8 @@
 
     void operateVnet(int vnet);
 
-    SwitchID m_switch_id;
+    const SwitchID m_switch_id;
+    Switch * const m_switch;
 
     // vector of queues from the components
     std::vector<std::vector<MessageBuffer*> > m_in;
diff -r 4808f8c4a47e -r a51ef09e3a78 src/mem/ruby/network/simple/Throttle.cc
--- a/src/mem/ruby/network/simple/Throttle.cc   Tue Sep 08 19:32:04 2015 -0500
+++ b/src/mem/ruby/network/simple/Throttle.cc   Sat Sep 12 16:16:03 2015 -0500
@@ -31,6 +31,7 @@
 #include "base/cast.hh"
 #include "base/cprintf.hh"
 #include "debug/RubyNetwork.hh"
+#include "mem/ruby/network/simple/Switch.hh"
 #include "mem/ruby/network/simple/Throttle.hh"
 #include "mem/ruby/network/MessageBuffer.hh"
 #include "mem/ruby/network/Network.hh"
@@ -48,27 +49,10 @@
 
 Throttle::Throttle(int sID, RubySystem *rs, NodeID node, Cycles link_latency,
                    int link_bandwidth_multiplier, int endpoint_bandwidth,
-                   ClockedObject *em)
-    : Consumer(em), m_ruby_system(rs)
+                   Switch *em)
+    : Consumer(em), m_switch_id(sID), m_switch(em), m_node(node),
+      m_ruby_system(rs)
 {
-    init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
-    m_sID = sID;
-}
-
-Throttle::Throttle(RubySystem *rs, NodeID node, Cycles link_latency,
-                   int link_bandwidth_multiplier, int endpoint_bandwidth,
-                   ClockedObject *em)
-    : Consumer(em), m_ruby_system(rs)
-{
-    init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
-    m_sID = 0;
-}
-
-void
-Throttle::init(NodeID node, Cycles link_latency,
-               int link_bandwidth_multiplier, int endpoint_bandwidth)
-{
-    m_node = node;
     m_vnets = 0;
 
     assert(link_bandwidth_multiplier > 0);
@@ -98,7 +82,7 @@
 
         // Set consumer and description
         in_ptr->setConsumer(this);
-        string desc = "[Queue to Throttle " + to_string(m_sID) + " " +
+        string desc = "[Queue to Throttle " + to_string(m_switch_id) + " " +
             to_string(m_node) + "]";
     }
 }
diff -r 4808f8c4a47e -r a51ef09e3a78 src/mem/ruby/network/simple/Throttle.hh
--- a/src/mem/ruby/network/simple/Throttle.hh   Tue Sep 08 19:32:04 2015 -0500
+++ b/src/mem/ruby/network/simple/Throttle.hh   Sat Sep 12 16:16:03 2015 -0500
@@ -47,20 +47,18 @@
 #include "mem/ruby/system/System.hh"
 
 class MessageBuffer;
+class Switch;
 
 class Throttle : public Consumer
 {
   public:
     Throttle(int sID, RubySystem *rs, NodeID node, Cycles link_latency,
              int link_bandwidth_multiplier, int endpoint_bandwidth,
-             ClockedObject *em);
-    Throttle(RubySystem *rs, NodeID node, Cycles link_latency,
-             int link_bandwidth_multiplier, int endpoint_bandwidth,
-             ClockedObject *em);
+             Switch *em);
     ~Throttle() {}
 
     std::string name()
-    { return csprintf("Throttle-%i", m_sID); }
+    { return csprintf("Throttle-%i", m_switch_id); }
 
     void addLinks(const std::vector<MessageBuffer*>& in_vec,
                   const std::vector<MessageBuffer*>& out_vec);
@@ -97,8 +95,10 @@
     unsigned int m_vnets;
     std::vector<int> m_units_remaining;
 
-    int m_sID;
+    const int m_switch_id;
+    Switch *m_switch;
     NodeID m_node;
+
     int m_link_bandwidth_multiplier;
     Cycles m_link_latency;
     int m_wakeups_wo_switch;
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to