Garnet: reorganize directory tree.
authorSteve Reinhardt <steve.reinhardt@amd.com>
Sat, 30 Jan 2010 04:29:30 +0000 (20:29 -0800)
committerSteve Reinhardt <steve.reinhardt@amd.com>
Sat, 30 Jan 2010 04:29:30 +0000 (20:29 -0800)
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

106 files changed:
src/mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/NetworkInterface_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/Router_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/Router_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/SConscript [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/Switch_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/Switch_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/flit_d.cc [deleted file]
src/mem/ruby/network/garnet-fixed-pipeline/flit_d.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/FlexibleConsumer.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/InVcState.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/InVcState.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/NetworkInterface.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/NetworkInterface.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/NetworkLink.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/NetworkLink.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/OutVcState.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/OutVcState.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/Router.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/Router.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/SConscript [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/VCarbiter.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/VCarbiter.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/flit.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/flit.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/flitBuffer.cc [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/flitBuffer.hh [deleted file]
src/mem/ruby/network/garnet-flexible-pipeline/netconfig.defaults [deleted file]
src/mem/ruby/network/garnet/NetworkHeader.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/SConscript [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/Router.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/Router.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/SConscript [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/flit.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/flit.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh [new file with mode: 0644]
src/mem/ruby/network/garnet/flexible-pipeline/netconfig.defaults [new file with mode: 0644]

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 (file)
index c554d72..0000000
+++ /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 (file)
index 765dd1b..0000000
+++ /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; i<number_of_routers; i++) {
-                m_router_ptr_vector.insertAtBottom(new Router_d(i, this));
-        }
-
-        for (int i=0; i < m_nodes; i++) {
-                NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks, this);
-                ni->addNode(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<double > 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<int > 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 " <<endl;
-        out << "-------------" << endl;
-}
-
-void GarnetNetwork_d::printConfig(ostream& out) const
-{
-        out << endl;
-        out << "Network Configuration" << endl;
-        out << "---------------------" << endl;
-        out << "network: GarnetNetwork_d" << endl;
-        out << "topology: " << m_topology_ptr->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 (file)
index 33f13b8..0000000
+++ /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<bool> m_in_use;
-        Vector<bool> m_ordered;
-
-        Vector<Vector<MessageBuffer*> > m_toNetQueues;
-        Vector<Vector<MessageBuffer*> > m_fromNetQueues;
-
-        Vector<Router_d *> m_router_ptr_vector;   // All Routers in Network
-        Vector<NetworkLink_d *> m_link_ptr_vector; // All links in the network
-        Vector<CreditLink_d *> m_creditlink_ptr_vector; // All links in the network
-        Vector<NetworkInterface_d *> 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 (file)
index 7f344b0..0000000
+++ /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 (file)
index beee79b..0000000
+++ /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<VirtualChannel_d *> 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 (file)
index 62ed9a1..0000000
+++ /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 (file)
index c31b76d..0000000
+++ /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<MessageBuffer*>& in,  Vector<MessageBuffer*>& 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<NetworkMessage*>(msg_ptr.ref());
-        NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
-        Vector<NodeID> 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<NetworkMessage*>(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 (file)
index 12b8d57..0000000
+++ /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<MessageBuffer *> &inNode, Vector<MessageBuffer *> &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<OutVcState_d *> m_out_vc_state;
-        Vector<int > 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<flitBuffer_d *>   m_ni_buffers; // The flit buffers which will serve the Consumer
-        Vector<Time > m_ni_enqueue_time;
-
-        Vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
-        Vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
-
-        bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
-        int calculateVC(int vnet);
-        void scheduleOutputLink();
-        void checkReschedule();
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.cc
deleted file mode 100644 (file)
index dc3c73b..0000000
+++ /dev/null
@@ -1,99 +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/NetworkLink_d.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
-
-/*
-NetworkLink_d::NetworkLink_d(int id)
-{
-        m_id = id;
-        m_latency = 1;
-        m_flit_width = NetworkConfig::getFlitSize();
-
-        linkBuffer = new flitBuffer_d();
-        m_link_utilized = 0;
-        m_vc_load.setSize(NetworkConfig::getVCsPerClass()*RubySystem::getNetwork()->getNumberOfVirtualNetworks());
-
-        for(int i = 0; i < NetworkConfig::getVCsPerClass()*RubySystem::getNetwork()->getNumberOfVirtualNetworks(); i++)
-                m_vc_load[i] = 0;
-}
-*/
-NetworkLink_d::NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr)
-{
-        m_net_ptr = net_ptr;
-        m_id = id;
-        m_latency = link_latency;
-        linkBuffer = new flitBuffer_d();
-        m_link_utilized = 0;
-        m_vc_load.setSize(m_net_ptr->getNetworkConfig()->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks());
-
-        for(int i = 0; i < m_net_ptr->getNetworkConfig()->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks(); i++)
-                m_vc_load[i] = 0;
-}
-
-NetworkLink_d::~NetworkLink_d()
-{
-        delete linkBuffer;
-}
-
-void NetworkLink_d::setLinkConsumer(Consumer *consumer)
-{
-        link_consumer = consumer;
-}
-
-void NetworkLink_d::setSourceQueue(flitBuffer_d *srcQueue)
-{
-        link_srcQueue = srcQueue;
-}
-
-void NetworkLink_d::wakeup()
-{
-        if(link_srcQueue->isReady())
-        {
-                flit_d *t_flit = link_srcQueue->getTopFlit();
-                t_flit->set_time(g_eventQueue_ptr->getTime() + m_latency);
-                linkBuffer->insert(t_flit);
-                g_eventQueue_ptr->scheduleEvent(link_consumer, m_latency);
-                m_link_utilized++;
-                m_vc_load[t_flit->get_vc()]++;
-        }
-}
-
-Vector<int> NetworkLink_d::getVcLoad()
-{
-        return m_vc_load;
-}
-
-int NetworkLink_d::getLinkUtilization()
-{
-        return m_link_utilized;
-}
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh
deleted file mode 100644 (file)
index fed8afb..0000000
+++ /dev/null
@@ -1,86 +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_LINK_D_H
-#define NETWORK_LINK_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh"
-#include "mem/gems_common/PrioHeap.hh"
-#include "mem/ruby/network/orion/power_bus.hh"
-
-class GarnetNetwork_d;
-
-class NetworkLink_d : public Consumer {
-public:
-        //NetworkLink_d(int id);
-        ~NetworkLink_d();
-
-        NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr);
-        void setLinkConsumer(Consumer *consumer);
-        void setSourceQueue(flitBuffer_d *srcQueue);
-        void print(ostream& out) const{}
-        int getLinkUtilization();
-        Vector<int> getVcLoad();
-        int get_id(){return m_id;}
-        void wakeup();
-
-        double calculate_offline_power(power_bus*);
-        double calculate_power();
-
-        inline bool isReady()
-        {
-                return linkBuffer->isReady();
-        }
-        inline flit_d* peekLink()
-        {
-                return linkBuffer->peekTopFlit();
-        }
-        inline flit_d* consumeLink()
-        {
-                return linkBuffer->getTopFlit();
-        }
-
-protected:
-        int m_id;
-        int m_latency;
-        GarnetNetwork_d *m_net_ptr;
-
-        flitBuffer_d *linkBuffer;
-        Consumer *link_consumer;
-        flitBuffer_d *link_srcQueue;
-        int m_link_utilized;
-        Vector<int > m_vc_load;
-        int m_flit_width;
-};
-
-#endif
-
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.cc
deleted file mode 100644 (file)
index 42d9af8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#include "mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
-
-OutVcState_d::OutVcState_d(int id, GarnetNetwork_d *network_ptr)
-{
-        m_network_ptr = network_ptr;
-        m_id = id;
-        m_vc_state = IDLE_;
-        m_time = g_eventQueue_ptr->getTime();
-        m_credit_count = m_network_ptr->getNetworkConfig()->getBufferSize();
-}
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/OutVcState_d.hh
deleted file mode 100644 (file)
index fe6b5fc..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#ifndef OUT_VC_STATE_D_H
-#define OUT_VC_STATE_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
-
-class OutVcState_d {
-public:
-        OutVcState_d(int id, GarnetNetwork_d *network_ptr);
-
-        int get_inport() {return m_in_port; }
-        int get_invc() { return m_in_vc; }
-        int get_credit_count() {return m_credit_count; }
-        void set_inport(int port) {m_in_port = port; }
-        void set_invc(int vc) {m_in_vc = vc; }
-
-        inline bool isInState(VC_state_type state, Time request_time)
-        {
-                return ((m_vc_state == state) && (request_time >= m_time) );
-        }
-
-        inline void setState(VC_state_type state, Time time)
-        {
-                m_vc_state = state;
-                m_time = time;
-        }
-
-        inline bool has_credits()
-        {
-                return (m_credit_count > 0);
-        }
-
-        inline void increment_credit()
-        {
-                m_credit_count++;
-        }
-
-        inline void decrement_credit()
-        {
-                m_credit_count--;
-        }
-
-private:
-        GarnetNetwork_d *m_network_ptr;
-        int m_id ;
-        Time m_time;
-        VC_state_type m_vc_state;
-        int m_in_port;
-        int m_in_vc;
-        int m_credit_count;
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.cc
deleted file mode 100644 (file)
index e672009..0000000
+++ /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
- */
-
-#include "mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/Router_d.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
-
-OutputUnit_d::OutputUnit_d(int id, Router_d *router)
-{
-        m_id = id;
-        m_router = router;
-        m_num_vcs = m_router->get_num_vcs();
-        m_out_buffer = new flitBuffer_d();
-
-        for(int i = 0; i < m_num_vcs; i++)
-        {
-                m_outvc_state.insertAtBottom(new OutVcState_d(i, m_router->get_net_ptr()));
-        }
-}
-
-OutputUnit_d::~OutputUnit_d()
-{
-        delete m_out_buffer;
-        m_outvc_state.deletePointers();
-}
-
-void OutputUnit_d::decrement_credit(int out_vc)
-{
-        m_outvc_state[out_vc]->decrement_credit();
-        m_router->update_incredit(m_outvc_state[out_vc]->get_inport(), m_outvc_state[out_vc]->get_invc(), m_outvc_state[out_vc]->get_credit_count());
-}
-
-void OutputUnit_d::wakeup()
-{
-        if(m_credit_link->isReady())
-        {
-                flit_d *t_flit = m_credit_link->consumeLink();
-                int out_vc = t_flit->get_vc();
-                m_outvc_state[out_vc]->increment_credit();
-                m_router->update_incredit(m_outvc_state[out_vc]->get_inport(), m_outvc_state[out_vc]->get_invc(), m_outvc_state[out_vc]->get_credit_count());
-
-                if(t_flit->is_free_signal())
-                        set_vc_state(IDLE_, out_vc);
-
-                delete t_flit;
-        }
-}
-
-flitBuffer_d* OutputUnit_d::getOutQueue()
-{
-        return m_out_buffer;
-}
-
-void OutputUnit_d::set_out_link(NetworkLink_d *link)
-{
-        m_out_link = link;
-}
-
-void OutputUnit_d::set_credit_link(CreditLink_d *credit_link)
-{
-        m_credit_link = credit_link;
-}
-
-void OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
-{
-        m_outvc_state[vc]->setState(ACTIVE_, g_eventQueue_ptr->getTime() + 1);
-        m_outvc_state[vc]->set_inport(in_port);
-        m_outvc_state[vc]->set_invc(in_vc);
-        m_router->update_incredit(in_port, in_vc, m_outvc_state[vc]->get_credit_count());
-}
-
-void OutputUnit_d::printConfig(ostream& out)
-{
-        out << endl;
-        out << "OutputUnit Configuration" << endl;
-        out << "---------------------" << endl;
-        out << "id = " << m_id << endl;
-        out << "Out link is " << m_out_link->get_id() << endl;
-}
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh
deleted file mode 100644 (file)
index beeab8c..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#ifndef OUTPUT_UNIT_D_H
-#define OUTPUT_UNIT_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/OutVcState_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 OutputUnit_d : public Consumer {
-public:
-        OutputUnit_d(int id, Router_d *router);
-        ~OutputUnit_d();
-        void set_out_link(NetworkLink_d *link);
-        void set_credit_link(CreditLink_d *credit_link);
-        void wakeup();
-        flitBuffer_d* getOutQueue();
-        void printConfig(ostream& out);
-        void update_vc(int vc, int in_port, int in_vc);
-        void print(ostream& out) const {};
-        int get_credit_cnt(int vc) { return m_outvc_state[vc]->get_credit_count(); }
-        void decrement_credit(int out_vc);
-
-        inline int get_outlink_id()
-        {
-                return m_out_link->get_id();
-        }
-
-        inline void set_vc_state(VC_state_type state, int vc)
-        {
-                m_outvc_state[vc]->setState(state, g_eventQueue_ptr->getTime() + 1);
-        }
-        inline bool is_vc_idle(int vc)
-        {
-                return (m_outvc_state[vc]->isInState(IDLE_, g_eventQueue_ptr->getTime())        );
-        }
-        inline void insert_flit(flit_d *t_flit)
-        {
-                m_out_buffer->insert(t_flit);
-                g_eventQueue_ptr->scheduleEvent(m_out_link, 1);
-        }
-
-
-
-private:
-        int m_id;
-        int m_num_vcs;
-        Router_d *m_router;
-        NetworkLink_d *m_out_link;
-        CreditLink_d *m_credit_link;
-
-        flitBuffer_d *m_out_buffer; // This is for the network link to consume
-        Vector<OutVcState_d *> m_outvc_state; // vc state of downstream router
-
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/Router_d.cc
deleted file mode 100644 (file)
index 5334de7..0000000
+++ /dev/null
@@ -1,162 +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/Router_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkLink_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/CreditLink_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/Switch_d.hh"
-
-Router_d::Router_d(int id, GarnetNetwork_d *network_ptr)
-{
-        m_id = id;
-        m_network_ptr = network_ptr;
-        m_virtual_networks = network_ptr->getNumberOfVirtualNetworks();
-        m_vc_per_vnet = m_network_ptr->getNetworkConfig()->getVCsPerClass();
-        m_num_vcs = m_virtual_networks*m_vc_per_vnet;
-        m_flit_width = m_network_ptr->getNetworkConfig()->getFlitSize();
-
-        m_routing_unit = new RoutingUnit_d(this);
-        m_vc_alloc = new VCallocator_d(this);
-        m_sw_alloc = new SWallocator_d(this);
-        m_switch = new Switch_d(this);
-
-        m_input_unit.clear();
-        m_output_unit.clear();
-
-        buf_read_count = 0;
-        buf_write_count = 0;
-        crossbar_count = 0;
-        vc_local_arbit_count = 0;
-        vc_global_arbit_count = 0;
-        sw_local_arbit_count = 0;
-        sw_global_arbit_count = 0;
-}
-
-Router_d::~Router_d()
-{
-        m_input_unit.deletePointers();
-        m_output_unit.deletePointers();
-        delete m_routing_unit;
-        delete m_vc_alloc;
-        delete m_sw_alloc;
-        delete m_switch;
-}
-
-void Router_d::init()
-{
-        m_vc_alloc->init();
-        m_sw_alloc->init();
-        m_switch->init();
-}
-
-void Router_d::addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link)
-{
-        int port_num = m_input_unit.size();
-        InputUnit_d *input_unit = new InputUnit_d(port_num, this);
-
-        input_unit->set_in_link(in_link);
-        input_unit->set_credit_link(credit_link);
-        in_link->setLinkConsumer(input_unit);
-        credit_link->setSourceQueue(input_unit->getCreditQueue());
-
-        m_input_unit.insertAtBottom(input_unit);
-}
-
-void Router_d::addOutPort(NetworkLink_d *out_link, const NetDest& routing_table_entry, int link_weight, CreditLink_d *credit_link)
-{
-        int port_num = m_output_unit.size();
-        OutputUnit_d *output_unit = new OutputUnit_d(port_num, this);
-
-        output_unit->set_out_link(out_link);
-        output_unit->set_credit_link(credit_link);
-        credit_link->setLinkConsumer(output_unit);
-        out_link->setSourceQueue(output_unit->getOutQueue());
-
-        m_output_unit.insertAtBottom(output_unit);
-
-        m_routing_unit->addRoute(routing_table_entry);
-        m_routing_unit->addWeight(link_weight);
-}
-
-void Router_d::route_req(flit_d *t_flit, InputUnit_d *in_unit, int invc)
-{
-        m_routing_unit->RC_stage(t_flit, in_unit, invc);
-}
-void Router_d::vcarb_req()
-{
-        g_eventQueue_ptr->scheduleEvent(m_vc_alloc, 1);
-}
-void Router_d::swarb_req()
-{
-        g_eventQueue_ptr->scheduleEvent(m_sw_alloc, 1);
-}
-void Router_d::update_incredit(int in_port, int in_vc, int credit)
-{
-        m_input_unit[in_port]->update_credit(in_vc, credit);
-}
-void Router_d::update_sw_winner(int inport, flit_d *t_flit)
-{
-        m_switch->update_sw_winner(inport, t_flit);
-        g_eventQueue_ptr->scheduleEvent(m_switch, 1);
-}
-
-void Router_d::calculate_performance_numbers()
-{
-        for(int i = 0; i < m_input_unit.size(); i++)
-        {
-                buf_read_count += m_input_unit[i]->get_buf_read_count();
-                buf_write_count += m_input_unit[i]->get_buf_write_count();
-        }
-        crossbar_count = m_switch->get_crossbar_count();
-        vc_local_arbit_count = m_vc_alloc->get_local_arbit_count();
-        vc_global_arbit_count = m_vc_alloc->get_global_arbit_count();
-        sw_local_arbit_count = m_sw_alloc->get_local_arbit_count();
-        sw_global_arbit_count = m_sw_alloc->get_global_arbit_count();
-}
-
-void Router_d::printConfig(ostream& out)
-{
-        out << "[Router " << m_id << "] :: " << endl;
-        out << "[inLink - ";
-        for(int i = 0;i < m_input_unit.size(); i++)
-                out << m_input_unit[i]->get_inlink_id() << " - ";
-        out << "]" << endl;
-        out << "[outLink - ";
-        for(int i = 0;i < m_output_unit.size(); i++)
-                out << m_output_unit[i]->get_outlink_id() << " - ";
-        out << "]" << endl;
-}
-
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/Router_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/Router_d.hh
deleted file mode 100644 (file)
index f9af1ab..0000000
+++ /dev/null
@@ -1,97 +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 ROUTER_D_H
-#define ROUTER_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/gems_common/Vector.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/flit_d.hh"
-#include "mem/ruby/common/NetDest.hh"
-#include "mem/ruby/network/orion/power_router_init.hh"
-
-class GarnetNetwork_d;
-class NetworkLink_d;
-class CreditLink_d;
-class InputUnit_d;
-class OutputUnit_d;
-class RoutingUnit_d;
-class VCallocator_d;
-class SWallocator_d;
-class Switch_d;
-
-class Router_d {
-public:
-        Router_d(int id, GarnetNetwork_d *network_ptr);
-
-        ~Router_d();
-
-        void init();
-        void addInPort(NetworkLink_d *link, CreditLink_d *credit_link);
-        void addOutPort(NetworkLink_d *link, const NetDest& routing_table_entry, int link_weight, CreditLink_d *credit_link);
-        int get_num_vcs() { return m_num_vcs; }
-        int get_vc_per_vnet() {return m_vc_per_vnet; }
-        int get_num_inports() { return m_input_unit.size(); }
-        int get_num_outports() { return m_output_unit.size(); }
-        void printConfig(ostream& out);
-        int get_id() { return m_id; }
-        GarnetNetwork_d* get_net_ptr() { return m_network_ptr; }
-
-        Vector<InputUnit_d *>& get_inputUnit_ref() { return m_input_unit; }
-        Vector<OutputUnit_d *>& get_outputUnit_ref() { return m_output_unit; }
-
-        void update_sw_winner(int inport, flit_d *t_flit);
-        void update_incredit(int in_port, int in_vc, int credit);
-        void route_req(flit_d *t_flit, InputUnit_d* in_unit, int invc);
-        void vcarb_req();
-        void swarb_req();
-
-        void power_router_initialize(power_router *router, power_router_info *info);
-        double calculate_power();
-        double calculate_offline_power(power_router*, power_router_info*);
-        void calculate_performance_numbers();
-
-private:
-        int m_id;
-        int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
-        GarnetNetwork_d *m_network_ptr;
-        int m_flit_width;
-
-        double buf_read_count, buf_write_count, crossbar_count, vc_local_arbit_count, vc_global_arbit_count, sw_local_arbit_count, sw_global_arbit_count;
-
-        Vector<InputUnit_d *> m_input_unit;
-        Vector<OutputUnit_d *> m_output_unit;
-        RoutingUnit_d *m_routing_unit;
-        VCallocator_d *m_vc_alloc;
-        SWallocator_d *m_sw_alloc;
-        Switch_d *m_switch;
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.cc
deleted file mode 100644 (file)
index 9f12ac9..0000000
+++ /dev/null
@@ -1,88 +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/RoutingUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/Router_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh"
-#include "mem/ruby/slicc_interface/NetworkMessage.hh"
-
-RoutingUnit_d::RoutingUnit_d(Router_d *router)
-{
-        m_router = router;
-        m_routing_table.clear();
-        m_weight_table.clear();
-}
-
-void RoutingUnit_d::addRoute(const NetDest& routing_table_entry)
-{
-        m_routing_table.insertAtBottom(routing_table_entry);
-}
-
-void RoutingUnit_d::addWeight(int link_weight)
-{
-        m_weight_table.insertAtBottom(link_weight);
-}
-
-void RoutingUnit_d::RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc)
-{
-        int outport = routeCompute(t_flit);
-        in_unit->updateRoute(invc, outport);
-        t_flit->advance_stage(VA_);
-        m_router->vcarb_req();
-}
-
-int RoutingUnit_d::routeCompute(flit_d *t_flit)
-{
-        MsgPtr msg_ptr = t_flit->get_msg_ptr();
-        NetworkMessage* net_msg_ptr = NULL;
-        net_msg_ptr = dynamic_cast<NetworkMessage*>(msg_ptr.ref());
-        NetDest msg_destination = net_msg_ptr->getInternalDestination();
-
-        int output_link = -1;
-        int min_weight = INFINITE_;
-
-        for(int link = 0; link < m_routing_table.size(); link++)
-        {
-                if (msg_destination.intersectionIsNotEmpty(m_routing_table[link]))
-                {
-                        if(m_weight_table[link] >= min_weight)
-                                continue;
-                        output_link = link;
-                        min_weight = m_weight_table[link];
-                }
-        }
-        if(output_link == -1)
-        {
-                ERROR_MSG("Fatal Error:: No Route exists from this Router.");
-                exit(0);
-        }
-        return output_link;
-
-}
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/RoutingUnit_d.hh
deleted file mode 100644 (file)
index 33c9f3c..0000000
+++ /dev/null
@@ -1,56 +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 ROUTING_UNIT_D_H
-#define ROUTING_UNIT_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/flit_d.hh"
-#include "mem/ruby/common/NetDest.hh"
-
-class InputUnit_d;
-class Router_d;
-
-class RoutingUnit_d {
-public:
-        RoutingUnit_d(Router_d *router);
-        void addRoute(const NetDest& routing_table_entry);
-        int routeCompute(flit_d *t_flit);
-        void addWeight(int link_weight);
-        void RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc);
-
-private:
-        Router_d *m_router;
-        Vector<NetDest > m_routing_table;
-        Vector<int > m_weight_table;
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/SConscript b/src/mem/ruby/network/garnet-fixed-pipeline/SConscript
deleted file mode 100644 (file)
index 84f4ba3..0000000
+++ /dev/null
@@ -1,52 +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('*')
-
-# temporarily disable
-Return()
-
-if not env['RUBY']:
-    Return()
-
-Source('GarnetNetwork_d.cc')
-Source('InputUnit_d.cc')
-Source('NetworkInterface_d.cc')
-Source('NetworkLink_d.cc')
-Source('OutVcState_d.cc')
-Source('OutputUnit_d.cc')
-Source('Router_d.cc')
-Source('RoutingUnit_d.cc')
-Source('SWallocator_d.cc')
-Source('Switch_d.cc')
-Source('VCallocator_d.cc')
-Source('VirtualChannel_d.cc')
-Source('flitBuffer_d.cc')
-Source('flit_d.cc')
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.cc
deleted file mode 100644 (file)
index c730859..0000000
+++ /dev/null
@@ -1,225 +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/SWallocator_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/Router_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
-
-SWallocator_d::SWallocator_d(Router_d *router)
-{
-        m_router = router;
-        m_num_vcs = m_router->get_num_vcs();
-        m_vc_per_vnet = m_router->get_vc_per_vnet();
-
-        m_local_arbiter_activity = 0;
-        m_global_arbiter_activity = 0;
-}
-
-void SWallocator_d::init()
-{
-        m_input_unit = m_router->get_inputUnit_ref();
-        m_output_unit = m_router->get_outputUnit_ref();
-
-        m_num_inports = m_router->get_num_inports();
-        m_num_outports = m_router->get_num_outports();
-        m_round_robin_outport.setSize(m_num_outports);
-        m_round_robin_inport.setSize(m_num_inports);
-        m_port_req.setSize(m_num_outports);
-        m_vc_winners.setSize(m_num_outports);
-
-        for(int i = 0; i < m_num_inports; i++)
-        {
-                m_round_robin_inport[i] = 0;
-        }
-
-        for(int i = 0; i < m_num_outports; i++)
-        {
-                m_port_req[i].setSize(m_num_inports);
-                m_vc_winners[i].setSize(m_num_inports);
-
-                m_round_robin_outport[i] = 0;
-
-                for(int j = 0; j < m_num_inports; j++)
-                {
-                        m_port_req[i][j] = false; // [outport][inport]
-                }
-        }
-}
-
-void SWallocator_d::wakeup()
-{
-        arbitrate_inports(); // First stage of allocation
-        arbitrate_outports(); // Second stage of allocation
-
-        clear_request_vector();
-        check_for_wakeup();
-
-}
-
-void SWallocator_d::arbitrate_inports()
-{
-        // First I will do round robin arbitration on a set of input vc requests
-        for(int inport = 0; inport < m_num_inports; inport++)
-        {
-                int invc = m_round_robin_inport[inport];
-                m_round_robin_inport[inport]++;
-
-                if(m_round_robin_inport[inport] >= m_num_vcs)
-                        m_round_robin_inport[inport] = 0;
-                for(int j = 0; j < m_num_vcs; j++)
-                {
-                        invc++;
-                        if(invc >= m_num_vcs)
-                                invc = 0;
-                        if(m_input_unit[inport]->need_stage(invc, ACTIVE_, SA_) && m_input_unit[inport]->has_credits(invc))
-                        {
-                                if(is_candidate_inport(inport, invc))
-                                {
-                                        int outport = m_input_unit[inport]->get_route(invc);
-                                        m_local_arbiter_activity++;
-                                        m_port_req[outport][inport] = true;
-                                        m_vc_winners[outport][inport]= invc;
-                                        break; // got one vc winner for this port
-                                }
-                        }
-                }
-        }
-}
-
-bool SWallocator_d::is_candidate_inport(int inport, int invc)
-{
-        int outport = m_input_unit[inport]->get_route(invc);
-        int t_enqueue_time = m_input_unit[inport]->get_enqueue_time(invc);
-        int t_vnet = get_vnet(invc);
-        int vc_base = t_vnet*m_vc_per_vnet;
-        if((m_router->get_net_ptr())->isVNetOrdered(t_vnet))
-        {
-                for(int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++)
-                {
-                        int temp_vc = vc_base + vc_offset;
-                        if(m_input_unit[inport]->need_stage(temp_vc, ACTIVE_, SA_) && (m_input_unit[inport]->get_route(temp_vc) == outport) && (m_input_unit[inport]->get_enqueue_time(temp_vc) < t_enqueue_time))
-                        {
-                                return false;
-                                break;
-                        }
-                }
-        }
-        return true;
-}
-
-
-void SWallocator_d::arbitrate_outports()
-{
-// now I have a set of input vc requests for output vcs. Again do round robin arbitration on these requests
-        for(int outport = 0; outport < m_num_outports; outport++)
-        {
-                int in_port = m_round_robin_outport[outport];
-                m_round_robin_outport[outport]++;
-
-                if(m_round_robin_outport[outport] >= m_num_outports)
-                        m_round_robin_outport[outport] = 0;
-
-                for(int inport = 0; inport < m_num_inports; inport++)
-                {
-                        in_port++;
-                        if(in_port >= m_num_inports)
-                                in_port = 0;
-                        if(m_port_req[outport][in_port]) // This Inport has a request this cycle for this port
-                        {
-                                m_port_req[outport][in_port] = false;
-                                int invc = m_vc_winners[outport][in_port];
-                                int outvc = m_input_unit[in_port]->get_outvc(invc);
-                                flit_d *t_flit = m_input_unit[in_port]->getTopFlit(invc); // removes flit from Input Unit
-                                t_flit->advance_stage(ST_);
-                                t_flit->set_vc(outvc);
-                                t_flit->set_outport(outport);
-                                t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
-                                m_output_unit[outport]->decrement_credit(outvc);
-                                m_router->update_sw_winner(in_port, t_flit);
-                                m_global_arbiter_activity++;
-
-                                if((t_flit->get_type() == TAIL_) || t_flit->get_type() == HEAD_TAIL_)
-                                {
-                                        m_input_unit[in_port]->increment_credit(invc, true); // Send a credit back along with the information that this VC is not idle
-                                        assert(m_input_unit[in_port]->isReady(invc) == false); // This Input VC should now be empty
-
-                                        m_input_unit[in_port]->set_vc_state(IDLE_, invc);
-                                        m_input_unit[in_port]->set_enqueue_time(invc, INFINITE_);
-                                }
-                                else
-                                {
-                                        m_input_unit[in_port]->increment_credit(invc, false); // Send a credit back but do not indicate that the VC is idle
-                                }
-                                break; // got a in request for this outport
-                        }
-                }
-        }
-}
-
-void SWallocator_d::check_for_wakeup()
-{
-        for(int i = 0; i < m_num_inports; i++)
-        {
-                for(int j = 0; j < m_num_vcs; j++)
-                {
-                        if(m_input_unit[i]->need_stage_nextcycle(j, ACTIVE_, SA_))
-                        {
-                                g_eventQueue_ptr->scheduleEvent(this, 1);
-                                return;
-                        }
-                }
-        }
-}
-
-int SWallocator_d::get_vnet(int invc)
-{
-  for(int i = 0; i < RubySystem::getNetwork()->getNumberOfVirtualNetworks(); i++)
-        {
-                if(invc >= (i*m_vc_per_vnet) && invc < ((i+1)*m_vc_per_vnet))
-                {
-                        return i;
-                }
-        }
-        ERROR_MSG("Could not determine vc");
-        return -1;
-}
-
-void SWallocator_d::clear_request_vector()
-{
-        for(int i = 0; i < m_num_outports; i++)
-        {
-                for(int j = 0; j < m_num_inports; j++)
-                {
-                        m_port_req[i][j] = false;
-                }
-        }
-}
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/SWallocator_d.hh
deleted file mode 100644 (file)
index f0ec5d7..0000000
+++ /dev/null
@@ -1,77 +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 SW_ALLOCATOR_D_H
-#define SW_ALLOCATOR_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/common/Consumer.hh"
-
-class Router_d;
-class InputUnit_d;
-class OutputUnit_d;
-
-class SWallocator_d : public Consumer {
-public:
-        SWallocator_d(Router_d *router);
-        void wakeup();
-        void init();
-        void clear_request_vector();
-        void check_for_wakeup();
-        int get_vnet (int invc);
-        void print(ostream& out) const {};
-        void arbitrate_inports();
-        void arbitrate_outports();
-        bool is_candidate_inport(int inport, int invc);
-        inline double get_local_arbit_count()
-        {
-                return m_local_arbiter_activity;
-        }
-        inline double get_global_arbit_count()
-        {
-                return m_global_arbiter_activity;
-        }
-
-private:
-        int m_num_inports, m_num_outports;
-        int m_num_vcs, m_vc_per_vnet;
-
-        double m_local_arbiter_activity, m_global_arbiter_activity;
-
-        Router_d *m_router;
-        Vector<int > m_round_robin_outport;
-        Vector<int > m_round_robin_inport;
-        Vector<Vector<bool > > m_port_req;
-        Vector<Vector<int > > m_vc_winners; // a list for each outport
-        Vector<InputUnit_d *> m_input_unit;
-        Vector<OutputUnit_d *> m_output_unit;
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/Switch_d.cc
deleted file mode 100644 (file)
index 11a1969..0000000
+++ /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 "mem/ruby/network/garnet-fixed-pipeline/Switch_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/Router_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh"
-
-Switch_d::Switch_d(Router_d *router)
-{
-        m_router = router;
-        m_num_vcs = m_router->get_num_vcs();
-        m_crossbar_activity = 0;
-}
-
-Switch_d::~Switch_d()
-{
-        m_switch_buffer.deletePointers();
-}
-
-void Switch_d::init()
-{
-        m_output_unit = m_router->get_outputUnit_ref();
-
-        m_num_inports = m_router->get_num_inports();
-        m_switch_buffer.setSize(m_num_inports);
-        for(int i = 0; i < m_num_inports; i++)
-        {
-                m_switch_buffer[i] = new flitBuffer_d();
-        }
-}
-
-void Switch_d::wakeup()
-{
-        DEBUG_MSG(NETWORK_COMP, HighPrio, "Switch woke up");
-        DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
-
-        for(int inport = 0; inport < m_num_inports; inport++)
-        {
-                if(!m_switch_buffer[inport]->isReady())
-                        continue;
-                flit_d *t_flit = m_switch_buffer[inport]->peekTopFlit();
-                if(t_flit->is_stage(ST_))
-                {
-                        int outport = t_flit->get_outport();
-                        t_flit->advance_stage(LT_);
-                        t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
-                        m_output_unit[outport]->insert_flit(t_flit); // This will take care of waking up the Network Link
-                        m_switch_buffer[inport]->getTopFlit();
-                        m_crossbar_activity++;
-                }
-        }
-        check_for_wakeup();
-}
-
-void Switch_d::check_for_wakeup()
-{
-        for(int inport = 0; inport < m_num_inports; inport++)
-        {
-                if(m_switch_buffer[inport]->isReadyForNext())
-                {
-                        g_eventQueue_ptr->scheduleEvent(this, 1);
-                        break;
-                }
-        }
-}
-
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/Switch_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/Switch_d.hh
deleted file mode 100644 (file)
index 9369727..0000000
+++ /dev/null
@@ -1,68 +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 SWITCH_D_H
-#define SWITCH_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh"
-
-class Router_d;
-class OutputUnit_d;
-
-class Switch_d : public Consumer {
-public:
-        Switch_d(Router_d *router);
-        ~Switch_d();
-        void wakeup();
-        void init();
-        void check_for_wakeup();
-        void print(ostream& out) const {};
-        inline void update_sw_winner(int inport, flit_d *t_flit)
-        {
-                m_switch_buffer[inport]->insert(t_flit);
-        }
-        inline double get_crossbar_count()
-        {
-                return m_crossbar_activity;
-        }
-
-
-private:
-        int m_num_vcs;
-        int m_num_inports;
-        double m_crossbar_activity;
-        Router_d *m_router;
-        Vector<flitBuffer_d *> m_switch_buffer;
-        Vector<OutputUnit_d *> m_output_unit;
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.cc
deleted file mode 100644 (file)
index 4150907..0000000
+++ /dev/null
@@ -1,266 +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/NetworkConfig.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/Router_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/InputUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/OutputUnit_d.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
-
-VCallocator_d::VCallocator_d(Router_d *router)
-{
-        m_router = router;
-        m_num_vcs = m_router->get_num_vcs();
-        m_vc_per_vnet = m_router->get_vc_per_vnet();
-        m_local_arbiter_activity = 0;
-        m_global_arbiter_activity = 0;
-}
-
-void VCallocator_d::init()
-{
-        m_input_unit = m_router->get_inputUnit_ref();
-        m_output_unit = m_router->get_outputUnit_ref();
-
-        m_num_inports = m_router->get_num_inports();
-        m_num_outports = m_router->get_num_outports();
-        m_round_robin_invc.setSize(m_num_inports);
-        m_round_robin_outvc.setSize(m_num_outports);
-        m_outvc_req.setSize(m_num_outports);
-        m_outvc_is_req.setSize(m_num_outports);
-
-        for(int i = 0; i < m_num_inports; i++)
-        {
-                m_round_robin_invc[i].setSize(m_num_vcs);
-
-                for(int j = 0; j < m_num_vcs; j++)
-                {
-                        m_round_robin_invc[i][j] = 0;
-                }
-        }
-
-        for(int i = 0; i < m_num_outports; i++)
-        {
-                m_round_robin_outvc[i].setSize(m_num_vcs);
-                m_outvc_req[i].setSize(m_num_vcs);
-                m_outvc_is_req[i].setSize(m_num_vcs);
-
-                for(int j = 0; j < m_num_vcs; j++)
-                {
-                        m_round_robin_outvc[i][j].first = 0;
-                        m_round_robin_outvc[i][j].second = 0;
-                        m_outvc_is_req[i][j] = false;
-
-                        m_outvc_req[i][j].setSize(m_num_inports);
-
-                        for(int k = 0; k < m_num_inports; k++)
-                        {
-                                m_outvc_req[i][j][k].setSize(m_num_vcs);
-                                for(int l = 0; l < m_num_vcs; l++)
-                                {
-                                        m_outvc_req[i][j][k][l] = false;
-                                }
-                        }
-                }
-        }
-}
-
-void VCallocator_d::clear_request_vector()
-{
-        for(int i = 0; i < m_num_outports; i++)
-        {
-                for(int j = 0; j < m_num_vcs; j++)
-                {
-                        if(!m_outvc_is_req[i][j])
-                                continue;
-                        m_outvc_is_req[i][j] = false;
-                        for(int k = 0; k < m_num_inports; k++)
-                        {
-                                for(int l = 0; l < m_num_vcs; l++)
-                                {
-                                        m_outvc_req[i][j][k][l] = false;
-                                }
-                        }
-                }
-        }
-}
-
-void VCallocator_d::wakeup()
-{
-        arbitrate_invcs(); // First stage of allocation
-        arbitrate_outvcs(); // Second stage of allocation
-
-        clear_request_vector();
-        check_for_wakeup();
-}
-
-bool VCallocator_d::is_invc_candidate(int inport_iter, int invc_iter)
-{
-        int outport = m_input_unit[inport_iter]->get_route(invc_iter);
-        int vnet = get_vnet(invc_iter);
-        int t_enqueue_time = m_input_unit[inport_iter]->get_enqueue_time(invc_iter);
-
-        int invc_base = vnet*m_vc_per_vnet;
-
-        if((m_router->get_net_ptr())->isVNetOrdered(vnet))
-        {
-                for(int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++)
-                {
-                        int temp_vc = invc_base + vc_offset;
-                        if(m_input_unit[inport_iter]->need_stage(temp_vc, VC_AB_, VA_) && (m_input_unit[inport_iter]->get_route(temp_vc) == outport) && (m_input_unit[inport_iter]->get_enqueue_time(temp_vc) < t_enqueue_time))
-                        {
-                                return false;
-                        }
-                }
-        }
-        return true;
-}
-
-void VCallocator_d::select_outvc(int inport_iter, int invc_iter)
-{
-        int outport = m_input_unit[inport_iter]->get_route(invc_iter);
-        int vnet = get_vnet(invc_iter);
-        int outvc_base = vnet*m_vc_per_vnet;
-        int num_vcs_per_vnet = m_vc_per_vnet;
-
-        int outvc_offset = m_round_robin_invc[inport_iter][invc_iter];
-        m_round_robin_invc[inport_iter][invc_iter]++;
-
-        if(m_round_robin_invc[inport_iter][invc_iter] >= num_vcs_per_vnet)
-                m_round_robin_invc[inport_iter][invc_iter] = 0;
-
-        for(int outvc_offset_iter = 0; outvc_offset_iter < num_vcs_per_vnet; outvc_offset_iter++)
-        {
-                outvc_offset++;
-                if(outvc_offset >= num_vcs_per_vnet)
-                        outvc_offset = 0;
-                int outvc = outvc_base + outvc_offset;
-                if(m_output_unit[outport]->is_vc_idle(outvc))
-                {
-                        m_local_arbiter_activity++;
-                        m_outvc_req[outport][outvc][inport_iter][invc_iter] = true;
-                        if(!m_outvc_is_req[outport][outvc])
-                                m_outvc_is_req[outport][outvc] = true;
-                        return; // out vc acquired
-                }
-        }
-}
-
-void VCallocator_d::arbitrate_invcs()
-{
-        for(int inport_iter = 0; inport_iter < m_num_inports; inport_iter++)
-        {
-                for(int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++)
-                {
-                        if(m_input_unit[inport_iter]->need_stage(invc_iter, VC_AB_, VA_))
-                        {
-                                if(!is_invc_candidate(inport_iter, invc_iter))
-                                        continue;
-
-                                select_outvc(inport_iter, invc_iter);
-                        }
-                }
-        }
-}
-
-void VCallocator_d::arbitrate_outvcs()
-{
-        for(int outport_iter = 0; outport_iter < m_num_outports; outport_iter++)
-        {
-                for(int outvc_iter = 0; outvc_iter < m_num_vcs; outvc_iter++)
-                {
-                        if(!m_outvc_is_req[outport_iter][outvc_iter]) // No requests for this outvc in this cycle
-                                continue;
-
-                        int inport = m_round_robin_outvc[outport_iter][outvc_iter].first;
-                        int invc_offset = m_round_robin_outvc[outport_iter][outvc_iter].second;
-                        int vnet = get_vnet(outvc_iter);
-                        int invc_base = vnet*m_vc_per_vnet;
-                        int num_vcs_per_vnet = m_vc_per_vnet;
-
-                        m_round_robin_outvc[outport_iter][outvc_iter].second++;
-                        if(m_round_robin_outvc[outport_iter][outvc_iter].second >= num_vcs_per_vnet)
-                        {
-                                m_round_robin_outvc[outport_iter][outvc_iter].second = 0;
-                                m_round_robin_outvc[outport_iter][outvc_iter].first++;
-                                if(m_round_robin_outvc[outport_iter][outvc_iter].first >= m_num_inports)
-                                        m_round_robin_outvc[outport_iter][outvc_iter].first = 0;
-                        }
-                        for(int in_iter = 0; in_iter < m_num_inports*num_vcs_per_vnet; in_iter++)
-                        {
-                                invc_offset++;
-                                if(invc_offset >= num_vcs_per_vnet)
-                                {
-                                        invc_offset = 0;
-                                        inport++;
-                                        if(inport >= m_num_inports)
-                                                inport = 0;
-                                }
-                                int invc = invc_base + invc_offset;
-                                if(m_outvc_req[outport_iter][outvc_iter][inport][invc])
-                                {
-                                        m_global_arbiter_activity++;
-                                        m_input_unit[inport]->grant_vc(invc, outvc_iter);
-                                        m_output_unit[outport_iter]->update_vc(outvc_iter, inport, invc);
-                                        m_router->swarb_req();
-                                        break;
-                                }
-                        }
-                }
-        }
-}
-
-int VCallocator_d::get_vnet(int invc)
-{
-  for(int i = 0; i < RubySystem::getNetwork()->getNumberOfVirtualNetworks(); i++)
-        {
-                if(invc >= (i*m_vc_per_vnet) && invc < ((i+1)*m_vc_per_vnet))
-                {
-                        return i;
-                }
-        }
-        ERROR_MSG("Could not determine vc");
-        return -1;
-}
-
-void VCallocator_d::check_for_wakeup()
-{
-        for(int i = 0; i < m_num_inports; i++)
-        {
-                for(int j = 0; j < m_num_vcs; j++)
-                {
-                        if(m_input_unit[i]->need_stage_nextcycle(j, VC_AB_, VA_))
-                        {
-                                g_eventQueue_ptr->scheduleEvent(this, 1);
-                                return;
-                        }
-                }
-        }
-}
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/VCallocator_d.hh
deleted file mode 100644 (file)
index ad3c2c9..0000000
+++ /dev/null
@@ -1,81 +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 VC_ALLOCATOR_D_H
-#define VC_ALLOCATOR_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/common/Consumer.hh"
-
-class Router_d;
-class InputUnit_d;
-class OutputUnit_d;
-
-class VCallocator_d : public Consumer {
-public:
-        VCallocator_d(Router_d *router);
-        void init();
-        void wakeup();
-        void check_for_wakeup();
-        void clear_request_vector();
-        int get_vnet(int invc);
-        void print(ostream& out) const {};
-        void arbitrate_invcs();
-        void arbitrate_outvcs();
-        bool is_invc_candidate(int inport_iter, int invc_iter);
-        void select_outvc(int inport_iter, int invc_iter);
-        inline double get_local_arbit_count()
-        {
-                return m_local_arbiter_activity;
-        }
-        inline double get_global_arbit_count()
-        {
-                return m_global_arbiter_activity;
-        }
-
-private:
-        int m_num_vcs, m_vc_per_vnet;
-        int m_num_inports;
-        int m_num_outports;
-
-        double m_local_arbiter_activity, m_global_arbiter_activity;
-
-        Router_d *m_router;
-        Vector<Vector <int > > m_round_robin_invc; // First stage of arbitration where all vcs select an output vc to content for
-        Vector<Vector <pair<int, int> > > m_round_robin_outvc; // Arbiter for every output vc
-        Vector<Vector<Vector<Vector<bool > > > > m_outvc_req; // [outport][outvc][inpotr][invc]. set true in the first phase of allocation
-        Vector<Vector<bool > > m_outvc_is_req;
-
-        Vector<InputUnit_d *> m_input_unit ;
-        Vector<OutputUnit_d *> m_output_unit ;
-
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.cc
deleted file mode 100644 (file)
index 5ce3ca4..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#include "mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.hh"
-
-VirtualChannel_d::VirtualChannel_d(int id)
-{
-        m_id = id;
-        m_input_buffer = new flitBuffer_d();
-        m_vc_state.first = IDLE_;
-        m_vc_state.second = g_eventQueue_ptr->getTime();
-        m_enqueue_time = INFINITE_;
-}
-
-VirtualChannel_d::~VirtualChannel_d()
-{
-        delete m_input_buffer;
-}
-
-void VirtualChannel_d::set_outport(int outport)
-{
-        route = outport;
-}
-
-void VirtualChannel_d::grant_vc(int out_vc)
-{
-        m_output_vc = out_vc;
-        m_vc_state.first = ACTIVE_;
-        m_vc_state.second = g_eventQueue_ptr->getTime() + 1;
-        flit_d *t_flit = m_input_buffer->peekTopFlit();
-        t_flit->advance_stage(SA_);
-}
-
-bool VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage)
-{
-        if((m_vc_state.first == state) && (g_eventQueue_ptr->getTime() >= m_vc_state.second))
-        {
-                if(m_input_buffer->isReady())
-                {
-                        flit_d *t_flit = m_input_buffer->peekTopFlit();
-                        return(t_flit->is_stage(stage)) ;
-                }
-        }
-        return false;
-
-}
-
-bool VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage)
-{
-        if((m_vc_state.first == state) && ((g_eventQueue_ptr->getTime()+1) >= m_vc_state.second))
-        {
-                if(m_input_buffer->isReadyForNext())
-                {
-                        flit_d *t_flit = m_input_buffer->peekTopFlit();
-                        return(t_flit->is_next_stage(stage)) ;
-                }
-        }
-        return false;
-}
-
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/VirtualChannel_d.hh
deleted file mode 100644 (file)
index 2d81cb7..0000000
+++ /dev/null
@@ -1,114 +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 VIRTUAL_CHANNEL_D_H
-#define VIRTUAL_CHANNEL_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh"
-
-class VirtualChannel_d {
-public:
-        VirtualChannel_d(int id);
-        ~VirtualChannel_d();
-
-        bool need_stage(VC_state_type state, flit_stage stage);
-        bool need_stage_nextcycle(VC_state_type state, flit_stage stage);
-        void set_outport(int outport);
-        void grant_vc(int out_vc);
-
-        inline Time get_enqueue_time()
-        {
-                return m_enqueue_time;
-        }
-
-        inline void set_enqueue_time(Time time)
-        {
-                m_enqueue_time = time;
-        }
-
-        inline VC_state_type get_state()
-        {
-                return m_vc_state.first;
-        }
-        inline int get_outvc()
-        {
-                return m_output_vc;
-        }
-        inline bool isReady()
-        {
-                return m_input_buffer->isReady();
-        }
-        inline bool has_credits()
-        {
-                return (m_credit_count > 0);
-        }
-        inline int get_route()
-        {
-                return route;
-        }
-        inline void update_credit(int credit)
-        {
-                m_credit_count = credit;
-        }
-        inline void increment_credit()
-        {
-                m_credit_count++;
-        }
-        inline void insertFlit(flit_d *t_flit)
-        {
-                m_input_buffer->insert(t_flit);
-        }
-        inline void set_state(VC_state_type m_state)
-        {
-                m_vc_state.first = m_state;
-                m_vc_state.second = g_eventQueue_ptr->getTime() + 1;
-        }
-
-        inline flit_d* peekTopFlit()
-        {
-                return m_input_buffer->peekTopFlit();
-        }
-
-        inline flit_d* getTopFlit()
-        {
-                return m_input_buffer->getTopFlit();
-        }
-
-private:
-        int m_id;
-        flitBuffer_d *m_input_buffer;
-        pair<VC_state_type, Time> m_vc_state; // I/R/V/A/C
-        int route;
-        Time m_enqueue_time;
-        int m_output_vc;
-        int m_credit_count;
-};
-#endif
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.cc
deleted file mode 100644 (file)
index fa189a8..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#include "mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh"
-
-flitBuffer_d::flitBuffer_d()
-{
-        max_size = INFINITE_;
-}
-
-flitBuffer_d::flitBuffer_d(int maximum_size)
-{
-        max_size = maximum_size;
-}
-
-bool flitBuffer_d::isEmpty()
-{
-        return (m_buffer.size() == 0);
-}
-
-bool flitBuffer_d::isReady()
-{
-        if(m_buffer.size() != 0 )
-        {
-                flit_d *t_flit = m_buffer.peekMin();
-                if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
-                        return true;
-        }
-        return false;
-}
-
-bool flitBuffer_d::isReadyForNext()
-{
-        if(m_buffer.size() != 0 )
-        {
-                flit_d *t_flit = m_buffer.peekMin();
-                if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
-                        return true;
-        }
-        return false;
-}
-
-void flitBuffer_d::print(ostream& out) const
-{
-        out << "[flitBuffer: ";
-        out << m_buffer.size() << "] " << endl;
-}
-
-bool flitBuffer_d::isFull()
-{
-        return (m_buffer.size() >= max_size);
-}
-void flitBuffer_d::setMaxSize(int maximum)
-{
-        max_size = maximum;
-}
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/flitBuffer_d.hh
deleted file mode 100644 (file)
index 2edea9d..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#ifndef FLIT_BUFFER_D_H
-#define FLIT_BUFFER_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/gems_common/PrioHeap.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/flit_d.hh"
-
-class flitBuffer_d {
-public:
-        flitBuffer_d();
-        flitBuffer_d(int maximum_size);
-
-        bool isReady();
-        bool isReadyForNext();
-        bool isEmpty();
-        void print(ostream& out) const;
-        bool isFull();
-        void setMaxSize(int maximum);
-
-        inline flit_d* getTopFlit()
-        {
-                return m_buffer.extractMin();
-        }
-        inline flit_d* peekTopFlit()
-        {
-                return m_buffer.peekMin();
-        }
-        inline void insert(flit_d *flt)
-        {
-                m_buffer.insert(flt);
-        }
-        /**********Data Members*********/
-private:
-        PrioHeap <flit_d *> m_buffer;
-        int size, max_size;
-};
-
-ostream& operator<<(ostream& out, const flitBuffer_d& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-extern inline
-ostream& operator<<(ostream& out, const flitBuffer_d& obj)
-{
-  obj.print(out);
-  out << flush;
-  return out;
-}
-
-#endif
-
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/flit_d.cc b/src/mem/ruby/network/garnet-fixed-pipeline/flit_d.cc
deleted file mode 100644 (file)
index 15e0b03..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#include "mem/ruby/network/garnet-fixed-pipeline/flit_d.hh"
-
-flit_d::flit_d(int id, int  vc, int vnet, int size, MsgPtr msg_ptr)
-{
-        m_size = size;
-        m_msg_ptr = msg_ptr;
-        m_enqueue_time = g_eventQueue_ptr->getTime();
-        m_time = g_eventQueue_ptr->getTime();
-        m_id = id;
-        m_vnet = vnet;
-        m_vc = vc;
-        m_stage.first = I_;
-        m_stage.second = m_time;
-
-        if(size == 1)
-        {
-                m_type = HEAD_TAIL_;
-                return;
-        }
-        if(id == 0)
-                m_type = HEAD_;
-        else if(id == (size - 1))
-                m_type = TAIL_;
-        else
-                m_type = BODY_;
-}
-
-flit_d::flit_d(int vc, bool is_free_signal)
-{
-        m_id = 0;
-        m_vc = vc;
-        m_is_free_signal = is_free_signal;
-        m_time = g_eventQueue_ptr->getTime();
-}
-/*
-int flit_d::get_size()
-{
-        return m_size;
-}
-Time flit_d::get_enqueue_time()
-{
-        return m_enqueue_time;
-}
-int flit_d::get_id()
-{
-        return m_id;
-}
-Time flit_d::get_time()
-{
-        return m_time;
-}
-void flit_d::set_time(Time time)
-{
-        m_time = time;
-}
-int flit_d::get_vnet()
-{
-        return m_vnet;
-}
-int flit_d::get_vc()
-{
-        return m_vc;
-}
-void flit_d::set_vc(int vc)
-{
-        m_vc = vc;
-}
-MsgPtr& flit_d::get_msg_ptr()
-{
-        return m_msg_ptr;
-}
-flit_type flit_d::get_type()
-{
-        return m_type;
-}
-bool flit_d::is_stage(flit_stage t_stage)
-{
-        return ((m_stage.first == t_stage) && (g_eventQueue_ptr->getTime() >= m_stage.second));
-}
-bool flit_d::is_next_stage(flit_stage t_stage)
-{
-        return ((m_stage.first == t_stage) && ((g_eventQueue_ptr->getTime()+1) >= m_stage.second));
-}
-void flit_d::advance_stage(flit_stage t_stage)
-{
-        m_stage.first = t_stage;
-        m_stage.second = g_eventQueue_ptr->getTime() + 1;
-}
-*/
-void flit_d::print(ostream& out) const
-{
-        out << "[flit:: ";
-        out << "Id=" << m_id << " ";
-        out << "Type=" << m_type << " ";
-        out << "Vnet=" << m_vnet << " ";
-        out << "VC=" << m_vc << " ";
-        out << "Enqueue Time=" << m_enqueue_time << " ";
-        out << "]";
-}
diff --git a/src/mem/ruby/network/garnet-fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet-fixed-pipeline/flit_d.hh
deleted file mode 100644 (file)
index 39f0405..0000000
+++ /dev/null
@@ -1,160 +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 FLIT_D_H
-#define FLIT_D_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/slicc_interface/Message.hh"
-
-class flit_d {
-public:
-        flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr);
-        flit_d(int vc, bool is_free_signal);
-        void set_outport(int port) { m_outport = port; }
-        int get_outport() {return m_outport; }
-        void print(ostream& out) const;
-        bool is_free_signal()
-        {
-                return m_is_free_signal;
-        }
-
-        inline int get_size()
-        {
-                return m_size;
-        }
-        inline Time get_enqueue_time()
-        {
-                return m_enqueue_time;
-        }
-        inline int get_id()
-        {
-                return m_id;
-        }
-        inline Time get_time()
-        {
-                return m_time;
-        }
-        inline void set_time(Time time)
-        {
-                m_time = time;
-        }
-        inline int get_vnet()
-        {
-                return m_vnet;
-        }
-        inline int get_vc()
-        {
-                return m_vc;
-        }
-        inline void set_vc(int vc)
-        {
-                m_vc = vc;
-        }
-        inline MsgPtr& get_msg_ptr()
-        {
-                return m_msg_ptr;
-        }
-        inline flit_type get_type()
-        {
-                return m_type;
-        }
-        inline bool is_stage(flit_stage t_stage)
-        {
-                return ((m_stage.first == t_stage) && (g_eventQueue_ptr->getTime() >= m_stage.second));
-        }
-        inline bool is_next_stage(flit_stage t_stage)
-        {
-                return ((m_stage.first == t_stage) && ((g_eventQueue_ptr->getTime()+1) >= m_stage.second));
-        }
-        inline void advance_stage(flit_stage t_stage)
-        {
-                m_stage.first = t_stage;
-                m_stage.second = g_eventQueue_ptr->getTime() + 1;
-        }
-        inline pair<flit_stage, Time> get_stage()
-        {
-                return m_stage;
-        }
-        inline void set_delay(int delay)
-        {
-                src_delay = delay;
-        }
-
-        inline int get_delay()
-        {
-                return src_delay;
-        }
-
-
-private:
-        /************Data Members*************/
-        int m_id;
-        int m_vnet;
-        int m_vc;
-        int m_size;
-        bool m_is_free_signal;
-        Time m_enqueue_time, m_time;
-        flit_type m_type;
-        MsgPtr m_msg_ptr;
-        int m_outport;
-        int src_delay;
-        pair<flit_stage, Time> m_stage;
-
-};
-
-inline extern bool node_less_then_eq(flit_d* n1, flit_d* n2);
-
-inline extern
-bool node_less_then_eq(flit_d* n1, flit_d* n2)
-{
-  if (n1->get_time() == n2->get_time()) {
-//    ASSERT(n1->flit_id != n2->flit_id);
-    return (n1->get_id() <= n2->get_id());
-  } else {
-    return (n1->get_time() <= n2->get_time());
-  }
-}
-
-// Output operator declaration
-ostream& operator<<(ostream& out, const flit_d& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-extern inline
-ostream& operator<<(ostream& out, const flit_d& obj)
-{
-  obj.print(out);
-  out << flush;
-  return out;
-}
-
-#endif
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 (file)
index 82179ec..0000000
+++ /dev/null
@@ -1,46 +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 FLEXIBLE_CONSUMER_H
-#define FLEXIBLE_CONSUMER_H
-
-#include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/common/NetDest.hh"
-
-class FlexibleConsumer : public Consumer {
-public:
-        virtual bool isBufferNotFull(int vc, int inport) {return true;}
-        virtual void grant_vc(int out_port, int vc, Time grant_time) {}
-        virtual void release_vc(int out_port, int vc, Time release_time) {}
-        virtual void request_vc(int vc, int in_port, NetDest destination, Time request_time) {}
-};
-
-#endif
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 (file)
index d93d8ef..0000000
+++ /dev/null
@@ -1,297 +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/protocol/MachineType.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/NetworkInterface.hh"
-#include "mem/ruby/buffers/MessageBuffer.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/Router.hh"
-#include "mem/ruby/network/simple/Topology.hh"
-#include "mem/ruby/network/simple/SimpleNetwork.hh"
-#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/NetworkLink.hh"
-#include "mem/ruby/common/NetDest.hh"
-
-GarnetNetwork::GarnetNetwork(const string & name)
-  : Network(name)
-{
-}
-
-void GarnetNetwork::init()
-{
-//        printf("hello\n");
-        Network::init(argv);
-//added by SS
-//        assert (m_topology_ptr!=NULL);
-
-        m_network_config_ptr = new NetworkConfig;
-
-        m_network_config_ptr->init(argv);
-
-        m_ruby_start = 0;
-
-        // 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
-        assert (m_topology_ptr!=NULL);
-        m_topology_ptr->makeTopology();
-
-        int number_of_routers = m_topology_ptr->numSwitches();
-        for (int i=0; i<number_of_routers; i++) {
-                m_router_ptr_vector.insertAtBottom(new Router(i, this));
-        }
-
-        for (int i=0; i < m_nodes; i++) {
-                NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks, this);
-                ni->addNode(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
-}
-
-GarnetNetwork::~GarnetNetwork()
-{
-        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();
-        delete m_topology_ptr;
-}
-
-void GarnetNetwork::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();
-                }
-        }
-}
-
-void GarnetNetwork::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 *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
-                m_router_ptr_vector[dest]->addInPort(net_link);
-                m_ni_ptr_vector[src]->addOutPort(net_link);
-        }
-        else
-        {
-                ERROR_MSG("Fatal Error:: Reconfiguration not allowed here");
-                // do nothing
-        }
-}
-
-void GarnetNetwork::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 *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
-                m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight);
-                m_ni_ptr_vector[dest]->addInPort(net_link);
-        }
-        else
-        {
-                ERROR_MSG("Fatal Error:: Reconfiguration not allowed here");
-                //do nothing
-        }
-}
-
-void GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration)
-{
-        if(!isReconfiguration)
-        {
-                NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
-                m_router_ptr_vector[dest]->addInPort(net_link);
-                m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight);
-        }
-        else
-        {
-                ERROR_MSG("Fatal Error:: Reconfiguration not allowed here");
-                // do nothing
-        }
-
-}
-
-void GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num)
-{
-        printf ("id = %i, m_nodes = %i \n", id, m_nodes);
-        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::getToNetQueue(NodeID id, bool ordered, int network_num)
-{
-        checkNetworkAllocation(id, ordered, network_num);
-        return m_toNetQueues[id][network_num];
-}
-
-MessageBuffer* GarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num)
-{
-        checkNetworkAllocation(id, ordered, network_num);
-        return m_fromNetQueues[id][network_num];
-}
-
-void GarnetNetwork::clearStats()
-{
-        m_ruby_start = g_eventQueue_ptr->getTime();
-}
-
-Time GarnetNetwork::getRubyStartTime()
-{
-        return m_ruby_start;
-}
-
-void GarnetNetwork::printStats(ostream& out) const
-{       double average_link_utilization = 0;
-        Vector<double > 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 += m_link_ptr_vector[i]->getLinkUtilization();
-                Vector<int > 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;
-}
-
-void GarnetNetwork::printConfig(ostream& out) const
-{
-        out << endl;
-        out << "Network Configuration" << endl;
-        out << "---------------------" << endl;
-        out << "network: GARNET_NETWORK" << endl;
-        out << "topology: " << m_topology_ptr->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::print(ostream& out) const
-{
-        out << "[GarnetNetwork]";
-}
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 (file)
index fbebcc7..0000000
+++ /dev/null
@@ -1,120 +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 GARNET_NETWORK_H
-#define GARNET_NETWORK_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;
-class MessageBuffer;
-class Router;
-class Topology;
-class NetDest;
-class NetworkLink;
-
-class GarnetNetwork : public Network{
-public:
-        GarnetNetwork(const string & name);
-
-        ~GarnetNetwork();
-
-        void init();
-
-        //added by SS
-        NetworkConfig* getNetworkConfig() { return m_network_config_ptr; }
-
-        // 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;
-
-        bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
-        bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
-
-        Time getRubyStartTime();
-        int getNumNodes(){ return m_nodes; }
-
-        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:
-        void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
-
-// Private copy constructor and assignment operator
-        GarnetNetwork(const GarnetNetwork& obj);
-        GarnetNetwork& operator=(const GarnetNetwork& obj);
-
-
-/***********Data Members*************/
-//      int m_virtual_networks;
-//      int m_nodes;
-
-        Vector<bool> m_in_use;
-        Vector<bool> m_ordered;
-
-        Vector<Vector<MessageBuffer*> > m_toNetQueues;
-        Vector<Vector<MessageBuffer*> > m_fromNetQueues;
-
-        Vector<Router *> m_router_ptr_vector;   // All Routers in Network
-        Vector<NetworkLink *> m_link_ptr_vector; // All links in the network
-        Vector<NetworkInterface *> m_ni_ptr_vector;     // All NI's in Network
-
-//      Topology* m_topology_ptr;
-        Time m_ruby_start;
-
-        NetworkConfig* m_network_config_ptr;
-};
-
-// Output operator declaration
-ostream& operator<<(ostream& out, const GarnetNetwork& obj);
-
-// ******************* Definitions *******************
-// Output operator definition
-extern inline
-ostream& operator<<(ostream& out, const GarnetNetwork& obj)
-{
-        obj.print(out);
-        out << flush;
-        return out;
-}
-
-#endif //NETWORK_H
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 (file)
index 7fdff46..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#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, Time 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, Time time)
-{
-        m_vc_state = state;
-        m_time = time;
-}
-
-void InVcState::grant_vc(int out_vc, Time 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 (file)
index 67ff6b4..0000000
+++ /dev/null
@@ -1,55 +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 IN_VC_STATE_H
-#define IN_VC_STATE_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-
-class InVcState {
-public:
-        InVcState(int id);
-
-        void setRoute(int route);
-        void setState(VC_state_type state, Time time);
-        int get_outport();
-        int get_outvc();
-        void grant_vc(int out_vc, Time grant_time);
-        bool isInState(VC_state_type state, Time time);
-
-private:
-        int m_id;
-        int m_route;
-        int m_output_vc;
-        VC_state_type m_vc_state;
-        Time m_time;
-};
-
-#endif
diff --git a/src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh b/src/mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh
deleted file mode 100644 (file)
index b23e9a8..0000000
+++ /dev/null
@@ -1,73 +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
- */
-
-/*
- * This header file is used to define all configuration parameters
- * required by the interconnection network.
- */
-
-#ifndef NETWORKCONFIG_H
-#define NETWORKCONFIG_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/gems_common/util.hh"
-
-class NetworkConfig {
-        private:
-                int m_flit_size;
-                int m_number_of_pipe_stages;
-                int m_vcs_per_class;
-                int m_buffer_size;
-                bool m_using_network_testing;
-        public:
-                NetworkConfig(){}
-                void init() {
-                  for (size_t i=0; i<argv.size(); i+=2) {
-                   if (argv[i] == "flit_size")
-                     m_flit_size = atoi(argv[i+1].c_str());
-                   else if (argv[i] == "number_of_pipe_stages")
-                     m_number_of_pipe_stages = atoi(argv[i+1].c_str());
-                   else if (argv[i] == "vcs_per_class")
-                     m_vcs_per_class = atoi(argv[i+1].c_str());
-                   else if (argv[i] == "buffer_size")
-                     m_buffer_size = atoi(argv[i+1].c_str());
-                   else if (argv[i] == "using_network_testing")
-                     m_using_network_testing = atoi(argv[i+1].c_str());
-                  }
-                }
-                bool isNetworkTesting() {return m_using_network_testing; }
-                int getFlitSize() {return m_flit_size; }
-                int getNumPipeStages() {return m_number_of_pipe_stages; }
-                int getVCsPerClass() {return m_vcs_per_class; }
-                int getBufferSize() {return m_buffer_size; }
-};
-
-
-#endif
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 (file)
index 4af5b29..0000000
+++ /dev/null
@@ -1,301 +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/NetworkInterface.hh"
-#include "mem/ruby/buffers/MessageBuffer.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/flitBuffer.hh"
-#include "mem/ruby/slicc_interface/NetworkMessage.hh"
-
-NetworkInterface::NetworkInterface(int id, int virtual_networks, GarnetNetwork *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);
-        inNode_ptr.setSize(m_virtual_networks);
-        outNode_ptr.setSize(m_virtual_networks);
-
-        for(int i =0; i < m_num_vcs; i++)
-                m_ni_buffers[i] = new flitBuffer(); // instantiating the NI flit buffers
-
-         m_vc_allocator.setSize(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.insertAtBottom(new OutVcState(i));
-                m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
-         }
-}
-
-NetworkInterface::~NetworkInterface()
-{
-        m_out_vc_state.deletePointers();
-        m_ni_buffers.deletePointers();
-        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<MessageBuffer*>& in,  Vector<MessageBuffer*>& 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
-        }
-}
-
-void NetworkInterface::request_vc(int in_vc, int in_port, NetDest destination, Time request_time)
-{
-        inNetLink->grant_vc_link(in_vc, request_time);
-}
-
-bool NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
-{
-        NetworkMessage *net_msg_ptr = dynamic_cast<NetworkMessage*>(msg_ptr.ref());
-        NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
-        Vector<NodeID> 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)
-                {
-                        // did not find a free output vc
-                        return false ;
-                }
-                MsgPtr new_msg_ptr = *(msg_ptr.ref());
-                NodeID destID = dest_nodes[ctr];
-
-                NetworkMessage *new_net_msg_ptr = dynamic_cast<NetworkMessage*>(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++)
-                {
-                        flit *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr);
-                        m_ni_buffers[vc]->insert(fl);
-                }
-
-                m_out_vc_state[vc]->setState(VC_AB_, g_eventQueue_ptr->getTime());
-                outNetLink->request_vc_link(vc, new_net_msg_ptr->getInternalDestination(), g_eventQueue_ptr->getTime()); // setting an output vc request for the next hop. It is only when an output vc is acquired at the next hop that this flit will be ready to traverse the link and into the next hop
-        }
-
-        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, Time grant_time)
-{
-
-        assert(m_out_vc_state[vc]->isInState(VC_AB_, grant_time));
-        m_out_vc_state[vc]->grant_vc(grant_time);
-        g_eventQueue_ptr->scheduleEvent(this, 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, Time release_time)
-{
-        assert(m_out_vc_state[vc]->isInState(ACTIVE_, release_time));
-        m_out_vc_state[vc]->setState(IDLE_, release_time);
-        g_eventQueue_ptr->scheduleEvent(this, 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_, 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.
- */
-
-void NetworkInterface::wakeup()
-{
-        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 *t_flit = inNetLink->consumeLink();
-                if(t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_)
-                {
-                        DEBUG_EXPR(NETWORK_COMP, HighPrio, m_id);
-                        DEBUG_MSG(NETWORK_COMP, HighPrio, "Message got delivered");
-                        DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
-                        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
-                        }
-                        inNetLink->release_vc_link(t_flit->get_vc(), g_eventQueue_ptr->getTime() + 1); // signal the upstream router that this vc can be freed now
-                }
-                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::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())
-                {
-                        if(m_out_vc_state[vc]->isInState(ACTIVE_, g_eventQueue_ptr->getTime()) && outNetLink->isBufferNotFull_link(vc))  // models buffer backpressure
-                        {
-                                flit *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
-                                return;
-                        }
-                }
-        }
-}
-
-void NetworkInterface::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::printConfig(ostream& out) const
-{
-        out << "[Network Interface " << m_id << "] - ";
-        out << "[inLink " << inNetLink->get_id() << "] - ";
-        out << "[outLink " << outNetLink->get_id() << "]" << endl;
-}
-
-void NetworkInterface::print(ostream& out) const
-{
-        out << "[Network Interface]";
-}
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 (file)
index 8444658..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#ifndef NET_INTERFACE_H
-#define NET_INTERFACE_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh"
-#include "mem/gems_common/Vector.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/FlexibleConsumer.hh"
-#include "mem/ruby/slicc_interface/Message.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/NetworkLink.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/OutVcState.hh"
-
-class NetworkMessage;
-class MessageBuffer;
-class flitBuffer;
-
-class NetworkInterface : public FlexibleConsumer {
-public:
-        NetworkInterface(int id, int virtual_networks, GarnetNetwork* network_ptr);
-
-        ~NetworkInterface();
-
-        void addInPort(NetworkLink *in_link);
-        void addOutPort(NetworkLink *out_link);
-
-        void wakeup();
-        void addNode(Vector<MessageBuffer *> &inNode, Vector<MessageBuffer *> &outNode);
-        void grant_vc(int out_port, int vc, Time grant_time);
-        void release_vc(int out_port, int vc, Time release_time);
-        bool isBufferNotFull(int vc, int inport)
-        {
-                return true;
-        }
-        void request_vc(int in_vc, int in_port, NetDest destination, Time request_time);
-
-        void printConfig(ostream& out) const;
-        void print(ostream& out) const;
-
-private:
-/**************Data Members*************/
-        GarnetNetwork *m_net_ptr;
-        int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
-        NodeID m_id;
-
-        Vector<OutVcState *> m_out_vc_state;
-        Vector<int > 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
-        Vector<flitBuffer *>   m_ni_buffers; // The flit buffers which will serve the Consumer
-
-        Vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
-        Vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
-
-        bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
-        int calculateVC(int vnet);
-        void scheduleOutputLink();
-        void checkReschedule();
-};
-
-#endif
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 (file)
index 598c9e2..0000000
+++ /dev/null
@@ -1,142 +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/NetworkLink.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh"
-
-NetworkLink::NetworkLink(int id, int latency, GarnetNetwork *net_ptr)
-{
-        m_id = id;
-        linkBuffer = new flitBuffer();
-        m_in_port = 0;
-        m_out_port = 0;
-        m_link_utilized = 0;
-        m_net_ptr = net_ptr;
-        m_latency = latency;
-        int num_net = net_ptr->getNumberOfVirtualNetworks();
-        int num_vc = m_net_ptr->getNetworkConfig()->getVCsPerClass();
-        m_vc_load.setSize(num_net*num_vc);
-
-        for(int i = 0; i < num_net*num_vc; i++)
-                m_vc_load[i] = 0;
-}
-
-NetworkLink::~NetworkLink()
-{
-        delete linkBuffer;
-}
-
-int NetworkLink::get_id()
-{
-        return m_id;
-}
-
-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, Time 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, Time grant_time)
-{
-        link_source->grant_vc(m_out_port, vc, grant_time);
-}
-
-void NetworkLink::release_vc_link(int vc, Time release_time)
-{
-        link_source->release_vc(m_out_port, vc, release_time);
-}
-
-Vector<int> NetworkLink::getVcLoad()
-{
-        return m_vc_load;
-}
-
-double NetworkLink::getLinkUtilization()
-{
-        Time m_ruby_start = m_net_ptr->getRubyStartTime();
-        return (double(m_link_utilized)) / (double(g_eventQueue_ptr->getTime()-m_ruby_start));
-}
-
-bool NetworkLink::isReady()
-{
-        return linkBuffer->isReady();
-}
-
-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())
-        {
-                flit *t_flit = link_srcQueue->getTopFlit();
-                t_flit->set_time(g_eventQueue_ptr->getTime() + m_latency);
-                linkBuffer->insert(t_flit);
-                g_eventQueue_ptr->scheduleEvent(link_consumer, m_latency);
-                m_link_utilized++;
-                m_vc_load[t_flit->get_vc()]++;
-        }
-}
-
-flit* NetworkLink::peekLink()
-{
-        return linkBuffer->peekTopFlit();
-}
-
-flit* NetworkLink::consumeLink()
-{
-        return linkBuffer->getTopFlit();
-}
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 (file)
index 9f5640a..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2008 Princeton University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Niket Agarwal
- */
-
-#ifndef NETWORK_LINK_H
-#define NETWORK_LINK_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/FlexibleConsumer.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/flitBuffer.hh"
-#include "mem/gems_common/PrioHeap.hh"
-#include "mem/ruby/common/NetDest.hh"
-
-class GarnetNetwork;
-
-class NetworkLink : public FlexibleConsumer {
-public:
-        NetworkLink();
-        NetworkLink(int id, int latency, GarnetNetwork *net_ptr);
-        ~NetworkLink();
-
-        void setLinkConsumer(FlexibleConsumer *consumer);
-        void setSourceQueue(flitBuffer *srcQueue);
-        flit* peekLink();
-        flit* consumeLink();
-
-        void print(ostream& out) const {}
-
-        bool is_vc_ready(flit *t_flit);
-
-        int get_id();
-        void setInPort(int port);
-        void setOutPort(int port);
-        void wakeup();
-        bool isReady();
-        void grant_vc_link(int vc, Time grant_time);
-        void release_vc_link(int vc, Time release_time);
-        void request_vc_link(int vc, NetDest destination, Time request_time);
-        bool isBufferNotFull_link(int vc);
-        void setSource(FlexibleConsumer *source);
-        double getLinkUtilization();
-        Vector<int> getVcLoad();
-
-protected:
-        int m_id, m_latency;
-        int m_in_port, m_out_port;
-        int m_link_utilized;
-        Vector<int > m_vc_load;
-        GarnetNetwork *m_net_ptr;
-
-        flitBuffer *linkBuffer;
-        FlexibleConsumer *link_consumer;
-        FlexibleConsumer *link_source;
-        flitBuffer *link_srcQueue;
-};
-
-#endif
-
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 (file)
index a00dd19..0000000
+++ /dev/null
@@ -1,55 +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_id = id;
-        m_vc_state = IDLE_;
-}
-
-bool OutVcState::isInState(VC_state_type state, Time request_time)
-{
-        return ((m_vc_state == state) && (request_time >= m_time) );
-}
-
-void OutVcState::grant_vc(Time grant_time)
-{
-        m_time = grant_time;
-        m_vc_state = ACTIVE_;
-}
-
-void OutVcState::setState(VC_state_type state, Time 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 (file)
index ba68bf2..0000000
+++ /dev/null
@@ -1,50 +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 OUT_VC_STATE_H
-#define OUT_VC_STATE_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-
-class OutVcState {
-public:
-        OutVcState(int id);
-
-        bool isInState(VC_state_type state, Time request_time);
-        void setState(VC_state_type state, Time time);
-        void grant_vc(Time grant_time);
-
-private:
-        int m_id ;
-        Time m_time;
-        VC_state_type m_vc_state;
-};
-
-#endif
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 (file)
index 628f193..0000000
+++ /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 "mem/ruby/network/garnet-flexible-pipeline/Router.hh"
-#include "mem/ruby/slicc_interface/NetworkMessage.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/VCarbiter.hh"
-
-Router::Router(int id, GarnetNetwork *network_ptr)
-{
-        m_id = id;
-        m_net_ptr = network_ptr;
-        m_virtual_networks = m_net_ptr->getNumberOfVirtualNetworks();
-        m_vc_per_vnet = m_net_ptr->getNetworkConfig()->getVCsPerClass();
-        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++)
-        {
-                m_in_vc_state[i].deletePointers();
-        }
-        for (int i = 0; i < m_out_link.size(); i++)
-        {
-                m_out_vc_state[i].deletePointers();
-                m_router_buffers[i].deletePointers();
-        }
-        m_out_src_queue.deletePointers();
-        delete m_vc_arbiter;
-
-}
-
-void Router::addInPort(NetworkLink *in_link)
-{
-        int port = m_in_link.size();
-        Vector<InVcState *> in_vc_vector;
-        for(int i = 0; i < m_num_vcs; i++)
-        {
-                in_vc_vector.insertAtBottom(new InVcState(i));
-                in_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
-        }
-        m_in_vc_state.insertAtBottom(in_vc_vector);
-        m_in_link.insertAtBottom(in_link);
-        in_link->setLinkConsumer(this);
-        in_link->setInPort(port);
-
-        int start = 0;
-        m_round_robin_invc.insertAtBottom(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.insertAtBottom(start);
-
-        m_out_src_queue.insertAtBottom(new flitBuffer());
-
-        m_out_link.insertAtBottom(out_link);
-        m_routing_table.insertAtBottom(routing_table_entry);
-        out_link->setSourceQueue(m_out_src_queue[port]);
-        out_link->setSource(this);
-
-        Vector<flitBuffer *> intermediateQueues;
-        for(int i = 0; i < m_num_vcs; i++)
-        {
-                intermediateQueues.insertAtBottom(new flitBuffer(m_net_ptr->getNetworkConfig()->getBufferSize()));
-        }
-        m_router_buffers.insertAtBottom(intermediateQueues);
-
-        Vector<OutVcState *> out_vc_vector;
-        for(int i = 0; i < m_num_vcs; i++)
-        {
-                out_vc_vector.insertAtBottom(new OutVcState(i));
-                out_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
-        }
-        m_out_vc_state.insertAtBottom(out_vc_vector);
-        m_link_weights.insertAtBottom(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, Time 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 >= g_eventQueue_ptr->getTime());
-        if(request_time > g_eventQueue_ptr->getTime())
-                g_eventQueue_ptr->scheduleEventAbsolute(m_vc_arbiter, 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]++;
-
-                if(m_round_robin_invc[inport] >= m_num_vcs)
-                        m_round_robin_invc[inport] = 0;
-                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_, g_eventQueue_ptr->getTime()))
-                        {
-                                int outport = in_vc_state->get_outport();
-                                Vector<int > 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_, g_eventQueue_ptr->getTime()))
-                                        {
-                                                in_vc_state->grant_vc(valid_vcs[valid_vc_iter], g_eventQueue_ptr->getTime());
-                                                m_in_link[inport]->grant_vc_link(invc, g_eventQueue_ptr->getTime());
-                                                m_out_vc_state[outport][valid_vcs[valid_vc_iter]]->setState(VC_AB_, g_eventQueue_ptr->getTime());
-                                                break;
-                                        }
-                                }
-                        }
-                }
-        }
-}
-
-Vector<int > Router::get_valid_vcs(int invc)
-{
-        Vector<int > 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.insertAtBottom(base+offset);
-                        }
-                        break;
-                }
-        }
-        return vc_list;
-}
-
-void Router::grant_vc(int out_port, int vc, Time 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);
-        g_eventQueue_ptr->scheduleEvent(this, 1);
-}
-
-void Router::release_vc(int out_port, int vc, Time 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);
-        g_eventQueue_ptr->scheduleEvent(this, 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->getNetworkConfig()->getNumPipeStages() >= 1);
-        m_flit->set_time(g_eventQueue_ptr->getTime() + (m_net_ptr->getNetworkConfig()->getNumPipeStages() - 1)); // Becasuse 1 cycle will be consumed in scheduling the output link
-        m_flit->set_vc(outvc);
-        m_router_buffers[outport][outvc]->insert(m_flit);
-
-        if(m_net_ptr->getNetworkConfig()->getNumPipeStages() > 1)
-                g_eventQueue_ptr->scheduleEvent(this, m_net_ptr->getNetworkConfig()->getNumPipeStages() -1 );
-        if((m_flit->get_type() == HEAD_) || (m_flit->get_type() == HEAD_TAIL_))
-        {
-                NetDest destination = dynamic_cast<NetworkMessage*>(m_flit->get_msg_ptr().ref())->getInternalDestination();
-                if(m_net_ptr->getNetworkConfig()->getNumPipeStages() > 1)
-                {
-                        m_out_vc_state[outport][outvc]->setState(VC_AB_, g_eventQueue_ptr->getTime() + 1);
-                        m_out_link[outport]->request_vc_link(outvc, destination, g_eventQueue_ptr->getTime() + 1);
-                }
-                else
-                {
-                        m_out_vc_state[outport][outvc]->setState(VC_AB_, g_eventQueue_ptr->getTime());
-                        m_out_link[outport]->request_vc_link(outvc, destination, g_eventQueue_ptr->getTime());
-                }
-        }
-        if((m_flit->get_type() == TAIL_) || (m_flit->get_type() == HEAD_TAIL_))
-        {
-                m_in_vc_state[inport][invc]->setState(IDLE_, g_eventQueue_ptr->getTime() + 1);
-                m_in_link[inport]->release_vc_link(invc, g_eventQueue_ptr->getTime() + 1);
-        }
-}
-
-void Router::wakeup()
-{
-        flit *t_flit;
-
-        int incoming_port = m_round_robin_start; // This is for round-robin scheduling of incoming ports
-        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;
-                if(m_in_link[incoming_port]->isReady()) // checking the incoming link
-                {
-                        DEBUG_EXPR(NETWORK_COMP, HighPrio, m_id);
-                        DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
-                        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]++;
-                if(m_vc_round_robin[port] == m_num_vcs)
-                        m_vc_round_robin[port] = 0;
-
-                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())
-                        {
-                                if(m_out_vc_state[port][vc_tolookat]->isInState(ACTIVE_, g_eventQueue_ptr->getTime()) && m_out_link[port]->isBufferNotFull_link(vc_tolookat))
-                                // models buffer backpressure
-                                {
-                                        flit *t_flit = m_router_buffers[port][vc_tolookat]->getTopFlit();
-                                        t_flit->set_time(g_eventQueue_ptr->getTime() + 1 );
-                                        m_out_src_queue[port]->insert(t_flit);
-                                        g_eventQueue_ptr->scheduleEvent(m_out_link[port], 1);
-                                        break; // done for this port
-                                }
-                        }
-                }
-        }
-}
-
-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]->isReadyForNext())
-                        {
-                                g_eventQueue_ptr->scheduleEvent(this, 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_, g_eventQueue_ptr->getTime() + 1))
-                        {
-                                g_eventQueue_ptr->scheduleEvent(m_vc_arbiter, 1);
-                                return;
-                        }
-                }
-        }
-}
-
-void Router::printConfig(ostream& out) const
-{
-        out << "[Router " << m_id << "] :: " << endl;
-        out << "[inLink - ";
-        for(int i = 0;i < m_in_link.size(); i++)
-                out << m_in_link[i]->get_id() << " - ";
-        out << "]" << endl;
-        out << "[outLink - ";
-        for(int i = 0;i < m_out_link.size(); i++)
-                out << m_out_link[i]->get_id() << " - ";
-        out << "]" << endl;
-/*      out << "---------- routing table -------------" << endl;
-        for(int i =0; i < m_routing_table.size(); i++)
-                out << m_routing_table[i] << endl;
-*/
-}
-
-void Router::print(ostream& out) const
-{
-        out << "[Router]";
-}
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 (file)
index 69d405a..0000000
+++ /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
- */
-
-#ifndef ROUTER_H
-#define ROUTER_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/FlexibleConsumer.hh"
-#include "mem/gems_common/PrioHeap.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/NetworkLink.hh"
-#include "mem/ruby/common/NetDest.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/flitBuffer.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/InVcState.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/OutVcState.hh"
-
-class VCarbiter;
-
-class Router : public FlexibleConsumer {
-public:
-        Router(int id, GarnetNetwork *network_ptr);
-
-        ~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, Time request_time);
-        bool isBufferNotFull(int vc, int inport);
-        void grant_vc(int out_port, int vc, Time grant_time);
-        void release_vc(int out_port, int vc, Time release_time);
-        void vc_arbitrate();
-
-        void printConfig(ostream& out) const;
-        void print(ostream& out) const;
-
-private:
-/***************Data Members******************/
-        int m_id;
-        int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
-        GarnetNetwork *m_net_ptr;
-        Vector<int > m_vc_round_robin; // For scheduling of out source queues
-        int m_round_robin_inport, m_round_robin_start; // for vc arbitration
-        Vector<int > m_round_robin_invc; // For every outport. for vc arbitration
-
-        Vector<Vector<flitBuffer *> > m_router_buffers; // These are essentially output buffers
-        Vector<flitBuffer *> m_out_src_queue; // These are source queues for the output link
-        Vector<NetworkLink *> m_in_link;
-        Vector<NetworkLink *> m_out_link;
-        Vector<Vector<InVcState * > > m_in_vc_state;
-        Vector<Vector<OutVcState * > > m_out_vc_state;
-        Vector<NetDest> m_routing_table;
-        Vector<int > m_link_weights;
-        VCarbiter *m_vc_arbiter;
-
-/*********** Private methods *************/
-        int getRoute(NetDest destination);
-        Vector<int > get_valid_vcs(int invc);
-        void routeCompute(flit *m_flit, int inport);
-        void checkReschedule();
-        void check_arbiter_reschedule();
-        void scheduleOutputLinks();
-};
-
-#endif
-
diff --git a/src/mem/ruby/network/garnet-flexible-pipeline/SConscript b/src/mem/ruby/network/garnet-flexible-pipeline/SConscript
deleted file mode 100644 (file)
index e132741..0000000
+++ /dev/null
@@ -1,47 +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('*')
-
-# temporarily disable
-Return()
-
-if not env['RUBY']:
-    Return()
-
-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 (file)
index 9064cc4..0000000
+++ /dev/null
@@ -1,42 +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/VCarbiter.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/Router.hh"
-
-VCarbiter::VCarbiter(Router *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 (file)
index 7f7e5e8..0000000
+++ /dev/null
@@ -1,51 +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 VC_ARBITER_H
-#define VC_ARBITER_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/ruby/common/Consumer.hh"
-
-class Router;
-
-class VCarbiter : public Consumer{
-public:
-        VCarbiter(Router *router);
-        ~VCarbiter() {}
-
-        void print(ostream& out) const {}
-        void wakeup();
-
-private:
-        Router *m_router;
-};
-
-#endif
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 (file)
index 5497263..0000000
+++ /dev/null
@@ -1,108 +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)
-{
-        m_size = size;
-        m_msg_ptr = msg_ptr;
-        m_enqueue_time = g_eventQueue_ptr->getTime();
-        m_time = g_eventQueue_ptr->getTime();
-        m_id = id;
-        m_vnet = vnet;
-        m_vc = vc;
-
-        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_;
-}
-
-int flit::get_size()
-{
-        return m_size;
-}
-int flit::get_id()
-{
-        return m_id;
-}
-Time flit::get_time()
-{
-        return m_time;
-}
-
-Time flit::get_enqueue_time()
-{
-        return m_enqueue_time;
-}
-void flit::set_time(Time time)
-{
-        m_time = time;
-}
-
-int flit::get_vnet()
-{
-        return m_vnet;
-}
-int flit::get_vc()
-{
-        return m_vc;
-}
-void flit::set_vc(int vc)
-{
-        m_vc = vc;
-}
-MsgPtr& flit::get_msg_ptr()
-{
-        return m_msg_ptr;
-}
-flit_type flit::get_type()
-{
-        return m_type;
-}
-
-void flit::print(ostream& out) const
-{
-        out << "[flit:: ";
-        out << "Id=" << m_id << " ";
-        out << "Type=" << m_type << " ";
-        out << "Vnet=" << m_vnet << " ";
-        out << "VC=" << m_vc << " ";
-        out << "Enqueue Time=" << m_enqueue_time << " ";
-        out << "]";
-}
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 (file)
index a2e6284..0000000
+++ /dev/null
@@ -1,92 +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/NetworkHeader.hh"
-#include "mem/ruby/slicc_interface/Message.hh"
-
-#ifndef FLIT_H
-#define FLIT_H
-
-class flit {
-public:
-        flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr);
-
-        int get_size();
-        int get_id();
-        Time get_time();
-        Time get_enqueue_time();
-        void set_time(Time time);
-        int get_vnet();
-        int get_vc();
-        void set_vc(int vc);
-        MsgPtr& get_msg_ptr();
-        flit_type get_type();
-        void print(ostream&out) const;
-
-private:
-/************Data Members*************/
-        int m_id;
-        int m_vnet;
-        int m_vc;
-        int m_size;
-        Time m_enqueue_time, m_time;
-        flit_type m_type;
-        MsgPtr m_msg_ptr;
-
-};
-
-inline extern bool node_less_then_eq(flit* n1, flit* n2);
-
-inline extern
-bool node_less_then_eq(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());
-  }
-}
-
-// Output operator declaration
-ostream& operator<<(ostream& out, const flit& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-extern inline
-ostream& operator<<(ostream& out, const flit& obj)
-{
-  obj.print(out);
-  out << flush;
-  return out;
-}
-
-#endif
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 (file)
index c68f8c7..0000000
+++ /dev/null
@@ -1,99 +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/flitBuffer.hh"
-
-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()
-{
-        if(m_buffer.size() != 0 )
-        {
-                flit *t_flit = m_buffer.peekMin();
-                if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
-                        return true;
-        }
-        return false;
-}
-
-bool flitBuffer::isReadyForNext()
-{
-        if(m_buffer.size() != 0 )
-        {
-                flit *t_flit = m_buffer.peekMin();
-                if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
-                        return true;
-        }
-        return false;
-}
-
-bool flitBuffer::isFull()
-{
-        return (m_buffer.size() >= max_size);
-}
-
-void flitBuffer::setMaxSize(int maximum)
-{
-        max_size = maximum;
-}
-
-flit* flitBuffer:: getTopFlit()
-{
-        return m_buffer.extractMin();
-}
-
-flit* flitBuffer::peekTopFlit()
-{
-        return m_buffer.peekMin();
-}
-
-void flitBuffer::insert(flit *flt)
-{
-        m_buffer.insert(flt);
-}
-
-void flitBuffer::print(ostream& out) const
-{
-        out << "[flitBuffer: ";
-        out << m_buffer.size() << "] " << endl;
-}
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 (file)
index c722e16..0000000
+++ /dev/null
@@ -1,73 +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 FLIT_BUFFER_H
-#define FLIT_BUFFER_H
-
-#include "mem/ruby/network/garnet-fixed-pipeline/NetworkHeader.hh"
-#include "mem/gems_common/PrioHeap.hh"
-#include "mem/ruby/network/garnet-flexible-pipeline/flit.hh"
-
-class flitBuffer {
-public:
-        flitBuffer();
-        flitBuffer(int maximum_size);
-
-        bool isReady();
-        bool isReadyForNext();
-        bool isFull();
-        bool isEmpty();
-        void setMaxSize(int maximum);
-        flit *getTopFlit();
-        flit *peekTopFlit();
-        void insert(flit *flt);
-        void print(ostream& out) const;
-
-/**********Data Members*********/
-private:
-        PrioHeap <flit *> m_buffer;
-        int size, max_size;
-};
-
-ostream& operator<<(ostream& out, const flitBuffer& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-extern inline
-ostream& operator<<(ostream& out, const flitBuffer& obj)
-{
-  obj.print(out);
-  out << flush;
-  return out;
-}
-
-#endif
-
diff --git a/src/mem/ruby/network/garnet-flexible-pipeline/netconfig.defaults b/src/mem/ruby/network/garnet-flexible-pipeline/netconfig.defaults
deleted file mode 100644 (file)
index e60f192..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// Note: You should set Garnet's parameters in config/rubyconfig.defaults and not here
-g_GARNET_NETWORK:true
-g_DETAIL_NETWORK:true
-g_NETWORK_TESTING:false
-g_FLIT_SIZE:16
-g_NUM_PIPE_STAGES:4
-g_VCS_PER_CLASS:4
-g_BUFFER_SIZE:4
diff --git a/src/mem/ruby/network/garnet/NetworkHeader.hh b/src/mem/ruby/network/garnet/NetworkHeader.hh
new file mode 100644 (file)
index 0000000..62ed9a1
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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/CreditLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh
new file mode 100644 (file)
index 0000000..eda87da
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..11a34c0
--- /dev/null
@@ -0,0 +1,350 @@
+/*
+ * 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; i<number_of_routers; i++) {
+                m_router_ptr_vector.insertAtBottom(new Router_d(i, this));
+        }
+
+        for (int i=0; i < m_nodes; i++) {
+                NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks, this);
+                ni->addNode(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<double > 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<int > 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 " <<endl;
+        out << "-------------" << endl;
+}
+
+void GarnetNetwork_d::printConfig(ostream& out) const
+{
+        out << endl;
+        out << "Network Configuration" << endl;
+        out << "---------------------" << endl;
+        out << "network: GarnetNetwork_d" << endl;
+        out << "topology: " << m_topology_ptr->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
new file mode 100644 (file)
index 0000000..ccd3e37
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * 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/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<bool> m_in_use;
+        Vector<bool> m_ordered;
+
+        Vector<Vector<MessageBuffer*> > m_toNetQueues;
+        Vector<Vector<MessageBuffer*> > m_fromNetQueues;
+
+        Vector<Router_d *> m_router_ptr_vector;   // All Routers in Network
+        Vector<NetworkLink_d *> m_link_ptr_vector; // All links in the network
+        Vector<CreditLink_d *> m_creditlink_ptr_vector; // All links in the network
+        Vector<NetworkInterface_d *> 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
new file mode 100644 (file)
index 0000000..ce7a015
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..bca7b10
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * 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/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<VirtualChannel_d *> m_vcs; // [vc]
+};
+
+#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
new file mode 100644 (file)
index 0000000..4ba885f
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ * 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<MessageBuffer*>& in,  Vector<MessageBuffer*>& 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<NetworkMessage*>(msg_ptr.ref());
+        NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
+        Vector<NodeID> 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<NetworkMessage*>(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
new file mode 100644 (file)
index 0000000..1ca4a7a
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * 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/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<MessageBuffer *> &inNode, Vector<MessageBuffer *> &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<OutVcState_d *> m_out_vc_state;
+        Vector<int > 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<flitBuffer_d *>   m_ni_buffers; // The flit buffers which will serve the Consumer
+        Vector<Time > m_ni_enqueue_time;
+
+        Vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
+        Vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
+
+        bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
+        int calculateVC(int vnet);
+        void scheduleOutputLink();
+        void checkReschedule();
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
new file mode 100644 (file)
index 0000000..2294970
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * 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/NetworkLink_d.hh"
+#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
+
+/*
+NetworkLink_d::NetworkLink_d(int id)
+{
+        m_id = id;
+        m_latency = 1;
+        m_flit_width = NetworkConfig::getFlitSize();
+
+        linkBuffer = new flitBuffer_d();
+        m_link_utilized = 0;
+        m_vc_load.setSize(NetworkConfig::getVCsPerClass()*RubySystem::getNetwork()->getNumberOfVirtualNetworks());
+
+        for(int i = 0; i < NetworkConfig::getVCsPerClass()*RubySystem::getNetwork()->getNumberOfVirtualNetworks(); i++)
+                m_vc_load[i] = 0;
+}
+*/
+NetworkLink_d::NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr)
+{
+        m_net_ptr = net_ptr;
+        m_id = id;
+        m_latency = link_latency;
+        linkBuffer = new flitBuffer_d();
+        m_link_utilized = 0;
+        m_vc_load.setSize(m_net_ptr->getNetworkConfig()->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks());
+
+        for(int i = 0; i < m_net_ptr->getNetworkConfig()->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks(); i++)
+                m_vc_load[i] = 0;
+}
+
+NetworkLink_d::~NetworkLink_d()
+{
+        delete linkBuffer;
+}
+
+void NetworkLink_d::setLinkConsumer(Consumer *consumer)
+{
+        link_consumer = consumer;
+}
+
+void NetworkLink_d::setSourceQueue(flitBuffer_d *srcQueue)
+{
+        link_srcQueue = srcQueue;
+}
+
+void NetworkLink_d::wakeup()
+{
+        if(link_srcQueue->isReady())
+        {
+                flit_d *t_flit = link_srcQueue->getTopFlit();
+                t_flit->set_time(g_eventQueue_ptr->getTime() + m_latency);
+                linkBuffer->insert(t_flit);
+                g_eventQueue_ptr->scheduleEvent(link_consumer, m_latency);
+                m_link_utilized++;
+                m_vc_load[t_flit->get_vc()]++;
+        }
+}
+
+Vector<int> NetworkLink_d::getVcLoad()
+{
+        return m_vc_load;
+}
+
+int NetworkLink_d::getLinkUtilization()
+{
+        return m_link_utilized;
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
new file mode 100644 (file)
index 0000000..1fad750
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * 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_LINK_D_H
+#define NETWORK_LINK_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/common/Consumer.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
+#include "mem/gems_common/PrioHeap.hh"
+#include "mem/ruby/network/orion/power_bus.hh"
+
+class GarnetNetwork_d;
+
+class NetworkLink_d : public Consumer {
+public:
+        //NetworkLink_d(int id);
+        ~NetworkLink_d();
+
+        NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr);
+        void setLinkConsumer(Consumer *consumer);
+        void setSourceQueue(flitBuffer_d *srcQueue);
+        void print(ostream& out) const{}
+        int getLinkUtilization();
+        Vector<int> getVcLoad();
+        int get_id(){return m_id;}
+        void wakeup();
+
+        double calculate_offline_power(power_bus*);
+        double calculate_power();
+
+        inline bool isReady()
+        {
+                return linkBuffer->isReady();
+        }
+        inline flit_d* peekLink()
+        {
+                return linkBuffer->peekTopFlit();
+        }
+        inline flit_d* consumeLink()
+        {
+                return linkBuffer->getTopFlit();
+        }
+
+protected:
+        int m_id;
+        int m_latency;
+        GarnetNetwork_d *m_net_ptr;
+
+        flitBuffer_d *linkBuffer;
+        Consumer *link_consumer;
+        flitBuffer_d *link_srcQueue;
+        int m_link_utilized;
+        Vector<int > m_vc_load;
+        int m_flit_width;
+};
+
+#endif
+
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
new file mode 100644 (file)
index 0000000..9588865
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008 Princeton University
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Niket Agarwal
+ */
+
+#include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh"
+#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
+#include "mem/ruby/eventqueue/RubyEventQueue.hh"
+
+OutVcState_d::OutVcState_d(int id, GarnetNetwork_d *network_ptr)
+{
+        m_network_ptr = network_ptr;
+        m_id = id;
+        m_vc_state = IDLE_;
+        m_time = g_eventQueue_ptr->getTime();
+        m_credit_count = m_network_ptr->getNetworkConfig()->getBufferSize();
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh
new file mode 100644 (file)
index 0000000..a6b063d
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * 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 OUT_VC_STATE_D_H
+#define OUT_VC_STATE_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
+
+class OutVcState_d {
+public:
+        OutVcState_d(int id, GarnetNetwork_d *network_ptr);
+
+        int get_inport() {return m_in_port; }
+        int get_invc() { return m_in_vc; }
+        int get_credit_count() {return m_credit_count; }
+        void set_inport(int port) {m_in_port = port; }
+        void set_invc(int vc) {m_in_vc = vc; }
+
+        inline bool isInState(VC_state_type state, Time request_time)
+        {
+                return ((m_vc_state == state) && (request_time >= m_time) );
+        }
+
+        inline void setState(VC_state_type state, Time time)
+        {
+                m_vc_state = state;
+                m_time = time;
+        }
+
+        inline bool has_credits()
+        {
+                return (m_credit_count > 0);
+        }
+
+        inline void increment_credit()
+        {
+                m_credit_count++;
+        }
+
+        inline void decrement_credit()
+        {
+                m_credit_count--;
+        }
+
+private:
+        GarnetNetwork_d *m_network_ptr;
+        int m_id ;
+        Time m_time;
+        VC_state_type m_vc_state;
+        int m_in_port;
+        int m_in_vc;
+        int m_credit_count;
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
new file mode 100644 (file)
index 0000000..8a371bb
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * 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/OutputUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
+#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
+
+OutputUnit_d::OutputUnit_d(int id, Router_d *router)
+{
+        m_id = id;
+        m_router = router;
+        m_num_vcs = m_router->get_num_vcs();
+        m_out_buffer = new flitBuffer_d();
+
+        for(int i = 0; i < m_num_vcs; i++)
+        {
+                m_outvc_state.insertAtBottom(new OutVcState_d(i, m_router->get_net_ptr()));
+        }
+}
+
+OutputUnit_d::~OutputUnit_d()
+{
+        delete m_out_buffer;
+        m_outvc_state.deletePointers();
+}
+
+void OutputUnit_d::decrement_credit(int out_vc)
+{
+        m_outvc_state[out_vc]->decrement_credit();
+        m_router->update_incredit(m_outvc_state[out_vc]->get_inport(), m_outvc_state[out_vc]->get_invc(), m_outvc_state[out_vc]->get_credit_count());
+}
+
+void OutputUnit_d::wakeup()
+{
+        if(m_credit_link->isReady())
+        {
+                flit_d *t_flit = m_credit_link->consumeLink();
+                int out_vc = t_flit->get_vc();
+                m_outvc_state[out_vc]->increment_credit();
+                m_router->update_incredit(m_outvc_state[out_vc]->get_inport(), m_outvc_state[out_vc]->get_invc(), m_outvc_state[out_vc]->get_credit_count());
+
+                if(t_flit->is_free_signal())
+                        set_vc_state(IDLE_, out_vc);
+
+                delete t_flit;
+        }
+}
+
+flitBuffer_d* OutputUnit_d::getOutQueue()
+{
+        return m_out_buffer;
+}
+
+void OutputUnit_d::set_out_link(NetworkLink_d *link)
+{
+        m_out_link = link;
+}
+
+void OutputUnit_d::set_credit_link(CreditLink_d *credit_link)
+{
+        m_credit_link = credit_link;
+}
+
+void OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
+{
+        m_outvc_state[vc]->setState(ACTIVE_, g_eventQueue_ptr->getTime() + 1);
+        m_outvc_state[vc]->set_inport(in_port);
+        m_outvc_state[vc]->set_invc(in_vc);
+        m_router->update_incredit(in_port, in_vc, m_outvc_state[vc]->get_credit_count());
+}
+
+void OutputUnit_d::printConfig(ostream& out)
+{
+        out << endl;
+        out << "OutputUnit Configuration" << endl;
+        out << "---------------------" << endl;
+        out << "id = " << m_id << endl;
+        out << "Out link is " << m_out_link->get_id() << endl;
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
new file mode 100644 (file)
index 0000000..25747a1
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * 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 OUTPUT_UNIT_D_H
+#define OUTPUT_UNIT_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/common/Consumer.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_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 OutputUnit_d : public Consumer {
+public:
+        OutputUnit_d(int id, Router_d *router);
+        ~OutputUnit_d();
+        void set_out_link(NetworkLink_d *link);
+        void set_credit_link(CreditLink_d *credit_link);
+        void wakeup();
+        flitBuffer_d* getOutQueue();
+        void printConfig(ostream& out);
+        void update_vc(int vc, int in_port, int in_vc);
+        void print(ostream& out) const {};
+        int get_credit_cnt(int vc) { return m_outvc_state[vc]->get_credit_count(); }
+        void decrement_credit(int out_vc);
+
+        inline int get_outlink_id()
+        {
+                return m_out_link->get_id();
+        }
+
+        inline void set_vc_state(VC_state_type state, int vc)
+        {
+                m_outvc_state[vc]->setState(state, g_eventQueue_ptr->getTime() + 1);
+        }
+        inline bool is_vc_idle(int vc)
+        {
+                return (m_outvc_state[vc]->isInState(IDLE_, g_eventQueue_ptr->getTime())        );
+        }
+        inline void insert_flit(flit_d *t_flit)
+        {
+                m_out_buffer->insert(t_flit);
+                g_eventQueue_ptr->scheduleEvent(m_out_link, 1);
+        }
+
+
+
+private:
+        int m_id;
+        int m_num_vcs;
+        Router_d *m_router;
+        NetworkLink_d *m_out_link;
+        CreditLink_d *m_credit_link;
+
+        flitBuffer_d *m_out_buffer; // This is for the network link to consume
+        Vector<OutVcState_d *> m_outvc_state; // vc state of downstream router
+
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
new file mode 100644 (file)
index 0000000..89a893e
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * 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/Router_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh"
+
+Router_d::Router_d(int id, GarnetNetwork_d *network_ptr)
+{
+        m_id = id;
+        m_network_ptr = network_ptr;
+        m_virtual_networks = network_ptr->getNumberOfVirtualNetworks();
+        m_vc_per_vnet = m_network_ptr->getNetworkConfig()->getVCsPerClass();
+        m_num_vcs = m_virtual_networks*m_vc_per_vnet;
+        m_flit_width = m_network_ptr->getNetworkConfig()->getFlitSize();
+
+        m_routing_unit = new RoutingUnit_d(this);
+        m_vc_alloc = new VCallocator_d(this);
+        m_sw_alloc = new SWallocator_d(this);
+        m_switch = new Switch_d(this);
+
+        m_input_unit.clear();
+        m_output_unit.clear();
+
+        buf_read_count = 0;
+        buf_write_count = 0;
+        crossbar_count = 0;
+        vc_local_arbit_count = 0;
+        vc_global_arbit_count = 0;
+        sw_local_arbit_count = 0;
+        sw_global_arbit_count = 0;
+}
+
+Router_d::~Router_d()
+{
+        m_input_unit.deletePointers();
+        m_output_unit.deletePointers();
+        delete m_routing_unit;
+        delete m_vc_alloc;
+        delete m_sw_alloc;
+        delete m_switch;
+}
+
+void Router_d::init()
+{
+        m_vc_alloc->init();
+        m_sw_alloc->init();
+        m_switch->init();
+}
+
+void Router_d::addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link)
+{
+        int port_num = m_input_unit.size();
+        InputUnit_d *input_unit = new InputUnit_d(port_num, this);
+
+        input_unit->set_in_link(in_link);
+        input_unit->set_credit_link(credit_link);
+        in_link->setLinkConsumer(input_unit);
+        credit_link->setSourceQueue(input_unit->getCreditQueue());
+
+        m_input_unit.insertAtBottom(input_unit);
+}
+
+void Router_d::addOutPort(NetworkLink_d *out_link, const NetDest& routing_table_entry, int link_weight, CreditLink_d *credit_link)
+{
+        int port_num = m_output_unit.size();
+        OutputUnit_d *output_unit = new OutputUnit_d(port_num, this);
+
+        output_unit->set_out_link(out_link);
+        output_unit->set_credit_link(credit_link);
+        credit_link->setLinkConsumer(output_unit);
+        out_link->setSourceQueue(output_unit->getOutQueue());
+
+        m_output_unit.insertAtBottom(output_unit);
+
+        m_routing_unit->addRoute(routing_table_entry);
+        m_routing_unit->addWeight(link_weight);
+}
+
+void Router_d::route_req(flit_d *t_flit, InputUnit_d *in_unit, int invc)
+{
+        m_routing_unit->RC_stage(t_flit, in_unit, invc);
+}
+void Router_d::vcarb_req()
+{
+        g_eventQueue_ptr->scheduleEvent(m_vc_alloc, 1);
+}
+void Router_d::swarb_req()
+{
+        g_eventQueue_ptr->scheduleEvent(m_sw_alloc, 1);
+}
+void Router_d::update_incredit(int in_port, int in_vc, int credit)
+{
+        m_input_unit[in_port]->update_credit(in_vc, credit);
+}
+void Router_d::update_sw_winner(int inport, flit_d *t_flit)
+{
+        m_switch->update_sw_winner(inport, t_flit);
+        g_eventQueue_ptr->scheduleEvent(m_switch, 1);
+}
+
+void Router_d::calculate_performance_numbers()
+{
+        for(int i = 0; i < m_input_unit.size(); i++)
+        {
+                buf_read_count += m_input_unit[i]->get_buf_read_count();
+                buf_write_count += m_input_unit[i]->get_buf_write_count();
+        }
+        crossbar_count = m_switch->get_crossbar_count();
+        vc_local_arbit_count = m_vc_alloc->get_local_arbit_count();
+        vc_global_arbit_count = m_vc_alloc->get_global_arbit_count();
+        sw_local_arbit_count = m_sw_alloc->get_local_arbit_count();
+        sw_global_arbit_count = m_sw_alloc->get_global_arbit_count();
+}
+
+void Router_d::printConfig(ostream& out)
+{
+        out << "[Router " << m_id << "] :: " << endl;
+        out << "[inLink - ";
+        for(int i = 0;i < m_input_unit.size(); i++)
+                out << m_input_unit[i]->get_inlink_id() << " - ";
+        out << "]" << endl;
+        out << "[outLink - ";
+        for(int i = 0;i < m_output_unit.size(); i++)
+                out << m_output_unit[i]->get_outlink_id() << " - ";
+        out << "]" << endl;
+}
+
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
new file mode 100644 (file)
index 0000000..eca6214
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * 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 ROUTER_D_H
+#define ROUTER_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/gems_common/Vector.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
+#include "mem/ruby/common/NetDest.hh"
+#include "mem/ruby/network/orion/power_router_init.hh"
+
+class GarnetNetwork_d;
+class NetworkLink_d;
+class CreditLink_d;
+class InputUnit_d;
+class OutputUnit_d;
+class RoutingUnit_d;
+class VCallocator_d;
+class SWallocator_d;
+class Switch_d;
+
+class Router_d {
+public:
+        Router_d(int id, GarnetNetwork_d *network_ptr);
+
+        ~Router_d();
+
+        void init();
+        void addInPort(NetworkLink_d *link, CreditLink_d *credit_link);
+        void addOutPort(NetworkLink_d *link, const NetDest& routing_table_entry, int link_weight, CreditLink_d *credit_link);
+        int get_num_vcs() { return m_num_vcs; }
+        int get_vc_per_vnet() {return m_vc_per_vnet; }
+        int get_num_inports() { return m_input_unit.size(); }
+        int get_num_outports() { return m_output_unit.size(); }
+        void printConfig(ostream& out);
+        int get_id() { return m_id; }
+        GarnetNetwork_d* get_net_ptr() { return m_network_ptr; }
+
+        Vector<InputUnit_d *>& get_inputUnit_ref() { return m_input_unit; }
+        Vector<OutputUnit_d *>& get_outputUnit_ref() { return m_output_unit; }
+
+        void update_sw_winner(int inport, flit_d *t_flit);
+        void update_incredit(int in_port, int in_vc, int credit);
+        void route_req(flit_d *t_flit, InputUnit_d* in_unit, int invc);
+        void vcarb_req();
+        void swarb_req();
+
+        void power_router_initialize(power_router *router, power_router_info *info);
+        double calculate_power();
+        double calculate_offline_power(power_router*, power_router_info*);
+        void calculate_performance_numbers();
+
+private:
+        int m_id;
+        int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
+        GarnetNetwork_d *m_network_ptr;
+        int m_flit_width;
+
+        double buf_read_count, buf_write_count, crossbar_count, vc_local_arbit_count, vc_global_arbit_count, sw_local_arbit_count, sw_global_arbit_count;
+
+        Vector<InputUnit_d *> m_input_unit;
+        Vector<OutputUnit_d *> m_output_unit;
+        RoutingUnit_d *m_routing_unit;
+        VCallocator_d *m_vc_alloc;
+        SWallocator_d *m_sw_alloc;
+        Switch_d *m_switch;
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc
new file mode 100644 (file)
index 0000000..0c215ef
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * 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/RoutingUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh"
+#include "mem/ruby/slicc_interface/NetworkMessage.hh"
+
+RoutingUnit_d::RoutingUnit_d(Router_d *router)
+{
+        m_router = router;
+        m_routing_table.clear();
+        m_weight_table.clear();
+}
+
+void RoutingUnit_d::addRoute(const NetDest& routing_table_entry)
+{
+        m_routing_table.insertAtBottom(routing_table_entry);
+}
+
+void RoutingUnit_d::addWeight(int link_weight)
+{
+        m_weight_table.insertAtBottom(link_weight);
+}
+
+void RoutingUnit_d::RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc)
+{
+        int outport = routeCompute(t_flit);
+        in_unit->updateRoute(invc, outport);
+        t_flit->advance_stage(VA_);
+        m_router->vcarb_req();
+}
+
+int RoutingUnit_d::routeCompute(flit_d *t_flit)
+{
+        MsgPtr msg_ptr = t_flit->get_msg_ptr();
+        NetworkMessage* net_msg_ptr = NULL;
+        net_msg_ptr = dynamic_cast<NetworkMessage*>(msg_ptr.ref());
+        NetDest msg_destination = net_msg_ptr->getInternalDestination();
+
+        int output_link = -1;
+        int min_weight = INFINITE_;
+
+        for(int link = 0; link < m_routing_table.size(); link++)
+        {
+                if (msg_destination.intersectionIsNotEmpty(m_routing_table[link]))
+                {
+                        if(m_weight_table[link] >= min_weight)
+                                continue;
+                        output_link = link;
+                        min_weight = m_weight_table[link];
+                }
+        }
+        if(output_link == -1)
+        {
+                ERROR_MSG("Fatal Error:: No Route exists from this Router.");
+                exit(0);
+        }
+        return output_link;
+
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh
new file mode 100644 (file)
index 0000000..9688623
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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 ROUTING_UNIT_D_H
+#define ROUTING_UNIT_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/common/Consumer.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
+#include "mem/ruby/common/NetDest.hh"
+
+class InputUnit_d;
+class Router_d;
+
+class RoutingUnit_d {
+public:
+        RoutingUnit_d(Router_d *router);
+        void addRoute(const NetDest& routing_table_entry);
+        int routeCompute(flit_d *t_flit);
+        void addWeight(int link_weight);
+        void RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc);
+
+private:
+        Router_d *m_router;
+        Vector<NetDest > m_routing_table;
+        Vector<int > m_weight_table;
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript b/src/mem/ruby/network/garnet/fixed-pipeline/SConscript
new file mode 100644 (file)
index 0000000..84f4ba3
--- /dev/null
@@ -0,0 +1,52 @@
+# -*- 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('*')
+
+# temporarily disable
+Return()
+
+if not env['RUBY']:
+    Return()
+
+Source('GarnetNetwork_d.cc')
+Source('InputUnit_d.cc')
+Source('NetworkInterface_d.cc')
+Source('NetworkLink_d.cc')
+Source('OutVcState_d.cc')
+Source('OutputUnit_d.cc')
+Source('Router_d.cc')
+Source('RoutingUnit_d.cc')
+Source('SWallocator_d.cc')
+Source('Switch_d.cc')
+Source('VCallocator_d.cc')
+Source('VirtualChannel_d.cc')
+Source('flitBuffer_d.cc')
+Source('flit_d.cc')
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
new file mode 100644 (file)
index 0000000..4d60761
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * 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/SWallocator_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
+
+SWallocator_d::SWallocator_d(Router_d *router)
+{
+        m_router = router;
+        m_num_vcs = m_router->get_num_vcs();
+        m_vc_per_vnet = m_router->get_vc_per_vnet();
+
+        m_local_arbiter_activity = 0;
+        m_global_arbiter_activity = 0;
+}
+
+void SWallocator_d::init()
+{
+        m_input_unit = m_router->get_inputUnit_ref();
+        m_output_unit = m_router->get_outputUnit_ref();
+
+        m_num_inports = m_router->get_num_inports();
+        m_num_outports = m_router->get_num_outports();
+        m_round_robin_outport.setSize(m_num_outports);
+        m_round_robin_inport.setSize(m_num_inports);
+        m_port_req.setSize(m_num_outports);
+        m_vc_winners.setSize(m_num_outports);
+
+        for(int i = 0; i < m_num_inports; i++)
+        {
+                m_round_robin_inport[i] = 0;
+        }
+
+        for(int i = 0; i < m_num_outports; i++)
+        {
+                m_port_req[i].setSize(m_num_inports);
+                m_vc_winners[i].setSize(m_num_inports);
+
+                m_round_robin_outport[i] = 0;
+
+                for(int j = 0; j < m_num_inports; j++)
+                {
+                        m_port_req[i][j] = false; // [outport][inport]
+                }
+        }
+}
+
+void SWallocator_d::wakeup()
+{
+        arbitrate_inports(); // First stage of allocation
+        arbitrate_outports(); // Second stage of allocation
+
+        clear_request_vector();
+        check_for_wakeup();
+
+}
+
+void SWallocator_d::arbitrate_inports()
+{
+        // First I will do round robin arbitration on a set of input vc requests
+        for(int inport = 0; inport < m_num_inports; inport++)
+        {
+                int invc = m_round_robin_inport[inport];
+                m_round_robin_inport[inport]++;
+
+                if(m_round_robin_inport[inport] >= m_num_vcs)
+                        m_round_robin_inport[inport] = 0;
+                for(int j = 0; j < m_num_vcs; j++)
+                {
+                        invc++;
+                        if(invc >= m_num_vcs)
+                                invc = 0;
+                        if(m_input_unit[inport]->need_stage(invc, ACTIVE_, SA_) && m_input_unit[inport]->has_credits(invc))
+                        {
+                                if(is_candidate_inport(inport, invc))
+                                {
+                                        int outport = m_input_unit[inport]->get_route(invc);
+                                        m_local_arbiter_activity++;
+                                        m_port_req[outport][inport] = true;
+                                        m_vc_winners[outport][inport]= invc;
+                                        break; // got one vc winner for this port
+                                }
+                        }
+                }
+        }
+}
+
+bool SWallocator_d::is_candidate_inport(int inport, int invc)
+{
+        int outport = m_input_unit[inport]->get_route(invc);
+        int t_enqueue_time = m_input_unit[inport]->get_enqueue_time(invc);
+        int t_vnet = get_vnet(invc);
+        int vc_base = t_vnet*m_vc_per_vnet;
+        if((m_router->get_net_ptr())->isVNetOrdered(t_vnet))
+        {
+                for(int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++)
+                {
+                        int temp_vc = vc_base + vc_offset;
+                        if(m_input_unit[inport]->need_stage(temp_vc, ACTIVE_, SA_) && (m_input_unit[inport]->get_route(temp_vc) == outport) && (m_input_unit[inport]->get_enqueue_time(temp_vc) < t_enqueue_time))
+                        {
+                                return false;
+                                break;
+                        }
+                }
+        }
+        return true;
+}
+
+
+void SWallocator_d::arbitrate_outports()
+{
+// now I have a set of input vc requests for output vcs. Again do round robin arbitration on these requests
+        for(int outport = 0; outport < m_num_outports; outport++)
+        {
+                int in_port = m_round_robin_outport[outport];
+                m_round_robin_outport[outport]++;
+
+                if(m_round_robin_outport[outport] >= m_num_outports)
+                        m_round_robin_outport[outport] = 0;
+
+                for(int inport = 0; inport < m_num_inports; inport++)
+                {
+                        in_port++;
+                        if(in_port >= m_num_inports)
+                                in_port = 0;
+                        if(m_port_req[outport][in_port]) // This Inport has a request this cycle for this port
+                        {
+                                m_port_req[outport][in_port] = false;
+                                int invc = m_vc_winners[outport][in_port];
+                                int outvc = m_input_unit[in_port]->get_outvc(invc);
+                                flit_d *t_flit = m_input_unit[in_port]->getTopFlit(invc); // removes flit from Input Unit
+                                t_flit->advance_stage(ST_);
+                                t_flit->set_vc(outvc);
+                                t_flit->set_outport(outport);
+                                t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
+                                m_output_unit[outport]->decrement_credit(outvc);
+                                m_router->update_sw_winner(in_port, t_flit);
+                                m_global_arbiter_activity++;
+
+                                if((t_flit->get_type() == TAIL_) || t_flit->get_type() == HEAD_TAIL_)
+                                {
+                                        m_input_unit[in_port]->increment_credit(invc, true); // Send a credit back along with the information that this VC is not idle
+                                        assert(m_input_unit[in_port]->isReady(invc) == false); // This Input VC should now be empty
+
+                                        m_input_unit[in_port]->set_vc_state(IDLE_, invc);
+                                        m_input_unit[in_port]->set_enqueue_time(invc, INFINITE_);
+                                }
+                                else
+                                {
+                                        m_input_unit[in_port]->increment_credit(invc, false); // Send a credit back but do not indicate that the VC is idle
+                                }
+                                break; // got a in request for this outport
+                        }
+                }
+        }
+}
+
+void SWallocator_d::check_for_wakeup()
+{
+        for(int i = 0; i < m_num_inports; i++)
+        {
+                for(int j = 0; j < m_num_vcs; j++)
+                {
+                        if(m_input_unit[i]->need_stage_nextcycle(j, ACTIVE_, SA_))
+                        {
+                                g_eventQueue_ptr->scheduleEvent(this, 1);
+                                return;
+                        }
+                }
+        }
+}
+
+int SWallocator_d::get_vnet(int invc)
+{
+  for(int i = 0; i < RubySystem::getNetwork()->getNumberOfVirtualNetworks(); i++)
+        {
+                if(invc >= (i*m_vc_per_vnet) && invc < ((i+1)*m_vc_per_vnet))
+                {
+                        return i;
+                }
+        }
+        ERROR_MSG("Could not determine vc");
+        return -1;
+}
+
+void SWallocator_d::clear_request_vector()
+{
+        for(int i = 0; i < m_num_outports; i++)
+        {
+                for(int j = 0; j < m_num_inports; j++)
+                {
+                        m_port_req[i][j] = false;
+                }
+        }
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh
new file mode 100644 (file)
index 0000000..a6c838e
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * 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 SW_ALLOCATOR_D_H
+#define SW_ALLOCATOR_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/common/Consumer.hh"
+
+class Router_d;
+class InputUnit_d;
+class OutputUnit_d;
+
+class SWallocator_d : public Consumer {
+public:
+        SWallocator_d(Router_d *router);
+        void wakeup();
+        void init();
+        void clear_request_vector();
+        void check_for_wakeup();
+        int get_vnet (int invc);
+        void print(ostream& out) const {};
+        void arbitrate_inports();
+        void arbitrate_outports();
+        bool is_candidate_inport(int inport, int invc);
+        inline double get_local_arbit_count()
+        {
+                return m_local_arbiter_activity;
+        }
+        inline double get_global_arbit_count()
+        {
+                return m_global_arbiter_activity;
+        }
+
+private:
+        int m_num_inports, m_num_outports;
+        int m_num_vcs, m_vc_per_vnet;
+
+        double m_local_arbiter_activity, m_global_arbiter_activity;
+
+        Router_d *m_router;
+        Vector<int > m_round_robin_outport;
+        Vector<int > m_round_robin_inport;
+        Vector<Vector<bool > > m_port_req;
+        Vector<Vector<int > > m_vc_winners; // a list for each outport
+        Vector<InputUnit_d *> m_input_unit;
+        Vector<OutputUnit_d *> m_output_unit;
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
new file mode 100644 (file)
index 0000000..9b99934
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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/Switch_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh"
+
+Switch_d::Switch_d(Router_d *router)
+{
+        m_router = router;
+        m_num_vcs = m_router->get_num_vcs();
+        m_crossbar_activity = 0;
+}
+
+Switch_d::~Switch_d()
+{
+        m_switch_buffer.deletePointers();
+}
+
+void Switch_d::init()
+{
+        m_output_unit = m_router->get_outputUnit_ref();
+
+        m_num_inports = m_router->get_num_inports();
+        m_switch_buffer.setSize(m_num_inports);
+        for(int i = 0; i < m_num_inports; i++)
+        {
+                m_switch_buffer[i] = new flitBuffer_d();
+        }
+}
+
+void Switch_d::wakeup()
+{
+        DEBUG_MSG(NETWORK_COMP, HighPrio, "Switch woke up");
+        DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
+
+        for(int inport = 0; inport < m_num_inports; inport++)
+        {
+                if(!m_switch_buffer[inport]->isReady())
+                        continue;
+                flit_d *t_flit = m_switch_buffer[inport]->peekTopFlit();
+                if(t_flit->is_stage(ST_))
+                {
+                        int outport = t_flit->get_outport();
+                        t_flit->advance_stage(LT_);
+                        t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
+                        m_output_unit[outport]->insert_flit(t_flit); // This will take care of waking up the Network Link
+                        m_switch_buffer[inport]->getTopFlit();
+                        m_crossbar_activity++;
+                }
+        }
+        check_for_wakeup();
+}
+
+void Switch_d::check_for_wakeup()
+{
+        for(int inport = 0; inport < m_num_inports; inport++)
+        {
+                if(m_switch_buffer[inport]->isReadyForNext())
+                {
+                        g_eventQueue_ptr->scheduleEvent(this, 1);
+                        break;
+                }
+        }
+}
+
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh
new file mode 100644 (file)
index 0000000..0e3c17b
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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 SWITCH_D_H
+#define SWITCH_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/common/Consumer.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
+
+class Router_d;
+class OutputUnit_d;
+
+class Switch_d : public Consumer {
+public:
+        Switch_d(Router_d *router);
+        ~Switch_d();
+        void wakeup();
+        void init();
+        void check_for_wakeup();
+        void print(ostream& out) const {};
+        inline void update_sw_winner(int inport, flit_d *t_flit)
+        {
+                m_switch_buffer[inport]->insert(t_flit);
+        }
+        inline double get_crossbar_count()
+        {
+                return m_crossbar_activity;
+        }
+
+
+private:
+        int m_num_vcs;
+        int m_num_inports;
+        double m_crossbar_activity;
+        Router_d *m_router;
+        Vector<flitBuffer_d *> m_switch_buffer;
+        Vector<OutputUnit_d *> m_output_unit;
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
new file mode 100644 (file)
index 0000000..7bfb494
--- /dev/null
@@ -0,0 +1,266 @@
+/*
+ * 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/NetworkConfig.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
+
+VCallocator_d::VCallocator_d(Router_d *router)
+{
+        m_router = router;
+        m_num_vcs = m_router->get_num_vcs();
+        m_vc_per_vnet = m_router->get_vc_per_vnet();
+        m_local_arbiter_activity = 0;
+        m_global_arbiter_activity = 0;
+}
+
+void VCallocator_d::init()
+{
+        m_input_unit = m_router->get_inputUnit_ref();
+        m_output_unit = m_router->get_outputUnit_ref();
+
+        m_num_inports = m_router->get_num_inports();
+        m_num_outports = m_router->get_num_outports();
+        m_round_robin_invc.setSize(m_num_inports);
+        m_round_robin_outvc.setSize(m_num_outports);
+        m_outvc_req.setSize(m_num_outports);
+        m_outvc_is_req.setSize(m_num_outports);
+
+        for(int i = 0; i < m_num_inports; i++)
+        {
+                m_round_robin_invc[i].setSize(m_num_vcs);
+
+                for(int j = 0; j < m_num_vcs; j++)
+                {
+                        m_round_robin_invc[i][j] = 0;
+                }
+        }
+
+        for(int i = 0; i < m_num_outports; i++)
+        {
+                m_round_robin_outvc[i].setSize(m_num_vcs);
+                m_outvc_req[i].setSize(m_num_vcs);
+                m_outvc_is_req[i].setSize(m_num_vcs);
+
+                for(int j = 0; j < m_num_vcs; j++)
+                {
+                        m_round_robin_outvc[i][j].first = 0;
+                        m_round_robin_outvc[i][j].second = 0;
+                        m_outvc_is_req[i][j] = false;
+
+                        m_outvc_req[i][j].setSize(m_num_inports);
+
+                        for(int k = 0; k < m_num_inports; k++)
+                        {
+                                m_outvc_req[i][j][k].setSize(m_num_vcs);
+                                for(int l = 0; l < m_num_vcs; l++)
+                                {
+                                        m_outvc_req[i][j][k][l] = false;
+                                }
+                        }
+                }
+        }
+}
+
+void VCallocator_d::clear_request_vector()
+{
+        for(int i = 0; i < m_num_outports; i++)
+        {
+                for(int j = 0; j < m_num_vcs; j++)
+                {
+                        if(!m_outvc_is_req[i][j])
+                                continue;
+                        m_outvc_is_req[i][j] = false;
+                        for(int k = 0; k < m_num_inports; k++)
+                        {
+                                for(int l = 0; l < m_num_vcs; l++)
+                                {
+                                        m_outvc_req[i][j][k][l] = false;
+                                }
+                        }
+                }
+        }
+}
+
+void VCallocator_d::wakeup()
+{
+        arbitrate_invcs(); // First stage of allocation
+        arbitrate_outvcs(); // Second stage of allocation
+
+        clear_request_vector();
+        check_for_wakeup();
+}
+
+bool VCallocator_d::is_invc_candidate(int inport_iter, int invc_iter)
+{
+        int outport = m_input_unit[inport_iter]->get_route(invc_iter);
+        int vnet = get_vnet(invc_iter);
+        int t_enqueue_time = m_input_unit[inport_iter]->get_enqueue_time(invc_iter);
+
+        int invc_base = vnet*m_vc_per_vnet;
+
+        if((m_router->get_net_ptr())->isVNetOrdered(vnet))
+        {
+                for(int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++)
+                {
+                        int temp_vc = invc_base + vc_offset;
+                        if(m_input_unit[inport_iter]->need_stage(temp_vc, VC_AB_, VA_) && (m_input_unit[inport_iter]->get_route(temp_vc) == outport) && (m_input_unit[inport_iter]->get_enqueue_time(temp_vc) < t_enqueue_time))
+                        {
+                                return false;
+                        }
+                }
+        }
+        return true;
+}
+
+void VCallocator_d::select_outvc(int inport_iter, int invc_iter)
+{
+        int outport = m_input_unit[inport_iter]->get_route(invc_iter);
+        int vnet = get_vnet(invc_iter);
+        int outvc_base = vnet*m_vc_per_vnet;
+        int num_vcs_per_vnet = m_vc_per_vnet;
+
+        int outvc_offset = m_round_robin_invc[inport_iter][invc_iter];
+        m_round_robin_invc[inport_iter][invc_iter]++;
+
+        if(m_round_robin_invc[inport_iter][invc_iter] >= num_vcs_per_vnet)
+                m_round_robin_invc[inport_iter][invc_iter] = 0;
+
+        for(int outvc_offset_iter = 0; outvc_offset_iter < num_vcs_per_vnet; outvc_offset_iter++)
+        {
+                outvc_offset++;
+                if(outvc_offset >= num_vcs_per_vnet)
+                        outvc_offset = 0;
+                int outvc = outvc_base + outvc_offset;
+                if(m_output_unit[outport]->is_vc_idle(outvc))
+                {
+                        m_local_arbiter_activity++;
+                        m_outvc_req[outport][outvc][inport_iter][invc_iter] = true;
+                        if(!m_outvc_is_req[outport][outvc])
+                                m_outvc_is_req[outport][outvc] = true;
+                        return; // out vc acquired
+                }
+        }
+}
+
+void VCallocator_d::arbitrate_invcs()
+{
+        for(int inport_iter = 0; inport_iter < m_num_inports; inport_iter++)
+        {
+                for(int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++)
+                {
+                        if(m_input_unit[inport_iter]->need_stage(invc_iter, VC_AB_, VA_))
+                        {
+                                if(!is_invc_candidate(inport_iter, invc_iter))
+                                        continue;
+
+                                select_outvc(inport_iter, invc_iter);
+                        }
+                }
+        }
+}
+
+void VCallocator_d::arbitrate_outvcs()
+{
+        for(int outport_iter = 0; outport_iter < m_num_outports; outport_iter++)
+        {
+                for(int outvc_iter = 0; outvc_iter < m_num_vcs; outvc_iter++)
+                {
+                        if(!m_outvc_is_req[outport_iter][outvc_iter]) // No requests for this outvc in this cycle
+                                continue;
+
+                        int inport = m_round_robin_outvc[outport_iter][outvc_iter].first;
+                        int invc_offset = m_round_robin_outvc[outport_iter][outvc_iter].second;
+                        int vnet = get_vnet(outvc_iter);
+                        int invc_base = vnet*m_vc_per_vnet;
+                        int num_vcs_per_vnet = m_vc_per_vnet;
+
+                        m_round_robin_outvc[outport_iter][outvc_iter].second++;
+                        if(m_round_robin_outvc[outport_iter][outvc_iter].second >= num_vcs_per_vnet)
+                        {
+                                m_round_robin_outvc[outport_iter][outvc_iter].second = 0;
+                                m_round_robin_outvc[outport_iter][outvc_iter].first++;
+                                if(m_round_robin_outvc[outport_iter][outvc_iter].first >= m_num_inports)
+                                        m_round_robin_outvc[outport_iter][outvc_iter].first = 0;
+                        }
+                        for(int in_iter = 0; in_iter < m_num_inports*num_vcs_per_vnet; in_iter++)
+                        {
+                                invc_offset++;
+                                if(invc_offset >= num_vcs_per_vnet)
+                                {
+                                        invc_offset = 0;
+                                        inport++;
+                                        if(inport >= m_num_inports)
+                                                inport = 0;
+                                }
+                                int invc = invc_base + invc_offset;
+                                if(m_outvc_req[outport_iter][outvc_iter][inport][invc])
+                                {
+                                        m_global_arbiter_activity++;
+                                        m_input_unit[inport]->grant_vc(invc, outvc_iter);
+                                        m_output_unit[outport_iter]->update_vc(outvc_iter, inport, invc);
+                                        m_router->swarb_req();
+                                        break;
+                                }
+                        }
+                }
+        }
+}
+
+int VCallocator_d::get_vnet(int invc)
+{
+  for(int i = 0; i < RubySystem::getNetwork()->getNumberOfVirtualNetworks(); i++)
+        {
+                if(invc >= (i*m_vc_per_vnet) && invc < ((i+1)*m_vc_per_vnet))
+                {
+                        return i;
+                }
+        }
+        ERROR_MSG("Could not determine vc");
+        return -1;
+}
+
+void VCallocator_d::check_for_wakeup()
+{
+        for(int i = 0; i < m_num_inports; i++)
+        {
+                for(int j = 0; j < m_num_vcs; j++)
+                {
+                        if(m_input_unit[i]->need_stage_nextcycle(j, VC_AB_, VA_))
+                        {
+                                g_eventQueue_ptr->scheduleEvent(this, 1);
+                                return;
+                        }
+                }
+        }
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh
new file mode 100644 (file)
index 0000000..c9247c6
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * 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 VC_ALLOCATOR_D_H
+#define VC_ALLOCATOR_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/common/Consumer.hh"
+
+class Router_d;
+class InputUnit_d;
+class OutputUnit_d;
+
+class VCallocator_d : public Consumer {
+public:
+        VCallocator_d(Router_d *router);
+        void init();
+        void wakeup();
+        void check_for_wakeup();
+        void clear_request_vector();
+        int get_vnet(int invc);
+        void print(ostream& out) const {};
+        void arbitrate_invcs();
+        void arbitrate_outvcs();
+        bool is_invc_candidate(int inport_iter, int invc_iter);
+        void select_outvc(int inport_iter, int invc_iter);
+        inline double get_local_arbit_count()
+        {
+                return m_local_arbiter_activity;
+        }
+        inline double get_global_arbit_count()
+        {
+                return m_global_arbiter_activity;
+        }
+
+private:
+        int m_num_vcs, m_vc_per_vnet;
+        int m_num_inports;
+        int m_num_outports;
+
+        double m_local_arbiter_activity, m_global_arbiter_activity;
+
+        Router_d *m_router;
+        Vector<Vector <int > > m_round_robin_invc; // First stage of arbitration where all vcs select an output vc to content for
+        Vector<Vector <pair<int, int> > > m_round_robin_outvc; // Arbiter for every output vc
+        Vector<Vector<Vector<Vector<bool > > > > m_outvc_req; // [outport][outvc][inpotr][invc]. set true in the first phase of allocation
+        Vector<Vector<bool > > m_outvc_is_req;
+
+        Vector<InputUnit_d *> m_input_unit ;
+        Vector<OutputUnit_d *> m_output_unit ;
+
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
new file mode 100644 (file)
index 0000000..94e7819
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2008 Princeton University
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Niket Agarwal
+ */
+
+#include "mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh"
+
+VirtualChannel_d::VirtualChannel_d(int id)
+{
+        m_id = id;
+        m_input_buffer = new flitBuffer_d();
+        m_vc_state.first = IDLE_;
+        m_vc_state.second = g_eventQueue_ptr->getTime();
+        m_enqueue_time = INFINITE_;
+}
+
+VirtualChannel_d::~VirtualChannel_d()
+{
+        delete m_input_buffer;
+}
+
+void VirtualChannel_d::set_outport(int outport)
+{
+        route = outport;
+}
+
+void VirtualChannel_d::grant_vc(int out_vc)
+{
+        m_output_vc = out_vc;
+        m_vc_state.first = ACTIVE_;
+        m_vc_state.second = g_eventQueue_ptr->getTime() + 1;
+        flit_d *t_flit = m_input_buffer->peekTopFlit();
+        t_flit->advance_stage(SA_);
+}
+
+bool VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage)
+{
+        if((m_vc_state.first == state) && (g_eventQueue_ptr->getTime() >= m_vc_state.second))
+        {
+                if(m_input_buffer->isReady())
+                {
+                        flit_d *t_flit = m_input_buffer->peekTopFlit();
+                        return(t_flit->is_stage(stage)) ;
+                }
+        }
+        return false;
+
+}
+
+bool VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage)
+{
+        if((m_vc_state.first == state) && ((g_eventQueue_ptr->getTime()+1) >= m_vc_state.second))
+        {
+                if(m_input_buffer->isReadyForNext())
+                {
+                        flit_d *t_flit = m_input_buffer->peekTopFlit();
+                        return(t_flit->is_next_stage(stage)) ;
+                }
+        }
+        return false;
+}
+
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
new file mode 100644 (file)
index 0000000..2b47790
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * 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 VIRTUAL_CHANNEL_D_H
+#define VIRTUAL_CHANNEL_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
+
+class VirtualChannel_d {
+public:
+        VirtualChannel_d(int id);
+        ~VirtualChannel_d();
+
+        bool need_stage(VC_state_type state, flit_stage stage);
+        bool need_stage_nextcycle(VC_state_type state, flit_stage stage);
+        void set_outport(int outport);
+        void grant_vc(int out_vc);
+
+        inline Time get_enqueue_time()
+        {
+                return m_enqueue_time;
+        }
+
+        inline void set_enqueue_time(Time time)
+        {
+                m_enqueue_time = time;
+        }
+
+        inline VC_state_type get_state()
+        {
+                return m_vc_state.first;
+        }
+        inline int get_outvc()
+        {
+                return m_output_vc;
+        }
+        inline bool isReady()
+        {
+                return m_input_buffer->isReady();
+        }
+        inline bool has_credits()
+        {
+                return (m_credit_count > 0);
+        }
+        inline int get_route()
+        {
+                return route;
+        }
+        inline void update_credit(int credit)
+        {
+                m_credit_count = credit;
+        }
+        inline void increment_credit()
+        {
+                m_credit_count++;
+        }
+        inline void insertFlit(flit_d *t_flit)
+        {
+                m_input_buffer->insert(t_flit);
+        }
+        inline void set_state(VC_state_type m_state)
+        {
+                m_vc_state.first = m_state;
+                m_vc_state.second = g_eventQueue_ptr->getTime() + 1;
+        }
+
+        inline flit_d* peekTopFlit()
+        {
+                return m_input_buffer->peekTopFlit();
+        }
+
+        inline flit_d* getTopFlit()
+        {
+                return m_input_buffer->getTopFlit();
+        }
+
+private:
+        int m_id;
+        flitBuffer_d *m_input_buffer;
+        pair<VC_state_type, Time> m_vc_state; // I/R/V/A/C
+        int route;
+        Time m_enqueue_time;
+        int m_output_vc;
+        int m_credit_count;
+};
+#endif
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
new file mode 100644 (file)
index 0000000..9578f0a
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2008 Princeton University
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Niket Agarwal
+ */
+
+#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
+
+flitBuffer_d::flitBuffer_d()
+{
+        max_size = INFINITE_;
+}
+
+flitBuffer_d::flitBuffer_d(int maximum_size)
+{
+        max_size = maximum_size;
+}
+
+bool flitBuffer_d::isEmpty()
+{
+        return (m_buffer.size() == 0);
+}
+
+bool flitBuffer_d::isReady()
+{
+        if(m_buffer.size() != 0 )
+        {
+                flit_d *t_flit = m_buffer.peekMin();
+                if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
+                        return true;
+        }
+        return false;
+}
+
+bool flitBuffer_d::isReadyForNext()
+{
+        if(m_buffer.size() != 0 )
+        {
+                flit_d *t_flit = m_buffer.peekMin();
+                if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
+                        return true;
+        }
+        return false;
+}
+
+void flitBuffer_d::print(ostream& out) const
+{
+        out << "[flitBuffer: ";
+        out << m_buffer.size() << "] " << endl;
+}
+
+bool flitBuffer_d::isFull()
+{
+        return (m_buffer.size() >= max_size);
+}
+void flitBuffer_d::setMaxSize(int maximum)
+{
+        max_size = maximum;
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
new file mode 100644 (file)
index 0000000..11a3cda
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * 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 FLIT_BUFFER_D_H
+#define FLIT_BUFFER_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/gems_common/PrioHeap.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
+
+class flitBuffer_d {
+public:
+        flitBuffer_d();
+        flitBuffer_d(int maximum_size);
+
+        bool isReady();
+        bool isReadyForNext();
+        bool isEmpty();
+        void print(ostream& out) const;
+        bool isFull();
+        void setMaxSize(int maximum);
+
+        inline flit_d* getTopFlit()
+        {
+                return m_buffer.extractMin();
+        }
+        inline flit_d* peekTopFlit()
+        {
+                return m_buffer.peekMin();
+        }
+        inline void insert(flit_d *flt)
+        {
+                m_buffer.insert(flt);
+        }
+        /**********Data Members*********/
+private:
+        PrioHeap <flit_d *> m_buffer;
+        int size, max_size;
+};
+
+ostream& operator<<(ostream& out, const flitBuffer_d& obj);
+
+// ******************* Definitions *******************
+
+// Output operator definition
+extern inline
+ostream& operator<<(ostream& out, const flitBuffer_d& obj)
+{
+  obj.print(out);
+  out << flush;
+  return out;
+}
+
+#endif
+
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
new file mode 100644 (file)
index 0000000..c6a58a8
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2008 Princeton University
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Niket Agarwal
+ */
+
+#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
+
+flit_d::flit_d(int id, int  vc, int vnet, int size, MsgPtr msg_ptr)
+{
+        m_size = size;
+        m_msg_ptr = msg_ptr;
+        m_enqueue_time = g_eventQueue_ptr->getTime();
+        m_time = g_eventQueue_ptr->getTime();
+        m_id = id;
+        m_vnet = vnet;
+        m_vc = vc;
+        m_stage.first = I_;
+        m_stage.second = m_time;
+
+        if(size == 1)
+        {
+                m_type = HEAD_TAIL_;
+                return;
+        }
+        if(id == 0)
+                m_type = HEAD_;
+        else if(id == (size - 1))
+                m_type = TAIL_;
+        else
+                m_type = BODY_;
+}
+
+flit_d::flit_d(int vc, bool is_free_signal)
+{
+        m_id = 0;
+        m_vc = vc;
+        m_is_free_signal = is_free_signal;
+        m_time = g_eventQueue_ptr->getTime();
+}
+/*
+int flit_d::get_size()
+{
+        return m_size;
+}
+Time flit_d::get_enqueue_time()
+{
+        return m_enqueue_time;
+}
+int flit_d::get_id()
+{
+        return m_id;
+}
+Time flit_d::get_time()
+{
+        return m_time;
+}
+void flit_d::set_time(Time time)
+{
+        m_time = time;
+}
+int flit_d::get_vnet()
+{
+        return m_vnet;
+}
+int flit_d::get_vc()
+{
+        return m_vc;
+}
+void flit_d::set_vc(int vc)
+{
+        m_vc = vc;
+}
+MsgPtr& flit_d::get_msg_ptr()
+{
+        return m_msg_ptr;
+}
+flit_type flit_d::get_type()
+{
+        return m_type;
+}
+bool flit_d::is_stage(flit_stage t_stage)
+{
+        return ((m_stage.first == t_stage) && (g_eventQueue_ptr->getTime() >= m_stage.second));
+}
+bool flit_d::is_next_stage(flit_stage t_stage)
+{
+        return ((m_stage.first == t_stage) && ((g_eventQueue_ptr->getTime()+1) >= m_stage.second));
+}
+void flit_d::advance_stage(flit_stage t_stage)
+{
+        m_stage.first = t_stage;
+        m_stage.second = g_eventQueue_ptr->getTime() + 1;
+}
+*/
+void flit_d::print(ostream& out) const
+{
+        out << "[flit:: ";
+        out << "Id=" << m_id << " ";
+        out << "Type=" << m_type << " ";
+        out << "Vnet=" << m_vnet << " ";
+        out << "VC=" << m_vc << " ";
+        out << "Enqueue Time=" << m_enqueue_time << " ";
+        out << "]";
+}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
new file mode 100644 (file)
index 0000000..3f9afcd
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * 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 FLIT_D_H
+#define FLIT_D_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/slicc_interface/Message.hh"
+
+class flit_d {
+public:
+        flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr);
+        flit_d(int vc, bool is_free_signal);
+        void set_outport(int port) { m_outport = port; }
+        int get_outport() {return m_outport; }
+        void print(ostream& out) const;
+        bool is_free_signal()
+        {
+                return m_is_free_signal;
+        }
+
+        inline int get_size()
+        {
+                return m_size;
+        }
+        inline Time get_enqueue_time()
+        {
+                return m_enqueue_time;
+        }
+        inline int get_id()
+        {
+                return m_id;
+        }
+        inline Time get_time()
+        {
+                return m_time;
+        }
+        inline void set_time(Time time)
+        {
+                m_time = time;
+        }
+        inline int get_vnet()
+        {
+                return m_vnet;
+        }
+        inline int get_vc()
+        {
+                return m_vc;
+        }
+        inline void set_vc(int vc)
+        {
+                m_vc = vc;
+        }
+        inline MsgPtr& get_msg_ptr()
+        {
+                return m_msg_ptr;
+        }
+        inline flit_type get_type()
+        {
+                return m_type;
+        }
+        inline bool is_stage(flit_stage t_stage)
+        {
+                return ((m_stage.first == t_stage) && (g_eventQueue_ptr->getTime() >= m_stage.second));
+        }
+        inline bool is_next_stage(flit_stage t_stage)
+        {
+                return ((m_stage.first == t_stage) && ((g_eventQueue_ptr->getTime()+1) >= m_stage.second));
+        }
+        inline void advance_stage(flit_stage t_stage)
+        {
+                m_stage.first = t_stage;
+                m_stage.second = g_eventQueue_ptr->getTime() + 1;
+        }
+        inline pair<flit_stage, Time> get_stage()
+        {
+                return m_stage;
+        }
+        inline void set_delay(int delay)
+        {
+                src_delay = delay;
+        }
+
+        inline int get_delay()
+        {
+                return src_delay;
+        }
+
+
+private:
+        /************Data Members*************/
+        int m_id;
+        int m_vnet;
+        int m_vc;
+        int m_size;
+        bool m_is_free_signal;
+        Time m_enqueue_time, m_time;
+        flit_type m_type;
+        MsgPtr m_msg_ptr;
+        int m_outport;
+        int src_delay;
+        pair<flit_stage, Time> m_stage;
+
+};
+
+inline extern bool node_less_then_eq(flit_d* n1, flit_d* n2);
+
+inline extern
+bool node_less_then_eq(flit_d* n1, flit_d* n2)
+{
+  if (n1->get_time() == n2->get_time()) {
+//    ASSERT(n1->flit_id != n2->flit_id);
+    return (n1->get_id() <= n2->get_id());
+  } else {
+    return (n1->get_time() <= n2->get_time());
+  }
+}
+
+// Output operator declaration
+ostream& operator<<(ostream& out, const flit_d& obj);
+
+// ******************* Definitions *******************
+
+// Output operator definition
+extern inline
+ostream& operator<<(ostream& out, const flit_d& obj)
+{
+  obj.print(out);
+  out << flush;
+  return out;
+}
+
+#endif
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
new file mode 100644 (file)
index 0000000..fd12b4e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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 FLEXIBLE_CONSUMER_H
+#define FLEXIBLE_CONSUMER_H
+
+#include "mem/ruby/common/Consumer.hh"
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/common/NetDest.hh"
+
+class FlexibleConsumer : public Consumer {
+public:
+        virtual bool isBufferNotFull(int vc, int inport) {return true;}
+        virtual void grant_vc(int out_port, int vc, Time grant_time) {}
+        virtual void release_vc(int out_port, int vc, Time release_time) {}
+        virtual void request_vc(int vc, int in_port, NetDest destination, Time request_time) {}
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
new file mode 100644 (file)
index 0000000..a88263c
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * 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/protocol/MachineType.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh"
+#include "mem/ruby/buffers/MessageBuffer.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/Router.hh"
+#include "mem/ruby/network/simple/Topology.hh"
+#include "mem/ruby/network/simple/SimpleNetwork.hh"
+#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
+#include "mem/ruby/common/NetDest.hh"
+
+GarnetNetwork::GarnetNetwork(const string & name)
+  : Network(name)
+{
+}
+
+void GarnetNetwork::init()
+{
+//        printf("hello\n");
+        Network::init(argv);
+//added by SS
+//        assert (m_topology_ptr!=NULL);
+
+        m_network_config_ptr = new NetworkConfig;
+
+        m_network_config_ptr->init(argv);
+
+        m_ruby_start = 0;
+
+        // 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
+        assert (m_topology_ptr!=NULL);
+        m_topology_ptr->makeTopology();
+
+        int number_of_routers = m_topology_ptr->numSwitches();
+        for (int i=0; i<number_of_routers; i++) {
+                m_router_ptr_vector.insertAtBottom(new Router(i, this));
+        }
+
+        for (int i=0; i < m_nodes; i++) {
+                NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks, this);
+                ni->addNode(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
+}
+
+GarnetNetwork::~GarnetNetwork()
+{
+        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();
+        delete m_topology_ptr;
+}
+
+void GarnetNetwork::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();
+                }
+        }
+}
+
+void GarnetNetwork::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 *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
+                m_link_ptr_vector.insertAtBottom(net_link);
+                m_router_ptr_vector[dest]->addInPort(net_link);
+                m_ni_ptr_vector[src]->addOutPort(net_link);
+        }
+        else
+        {
+                ERROR_MSG("Fatal Error:: Reconfiguration not allowed here");
+                // do nothing
+        }
+}
+
+void GarnetNetwork::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 *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
+                m_link_ptr_vector.insertAtBottom(net_link);
+                m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight);
+                m_ni_ptr_vector[dest]->addInPort(net_link);
+        }
+        else
+        {
+                ERROR_MSG("Fatal Error:: Reconfiguration not allowed here");
+                //do nothing
+        }
+}
+
+void GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration)
+{
+        if(!isReconfiguration)
+        {
+                NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
+                m_link_ptr_vector.insertAtBottom(net_link);
+                m_router_ptr_vector[dest]->addInPort(net_link);
+                m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight);
+        }
+        else
+        {
+                ERROR_MSG("Fatal Error:: Reconfiguration not allowed here");
+                // do nothing
+        }
+
+}
+
+void GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num)
+{
+        printf ("id = %i, m_nodes = %i \n", id, m_nodes);
+        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::getToNetQueue(NodeID id, bool ordered, int network_num)
+{
+        checkNetworkAllocation(id, ordered, network_num);
+        return m_toNetQueues[id][network_num];
+}
+
+MessageBuffer* GarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num)
+{
+        checkNetworkAllocation(id, ordered, network_num);
+        return m_fromNetQueues[id][network_num];
+}
+
+void GarnetNetwork::clearStats()
+{
+        m_ruby_start = g_eventQueue_ptr->getTime();
+}
+
+Time GarnetNetwork::getRubyStartTime()
+{
+        return m_ruby_start;
+}
+
+void GarnetNetwork::printStats(ostream& out) const
+{       double average_link_utilization = 0;
+        Vector<double > 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 += m_link_ptr_vector[i]->getLinkUtilization();
+                Vector<int > 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;
+}
+
+void GarnetNetwork::printConfig(ostream& out) const
+{
+        out << endl;
+        out << "Network Configuration" << endl;
+        out << "---------------------" << endl;
+        out << "network: GARNET_NETWORK" << endl;
+        out << "topology: " << m_topology_ptr->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::print(ostream& out) const
+{
+        out << "[GarnetNetwork]";
+}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
new file mode 100644 (file)
index 0000000..03a1703
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * 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 GARNET_NETWORK_H
+#define GARNET_NETWORK_H
+
+#include "mem/ruby/network/garnet/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;
+class MessageBuffer;
+class Router;
+class Topology;
+class NetDest;
+class NetworkLink;
+
+class GarnetNetwork : public Network{
+public:
+        GarnetNetwork(const string & name);
+
+        ~GarnetNetwork();
+
+        void init();
+
+        //added by SS
+        NetworkConfig* getNetworkConfig() { return m_network_config_ptr; }
+
+        // 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;
+
+        bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
+        bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
+
+        Time getRubyStartTime();
+        int getNumNodes(){ return m_nodes; }
+
+        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:
+        void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
+
+// Private copy constructor and assignment operator
+        GarnetNetwork(const GarnetNetwork& obj);
+        GarnetNetwork& operator=(const GarnetNetwork& obj);
+
+
+/***********Data Members*************/
+//      int m_virtual_networks;
+//      int m_nodes;
+
+        Vector<bool> m_in_use;
+        Vector<bool> m_ordered;
+
+        Vector<Vector<MessageBuffer*> > m_toNetQueues;
+        Vector<Vector<MessageBuffer*> > m_fromNetQueues;
+
+        Vector<Router *> m_router_ptr_vector;   // All Routers in Network
+        Vector<NetworkLink *> m_link_ptr_vector; // All links in the network
+        Vector<NetworkInterface *> m_ni_ptr_vector;     // All NI's in Network
+
+//      Topology* m_topology_ptr;
+        Time m_ruby_start;
+
+        NetworkConfig* m_network_config_ptr;
+};
+
+// Output operator declaration
+ostream& operator<<(ostream& out, const GarnetNetwork& obj);
+
+// ******************* Definitions *******************
+// Output operator definition
+extern inline
+ostream& operator<<(ostream& out, const GarnetNetwork& obj)
+{
+        obj.print(out);
+        out << flush;
+        return out;
+}
+
+#endif //NETWORK_H
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc b/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc
new file mode 100644 (file)
index 0000000..84196e4
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * 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, Time 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, Time time)
+{
+        m_vc_state = state;
+        m_time = time;
+}
+
+void InVcState::grant_vc(int out_vc, Time 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
new file mode 100644 (file)
index 0000000..d84bbe8
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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 IN_VC_STATE_H
+#define IN_VC_STATE_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+
+class InVcState {
+public:
+        InVcState(int id);
+
+        void setRoute(int route);
+        void setState(VC_state_type state, Time time);
+        int get_outport();
+        int get_outvc();
+        void grant_vc(int out_vc, Time grant_time);
+        bool isInState(VC_state_type state, Time time);
+
+private:
+        int m_id;
+        int m_route;
+        int m_output_vc;
+        VC_state_type m_vc_state;
+        Time m_time;
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh
new file mode 100644 (file)
index 0000000..44900d2
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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
+ */
+
+/*
+ * This header file is used to define all configuration parameters
+ * required by the interconnection network.
+ */
+
+#ifndef NETWORKCONFIG_H
+#define NETWORKCONFIG_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/gems_common/util.hh"
+
+class NetworkConfig {
+        private:
+                int m_flit_size;
+                int m_number_of_pipe_stages;
+                int m_vcs_per_class;
+                int m_buffer_size;
+                bool m_using_network_testing;
+        public:
+                NetworkConfig(){}
+                void init() {
+                  for (size_t i=0; i<argv.size(); i+=2) {
+                   if (argv[i] == "flit_size")
+                     m_flit_size = atoi(argv[i+1].c_str());
+                   else if (argv[i] == "number_of_pipe_stages")
+                     m_number_of_pipe_stages = atoi(argv[i+1].c_str());
+                   else if (argv[i] == "vcs_per_class")
+                     m_vcs_per_class = atoi(argv[i+1].c_str());
+                   else if (argv[i] == "buffer_size")
+                     m_buffer_size = atoi(argv[i+1].c_str());
+                   else if (argv[i] == "using_network_testing")
+                     m_using_network_testing = atoi(argv[i+1].c_str());
+                  }
+                }
+                bool isNetworkTesting() {return m_using_network_testing; }
+                int getFlitSize() {return m_flit_size; }
+                int getNumPipeStages() {return m_number_of_pipe_stages; }
+                int getVCsPerClass() {return m_vcs_per_class; }
+                int getBufferSize() {return m_buffer_size; }
+};
+
+
+#endif
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
new file mode 100644 (file)
index 0000000..a8a8fd1
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * 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/NetworkInterface.hh"
+#include "mem/ruby/buffers/MessageBuffer.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
+#include "mem/ruby/slicc_interface/NetworkMessage.hh"
+
+NetworkInterface::NetworkInterface(int id, int virtual_networks, GarnetNetwork *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);
+        inNode_ptr.setSize(m_virtual_networks);
+        outNode_ptr.setSize(m_virtual_networks);
+
+        for(int i =0; i < m_num_vcs; i++)
+                m_ni_buffers[i] = new flitBuffer(); // instantiating the NI flit buffers
+
+         m_vc_allocator.setSize(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.insertAtBottom(new OutVcState(i));
+                m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+         }
+}
+
+NetworkInterface::~NetworkInterface()
+{
+        m_out_vc_state.deletePointers();
+        m_ni_buffers.deletePointers();
+        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<MessageBuffer*>& in,  Vector<MessageBuffer*>& 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
+        }
+}
+
+void NetworkInterface::request_vc(int in_vc, int in_port, NetDest destination, Time request_time)
+{
+        inNetLink->grant_vc_link(in_vc, request_time);
+}
+
+bool NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
+{
+        NetworkMessage *net_msg_ptr = dynamic_cast<NetworkMessage*>(msg_ptr.ref());
+        NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
+        Vector<NodeID> 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)
+                {
+                        // did not find a free output vc
+                        return false ;
+                }
+                MsgPtr new_msg_ptr = *(msg_ptr.ref());
+                NodeID destID = dest_nodes[ctr];
+
+                NetworkMessage *new_net_msg_ptr = dynamic_cast<NetworkMessage*>(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++)
+                {
+                        flit *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr);
+                        m_ni_buffers[vc]->insert(fl);
+                }
+
+                m_out_vc_state[vc]->setState(VC_AB_, g_eventQueue_ptr->getTime());
+                outNetLink->request_vc_link(vc, new_net_msg_ptr->getInternalDestination(), g_eventQueue_ptr->getTime()); // setting an output vc request for the next hop. It is only when an output vc is acquired at the next hop that this flit will be ready to traverse the link and into the next hop
+        }
+
+        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, Time grant_time)
+{
+
+        assert(m_out_vc_state[vc]->isInState(VC_AB_, grant_time));
+        m_out_vc_state[vc]->grant_vc(grant_time);
+        g_eventQueue_ptr->scheduleEvent(this, 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, Time release_time)
+{
+        assert(m_out_vc_state[vc]->isInState(ACTIVE_, release_time));
+        m_out_vc_state[vc]->setState(IDLE_, release_time);
+        g_eventQueue_ptr->scheduleEvent(this, 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_, 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.
+ */
+
+void NetworkInterface::wakeup()
+{
+        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 *t_flit = inNetLink->consumeLink();
+                if(t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_)
+                {
+                        DEBUG_EXPR(NETWORK_COMP, HighPrio, m_id);
+                        DEBUG_MSG(NETWORK_COMP, HighPrio, "Message got delivered");
+                        DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
+                        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
+                        }
+                        inNetLink->release_vc_link(t_flit->get_vc(), g_eventQueue_ptr->getTime() + 1); // signal the upstream router that this vc can be freed now
+                }
+                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::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())
+                {
+                        if(m_out_vc_state[vc]->isInState(ACTIVE_, g_eventQueue_ptr->getTime()) && outNetLink->isBufferNotFull_link(vc))  // models buffer backpressure
+                        {
+                                flit *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
+                                return;
+                        }
+                }
+        }
+}
+
+void NetworkInterface::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::printConfig(ostream& out) const
+{
+        out << "[Network Interface " << m_id << "] - ";
+        out << "[inLink " << inNetLink->get_id() << "] - ";
+        out << "[outLink " << outNetLink->get_id() << "]" << endl;
+}
+
+void NetworkInterface::print(ostream& out) const
+{
+        out << "[Network Interface]";
+}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh
new file mode 100644 (file)
index 0000000..67bba5f
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * 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_H
+#define NET_INTERFACE_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
+#include "mem/gems_common/Vector.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
+#include "mem/ruby/slicc_interface/Message.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh"
+
+class NetworkMessage;
+class MessageBuffer;
+class flitBuffer;
+
+class NetworkInterface : public FlexibleConsumer {
+public:
+        NetworkInterface(int id, int virtual_networks, GarnetNetwork* network_ptr);
+
+        ~NetworkInterface();
+
+        void addInPort(NetworkLink *in_link);
+        void addOutPort(NetworkLink *out_link);
+
+        void wakeup();
+        void addNode(Vector<MessageBuffer *> &inNode, Vector<MessageBuffer *> &outNode);
+        void grant_vc(int out_port, int vc, Time grant_time);
+        void release_vc(int out_port, int vc, Time release_time);
+        bool isBufferNotFull(int vc, int inport)
+        {
+                return true;
+        }
+        void request_vc(int in_vc, int in_port, NetDest destination, Time request_time);
+
+        void printConfig(ostream& out) const;
+        void print(ostream& out) const;
+
+private:
+/**************Data Members*************/
+        GarnetNetwork *m_net_ptr;
+        int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
+        NodeID m_id;
+
+        Vector<OutVcState *> m_out_vc_state;
+        Vector<int > 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
+        Vector<flitBuffer *>   m_ni_buffers; // The flit buffers which will serve the Consumer
+
+        Vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
+        Vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
+
+        bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
+        int calculateVC(int vnet);
+        void scheduleOutputLink();
+        void checkReschedule();
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
new file mode 100644 (file)
index 0000000..3b1c84e
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * 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/NetworkLink.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
+
+NetworkLink::NetworkLink(int id, int latency, GarnetNetwork *net_ptr)
+{
+        m_id = id;
+        linkBuffer = new flitBuffer();
+        m_in_port = 0;
+        m_out_port = 0;
+        m_link_utilized = 0;
+        m_net_ptr = net_ptr;
+        m_latency = latency;
+        int num_net = net_ptr->getNumberOfVirtualNetworks();
+        int num_vc = m_net_ptr->getNetworkConfig()->getVCsPerClass();
+        m_vc_load.setSize(num_net*num_vc);
+
+        for(int i = 0; i < num_net*num_vc; i++)
+                m_vc_load[i] = 0;
+}
+
+NetworkLink::~NetworkLink()
+{
+        delete linkBuffer;
+}
+
+int NetworkLink::get_id()
+{
+        return m_id;
+}
+
+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, Time 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, Time grant_time)
+{
+        link_source->grant_vc(m_out_port, vc, grant_time);
+}
+
+void NetworkLink::release_vc_link(int vc, Time release_time)
+{
+        link_source->release_vc(m_out_port, vc, release_time);
+}
+
+Vector<int> NetworkLink::getVcLoad()
+{
+        return m_vc_load;
+}
+
+double NetworkLink::getLinkUtilization()
+{
+        Time m_ruby_start = m_net_ptr->getRubyStartTime();
+        return (double(m_link_utilized)) / (double(g_eventQueue_ptr->getTime()-m_ruby_start));
+}
+
+bool NetworkLink::isReady()
+{
+        return linkBuffer->isReady();
+}
+
+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())
+        {
+                flit *t_flit = link_srcQueue->getTopFlit();
+                t_flit->set_time(g_eventQueue_ptr->getTime() + m_latency);
+                linkBuffer->insert(t_flit);
+                g_eventQueue_ptr->scheduleEvent(link_consumer, m_latency);
+                m_link_utilized++;
+                m_vc_load[t_flit->get_vc()]++;
+        }
+}
+
+flit* NetworkLink::peekLink()
+{
+        return linkBuffer->peekTopFlit();
+}
+
+flit* NetworkLink::consumeLink()
+{
+        return linkBuffer->getTopFlit();
+}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
new file mode 100644 (file)
index 0000000..e371d92
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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_LINK_H
+#define NETWORK_LINK_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
+#include "mem/gems_common/PrioHeap.hh"
+#include "mem/ruby/common/NetDest.hh"
+
+class GarnetNetwork;
+
+class NetworkLink : public FlexibleConsumer {
+public:
+        NetworkLink();
+        NetworkLink(int id, int latency, GarnetNetwork *net_ptr);
+        ~NetworkLink();
+
+        void setLinkConsumer(FlexibleConsumer *consumer);
+        void setSourceQueue(flitBuffer *srcQueue);
+        flit* peekLink();
+        flit* consumeLink();
+
+        void print(ostream& out) const {}
+
+        bool is_vc_ready(flit *t_flit);
+
+        int get_id();
+        void setInPort(int port);
+        void setOutPort(int port);
+        void wakeup();
+        bool isReady();
+        void grant_vc_link(int vc, Time grant_time);
+        void release_vc_link(int vc, Time release_time);
+        void request_vc_link(int vc, NetDest destination, Time request_time);
+        bool isBufferNotFull_link(int vc);
+        void setSource(FlexibleConsumer *source);
+        double getLinkUtilization();
+        Vector<int> getVcLoad();
+
+protected:
+        int m_id, m_latency;
+        int m_in_port, m_out_port;
+        int m_link_utilized;
+        Vector<int > m_vc_load;
+        GarnetNetwork *m_net_ptr;
+
+        flitBuffer *linkBuffer;
+        FlexibleConsumer *link_consumer;
+        FlexibleConsumer *link_source;
+        flitBuffer *link_srcQueue;
+};
+
+#endif
+
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
new file mode 100644 (file)
index 0000000..e17db5d
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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_id = id;
+        m_vc_state = IDLE_;
+}
+
+bool OutVcState::isInState(VC_state_type state, Time request_time)
+{
+        return ((m_vc_state == state) && (request_time >= m_time) );
+}
+
+void OutVcState::grant_vc(Time grant_time)
+{
+        m_time = grant_time;
+        m_vc_state = ACTIVE_;
+}
+
+void OutVcState::setState(VC_state_type state, Time 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
new file mode 100644 (file)
index 0000000..a1c0fdf
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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 OUT_VC_STATE_H
+#define OUT_VC_STATE_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+
+class OutVcState {
+public:
+        OutVcState(int id);
+
+        bool isInState(VC_state_type state, Time request_time);
+        void setState(VC_state_type state, Time time);
+        void grant_vc(Time grant_time);
+
+private:
+        int m_id ;
+        Time m_time;
+        VC_state_type m_vc_state;
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
new file mode 100644 (file)
index 0000000..63f0373
--- /dev/null
@@ -0,0 +1,384 @@
+/*
+ * 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/slicc_interface/NetworkMessage.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/VCarbiter.hh"
+
+Router::Router(int id, GarnetNetwork *network_ptr)
+{
+        m_id = id;
+        m_net_ptr = network_ptr;
+        m_virtual_networks = m_net_ptr->getNumberOfVirtualNetworks();
+        m_vc_per_vnet = m_net_ptr->getNetworkConfig()->getVCsPerClass();
+        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++)
+        {
+                m_in_vc_state[i].deletePointers();
+        }
+        for (int i = 0; i < m_out_link.size(); i++)
+        {
+                m_out_vc_state[i].deletePointers();
+                m_router_buffers[i].deletePointers();
+        }
+        m_out_src_queue.deletePointers();
+        delete m_vc_arbiter;
+
+}
+
+void Router::addInPort(NetworkLink *in_link)
+{
+        int port = m_in_link.size();
+        Vector<InVcState *> in_vc_vector;
+        for(int i = 0; i < m_num_vcs; i++)
+        {
+                in_vc_vector.insertAtBottom(new InVcState(i));
+                in_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+        }
+        m_in_vc_state.insertAtBottom(in_vc_vector);
+        m_in_link.insertAtBottom(in_link);
+        in_link->setLinkConsumer(this);
+        in_link->setInPort(port);
+
+        int start = 0;
+        m_round_robin_invc.insertAtBottom(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.insertAtBottom(start);
+
+        m_out_src_queue.insertAtBottom(new flitBuffer());
+
+        m_out_link.insertAtBottom(out_link);
+        m_routing_table.insertAtBottom(routing_table_entry);
+        out_link->setSourceQueue(m_out_src_queue[port]);
+        out_link->setSource(this);
+
+        Vector<flitBuffer *> intermediateQueues;
+        for(int i = 0; i < m_num_vcs; i++)
+        {
+                intermediateQueues.insertAtBottom(new flitBuffer(m_net_ptr->getNetworkConfig()->getBufferSize()));
+        }
+        m_router_buffers.insertAtBottom(intermediateQueues);
+
+        Vector<OutVcState *> out_vc_vector;
+        for(int i = 0; i < m_num_vcs; i++)
+        {
+                out_vc_vector.insertAtBottom(new OutVcState(i));
+                out_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+        }
+        m_out_vc_state.insertAtBottom(out_vc_vector);
+        m_link_weights.insertAtBottom(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, Time 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 >= g_eventQueue_ptr->getTime());
+        if(request_time > g_eventQueue_ptr->getTime())
+                g_eventQueue_ptr->scheduleEventAbsolute(m_vc_arbiter, 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]++;
+
+                if(m_round_robin_invc[inport] >= m_num_vcs)
+                        m_round_robin_invc[inport] = 0;
+                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_, g_eventQueue_ptr->getTime()))
+                        {
+                                int outport = in_vc_state->get_outport();
+                                Vector<int > 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_, g_eventQueue_ptr->getTime()))
+                                        {
+                                                in_vc_state->grant_vc(valid_vcs[valid_vc_iter], g_eventQueue_ptr->getTime());
+                                                m_in_link[inport]->grant_vc_link(invc, g_eventQueue_ptr->getTime());
+                                                m_out_vc_state[outport][valid_vcs[valid_vc_iter]]->setState(VC_AB_, g_eventQueue_ptr->getTime());
+                                                break;
+                                        }
+                                }
+                        }
+                }
+        }
+}
+
+Vector<int > Router::get_valid_vcs(int invc)
+{
+        Vector<int > 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.insertAtBottom(base+offset);
+                        }
+                        break;
+                }
+        }
+        return vc_list;
+}
+
+void Router::grant_vc(int out_port, int vc, Time 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);
+        g_eventQueue_ptr->scheduleEvent(this, 1);
+}
+
+void Router::release_vc(int out_port, int vc, Time 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);
+        g_eventQueue_ptr->scheduleEvent(this, 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->getNetworkConfig()->getNumPipeStages() >= 1);
+        m_flit->set_time(g_eventQueue_ptr->getTime() + (m_net_ptr->getNetworkConfig()->getNumPipeStages() - 1)); // Becasuse 1 cycle will be consumed in scheduling the output link
+        m_flit->set_vc(outvc);
+        m_router_buffers[outport][outvc]->insert(m_flit);
+
+        if(m_net_ptr->getNetworkConfig()->getNumPipeStages() > 1)
+                g_eventQueue_ptr->scheduleEvent(this, m_net_ptr->getNetworkConfig()->getNumPipeStages() -1 );
+        if((m_flit->get_type() == HEAD_) || (m_flit->get_type() == HEAD_TAIL_))
+        {
+                NetDest destination = dynamic_cast<NetworkMessage*>(m_flit->get_msg_ptr().ref())->getInternalDestination();
+                if(m_net_ptr->getNetworkConfig()->getNumPipeStages() > 1)
+                {
+                        m_out_vc_state[outport][outvc]->setState(VC_AB_, g_eventQueue_ptr->getTime() + 1);
+                        m_out_link[outport]->request_vc_link(outvc, destination, g_eventQueue_ptr->getTime() + 1);
+                }
+                else
+                {
+                        m_out_vc_state[outport][outvc]->setState(VC_AB_, g_eventQueue_ptr->getTime());
+                        m_out_link[outport]->request_vc_link(outvc, destination, g_eventQueue_ptr->getTime());
+                }
+        }
+        if((m_flit->get_type() == TAIL_) || (m_flit->get_type() == HEAD_TAIL_))
+        {
+                m_in_vc_state[inport][invc]->setState(IDLE_, g_eventQueue_ptr->getTime() + 1);
+                m_in_link[inport]->release_vc_link(invc, g_eventQueue_ptr->getTime() + 1);
+        }
+}
+
+void Router::wakeup()
+{
+        flit *t_flit;
+
+        int incoming_port = m_round_robin_start; // This is for round-robin scheduling of incoming ports
+        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;
+                if(m_in_link[incoming_port]->isReady()) // checking the incoming link
+                {
+                        DEBUG_EXPR(NETWORK_COMP, HighPrio, m_id);
+                        DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
+                        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]++;
+                if(m_vc_round_robin[port] == m_num_vcs)
+                        m_vc_round_robin[port] = 0;
+
+                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())
+                        {
+                                if(m_out_vc_state[port][vc_tolookat]->isInState(ACTIVE_, g_eventQueue_ptr->getTime()) && m_out_link[port]->isBufferNotFull_link(vc_tolookat))
+                                // models buffer backpressure
+                                {
+                                        flit *t_flit = m_router_buffers[port][vc_tolookat]->getTopFlit();
+                                        t_flit->set_time(g_eventQueue_ptr->getTime() + 1 );
+                                        m_out_src_queue[port]->insert(t_flit);
+                                        g_eventQueue_ptr->scheduleEvent(m_out_link[port], 1);
+                                        break; // done for this port
+                                }
+                        }
+                }
+        }
+}
+
+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]->isReadyForNext())
+                        {
+                                g_eventQueue_ptr->scheduleEvent(this, 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_, g_eventQueue_ptr->getTime() + 1))
+                        {
+                                g_eventQueue_ptr->scheduleEvent(m_vc_arbiter, 1);
+                                return;
+                        }
+                }
+        }
+}
+
+void Router::printConfig(ostream& out) const
+{
+        out << "[Router " << m_id << "] :: " << endl;
+        out << "[inLink - ";
+        for(int i = 0;i < m_in_link.size(); i++)
+                out << m_in_link[i]->get_id() << " - ";
+        out << "]" << endl;
+        out << "[outLink - ";
+        for(int i = 0;i < m_out_link.size(); i++)
+                out << m_out_link[i]->get_id() << " - ";
+        out << "]" << endl;
+/*      out << "---------- routing table -------------" << endl;
+        for(int i =0; i < m_routing_table.size(); i++)
+                out << m_routing_table[i] << endl;
+*/
+}
+
+void Router::print(ostream& out) const
+{
+        out << "[Router]";
+}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
new file mode 100644 (file)
index 0000000..5ec7590
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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 ROUTER_H
+#define ROUTER_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
+#include "mem/gems_common/PrioHeap.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
+#include "mem/ruby/common/NetDest.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/InVcState.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh"
+
+class VCarbiter;
+
+class Router : public FlexibleConsumer {
+public:
+        Router(int id, GarnetNetwork *network_ptr);
+
+        ~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, Time request_time);
+        bool isBufferNotFull(int vc, int inport);
+        void grant_vc(int out_port, int vc, Time grant_time);
+        void release_vc(int out_port, int vc, Time release_time);
+        void vc_arbitrate();
+
+        void printConfig(ostream& out) const;
+        void print(ostream& out) const;
+
+private:
+/***************Data Members******************/
+        int m_id;
+        int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
+        GarnetNetwork *m_net_ptr;
+        Vector<int > m_vc_round_robin; // For scheduling of out source queues
+        int m_round_robin_inport, m_round_robin_start; // for vc arbitration
+        Vector<int > m_round_robin_invc; // For every outport. for vc arbitration
+
+        Vector<Vector<flitBuffer *> > m_router_buffers; // These are essentially output buffers
+        Vector<flitBuffer *> m_out_src_queue; // These are source queues for the output link
+        Vector<NetworkLink *> m_in_link;
+        Vector<NetworkLink *> m_out_link;
+        Vector<Vector<InVcState * > > m_in_vc_state;
+        Vector<Vector<OutVcState * > > m_out_vc_state;
+        Vector<NetDest> m_routing_table;
+        Vector<int > m_link_weights;
+        VCarbiter *m_vc_arbiter;
+
+/*********** Private methods *************/
+        int getRoute(NetDest destination);
+        Vector<int > get_valid_vcs(int invc);
+        void routeCompute(flit *m_flit, int inport);
+        void checkReschedule();
+        void check_arbiter_reschedule();
+        void scheduleOutputLinks();
+};
+
+#endif
+
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/SConscript b/src/mem/ruby/network/garnet/flexible-pipeline/SConscript
new file mode 100644 (file)
index 0000000..e132741
--- /dev/null
@@ -0,0 +1,47 @@
+# -*- 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('*')
+
+# temporarily disable
+Return()
+
+if not env['RUBY']:
+    Return()
+
+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
new file mode 100644 (file)
index 0000000..fdf9aad
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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/VCarbiter.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/Router.hh"
+
+VCarbiter::VCarbiter(Router *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
new file mode 100644 (file)
index 0000000..6a8c356
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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 VC_ARBITER_H
+#define VC_ARBITER_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/ruby/common/Consumer.hh"
+
+class Router;
+
+class VCarbiter : public Consumer{
+public:
+        VCarbiter(Router *router);
+        ~VCarbiter() {}
+
+        void print(ostream& out) const {}
+        void wakeup();
+
+private:
+        Router *m_router;
+};
+
+#endif
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
new file mode 100644 (file)
index 0000000..e73a8b9
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * 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)
+{
+        m_size = size;
+        m_msg_ptr = msg_ptr;
+        m_enqueue_time = g_eventQueue_ptr->getTime();
+        m_time = g_eventQueue_ptr->getTime();
+        m_id = id;
+        m_vnet = vnet;
+        m_vc = vc;
+
+        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_;
+}
+
+int flit::get_size()
+{
+        return m_size;
+}
+int flit::get_id()
+{
+        return m_id;
+}
+Time flit::get_time()
+{
+        return m_time;
+}
+
+Time flit::get_enqueue_time()
+{
+        return m_enqueue_time;
+}
+void flit::set_time(Time time)
+{
+        m_time = time;
+}
+
+int flit::get_vnet()
+{
+        return m_vnet;
+}
+int flit::get_vc()
+{
+        return m_vc;
+}
+void flit::set_vc(int vc)
+{
+        m_vc = vc;
+}
+MsgPtr& flit::get_msg_ptr()
+{
+        return m_msg_ptr;
+}
+flit_type flit::get_type()
+{
+        return m_type;
+}
+
+void flit::print(ostream& out) const
+{
+        out << "[flit:: ";
+        out << "Id=" << m_id << " ";
+        out << "Type=" << m_type << " ";
+        out << "Vnet=" << m_vnet << " ";
+        out << "VC=" << m_vc << " ";
+        out << "Enqueue Time=" << m_enqueue_time << " ";
+        out << "]";
+}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
new file mode 100644 (file)
index 0000000..2cf3eaa
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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/NetworkHeader.hh"
+#include "mem/ruby/slicc_interface/Message.hh"
+
+#ifndef FLIT_H
+#define FLIT_H
+
+class flit {
+public:
+        flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr);
+
+        int get_size();
+        int get_id();
+        Time get_time();
+        Time get_enqueue_time();
+        void set_time(Time time);
+        int get_vnet();
+        int get_vc();
+        void set_vc(int vc);
+        MsgPtr& get_msg_ptr();
+        flit_type get_type();
+        void print(ostream&out) const;
+
+private:
+/************Data Members*************/
+        int m_id;
+        int m_vnet;
+        int m_vc;
+        int m_size;
+        Time m_enqueue_time, m_time;
+        flit_type m_type;
+        MsgPtr m_msg_ptr;
+
+};
+
+inline extern bool node_less_then_eq(flit* n1, flit* n2);
+
+inline extern
+bool node_less_then_eq(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());
+  }
+}
+
+// Output operator declaration
+ostream& operator<<(ostream& out, const flit& obj);
+
+// ******************* Definitions *******************
+
+// Output operator definition
+extern inline
+ostream& operator<<(ostream& out, const flit& obj)
+{
+  obj.print(out);
+  out << flush;
+  return out;
+}
+
+#endif
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
new file mode 100644 (file)
index 0000000..d2f9244
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * 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/flitBuffer.hh"
+
+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()
+{
+        if(m_buffer.size() != 0 )
+        {
+                flit *t_flit = m_buffer.peekMin();
+                if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
+                        return true;
+        }
+        return false;
+}
+
+bool flitBuffer::isReadyForNext()
+{
+        if(m_buffer.size() != 0 )
+        {
+                flit *t_flit = m_buffer.peekMin();
+                if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
+                        return true;
+        }
+        return false;
+}
+
+bool flitBuffer::isFull()
+{
+        return (m_buffer.size() >= max_size);
+}
+
+void flitBuffer::setMaxSize(int maximum)
+{
+        max_size = maximum;
+}
+
+flit* flitBuffer:: getTopFlit()
+{
+        return m_buffer.extractMin();
+}
+
+flit* flitBuffer::peekTopFlit()
+{
+        return m_buffer.peekMin();
+}
+
+void flitBuffer::insert(flit *flt)
+{
+        m_buffer.insert(flt);
+}
+
+void flitBuffer::print(ostream& out) const
+{
+        out << "[flitBuffer: ";
+        out << m_buffer.size() << "] " << endl;
+}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
new file mode 100644 (file)
index 0000000..f8b3472
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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 FLIT_BUFFER_H
+#define FLIT_BUFFER_H
+
+#include "mem/ruby/network/garnet/NetworkHeader.hh"
+#include "mem/gems_common/PrioHeap.hh"
+#include "mem/ruby/network/garnet/flexible-pipeline/flit.hh"
+
+class flitBuffer {
+public:
+        flitBuffer();
+        flitBuffer(int maximum_size);
+
+        bool isReady();
+        bool isReadyForNext();
+        bool isFull();
+        bool isEmpty();
+        void setMaxSize(int maximum);
+        flit *getTopFlit();
+        flit *peekTopFlit();
+        void insert(flit *flt);
+        void print(ostream& out) const;
+
+/**********Data Members*********/
+private:
+        PrioHeap <flit *> m_buffer;
+        int size, max_size;
+};
+
+ostream& operator<<(ostream& out, const flitBuffer& obj);
+
+// ******************* Definitions *******************
+
+// Output operator definition
+extern inline
+ostream& operator<<(ostream& out, const flitBuffer& obj)
+{
+  obj.print(out);
+  out << flush;
+  return out;
+}
+
+#endif
+
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/netconfig.defaults b/src/mem/ruby/network/garnet/flexible-pipeline/netconfig.defaults
new file mode 100644 (file)
index 0000000..e60f192
--- /dev/null
@@ -0,0 +1,8 @@
+// Note: You should set Garnet's parameters in config/rubyconfig.defaults and not here
+g_GARNET_NETWORK:true
+g_DETAIL_NETWORK:true
+g_NETWORK_TESTING:false
+g_FLIT_SIZE:16
+g_NUM_PIPE_STAGES:4
+g_VCS_PER_CLASS:4
+g_BUFFER_SIZE:4