From b512f4bf71fac79fb6e17bb2a9e05c1f494f69f4 Mon Sep 17 00:00:00 2001 From: Tushar Krishna Date: Thu, 6 Oct 2016 14:35:21 -0400 Subject: ruby: remove the original garnet code. Only garnet2.0 will be supported henceforth. --- .../network/garnet/fixed-pipeline/CreditLink_d.hh | 44 --- .../network/garnet/fixed-pipeline/GarnetLink_d.cc | 83 ----- .../network/garnet/fixed-pipeline/GarnetLink_d.hh | 92 ----- .../network/garnet/fixed-pipeline/GarnetLink_d.py | 90 ----- .../garnet/fixed-pipeline/GarnetNetwork_d.cc | 260 -------------- .../garnet/fixed-pipeline/GarnetNetwork_d.hh | 111 ------ .../garnet/fixed-pipeline/GarnetNetwork_d.py | 61 ---- .../network/garnet/fixed-pipeline/InputUnit_d.cc | 122 ------- .../network/garnet/fixed-pipeline/InputUnit_d.hh | 182 ---------- .../garnet/fixed-pipeline/NetworkInterface_d.cc | 394 --------------------- .../garnet/fixed-pipeline/NetworkInterface_d.hh | 102 ------ .../network/garnet/fixed-pipeline/NetworkLink_d.cc | 89 ----- .../network/garnet/fixed-pipeline/NetworkLink_d.hh | 82 ----- .../network/garnet/fixed-pipeline/OutVcState_d.cc | 47 --- .../network/garnet/fixed-pipeline/OutVcState_d.hh | 72 ---- .../network/garnet/fixed-pipeline/OutputUnit_d.cc | 116 ------ .../network/garnet/fixed-pipeline/OutputUnit_d.hh | 103 ------ .../ruby/network/garnet/fixed-pipeline/Router_d.cc | 277 --------------- .../ruby/network/garnet/fixed-pipeline/Router_d.hh | 134 ------- .../network/garnet/fixed-pipeline/RoutingUnit_d.cc | 90 ----- .../network/garnet/fixed-pipeline/RoutingUnit_d.hh | 57 --- .../ruby/network/garnet/fixed-pipeline/SConscript | 53 --- .../network/garnet/fixed-pipeline/SWallocator_d.cc | 241 ------------- .../network/garnet/fixed-pipeline/SWallocator_d.hh | 84 ----- .../ruby/network/garnet/fixed-pipeline/Switch_d.cc | 111 ------ .../ruby/network/garnet/fixed-pipeline/Switch_d.hh | 70 ---- .../network/garnet/fixed-pipeline/VCallocator_d.cc | 265 -------------- .../network/garnet/fixed-pipeline/VCallocator_d.hh | 94 ----- .../garnet/fixed-pipeline/VirtualChannel_d.cc | 80 ----- .../garnet/fixed-pipeline/VirtualChannel_d.hh | 100 ------ .../network/garnet/fixed-pipeline/flitBuffer_d.cc | 90 ----- .../network/garnet/fixed-pipeline/flitBuffer_d.hh | 90 ----- .../ruby/network/garnet/fixed-pipeline/flit_d.cc | 83 ----- .../ruby/network/garnet/fixed-pipeline/flit_d.hh | 115 ------ 34 files changed, 4084 deletions(-) delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/SConscript delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc delete mode 100644 src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh (limited to 'src/mem/ruby/network/garnet/fixed-pipeline') diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh deleted file mode 100644 index e6c39475d..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_CREDIT_LINK_D_HH__ -#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: - 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 deleted file mode 100644 index da9249690..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 deleted file mode 100644 index cb2ae62dc..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 -#include -#include - -#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 deleted file mode 100644 index 5a4f3026e..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py +++ /dev/null @@ -1,90 +0,0 @@ -# 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 ClockedObject import ClockedObject -from BasicLink import BasicIntLink, BasicExtLink - -class NetworkLink_d(ClockedObject): - type = 'NetworkLink_d' - cxx_header = "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh" - link_id = Param.Int(Parent.link_id, "link id") - link_latency = Param.Cycles(Parent.latency, "link latency") - vcs_per_vnet = Param.Int(Parent.vcs_per_vnet, - "virtual channels per virtual network") - virt_nets = Param.Int(Parent.number_of_virtual_networks, - "number of virtual networks") - -class CreditLink_d(NetworkLink_d): - type = 'CreditLink_d' - cxx_header = "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh" - -# Interior fixed pipeline links between routers -class GarnetIntLink_d(BasicIntLink): - type = 'GarnetIntLink_d' - cxx_header = "mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh" - # 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' - cxx_header = "mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh" - # 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 deleted file mode 100644 index 9fd0c8669..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include - -#include "base/cast.hh" -#include "base/stl_helpers.hh" -#include "mem/ruby/common/NetDest.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" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" -#include "mem/ruby/system/RubySystem.hh" - -using namespace std; -using m5::stl_helpers::deletePointers; - -GarnetNetwork_d::GarnetNetwork_d(const Params *p) - : BaseGarnetNetwork(p) -{ - m_buffers_per_data_vc = p->buffers_per_data_vc; - m_buffers_per_ctrl_vc = p->buffers_per_ctrl_vc; - - m_vnet_type.resize(m_virtual_networks); - - for (int i = 0 ; i < m_virtual_networks ; i++) - { - if (m_vnet_type_names[i] == "response") - m_vnet_type[i] = DATA_VNET_; // carries data (and ctrl) packets - else - m_vnet_type[i] = CTRL_VNET_; // carries only ctrl packets - } - - // record the routers - for (vector::const_iterator i = p->routers.begin(); - i != p->routers.end(); ++i) { - Router_d* router = safe_cast(*i); - m_routers.push_back(router); - - // initialize the router's network pointers - router->init_net_ptr(this); - } - - // record the network interfaces - for (vector::const_iterator i = p->netifs.begin(); - i != p->netifs.end(); ++i) { - NetworkInterface_d *ni = safe_cast(*i); - m_nis.push_back(ni); - ni->init_net_ptr(this); - } -} - -void -GarnetNetwork_d::init() -{ - BaseGarnetNetwork::init(); - - for (int i=0; i < m_nodes; i++) { - m_nis[i]->addNode(m_toNetQueues[i], m_fromNetQueues[i]); - } - - // The topology pointer should have already been initialized in the - // parent network constructor - assert(m_topology_ptr != NULL); - m_topology_ptr->createLinks(this); - - // FaultModel: declare each router to the fault model - if (isFaultModelEnabled()){ - for (vector::const_iterator i= m_routers.begin(); - i != m_routers.end(); ++i) { - Router_d* router = safe_cast(*i); - int router_id M5_VAR_USED = - fault_model->declare_router(router->get_num_inports(), - router->get_num_outports(), - router->get_vc_per_vnet(), - getBuffersPerDataVC(), - getBuffersPerCtrlVC()); - assert(router_id == router->get_id()); - router->printAggregateFaultProbability(cout); - router->printFaultVector(cout); - } - } -} - -GarnetNetwork_d::~GarnetNetwork_d() -{ - deletePointers(m_routers); - deletePointers(m_nis); - deletePointers(m_links); - deletePointers(m_creditlinks); -} - -/* - * This function creates a link from the Network Interface (NI) - * into the Network. - * It creates a Network Link from the NI to a Router and a Credit Link from - * the Router to the NI -*/ - -void -GarnetNetwork_d::makeExtInLink(NodeID src, SwitchID dest, BasicLink* link, - const NetDest& routing_table_entry) -{ - assert(src < m_nodes); - - GarnetExtLink_d* garnet_link = safe_cast(link); - NetworkLink_d* net_link = garnet_link->m_network_links[0]; - CreditLink_d* credit_link = garnet_link->m_credit_links[0]; - - m_links.push_back(net_link); - m_creditlinks.push_back(credit_link); - - m_routers[dest]->addInPort(net_link, credit_link); - m_nis[src]->addOutPort(net_link, credit_link); -} - -/* - * This function creates a link from the Network to a NI. - * It creates a Network Link from a Router to the NI and - * a Credit Link from NI to the Router -*/ - -void -GarnetNetwork_d::makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link, - const NetDest& routing_table_entry) -{ - assert(dest < m_nodes); - assert(src < m_routers.size()); - assert(m_routers[src] != NULL); - - GarnetExtLink_d* garnet_link = safe_cast(link); - NetworkLink_d* net_link = garnet_link->m_network_links[1]; - CreditLink_d* credit_link = garnet_link->m_credit_links[1]; - - m_links.push_back(net_link); - m_creditlinks.push_back(credit_link); - - m_routers[src]->addOutPort(net_link, routing_table_entry, - link->m_weight, credit_link); - m_nis[dest]->addInPort(net_link, credit_link); -} - -/* - * This function creates an internal network link -*/ - -void -GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, - const NetDest& routing_table_entry, - PortDirection src_outport, - PortDirection dst_inport) -{ - GarnetIntLink_d* garnet_link = safe_cast(link); - NetworkLink_d* net_link = garnet_link->m_network_links[0]; - CreditLink_d* credit_link = garnet_link->m_credit_links[0]; - - m_links.push_back(net_link); - m_creditlinks.push_back(credit_link); - - m_routers[dest]->addInPort(net_link, credit_link); - m_routers[src]->addOutPort(net_link, routing_table_entry, - link->m_weight, credit_link); -} - -void -GarnetNetwork_d::regStats() -{ - BaseGarnetNetwork::regStats(); - - m_average_link_utilization.name(name() + ".avg_link_utilization"); - - m_average_vc_load - .init(m_virtual_networks * m_vcs_per_vnet) - .name(name() + ".avg_vc_load") - .flags(Stats::pdf | Stats::total | Stats::nozero | Stats::oneline) - ; -} - -void -GarnetNetwork_d::collateStats() -{ - RubySystem *rs = params()->ruby_system; - double time_delta = double(curCycle() - rs->getStartCycle()); - - for (int i = 0; i < m_links.size(); i++) { - m_average_link_utilization += - (double(m_links[i]->getLinkUtilization())) / time_delta; - - vector vc_load = m_links[i]->getVcLoad(); - for (int j = 0; j < vc_load.size(); j++) { - m_average_vc_load[j] += ((double)vc_load[j] / time_delta); - } - } - - // Ask the routers to collate their statistics - for (int i = 0; i < m_routers.size(); i++) { - m_routers[i]->collateStats(); - } -} - -void -GarnetNetwork_d::print(ostream& out) const -{ - out << "[GarnetNetwork_d]"; -} - -GarnetNetwork_d * -GarnetNetwork_dParams::create() -{ - return new GarnetNetwork_d(this); -} - -uint32_t -GarnetNetwork_d::functionalWrite(Packet *pkt) -{ - uint32_t num_functional_writes = 0; - - for (unsigned int i = 0; i < m_routers.size(); i++) { - num_functional_writes += m_routers[i]->functionalWrite(pkt); - } - - for (unsigned int i = 0; i < m_nis.size(); ++i) { - num_functional_writes += m_nis[i]->functionalWrite(pkt); - } - - for (unsigned int i = 0; i < m_links.size(); ++i) { - num_functional_writes += m_links[i]->functionalWrite(pkt); - } - - return num_functional_writes; -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh deleted file mode 100644 index 36a96e955..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__ - -#include -#include - -#include "mem/ruby/network/garnet/BaseGarnetNetwork.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "params/GarnetNetwork_d.hh" - -class FaultModel; -class NetworkInterface_d; -class Router_d; -class NetDest; -class NetworkLink_d; -class CreditLink_d; - -class GarnetNetwork_d : public BaseGarnetNetwork -{ - public: - typedef GarnetNetwork_dParams Params; - GarnetNetwork_d(const Params *p); - - ~GarnetNetwork_d(); - void init(); - - int getBuffersPerDataVC() { return m_buffers_per_data_vc; } - int getBuffersPerCtrlVC() { return m_buffers_per_ctrl_vc; } - - void collateStats(); - void regStats(); - void print(std::ostream& out) const; - - VNET_type - get_vnet_type(int vc) - { - int vnet = vc/getVCsPerVnet(); - return m_vnet_type[vnet]; - } - - // Methods used by Topology to setup the network - void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link, - const NetDest& routing_table_entry); - void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link, - const NetDest& routing_table_entry); - void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, - const NetDest& routing_table_entry, - PortDirection src_outport, - PortDirection dst_inport); - - //! Function for performing a functional write. The return value - //! indicates the number of messages that were written. - uint32_t functionalWrite(Packet *pkt); - - private: - GarnetNetwork_d(const GarnetNetwork_d& obj); - GarnetNetwork_d& operator=(const GarnetNetwork_d& obj); - - std::vector m_vnet_type; - std::vector m_routers; // All Routers in Network - std::vector m_links; // All links in the network - std::vector m_creditlinks; // All links in net - std::vector m_nis; // All NI's in Network - - int m_buffers_per_data_vc; - int m_buffers_per_ctrl_vc; - - // Statistical variables for performance - Stats::Scalar m_average_link_utilization; - Stats::Vector m_average_vc_load; -}; - -inline std::ostream& -operator<<(std::ostream& out, const GarnetNetwork_d& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py deleted file mode 100644 index 0191d45af..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py +++ /dev/null @@ -1,61 +0,0 @@ -# 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 BaseGarnetNetwork import BaseGarnetNetwork -from BasicRouter import BasicRouter -from ClockedObject import ClockedObject - -class GarnetRouter_d(BasicRouter): - type = 'GarnetRouter_d' - cxx_class = 'Router_d' - cxx_header = "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" - vcs_per_vnet = Param.UInt32(Parent.vcs_per_vnet, - "virtual channels per virtual network") - virt_nets = Param.UInt32(Parent.number_of_virtual_networks, - "number of virtual networks") - -class GarnetNetworkInterface_d(ClockedObject): - type = 'GarnetNetworkInterface_d' - cxx_class = 'NetworkInterface_d' - cxx_header = "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh" - - id = Param.UInt32("ID in relation to other network interfaces") - vcs_per_vnet = Param.UInt32(Parent.vcs_per_vnet, - "virtual channels per virtual network") - virt_nets = Param.UInt32(Parent.number_of_virtual_networks, - "number of virtual networks") - -class GarnetNetwork_d(BaseGarnetNetwork): - type = 'GarnetNetwork_d' - cxx_header = "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh" - buffers_per_data_vc = Param.UInt32(4, "buffers per data virtual channel"); - buffers_per_ctrl_vc = Param.UInt32(1, "buffers per ctrl virtual channel"); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc deleted file mode 100644 index 2f99d387a..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "base/stl_helpers.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" - -using namespace std; -using m5::stl_helpers::deletePointers; - -InputUnit_d::InputUnit_d(int id, Router_d *router) : Consumer(router) -{ - m_id = id; - m_router = router; - m_num_vcs = m_router->get_num_vcs(); - m_vc_per_vnet = m_router->get_vc_per_vnet(); - - m_num_buffer_reads.resize(m_num_vcs/m_vc_per_vnet); - m_num_buffer_writes.resize(m_num_vcs/m_vc_per_vnet); - for (int i = 0; i < m_num_buffer_reads.size(); i++) { - m_num_buffer_reads[i] = 0; - m_num_buffer_writes[i] = 0; - } - - creditQueue = new flitBuffer_d(); - // Instantiating the virtual channels - m_vcs.resize(m_num_vcs); - for (int i=0; i < m_num_vcs; i++) { - m_vcs[i] = new VirtualChannel_d(i); - } -} - -InputUnit_d::~InputUnit_d() -{ - delete creditQueue; - deletePointers(m_vcs); -} - -void -InputUnit_d::wakeup() -{ - flit_d *t_flit; - if (m_in_link->isReady(m_router->curCycle())) { - - t_flit = m_in_link->consumeLink(); - int vc = t_flit->get_vc(); - - if ((t_flit->get_type() == HEAD_) || - (t_flit->get_type() == HEAD_TAIL_)) { - - assert(m_vcs[vc]->get_state() == IDLE_); - // Do the route computation for this vc - m_router->route_req(t_flit, this, vc); - - m_vcs[vc]->set_enqueue_time(m_router->curCycle()); - } else { - t_flit->advance_stage(SA_, m_router->curCycle()); - // Changing router latency to 2 cycles. Input Unit takes 1 cycle for wakeup. - // VCalloc, SWalloc, Sw-Xfer and output scheduling takes 1 cycle. The original - // design schedules VCallocator for head flit, and Swalloc for non-head flit. - // VCalloc now calls SWalloc directly instead of scheduling it for the next cycle, - // hence we should not allocate SWalloc, otherwise it might get called twice, once - // by the scheduler and once by VCalloc. - m_router->vcarb_req(); - } - // write flit into input buffer - m_vcs[vc]->insertFlit(t_flit); - - int vnet = vc/m_vc_per_vnet; - // number of writes same as reads - // any flit that is written will be read only once - m_num_buffer_writes[vnet]++; - m_num_buffer_reads[vnet]++; - } -} - -uint32_t -InputUnit_d::functionalWrite(Packet *pkt) -{ - uint32_t num_functional_writes = 0; - for (int i=0; i < m_num_vcs; i++) { - num_functional_writes += m_vcs[i]->functionalWrite(pkt); - } - - return num_functional_writes; -} - -void -InputUnit_d::resetStats() -{ - for (int j = 0; j < m_num_buffer_reads.size(); j++) { - m_num_buffer_reads[j] = 0; - m_num_buffer_writes[j] = 0; - } -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh deleted file mode 100644 index c9437a774..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_INPUT_UNIT_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_INPUT_UNIT_D_HH__ - -#include -#include - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class InputUnit_d : public Consumer -{ - public: - InputUnit_d(int id, Router_d *router); - ~InputUnit_d(); - - void wakeup(); - flitBuffer_d* getCreditQueue() { return creditQueue; } - void print(std::ostream& out) const {}; - - inline int get_inlink_id() { return m_in_link->get_id(); } - - inline void - set_vc_state(VC_state_type state, int vc, Cycles curTime) - { - m_vcs[vc]->set_state(state, curTime); - } - - inline void - set_enqueue_time(int invc, Cycles time) - { - m_vcs[invc]->set_enqueue_time(time); - } - - inline Cycles - get_enqueue_time(int invc) - { - return m_vcs[invc]->get_enqueue_time(); - } - - inline void - update_credit(int in_vc, int credit) - { - m_vcs[in_vc]->update_credit(credit); - } - - inline bool - has_credits(int vc) - { - return m_vcs[vc]->has_credits(); - } - - inline void - increment_credit(int in_vc, bool free_signal, Cycles curTime) - { - flit_d *t_flit = new flit_d(in_vc, free_signal, curTime); - creditQueue->insert(t_flit); - m_credit_link->scheduleEventAbsolute(m_router->clockEdge(Cycles(1))); - } - - inline int - get_outvc(int invc) - { - return m_vcs[invc]->get_outvc(); - } - - inline void - updateRoute(int vc, int outport, Cycles curTime) - { - m_vcs[vc]->set_outport(outport); - m_vcs[vc]->set_state(VC_AB_, curTime); - } - - inline void - grant_vc(int in_vc, int out_vc, Cycles curTime) - { - m_vcs[in_vc]->grant_vc(out_vc, curTime); - } - - inline flit_d* - peekTopFlit(int vc) - { - return m_vcs[vc]->peekTopFlit(); - } - - inline flit_d* - getTopFlit(int vc) - { - return m_vcs[vc]->getTopFlit(); - } - - inline bool - need_stage(int vc, VC_state_type state, flit_stage stage, Cycles cTime) - { - return m_vcs[vc]->need_stage(state, stage, cTime); - } - - inline bool - isReady(int invc, Cycles curTime) - { - return m_vcs[invc]->isReady(curTime); - } - - inline int - get_route(int vc) - { - return m_vcs[vc]->get_route(); - } - - inline void - set_in_link(NetworkLink_d *link) - { - m_in_link = link; - } - - inline void - set_credit_link(CreditLink_d *credit_link) - { - m_credit_link = credit_link; - } - - double get_buf_read_count(unsigned int vnet) const - { return m_num_buffer_reads[vnet]; } - double get_buf_write_count(unsigned int vnet) const - { return m_num_buffer_writes[vnet]; } - - uint32_t functionalWrite(Packet *pkt); - void resetStats(); - - private: - int m_id; - int m_num_vcs; - int m_vc_per_vnet; - - Router_d *m_router; - NetworkLink_d *m_in_link; - CreditLink_d *m_credit_link; - flitBuffer_d *creditQueue; - - // Virtual channels - std::vector m_vcs; - - // Statistical variables - std::vector m_num_buffer_writes; - std::vector m_num_buffer_reads; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_INPUT_UNIT_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc deleted file mode 100644 index b1ce027dc..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ /dev/null @@ -1,394 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include -#include - -#include "base/cast.hh" -#include "base/stl_helpers.hh" -#include "debug/RubyNetwork.hh" -#include "mem/ruby/network/MessageBuffer.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" -#include "mem/ruby/slicc_interface/Message.hh" - -using namespace std; -using m5::stl_helpers::deletePointers; - -NetworkInterface_d::NetworkInterface_d(const Params *p) - : ClockedObject(p), Consumer(this), m_id(p->id), - m_virtual_networks(p->virt_nets), m_vc_per_vnet(p->vcs_per_vnet), - m_num_vcs(m_vc_per_vnet * m_virtual_networks) -{ - m_vc_round_robin = 0; - m_ni_buffers.resize(m_num_vcs); - m_ni_enqueue_time.resize(m_num_vcs); - creditQueue = new flitBuffer_d(); - - // instantiating the NI flit buffers - for (int i = 0; i < m_num_vcs; i++) { - m_ni_buffers[i] = new flitBuffer_d(); - m_ni_enqueue_time[i] = Cycles(INFINITE_); - } - - m_vc_allocator.resize(m_virtual_networks); // 1 allocator per vnet - for (int i = 0; i < m_virtual_networks; i++) { - m_vc_allocator[i] = 0; - } -} - -void -NetworkInterface_d::init() -{ - for (int i = 0; i < m_num_vcs; i++) { - m_out_vc_state.push_back(new OutVcState_d(i, m_net_ptr)); - } -} - -NetworkInterface_d::~NetworkInterface_d() -{ - deletePointers(m_out_vc_state); - deletePointers(m_ni_buffers); - delete creditQueue; - delete outSrcQueue; -} - -void -NetworkInterface_d::addInPort(NetworkLink_d *in_link, - CreditLink_d *credit_link) -{ - inNetLink = in_link; - in_link->setLinkConsumer(this); - m_ni_credit_link = credit_link; - credit_link->setSourceQueue(creditQueue); -} - -void -NetworkInterface_d::addOutPort(NetworkLink_d *out_link, - CreditLink_d *credit_link) -{ - m_credit_link = credit_link; - credit_link->setLinkConsumer(this); - - outNetLink = out_link; - outSrcQueue = new flitBuffer_d(); - out_link->setSourceQueue(outSrcQueue); -} - -void -NetworkInterface_d::addNode(vector& in, - vector& out) -{ - inNode_ptr = in; - outNode_ptr = out; - - for (auto& it : in) { - if (it != nullptr) { - it->setConsumer(this); - } - } -} - -bool -NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet) -{ - Message *net_msg_ptr = msg_ptr.get(); - NetDest net_msg_dest = net_msg_ptr->getDestination(); - - // gets all the destinations associated with this message. - vector dest_nodes = net_msg_dest.getAllDest(); - - // Number of flits is dependent on the link bandwidth available. - // This is expressed in terms of bytes/cycle or the flit size - int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int( - net_msg_ptr->getMessageSize())/m_net_ptr->getNiFlitSize()); - - // loop to convert all multicast messages into unicast messages - for (int ctr = 0; ctr < dest_nodes.size(); ctr++) { - - // this will return a free output virtual channel - int vc = calculateVC(vnet); - - if (vc == -1) { - return false ; - } - MsgPtr new_msg_ptr = msg_ptr->clone(); - NodeID destID = dest_nodes[ctr]; - - Message *new_net_msg_ptr = new_msg_ptr.get(); - if (dest_nodes.size() > 1) { - NetDest personal_dest; - for (int m = 0; m < (int) MachineType_NUM; m++) { - if ((destID >= MachineType_base_number((MachineType) m)) && - destID < MachineType_base_number((MachineType) (m+1))) { - // calculating the NetDest associated with this destID - personal_dest.clear(); - personal_dest.add((MachineID) {(MachineType) m, (destID - - MachineType_base_number((MachineType) m))}); - new_net_msg_ptr->getDestination() = personal_dest; - break; - } - } - net_msg_dest.removeNetDest(personal_dest); - // removing the destination from the original message to reflect - // that a message with this particular destination has been - // flitisized and an output vc is acquired - net_msg_ptr->getDestination().removeNetDest(personal_dest); - } - - for (int i = 0; i < num_flits; i++) { - m_net_ptr->increment_injected_flits(vnet); - flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr, - curCycle()); - - fl->set_delay(curCycle() - ticksToCycles(msg_ptr->getTime())); - m_ni_buffers[vc]->insert(fl); - } - - m_ni_enqueue_time[vc] = curCycle(); - m_out_vc_state[vc]->setState(ACTIVE_, curCycle()); - } - return true ; -} - -// Looking for a free output vc -int -NetworkInterface_d::calculateVC(int vnet) -{ - for (int i = 0; i < m_vc_per_vnet; i++) { - int delta = m_vc_allocator[vnet]; - m_vc_allocator[vnet]++; - if (m_vc_allocator[vnet] == m_vc_per_vnet) - m_vc_allocator[vnet] = 0; - - if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState( - IDLE_, curCycle())) { - return ((vnet*m_vc_per_vnet) + delta); - } - } - return -1; -} - -/* - * The NI wakeup checks whether there are any ready messages in the protocol - * buffer. If yes, it picks that up, flitisizes it into a number of flits and - * puts it into an output buffer and schedules the output link. On a wakeup - * it also checks whether there are flits in the input link. If yes, it picks - * them up and if the flit is a tail, the NI inserts the corresponding message - * into the protocol buffer. It also checks for credits being sent by the - * downstream router. - */ - -void -NetworkInterface_d::wakeup() -{ - DPRINTF(RubyNetwork, "m_id: %d woke up at time: %lld", m_id, curCycle()); - - MsgPtr msg_ptr; - Tick curTime = clockEdge(); - - // Checking for messages coming from the protocol - // can pick up a message/cycle for each virtual net - for (int vnet = 0; vnet < inNode_ptr.size(); ++vnet) { - MessageBuffer *b = inNode_ptr[vnet]; - if (b == nullptr) { - continue; - } - - while (b->isReady(curTime)) { // Is there a message waiting - msg_ptr = b->peekMsgPtr(); - if (flitisizeMessage(msg_ptr, vnet)) { - b->dequeue(curTime); - } else { - break; - } - } - } - - scheduleOutputLink(); - checkReschedule(); - - /*********** Picking messages destined for this NI **********/ - - if (inNetLink->isReady(curCycle())) { - flit_d *t_flit = inNetLink->consumeLink(); - bool free_signal = false; - if (t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) { - free_signal = true; - - outNode_ptr[t_flit->get_vnet()]->enqueue( - t_flit->get_msg_ptr(), curTime, cyclesToTicks(Cycles(1))); - } - // Simply send a credit back since we are not buffering - // this flit in the NI - flit_d *credit_flit = new flit_d(t_flit->get_vc(), free_signal, - curCycle()); - creditQueue->insert(credit_flit); - m_ni_credit_link-> - scheduleEventAbsolute(clockEdge(Cycles(1))); - - int vnet = t_flit->get_vnet(); - m_net_ptr->increment_received_flits(vnet); - Cycles network_delay = curCycle() - t_flit->get_enqueue_time(); - Cycles queueing_delay = t_flit->get_delay(); - - m_net_ptr->increment_network_latency(network_delay, vnet); - m_net_ptr->increment_queueing_latency(queueing_delay, vnet); - delete t_flit; - } - - /****************** Checking for credit link *******/ - - if (m_credit_link->isReady(curCycle())) { - flit_d *t_flit = m_credit_link->consumeLink(); - m_out_vc_state[t_flit->get_vc()]->increment_credit(); - if (t_flit->is_free_signal()) { - m_out_vc_state[t_flit->get_vc()]->setState(IDLE_, curCycle()); - } - delete t_flit; - } -} - -/** This function looks at the NI buffers - * if some buffer has flits which are ready to traverse the link in the next - * cycle, and the downstream output vc associated with this flit has buffers - * left, the link is scheduled for the next cycle - */ - -void -NetworkInterface_d::scheduleOutputLink() -{ - int vc = m_vc_round_robin; - m_vc_round_robin++; - if (m_vc_round_robin == m_num_vcs) - m_vc_round_robin = 0; - - for (int i = 0; i < m_num_vcs; i++) { - vc++; - if (vc == m_num_vcs) - vc = 0; - - // model buffer backpressure - if (m_ni_buffers[vc]->isReady(curCycle()) && - m_out_vc_state[vc]->has_credits()) { - - bool is_candidate_vc = true; - int t_vnet = get_vnet(vc); - int vc_base = t_vnet * m_vc_per_vnet; - - if (m_net_ptr->isVNetOrdered(t_vnet)) { - for (int vc_offset = 0; vc_offset < m_vc_per_vnet; - vc_offset++) { - int t_vc = vc_base + vc_offset; - if (m_ni_buffers[t_vc]->isReady(curCycle())) { - if (m_ni_enqueue_time[t_vc] < m_ni_enqueue_time[vc]) { - is_candidate_vc = false; - break; - } - } - } - } - if (!is_candidate_vc) - continue; - - m_out_vc_state[vc]->decrement_credit(); - // Just removing the flit - flit_d *t_flit = m_ni_buffers[vc]->getTopFlit(); - t_flit->set_time(curCycle() + Cycles(1)); - outSrcQueue->insert(t_flit); - // schedule the out link - outNetLink->scheduleEventAbsolute(clockEdge(Cycles(1))); - - if (t_flit->get_type() == TAIL_ || - t_flit->get_type() == HEAD_TAIL_) { - m_ni_enqueue_time[vc] = Cycles(INFINITE_); - } - return; - } - } -} - -int -NetworkInterface_d::get_vnet(int vc) -{ - for (int i = 0; i < m_virtual_networks; i++) { - if (vc >= (i*m_vc_per_vnet) && vc < ((i+1)*m_vc_per_vnet)) { - return i; - } - } - fatal("Could not determine vc"); -} - -void -NetworkInterface_d::checkReschedule() -{ - for (const auto& it : inNode_ptr) { - if (it == nullptr) { - continue; - } - - while (it->isReady(clockEdge())) { // Is there a message waiting - scheduleEvent(Cycles(1)); - return; - } - } - - for (int vc = 0; vc < m_num_vcs; vc++) { - if (m_ni_buffers[vc]->isReady(curCycle() + Cycles(1))) { - scheduleEvent(Cycles(1)); - return; - } - } -} - -void -NetworkInterface_d::print(std::ostream& out) const -{ - out << "[Network Interface]"; -} - -uint32_t -NetworkInterface_d::functionalWrite(Packet *pkt) -{ - uint32_t num_functional_writes = 0; - for (unsigned int i = 0; i < m_num_vcs; ++i) { - num_functional_writes += m_ni_buffers[i]->functionalWrite(pkt); - } - - num_functional_writes += outSrcQueue->functionalWrite(pkt); - return num_functional_writes; -} - -NetworkInterface_d * -GarnetNetworkInterface_dParams::create() -{ - return new NetworkInterface_d(this); -} - diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh deleted file mode 100644 index 6432114c1..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_INTERFACE_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_INTERFACE_D_HH__ - -#include -#include - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "mem/ruby/slicc_interface/Message.hh" -#include "params/GarnetNetworkInterface_d.hh" - -class MessageBuffer; -class flitBuffer_d; - -class NetworkInterface_d : public ClockedObject, public Consumer -{ - public: - typedef GarnetNetworkInterface_dParams Params; - NetworkInterface_d(const Params *p); - ~NetworkInterface_d(); - - void init(); - - void addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link); - void addOutPort(NetworkLink_d *out_link, CreditLink_d *credit_link); - - void wakeup(); - void addNode(std::vector &inNode, - std::vector &outNode); - - void print(std::ostream& out) const; - int get_vnet(int vc); - void init_net_ptr(GarnetNetwork_d *net_ptr) { m_net_ptr = net_ptr; } - - uint32_t functionalWrite(Packet *); - - private: - GarnetNetwork_d *m_net_ptr; - const NodeID M5_CLASS_VAR_USED m_id; - const int m_virtual_networks, m_vc_per_vnet, m_num_vcs; - std::vector m_out_vc_state; - std::vector m_vc_allocator; - int m_vc_round_robin; // For round robin scheduling - flitBuffer_d *outSrcQueue; // For modelling link contention - flitBuffer_d *creditQueue; - - NetworkLink_d *inNetLink; - NetworkLink_d *outNetLink; - CreditLink_d *m_credit_link; - CreditLink_d *m_ni_credit_link; - - // Input Flit Buffers - // The flit buffers which will serve the Consumer - std::vector m_ni_buffers; - std::vector m_ni_enqueue_time; - - // The Message buffers that takes messages from the protocol - std::vector inNode_ptr; - // The Message buffers that provides messages to the protocol - std::vector outNode_ptr; - - bool flitisizeMessage(MsgPtr msg_ptr, int vnet); - int calculateVC(int vnet); - void scheduleOutputLink(); - void checkReschedule(); -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_INTERFACE_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc deleted file mode 100644 index 60c7ca3f4..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh" - -NetworkLink_d::NetworkLink_d(const Params *p) - : ClockedObject(p), Consumer(this), m_id(p->link_id), - m_latency(p->link_latency), - linkBuffer(new flitBuffer_d()), link_consumer(nullptr), - link_srcQueue(nullptr), m_link_utilized(0), - m_vc_load(p->vcs_per_vnet * p->virt_nets) -{ -} - -NetworkLink_d::~NetworkLink_d() -{ - delete linkBuffer; -} - -void -NetworkLink_d::setLinkConsumer(Consumer *consumer) -{ - link_consumer = consumer; -} - -void -NetworkLink_d::setSourceQueue(flitBuffer_d *srcQueue) -{ - link_srcQueue = srcQueue; -} - -void -NetworkLink_d::wakeup() -{ - if (link_srcQueue->isReady(curCycle())) { - flit_d *t_flit = link_srcQueue->getTopFlit(); - t_flit->set_time(curCycle() + m_latency); - linkBuffer->insert(t_flit); - link_consumer->scheduleEventAbsolute(clockEdge(m_latency)); - m_link_utilized++; - m_vc_load[t_flit->get_vc()]++; - } -} - -NetworkLink_d * -NetworkLink_dParams::create() -{ - return new NetworkLink_d(this); -} - -CreditLink_d * -CreditLink_dParams::create() -{ - return new CreditLink_d(this); -} - -uint32_t -NetworkLink_d::functionalWrite(Packet *pkt) -{ - return linkBuffer->functionalWrite(pkt); -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh deleted file mode 100644 index be937f093..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_LINK_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_LINK_D_HH__ - -#include -#include - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "params/NetworkLink_d.hh" -#include "sim/clocked_object.hh" - -class GarnetNetwork_d; - -class NetworkLink_d : public ClockedObject, public Consumer -{ - public: - typedef NetworkLink_dParams Params; - NetworkLink_d(const Params *p); - ~NetworkLink_d(); - - void setLinkConsumer(Consumer *consumer); - void setSourceQueue(flitBuffer_d *srcQueue); - void print(std::ostream& out) const {} - int get_id() const { return m_id; } - void wakeup(); - - unsigned int getLinkUtilization() const { return m_link_utilized; } - const std::vector & getVcLoad() const { return m_vc_load; } - - inline bool isReady(Cycles curTime) - { return linkBuffer->isReady(curTime); } - - inline flit_d* peekLink() { return linkBuffer->peekTopFlit(); } - inline flit_d* consumeLink() { return linkBuffer->getTopFlit(); } - - uint32_t functionalWrite(Packet *); - - private: - const int m_id; - const Cycles m_latency; - - flitBuffer_d *linkBuffer; - Consumer *link_consumer; - flitBuffer_d *link_srcQueue; - - // Statistical variables - unsigned int m_link_utilized; - std::vector m_vc_load; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_LINK_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc deleted file mode 100644 index 39cfc00b5..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh" - -#include "mem/ruby/system/RubySystem.hh" - -OutVcState_d::OutVcState_d(int id, GarnetNetwork_d *network_ptr) - : m_time(0) -{ - m_id = id; - m_vc_state = IDLE_; - - if (network_ptr->get_vnet_type(id) == DATA_VNET_) - m_credit_count = network_ptr->getBuffersPerDataVC(); - else - m_credit_count = network_ptr->getBuffersPerCtrlVC(); - - assert(m_credit_count >= 1); -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh deleted file mode 100644 index 08ceecec0..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__ - -#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class OutVcState_d -{ - public: - OutVcState_d(int id, GarnetNetwork_d *network_ptr); - - int get_inport() { return m_in_port; } - int get_invc() { return m_in_vc; } - int get_credit_count() { return m_credit_count; } - - void set_inport(int port) { m_in_port = port; } - void set_invc(int vc) { m_in_vc = vc; } - inline bool - isInState(VC_state_type state, Cycles request_time) - { - return ((m_vc_state == state) && (request_time >= m_time) ); - } - inline void - setState(VC_state_type state, Cycles time) - { - m_vc_state = state; - m_time = time; - } - inline bool has_credits() { return (m_credit_count > 0); } - inline void increment_credit() { m_credit_count++; } - inline void decrement_credit() { m_credit_count--; } - - private: - int m_id ; - Cycles m_time; - VC_state_type m_vc_state; - int m_in_port; - int m_in_vc; - int m_credit_count; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc deleted file mode 100644 index 9ef2ca271..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "base/stl_helpers.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" - -using namespace std; -using m5::stl_helpers::deletePointers; - -OutputUnit_d::OutputUnit_d(int id, Router_d *router) - : Consumer(router) -{ - m_id = id; - m_router = router; - m_num_vcs = m_router->get_num_vcs(); - m_out_buffer = new flitBuffer_d(); - - for (int i = 0; i < m_num_vcs; i++) { - m_outvc_state.push_back(new OutVcState_d(i, m_router->get_net_ptr())); - } -} - -OutputUnit_d::~OutputUnit_d() -{ - delete m_out_buffer; - deletePointers(m_outvc_state); -} - -void -OutputUnit_d::decrement_credit(int out_vc) -{ - m_outvc_state[out_vc]->decrement_credit(); - m_router->update_incredit(m_outvc_state[out_vc]->get_inport(), - m_outvc_state[out_vc]->get_invc(), - m_outvc_state[out_vc]->get_credit_count()); -} - -void -OutputUnit_d::wakeup() -{ - if (m_credit_link->isReady(m_router->curCycle())) { - flit_d *t_flit = m_credit_link->consumeLink(); - int out_vc = t_flit->get_vc(); - m_outvc_state[out_vc]->increment_credit(); - m_router->update_incredit(m_outvc_state[out_vc]->get_inport(), - m_outvc_state[out_vc]->get_invc(), - m_outvc_state[out_vc]->get_credit_count()); - - if (t_flit->is_free_signal()) - set_vc_state(IDLE_, out_vc, m_router->curCycle()); - - delete t_flit; - } -} - -flitBuffer_d* -OutputUnit_d::getOutQueue() -{ - return m_out_buffer; -} - -void -OutputUnit_d::set_out_link(NetworkLink_d *link) -{ - m_out_link = link; -} - -void -OutputUnit_d::set_credit_link(CreditLink_d *credit_link) -{ - m_credit_link = credit_link; -} - -void -OutputUnit_d::update_vc(int vc, int in_port, int in_vc) -{ - m_outvc_state[vc]->setState(ACTIVE_, m_router->curCycle()); - m_outvc_state[vc]->set_inport(in_port); - m_outvc_state[vc]->set_invc(in_vc); - m_router->update_incredit(in_port, in_vc, - m_outvc_state[vc]->get_credit_count()); -} - -uint32_t -OutputUnit_d::functionalWrite(Packet *pkt) -{ - return m_out_buffer->functionalWrite(pkt); -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh deleted file mode 100644 index 85b0f6a38..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUTPUT_UNIT_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUTPUT_UNIT_D_HH__ - -#include -#include - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class OutputUnit_d : public Consumer -{ - public: - OutputUnit_d(int id, Router_d *router); - ~OutputUnit_d(); - void set_out_link(NetworkLink_d *link); - void set_credit_link(CreditLink_d *credit_link); - void wakeup(); - flitBuffer_d* getOutQueue(); - void update_vc(int vc, int in_port, int in_vc); - void print(std::ostream& out) const {}; - void decrement_credit(int out_vc); - - int - get_credit_cnt(int vc) - { - return m_outvc_state[vc]->get_credit_count(); - } - - inline int - get_outlink_id() - { - return m_out_link->get_id(); - } - - inline void - set_vc_state(VC_state_type state, int vc, Cycles curTime) - { - m_outvc_state[vc]->setState(state, curTime); - } - - inline bool - is_vc_idle(int vc, Cycles curTime) - { - return (m_outvc_state[vc]->isInState(IDLE_, curTime)); - } - - inline void - insert_flit(flit_d *t_flit) - { - m_out_buffer->insert(t_flit); - m_out_link->scheduleEventAbsolute(m_router->clockEdge(Cycles(1))); - } - - uint32_t functionalWrite(Packet *pkt); - - private: - int m_id; - int m_num_vcs; - Router_d *m_router; - NetworkLink_d *m_out_link; - CreditLink_d *m_credit_link; - - flitBuffer_d *m_out_buffer; // This is for the network link to consume - std::vector m_outvc_state; // vc state of downstream router - -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUTPUT_UNIT_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc deleted file mode 100644 index dab9b7dda..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "base/stl_helpers.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh" - -using namespace std; -using m5::stl_helpers::deletePointers; - -Router_d::Router_d(const Params *p) - : BasicRouter(p) -{ - m_virtual_networks = p->virt_nets; - m_vc_per_vnet = p->vcs_per_vnet; - m_num_vcs = m_virtual_networks * m_vc_per_vnet; - - m_routing_unit = new RoutingUnit_d(this); - m_vc_alloc = new VCallocator_d(this); - m_sw_alloc = new SWallocator_d(this); - m_switch = new Switch_d(this); - - m_input_unit.clear(); - m_output_unit.clear(); -} - -Router_d::~Router_d() -{ - deletePointers(m_input_unit); - deletePointers(m_output_unit); - delete m_routing_unit; - delete m_vc_alloc; - delete m_sw_alloc; - delete m_switch; -} - -void -Router_d::init() -{ - BasicRouter::init(); - - m_vc_alloc->init(); - m_sw_alloc->init(); - m_switch->init(); -} - -void -Router_d::addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link) -{ - int port_num = m_input_unit.size(); - InputUnit_d *input_unit = new InputUnit_d(port_num, this); - - input_unit->set_in_link(in_link); - input_unit->set_credit_link(credit_link); - in_link->setLinkConsumer(input_unit); - credit_link->setSourceQueue(input_unit->getCreditQueue()); - - m_input_unit.push_back(input_unit); -} - -void -Router_d::addOutPort(NetworkLink_d *out_link, - const NetDest& routing_table_entry, int link_weight, - CreditLink_d *credit_link) -{ - int port_num = m_output_unit.size(); - OutputUnit_d *output_unit = new OutputUnit_d(port_num, this); - - output_unit->set_out_link(out_link); - output_unit->set_credit_link(credit_link); - credit_link->setLinkConsumer(output_unit); - out_link->setSourceQueue(output_unit->getOutQueue()); - - m_output_unit.push_back(output_unit); - - m_routing_unit->addRoute(routing_table_entry); - m_routing_unit->addWeight(link_weight); -} - -void -Router_d::route_req(flit_d *t_flit, InputUnit_d *in_unit, int invc) -{ - m_routing_unit->RC_stage(t_flit, in_unit, invc); -} - -void -Router_d::vcarb_req() -{ - m_vc_alloc->scheduleEventAbsolute(clockEdge(Cycles(1))); -} - -void -Router_d::swarb_req() -{ - m_sw_alloc->scheduleEventAbsolute(clockEdge(Cycles(1))); -} - -void -Router_d::call_sw_alloc() -{ - m_sw_alloc->wakeup(); -} - -void -Router_d::call_switch() -{ - m_switch->wakeup(); -} - -void -Router_d::update_incredit(int in_port, int in_vc, int credit) -{ - m_input_unit[in_port]->update_credit(in_vc, credit); -} - -void -Router_d::update_sw_winner(int inport, flit_d *t_flit) -{ - m_switch->update_sw_winner(inport, t_flit); - m_switch->scheduleEventAbsolute(clockEdge(Cycles(1))); -} - -void -Router_d::regStats() -{ - BasicRouter::regStats(); - - m_buffer_reads - .name(name() + ".buffer_reads") - .flags(Stats::nozero) - ; - - m_buffer_writes - .name(name() + ".buffer_writes") - .flags(Stats::nozero) - ; - - m_crossbar_activity - .name(name() + ".crossbar_activity") - .flags(Stats::nozero) - ; - - m_sw_local_arbiter_activity - .name(name() + ".sw_local_arbiter_activity") - .flags(Stats::nozero) - ; - - m_sw_global_arbiter_activity - .name(name() + ".sw_global_arbiter_activity") - .flags(Stats::nozero) - ; - - m_vc_local_arbiter_activity - .name(name() + ".vc_local_arbiter_activity") - .flags(Stats::nozero) - ; - - m_vc_global_arbiter_activity - .name(name() + ".vc_global_arbiter_activity") - .flags(Stats::nozero) - ; -} - -void -Router_d::collateStats() -{ - for (int j = 0; j < m_virtual_networks; j++) { - for (int i = 0; i < m_input_unit.size(); i++) { - m_buffer_reads += m_input_unit[i]->get_buf_read_count(j); - m_buffer_writes += m_input_unit[i]->get_buf_write_count(j); - } - - m_vc_local_arbiter_activity += m_vc_alloc->get_local_arbit_count(j); - m_vc_global_arbiter_activity += m_vc_alloc->get_global_arbit_count(j); - } - - m_sw_local_arbiter_activity = m_sw_alloc->get_local_arbit_count(); - m_sw_global_arbiter_activity = m_sw_alloc->get_global_arbit_count(); - m_crossbar_activity = m_switch->get_crossbar_count(); -} - -void -Router_d::resetStats() -{ - for (int j = 0; j < m_virtual_networks; j++) { - for (int i = 0; i < m_input_unit.size(); i++) { - m_input_unit[i]->resetStats(); - } - } -} - -void -Router_d::printFaultVector(ostream& out) -{ - int temperature_celcius = BASELINE_TEMPERATURE_CELCIUS; - int num_fault_types = m_network_ptr->fault_model->number_of_fault_types; - float fault_vector[num_fault_types]; - get_fault_vector(temperature_celcius, fault_vector); - out << "Router-" << m_id << " fault vector: " << endl; - for (int fault_type_index = 0; fault_type_index < num_fault_types; - fault_type_index++){ - out << " - probability of ("; - out << - m_network_ptr->fault_model->fault_type_to_string(fault_type_index); - out << ") = "; - out << fault_vector[fault_type_index] << endl; - } -} - -void -Router_d::printAggregateFaultProbability(std::ostream& out) -{ - int temperature_celcius = BASELINE_TEMPERATURE_CELCIUS; - float aggregate_fault_prob; - get_aggregate_fault_probability(temperature_celcius, - &aggregate_fault_prob); - out << "Router-" << m_id << " fault probability: "; - out << aggregate_fault_prob << endl; -} - -uint32_t -Router_d::functionalWrite(Packet *pkt) -{ - uint32_t num_functional_writes = 0; - num_functional_writes += m_switch->functionalWrite(pkt); - - for (uint32_t i = 0; i < m_input_unit.size(); i++) { - num_functional_writes += m_input_unit[i]->functionalWrite(pkt); - } - - for (uint32_t i = 0; i < m_output_unit.size(); i++) { - num_functional_writes += m_output_unit[i]->functionalWrite(pkt); - } - - return num_functional_writes; -} - -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 deleted file mode 100644 index 99a0046ce..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__ - -#include -#include - -#include "mem/ruby/common/NetDest.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "mem/ruby/network/BasicRouter.hh" -#include "params/GarnetRouter_d.hh" - -class NetworkLink_d; -class CreditLink_d; -class InputUnit_d; -class OutputUnit_d; -class RoutingUnit_d; -class VCallocator_d; -class SWallocator_d; -class Switch_d; -class FaultModel; - -class Router_d : public BasicRouter -{ - public: - typedef GarnetRouter_dParams Params; - Router_d(const Params *p); - - ~Router_d(); - - void init(); - void addInPort(NetworkLink_d *link, CreditLink_d *credit_link); - void addOutPort(NetworkLink_d *link, const NetDest& routing_table_entry, - int link_weight, CreditLink_d *credit_link); - - int get_num_vcs() { return m_num_vcs; } - int get_num_vnets() { return m_virtual_networks; } - int get_vc_per_vnet() { return m_vc_per_vnet; } - int get_num_inports() { return m_input_unit.size(); } - 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& get_inputUnit_ref() { return m_input_unit; } - std::vector& get_outputUnit_ref() { return m_output_unit; } - - void update_sw_winner(int inport, flit_d *t_flit); - void update_incredit(int in_port, int in_vc, int credit); - void route_req(flit_d *t_flit, InputUnit_d* in_unit, int invc); - void vcarb_req(); - void swarb_req(); - void call_sw_alloc(); - void call_switch(); - - void printFaultVector(std::ostream& out); - void printAggregateFaultProbability(std::ostream& out); - - void regStats(); - void collateStats(); - void resetStats(); - - bool get_fault_vector(int temperature, float fault_vector[]){ - return m_network_ptr->fault_model->fault_vector(m_id, temperature, - fault_vector); - } - bool get_aggregate_fault_probability(int temperature, - float *aggregate_fault_prob){ - return m_network_ptr->fault_model->fault_prob(m_id, temperature, - aggregate_fault_prob); - } - - uint32_t functionalWrite(Packet *); - - private: - int m_virtual_networks, m_num_vcs, m_vc_per_vnet; - GarnetNetwork_d *m_network_ptr; - - std::vector m_input_unit; - std::vector m_output_unit; - RoutingUnit_d *m_routing_unit; - VCallocator_d *m_vc_alloc; - SWallocator_d *m_sw_alloc; - Switch_d *m_switch; - - // Statistical variables required for power computations - Stats::Scalar m_buffer_reads; - Stats::Scalar m_buffer_writes; - - Stats::Scalar m_sw_local_arbiter_activity; - Stats::Scalar m_sw_global_arbiter_activity; - - Stats::Scalar m_vc_local_arbiter_activity; - Stats::Scalar m_vc_global_arbiter_activity; - - Stats::Scalar m_crossbar_activity; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc deleted file mode 100644 index cd8f974f6..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "base/cast.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh" -#include "mem/ruby/slicc_interface/Message.hh" - -RoutingUnit_d::RoutingUnit_d(Router_d *router) -{ - m_router = router; - m_routing_table.clear(); - m_weight_table.clear(); -} - -void -RoutingUnit_d::addRoute(const NetDest& routing_table_entry) -{ - m_routing_table.push_back(routing_table_entry); -} - -void -RoutingUnit_d::addWeight(int link_weight) -{ - m_weight_table.push_back(link_weight); -} - -void -RoutingUnit_d::RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc) -{ - int outport = routeCompute(t_flit); - in_unit->updateRoute(invc, outport, m_router->curCycle()); - t_flit->advance_stage(VA_, m_router->curCycle() + Cycles(1)); - m_router->vcarb_req(); -} - -int -RoutingUnit_d::routeCompute(flit_d *t_flit) -{ - MsgPtr msg_ptr = t_flit->get_msg_ptr(); - Message *net_msg_ptr = msg_ptr.get(); - NetDest msg_destination = net_msg_ptr->getDestination(); - - int output_link = -1; - int min_weight = INFINITE_; - - for (int link = 0; link < m_routing_table.size(); link++) { - if (msg_destination.intersectionIsNotEmpty(m_routing_table[link])) { - if (m_weight_table[link] >= min_weight) - continue; - output_link = link; - min_weight = m_weight_table[link]; - } - } - - if (output_link == -1) { - fatal("Fatal Error:: No Route exists from this Router."); - exit(0); - } - - return output_link; -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh deleted file mode 100644 index 15e893150..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTING_UNIT_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTING_UNIT_D_HH__ - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/common/NetDest.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class InputUnit_d; -class Router_d; - -class RoutingUnit_d -{ - public: - RoutingUnit_d(Router_d *router); - void addRoute(const NetDest& routing_table_entry); - int routeCompute(flit_d *t_flit); - void addWeight(int link_weight); - void RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc); - - private: - Router_d *m_router; - std::vector m_routing_table; - std::vector m_weight_table; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTING_UNIT_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript b/src/mem/ruby/network/garnet/fixed-pipeline/SConscript deleted file mode 100644 index 534fdc884..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript +++ /dev/null @@ -1,53 +0,0 @@ -# -*- mode:python -*- - -# Copyright (c) 2009 The Hewlett-Packard Development Company -# 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: Nathan Binkert - -Import('*') - -if env['PROTOCOL'] == 'None': - Return() - -SimObject('GarnetLink_d.py') -SimObject('GarnetNetwork_d.py') - -Source('GarnetLink_d.cc') -Source('GarnetNetwork_d.cc') -Source('InputUnit_d.cc') -Source('NetworkInterface_d.cc') -Source('NetworkLink_d.cc') -Source('OutVcState_d.cc') -Source('OutputUnit_d.cc') -Source('Router_d.cc') -Source('RoutingUnit_d.cc') -Source('SWallocator_d.cc') -Source('Switch_d.cc') -Source('VCallocator_d.cc') -Source('VirtualChannel_d.cc') -Source('flitBuffer_d.cc') -Source('flit_d.cc') diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc deleted file mode 100644 index 2387d2e8a..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh" - -SWallocator_d::SWallocator_d(Router_d *router) - : Consumer(router) -{ - m_router = router; - m_num_vcs = m_router->get_num_vcs(); - m_vc_per_vnet = m_router->get_vc_per_vnet(); - - m_local_arbiter_activity = 0; - m_global_arbiter_activity = 0; -} - -void -SWallocator_d::init() -{ - m_input_unit = m_router->get_inputUnit_ref(); - m_output_unit = m_router->get_outputUnit_ref(); - - m_num_inports = m_router->get_num_inports(); - m_num_outports = m_router->get_num_outports(); - m_round_robin_outport.resize(m_num_outports); - m_round_robin_inport.resize(m_num_inports); - m_port_req.resize(m_num_outports); - m_vc_winners.resize(m_num_outports); - - for (int i = 0; i < m_num_inports; i++) { - m_round_robin_inport[i] = 0; - } - - for (int i = 0; i < m_num_outports; i++) { - m_port_req[i].resize(m_num_inports); - m_vc_winners[i].resize(m_num_inports); - - m_round_robin_outport[i] = 0; - - for (int j = 0; j < m_num_inports; j++) { - m_port_req[i][j] = false; // [outport][inport] - } - } -} - -void -SWallocator_d::wakeup() -{ - arbitrate_inports(); // First stage of allocation - arbitrate_outports(); // Second stage of allocation - - clear_request_vector(); - check_for_wakeup(); - m_router->call_switch(); - -} - -void -SWallocator_d::arbitrate_inports() -{ - // First do round robin arbitration on a set of input vc requests - for (int inport = 0; inport < m_num_inports; inport++) { - int invc = m_round_robin_inport[inport]; - - // Select next round robin vc candidate within valid vnet - int next_round_robin_invc = invc; - next_round_robin_invc++; - if (next_round_robin_invc >= m_num_vcs) - next_round_robin_invc = 0; - m_round_robin_inport[inport] = next_round_robin_invc; - - for (int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++) { - invc++; - if (invc >= m_num_vcs) - invc = 0; - - if (m_input_unit[inport]->need_stage(invc, ACTIVE_, SA_, - m_router->curCycle()) && - m_input_unit[inport]->has_credits(invc)) { - - if (is_candidate_inport(inport, invc)) { - int outport = m_input_unit[inport]->get_route(invc); - m_local_arbiter_activity++; - m_port_req[outport][inport] = true; - m_vc_winners[outport][inport]= invc; - break; // got one vc winner for this port - } - } - } - } -} - -bool -SWallocator_d::is_candidate_inport(int inport, int invc) -{ - int outport = m_input_unit[inport]->get_route(invc); - Cycles t_enqueue_time = m_input_unit[inport]->get_enqueue_time(invc); - int t_vnet = get_vnet(invc); - int vc_base = t_vnet*m_vc_per_vnet; - if ((m_router->get_net_ptr())->isVNetOrdered(t_vnet)) { - for (int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++) { - int temp_vc = vc_base + vc_offset; - if (m_input_unit[inport]->need_stage(temp_vc, ACTIVE_, SA_, - m_router->curCycle()) && - (m_input_unit[inport]->get_route(temp_vc) == outport) && - (m_input_unit[inport]->get_enqueue_time(temp_vc) < - t_enqueue_time)) { - return false; - break; - } - } - } - return true; -} - - -void -SWallocator_d::arbitrate_outports() -{ - // Now there are a set of input vc requests for output vcs. - // Again do round robin arbitration on these requests - for (int outport = 0; outport < m_num_outports; outport++) { - int inport = m_round_robin_outport[outport]; - m_round_robin_outport[outport]++; - - if (m_round_robin_outport[outport] >= m_num_outports) - m_round_robin_outport[outport] = 0; - - for (int inport_iter = 0; inport_iter < m_num_inports; inport_iter++) { - inport++; - if (inport >= m_num_inports) - inport = 0; - - // inport has a request this cycle for outport: - if (m_port_req[outport][inport]) { - m_port_req[outport][inport] = false; - int invc = m_vc_winners[outport][inport]; - int outvc = m_input_unit[inport]->get_outvc(invc); - - // remove flit from Input Unit - flit_d *t_flit = m_input_unit[inport]->getTopFlit(invc); - t_flit->advance_stage(ST_, m_router->curCycle()); - t_flit->set_vc(outvc); - t_flit->set_outport(outport); - t_flit->set_time(m_router->curCycle()); - - m_output_unit[outport]->decrement_credit(outvc); - m_router->update_sw_winner(inport, t_flit); - m_global_arbiter_activity++; - - if ((t_flit->get_type() == TAIL_) || - t_flit->get_type() == HEAD_TAIL_) { - - // Send a credit back - // along with the information that this VC is now idle - m_input_unit[inport]->increment_credit(invc, true, - m_router->curCycle()); - - // This Input VC should now be empty - assert(!m_input_unit[inport]-> - isReady(invc, m_router->curCycle())); - - m_input_unit[inport]->set_vc_state(IDLE_, invc, - m_router->curCycle()); - m_input_unit[inport]->set_enqueue_time(invc, - Cycles(INFINITE_)); - } else { - // Send a credit back - // but do not indicate that the VC is idle - m_input_unit[inport]->increment_credit(invc, false, - m_router->curCycle()); - } - break; // got a in request for this outport - } - } - } -} - -void -SWallocator_d::check_for_wakeup() -{ - Cycles nextCycle = m_router->curCycle() + Cycles(1); - - for (int i = 0; i < m_num_inports; i++) { - for (int j = 0; j < m_num_vcs; j++) { - if (m_input_unit[i]->need_stage(j, ACTIVE_, SA_, nextCycle)) { - m_router->vcarb_req(); - return; - } - } - } -} - -int -SWallocator_d::get_vnet(int invc) -{ - int vnet = invc/m_vc_per_vnet; - assert(vnet < m_router->get_num_vnets()); - return vnet; -} - -void -SWallocator_d::clear_request_vector() -{ - for (int i = 0; i < m_num_outports; i++) { - for (int j = 0; j < m_num_inports; j++) { - m_port_req[i][j] = false; - } - } -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh deleted file mode 100644 index 15f7b8bfe..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SW_ALLOCATOR_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SW_ALLOCATOR_D_HH__ - -#include -#include - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class Router_d; -class InputUnit_d; -class OutputUnit_d; - -class SWallocator_d : public Consumer -{ - public: - SWallocator_d(Router_d *router); - void wakeup(); - void init(); - void clear_request_vector(); - void check_for_wakeup(); - int get_vnet (int invc); - void print(std::ostream& out) const {}; - void arbitrate_inports(); - void arbitrate_outports(); - bool is_candidate_inport(int inport, int invc); - - inline double - get_local_arbit_count() - { - return m_local_arbiter_activity; - } - inline double - get_global_arbit_count() - { - return m_global_arbiter_activity; - } - - private: - int m_num_inports, m_num_outports; - int m_num_vcs, m_vc_per_vnet; - - double m_local_arbiter_activity, m_global_arbiter_activity; - - Router_d *m_router; - std::vector m_round_robin_outport; - std::vector m_round_robin_inport; - std::vector > m_port_req; - std::vector > m_vc_winners; // a list for each outport - std::vector m_input_unit; - std::vector m_output_unit; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SW_ALLOCATOR_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc deleted file mode 100644 index 25dc26e51..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "base/stl_helpers.hh" -#include "debug/RubyNetwork.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh" - -using m5::stl_helpers::deletePointers; - -Switch_d::Switch_d(Router_d *router) - : Consumer(router) -{ - m_router = router; - m_num_vcs = m_router->get_num_vcs(); - m_crossbar_activity = 0; -} - -Switch_d::~Switch_d() -{ - deletePointers(m_switch_buffer); -} - -void -Switch_d::init() -{ - m_output_unit = m_router->get_outputUnit_ref(); - - m_num_inports = m_router->get_num_inports(); - m_switch_buffer.resize(m_num_inports); - for (int i = 0; i < m_num_inports; i++) { - m_switch_buffer[i] = new flitBuffer_d(); - } -} - -void -Switch_d::wakeup() -{ - DPRINTF(RubyNetwork, "Switch woke up at time: %lld\n", - m_router->curCycle()); - - for (int inport = 0; inport < m_num_inports; inport++) { - if (!m_switch_buffer[inport]->isReady(m_router->curCycle())) - continue; - flit_d *t_flit = m_switch_buffer[inport]->peekTopFlit(); - if (t_flit->is_stage(ST_, m_router->curCycle())) { - int outport = t_flit->get_outport(); - t_flit->advance_stage(LT_, m_router->curCycle()); - t_flit->set_time(m_router->curCycle()); - - // This will take care of waking up the Network Link - m_output_unit[outport]->insert_flit(t_flit); - m_switch_buffer[inport]->getTopFlit(); - m_crossbar_activity++; - } - } - check_for_wakeup(); -} - -void -Switch_d::check_for_wakeup() -{ - Cycles nextCycle = m_router->curCycle() + Cycles(1); - - for (int inport = 0; inport < m_num_inports; inport++) { - if (m_switch_buffer[inport]->isReady(nextCycle)) { - m_router->vcarb_req(); - break; - } - } -} - -uint32_t -Switch_d::functionalWrite(Packet *pkt) -{ - uint32_t num_functional_writes = 0; - - for (uint32_t i = 0; i < m_switch_buffer.size(); ++i) { - num_functional_writes += m_switch_buffer[i]->functionalWrite(pkt); - } - - return num_functional_writes; -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh deleted file mode 100644 index 24fe6083d..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SWITCH_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SWITCH_D_HH__ - -#include -#include - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class Router_d; -class OutputUnit_d; - -class Switch_d : public Consumer -{ - public: - Switch_d(Router_d *router); - ~Switch_d(); - void wakeup(); - void init(); - void check_for_wakeup(); - void print(std::ostream& out) const {}; - - inline void update_sw_winner(int inport, flit_d *t_flit) - { m_switch_buffer[inport]->insert(t_flit); } - - inline double get_crossbar_count() { return m_crossbar_activity; } - - uint32_t functionalWrite(Packet *pkt); - - private: - int m_num_vcs; - int m_num_inports; - double m_crossbar_activity; - Router_d *m_router; - std::vector m_switch_buffer; - std::vector m_output_unit; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SWITCH_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc deleted file mode 100644 index d389f07ba..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh" -#include "mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh" - -VCallocator_d::VCallocator_d(Router_d *router) - : Consumer(router) -{ - m_router = router; - m_num_vcs = m_router->get_num_vcs(); - m_vc_per_vnet = m_router->get_vc_per_vnet(); - - m_local_arbiter_activity.resize(m_num_vcs/m_vc_per_vnet); - m_global_arbiter_activity.resize(m_num_vcs/m_vc_per_vnet); - for (int i = 0; i < m_local_arbiter_activity.size(); i++) { - m_local_arbiter_activity[i] = 0; - m_global_arbiter_activity[i] = 0; - } -} - -void -VCallocator_d::init() -{ - m_input_unit = m_router->get_inputUnit_ref(); - m_output_unit = m_router->get_outputUnit_ref(); - - m_num_inports = m_router->get_num_inports(); - m_num_outports = m_router->get_num_outports(); - m_round_robin_invc.resize(m_num_inports); - m_round_robin_outvc.resize(m_num_outports); - m_outvc_req.resize(m_num_outports); - m_outvc_is_req.resize(m_num_outports); - - for (int i = 0; i < m_num_inports; i++) { - m_round_robin_invc[i].resize(m_num_vcs); - - for (int j = 0; j < m_num_vcs; j++) { - m_round_robin_invc[i][j] = 0; - } - } - - for (int i = 0; i < m_num_outports; i++) { - m_round_robin_outvc[i].resize(m_num_vcs); - m_outvc_req[i].resize(m_num_vcs); - m_outvc_is_req[i].resize(m_num_vcs); - - for (int j = 0; j < m_num_vcs; j++) { - m_round_robin_outvc[i][j].first = 0; - m_round_robin_outvc[i][j].second = 0; - m_outvc_is_req[i][j] = false; - - m_outvc_req[i][j].resize(m_num_inports); - - for (int k = 0; k < m_num_inports; k++) { - m_outvc_req[i][j][k].resize(m_num_vcs); - for (int l = 0; l < m_num_vcs; l++) { - m_outvc_req[i][j][k][l] = false; - } - } - } - } -} - -void -VCallocator_d::clear_request_vector() -{ - for (int i = 0; i < m_num_outports; i++) { - for (int j = 0; j < m_num_vcs; j++) { - if (!m_outvc_is_req[i][j]) - continue; - m_outvc_is_req[i][j] = false; - for (int k = 0; k < m_num_inports; k++) { - for (int l = 0; l < m_num_vcs; l++) { - m_outvc_req[i][j][k][l] = false; - } - } - } - } -} - -void -VCallocator_d::wakeup() -{ - arbitrate_invcs(); // First stage of allocation - arbitrate_outvcs(); // Second stage of allocation - - clear_request_vector(); - check_for_wakeup(); - m_router->call_sw_alloc(); -} - -bool -VCallocator_d::is_invc_candidate(int inport_iter, int invc_iter) -{ - int outport = m_input_unit[inport_iter]->get_route(invc_iter); - int vnet = get_vnet(invc_iter); - Cycles t_enqueue_time = - m_input_unit[inport_iter]->get_enqueue_time(invc_iter); - - int invc_base = vnet*m_vc_per_vnet; - - if ((m_router->get_net_ptr())->isVNetOrdered(vnet)) { - for (int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++) { - int temp_vc = invc_base + vc_offset; - if (m_input_unit[inport_iter]->need_stage(temp_vc, VC_AB_, VA_, - m_router->curCycle()) && - (m_input_unit[inport_iter]->get_route(temp_vc) == outport) && - (m_input_unit[inport_iter]->get_enqueue_time(temp_vc) < - t_enqueue_time)) { - return false; - } - } - } - return true; -} - -void -VCallocator_d::select_outvc(int inport_iter, int invc_iter) -{ - int outport = m_input_unit[inport_iter]->get_route(invc_iter); - int vnet = get_vnet(invc_iter); - int outvc_base = vnet*m_vc_per_vnet; - int num_vcs_per_vnet = m_vc_per_vnet; - - int outvc_offset = m_round_robin_invc[inport_iter][invc_iter]; - m_round_robin_invc[inport_iter][invc_iter]++; - - if (m_round_robin_invc[inport_iter][invc_iter] >= num_vcs_per_vnet) - m_round_robin_invc[inport_iter][invc_iter] = 0; - - for (int outvc_offset_iter = 0; outvc_offset_iter < num_vcs_per_vnet; - outvc_offset_iter++) { - outvc_offset++; - if (outvc_offset >= num_vcs_per_vnet) - outvc_offset = 0; - int outvc = outvc_base + outvc_offset; - if (m_output_unit[outport]->is_vc_idle(outvc, m_router->curCycle())) { - m_local_arbiter_activity[vnet]++; - m_outvc_req[outport][outvc][inport_iter][invc_iter] = true; - if (!m_outvc_is_req[outport][outvc]) - m_outvc_is_req[outport][outvc] = true; - return; // out vc acquired - } - } -} - -void -VCallocator_d::arbitrate_invcs() -{ - for (int inport_iter = 0; inport_iter < m_num_inports; inport_iter++) { - for (int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++) { - if (m_input_unit[inport_iter]->need_stage(invc_iter, VC_AB_, - VA_, m_router->curCycle())) { - if (!is_invc_candidate(inport_iter, invc_iter)) - continue; - - select_outvc(inport_iter, invc_iter); - } - } - } -} - -void -VCallocator_d::arbitrate_outvcs() -{ - for (int outport_iter = 0; outport_iter < m_num_outports; outport_iter++) { - for (int outvc_iter = 0; outvc_iter < m_num_vcs; outvc_iter++) { - if (!m_outvc_is_req[outport_iter][outvc_iter]) { - // No requests for this outvc in this cycle - continue; - } - - int inport = m_round_robin_outvc[outport_iter][outvc_iter].first; - int invc_offset = - m_round_robin_outvc[outport_iter][outvc_iter].second; - int vnet = get_vnet(outvc_iter); - int invc_base = vnet*m_vc_per_vnet; - int num_vcs_per_vnet = m_vc_per_vnet; - - m_round_robin_outvc[outport_iter][outvc_iter].second++; - if (m_round_robin_outvc[outport_iter][outvc_iter].second >= - num_vcs_per_vnet) { - m_round_robin_outvc[outport_iter][outvc_iter].second = 0; - m_round_robin_outvc[outport_iter][outvc_iter].first++; - if (m_round_robin_outvc[outport_iter][outvc_iter].first >= - m_num_inports) - m_round_robin_outvc[outport_iter][outvc_iter].first = 0; - } - for (int in_iter = 0; in_iter < m_num_inports*num_vcs_per_vnet; - in_iter++) { - invc_offset++; - if (invc_offset >= num_vcs_per_vnet) { - invc_offset = 0; - inport++; - if (inport >= m_num_inports) - inport = 0; - } - int invc = invc_base + invc_offset; - if (m_outvc_req[outport_iter][outvc_iter][inport][invc]) { - m_global_arbiter_activity[vnet]++; - m_input_unit[inport]->grant_vc(invc, outvc_iter, - m_router->curCycle()); - m_output_unit[outport_iter]->update_vc( - outvc_iter, inport, invc); - break; - } - } - } - } -} - -int -VCallocator_d::get_vnet(int invc) -{ - int vnet = invc/m_vc_per_vnet; - assert(vnet < m_router->get_num_vnets()); - - return vnet; -} - -void -VCallocator_d::check_for_wakeup() -{ - Cycles nextCycle = m_router->curCycle() + Cycles(1); - - for (int i = 0; i < m_num_inports; i++) { - for (int j = 0; j < m_num_vcs; j++) { - if (m_input_unit[i]->need_stage(j, VC_AB_, VA_, nextCycle)) { - m_router->vcarb_req(); - return; - } - } - } -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh deleted file mode 100644 index 246b7ad2f..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VC_ALLOCATOR_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VC_ALLOCATOR_D_HH__ - -#include -#include -#include - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class Router_d; -class InputUnit_d; -class OutputUnit_d; - -class VCallocator_d : public Consumer -{ - public: - VCallocator_d(Router_d *router); - void init(); - void wakeup(); - void check_for_wakeup(); - void clear_request_vector(); - int get_vnet(int invc); - void print(std::ostream& out) const {} - void arbitrate_invcs(); - void arbitrate_outvcs(); - bool is_invc_candidate(int inport_iter, int invc_iter); - void select_outvc(int inport_iter, int invc_iter); - - double get_local_arbit_count(unsigned int vnet) const - { return m_local_arbiter_activity[vnet]; } - - double get_global_arbit_count(unsigned int vnet) const - { return m_global_arbiter_activity[vnet]; } - - private: - int m_num_vcs, m_vc_per_vnet; - int m_num_inports; - int m_num_outports; - - Router_d *m_router; - - // First stage of arbitration - // where all vcs select an output vc to contend for - std::vector > m_round_robin_invc; - - // Arbiter for every output vc - std::vector > > m_round_robin_outvc; - - // [outport][outvc][inport][invc] - // set true in the first phase of allocation - std::vector > > > m_outvc_req; - - std::vector > m_outvc_is_req; - - std::vector m_input_unit; - std::vector m_output_unit; - - // Statistical variables - std::vector m_local_arbiter_activity; - std::vector m_global_arbiter_activity; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VC_ALLOCATOR_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc deleted file mode 100644 index 996837b1b..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh" - -VirtualChannel_d::VirtualChannel_d(int id) - : m_enqueue_time(INFINITE_) -{ - m_id = id; - m_input_buffer = new flitBuffer_d(); - m_vc_state.first = IDLE_; - m_vc_state.second = Cycles(0); -} - -VirtualChannel_d::~VirtualChannel_d() -{ - delete m_input_buffer; -} - -void -VirtualChannel_d::set_outport(int outport) -{ - route = outport; -} - -void -VirtualChannel_d::grant_vc(int out_vc, Cycles curTime) -{ - m_output_vc = out_vc; - m_vc_state.first = ACTIVE_; - m_vc_state.second = curTime; - flit_d *t_flit = m_input_buffer->peekTopFlit(); - t_flit->advance_stage(SA_, curTime); -} - -bool -VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage, - Cycles ct) -{ - if ((m_vc_state.first == state) && (ct >= m_vc_state.second)) { - if (m_input_buffer->isReady(ct)) { - flit_d *t_flit = m_input_buffer->peekTopFlit(); - return(t_flit->is_stage(stage, ct)) ; - } - } - return false; -} - -uint32_t -VirtualChannel_d::functionalWrite(Packet *pkt) -{ - return m_input_buffer->functionalWrite(pkt); -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh deleted file mode 100644 index b55b87feb..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VIRTUAL_CHANNEL_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VIRTUAL_CHANNEL_D_HH__ - -#include - -#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class VirtualChannel_d -{ - public: - VirtualChannel_d(int id); - ~VirtualChannel_d(); - - bool need_stage(VC_state_type state, flit_stage stage, Cycles curTime); - void set_outport(int outport); - void grant_vc(int out_vc, Cycles curTime); - - inline Cycles get_enqueue_time() { return m_enqueue_time; } - inline void set_enqueue_time(Cycles time) { m_enqueue_time = time; } - inline VC_state_type get_state() { return m_vc_state.first; } - inline int get_outvc() { return m_output_vc; } - inline bool has_credits() { return (m_credit_count > 0); } - inline int get_route() { return route; } - inline void update_credit(int credit) { m_credit_count = credit; } - inline void increment_credit() { m_credit_count++; } - - inline bool isReady(Cycles curTime) - { - return m_input_buffer->isReady(curTime); - } - - inline void - insertFlit(flit_d *t_flit) - { - m_input_buffer->insert(t_flit); - } - - inline void - set_state(VC_state_type m_state, Cycles curTime) - { - m_vc_state.first = m_state; - m_vc_state.second = curTime; - } - - inline flit_d* - peekTopFlit() - { - return m_input_buffer->peekTopFlit(); - } - - inline flit_d* - getTopFlit() - { - return m_input_buffer->getTopFlit(); - } - - uint32_t functionalWrite(Packet *pkt); - - private: - int m_id; - flitBuffer_d *m_input_buffer; - std::pair m_vc_state; // I/R/V/A/C - int route; - Cycles m_enqueue_time; - int m_output_vc; - int m_credit_count; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VIRTUAL_CHANNEL_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc deleted file mode 100644 index 1305b1547..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" - -flitBuffer_d::flitBuffer_d() -{ - max_size = INFINITE_; -} - -flitBuffer_d::flitBuffer_d(int maximum_size) -{ - max_size = maximum_size; -} - -bool -flitBuffer_d::isEmpty() -{ - return (m_buffer.size() == 0); -} - -bool -flitBuffer_d::isReady(Cycles curTime) -{ - if (m_buffer.size() != 0 ) { - flit_d *t_flit = peekTopFlit(); - if (t_flit->get_time() <= curTime) - return true; - } - return false; -} - -void -flitBuffer_d::print(std::ostream& out) const -{ - out << "[flitBuffer: " << m_buffer.size() << "] " << std::endl; -} - -bool -flitBuffer_d::isFull() -{ - return (m_buffer.size() >= max_size); -} - -void -flitBuffer_d::setMaxSize(int maximum) -{ - max_size = maximum; -} - -uint32_t -flitBuffer_d::functionalWrite(Packet *pkt) -{ - uint32_t num_functional_writes = 0; - - for (unsigned int i = 0; i < m_buffer.size(); ++i) { - if (m_buffer[i]->functionalWrite(pkt)) { - num_functional_writes++; - } - } - - return num_functional_writes; -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh deleted file mode 100644 index bfa6cc9a9..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_BUFFER_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_BUFFER_D_HH__ - -#include -#include -#include - -#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class flitBuffer_d -{ - public: - flitBuffer_d(); - flitBuffer_d(int maximum_size); - - bool isReady(Cycles curTime); - bool isEmpty(); - void print(std::ostream& out) const; - bool isFull(); - void setMaxSize(int maximum); - - flit_d * - getTopFlit() - { - flit_d *f = m_buffer.front(); - std::pop_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater); - m_buffer.pop_back(); - return f; - } - - flit_d * - peekTopFlit() - { - return m_buffer.front(); - } - - void - insert(flit_d *flt) - { - m_buffer.push_back(flt); - std::push_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater); - } - - uint32_t functionalWrite(Packet *pkt); - - private: - std::vector m_buffer; - int max_size; -}; - -inline std::ostream& -operator<<(std::ostream& out, const flitBuffer_d& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_BUFFER_D_HH__ diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc deleted file mode 100644 index bb0d3eda5..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh" - -flit_d::flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr, - Cycles curTime) -{ - m_size = size; - m_msg_ptr = msg_ptr; - m_enqueue_time = curTime; - m_time = curTime; - m_id = id; - m_vnet = vnet; - m_vc = vc; - m_stage.first = I_; - m_stage.second = m_time; - - if (size == 1) { - m_type = HEAD_TAIL_; - return; - } - if (id == 0) - m_type = HEAD_; - else if (id == (size - 1)) - m_type = TAIL_; - else - m_type = BODY_; -} - -flit_d::flit_d(int vc, bool is_free_signal, Cycles curTime) -{ - m_id = 0; - m_vc = vc; - m_is_free_signal = is_free_signal; - m_time = curTime; -} - -void -flit_d::print(std::ostream& out) const -{ - out << "[flit:: "; - out << "Id=" << m_id << " "; - out << "Type=" << m_type << " "; - out << "Vnet=" << m_vnet << " "; - out << "VC=" << m_vc << " "; - out << "Enqueue Time=" << m_enqueue_time << " "; - out << "]"; -} - -bool -flit_d::functionalWrite(Packet *pkt) -{ - Message *msg = m_msg_ptr.get(); - return msg->functionalWrite(pkt); -} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh deleted file mode 100644 index eb076d613..000000000 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * 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: Niket Agarwal - */ - -#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_D_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_D_HH__ - -#include -#include - -#include "base/types.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "mem/ruby/slicc_interface/Message.hh" - -class flit_d -{ - public: - flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime); - flit_d(int vc, bool is_free_signal, Cycles curTime); - void set_outport(int port) { m_outport = port; } - int get_outport() {return m_outport; } - void print(std::ostream& out) const; - bool is_free_signal() { return m_is_free_signal; } - int get_size() { return m_size; } - Cycles get_enqueue_time() { return m_enqueue_time; } - int get_id() { return m_id; } - Cycles get_time() { return m_time; } - void set_time(Cycles time) { m_time = time; } - int get_vnet() { return m_vnet; } - int get_vc() { return m_vc; } - void set_vc(int vc) { m_vc = vc; } - MsgPtr& get_msg_ptr() { return m_msg_ptr; } - flit_type get_type() { return m_type; } - - bool - is_stage(flit_stage t_stage, Cycles curTime) - { - return (m_stage.first == t_stage && - curTime >= m_stage.second); - } - - void - advance_stage(flit_stage t_stage, Cycles newTime) - { - m_stage.first = t_stage; - m_stage.second = newTime; - } - - std::pair get_stage() { return m_stage; } - - void set_delay(Cycles delay) { src_delay = delay; } - Cycles get_delay() { return src_delay; } - - static bool - greater(flit_d* n1, flit_d* n2) - { - if (n1->get_time() == n2->get_time()) { - //assert(n1->flit_id != n2->flit_id); - return (n1->get_id() > n2->get_id()); - } else { - return (n1->get_time() > n2->get_time()); - } - } - - bool functionalWrite(Packet *pkt); - - private: - int m_id; - int m_vnet; - int m_vc; - int m_size; - bool m_is_free_signal; - Cycles m_enqueue_time, m_time; - flit_type m_type; - MsgPtr m_msg_ptr; - int m_outport; - Cycles src_delay; - std::pair m_stage; -}; - -inline std::ostream& -operator<<(std::ostream& out, const flit_d& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_D_HH__ -- cgit v1.2.3