diff options
Diffstat (limited to 'src/mem/ruby/network/garnet/flexible-pipeline')
11 files changed, 379 insertions, 49 deletions
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.cc new file mode 100644 index 000000000..270b1327e --- /dev/null +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.cc @@ -0,0 +1,78 @@ +/* + * 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/flexible-pipeline/GarnetLink.hh" +#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" + +GarnetIntLink::GarnetIntLink(const Params *p) + : BasicLink(p) +{ + m_network_links[0] = p->network_links[0]; + m_network_links[1] = p->network_links[1]; +} + +void +GarnetIntLink::init() +{ +} + +void +GarnetIntLink::print(std::ostream& out) const +{ + out << name(); +} + +GarnetIntLink * +GarnetIntLinkParams::create() +{ + return new GarnetIntLink(this); +} + +GarnetExtLink::GarnetExtLink(const Params *p) + : BasicLink(p) +{ + m_network_links[0] = p->network_links[0]; + m_network_links[1] = p->network_links[1]; +} + +void +GarnetExtLink::init() +{ +} + +void +GarnetExtLink::print(std::ostream& out) const +{ + out << name(); +} + +GarnetExtLink * +GarnetExtLinkParams::create() +{ + return new GarnetExtLink(this); +} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh new file mode 100644 index 000000000..cd42378bf --- /dev/null +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh @@ -0,0 +1,89 @@ +/* + * 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_FLEXIBLE_PIPELINE_LINK_HH__ +#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_LINK_HH__ + +#include <iostream> +#include <string> +#include <vector> + +#include "mem/ruby/network/BasicLink.hh" +#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" +#include "params/GarnetIntLink.hh" +#include "params/GarnetExtLink.hh" + +class GarnetIntLink : public BasicLink +{ + public: + typedef GarnetIntLinkParams Params; + GarnetIntLink(const Params *p); + + void init(); + + void print(std::ostream& out) const; + + friend class GarnetNetwork; + + protected: + NetworkLink* m_network_links[2]; +}; + +inline std::ostream& +operator<<(std::ostream& out, const GarnetIntLink& obj) +{ + obj.print(out); + out << std::flush; + return out; +} + +class GarnetExtLink : public BasicLink +{ + public: + typedef GarnetExtLinkParams Params; + GarnetExtLink(const Params *p); + + void init(); + + void print(std::ostream& out) const; + + friend class GarnetNetwork; + + protected: + NetworkLink* m_network_links[2]; +}; + +inline std::ostream& +operator<<(std::ostream& out, const GarnetExtLink& obj) +{ + obj.print(out); + out << std::flush; + return out; +} + +#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_LINK_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py new file mode 100644 index 000000000..45c56fa9e --- /dev/null +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py @@ -0,0 +1,68 @@ +# 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(SimObject): + type = 'NetworkLink' + 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") + +# Interior fixed pipeline links between routers +class GarnetIntLink(BasicIntLink): + type = 'GarnetIntLink' + # The flexible pipeline bi-directional link only include two main + # forward links and no backward flow-control links + nls = [] + # In uni-directional link + nls.append(NetworkLink()); + # Out uni-directional link + nls.append(NetworkLink()); + network_links = VectorParam.NetworkLink(nls, "forward links") + +# Exterior fixed pipeline links between a router and a controller +class GarnetExtLink(BasicExtLink): + type = 'GarnetExtLink' + # The flexible pipeline bi-directional link only include two main + # forward links and no backward flow-control links + nls = [] + # In uni-directional link + nls.append(NetworkLink()); + # Out uni-directional link + nls.append(NetworkLink()); + network_links = VectorParam.NetworkLink(nls, "forward links") diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc index 8e919284a..16c56e95e 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -34,6 +34,8 @@ #include "mem/protocol/MachineType.hh" #include "mem/ruby/buffers/MessageBuffer.hh" #include "mem/ruby/common/NetDest.hh" +#include "mem/ruby/network/BasicLink.hh" +#include "mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh" #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" #include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh" #include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" @@ -52,6 +54,14 @@ GarnetNetwork::GarnetNetwork(const Params *p) m_network_latency = 0.0; m_queueing_latency = 0.0; + // record the routers + for (vector<BasicRouter*>::const_iterator i = + m_topology_ptr->params()->routers.begin(); + i != m_topology_ptr->params()->routers.end(); ++i) { + Router* router = safe_cast<Router*>(*i); + m_router_ptr_vector.push_back(router); + } + // Allocate to and from queues // Queues that are getting messages from protocol @@ -89,9 +99,11 @@ GarnetNetwork::init() // Setup the network switches 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(i, this)); + // initialize the router's network pointers + for (vector<Router*>::const_iterator i = m_router_ptr_vector.begin(); + i != m_router_ptr_vector.end(); ++i) { + Router* router = safe_cast<Router*>(*i); + router->init_net_ptr(this); } for (int i=0; i < m_nodes; i++) { @@ -129,15 +141,18 @@ GarnetNetwork::reset() } void -GarnetNetwork::makeInLink(NodeID src, SwitchID dest, - const NetDest& routing_table_entry, int link_latency, int bw_multiplier, - bool isReconfiguration) +GarnetNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link, + LinkDirection direction, + const NetDest& routing_table_entry, + bool isReconfiguration) { assert(src < m_nodes); + GarnetExtLink* garnet_link = safe_cast<GarnetExtLink*>(link); + if (!isReconfiguration) { - NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(), - link_latency, this); + NetworkLink *net_link = garnet_link->m_network_links[direction]; + net_link->init_net_ptr(this); m_link_ptr_vector.push_back(net_link); m_router_ptr_vector[dest]->addInPort(net_link); m_ni_ptr_vector[src]->addOutPort(net_link); @@ -148,20 +163,23 @@ GarnetNetwork::makeInLink(NodeID src, SwitchID dest, } void -GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, - const NetDest& routing_table_entry, int link_latency, int link_weight, - int bw_multiplier, bool isReconfiguration) +GarnetNetwork::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* garnet_link = safe_cast<GarnetExtLink*>(link); + if (!isReconfiguration) { - NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(), - link_latency, this); + NetworkLink *net_link = garnet_link->m_network_links[direction]; + net_link->init_net_ptr(this); m_link_ptr_vector.push_back(net_link); m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, - link_weight); + link->m_weight); m_ni_ptr_vector[dest]->addInPort(net_link); } else { fatal("Fatal Error:: Reconfiguration not allowed here"); @@ -170,17 +188,20 @@ GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, } void -GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, - const NetDest& routing_table_entry, int link_latency, int link_weight, - int bw_multiplier, bool isReconfiguration) +GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, + LinkDirection direction, + const NetDest& routing_table_entry, + bool isReconfiguration) { + GarnetIntLink* garnet_link = safe_cast<GarnetIntLink*>(link); + if (!isReconfiguration) { - NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(), - link_latency, this); + NetworkLink *net_link = garnet_link->m_network_links[direction]; + net_link->init_net_ptr(this); m_link_ptr_vector.push_back(net_link); m_router_ptr_vector[dest]->addInPort(net_link); m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, - link_weight); + link->m_weight); } else { fatal("Fatal Error:: Reconfiguration not allowed here"); // do nothing diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh index b04e649df..a89a70ba7 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh @@ -89,15 +89,18 @@ class GarnetNetwork : 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); @@ -105,8 +108,6 @@ class GarnetNetwork : public BaseGarnetNetwork GarnetNetwork(const GarnetNetwork& obj); GarnetNetwork& operator=(const GarnetNetwork& obj); - // int m_virtual_networks; - // int m_nodes; int m_flits_received, m_flits_injected; double m_network_latency, m_queueing_latency; @@ -120,7 +121,6 @@ class GarnetNetwork : public BaseGarnetNetwork std::vector<NetworkLink *> m_link_ptr_vector; // All links in network std::vector<NetworkInterface *> m_ni_ptr_vector; // All NI's in Network - // Topology* m_topology_ptr; Time m_ruby_start; }; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetRouter.py b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetRouter.py new file mode 100644 index 000000000..c35b7db38 --- /dev/null +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetRouter.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(BasicRouter): + type = 'GarnetRouter' + cxx_class = 'Router' + 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/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc index 8badcb812..c6584700a 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc @@ -31,17 +31,17 @@ #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" #include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" -NetworkLink::NetworkLink(int id, int latency, GarnetNetwork *net_ptr) +NetworkLink::NetworkLink(const Params *p) + : SimObject(p) { - m_id = id; linkBuffer = new flitBuffer(); m_in_port = 0; m_out_port = 0; m_link_utilized = 0; - m_net_ptr = net_ptr; - m_latency = latency; - int num_net = net_ptr->getNumberOfVirtualNetworks(); - int num_vc = m_net_ptr->getVCsPerClass(); + m_latency = p->link_latency; + m_id = p->link_id; + int num_net = p->virt_nets; + int num_vc = p->vcs_per_class; m_vc_load.resize(num_net * num_vc); for (int i = 0; i < num_net * num_vc; i++) @@ -158,3 +158,9 @@ NetworkLink::consumeLink() { return linkBuffer->getTopFlit(); } + +NetworkLink * +NetworkLinkParams::create() +{ + return new NetworkLink(this); +} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh index cf2903a19..5b0cd5aae 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh @@ -38,14 +38,16 @@ #include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh" #include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" #include "mem/ruby/network/garnet/NetworkHeader.hh" +#include "params/NetworkLink.hh" +#include "sim/sim_object.hh" class GarnetNetwork; -class NetworkLink : public FlexibleConsumer +class NetworkLink : public SimObject, public FlexibleConsumer { public: - NetworkLink(); - NetworkLink(int id, int latency, GarnetNetwork *net_ptr); + typedef NetworkLinkParams Params; + NetworkLink(const Params *p); ~NetworkLink(); void setLinkConsumer(FlexibleConsumer *consumer); @@ -70,6 +72,11 @@ class NetworkLink : public FlexibleConsumer double getLinkUtilization(); std::vector<int> getVcLoad(); + void init_net_ptr(GarnetNetwork* net_ptr) + { + m_net_ptr = net_ptr; + } + protected: int m_id, m_latency; int m_in_port, m_out_port; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc index 31ecf96f9..51af50b7d 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc @@ -39,15 +39,15 @@ using namespace std; using m5::stl_helpers::deletePointers; -Router::Router(int id, GarnetNetwork *network_ptr) +Router::Router(const Params *p) + : BasicRouter(p) { - m_id = id; - m_net_ptr = network_ptr; - m_virtual_networks = m_net_ptr->getNumberOfVirtualNetworks(); - m_vc_per_vnet = m_net_ptr->getVCsPerClass(); + m_id = p->router_id; + m_virtual_networks = p->virt_nets; + m_vc_per_vnet = p->vcs_per_class; m_round_robin_inport = 0; m_round_robin_start = 0; - m_num_vcs = m_vc_per_vnet*m_virtual_networks; + m_num_vcs = m_vc_per_vnet * m_virtual_networks; m_vc_arbiter = new VCarbiter(this); } @@ -440,3 +440,9 @@ Router::print(ostream& out) const { out << "[Router]"; } + +Router * +GarnetRouterParams::create() +{ + return new Router(this); +} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh index 99b9cc1c3..e9b340c93 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh @@ -35,6 +35,7 @@ #include <vector> #include "mem/ruby/common/NetDest.hh" +#include "mem/ruby/network/BasicRouter.hh" #include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh" #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" #include "mem/ruby/network/garnet/flexible-pipeline/InVcState.hh" @@ -42,13 +43,15 @@ #include "mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh" #include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" #include "mem/ruby/network/garnet/NetworkHeader.hh" +#include "params/GarnetRouter.hh" class VCarbiter; -class Router : public FlexibleConsumer +class Router : public BasicRouter, public FlexibleConsumer { public: - Router(int id, GarnetNetwork *network_ptr); + typedef GarnetRouterParams Params; + Router(const Params *p); ~Router(); @@ -67,6 +70,11 @@ class Router : public FlexibleConsumer void printConfig(std::ostream& out) const; void print(std::ostream& out) const; + void init_net_ptr(GarnetNetwork* net_ptr) + { + m_net_ptr = net_ptr; + } + private: int m_id; int m_virtual_networks, m_num_vcs, m_vc_per_vnet; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/SConscript b/src/mem/ruby/network/garnet/flexible-pipeline/SConscript index fa23c02d6..03f4e3fdb 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/SConscript +++ b/src/mem/ruby/network/garnet/flexible-pipeline/SConscript @@ -33,8 +33,11 @@ Import('*') if not env['RUBY']: Return() +SimObject('GarnetLink.py') SimObject('GarnetNetwork.py') +SimObject('GarnetRouter.py') +Source('GarnetLink.cc') Source('GarnetNetwork.cc') Source('InVcState.cc') Source('NetworkInterface.cc') |