summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/simple
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2012-09-18 22:46:34 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2012-09-18 22:46:34 -0500
commit86b1c0fd540b57c1e7bba948ad0417f22f90eb41 (patch)
treec4dc42939158c13b5eeff2f6809fa800c99e490b /src/mem/ruby/network/simple
parentd2b57a7473768e8aff3707916b40b264cab6821c (diff)
downloadgem5-86b1c0fd540b57c1e7bba948ad0417f22f90eb41.tar.xz
ruby: avoid using g_system_ptr for event scheduling
This patch removes the use of g_system_ptr for event scheduling. Each consumer object now needs to specify upfront an EventManager object it would use for scheduling events. This makes the ruby memory system more amenable for a multi-threaded simulation.
Diffstat (limited to 'src/mem/ruby/network/simple')
-rw-r--r--src/mem/ruby/network/simple/PerfectSwitch.cc1
-rw-r--r--src/mem/ruby/network/simple/Switch.cc4
-rw-r--r--src/mem/ruby/network/simple/Switch.hh2
-rw-r--r--src/mem/ruby/network/simple/Throttle.cc8
-rw-r--r--src/mem/ruby/network/simple/Throttle.hh5
5 files changed, 12 insertions, 8 deletions
diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc
index 66065e22c..0ead3ac30 100644
--- a/src/mem/ruby/network/simple/PerfectSwitch.cc
+++ b/src/mem/ruby/network/simple/PerfectSwitch.cc
@@ -49,6 +49,7 @@ operator<(const LinkOrder& l1, const LinkOrder& l2)
}
PerfectSwitch::PerfectSwitch(SwitchID sid, SimpleNetwork* network_ptr)
+ : Consumer(network_ptr)
{
m_virtual_networks = network_ptr->getNumberOfVirtualNetworks();
m_switch_id = sid;
diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc
index 922807a0b..42a4efae3 100644
--- a/src/mem/ruby/network/simple/Switch.cc
+++ b/src/mem/ruby/network/simple/Switch.cc
@@ -74,7 +74,8 @@ Switch::addOutPort(const vector<MessageBuffer*>& out,
// Create a throttle
throttle_ptr = new Throttle(m_switch_id, m_throttles.size(), link_latency,
- bw_multiplier, net_ptr->getEndpointBandwidth());
+ bw_multiplier, net_ptr->getEndpointBandwidth(),
+ net_ptr);
m_throttles.push_back(throttle_ptr);
// Create one buffer per vnet (these are intermediaryQueues)
@@ -214,4 +215,3 @@ Switch::print(std::ostream& out) const
// FIXME printing
out << "[Switch]";
}
-
diff --git a/src/mem/ruby/network/simple/Switch.hh b/src/mem/ruby/network/simple/Switch.hh
index 31ea6add1..0bc1e5eca 100644
--- a/src/mem/ruby/network/simple/Switch.hh
+++ b/src/mem/ruby/network/simple/Switch.hh
@@ -42,8 +42,6 @@
#include <iostream>
#include <vector>
-#include "mem/ruby/common/Global.hh"
-
class MessageBuffer;
class PerfectSwitch;
class NetDest;
diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc
index 05dfc2553..e4dc71527 100644
--- a/src/mem/ruby/network/simple/Throttle.cc
+++ b/src/mem/ruby/network/simple/Throttle.cc
@@ -49,14 +49,18 @@ const int PRIORITY_SWITCH_LIMIT = 128;
static int network_message_to_size(NetworkMessage* net_msg_ptr);
Throttle::Throttle(int sID, NodeID node, int link_latency,
- int link_bandwidth_multiplier, int endpoint_bandwidth)
+ int link_bandwidth_multiplier, int endpoint_bandwidth,
+ EventManager *em)
+ : Consumer(em)
{
init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
m_sID = sID;
}
Throttle::Throttle(NodeID node, int link_latency,
- int link_bandwidth_multiplier, int endpoint_bandwidth)
+ int link_bandwidth_multiplier, int endpoint_bandwidth,
+ EventManager *em)
+ : Consumer(em)
{
init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
m_sID = 0;
diff --git a/src/mem/ruby/network/simple/Throttle.hh b/src/mem/ruby/network/simple/Throttle.hh
index 37a53b80a..b86a247d2 100644
--- a/src/mem/ruby/network/simple/Throttle.hh
+++ b/src/mem/ruby/network/simple/Throttle.hh
@@ -53,9 +53,10 @@ class Throttle : public Consumer
{
public:
Throttle(int sID, NodeID node, int link_latency,
- int link_bandwidth_multiplier, int endpoint_bandwidth);
+ int link_bandwidth_multiplier, int endpoint_bandwidth,
+ EventManager *em);
Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier,
- int endpoint_bandwidth);
+ int endpoint_bandwidth, EventManager *em);
~Throttle() {}
std::string name()