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. --- .../garnet/flexible-pipeline/FlexibleConsumer.hh | 49 --- .../network/garnet/flexible-pipeline/GarnetLink.cc | 78 ---- .../network/garnet/flexible-pipeline/GarnetLink.hh | 89 ---- .../network/garnet/flexible-pipeline/GarnetLink.py | 72 ---- .../garnet/flexible-pipeline/GarnetNetwork.cc | 240 ----------- .../garnet/flexible-pipeline/GarnetNetwork.hh | 104 ----- .../garnet/flexible-pipeline/GarnetNetwork.py | 62 --- .../network/garnet/flexible-pipeline/InVcState.cc | 76 ---- .../network/garnet/flexible-pipeline/InVcState.hh | 57 --- .../garnet/flexible-pipeline/NetworkInterface.cc | 384 ------------------ .../garnet/flexible-pipeline/NetworkInterface.hh | 106 ----- .../garnet/flexible-pipeline/NetworkLink.cc | 151 ------- .../garnet/flexible-pipeline/NetworkLink.hh | 96 ----- .../network/garnet/flexible-pipeline/OutVcState.cc | 58 --- .../network/garnet/flexible-pipeline/OutVcState.hh | 52 --- .../network/garnet/flexible-pipeline/Router.cc | 448 --------------------- .../network/garnet/flexible-pipeline/Router.hh | 110 ----- .../network/garnet/flexible-pipeline/SConscript | 48 --- .../network/garnet/flexible-pipeline/VCarbiter.cc | 45 --- .../network/garnet/flexible-pipeline/VCarbiter.hh | 54 --- .../ruby/network/garnet/flexible-pipeline/flit.cc | 75 ---- .../ruby/network/garnet/flexible-pipeline/flit.hh | 93 ----- .../network/garnet/flexible-pipeline/flitBuffer.cc | 127 ------ .../network/garnet/flexible-pipeline/flitBuffer.hh | 71 ---- 24 files changed, 2745 deletions(-) delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.py delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/Router.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/Router.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/SConscript delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/flit.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/flit.hh delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc delete mode 100644 src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh (limited to 'src/mem/ruby/network/garnet/flexible-pipeline') diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh deleted file mode 100644 index f0fe26314..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh +++ /dev/null @@ -1,49 +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_FLEXIBLE_PIPELINE_FLEXIBLE_CONSUMER_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLEXIBLE_CONSUMER_HH__ - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/common/NetDest.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class FlexibleConsumer : public Consumer -{ - public: - FlexibleConsumer(ClockedObject *em) : Consumer(em) {} - virtual bool isBufferNotFull(int vc, int inport) { return true; } - virtual void grant_vc(int out_port, int vc, Cycles grant_time) {} - virtual void release_vc(int out_port, int vc, Cycles release_time) {} - virtual void request_vc(int vc, int in_port, NetDest destination, - Cycles request_time) {} -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLEXIBLE_CONSUMER_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.cc deleted file mode 100644 index 270b1327e..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.cc +++ /dev/null @@ -1,78 +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/flexible-pipeline/GarnetLink.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" - -GarnetIntLink::GarnetIntLink(const Params *p) - : BasicLink(p) -{ - m_network_links[0] = p->network_links[0]; - m_network_links[1] = p->network_links[1]; -} - -void -GarnetIntLink::init() -{ -} - -void -GarnetIntLink::print(std::ostream& out) const -{ - out << name(); -} - -GarnetIntLink * -GarnetIntLinkParams::create() -{ - return new GarnetIntLink(this); -} - -GarnetExtLink::GarnetExtLink(const Params *p) - : BasicLink(p) -{ - m_network_links[0] = p->network_links[0]; - m_network_links[1] = p->network_links[1]; -} - -void -GarnetExtLink::init() -{ -} - -void -GarnetExtLink::print(std::ostream& out) const -{ - out << name(); -} - -GarnetExtLink * -GarnetExtLinkParams::create() -{ - return new GarnetExtLink(this); -} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh deleted file mode 100644 index cd42378bf..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh +++ /dev/null @@ -1,89 +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_FLEXIBLE_PIPELINE_LINK_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_LINK_HH__ - -#include -#include -#include - -#include "mem/ruby/network/BasicLink.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" -#include "params/GarnetIntLink.hh" -#include "params/GarnetExtLink.hh" - -class GarnetIntLink : public BasicLink -{ - public: - typedef GarnetIntLinkParams Params; - GarnetIntLink(const Params *p); - - void init(); - - void print(std::ostream& out) const; - - friend class GarnetNetwork; - - protected: - NetworkLink* m_network_links[2]; -}; - -inline std::ostream& -operator<<(std::ostream& out, const GarnetIntLink& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -class GarnetExtLink : public BasicLink -{ - public: - typedef GarnetExtLinkParams Params; - GarnetExtLink(const Params *p); - - void init(); - - void print(std::ostream& out) const; - - friend class GarnetNetwork; - - protected: - NetworkLink* m_network_links[2]; -}; - -inline std::ostream& -operator<<(std::ostream& out, const GarnetExtLink& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_LINK_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py deleted file mode 100644 index 1fefca2c5..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py +++ /dev/null @@ -1,72 +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(ClockedObject): - type = 'NetworkLink' - cxx_header = "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.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") - channel_width = Param.Int(Parent.bandwidth_factor, - "channel width == bw factor") - -# Interior fixed pipeline links between routers -class GarnetIntLink(BasicIntLink): - type = 'GarnetIntLink' - cxx_header = "mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh" - # The flexible pipeline bi-directional link only include two main - # forward links and no backward flow-control links - nls = [] - # In uni-directional link - nls.append(NetworkLink()); - # Out uni-directional link - nls.append(NetworkLink()); - network_links = VectorParam.NetworkLink(nls, "forward links") - -# Exterior fixed pipeline links between a router and a controller -class GarnetExtLink(BasicExtLink): - type = 'GarnetExtLink' - cxx_header = "mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh" - # The flexible pipeline bi-directional link only include two main - # forward links and no backward flow-control links - nls = [] - # In uni-directional link - nls.append(NetworkLink()); - # Out uni-directional link - nls.append(NetworkLink()); - network_links = VectorParam.NetworkLink(nls, "forward links") diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc deleted file mode 100644 index bc37c62c5..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ /dev/null @@ -1,240 +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/BasicLink.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/Router.hh" -#include "mem/ruby/system/RubySystem.hh" - -using namespace std; -using m5::stl_helpers::deletePointers; - -GarnetNetwork::GarnetNetwork(const Params *p) - : BaseGarnetNetwork(p) -{ - m_buffer_size = p->buffer_size; - m_number_of_pipe_stages = p->number_of_pipe_stages; - - // record the routers - for (vector::const_iterator i = p->routers.begin(); - i != p->routers.end(); ++i) { - Router* router = safe_cast(*i); - m_routers.push_back(router); - } - - for (int i=0; i < m_nodes; i++) { - NetworkInterface *ni = safe_cast(p->netifs[i]); - m_nis.push_back(ni); - } -} - -void -GarnetNetwork::init() -{ - BaseGarnetNetwork::init(); - - // Setup the network switches - assert (m_topology_ptr!=NULL); - - // initialize the router's network pointers - for (vector::const_iterator i = m_routers.begin(); - i != m_routers.end(); ++i) { - Router* router = safe_cast(*i); - router->init_net_ptr(this); - } - - for (int i=0; i < m_nodes; i++) { - m_nis[i]->init_net_ptr(this); - m_nis[i]->addNode(m_toNetQueues[i], m_fromNetQueues[i]); - } - - m_topology_ptr->createLinks(this); -} - -GarnetNetwork::~GarnetNetwork() -{ - deletePointers(m_routers); - deletePointers(m_nis); - deletePointers(m_links); -} - -void -GarnetNetwork::makeExtInLink(NodeID src, SwitchID dest, BasicLink* link, - const NetDest& routing_table_entry) -{ - assert(src < m_nodes); - - GarnetExtLink* garnet_link = safe_cast(link); - NetworkLink *net_link = garnet_link->m_network_links[0]; - - net_link->init_net_ptr(this); - m_links.push_back(net_link); - m_routers[dest]->addInPort(net_link); - m_nis[src]->addOutPort(net_link); -} - -void -GarnetNetwork::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* garnet_link = safe_cast(link); - NetworkLink *net_link = garnet_link->m_network_links[1]; - - net_link->init_net_ptr(this); - m_links.push_back(net_link); - m_routers[src]->addOutPort(net_link, routing_table_entry, - link->m_weight); - m_nis[dest]->addInPort(net_link); -} - -void -GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, - const NetDest& routing_table_entry, - PortDirection src_outport, - PortDirection dst_inport) -{ - GarnetIntLink* garnet_link = safe_cast(link); - NetworkLink *net_link = garnet_link->m_network_links[0]; - - net_link->init_net_ptr(this); - m_links.push_back(net_link); - m_routers[dest]->addInPort(net_link); - m_routers[src]->addOutPort(net_link, routing_table_entry, - link->m_weight); -} - -/* - * Go through all the routers, network interfaces and the interconnecting - * links for reading/writing all the messages. - */ -bool -GarnetNetwork::functionalRead(Packet *pkt) -{ - for (unsigned int i = 0; i < m_routers.size(); i++) { - if (m_routers[i]->functionalRead(pkt)) { - return true; - } - } - - for (unsigned int i = 0; i < m_nis.size(); ++i) { - if (m_nis[i]->functionalRead(pkt)) { - return true; - } - } - - for (unsigned int i = 0; i < m_links.size(); ++i) { - if (m_links[i]->functionalRead(pkt)) { - return true; - } - } - - return false; -} - -uint32_t -GarnetNetwork::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; -} - -void -GarnetNetwork::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) - ; - for (int i = 0; i < m_virtual_networks * m_vcs_per_vnet; i++) { - m_average_vc_load - .subname(i, csprintf(".%i", i)) - .flags(Stats::nozero) - ; - } -} - -void -GarnetNetwork::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] += vc_load[j]; - } - } -} - -void -GarnetNetwork::print(ostream& out) const -{ - out << "[GarnetNetwork]"; -} - -GarnetNetwork * -GarnetNetworkParams::create() -{ - return new GarnetNetwork(this); -} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh deleted file mode 100644 index 6ffa06329..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ /dev/null @@ -1,104 +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_FLEXIBLE_PIPELINE_GARNET_NETWORK_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_GARNET_NETWORK_HH__ - -#include -#include - -#include "mem/ruby/network/garnet/BaseGarnetNetwork.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "params/GarnetNetwork.hh" - -class NetworkInterface; -class Router; -class NetDest; -class NetworkLink; - -class GarnetNetwork : public BaseGarnetNetwork -{ - public: - typedef GarnetNetworkParams Params; - GarnetNetwork(const Params *p); - - ~GarnetNetwork(); - void init(); - - int getBufferSize() { return m_buffer_size; } - int getNumPipeStages() {return m_number_of_pipe_stages; } - - void collateStats(); - void regStats(); - void print(std::ostream& out) const; - - // 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 read. The return value - //! indicates if a message was found that had the required address. - bool functionalRead(Packet *pkt); - - //! Function for performing a functional write. The return value - //! indicates the number of messages that were written. - uint32_t functionalWrite(Packet *pkt); - - private: - GarnetNetwork(const GarnetNetwork& obj); - GarnetNetwork& operator=(const GarnetNetwork& obj); - - std::vector m_routers; // All Routers in Network - std::vector m_links; // All links in network - std::vector m_nis; // All NI's in Network - - int m_buffer_size; - int m_number_of_pipe_stages; - - // Statistical variables - Stats::Scalar m_average_link_utilization; - Stats::Vector m_average_vc_load; -}; - -inline std::ostream& -operator<<(std::ostream& out, const GarnetNetwork& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_GARNET_NETWORK_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.py b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.py deleted file mode 100644 index 0c9b143a3..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.py +++ /dev/null @@ -1,62 +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(BasicRouter): - type = 'GarnetRouter' - cxx_class = 'Router' - cxx_header = "mem/ruby/network/garnet/flexible-pipeline/Router.hh" - 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 GarnetNetworkInterface(ClockedObject): - type = 'GarnetNetworkInterface' - cxx_class = 'NetworkInterface' - cxx_header = "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.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(BaseGarnetNetwork): - type = 'GarnetNetwork' - cxx_header = "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" - buffer_size = Param.UInt32(0, - "default buffer size; 0 indicates infinite buffering"); - number_of_pipe_stages = Param.UInt32(4, "router pipeline stages"); diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc b/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc deleted file mode 100644 index dc2d3f24a..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc +++ /dev/null @@ -1,76 +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/flexible-pipeline/InVcState.hh" - -InVcState::InVcState(int id) -{ - m_id = id; - m_vc_state = IDLE_; -} - -bool -InVcState::isInState(VC_state_type state, Cycles request_time) -{ - return ((m_vc_state == state) && (request_time >= m_time) ); -} - -void -InVcState::setRoute(int route) -{ - m_route = route; -} - -void -InVcState::setState(VC_state_type state, Cycles time) -{ - m_vc_state = state; - m_time = time; -} - -void -InVcState::grant_vc(int out_vc, Cycles grant_time) -{ - m_vc_state = ACTIVE_; - m_time = grant_time; - m_output_vc = out_vc; -} - -int -InVcState::get_outport() -{ - return m_route; -} - -int -InVcState::get_outvc() -{ - return m_output_vc; -} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh b/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh deleted file mode 100644 index 4f4f95f5c..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.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_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__ - -#include "base/types.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class InVcState -{ - public: - InVcState(int id); - - void setRoute(int route); - void setState(VC_state_type state, Cycles time); - int get_outport(); - int get_outvc(); - void grant_vc(int out_vc, Cycles grant_time); - bool isInState(VC_state_type state, Cycles time); - - private: - int m_id; - int m_route; - int m_output_vc; - VC_state_type m_vc_state; - Cycles m_time; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc deleted file mode 100644 index d2a6ed4b1..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ /dev/null @@ -1,384 +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/flexible-pipeline/NetworkInterface.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" -#include "mem/ruby/slicc_interface/Message.hh" - -using namespace std; -using m5::stl_helpers::deletePointers; - -NetworkInterface::NetworkInterface(const Params *p) - : ClockedObject(p), FlexibleConsumer(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; - - // instantiating the NI flit buffers - m_ni_buffers.resize(m_num_vcs); - for (int i =0; i < m_num_vcs; i++) - m_ni_buffers[i] = new flitBuffer(); - - m_vc_allocator.resize(m_virtual_networks); - for (int i = 0; i < m_virtual_networks; i++) { - m_vc_allocator[i] = 0; - } - - for (int i = 0; i < m_num_vcs; i++) { - m_out_vc_state.push_back(new OutVcState(i)); - } -} - -NetworkInterface::~NetworkInterface() -{ - deletePointers(m_out_vc_state); - deletePointers(m_ni_buffers); - delete outSrcQueue; -} - -void -NetworkInterface::addInPort(NetworkLink *in_link) -{ - inNetLink = in_link; - in_link->setLinkConsumer(this); -} - -void -NetworkInterface::addOutPort(NetworkLink *out_link) -{ - outNetLink = out_link; - outSrcQueue = new flitBuffer(); - out_link->setSourceQueue(outSrcQueue); - out_link->setSource(this); -} - -void -NetworkInterface::addNode(vector& in, - vector& out) -{ - inNode_ptr = in; - outNode_ptr = out; - - for (auto& it: in) { - if (it != nullptr) { - it->setConsumer(this); - } - } -} - -void -NetworkInterface::request_vc(int in_vc, int in_port, NetDest destination, - Cycles request_time) -{ - inNetLink->grant_vc_link(in_vc, request_time); -} - -bool -NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet) -{ - Message *net_msg_ptr = msg_ptr.get(); - NetDest net_msg_dest = net_msg_ptr->getDestination(); - - // get 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++) { - int vc = calculateVC(vnet); // this will return a free output vc - - if (vc == -1) { - // did not find a free output vc - 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 *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr, - curCycle()); - fl->set_delay(curCycle() - ticksToCycles(msg_ptr->getTime())); - m_ni_buffers[vc]->insert(fl); - } - - m_out_vc_state[vc]->setState(VC_AB_, curCycle()); - - // setting an output vc request for the next hop. - // This flit will be ready to traverse the link and into the next hop - // only when an output vc is acquired at the next hop - outNetLink->request_vc_link( - vc, new_net_msg_ptr->getDestination(), curCycle()); - } - - return true ; -} - -// An output vc has been granted at the next hop to one of the vc's. -// We have to update the state of the vc to reflect this -void -NetworkInterface::grant_vc(int out_port, int vc, Cycles grant_time) -{ - assert(m_out_vc_state[vc]->isInState(VC_AB_, grant_time)); - m_out_vc_state[vc]->grant_vc(grant_time); - scheduleEvent(Cycles(1)); -} - -// The tail flit corresponding to this vc has been buffered at the next hop -// and thus this vc is now free -void -NetworkInterface::release_vc(int out_port, int vc, Cycles release_time) -{ - assert(m_out_vc_state[vc]->isInState(ACTIVE_, release_time)); - m_out_vc_state[vc]->setState(IDLE_, release_time); - scheduleEvent(Cycles(1)); -} - -// Looking for a free output vc -int -NetworkInterface::calculateVC(int vnet) -{ - int vc_per_vnet; - if (m_net_ptr->isVNetOrdered(vnet)) - vc_per_vnet = 1; - else - vc_per_vnet = m_vc_per_vnet; - - for (int i = 0; i < vc_per_vnet; i++) { - int delta = m_vc_allocator[vnet]; - m_vc_allocator[vnet]++; - if (m_vc_allocator[vnet] == 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. - */ - -void -NetworkInterface::wakeup() -{ - MsgPtr msg_ptr; - - //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(clockEdge())) { // Is there a message waiting - msg_ptr = b->peekMsgPtr(); - if (flitisizeMessage(msg_ptr, vnet)) { - b->dequeue(clockEdge()); - } else { - break; - } - } - } - - scheduleOutputLink(); - checkReschedule(); - - /*********** Picking messages destined for this NI **********/ - - if (inNetLink->isReady()) { - flit *t_flit = inNetLink->consumeLink(); - if (t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) { - DPRINTF(RubyNetwork, "m_id: %d, Message delivered at time: %lld\n", - m_id, curCycle()); - - outNode_ptr[t_flit->get_vnet()]->enqueue( - t_flit->get_msg_ptr(), clockEdge(), cyclesToTicks(Cycles(1))); - - // signal the upstream router that this vc can be freed now - inNetLink->release_vc_link(t_flit->get_vc(), - curCycle() + Cycles(1)); - } - - int vnet = t_flit->get_vnet(); - m_net_ptr->increment_received_flits(vnet); - Cycles network_delay = curCycle() - t_flit->get_creation_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; - } -} - -/* This function looks at the NI buffers and if some buffer has flits which - * are ready to traverse the link in the next cycle and also the downstream - * output vc associated with this flit has buffers left, the link is scheduled - * for the next cycle - */ - -void -NetworkInterface::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; - if (m_ni_buffers[vc]->isReady(curCycle())) { - if (m_out_vc_state[vc]->isInState(ACTIVE_, curCycle()) && - outNetLink->isBufferNotFull_link(vc)) { // buffer backpressure - - // Just removing the flit - flit *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))); - return; - } - } - } -} - -void -NetworkInterface::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; - } - } -} - -bool -NetworkInterface::functionalRead(Packet *pkt) -{ - // Go through the internal buffers - for (unsigned int i = 0; i < m_ni_buffers.size(); ++i) { - if (m_ni_buffers[i]->functionalRead(pkt)) { - return true; - } - } - - // Go through the buffer between this network interface and the router - if (outSrcQueue->functionalRead(pkt)) { - return true; - } - - return false; -} - -uint32_t -NetworkInterface::functionalWrite(Packet *pkt) -{ - uint32_t num_functional_writes = 0; - for (unsigned int i = 0; i < m_ni_buffers.size(); ++i) { - num_functional_writes += m_ni_buffers[i]->functionalWrite(pkt); - } - - num_functional_writes += outSrcQueue->functionalWrite(pkt); - return num_functional_writes; -} - -void -NetworkInterface::print(std::ostream& out) const -{ - out << "[Network Interface]"; -} - -NetworkInterface * -GarnetNetworkInterfaceParams::create() -{ - return new NetworkInterface(this); -} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh deleted file mode 100644 index 9207c353a..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh +++ /dev/null @@ -1,106 +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_FLEXIBLE_PIPELINE_NETWORK_INTERFACE_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_INTERFACE_HH__ - -#include -#include - -#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "mem/ruby/slicc_interface/Message.hh" -#include "params/GarnetNetworkInterface.hh" - -class MessageBuffer; -class flitBuffer; - -class NetworkInterface : public ClockedObject, public FlexibleConsumer -{ - public: - typedef GarnetNetworkInterfaceParams Params; - NetworkInterface(const Params *p); - - ~NetworkInterface(); - - void addInPort(NetworkLink *in_link); - void addOutPort(NetworkLink *out_link); - void addNode(std::vector &inNode, - std::vector &outNode); - - void wakeup(); - void grant_vc(int out_port, int vc, Cycles grant_time); - void release_vc(int out_port, int vc, Cycles release_time); - - bool isBufferNotFull(int vc, int inport) { return true; } - void request_vc(int in_vc, int in_port, NetDest destination, - Cycles request_time); - - void print(std::ostream& out) const; - - bool functionalRead(Packet *); - uint32_t functionalWrite(Packet *); - - void init_net_ptr(GarnetNetwork* net_ptr) { m_net_ptr = net_ptr; } - - private: - GarnetNetwork *m_net_ptr; - uint32_t m_virtual_networks, m_num_vcs, m_vc_per_vnet; - NodeID m_id; - - std::vector m_out_vc_state; - std::vector m_vc_allocator; - int m_vc_round_robin; // For round robin scheduling - flitBuffer *outSrcQueue; // For modelling link contention - - NetworkLink *inNetLink; - NetworkLink *outNetLink; - - // Input Flit Buffers - - // The flit buffers which will serve the Consumer - std::vector m_ni_buffers; - - // 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_FLEXIBLE_PIPELINE_NETWORK_INTERFACE_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc deleted file mode 100644 index f445b5d07..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc +++ /dev/null @@ -1,151 +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/flexible-pipeline/GarnetNetwork.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" - -NetworkLink::NetworkLink(const Params *p) - : ClockedObject(p), Consumer(this), m_id(p->link_id), - m_latency(p->link_latency), m_in_port(0), m_out_port(0), - linkBuffer(new flitBuffer()), link_consumer(nullptr), - link_source(nullptr), link_srcQueue(nullptr), m_link_utilized(0), - m_vc_load(p->virt_nets * p->vcs_per_vnet) -{ -} - -NetworkLink::~NetworkLink() -{ - delete linkBuffer; -} - -void -NetworkLink::setLinkConsumer(FlexibleConsumer *consumer) -{ - link_consumer = consumer; -} - -void -NetworkLink::setSourceQueue(flitBuffer *srcQueue) -{ - link_srcQueue = srcQueue; -} - -void -NetworkLink::setSource(FlexibleConsumer *source) -{ - link_source = source; -} - -void -NetworkLink::request_vc_link(int vc, NetDest destination, Cycles request_time) -{ - link_consumer->request_vc(vc, m_in_port, destination, request_time); -} - -bool -NetworkLink::isBufferNotFull_link(int vc) -{ - return link_consumer->isBufferNotFull(vc, m_in_port); -} - -void -NetworkLink::grant_vc_link(int vc, Cycles grant_time) -{ - link_source->grant_vc(m_out_port, vc, grant_time); -} - -void -NetworkLink::release_vc_link(int vc, Cycles release_time) -{ - link_source->release_vc(m_out_port, vc, release_time); -} - -bool -NetworkLink::isReady() -{ - return linkBuffer->isReady(curCycle()); -} - -void -NetworkLink::setInPort(int port) -{ - m_in_port = port; -} - -void -NetworkLink::setOutPort(int port) -{ - m_out_port = port; -} - -void -NetworkLink::wakeup() -{ - if (!link_srcQueue->isReady(curCycle())) - return; - - flit *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()]++; -} - -flit* -NetworkLink::peekLink() -{ - return linkBuffer->peekTopFlit(); -} - -flit* -NetworkLink::consumeLink() -{ - return linkBuffer->getTopFlit(); -} - -bool -NetworkLink::functionalRead(Packet *pkt) -{ - return linkBuffer->functionalRead(pkt); -} - -uint32_t -NetworkLink::functionalWrite(Packet *pkt) -{ - return linkBuffer->functionalWrite(pkt); -} - -NetworkLink * -NetworkLinkParams::create() -{ - return new NetworkLink(this); -} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh deleted file mode 100644 index f821daf7a..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh +++ /dev/null @@ -1,96 +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_FLEXIBLE_PIPELINE_NETWORK_LINK_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_LINK_HH__ - -#include -#include - -#include "mem/ruby/common/NetDest.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "params/NetworkLink.hh" -#include "sim/clocked_object.hh" - -class GarnetNetwork; - -class NetworkLink : public ClockedObject, public Consumer -{ - public: - typedef NetworkLinkParams Params; - NetworkLink(const Params *p); - ~NetworkLink(); - - void setLinkConsumer(FlexibleConsumer *consumer); - void setSourceQueue(flitBuffer *srcQueue); - flit *peekLink(); - flit *consumeLink(); - - void print(std::ostream& out) const {} - - bool is_vc_ready(flit *t_flit); - - int get_id() const { return m_id; } - void setInPort(int port); - void setOutPort(int port); - void wakeup(); - bool isReady(); - void grant_vc_link(int vc, Cycles grant_time); - void release_vc_link(int vc, Cycles release_time); - void request_vc_link(int vc, NetDest destination, Cycles request_time); - bool isBufferNotFull_link(int vc); - void setSource(FlexibleConsumer *source); - void init_net_ptr(GarnetNetwork* net_ptr) { m_net_ptr = net_ptr; } - - unsigned int getLinkUtilization() const { return m_link_utilized; } - const std::vector & getVcLoad() const { return m_vc_load; } - - bool functionalRead(Packet *); - uint32_t functionalWrite(Packet *); - - private: - int m_id; - Cycles m_latency; - int m_in_port, m_out_port; - GarnetNetwork *m_net_ptr; - - flitBuffer *linkBuffer; - FlexibleConsumer *link_consumer; - FlexibleConsumer *link_source; - flitBuffer *link_srcQueue; - - // Statistical variables - unsigned int m_link_utilized; - std::vector m_vc_load; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_LINK_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc deleted file mode 100644 index 114baa5cd..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc +++ /dev/null @@ -1,58 +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/flexible-pipeline/OutVcState.hh" - -OutVcState::OutVcState(int id) - : m_time(0) -{ - m_id = id; - m_vc_state = IDLE_; -} - -bool -OutVcState::isInState(VC_state_type state, Cycles request_time) -{ - return ((m_vc_state == state) && (request_time >= m_time)); -} - -void -OutVcState::grant_vc(Cycles grant_time) -{ - m_time = grant_time; - m_vc_state = ACTIVE_; -} - -void -OutVcState::setState(VC_state_type state, Cycles time) -{ - m_vc_state = state; - m_time = time; -} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh deleted file mode 100644 index 3462ee7bf..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh +++ /dev/null @@ -1,52 +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_FLEXIBLE_PIPELINE_OUT_VC_STATE_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_OUT_VC_STATE_HH__ - -#include "base/types.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class OutVcState -{ - public: - OutVcState(int id); - - bool isInState(VC_state_type state, Cycles request_time); - void setState(VC_state_type state, Cycles time); - void grant_vc(Cycles grant_time); - - private: - int m_id ; - Cycles m_time; - VC_state_type m_vc_state; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_OUT_VC_STATE_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc deleted file mode 100644 index 9451439c9..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc +++ /dev/null @@ -1,448 +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 "base/stl_helpers.hh" -#include "debug/RubyNetwork.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/InVcState.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/Router.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh" -#include "mem/ruby/slicc_interface/Message.hh" - -using namespace std; -using m5::stl_helpers::deletePointers; - -Router::Router(const Params *p) - : BasicRouter(p), FlexibleConsumer(this) -{ - m_virtual_networks = p->virt_nets; - m_vc_per_vnet = p->vcs_per_vnet; - m_round_robin_inport = 0; - m_round_robin_start = 0; - m_num_vcs = m_vc_per_vnet * m_virtual_networks; - m_vc_arbiter = new VCarbiter(this); -} - -Router::~Router() -{ - for (int i = 0; i < m_in_link.size(); i++) { - deletePointers(m_in_vc_state[i]); - } - for (int i = 0; i < m_out_link.size(); i++) { - deletePointers(m_out_vc_state[i]); - deletePointers(m_router_buffers[i]); - } - deletePointers(m_out_src_queue); - delete m_vc_arbiter; -} - -void -Router::addInPort(NetworkLink *in_link) -{ - int port = m_in_link.size(); - vector in_vc_vector; - for (int i = 0; i < m_num_vcs; i++) { - in_vc_vector.push_back(new InVcState(i)); - in_vc_vector[i]->setState(IDLE_, curCycle()); - } - m_in_vc_state.push_back(in_vc_vector); - m_in_link.push_back(in_link); - in_link->setLinkConsumer(this); - in_link->setInPort(port); - - int start = 0; - m_round_robin_invc.push_back(start); -} - -void -Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entry, - int link_weight) -{ - int port = m_out_link.size(); - out_link->setOutPort(port); - int start = 0; - m_vc_round_robin.push_back(start); - - m_out_src_queue.push_back(new flitBuffer()); - - m_out_link.push_back(out_link); - m_routing_table.push_back(routing_table_entry); - out_link->setSourceQueue(m_out_src_queue[port]); - out_link->setSource(this); - - vector intermediateQueues; - for (int i = 0; i < m_num_vcs; i++) { - int buffer_size = m_net_ptr->getBufferSize(); - if (buffer_size > 0) // finite size - intermediateQueues.push_back(new flitBuffer(buffer_size)); - else // infinite size - intermediateQueues.push_back(new flitBuffer()); - } - m_router_buffers.push_back(intermediateQueues); - - vector out_vc_vector; - for (int i = 0; i < m_num_vcs; i++) { - out_vc_vector.push_back(new OutVcState(i)); - out_vc_vector[i]->setState(IDLE_, curCycle()); - } - m_out_vc_state.push_back(out_vc_vector); - m_link_weights.push_back(link_weight); -} - -bool -Router::isBufferNotFull(int vc, int inport) -{ - int outport = m_in_vc_state[inport][vc]->get_outport(); - int outvc = m_in_vc_state[inport][vc]->get_outvc(); - - return (!m_router_buffers[outport][outvc]->isFull()); -} - -// A request for an output vc has been placed by an upstream Router/NI. -// This has to be updated and arbitration performed -void -Router::request_vc(int in_vc, int in_port, NetDest destination, - Cycles request_time) -{ - assert(m_in_vc_state[in_port][in_vc]->isInState(IDLE_, request_time)); - - int outport = getRoute(destination); - m_in_vc_state[in_port][in_vc]->setRoute(outport); - m_in_vc_state[in_port][in_vc]->setState(VC_AB_, request_time); - assert(request_time >= curCycle()); - if (request_time > curCycle()) - m_vc_arbiter->scheduleEventAbsolute(clockPeriod() * request_time); - else - vc_arbitrate(); -} - -void -Router::vc_arbitrate() -{ - int inport = m_round_robin_inport; - m_round_robin_inport++; - if (m_round_robin_inport == m_in_link.size()) - m_round_robin_inport = 0; - - for (int port_iter = 0; port_iter < m_in_link.size(); port_iter++) { - inport++; - if (inport >= m_in_link.size()) - inport = 0; - int invc = m_round_robin_invc[inport]; - m_round_robin_invc[inport] = get_next_round_robin_vc(invc); - - for (int vc_iter = 0; vc_iter < m_num_vcs; vc_iter++) { - invc++; - if (invc >= m_num_vcs) - invc = 0; - - InVcState *in_vc_state = m_in_vc_state[inport][invc]; - - if (in_vc_state->isInState(VC_AB_, curCycle())) { - int outport = in_vc_state->get_outport(); - vector valid_vcs = get_valid_vcs(invc); - for (int valid_vc_iter = 0; valid_vc_iter < valid_vcs.size(); - valid_vc_iter++) { - if (m_out_vc_state[outport][valid_vcs[valid_vc_iter]] - ->isInState(IDLE_, curCycle())) { - - in_vc_state->grant_vc(valid_vcs[valid_vc_iter], - curCycle()); - - m_in_link[inport]->grant_vc_link(invc, curCycle()); - - m_out_vc_state[outport][valid_vcs[valid_vc_iter]] - ->setState(VC_AB_, curCycle()); - break; - } - } - } - } - } -} - -vector -Router::get_valid_vcs(int invc) -{ - vector vc_list; - - for (int vnet = 0; vnet < m_virtual_networks; vnet++) { - if (invc >= (vnet*m_vc_per_vnet) && invc < ((vnet+1)*m_vc_per_vnet)) { - int base = vnet*m_vc_per_vnet; - int vc_per_vnet; - if (m_net_ptr->isVNetOrdered(vnet)) - vc_per_vnet = 1; - else - vc_per_vnet = m_vc_per_vnet; - - for (int offset = 0; offset < vc_per_vnet; offset++) { - vc_list.push_back(base+offset); - } - break; - } - } - return vc_list; -} - -void -Router::grant_vc(int out_port, int vc, Cycles grant_time) -{ - assert(m_out_vc_state[out_port][vc]->isInState(VC_AB_, grant_time)); - m_out_vc_state[out_port][vc]->grant_vc(grant_time); - scheduleEvent(Cycles(1)); -} - -void -Router::release_vc(int out_port, int vc, Cycles release_time) -{ - assert(m_out_vc_state[out_port][vc]->isInState(ACTIVE_, release_time)); - m_out_vc_state[out_port][vc]->setState(IDLE_, release_time); - scheduleEvent(Cycles(1)); -} - -// This function calculated the output port for a particular destination. -int -Router::getRoute(NetDest destination) -{ - int output_link = -1; - int min_weight = INFINITE_; - for (int link = 0; link < m_routing_table.size(); link++) { - if (destination.intersectionIsNotEmpty(m_routing_table[link])) { - if ((m_link_weights[link] >= min_weight)) - continue; - output_link = link; - min_weight = m_link_weights[link]; - } - } - return output_link; -} - -void -Router::routeCompute(flit *m_flit, int inport) -{ - int invc = m_flit->get_vc(); - int outport = m_in_vc_state[inport][invc]->get_outport(); - int outvc = m_in_vc_state[inport][invc]->get_outvc(); - - assert(m_net_ptr->getNumPipeStages() >= 1); - - // Subtract 1 as 1 cycle will be consumed in scheduling the output link - m_flit->set_time(curCycle() + Cycles((m_net_ptr->getNumPipeStages() - 1))); - m_flit->set_vc(outvc); - m_router_buffers[outport][outvc]->insert(m_flit); - - if (m_net_ptr->getNumPipeStages() > 1) - scheduleEvent(Cycles(m_net_ptr->getNumPipeStages() - 1)); - - if ((m_flit->get_type() == HEAD_) || (m_flit->get_type() == HEAD_TAIL_)) { - Message *nm = m_flit->get_msg_ptr().get(); - NetDest destination = nm->getDestination(); - - if (m_net_ptr->getNumPipeStages() > 1) { - m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle() + - Cycles(1)); - m_out_link[outport]->request_vc_link(outvc, destination, - curCycle() + Cycles(1)); - } else { - m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle()); - m_out_link[outport]->request_vc_link(outvc, destination, - curCycle()); - } - } - - if ((m_flit->get_type() == TAIL_) || (m_flit->get_type() == HEAD_TAIL_)) { - m_in_vc_state[inport][invc]->setState(IDLE_, curCycle() + Cycles(1)); - m_in_link[inport]->release_vc_link(invc, curCycle() + Cycles(1)); - } -} - -void -Router::wakeup() -{ - flit *t_flit; - - // This is for round-robin scheduling of incoming ports - int incoming_port = m_round_robin_start; - m_round_robin_start++; - if (m_round_robin_start >= m_in_link.size()) { - m_round_robin_start = 0; - } - - for (int port = 0; port < m_in_link.size(); port++) { - // Round robin scheduling - incoming_port++; - if (incoming_port >= m_in_link.size()) - incoming_port = 0; - - // checking the incoming link - if (m_in_link[incoming_port]->isReady()) { - DPRINTF(RubyNetwork, "m_id: %d, Time: %lld\n", m_id, curCycle()); - t_flit = m_in_link[incoming_port]->peekLink(); - routeCompute(t_flit, incoming_port); - m_in_link[incoming_port]->consumeLink(); - } - } - scheduleOutputLinks(); - checkReschedule(); // This is for flits lying in the router buffers - vc_arbitrate(); - check_arbiter_reschedule(); -} - -void -Router::scheduleOutputLinks() -{ - for (int port = 0; port < m_out_link.size(); port++) { - int vc_tolookat = m_vc_round_robin[port]; - m_vc_round_robin[port] = get_next_round_robin_vc(vc_tolookat); - - for (int i = 0; i < m_num_vcs; i++) { - vc_tolookat++; - if (vc_tolookat == m_num_vcs) - vc_tolookat = 0; - - if (m_router_buffers[port][vc_tolookat]->isReady(curCycle())) { - - // models buffer backpressure - if (m_out_vc_state[port][vc_tolookat]->isInState(ACTIVE_, - curCycle()) && - m_out_link[port]->isBufferNotFull_link(vc_tolookat)) { - - flit *t_flit = - m_router_buffers[port][vc_tolookat]->getTopFlit(); - t_flit->set_time(curCycle() + Cycles(1)); - m_out_src_queue[port]->insert(t_flit); - - m_out_link[port]-> - scheduleEventAbsolute(clockEdge(Cycles(1))); - break; // done for this port - } - } - } - } -} - -int -Router::get_vnet(int vc) const -{ - int vnet = vc/m_vc_per_vnet; - assert(vnet < m_virtual_networks); - return vnet; -} - -int -Router::get_next_round_robin_vc(int vc) const -{ - vc++; - if (vc == m_num_vcs) - vc = 0; - return vc; -} - -void -Router::checkReschedule() -{ - for (int port = 0; port < m_out_link.size(); port++) { - for (int vc = 0; vc < m_num_vcs; vc++) { - if (m_router_buffers[port][vc]->isReady(curCycle() + Cycles(1))) { - scheduleEvent(Cycles(1)); - return; - } - } - } -} - -void -Router::check_arbiter_reschedule() -{ - for (int port = 0; port < m_in_link.size(); port++) { - for (int vc = 0; vc < m_num_vcs; vc++) { - if (m_in_vc_state[port][vc]->isInState(VC_AB_, curCycle() + - Cycles(1))) { - m_vc_arbiter->scheduleEventAbsolute(clockEdge(Cycles(1))); - return; - } - } - } -} - -bool -Router::functionalRead(Packet *pkt) -{ - // Access the buffers in the router for performing a functional read - for (unsigned int i = 0; i < m_router_buffers.size(); i++) { - for (unsigned int j = 0; j < m_router_buffers[i].size(); ++j) { - if (m_router_buffers[i][j]->functionalRead(pkt)) { - return true; - } - } - } - - // Access the link queues for performing a functional read - for (unsigned int i = 0; i < m_out_src_queue.size(); i++) { - if (m_out_src_queue[i]->functionalRead(pkt)) { - return true; - } - } - return false; -} - -uint32_t -Router::functionalWrite(Packet *pkt) -{ - uint32_t num_functional_writes = 0; - - // Access the buffers in the router for performing a functional write - for (unsigned int i = 0; i < m_router_buffers.size(); i++) { - for (unsigned int j = 0; j < m_router_buffers[i].size(); ++j) { - num_functional_writes += - m_router_buffers[i][j]->functionalWrite(pkt); - } - } - - // Access the link queues for performing a functional write - for (unsigned int i = 0; i < m_out_src_queue.size(); i++) { - num_functional_writes += m_out_src_queue[i]->functionalWrite(pkt); - } - - return num_functional_writes; -} - -void -Router::print(ostream& out) const -{ - out << "[Router]"; -} - -Router * -GarnetRouterParams::create() -{ - return new Router(this); -} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh deleted file mode 100644 index c225e8b71..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh +++ /dev/null @@ -1,110 +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_FLEXIBLE_PIPELINE_ROUTER_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_ROUTER_HH__ - -#include -#include - -#include "mem/ruby/common/NetDest.hh" -#include "mem/ruby/network/BasicRouter.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/InVcState.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "params/GarnetRouter.hh" - -class VCarbiter; - -class Router : public BasicRouter, public FlexibleConsumer -{ - public: - typedef GarnetRouterParams Params; - Router(const Params *p); - - ~Router(); - - void addInPort(NetworkLink *in_link); - void addOutPort(NetworkLink *out_link, const NetDest& routing_table_entry, - int link_weight); - void wakeup(); - void request_vc(int in_vc, int in_port, NetDest destination, - Cycles request_time); - bool isBufferNotFull(int vc, int inport); - void grant_vc(int out_port, int vc, Cycles grant_time); - void release_vc(int out_port, int vc, Cycles release_time); - void vc_arbitrate(); - - void print(std::ostream& out) const; - - void init_net_ptr(GarnetNetwork* net_ptr) - { - m_net_ptr = net_ptr; - } - - bool functionalRead(Packet *); - uint32_t functionalWrite(Packet *); - - private: - int m_virtual_networks, m_num_vcs, m_vc_per_vnet; - GarnetNetwork *m_net_ptr; - std::vector m_vc_round_robin; // For scheduling of out source queues - int m_round_robin_inport, m_round_robin_start; // for vc arbitration - std::vector m_round_robin_invc; // For vc arbitration of each outport - - // These are essentially output buffers - std::vector > m_router_buffers; - - // These are source queues for the output link - std::vector m_out_src_queue; - - std::vector m_in_link; - std::vector m_out_link; - std::vector > m_in_vc_state; - std::vector > m_out_vc_state; - std::vector m_routing_table; - std::vector m_link_weights; - VCarbiter *m_vc_arbiter; - - int getRoute(NetDest destination); - std::vector get_valid_vcs(int invc); - void routeCompute(flit *m_flit, int inport); - void checkReschedule(); - void check_arbiter_reschedule(); - void scheduleOutputLinks(); - int get_vnet(int vc) const; - int get_next_round_robin_vc(int vc) const; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_ROUTER_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/SConscript b/src/mem/ruby/network/garnet/flexible-pipeline/SConscript deleted file mode 100644 index d4c1a2cb9..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/SConscript +++ /dev/null @@ -1,48 +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.py') -SimObject('GarnetNetwork.py') - -Source('GarnetLink.cc') -Source('GarnetNetwork.cc') -Source('InVcState.cc') -Source('NetworkInterface.cc') -Source('NetworkLink.cc') -Source('OutVcState.cc') -Source('Router.cc') -Source('VCarbiter.cc') -Source('flit.cc') -Source('flitBuffer.cc') diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc deleted file mode 100644 index 5ed336699..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc +++ /dev/null @@ -1,45 +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/flexible-pipeline/Router.hh" -#include "mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh" - -VCarbiter::VCarbiter(Router *router) - : Consumer(router) -{ - m_router = router; -} - -void -VCarbiter::wakeup() -{ - m_router->vc_arbitrate(); -} - diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh deleted file mode 100644 index a56bfae0d..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh +++ /dev/null @@ -1,54 +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_FLEXIBLE_PIPELINE_VC_ARBITER_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_VC_ARBITER_HH__ - -#include - -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class Router; - -class VCarbiter : public Consumer -{ - public: - VCarbiter(Router *router); - ~VCarbiter() {} - - void print(std::ostream& out) const {} - void wakeup(); - - private: - Router *m_router; -}; - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_VC_ARBITER_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc deleted file mode 100644 index aaf19b3b5..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc +++ /dev/null @@ -1,75 +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/flexible-pipeline/flit.hh" - -flit::flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime) - : m_id(id), m_vnet(vnet), m_vc(vc), m_size(size), m_creation_time(curTime) -{ - m_msg_ptr = msg_ptr; - m_time = curTime; - - 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_; -} - -void -flit::print(std::ostream& out) const -{ - out << "[flit:: "; - out << "Id=" << m_id << " "; - out << "Type=" << m_type << " "; - out << "Vnet=" << m_vnet << " "; - out << "VC=" << m_vc << " "; - out << "Creation Time=" << m_creation_time << " "; - out << "]"; -} - -bool -flit::functionalRead(Packet *pkt) -{ - Message *msg = m_msg_ptr.get(); - return msg->functionalRead(pkt); -} - -bool -flit::functionalWrite(Packet *pkt) -{ - Message *msg = m_msg_ptr.get(); - return msg->functionalWrite(pkt); -} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh deleted file mode 100644 index 4049a9212..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh +++ /dev/null @@ -1,93 +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/types.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" -#include "mem/ruby/slicc_interface/Message.hh" - -#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_HH__ - -class flit -{ - public: - flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime); - - int get_size() const { return m_size; } - int get_id() const { return m_id; } - Cycles get_time() const { return m_time; } - Cycles get_creation_time() const { return m_creation_time; } - void set_time(Cycles time) { m_time = time; } - int get_vnet() const { return m_vnet; } - int get_vc() const { return m_vc; } - void set_vc(int vc) { m_vc = vc; } - MsgPtr& get_msg_ptr() { return m_msg_ptr; } - flit_type get_type() const { return m_type; } - void set_delay(Cycles delay) { src_delay = delay; } - Cycles get_delay() const { return src_delay; } - void print(std::ostream& out) const; - - static bool - greater(flit* n1, flit* 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 functionalRead(Packet *pkt); - bool functionalWrite(Packet *pkt); - - private: - const int m_id; - const int m_vnet; - int m_vc; - const int m_size; - const Cycles m_creation_time; - Cycles m_time; - flit_type m_type; - MsgPtr m_msg_ptr; - Cycles src_delay; -}; - -inline std::ostream& -operator<<(std::ostream& out, const flit& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_HH__ diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc deleted file mode 100644 index ee31ac3d2..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc +++ /dev/null @@ -1,127 +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 "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" - -using namespace std; - -flitBuffer::flitBuffer() -{ - max_size = INFINITE_; -} - -flitBuffer::flitBuffer(int maximum_size) -{ - max_size = maximum_size; -} - -bool -flitBuffer::isEmpty() -{ - return (m_buffer.size() == 0); -} - -bool -flitBuffer::isReady(Cycles curTime) -{ - if (m_buffer.size() != 0 ) { - flit *t_flit = m_buffer.front(); - if (t_flit->get_time() <= curTime) - return true; - } - return false; -} - -bool -flitBuffer::isFull() -{ - return (m_buffer.size() >= max_size); -} - -void -flitBuffer::setMaxSize(int maximum) -{ - max_size = maximum; -} - -flit* -flitBuffer:: getTopFlit() -{ - flit *f = m_buffer.front(); - pop_heap(m_buffer.begin(), m_buffer.end(), flit::greater); - m_buffer.pop_back(); - return f; -} - -flit* -flitBuffer::peekTopFlit() -{ - return m_buffer.front(); -} - -void -flitBuffer::insert(flit *flt) -{ - m_buffer.push_back(flt); - push_heap(m_buffer.begin(), m_buffer.end(), flit::greater); -} - -void -flitBuffer::print(std::ostream& out) const -{ - out << "[flitBuffer: "; - out << m_buffer.size() << "] " << std::endl; -} - -bool -flitBuffer::functionalRead(Packet *pkt) -{ - for (unsigned int i = 0; i < m_buffer.size(); ++i) { - if (m_buffer[i]->functionalRead(pkt)) { - return true; - } - } - return false; -} - -uint32_t -flitBuffer::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/flexible-pipeline/flitBuffer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh deleted file mode 100644 index 99fa2678b..000000000 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh +++ /dev/null @@ -1,71 +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_FLEXIBLE_PIPELINE_FLIT_BUFFER_HH__ -#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_BUFFER_HH__ - -#include -#include - -#include "mem/ruby/network/garnet/flexible-pipeline/flit.hh" -#include "mem/ruby/network/garnet/NetworkHeader.hh" - -class flitBuffer -{ - public: - flitBuffer(); - flitBuffer(int maximum_size); - - bool isReady(Cycles curTime); - bool isFull(); - bool isEmpty(); - void setMaxSize(int maximum); - flit *getTopFlit(); - flit *peekTopFlit(); - void insert(flit *flt); - void print(std::ostream& out) const; - - bool functionalRead(Packet *); - uint32_t functionalWrite(Packet *); - - private: - std::vector m_buffer; - int max_size; -}; - -inline std::ostream& -operator<<(std::ostream& out, const flitBuffer& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_BUFFER_HH__ -- cgit v1.2.3