diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2010-01-29 20:29:17 -0800 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2010-01-29 20:29:17 -0800 |
commit | 98c94cfe3ce83634f3bad79ca18263f42e36ca6a (patch) | |
tree | b299448162932c5574b87238a3b02a01efd14db6 /src/mem/ruby/network/simple | |
parent | b43994ba45b7805da0d1d9600e5cbb8332057403 (diff) | |
download | gem5-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/simple')
-rw-r--r-- | src/mem/ruby/network/simple/HierarchicalSwitchTopology.hh | 2 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/PtToPtTopology.hh | 2 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/SConscript | 2 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/SimpleNetwork.cc | 15 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/SimpleNetwork.hh | 8 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/SimpleNetwork.py | 5 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/Topology.cc | 25 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/Topology.hh | 11 | ||||
-rw-r--r-- | src/mem/ruby/network/simple/Torus2DTopology.hh | 2 |
9 files changed, 43 insertions, 29 deletions
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(); |