summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2010-01-29 20:29:17 -0800
committerSteve Reinhardt <steve.reinhardt@amd.com>2010-01-29 20:29:17 -0800
commit98c94cfe3ce83634f3bad79ca18263f42e36ca6a (patch)
treeb299448162932c5574b87238a3b02a01efd14db6 /src/mem/ruby/network
parentb43994ba45b7805da0d1d9600e5cbb8332057403 (diff)
downloadgem5-98c94cfe3ce83634f3bad79ca18263f42e36ca6a.tar.xz
ruby: Convert most Ruby objects to M5 SimObjects.
The necessary companion conversion of Ruby objects generated by SLICC are converted to M5 SimObjects in the following patch, so this patch alone does not compile. Conversion of Garnet network models is also handled in a separate patch; that code is temporarily disabled from compiling to allow testing of interim code.
Diffstat (limited to 'src/mem/ruby/network')
-rw-r--r--src/mem/ruby/network/Network.cc38
-rw-r--r--src/mem/ruby/network/Network.hh10
-rw-r--r--src/mem/ruby/network/Network.py51
-rw-r--r--src/mem/ruby/network/SConscript2
-rw-r--r--src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc2
-rw-r--r--src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh2
-rw-r--r--src/mem/ruby/network/garnet-fixed-pipeline/SConscript3
-rw-r--r--src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.cc2
-rw-r--r--src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh2
-rw-r--r--src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh2
-rw-r--r--src/mem/ruby/network/garnet-flexible-pipeline/SConscript3
-rw-r--r--src/mem/ruby/network/orion/SConscript3
-rw-r--r--src/mem/ruby/network/simple/HierarchicalSwitchTopology.hh2
-rw-r--r--src/mem/ruby/network/simple/PtToPtTopology.hh2
-rw-r--r--src/mem/ruby/network/simple/SConscript2
-rw-r--r--src/mem/ruby/network/simple/SimpleNetwork.cc15
-rw-r--r--src/mem/ruby/network/simple/SimpleNetwork.hh8
-rw-r--r--src/mem/ruby/network/simple/SimpleNetwork.py5
-rw-r--r--src/mem/ruby/network/simple/Topology.cc25
-rw-r--r--src/mem/ruby/network/simple/Topology.hh11
-rw-r--r--src/mem/ruby/network/simple/Torus2DTopology.hh2
21 files changed, 129 insertions, 63 deletions
diff --git a/src/mem/ruby/network/Network.cc b/src/mem/ruby/network/Network.cc
index ac785f632..7c5883ee6 100644
--- a/src/mem/ruby/network/Network.cc
+++ b/src/mem/ruby/network/Network.cc
@@ -29,38 +29,26 @@
#include "mem/protocol/MachineType.hh"
#include "mem/ruby/network/Network.hh"
-Network::Network(const string & name)
- : m_name(name)
+Network::Network(const Params *p)
+ : SimObject(p)
{
- m_virtual_networks = 0;
- m_topology_ptr = NULL;
+ m_virtual_networks = p->number_of_virtual_networks;
+ m_topology_ptr = p->topology;
+ m_buffer_size = p->buffer_size;
+ m_endpoint_bandwidth = p->endpoint_bandwidth;
+ m_adaptive_routing = p->adaptive_routing;
+ m_link_latency = p->link_latency;
+ m_control_msg_size = p->control_msg_size;
+
+ assert(m_virtual_networks != 0);
+ assert(m_topology_ptr != NULL);
}
-void Network::init(const vector<string> & argv)
+void Network::init()
{
m_nodes = MachineType_base_number(MachineType_NUM); // Total nodes in network
- for (size_t i=0; i<argv.size(); i+=2) {
- if (argv[i] == "number_of_virtual_networks")
- m_virtual_networks = atoi(argv[i+1].c_str());
- else if (argv[i] == "topology")
- m_topology_ptr = RubySystem::getTopology(argv[i+1]);
- else if (argv[i] == "buffer_size")
- m_buffer_size = atoi(argv[i+1].c_str());
- else if (argv[i] == "endpoint_bandwidth")
- m_endpoint_bandwidth = atoi(argv[i+1].c_str());
- else if (argv[i] == "adaptive_routing")
- m_adaptive_routing = (argv[i+1]=="true");
- else if (argv[i] == "link_latency")
- m_link_latency = atoi(argv[i+1].c_str());
- else if (argv[i] == "control_msg_size")
- m_control_msg_size = atoi(argv[i+1].c_str());
- }
-
m_data_msg_size = RubySystem::getBlockSizeBytes() + m_control_msg_size;
-
- assert(m_virtual_networks != 0);
- assert(m_topology_ptr != NULL);
}
int Network::MessageSizeType_to_int(MessageSizeType size_type)
diff --git a/src/mem/ruby/network/Network.hh b/src/mem/ruby/network/Network.hh
index e7c86b6b2..be0ab72db 100644
--- a/src/mem/ruby/network/Network.hh
+++ b/src/mem/ruby/network/Network.hh
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -50,17 +49,20 @@
#include "mem/ruby/system/NodeID.hh"
#include "mem/protocol/MessageSizeType.hh"
#include "mem/ruby/system/System.hh"
+#include "sim/sim_object.hh"
+#include "params/RubyNetwork.hh"
class NetDest;
class MessageBuffer;
class Throttle;
class Topology;
-class Network {
+class Network : public SimObject {
public:
// Constructors
- Network(const string & name);
- virtual void init(const vector<string> & argv);
+ typedef RubyNetworkParams Params;
+ Network(const Params *p);
+ virtual void init();
// Destructor
virtual ~Network() {}
diff --git a/src/mem/ruby/network/Network.py b/src/mem/ruby/network/Network.py
new file mode 100644
index 000000000..94115ebe8
--- /dev/null
+++ b/src/mem/ruby/network/Network.py
@@ -0,0 +1,51 @@
+# Copyright (c) 2009 Advanced Micro Devices, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Steve Reinhardt
+# Brad Beckmann
+
+from m5.params import *
+from m5.SimObject import SimObject
+
+class Topology(SimObject):
+ type = 'Topology'
+ connections = Param.String("")
+ print_config = Param.Bool(False,
+ "display topology config in the stats file")
+
+class RubyNetwork(SimObject):
+ type = 'RubyNetwork'
+ cxx_class = 'Network'
+ abstract = True
+ number_of_virtual_networks = Param.Int(10, "");
+ topology = Param.Topology("");
+ buffer_size = Param.Int(0,
+ "default buffer size; 0 indicates infinite buffering");
+ endpoint_bandwidth = Param.Int(10000, "");
+ adaptive_routing = Param.Bool(True, "");
+ link_latency = Param.Int(1,
+ "local memory latency ?? NetworkLinkLatency");
+ control_msg_size = Param.Int(8, "");
diff --git a/src/mem/ruby/network/SConscript b/src/mem/ruby/network/SConscript
index 3c4cdfbc2..28151e5cb 100644
--- a/src/mem/ruby/network/SConscript
+++ b/src/mem/ruby/network/SConscript
@@ -33,4 +33,6 @@ Import('*')
if not env['RUBY']:
Return()
+SimObject('Network.py')
+
Source('Network.cc')
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc
index df643e800..716cfb9ad 100644
--- a/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc
+++ b/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc
@@ -43,7 +43,7 @@ GarnetNetwork_d::GarnetNetwork_d(const string & name)
{
}
-void GarnetNetwork_d::init(const vector<string> & argv)
+void GarnetNetwork_d::init()
{
Network::init(argv);
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh
index 997f5e374..33f13b836 100644
--- a/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh
+++ b/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh
@@ -50,7 +50,7 @@ public:
~GarnetNetwork_d();
- void init(const vector<string> & argv);
+ void init();
//added by SS
NetworkConfig* getNetworkConfig() { return m_network_config_ptr; }
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/SConscript b/src/mem/ruby/network/garnet-fixed-pipeline/SConscript
index 0814df2f5..84f4ba378 100644
--- a/src/mem/ruby/network/garnet-fixed-pipeline/SConscript
+++ b/src/mem/ruby/network/garnet-fixed-pipeline/SConscript
@@ -30,6 +30,9 @@
Import('*')
+# temporarily disable
+Return()
+
if not env['RUBY']:
Return()
diff --git a/src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.cc
index 5a6b610f9..b2a385843 100644
--- a/src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.cc
@@ -44,7 +44,7 @@ GarnetNetwork::GarnetNetwork(const string & name)
{
}
-void GarnetNetwork::init(const vector<string> & argv)
+void GarnetNetwork::init()
{
// printf("hello\n");
Network::init(argv);
diff --git a/src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh
index c0e4ac6e4..fbebcc7bd 100644
--- a/src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh
@@ -49,7 +49,7 @@ public:
~GarnetNetwork();
- void init(const vector<string> & argv);
+ void init();
//added by SS
NetworkConfig* getNetworkConfig() { return m_network_config_ptr; }
diff --git a/src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh b/src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh
index 2080ef022..b23e9a88a 100644
--- a/src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh
+++ b/src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh
@@ -48,7 +48,7 @@ class NetworkConfig {
bool m_using_network_testing;
public:
NetworkConfig(){}
- void init(const vector<string> & argv) {
+ void init() {
for (size_t i=0; i<argv.size(); i+=2) {
if (argv[i] == "flit_size")
m_flit_size = atoi(argv[i+1].c_str());
diff --git a/src/mem/ruby/network/garnet-flexible-pipeline/SConscript b/src/mem/ruby/network/garnet-flexible-pipeline/SConscript
index a376bf10f..e132741ca 100644
--- a/src/mem/ruby/network/garnet-flexible-pipeline/SConscript
+++ b/src/mem/ruby/network/garnet-flexible-pipeline/SConscript
@@ -30,6 +30,9 @@
Import('*')
+# temporarily disable
+Return()
+
if not env['RUBY']:
Return()
diff --git a/src/mem/ruby/network/orion/SConscript b/src/mem/ruby/network/orion/SConscript
index 99b38bc22..62d5dfef5 100644
--- a/src/mem/ruby/network/orion/SConscript
+++ b/src/mem/ruby/network/orion/SConscript
@@ -30,6 +30,9 @@
Import('*')
+# temporarily disable
+Return()
+
if not env['RUBY']:
Return()
diff --git a/src/mem/ruby/network/simple/HierarchicalSwitchTopology.hh b/src/mem/ruby/network/simple/HierarchicalSwitchTopology.hh
index 0c2c84ef8..1b5627206 100644
--- a/src/mem/ruby/network/simple/HierarchicalSwitchTopology.hh
+++ b/src/mem/ruby/network/simple/HierarchicalSwitchTopology.hh
@@ -8,7 +8,7 @@ class HierarchicalSwitchTopology : public Topology
{
public:
HierarchicalSwitchTopology(const string & name);
- void init(const vector<string> & argv);
+ void init();
protected:
void construct();
diff --git a/src/mem/ruby/network/simple/PtToPtTopology.hh b/src/mem/ruby/network/simple/PtToPtTopology.hh
index f15fa5956..f3c57d0a0 100644
--- a/src/mem/ruby/network/simple/PtToPtTopology.hh
+++ b/src/mem/ruby/network/simple/PtToPtTopology.hh
@@ -8,7 +8,7 @@ class PtToPtTopology : public Topology
{
public:
PtToPtTopology(const string & name);
- void init(const vector<string> & argv);
+ void init();
protected:
void construct();
diff --git a/src/mem/ruby/network/simple/SConscript b/src/mem/ruby/network/simple/SConscript
index 3df736c00..1c952abf4 100644
--- a/src/mem/ruby/network/simple/SConscript
+++ b/src/mem/ruby/network/simple/SConscript
@@ -33,6 +33,8 @@ Import('*')
if not env['RUBY']:
Return()
+SimObject('SimpleNetwork.py')
+
Source('PerfectSwitch.cc')
Source('SimpleNetwork.cc')
Source('Switch.cc')
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc
index adf7ee21e..bbc9cefdb 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.cc
+++ b/src/mem/ruby/network/simple/SimpleNetwork.cc
@@ -59,17 +59,17 @@ Network* Network::createNetwork(int nodes)
}
*/
-SimpleNetwork::SimpleNetwork(const string & name)
- : Network(name)
+SimpleNetwork::SimpleNetwork(const Params *p)
+ : Network(p)
{
m_virtual_networks = 0;
m_topology_ptr = NULL;
}
-void SimpleNetwork::init(const vector<string> & argv)
+void SimpleNetwork::init()
{
- Network::init(argv);
+ Network::init();
m_endpoint_switches.setSize(m_nodes);
@@ -263,3 +263,10 @@ void SimpleNetwork::print(ostream& out) const
{
out << "[SimpleNetwork]";
}
+
+
+SimpleNetwork *
+SimpleNetworkParams::create()
+{
+ return new SimpleNetwork(this);
+}
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.hh b/src/mem/ruby/network/simple/SimpleNetwork.hh
index 9ffd862d3..76070538f 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.hh
+++ b/src/mem/ruby/network/simple/SimpleNetwork.hh
@@ -73,6 +73,8 @@
#include "mem/gems_common/Vector.hh"
#include "mem/ruby/network/Network.hh"
#include "mem/ruby/system/NodeID.hh"
+#include "sim/sim_object.hh"
+#include "params/SimpleNetwork.hh"
class NetDest;
class MessageBuffer;
@@ -83,13 +85,13 @@ class Topology;
class SimpleNetwork : public Network {
public:
// Constructors
- // SimpleNetwork(int nodes);
- SimpleNetwork(const string & name);
+ typedef SimpleNetworkParams Params;
+ SimpleNetwork(const Params *p);
// Destructor
~SimpleNetwork();
- void init(const vector<string> & argv);
+ void init();
// Public Methods
void printStats(ostream& out) const;
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.py b/src/mem/ruby/network/simple/SimpleNetwork.py
new file mode 100644
index 000000000..9fd25c38c
--- /dev/null
+++ b/src/mem/ruby/network/simple/SimpleNetwork.py
@@ -0,0 +1,5 @@
+from m5.params import *
+from Network import RubyNetwork
+
+class SimpleNetwork(RubyNetwork):
+ type = 'SimpleNetwork'
diff --git a/src/mem/ruby/network/simple/Topology.cc b/src/mem/ruby/network/simple/Topology.cc
index 563a1b01c..9d636df49 100644
--- a/src/mem/ruby/network/simple/Topology.cc
+++ b/src/mem/ruby/network/simple/Topology.cc
@@ -62,26 +62,18 @@ static Matrix shortest_path(const Matrix& weights, Matrix& latencies, Matrix& in
static bool link_is_shortest_path_to_node(SwitchID src, SwitchID next, SwitchID final, const Matrix& weights, const Matrix& dist);
static NetDest shortest_path_to_node(SwitchID src, SwitchID next, const Matrix& weights, const Matrix& dist);
-Topology::Topology(const string & name)
- : m_name(name)
+Topology::Topology(const Params *p)
+ : SimObject(p)
{
- m_network_ptr = NULL;
+// m_network_ptr = p->network;
+ m_connections = p->connections;
+ m_print_config = p->print_config;
m_nodes = MachineType_base_number(MachineType_NUM);
m_number_of_switches = 0;
}
-void Topology::init(const vector<string> & argv)
+void Topology::init()
{
- for (size_t i=0; i<argv.size(); i+=2) {
- if (argv[i] == "network")
- m_network_ptr = RubySystem::getNetwork();
- else if (argv[i] == "connections")
- m_connections = argv[i+1];
- else if (argv[i] == "print_config") {
- m_print_config = string_to_bool(argv[i+1]);
- }
- }
- assert(m_network_ptr != NULL);
}
void Topology::makeTopology()
@@ -457,3 +449,8 @@ static NetDest shortest_path_to_node(SwitchID src, SwitchID next,
return result;
}
+Topology *
+TopologyParams::create()
+{
+ return new Topology(this);
+}
diff --git a/src/mem/ruby/network/simple/Topology.hh b/src/mem/ruby/network/simple/Topology.hh
index 0f8cdff3b..6562bdb70 100644
--- a/src/mem/ruby/network/simple/Topology.hh
+++ b/src/mem/ruby/network/simple/Topology.hh
@@ -50,22 +50,24 @@
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh"
#include "mem/ruby/system/NodeID.hh"
+#include "sim/sim_object.hh"
+#include "params/Topology.hh"
class Network;
class NetDest;
typedef Vector < Vector <int> > Matrix;
-class Topology {
+class Topology : public SimObject {
public:
// Constructors
- // Topology(Network* network_ptr, int number_of_nodes);
- Topology(const string & name);
+ typedef TopologyParams Params;
+ Topology(const Params *p);
// Destructor
virtual ~Topology() {}
- virtual void init(const vector<string> & argv);
+ virtual void init();
// Public Methods
void makeTopology();
@@ -80,7 +82,6 @@ public:
protected:
// Private Methods
- void init();
SwitchID newSwitchID();
void addLink(SwitchID src, SwitchID dest, int link_latency);
void addLink(SwitchID src, SwitchID dest, int link_latency, int bw_multiplier);
diff --git a/src/mem/ruby/network/simple/Torus2DTopology.hh b/src/mem/ruby/network/simple/Torus2DTopology.hh
index 83a314e94..bc50f161a 100644
--- a/src/mem/ruby/network/simple/Torus2DTopology.hh
+++ b/src/mem/ruby/network/simple/Torus2DTopology.hh
@@ -8,7 +8,7 @@ class Torus2DTopology : public Topology
{
public:
Torus2DTopology(const string & name);
- void init(const vector<string> & argv);
+ void init();
protected:
void construct();