summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/garnet/fixed-pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/network/garnet/fixed-pipeline')
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh6
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.cc83
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh92
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py85
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc79
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh21
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py44
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc30
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh10
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc23
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh13
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/SConscript3
12 files changed, 420 insertions, 69 deletions
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh
index 779161336..e6c39475d 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh
@@ -32,13 +32,13 @@
#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_CREDIT_LINK_D_HH__
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
+#include "params/CreditLink_d.hh"
class CreditLink_d : public NetworkLink_d
{
public:
- CreditLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr)
- : NetworkLink_d(id, link_latency, net_ptr)
- {}
+ typedef CreditLink_dParams Params;
+ CreditLink_d(const Params *p) : NetworkLink_d(p) {}
};
#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_CREDIT_LINK_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.cc
new file mode 100644
index 000000000..da9249690
--- /dev/null
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.cc
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2011 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.
+ */
+
+#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
+
+GarnetIntLink_d::GarnetIntLink_d(const Params *p)
+ : BasicLink(p)
+{
+ m_network_links[0] = p->network_links[0];
+ m_credit_links[0] = p->credit_links[0];
+ m_network_links[1] = p->network_links[1];
+ m_credit_links[1] = p->credit_links[1];
+}
+
+void
+GarnetIntLink_d::init()
+{
+}
+
+void
+GarnetIntLink_d::print(std::ostream& out) const
+{
+ out << name();
+}
+
+GarnetIntLink_d *
+GarnetIntLink_dParams::create()
+{
+ return new GarnetIntLink_d(this);
+}
+
+GarnetExtLink_d::GarnetExtLink_d(const Params *p)
+ : BasicLink(p)
+{
+ m_network_links[0] = p->network_links[0];
+ m_credit_links[0] = p->credit_links[0];
+ m_network_links[1] = p->network_links[1];
+ m_credit_links[1] = p->credit_links[1];
+}
+
+void
+GarnetExtLink_d::init()
+{
+}
+
+void
+GarnetExtLink_d::print(std::ostream& out) const
+{
+ out << name();
+}
+
+GarnetExtLink_d *
+GarnetExtLink_dParams::create()
+{
+ return new GarnetExtLink_d(this);
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh
new file mode 100644
index 000000000..cb2ae62dc
--- /dev/null
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2011 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.
+ */
+
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_LINK_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_LINK_HH__
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include "mem/ruby/network/BasicLink.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
+#include "params/GarnetIntLink_d.hh"
+#include "params/GarnetExtLink_d.hh"
+
+class GarnetIntLink_d : public BasicLink
+{
+ public:
+ typedef GarnetIntLink_dParams Params;
+ GarnetIntLink_d(const Params *p);
+
+ void init();
+
+ void print(std::ostream& out) const;
+
+ friend class GarnetNetwork_d;
+
+ protected:
+ NetworkLink_d* m_network_links[2];
+ CreditLink_d* m_credit_links[2];
+};
+
+inline std::ostream&
+operator<<(std::ostream& out, const GarnetIntLink_d& obj)
+{
+ obj.print(out);
+ out << std::flush;
+ return out;
+}
+
+class GarnetExtLink_d : public BasicLink
+{
+ public:
+ typedef GarnetExtLink_dParams Params;
+ GarnetExtLink_d(const Params *p);
+
+ void init();
+
+ void print(std::ostream& out) const;
+
+ friend class GarnetNetwork_d;
+
+ protected:
+ NetworkLink_d* m_network_links[2];
+ CreditLink_d* m_credit_links[2];
+};
+
+inline std::ostream&
+operator<<(std::ostream& out, const GarnetExtLink_d& obj)
+{
+ obj.print(out);
+ out << std::flush;
+ return out;
+}
+
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_LINK_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py
new file mode 100644
index 000000000..941746cbc
--- /dev/null
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py
@@ -0,0 +1,85 @@
+# Copyright (c) 2008 Princeton University
+# 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.proxy import *
+from m5.SimObject import SimObject
+from BasicLink import BasicIntLink, BasicExtLink
+
+class NetworkLink_d(SimObject):
+ type = 'NetworkLink_d'
+ link_id = Param.Int(Parent.link_id, "link id")
+ link_latency = Param.Int(Parent.latency, "link latency")
+ vcs_per_class = Param.Int(Parent.vcs_per_class,
+ "virtual channels per message class")
+ virt_nets = Param.Int(Parent.number_of_virtual_networks,
+ "number of virtual networks")
+ channel_width = Param.Int(Parent.flit_size, "channel width == flit size")
+
+class CreditLink_d(NetworkLink_d):
+ type = 'CreditLink_d'
+
+# Interior fixed pipeline links between routers
+class GarnetIntLink_d(BasicIntLink):
+ type = 'GarnetIntLink_d'
+ # The detailed fixed pipeline bi-directional link include two main
+ # forward links and two backward flow-control links, one per direction
+ nls = []
+ # In uni-directional link
+ nls.append(NetworkLink_d());
+ # Out uni-directional link
+ nls.append(NetworkLink_d());
+ network_links = VectorParam.NetworkLink_d(nls, "forward links")
+
+ cls = []
+ # In uni-directional link
+ cls.append(CreditLink_d());
+ # Out uni-directional link
+ cls.append(CreditLink_d());
+ credit_links = VectorParam.CreditLink_d(cls, "backward flow-control links")
+
+# Exterior fixed pipeline links between a router and a controller
+class GarnetExtLink_d(BasicExtLink):
+ type = 'GarnetExtLink_d'
+ # The detailed fixed pipeline bi-directional link include two main
+ # forward links and two backward flow-control links, one per direction
+ nls = []
+ # In uni-directional link
+ nls.append(NetworkLink_d());
+ # Out uni-directional link
+ nls.append(NetworkLink_d());
+ network_links = VectorParam.NetworkLink_d(nls, "forward links")
+
+ cls = []
+ # In uni-directional link
+ cls.append(CreditLink_d());
+ # Out uni-directional link
+ cls.append(CreditLink_d());
+ credit_links = VectorParam.CreditLink_d(cls, "backward flow-control links")
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 265023b7e..5aa9ceca8 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
@@ -34,7 +34,9 @@
#include "mem/protocol/MachineType.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/common/NetDest.hh"
+#include "mem/ruby/network/garnet/BaseGarnetNetwork.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
@@ -53,7 +55,13 @@ GarnetNetwork_d::GarnetNetwork_d(const Params *p)
m_network_latency = 0.0;
m_queueing_latency = 0.0;
- m_router_ptr_vector.clear();
+ // record the routers
+ for (vector<BasicRouter*>::const_iterator i =
+ m_topology_ptr->params()->routers.begin();
+ i != m_topology_ptr->params()->routers.end(); ++i) {
+ Router_d* router = safe_cast<Router_d*>(*i);
+ m_router_ptr_vector.push_back(router);
+ }
// Queues that are getting messages from protocol
m_toNetQueues.resize(m_nodes);
@@ -87,15 +95,17 @@ GarnetNetwork_d::init()
{
BaseGarnetNetwork::init();
+ // initialize the router's network pointers
+ for (vector<Router_d*>::const_iterator i = m_router_ptr_vector.begin();
+ i != m_router_ptr_vector.end(); ++i) {
+ Router_d* router = safe_cast<Router_d*>(*i);
+ router->init_net_ptr(this);
+ }
+
// The topology pointer should have already been initialized in the
// parent network constructor
assert(m_topology_ptr != NULL);
- int number_of_routers = m_topology_ptr->numSwitches();
- for (int i=0; i<number_of_routers; i++) {
- m_router_ptr_vector.push_back(new Router_d(i, this));
- }
-
for (int i=0; i < m_nodes; i++) {
NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks,
this);
@@ -104,9 +114,6 @@ GarnetNetwork_d::init()
}
// false because this isn't a reconfiguration
m_topology_ptr->createLinks(this, false);
- for (int i = 0; i < m_router_ptr_vector.size(); i++) {
- m_router_ptr_vector[i]->init();
- }
m_vnet_type.resize(m_virtual_networks);
for (int i = 0; i < m_vnet_type.size(); i++) {
@@ -147,17 +154,19 @@ GarnetNetwork_d::reset()
*/
void
-GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest,
- const NetDest& routing_table_entry, int link_latency, int bw_multiplier,
- bool isReconfiguration)
+GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
+ LinkDirection direction,
+ const NetDest& routing_table_entry,
+ bool isReconfiguration)
{
assert(src < m_nodes);
+ GarnetExtLink_d* garnet_link = safe_cast<GarnetExtLink_d*>(link);
+
if (!isReconfiguration) {
- NetworkLink_d *net_link = new NetworkLink_d
- (m_link_ptr_vector.size(), link_latency, this);
- CreditLink_d *credit_link = new CreditLink_d
- (m_creditlink_ptr_vector.size(), link_latency, this);
+ NetworkLink_d* net_link = garnet_link->m_network_links[direction];
+ CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
+
m_link_ptr_vector.push_back(net_link);
m_creditlink_ptr_vector.push_back(credit_link);
@@ -176,24 +185,27 @@ GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest,
*/
void
-GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest,
- const NetDest& routing_table_entry, int link_latency, int link_weight,
- int bw_multiplier, bool isReconfiguration)
+GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
+ LinkDirection direction,
+ const NetDest& routing_table_entry,
+ bool isReconfiguration)
{
assert(dest < m_nodes);
assert(src < m_router_ptr_vector.size());
assert(m_router_ptr_vector[src] != NULL);
+ GarnetExtLink_d* garnet_link = safe_cast<GarnetExtLink_d*>(link);
+
if (!isReconfiguration) {
- NetworkLink_d *net_link = new NetworkLink_d
- (m_link_ptr_vector.size(), link_latency, this);
- CreditLink_d *credit_link = new CreditLink_d
- (m_creditlink_ptr_vector.size(), link_latency, this);
+ NetworkLink_d* net_link = garnet_link->m_network_links[direction];
+ CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
+
m_link_ptr_vector.push_back(net_link);
m_creditlink_ptr_vector.push_back(credit_link);
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
- link_weight, credit_link);
+ link->m_weight,
+ credit_link);
m_ni_ptr_vector[dest]->addInPort(net_link, credit_link);
} else {
fatal("Fatal Error:: Reconfiguration not allowed here");
@@ -206,21 +218,24 @@ GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest,
*/
void
-GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest,
- const NetDest& routing_table_entry, int link_latency, int link_weight,
- int bw_multiplier, bool isReconfiguration)
+GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
+ LinkDirection direction,
+ const NetDest& routing_table_entry,
+ bool isReconfiguration)
{
+ GarnetIntLink_d* garnet_link = safe_cast<GarnetIntLink_d*>(link);
+
if (!isReconfiguration) {
- NetworkLink_d *net_link = new NetworkLink_d
- (m_link_ptr_vector.size(), link_latency, this);
- CreditLink_d *credit_link = new CreditLink_d
- (m_creditlink_ptr_vector.size(), link_latency, this);
+ NetworkLink_d* net_link = garnet_link->m_network_links[direction];
+ CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
+
m_link_ptr_vector.push_back(net_link);
m_creditlink_ptr_vector.push_back(credit_link);
m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
- link_weight, credit_link);
+ link->m_weight,
+ credit_link);
} else {
fatal("Fatal Error:: Reconfiguration not allowed here");
// do nothing
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 f403660ea..7c6e5f8e1 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
@@ -105,15 +105,18 @@ class GarnetNetwork_d : public BaseGarnetNetwork
void reset();
// Methods used by Topology to setup the network
- void makeOutLink(SwitchID src, NodeID dest,
- const NetDest& routing_table_entry, int link_latency, int link_weight,
- int bw_multiplier, bool isReconfiguration);
- void makeInLink(SwitchID src, NodeID dest,
- const NetDest& routing_table_entry, int link_latency,
- int bw_multiplier, bool isReconfiguration);
- void makeInternalLink(SwitchID src, NodeID dest,
- const NetDest& routing_table_entry, int link_latency, int link_weight,
- int bw_multiplier, bool isReconfiguration);
+ void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
+ LinkDirection direction,
+ const NetDest& routing_table_entry,
+ bool isReconfiguration);
+ void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
+ LinkDirection direction,
+ const NetDest& routing_table_entry,
+ bool isReconfiguration);
+ void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
+ LinkDirection direction,
+ const NetDest& routing_table_entry,
+ bool isReconfiguration);
private:
void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py
new file mode 100644
index 000000000..92e49b328
--- /dev/null
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py
@@ -0,0 +1,44 @@
+# Copyright (c) 2008 Princeton University
+# 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.proxy import *
+from BasicRouter import BasicRouter
+
+class GarnetRouter_d(BasicRouter):
+ type = 'GarnetRouter_d'
+ cxx_class = 'Router_d'
+ vcs_per_class = Param.Int(Parent.vcs_per_class,
+ "virtual channels per message class")
+ virt_nets = Param.Int(Parent.number_of_virtual_networks,
+ "number of virtual networks")
+ flit_width = Param.Int(Parent.flit_size, "flit width == flit size")
+
+
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
index 72439a67b..38627b109 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
@@ -28,22 +28,20 @@
* Authors: Niket Agarwal
*/
-#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
-NetworkLink_d::NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr)
+NetworkLink_d::NetworkLink_d(const Params *p)
+ : SimObject(p)
{
- m_net_ptr = net_ptr;
- m_id = id;
- m_latency = link_latency;
+ m_latency = p->link_latency;
+ channel_width = p->channel_width;
+ m_id = p->link_id;
linkBuffer = new flitBuffer_d();
m_link_utilized = 0;
- m_vc_load.resize(m_net_ptr->getVCsPerClass() *
- net_ptr->getNumberOfVirtualNetworks());
+ m_vc_load.resize(p->vcs_per_class * p->virt_nets);
- for (int i = 0;
- i < m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks();
- i++) {
+ for (int i = 0; i < (p->vcs_per_class * p->virt_nets); i++) {
m_vc_load[i] = 0;
}
}
@@ -89,3 +87,15 @@ NetworkLink_d::getLinkUtilization()
{
return m_link_utilized;
}
+
+NetworkLink_d *
+NetworkLink_dParams::create()
+{
+ return new NetworkLink_d(this);
+}
+
+CreditLink_d *
+CreditLink_dParams::create()
+{
+ return new CreditLink_d(this);
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
index a46c59f41..5da006c4d 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
@@ -38,16 +38,18 @@
#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/orion/NetworkPower.hh"
+#include "params/NetworkLink_d.hh"
+#include "sim/sim_object.hh"
class GarnetNetwork_d;
-class NetworkLink_d : public Consumer
+class NetworkLink_d : public SimObject, public Consumer
{
public:
- //NetworkLink_d(int id);
+ typedef NetworkLink_dParams Params;
+ NetworkLink_d(const Params *p);
~NetworkLink_d();
- NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr);
void setLinkConsumer(Consumer *consumer);
void setSourceQueue(flitBuffer_d *srcQueue);
void print(std::ostream& out) const{}
@@ -67,8 +69,8 @@ class NetworkLink_d : public Consumer
protected:
int m_id;
int m_latency;
- GarnetNetwork_d *m_net_ptr;
+ int channel_width;
flitBuffer_d *linkBuffer;
Consumer *link_consumer;
flitBuffer_d *link_srcQueue;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
index 15cddd3b7..5eefd52de 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
@@ -43,14 +43,13 @@
using namespace std;
using m5::stl_helpers::deletePointers;
-Router_d::Router_d(int id, GarnetNetwork_d *network_ptr)
+Router_d::Router_d(const Params *p)
+ : BasicRouter(p)
{
- m_id = id;
- m_network_ptr = network_ptr;
- m_virtual_networks = network_ptr->getNumberOfVirtualNetworks();
- m_vc_per_vnet = m_network_ptr->getVCsPerClass();
- m_num_vcs = m_virtual_networks*m_vc_per_vnet;
- m_flit_width = m_network_ptr->getFlitSize();
+ m_virtual_networks = p->virt_nets;
+ m_vc_per_vnet = p->vcs_per_class;
+ m_num_vcs = m_virtual_networks * m_vc_per_vnet;
+ m_flit_width = p->flit_width;
m_routing_unit = new RoutingUnit_d(this);
m_vc_alloc = new VCallocator_d(this);
@@ -88,6 +87,8 @@ Router_d::~Router_d()
void
Router_d::init()
{
+ BasicRouter::init();
+
m_vc_alloc->init();
m_sw_alloc->init();
m_switch->init();
@@ -178,7 +179,7 @@ Router_d::calculate_performance_numbers()
void
Router_d::printConfig(ostream& out)
{
- out << "[Router " << m_id << "] :: " << endl;
+ out << name() << endl;
out << "[inLink - ";
for (int i = 0;i < m_input_unit.size(); i++)
out << m_input_unit[i]->get_inlink_id() << " - ";
@@ -188,3 +189,9 @@ Router_d::printConfig(ostream& out)
out << m_output_unit[i]->get_outlink_id() << " - ";
out << "]" << endl;
}
+
+Router_d *
+GarnetRouter_dParams::create()
+{
+ return new Router_d(this);
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
index 4c2b83312..ec44cc7b3 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
@@ -35,9 +35,11 @@
#include <vector>
#include "mem/ruby/common/NetDest.hh"
+#include "mem/ruby/network/BasicRouter.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/orion/NetworkPower.hh"
+#include "params/GarnetRouter_d.hh"
class GarnetNetwork_d;
class NetworkLink_d;
@@ -49,10 +51,11 @@ class VCallocator_d;
class SWallocator_d;
class Switch_d;
-class Router_d
+class Router_d : public BasicRouter
{
public:
- Router_d(int id, GarnetNetwork_d *network_ptr);
+ typedef GarnetRouter_dParams Params;
+ Router_d(const Params *p);
~Router_d();
@@ -68,6 +71,11 @@ class Router_d
int get_num_outports() { return m_output_unit.size(); }
int get_id() { return m_id; }
+ void init_net_ptr(GarnetNetwork_d* net_ptr)
+ {
+ m_network_ptr = net_ptr;
+ }
+
GarnetNetwork_d* get_net_ptr() { return m_network_ptr; }
std::vector<InputUnit_d *>& get_inputUnit_ref() { return m_input_unit; }
std::vector<OutputUnit_d *>& get_outputUnit_ref() { return m_output_unit; }
@@ -86,7 +94,6 @@ class Router_d
double get_static_power(){return m_power_sta;}
private:
- int m_id;
int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
GarnetNetwork_d *m_network_ptr;
int m_flit_width;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript b/src/mem/ruby/network/garnet/fixed-pipeline/SConscript
index d3cf45878..ae3b964de 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/SConscript
@@ -33,8 +33,11 @@ Import('*')
if not env['RUBY']:
Return()
+SimObject('GarnetLink_d.py')
SimObject('GarnetNetwork_d.py')
+SimObject('GarnetRouter_d.py')
+Source('GarnetLink_d.cc')
Source('GarnetNetwork_d.cc', Werror=False)
Source('InputUnit_d.cc', Werror=False)
Source('NetworkInterface_d.cc')