From: Steve Reinhardt Date: Sat, 30 Jan 2010 04:29:30 +0000 (-0800) Subject: Garnet: reorganize directory tree. X-Git-Tag: stable_2012_02_02~1529 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b5444625056a93cd676c512a891b0c13c44cf58b;p=gem5.git Garnet: reorganize directory tree. Rename the ruby/network/garnet-foo directories to garnet/foo. Move the common NetworkHeader.hh file from garnet-fixed-pipeline up to the common garnet directory. Fix up include paths. --HG-- rename : src/mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh => src/mem/ruby/network/garnet/NetworkHeader.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/Router_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/Router_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/SConscript => src/mem/ruby/network/garnet/fixed-pipeline/SConscript rename : src/mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/Switch_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/Switch_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh rename : src/mem/ruby/network/garnet-fixed-pipeline/flit_d.cc => src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc rename : src/mem/ruby/network/garnet-fixed-pipeline/flit_d.hh => src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/FlexibleConsumer.hh => src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.cc => src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh => src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/InVcState.cc => src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/InVcState.hh => src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh => src/mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/NetworkInterface.cc => src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/NetworkInterface.hh => src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/NetworkLink.cc => src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/NetworkLink.hh => src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/OutVcState.cc => src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/OutVcState.hh => src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/Router.cc => src/mem/ruby/network/garnet/flexible-pipeline/Router.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/Router.hh => src/mem/ruby/network/garnet/flexible-pipeline/Router.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/SConscript => src/mem/ruby/network/garnet/flexible-pipeline/SConscript rename : src/mem/ruby/network/garnet-flexible-pipeline/VCarbiter.cc => src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/VCarbiter.hh => src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/flit.cc => src/mem/ruby/network/garnet/flexible-pipeline/flit.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/flit.hh => src/mem/ruby/network/garnet/flexible-pipeline/flit.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/flitBuffer.cc => src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc rename : src/mem/ruby/network/garnet-flexible-pipeline/flitBuffer.hh => src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh rename : src/mem/ruby/network/garnet-flexible-pipeline/netconfig.defaults => src/mem/ruby/network/garnet/flexible-pipeline/netconfig.defaults --- diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh deleted file mode 100644 index c554d7216..000000000 --- a/src/mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh +++ /dev/null @@ -1,41 +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 CREDIT_LINK_D_H -#define CREDIT_LINK_D_H - -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh" - -class CreditLink_d : public NetworkLink_d { -public: - CreditLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr):NetworkLink_d(id, link_latency, net_ptr) {} -}; - -#endif diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc deleted file mode 100644 index 765dd1b29..000000000 --- a/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Niket Agarwal - */ - -#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh" -#include "mem/protocol/MachineType.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.hh" -#include "mem/ruby/buffers/MessageBuffer.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/Router_d.hh" -#include "mem/ruby/network/simple/Topology.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh" -#include "mem/ruby/common/NetDest.hh" - -GarnetNetwork_d::GarnetNetwork_d(const string & name) - : Network(name) -{ -} - -void GarnetNetwork_d::init() -{ - Network::init(argv); - - //added by SS - m_network_config_ptr = new NetworkConfig; - m_network_config_ptr->init(argv); - - m_ruby_start = 0; - m_flits_recieved = 0; - m_flits_injected = 0; - m_network_latency = 0.0; - m_queueing_latency = 0.0; - - m_router_ptr_vector.clear(); - - // Allocate to and from queues - m_toNetQueues.setSize(m_nodes); // Queues that are getting messages from protocol - m_fromNetQueues.setSize(m_nodes); // Queues that are feeding the protocol - m_in_use.setSize(m_virtual_networks); - m_ordered.setSize(m_virtual_networks); - for (int i = 0; i < m_virtual_networks; i++) - { - m_in_use[i] = false; - m_ordered[i] = false; - } - - for (int node = 0; node < m_nodes; node++) - { - //Setting how many vitual message buffers will there be per Network Queue - m_toNetQueues[node].setSize(m_virtual_networks); - m_fromNetQueues[node].setSize(m_virtual_networks); - - for (int j = 0; j < m_virtual_networks; j++) - { - m_toNetQueues[node][j] = new MessageBuffer(); // Instantiating the Message Buffers that interact with the coherence protocol - m_fromNetQueues[node][j] = new MessageBuffer(); - } - } - - // Setup the network switches - m_topology_ptr->makeTopology(); - - int number_of_routers = m_topology_ptr->numSwitches(); - for (int i=0; iaddNode(m_toNetQueues[i], m_fromNetQueues[i]); - m_ni_ptr_vector.insertAtBottom(ni); - } - m_topology_ptr->createLinks(this, false); // false because this isn't a reconfiguration - for(int i = 0; i < m_router_ptr_vector.size(); i++) - { - m_router_ptr_vector[i]->init(); - } -} - -GarnetNetwork_d::~GarnetNetwork_d() -{ - for (int i = 0; i < m_nodes; i++) - { - m_toNetQueues[i].deletePointers(); - m_fromNetQueues[i].deletePointers(); - } - m_router_ptr_vector.deletePointers(); - m_ni_ptr_vector.deletePointers(); - m_link_ptr_vector.deletePointers(); - m_creditlink_ptr_vector.deletePointers(); - delete m_topology_ptr; -} - -void GarnetNetwork_d::reset() -{ - for (int node = 0; node < m_nodes; node++) - { - for (int j = 0; j < m_virtual_networks; j++) - { - m_toNetQueues[node][j]->clear(); - m_fromNetQueues[node][j]->clear(); - } - } -} - -/* - * This function creates a link from the Network Interface (NI) into the Network. - * It creates a Network Link from the NI to a Router and a Credit Link from - * the Router to the NI -*/ - -void GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, const NetDest& routing_table_entry, int link_latency, int bw_multiplier, bool isReconfiguration) -{ - assert(src < m_nodes); - - if(!isReconfiguration) - { - NetworkLink_d *net_link = new NetworkLink_d(m_link_ptr_vector.size(), link_latency, this); - CreditLink_d *credit_link = new CreditLink_d(m_creditlink_ptr_vector.size(), link_latency, this); - m_link_ptr_vector.insertAtBottom(net_link); - m_creditlink_ptr_vector.insertAtBottom(credit_link); - - m_router_ptr_vector[dest]->addInPort(net_link, credit_link); - m_ni_ptr_vector[src]->addOutPort(net_link, credit_link); - } - else - { - ERROR_MSG("Fatal Error:: Reconfiguration not allowed here"); - // do nothing - } -} - -/* - * This function creates a link from the Network to a NI. - * It creates a Network Link from a Router to the NI and - * a Credit Link from NI to the Router -*/ - -void GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration) -{ - assert(dest < m_nodes); - assert(src < m_router_ptr_vector.size()); - assert(m_router_ptr_vector[src] != NULL); - - if(!isReconfiguration) - { - NetworkLink_d *net_link = new NetworkLink_d(m_link_ptr_vector.size(), link_latency, this); - CreditLink_d *credit_link = new CreditLink_d(m_creditlink_ptr_vector.size(), link_latency, this); - m_link_ptr_vector.insertAtBottom(net_link); - m_creditlink_ptr_vector.insertAtBottom(credit_link); - - m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight, credit_link); - m_ni_ptr_vector[dest]->addInPort(net_link, credit_link); - } - else - { - ERROR_MSG("Fatal Error:: Reconfiguration not allowed here"); - //do nothing - } -} - -/* - * This function creates a internal network links -*/ - -void GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration) -{ - if(!isReconfiguration) - { - NetworkLink_d *net_link = new NetworkLink_d(m_link_ptr_vector.size(), link_latency, this); - CreditLink_d *credit_link = new CreditLink_d(m_creditlink_ptr_vector.size(), link_latency, this); - m_link_ptr_vector.insertAtBottom(net_link); - m_creditlink_ptr_vector.insertAtBottom(credit_link); - - m_router_ptr_vector[dest]->addInPort(net_link, credit_link); - m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight, credit_link); - } - else - { - ERROR_MSG("Fatal Error:: Reconfiguration not allowed here"); - // do nothing - } -} - -void GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered, int network_num) -{ - ASSERT(id < m_nodes); - ASSERT(network_num < m_virtual_networks); - - if (ordered) - { - m_ordered[network_num] = true; - } - m_in_use[network_num] = true; -} - -MessageBuffer* GarnetNetwork_d::getToNetQueue(NodeID id, bool ordered, int network_num) -{ - checkNetworkAllocation(id, ordered, network_num); - return m_toNetQueues[id][network_num]; -} - -MessageBuffer* GarnetNetwork_d::getFromNetQueue(NodeID id, bool ordered, int network_num) -{ - checkNetworkAllocation(id, ordered, network_num); - return m_fromNetQueues[id][network_num]; -} - -void GarnetNetwork_d::clearStats() -{ - m_ruby_start = g_eventQueue_ptr->getTime(); -} - -Time GarnetNetwork_d::getRubyStartTime() -{ - return m_ruby_start; -} - -void GarnetNetwork_d::printStats(ostream& out) const -{ double average_link_utilization = 0; - Vector average_vc_load; - average_vc_load.setSize(m_virtual_networks*m_network_config_ptr->getVCsPerClass()); - - for(int i = 0; i < m_virtual_networks*m_network_config_ptr->getVCsPerClass(); i++) - { - average_vc_load[i] = 0; - } - - out << endl; - out << "Network Stats" << endl; - out << "-------------" << endl; - out << endl; - for(int i = 0; i < m_link_ptr_vector.size(); i++) - { - average_link_utilization += (double(m_link_ptr_vector[i]->getLinkUtilization())) / (double(g_eventQueue_ptr->getTime()-m_ruby_start)); - - Vector vc_load = m_link_ptr_vector[i]->getVcLoad(); - for(int j = 0; j < vc_load.size(); j++) - { - assert(vc_load.size() == m_network_config_ptr->getVCsPerClass()*m_virtual_networks); - average_vc_load[j] += vc_load[j]; - } - } - average_link_utilization = average_link_utilization/m_link_ptr_vector.size(); - out << "Average Link Utilization :: " << average_link_utilization << " flits/cycle" << endl; - out << "-------------" << endl; - - for(int i = 0; i < m_network_config_ptr->getVCsPerClass()*m_virtual_networks; i++) - { - average_vc_load[i] = (double(average_vc_load[i]) / (double(g_eventQueue_ptr->getTime()) - m_ruby_start)); - out << "Average VC Load [" << i << "] = " << average_vc_load[i] << " flits/cycle " << endl; - } - out << "-------------" << endl; - - // out << "Total flits injected = " << m_flits_injected << endl; - // out << "Total flits recieved = " << m_flits_recieved << endl; - out << "Average network latency = " << ((double) m_network_latency/ (double) m_flits_recieved)<< endl; - // out << "Average queueing latency = " << ((double) m_queueing_latency/ (double) m_flits_recieved)<< endl; - // out << "Average latency = " << ((double) (m_queueing_latency + m_network_latency) / (double) m_flits_recieved)<< endl; - out << "-------------" << endl; - - double m_total_link_power = 0.0; - double m_total_router_power = 0.0; - - for(int i = 0; i < m_link_ptr_vector.size(); i++) - { - m_total_link_power += m_link_ptr_vector[i]->calculate_power(); - } - - for(int i = 0; i < m_router_ptr_vector.size(); i++) - { - m_total_router_power += m_router_ptr_vector[i]->calculate_power(); - } - out << "Total Link Power = " << m_total_link_power << " W " << endl; - out << "Total Router Power = " << m_total_router_power << " W " <getName() << endl; - out << endl; - - for (int i = 0; i < m_virtual_networks; i++) - { - out << "virtual_net_" << i << ": "; - if (m_in_use[i]) - { - out << "active, "; - if (m_ordered[i]) - { - out << "ordered" << endl; - } - else - { - out << "unordered" << endl; - } - } - else - { - out << "inactive" << endl; - } - } - out << endl; - - for(int i = 0; i < m_ni_ptr_vector.size(); i++) - { - m_ni_ptr_vector[i]->printConfig(out); - } - for(int i = 0; i < m_router_ptr_vector.size(); i++) - { - m_router_ptr_vector[i]->printConfig(out); - } - m_topology_ptr->printConfig(out); -} - -void GarnetNetwork_d::print(ostream& out) const -{ - out << "[GarnetNetwork_d]"; -} diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh deleted file mode 100644 index 33f13b836..000000000 --- a/src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh +++ /dev/null @@ -1,144 +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 GARNETNETWORK_D_H -#define GARNETNETWORK_D_H - -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh" -#include "mem/gems_common/Vector.hh" -#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh" -#include "mem/ruby/network/Network.hh" - -class NetworkInterface_d; -class MessageBuffer; -class Router_d; -class Topology; -class NetDest; -class NetworkLink_d; -class CreditLink_d; - -class GarnetNetwork_d : public Network{ -public: - GarnetNetwork_d(const string & name); - - ~GarnetNetwork_d(); - - void init(); - - //added by SS - NetworkConfig* getNetworkConfig() { return m_network_config_ptr; } - - int getNumNodes(){ return m_nodes;} - - // returns the queue requested for the given component - MessageBuffer* getToNetQueue(NodeID id, bool ordered, int network_num); - MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int network_num); - - void clearStats(); - void printStats(ostream& out) const; - void printConfig(ostream& out) const; - void print(ostream& out) const; - - inline void increment_injected_flits() - { - m_flits_injected++; - } - inline void increment_recieved_flits() - { - m_flits_recieved++; - } - inline void increment_network_latency(Time latency) - { - m_network_latency += latency; - } - inline void increment_queueing_latency(Time latency) - { - m_queueing_latency += latency; - } - - bool isVNetOrdered(int vnet) - { - return m_ordered[vnet]; - } - bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; } - - Time getRubyStartTime(); - - void reset(); - - // Methods used by Topology to setup the network - void makeOutLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration); - void makeInLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int bw_multiplier, bool isReconfiguration); - void makeInternalLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration); - -private: - NetworkConfig* m_network_config_ptr; - - void checkNetworkAllocation(NodeID id, bool ordered, int network_num); - -// Private copy constructor and assignment operator - GarnetNetwork_d(const GarnetNetwork_d& obj); - GarnetNetwork_d& operator=(const GarnetNetwork_d& obj); - -/***********Data Members*************/ -// int m_virtual_networks; -// int m_nodes; - int m_flits_recieved, m_flits_injected; - double m_network_latency, m_queueing_latency; - - Vector m_in_use; - Vector m_ordered; - - Vector > m_toNetQueues; - Vector > m_fromNetQueues; - - Vector m_router_ptr_vector; // All Routers in Network - Vector m_link_ptr_vector; // All links in the network - Vector m_creditlink_ptr_vector; // All links in the network - Vector m_ni_ptr_vector; // All NI's in Network - -// Topology* m_topology_ptr; - Time m_ruby_start; -}; - -// Output operator declaration -ostream& operator<<(ostream& out, const GarnetNetwork_d& obj); - -// ******************* Definitions ******************* -// Output operator definition -extern inline -ostream& operator<<(ostream& out, const GarnetNetwork_d& obj) -{ - obj.print(out); - out << flush; - return out; -} - -#endif //GARNETNETWORK_D_H diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.cc deleted file mode 100644 index 7f344b0b7..000000000 --- a/src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Niket Agarwal - */ - -#include "mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/Router_d.hh" - -InputUnit_d::InputUnit_d(int id, Router_d *router) -{ - m_id = id; - m_router = router; - m_num_vcs = m_router->get_num_vcs(); - - m_num_buffer_reads = 0; - m_num_buffer_writes = 0; - - creditQueue = new flitBuffer_d(); - // Instantiating the virtual channels - m_vcs.setSize(m_num_vcs); - for(int i=0; i < m_num_vcs; i++) - { - m_vcs[i] = new VirtualChannel_d(i); - } -} - -InputUnit_d::~InputUnit_d() -{ - delete creditQueue; - m_vcs.deletePointers(); -} - -void InputUnit_d::wakeup() -{ - flit_d *t_flit; - if(m_in_link->isReady()) - { - t_flit = m_in_link->consumeLink(); - int vc = t_flit->get_vc(); - if((t_flit->get_type() == HEAD_) || (t_flit->get_type() == HEAD_TAIL_)) - { - assert(m_vcs[vc]->get_state() == IDLE_); - m_router->route_req(t_flit, this, vc); // Do the route computation for this vc - m_vcs[vc]->set_enqueue_time(g_eventQueue_ptr->getTime()); - } - else - { - t_flit->advance_stage(SA_); - m_router->swarb_req(); - } - m_vcs[vc]->insertFlit(t_flit); // write flit into input buffer - m_num_buffer_writes++; - m_num_buffer_reads++; // same as read because any flit that is written will be read only once - } -} - - -void InputUnit_d::printConfig(ostream& out) -{ - out << endl; - out << "InputUnit Configuration" << endl; - out << "---------------------" << endl; - out << "id = " << m_id << endl; - out << "In link is " << m_in_link->get_id() << endl; -} diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh deleted file mode 100644 index beee79b3e..000000000 --- a/src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh +++ /dev/null @@ -1,167 +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 INPUT_UNIT_D_H -#define INPUT_UNIT_D_H - -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh" -#include "mem/ruby/common/Consumer.hh" -#include "mem/gems_common/Vector.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh" - -class Router_d; - -class InputUnit_d : public Consumer { -public: - InputUnit_d(int id, Router_d *router); - ~InputUnit_d(); - - void wakeup(); - void printConfig(ostream& out); - flitBuffer_d* getCreditQueue() { return creditQueue; } - void print(ostream& out) const {}; - - inline int get_inlink_id() - { - return m_in_link->get_id(); - } - - inline void set_vc_state(VC_state_type state, int vc) - { - m_vcs[vc]->set_state(state); - } - inline void set_enqueue_time(int invc, Time time) - { - m_vcs[invc]->set_enqueue_time(time); - } - inline Time get_enqueue_time(int invc) - { - return m_vcs[invc]->get_enqueue_time(); - } - inline void update_credit(int in_vc, int credit) - { - m_vcs[in_vc]->update_credit(credit); - } - - inline bool has_credits(int vc) - { - return m_vcs[vc]->has_credits(); - } - - inline void increment_credit(int in_vc, bool free_signal) - { - flit_d *t_flit = new flit_d(in_vc, free_signal); - creditQueue->insert(t_flit); - g_eventQueue_ptr->scheduleEvent(m_credit_link, 1); - } - - inline int get_outvc(int invc) - { - return m_vcs[invc]->get_outvc(); - } - - inline void updateRoute(int vc, int outport) - { - m_vcs[vc]->set_outport(outport); - m_vcs[vc]->set_state(VC_AB_); - } - - inline void grant_vc(int in_vc, int out_vc) - { - m_vcs[in_vc]->grant_vc(out_vc); - } - - inline flit_d* peekTopFlit(int vc) - { - return m_vcs[vc]->peekTopFlit(); - } - - inline flit_d* getTopFlit(int vc) - { - return m_vcs[vc]->getTopFlit(); - } - - inline bool need_stage(int vc, VC_state_type state, flit_stage stage) - { - return m_vcs[vc]->need_stage(state, stage); - } - - inline bool need_stage_nextcycle(int vc, VC_state_type state, flit_stage stage) - { - return m_vcs[vc]->need_stage_nextcycle(state, stage); - } - - inline bool isReady(int invc) - { - return m_vcs[invc]->isReady(); - } - - inline int get_route(int vc) - { - return m_vcs[vc]->get_route(); - } - inline void set_in_link(NetworkLink_d *link) - { - m_in_link = link; - } - - inline void set_credit_link(CreditLink_d *credit_link) - { - m_credit_link = credit_link; - } - - inline double get_buf_read_count() - { - return m_num_buffer_reads; - } - - inline double get_buf_write_count() - { - return m_num_buffer_writes; - } - -private: - int m_id; - int m_num_vcs; - double m_num_buffer_writes, m_num_buffer_reads; - - Router_d *m_router; - NetworkLink_d *m_in_link; - CreditLink_d *m_credit_link; - flitBuffer_d *creditQueue; - - // Virtual channels - Vector m_vcs; // [vc] -}; - -#endif diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh b/src/mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh deleted file mode 100644 index 62ed9a12c..000000000 --- a/src/mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.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 NETWORK_HEADER_H -#define NETWORK_HEADER_H - -#include "mem/ruby/common/Global.hh" -#include "mem/ruby/system/NodeID.hh" - -using namespace std; -using namespace __gnu_cxx; - -enum flit_type {HEAD_, BODY_, TAIL_, HEAD_TAIL_, NUM_FLIT_TYPE_}; -enum VC_state_type {IDLE_, VC_AB_, ACTIVE_, NUM_VC_STATE_TYPE_}; -enum flit_stage {I_, VA_, SA_, ST_, LT_, NUM_FLIT_STAGE_}; - -#define NETCONFIG_DEFAULTS "netconfig.defaults" - -#define INFINITE_ 10000 - -#endif - diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.cc deleted file mode 100644 index c31b76d62..000000000 --- a/src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.cc +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Copyright (c) 2008 Princeton University - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Niket Agarwal - */ - -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.hh" -#include "mem/ruby/buffers/MessageBuffer.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh" -#include "mem/ruby/slicc_interface/NetworkMessage.hh" - -NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks, GarnetNetwork_d *network_ptr) -{ - m_id = id; - m_net_ptr = network_ptr; - m_virtual_networks = virtual_networks; - m_vc_per_vnet = m_net_ptr->getNetworkConfig()->getVCsPerClass(); - m_num_vcs = m_vc_per_vnet*m_virtual_networks; - - m_vc_round_robin = 0; - m_ni_buffers.setSize(m_num_vcs); - m_ni_enqueue_time.setSize(m_num_vcs); - inNode_ptr.setSize(m_virtual_networks); - outNode_ptr.setSize(m_virtual_networks); - creditQueue = new flitBuffer_d(); - - for(int i =0; i < m_num_vcs; i++) - { - m_ni_buffers[i] = new flitBuffer_d(); // instantiating the NI flit buffers - m_ni_enqueue_time[i] = INFINITE_; - } - m_vc_allocator.setSize(m_virtual_networks); // 1 allocator per virtual net - 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.insertAtBottom(new OutVcState_d(i, m_net_ptr)); - m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime()); - } -} - -NetworkInterface_d::~NetworkInterface_d() -{ - m_out_vc_state.deletePointers(); - m_ni_buffers.deletePointers(); - delete creditQueue; - delete outSrcQueue; -} - -void NetworkInterface_d::addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link) -{ - inNetLink = in_link; - in_link->setLinkConsumer(this); - m_ni_credit_link = credit_link; - credit_link->setSourceQueue(creditQueue); -} - -void NetworkInterface_d::addOutPort(NetworkLink_d *out_link, CreditLink_d *credit_link) -{ - m_credit_link = credit_link; - credit_link->setLinkConsumer(this); - - outNetLink = out_link; - outSrcQueue = new flitBuffer_d(); - out_link->setSourceQueue(outSrcQueue); -} - -void NetworkInterface_d::addNode(Vector& in, Vector& out) -{ - ASSERT(in.size() == m_virtual_networks); - inNode_ptr = in; - outNode_ptr = out; - for (int j = 0; j < m_virtual_networks; j++) - { - inNode_ptr[j]->setConsumer(this); // So that protocol injects messages into the NI - } -} - -bool NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet) -{ - NetworkMessage *net_msg_ptr = dynamic_cast(msg_ptr.ref()); - NetDest net_msg_dest = net_msg_ptr->getInternalDestination(); - Vector dest_nodes = net_msg_dest.getAllDest(); // gets all the destinations associated with this message. - - int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(net_msg_ptr->getMessageSize())/m_net_ptr->getNetworkConfig()->getFlitSize() ); // Number of flits is dependent on the link bandwidth available. This is expressed in terms of bytes/cycle or the flit size - - for(int ctr = 0; ctr < dest_nodes.size(); ctr++) // loop because we will be converting all multicast messages into unicast messages - { - int vc = calculateVC(vnet); // this will return a free output virtual channel - if(vc == -1) - { - return false ; - } - MsgPtr new_msg_ptr = *(msg_ptr.ref()); - NodeID destID = dest_nodes[ctr]; - - NetworkMessage *new_net_msg_ptr = dynamic_cast(new_msg_ptr.ref()); - 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 destination ID - personal_dest.clear(); - personal_dest.add((MachineID) {(MachineType) m, (destID - MachineType_base_number((MachineType) m))}); - new_net_msg_ptr->getInternalDestination() = personal_dest; - break; - } - } - net_msg_dest.removeNetDest(personal_dest); - net_msg_ptr->getInternalDestination().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 - } - for(int i = 0; i < num_flits; i++) - { - m_net_ptr->increment_injected_flits(); - flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr); - fl->set_delay(g_eventQueue_ptr->getTime() - (msg_ptr.ref())->getTime()); - m_ni_buffers[vc]->insert(fl); - } - m_ni_enqueue_time[vc] = g_eventQueue_ptr->getTime(); - m_out_vc_state[vc]->setState(ACTIVE_, g_eventQueue_ptr->getTime()); - } - return true ; -} - -// Looking for a free output vc -int NetworkInterface_d::calculateVC(int vnet) -{ - for(int i = 0; i < m_vc_per_vnet; i++) - { - int delta = m_vc_allocator[vnet]; - m_vc_allocator[vnet]++; - if(m_vc_allocator[vnet] == m_vc_per_vnet) - m_vc_allocator[vnet] = 0; - - if(m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState(IDLE_, g_eventQueue_ptr->getTime())) - { - return ((vnet*m_vc_per_vnet) + delta); - } - } - return -1; -} - -/* - * The NI wakeup checks whether there are any ready messages in the protocol buffer. If yes, - * it picks that up, flitisizes it into a number of flits and puts it into an output buffer - * and schedules the output link. On a wakeup it also checks whether there are flits in the - * input link. If yes, it picks them up and if the flit is a tail, the NI inserts the - * corresponding message into the protocol buffer. It also checks for credits being sent - * by the downstream router. - */ - -void NetworkInterface_d::wakeup() -{ - DEBUG_EXPR(NETWORK_COMP, MedPrio, m_id); - DEBUG_MSG(NETWORK_COMP, MedPrio, "NI WOKE UP"); - DEBUG_EXPR(NETWORK_COMP, MedPrio, g_eventQueue_ptr->getTime()); - - MsgPtr msg_ptr; - - //Checking for messages coming from the protocol - for (int vnet = 0; vnet < m_virtual_networks; vnet++) // can pick up a message/cycle for each virtual net - { - while(inNode_ptr[vnet]->isReady()) // Is there a message waiting - { - msg_ptr = inNode_ptr[vnet]->peekMsgPtr(); - if(flitisizeMessage(msg_ptr, vnet)) - { - inNode_ptr[vnet]->pop(); - } - else - { - break; - } - } - } - - scheduleOutputLink(); - checkReschedule(); - -/*********** Picking messages destined for this NI **********/ - - if(inNetLink->isReady()) - { - flit_d *t_flit = inNetLink->consumeLink(); - bool free_signal = false; - if(t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) - { - free_signal = true; - if(!m_net_ptr->getNetworkConfig()->isNetworkTesting()) // When we are doing network only testing, the messages do not have to be buffered into the message buffers - { - outNode_ptr[t_flit->get_vnet()]->enqueue(t_flit->get_msg_ptr(), 1); // enqueueing for protocol buffer. This is not required when doing network only testing - } - } - flit_d *credit_flit = new flit_d(t_flit->get_vc(), free_signal); // Simply send a credit back since we are not buddering this flit in the NI - creditQueue->insert(credit_flit); - g_eventQueue_ptr->scheduleEvent(m_ni_credit_link, 1); - - m_net_ptr->increment_recieved_flits(); - int network_delay = g_eventQueue_ptr->getTime() - t_flit->get_enqueue_time(); - int queueing_delay = t_flit->get_delay(); - m_net_ptr->increment_network_latency(network_delay); - m_net_ptr->increment_queueing_latency(queueing_delay); - delete t_flit; - } - - /****************** Checking for credit link *******/ - - if(m_credit_link->isReady()) - { - flit_d *t_flit = m_credit_link->consumeLink(); - m_out_vc_state[t_flit->get_vc()]->increment_credit(); - if(t_flit->is_free_signal()) - { - m_out_vc_state[t_flit->get_vc()]->setState(IDLE_, g_eventQueue_ptr->getTime()); - } - delete t_flit; - } -} - -// This function look 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_d::scheduleOutputLink() -{ - int vc = m_vc_round_robin; - m_vc_round_robin++; - if(m_vc_round_robin == m_num_vcs) - m_vc_round_robin = 0; - - for(int i = 0; i < m_num_vcs; i++) - { - vc++; - if(vc == m_num_vcs) - vc = 0; - if(m_ni_buffers[vc]->isReady() && m_out_vc_state[vc]->has_credits()) // models buffer backpressure - { - bool is_candidate_vc = true; - int t_vnet = get_vnet(vc); - int vc_base = t_vnet * m_vc_per_vnet; - - if(m_net_ptr->isVNetOrdered(t_vnet)) - { - for (int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++) - { - int t_vc = vc_base + vc_offset; - if(m_ni_buffers[t_vc]->isReady()) - { - if(m_ni_enqueue_time[t_vc] < m_ni_enqueue_time[vc]) - { - is_candidate_vc = false; - break; - } - } - } - } - if(!is_candidate_vc) - continue; - - m_out_vc_state[vc]->decrement_credit(); - flit_d *t_flit = m_ni_buffers[vc]->getTopFlit(); // Just removing the flit - t_flit->set_time(g_eventQueue_ptr->getTime() + 1); - outSrcQueue->insert(t_flit); - g_eventQueue_ptr->scheduleEvent(outNetLink, 1); // schedule the out link - - if(t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) - { - m_ni_enqueue_time[vc] = INFINITE_; - } - return; - } - } -} - -int NetworkInterface_d::get_vnet(int vc) -{ - for(int i = 0; i < m_net_ptr->getNumberOfVirtualNetworks(); i++) - { - if(vc >= (i*m_vc_per_vnet) && vc < ((i+1)*m_vc_per_vnet)) - { - return i; - } - } - ERROR_MSG("Could not determine vc"); - return -1; -} - -void NetworkInterface_d::checkReschedule() -{ - for(int vnet = 0; vnet < m_virtual_networks; vnet++) - { - if(inNode_ptr[vnet]->isReady()) // Is there a message waiting - { - g_eventQueue_ptr->scheduleEvent(this, 1); - return; - } - } - for(int vc = 0; vc < m_num_vcs; vc++) - { - if(m_ni_buffers[vc]->isReadyForNext()) - { - g_eventQueue_ptr->scheduleEvent(this, 1); - return; - } - } -} - -void NetworkInterface_d::printConfig(ostream& out) const -{ - out << "[Network Interface " << m_id << "] - "; - out << "[inLink " << inNetLink->get_id() << "] - "; - out << "[outLink " << outNetLink->get_id() << "]" << endl; -} - -void NetworkInterface_d::print(ostream& out) const -{ - out << "[Network Interface]"; -} diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.hh deleted file mode 100644 index 12b8d57e1..000000000 --- a/src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.hh +++ /dev/null @@ -1,91 +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 NET_INTERFACE_D_H -#define NET_INTERFACE_D_H - -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh" -#include "mem/gems_common/Vector.hh" -#include "mem/ruby/common/Consumer.hh" -#include "mem/ruby/slicc_interface/Message.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh" -#include "mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.hh" - -class NetworkMessage; -class MessageBuffer; -class flitBuffer_d; - -class NetworkInterface_d : public Consumer { -public: - NetworkInterface_d(int id, int virtual_networks, GarnetNetwork_d* network_ptr); - - ~NetworkInterface_d(); - - void addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link); - void addOutPort(NetworkLink_d *out_link, CreditLink_d *credit_link); - - void wakeup(); - void addNode(Vector &inNode, Vector &outNode); - void printConfig(ostream& out) const; - void print(ostream& out) const; - int get_vnet(int vc); - -private: -/**************Data Members*************/ - GarnetNetwork_d *m_net_ptr; - int m_virtual_networks, m_num_vcs, m_vc_per_vnet; - NodeID m_id; - Vector m_out_vc_state; - Vector m_vc_allocator; - int m_vc_round_robin; // For round robin scheduling - flitBuffer_d *outSrcQueue; // For modelling link contention - flitBuffer_d *creditQueue; - - NetworkLink_d *inNetLink; - NetworkLink_d *outNetLink; - CreditLink_d *m_credit_link; - CreditLink_d *m_ni_credit_link; - - // Input Flit Buffers - Vector m_ni_buffers; // The flit buffers which will serve the Consumer - Vector