summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/simple
diff options
context:
space:
mode:
authorBrad Beckmann <Brad.Beckmann@amd.com>2011-04-28 17:18:14 -0700
committerBrad Beckmann <Brad.Beckmann@amd.com>2011-04-28 17:18:14 -0700
commit491cc1a9f40571180b49b5318d735109380dad17 (patch)
tree7282442301a9046662f9d4473b0c5cb69b829398 /src/mem/ruby/network/simple
parent8733ed4b7d3f4c138738c9636da1437e7724e9cc (diff)
downloadgem5-491cc1a9f40571180b49b5318d735109380dad17.tar.xz
network: moved network config params
Moved the buffer_size, endpoint_bandwidth, and adaptive_routing params out of the top-level parent network object and to only those networks that actually use those parameters.
Diffstat (limited to 'src/mem/ruby/network/simple')
-rw-r--r--src/mem/ruby/network/simple/SimpleNetwork.cc4
-rw-r--r--src/mem/ruby/network/simple/SimpleNetwork.hh8
-rw-r--r--src/mem/ruby/network/simple/SimpleNetwork.py4
-rw-r--r--src/mem/ruby/network/simple/Switch.cc7
-rw-r--r--src/mem/ruby/network/simple/Switch.hh3
-rw-r--r--src/mem/ruby/network/simple/Throttle.cc12
-rw-r--r--src/mem/ruby/network/simple/Throttle.hh12
7 files changed, 35 insertions, 15 deletions
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc
index 8829b2eb5..eb561b612 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.cc
+++ b/src/mem/ruby/network/simple/SimpleNetwork.cc
@@ -62,6 +62,10 @@ Network::createNetwork(int nodes)
SimpleNetwork::SimpleNetwork(const Params *p)
: Network(p)
{
+ m_buffer_size = p->buffer_size;
+ m_endpoint_bandwidth = p->endpoint_bandwidth;
+ m_adaptive_routing = p->adaptive_routing;
+
// Note: the parent Network Object constructor is called before the
// SimpleNetwork child constructor. Therefore, the member variables
// used below should already be initialized.
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.hh b/src/mem/ruby/network/simple/SimpleNetwork.hh
index 13a4b173e..093ed959e 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.hh
+++ b/src/mem/ruby/network/simple/SimpleNetwork.hh
@@ -53,6 +53,10 @@ class SimpleNetwork : public Network
void init();
+ int getBufferSize() { return m_buffer_size; }
+ int getEndpointBandwidth() { return m_endpoint_bandwidth; }
+ bool getAdaptiveRouting() {return m_adaptive_routing; }
+
void printStats(std::ostream& out) const;
void clearStats();
void printConfig(std::ostream& out) const;
@@ -107,6 +111,10 @@ class SimpleNetwork : public Network
std::vector<Switch*> m_switch_ptr_vector;
std::vector<MessageBuffer*> m_buffers_to_free;
std::vector<Switch*> m_endpoint_switches;
+
+ int m_buffer_size;
+ int m_endpoint_bandwidth;
+ bool m_adaptive_routing;
};
inline std::ostream&
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.py b/src/mem/ruby/network/simple/SimpleNetwork.py
index d8bf55a22..e9a3a1987 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.py
+++ b/src/mem/ruby/network/simple/SimpleNetwork.py
@@ -32,3 +32,7 @@ from Network import RubyNetwork
class SimpleNetwork(RubyNetwork):
type = 'SimpleNetwork'
+ buffer_size = Param.Int(0,
+ "default buffer size; 0 indicates infinite buffering");
+ endpoint_bandwidth = Param.Int(10000, "");
+ adaptive_routing = Param.Bool(False, "enable adaptive routing");
diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc
index 391e08724..bcc1347a3 100644
--- a/src/mem/ruby/network/simple/Switch.cc
+++ b/src/mem/ruby/network/simple/Switch.cc
@@ -33,9 +33,9 @@
#include "mem/protocol/Protocol.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/network/simple/PerfectSwitch.hh"
+#include "mem/ruby/network/simple/SimpleNetwork.hh"
#include "mem/ruby/network/simple/Switch.hh"
#include "mem/ruby/network/simple/Throttle.hh"
-#include "mem/ruby/network/Network.hh"
using namespace std;
using m5::stl_helpers::deletePointers;
@@ -69,10 +69,12 @@ Switch::addOutPort(const vector<MessageBuffer*>& out,
const NetDest& routing_table_entry, int link_latency, int bw_multiplier)
{
Throttle* throttle_ptr = NULL;
+ SimpleNetwork* net_ptr =
+ safe_cast<SimpleNetwork*>(RubySystem::getNetwork());
// Create a throttle
throttle_ptr = new Throttle(m_switch_id, m_throttles.size(), link_latency,
- bw_multiplier);
+ bw_multiplier, net_ptr->getEndpointBandwidth());
m_throttles.push_back(throttle_ptr);
// Create one buffer per vnet (these are intermediaryQueues)
@@ -81,7 +83,6 @@ Switch::addOutPort(const vector<MessageBuffer*>& out,
MessageBuffer* buffer_ptr = new MessageBuffer;
// Make these queues ordered
buffer_ptr->setOrdering(true);
- Network* net_ptr = RubySystem::getNetwork();
if (net_ptr->getBufferSize() > 0) {
buffer_ptr->resize(net_ptr->getBufferSize());
}
diff --git a/src/mem/ruby/network/simple/Switch.hh b/src/mem/ruby/network/simple/Switch.hh
index 6e80c8642..c7630f200 100644
--- a/src/mem/ruby/network/simple/Switch.hh
+++ b/src/mem/ruby/network/simple/Switch.hh
@@ -49,7 +49,6 @@ class PerfectSwitch;
class NetDest;
class SimpleNetwork;
class Throttle;
-class Network;
class Switch
{
@@ -79,7 +78,7 @@ class Switch
Switch& operator=(const Switch& obj);
PerfectSwitch* m_perfect_switch_ptr;
- Network* m_network_ptr;
+ SimpleNetwork* m_network_ptr;
std::vector<Throttle*> m_throttles;
std::vector<MessageBuffer*> m_buffers_to_free;
SwitchID m_switch_id;
diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc
index 905a7aa28..108dd843d 100644
--- a/src/mem/ruby/network/simple/Throttle.cc
+++ b/src/mem/ruby/network/simple/Throttle.cc
@@ -49,21 +49,22 @@ 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 link_bandwidth_multiplier, int endpoint_bandwidth)
{
- init(node, link_latency, link_bandwidth_multiplier);
+ init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
m_sID = sID;
}
Throttle::Throttle(NodeID node, int link_latency,
- int link_bandwidth_multiplier)
+ int link_bandwidth_multiplier, int endpoint_bandwidth)
{
- init(node, link_latency, link_bandwidth_multiplier);
+ init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
m_sID = 0;
}
void
-Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier)
+Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier,
+ int endpoint_bandwidth)
{
m_node = node;
m_vnets = 0;
@@ -71,6 +72,7 @@ Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier)
assert(link_bandwidth_multiplier > 0);
m_link_bandwidth_multiplier = link_bandwidth_multiplier;
m_link_latency = link_latency;
+ m_endpoint_bandwidth = endpoint_bandwidth;
m_wakeups_wo_switch = 0;
clearStats();
diff --git a/src/mem/ruby/network/simple/Throttle.hh b/src/mem/ruby/network/simple/Throttle.hh
index 0a1fc9a30..09eac79a8 100644
--- a/src/mem/ruby/network/simple/Throttle.hh
+++ b/src/mem/ruby/network/simple/Throttle.hh
@@ -54,8 +54,9 @@ class Throttle : public Consumer
{
public:
Throttle(int sID, NodeID node, int link_latency,
- int link_bandwidth_multiplier);
- Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier);
+ int link_bandwidth_multiplier, int endpoint_bandwidth);
+ Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier,
+ int endpoint_bandwidth);
~Throttle() {}
std::string name()
@@ -73,8 +74,7 @@ class Throttle : public Consumer
int
getLinkBandwidth() const
{
- return RubySystem::getNetwork()->getEndpointBandwidth() *
- m_link_bandwidth_multiplier;
+ return m_endpoint_bandwidth * m_link_bandwidth_multiplier;
}
int getLatency() const { return m_link_latency; }
@@ -89,7 +89,8 @@ class Throttle : public Consumer
void print(std::ostream& out) const;
private:
- void init(NodeID node, int link_latency, int link_bandwidth_multiplier);
+ void init(NodeID node, int link_latency, int link_bandwidth_multiplier,
+ int endpoint_bandwidth);
void addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr);
void linkUtilized(double ratio) { m_links_utilized += ratio; }
@@ -107,6 +108,7 @@ class Throttle : public Consumer
int m_link_bandwidth_multiplier;
int m_link_latency;
int m_wakeups_wo_switch;
+ int m_endpoint_bandwidth;
// For tracking utilization
Time m_ruby_start;