summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network
diff options
context:
space:
mode:
authorTushar Krishna <Tushar.Krishna@amd.com>2010-06-22 15:36:07 -0700
committerTushar Krishna <Tushar.Krishna@amd.com>2010-06-22 15:36:07 -0700
commit66f0d26059ffaa09b829c0a84419936f88fd68c2 (patch)
tree6878f789faa552fa8c4af6e1c2c096370f7ecfa2 /src/mem/ruby/network
parent84489c58741d637fd3af2379952df5b96b4f63a5 (diff)
downloadgem5-66f0d26059ffaa09b829c0a84419936f88fd68c2.tar.xz
style: updated garnet to match M5 coding style
Diffstat (limited to 'src/mem/ruby/network')
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.cc3
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.hh11
-rw-r--r--src/mem/ruby/network/garnet/NetworkHeader.hh7
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh15
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc436
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh155
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc89
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh269
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc514
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh80
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc77
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh67
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc10
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh79
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc92
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh93
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc180
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh83
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc69
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh29
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc293
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh72
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc75
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh56
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc336
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh93
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc67
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh124
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc58
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh73
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc122
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh181
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh20
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc352
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh85
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc40
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh37
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc444
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh88
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc127
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh74
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc24
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh27
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/Router.cc583
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/Router.hh88
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc8
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh23
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.cc109
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.hh70
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc81
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh41
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/netconfig.defaults8
52 files changed, 3190 insertions, 3047 deletions
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
index 4a0d4157b..7290a70d9 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
@@ -40,7 +40,8 @@ BaseGarnetNetwork::BaseGarnetNetwork(const Params *p)
m_using_network_testing = p->using_network_testing;
}
-void BaseGarnetNetwork::init()
+void
+BaseGarnetNetwork::init()
{
Network::init();
}
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
index a8eca11a4..51d84c6e0 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
@@ -33,14 +33,15 @@
* required by the interconnection network.
*/
-#ifndef BASEGARNETNETWORK_H
-#define BASEGARNETNETWORK_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_BASEGARNETNETWORK_HH__
+#define __MEM_RUBY_NETWORK_GARNET_BASEGARNETNETWORK_HH__
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/Network.hh"
#include "params/BaseGarnetNetwork.hh"
-class BaseGarnetNetwork : public Network {
+class BaseGarnetNetwork : public Network
+{
public:
typedef BaseGarnetNetworkParams Params;
BaseGarnetNetwork(const Params *p);
@@ -58,8 +59,6 @@ class BaseGarnetNetwork : public Network {
int m_vcs_per_class;
int m_buffer_size;
bool m_using_network_testing;
-
};
-
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_BASEGARNETNETWORK_HH__
diff --git a/src/mem/ruby/network/garnet/NetworkHeader.hh b/src/mem/ruby/network/garnet/NetworkHeader.hh
index 98c8024fa..63900ad66 100644
--- a/src/mem/ruby/network/garnet/NetworkHeader.hh
+++ b/src/mem/ruby/network/garnet/NetworkHeader.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef NETWORK_HEADER_H
-#define NETWORK_HEADER_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_NETWORKHEADER_HH__
+#define __MEM_RUBY_NETWORK_GARNET_NETWORKHEADER_HH__
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/NodeID.hh"
@@ -40,5 +40,4 @@ enum flit_stage {I_, VA_, SA_, ST_, LT_, NUM_FLIT_STAGE_};
#define INFINITE_ 10000
-#endif
-
+#endif // __MEM_RUBY_NETWORK_GARNET_NETWORKHEADER_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh
index eda87da1a..779161336 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh
@@ -28,14 +28,17 @@
* Authors: Niket Agarwal
*/
-#ifndef CREDIT_LINK_D_H
-#define CREDIT_LINK_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_CREDIT_LINK_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_CREDIT_LINK_D_HH__
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
-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) {}
+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
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_CREDIT_LINK_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
index 124a38e93..2a392c206 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
@@ -43,49 +43,50 @@ using namespace std;
using m5::stl_helpers::deletePointers;
GarnetNetwork_d::GarnetNetwork_d(const Params *p)
- : BaseGarnetNetwork(p)
+ : BaseGarnetNetwork(p)
{
m_ruby_start = 0;
- m_flits_recieved = 0;
+ m_flits_received = 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.resize(m_nodes); // Queues that are getting messages from protocol
- m_fromNetQueues.resize(m_nodes); // Queues that are feeding the protocol
+
+ // Queues that are getting messages from protocol
+ m_toNetQueues.resize(m_nodes);
+
+ // Queues that are feeding the protocol
+ m_fromNetQueues.resize(m_nodes);
m_in_use.resize(m_virtual_networks);
m_ordered.resize(m_virtual_networks);
- for (int i = 0; i < m_virtual_networks; i++)
- {
+ 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
+
+ for (int node = 0; node < m_nodes; node++) {
+ // Setting how many vitual message buffers
+ // will there be per Network Queue
m_toNetQueues[node].resize(m_virtual_networks);
m_fromNetQueues[node].resize(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
+
+ // Instantiating the Message Buffers
+ // that interact with the coherence protocol
+ for (int j = 0; j < m_virtual_networks; j++) {
+ m_toNetQueues[node][j] = new MessageBuffer();
m_fromNetQueues[node][j] = new MessageBuffer();
}
}
}
-void GarnetNetwork_d::init()
+void
+GarnetNetwork_d::init()
{
BaseGarnetNetwork::init();
- //
- // The topology pointer should have already been initialized in the parent
- // network constructor.
- //
+ // The topology pointer should have already been initialized in the
+ // parent network constructor
assert(m_topology_ptr != NULL);
int number_of_routers = m_topology_ptr->numSwitches();
@@ -94,68 +95,70 @@ void GarnetNetwork_d::init()
}
for (int i=0; i < m_nodes; i++) {
- NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks, this);
+ NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks,
+ this);
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
m_ni_ptr_vector.push_back(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++)
- {
+ // false because this isn't a reconfiguration
+ m_topology_ptr->createLinks(this, false);
+ 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++)
- {
- deletePointers(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);
- delete m_topology_ptr;
+ for (int i = 0; i < m_nodes; i++) {
+ deletePointers(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);
+ delete m_topology_ptr;
}
-void GarnetNetwork_d::reset()
+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();
- }
+ 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.
+ * 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)
+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.push_back(net_link);
- m_creditlink_ptr_vector.push_back(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
- }
+ 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.push_back(net_link);
+ m_creditlink_ptr_vector.push_back(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
+ }
}
/*
@@ -164,191 +167,202 @@ void GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, const NetDest& routi
* 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)
+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.push_back(net_link);
- m_creditlink_ptr_vector.push_back(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
- }
+ 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.push_back(net_link);
+ m_creditlink_ptr_vector.push_back(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
+ * This function creates an internal network link
*/
-void GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration)
+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.push_back(net_link);
- m_creditlink_ptr_vector.push_back(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
- }
+ 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.push_back(net_link);
+ m_creditlink_ptr_vector.push_back(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)
+void
+GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered,
+ int network_num)
{
- ASSERT(id < m_nodes);
- ASSERT(network_num < m_virtual_networks);
+ ASSERT(id < m_nodes);
+ ASSERT(network_num < m_virtual_networks);
- if (ordered)
- {
- m_ordered[network_num] = true;
- }
- m_in_use[network_num] = true;
+ if (ordered) {
+ m_ordered[network_num] = true;
+ }
+ m_in_use[network_num] = true;
}
-MessageBuffer* GarnetNetwork_d::getToNetQueue(NodeID id, bool ordered, int network_num)
+MessageBuffer*
+GarnetNetwork_d::getToNetQueue(NodeID id, bool ordered, int network_num)
{
- checkNetworkAllocation(id, ordered, network_num);
- return m_toNetQueues[id][network_num];
+ checkNetworkAllocation(id, ordered, network_num);
+ return m_toNetQueues[id][network_num];
}
-MessageBuffer* GarnetNetwork_d::getFromNetQueue(NodeID id, bool ordered, int network_num)
+MessageBuffer*
+GarnetNetwork_d::getFromNetQueue(NodeID id, bool ordered, int network_num)
{
- checkNetworkAllocation(id, ordered, network_num);
- return m_fromNetQueues[id][network_num];
+ checkNetworkAllocation(id, ordered, network_num);
+ return m_fromNetQueues[id][network_num];
}
-void GarnetNetwork_d::clearStats()
+void
+GarnetNetwork_d::clearStats()
{
- m_ruby_start = g_eventQueue_ptr->getTime();
+ m_ruby_start = g_eventQueue_ptr->getTime();
}
-Time GarnetNetwork_d::getRubyStartTime()
+Time
+GarnetNetwork_d::getRubyStartTime()
{
- return m_ruby_start;
+ return m_ruby_start;
}
-void GarnetNetwork_d::printStats(ostream& out) const
-{ double average_link_utilization = 0;
- vector<double> average_vc_load;
- average_vc_load.resize(m_virtual_networks*m_vcs_per_class);
-
- for(int i = 0; i < m_virtual_networks*m_vcs_per_class; 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_vcs_per_class*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_vcs_per_class*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;
+void
+GarnetNetwork_d::printStats(ostream& out) const
+{
+ double average_link_utilization = 0;
+ vector<double> average_vc_load;
+ average_vc_load.resize(m_virtual_networks*m_vcs_per_class);
- double m_total_link_power = 0.0;
- double m_total_router_power = 0.0;
+ for (int i = 0; i < m_virtual_networks*m_vcs_per_class; i++)
+ {
+ average_vc_load[i] = 0;
+ }
- for(int i = 0; i < m_link_ptr_vector.size(); i++)
- {
- m_total_link_power += m_link_ptr_vector[i]->calculate_power();
+ 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_vcs_per_class*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_vcs_per_class*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 received = " << m_flits_received << endl;
+ out << "Average network latency = "
+ << ((double) m_network_latency/ (double) m_flits_received)<< endl;
+ // out << "Average queueing latency = "
+ // << ((double) m_queueing_latency/ (double) m_flits_received)<< endl;
+ // out << "Average latency = "
+ // << ((double) (m_queueing_latency + m_network_latency) /
+ // (double) m_flits_received)<< 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;
+ 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
+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;
+ 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;
+ }
+ 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);
+ 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
+void
+GarnetNetwork_d::print(ostream& out) const
{
- out << "[GarnetNetwork_d]";
+ out << "[GarnetNetwork_d]";
}
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
index 7f1b293f4..d3fb9f39b 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef GARNETNETWORK_D_H
-#define GARNETNETWORK_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__
#include <iostream>
#include <vector>
@@ -47,84 +47,83 @@ class NetDest;
class NetworkLink_d;
class CreditLink_d;
-class GarnetNetwork_d : public BaseGarnetNetwork {
-public:
+class GarnetNetwork_d : public BaseGarnetNetwork
+{
+ public:
typedef GarnetNetwork_dParams Params;
GarnetNetwork_d(const Params *p);
- ~GarnetNetwork_d();
-
- void init();
-
- 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(std::ostream& out) const;
- void printConfig(std::ostream& out) const;
- void print(std::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:
- 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;
-
- std::vector<bool> m_in_use;
- std::vector<bool> m_ordered;
-
- std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
- std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
-
- std::vector<Router_d *> m_router_ptr_vector; // All Routers in Network
- std::vector<NetworkLink_d *> m_link_ptr_vector; // All links in the network
- std::vector<CreditLink_d *> m_creditlink_ptr_vector; // All links in the network
- std::vector<NetworkInterface_d *> m_ni_ptr_vector; // All NI's in Network
-
-// Topology* m_topology_ptr;
- Time m_ruby_start;
+ ~GarnetNetwork_d();
+
+ void init();
+
+ 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(std::ostream& out) const;
+ void printConfig(std::ostream& out) const;
+ void print(std::ostream& out) const;
+
+ inline void increment_injected_flits() { m_flits_injected++; }
+ inline void increment_received_flits() { m_flits_received++; }
+
+ 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:
+ void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
+
+ GarnetNetwork_d(const GarnetNetwork_d& obj);
+ GarnetNetwork_d& operator=(const GarnetNetwork_d& obj);
+
+ // int m_virtual_networks;
+ // int m_nodes;
+ int m_flits_received, m_flits_injected;
+ double m_network_latency, m_queueing_latency;
+
+ std::vector<bool> m_in_use;
+ std::vector<bool> m_ordered;
+
+ std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
+ std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
+
+ std::vector<Router_d *> m_router_ptr_vector; // All Routers in Network
+ std::vector<NetworkLink_d *> m_link_ptr_vector; // All links in the network
+ std::vector<CreditLink_d *> m_creditlink_ptr_vector; // All links in net
+ std::vector<NetworkInterface_d *> m_ni_ptr_vector; // All NI's in Network
+
+ // Topology* m_topology_ptr;
+ Time m_ruby_start;
};
inline std::ostream&
@@ -135,4 +134,4 @@ operator<<(std::ostream& out, const GarnetNetwork_d& obj)
return out;
}
-#endif //GARNETNETWORK_D_H
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
index d41c3d4ee..057b11fe9 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
@@ -37,58 +37,65 @@ using m5::stl_helpers::deletePointers;
InputUnit_d::InputUnit_d(int id, Router_d *router)
{
- m_id = id;
- m_router = router;
- m_num_vcs = m_router->get_num_vcs();
+ m_id = id;
+ m_router = router;
+ m_num_vcs = m_router->get_num_vcs();
- m_num_buffer_reads = 0;
- m_num_buffer_writes = 0;
+ m_num_buffer_reads = 0;
+ m_num_buffer_writes = 0;
- creditQueue = new flitBuffer_d();
- // Instantiating the virtual channels
- m_vcs.resize(m_num_vcs);
- for(int i=0; i < m_num_vcs; i++)
- {
- m_vcs[i] = new VirtualChannel_d(i);
- }
+ creditQueue = new flitBuffer_d();
+ // Instantiating the virtual channels
+ m_vcs.resize(m_num_vcs);
+ for (int i=0; i < m_num_vcs; i++) {
+ m_vcs[i] = new VirtualChannel_d(i);
+ }
}
InputUnit_d::~InputUnit_d()
{
- delete creditQueue;
- deletePointers(m_vcs);
+ delete creditQueue;
+ deletePointers(m_vcs);
}
-void InputUnit_d::wakeup()
+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
+ 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_);
+ // Do the route computation for this vc
+ m_router->route_req(t_flit, this, vc);
+
+ m_vcs[vc]->set_enqueue_time(g_eventQueue_ptr->getTime());
+ } else {
+ t_flit->advance_stage(SA_);
+ m_router->swarb_req();
}
-}
+ // write flit into input buffer
+ m_vcs[vc]->insertFlit(t_flit);
-void InputUnit_d::printConfig(ostream& out)
+ // number of writes same as reads
+ // any flit that is written will be read only once
+ m_num_buffer_writes++;
+ m_num_buffer_reads++;
+ }
+}
+
+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;
+ 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
index 4f02729ed..bb2b7aa82 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef INPUT_UNIT_D_H
-#define INPUT_UNIT_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_INPUT_UNIT_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_INPUT_UNIT_D_HH__
#include <iostream>
#include <vector>
@@ -43,127 +43,148 @@
class Router_d;
-class InputUnit_d : public Consumer {
-public:
- InputUnit_d(int id, Router_d *router);
- ~InputUnit_d();
-
- void wakeup();
- void printConfig(std::ostream& out);
- flitBuffer_d* getCreditQueue() { return creditQueue; }
- void print(std::ostream& out) const {};
-
- inline int get_inlink_id()
- {
- return m_in_link->get_id();
- }
-
- inline void set_vc_state(VC_state_type state, int vc)
- {
- 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
- std::vector<VirtualChannel_d *> m_vcs; // [vc]
+class InputUnit_d : public Consumer
+{
+ public:
+ InputUnit_d(int id, Router_d *router);
+ ~InputUnit_d();
+
+ void wakeup();
+ void printConfig(std::ostream& out);
+ flitBuffer_d* getCreditQueue() { return creditQueue; }
+ void print(std::ostream& out) const {};
+
+ inline int get_inlink_id() { return m_in_link->get_id(); }
+
+ inline void
+ set_vc_state(VC_state_type state, int vc)
+ {
+ 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
+ std::vector<VirtualChannel_d *> m_vcs;
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_INPUT_UNIT_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
index 3cda065ad..a33776c17 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
@@ -39,139 +39,153 @@
using namespace std;
using m5::stl_helpers::deletePointers;
-NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks, GarnetNetwork_d *network_ptr)
+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->getVCsPerClass();
- m_num_vcs = m_vc_per_vnet*m_virtual_networks;
-
- m_vc_round_robin = 0;
- m_ni_buffers.resize(m_num_vcs);
- m_ni_enqueue_time.resize(m_num_vcs);
- inNode_ptr.resize(m_virtual_networks);
- outNode_ptr.resize(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.resize(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.push_back(new OutVcState_d(i, m_net_ptr));
- m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
- }
+ m_id = id;
+ m_net_ptr = network_ptr;
+ m_virtual_networks = virtual_networks;
+ m_vc_per_vnet = m_net_ptr->getVCsPerClass();
+ m_num_vcs = m_vc_per_vnet*m_virtual_networks;
+
+ m_vc_round_robin = 0;
+ m_ni_buffers.resize(m_num_vcs);
+ m_ni_enqueue_time.resize(m_num_vcs);
+ inNode_ptr.resize(m_virtual_networks);
+ outNode_ptr.resize(m_virtual_networks);
+ creditQueue = new flitBuffer_d();
+
+ // instantiating the NI flit buffers
+ for (int i = 0; i < m_num_vcs; i++) {
+ m_ni_buffers[i] = new flitBuffer_d();
+ m_ni_enqueue_time[i] = INFINITE_;
+ }
+ m_vc_allocator.resize(m_virtual_networks); // 1 allocator per vnet
+ for (int i = 0; i < m_virtual_networks; i++) {
+ m_vc_allocator[i] = 0;
+ }
+
+ for (int i = 0; i < m_num_vcs; i++) {
+ m_out_vc_state.push_back(new OutVcState_d(i, m_net_ptr));
+ m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+ }
}
NetworkInterface_d::~NetworkInterface_d()
{
- deletePointers(m_out_vc_state);
- deletePointers(m_ni_buffers);
- delete creditQueue;
- delete outSrcQueue;
+ deletePointers(m_out_vc_state);
+ deletePointers(m_ni_buffers);
+ delete creditQueue;
+ delete outSrcQueue;
}
-void NetworkInterface_d::addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link)
+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);
+ 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)
+void
+NetworkInterface_d::addOutPort(NetworkLink_d *out_link,
+ CreditLink_d *credit_link)
{
- m_credit_link = credit_link;
- credit_link->setLinkConsumer(this);
+ m_credit_link = credit_link;
+ credit_link->setLinkConsumer(this);
- outNetLink = out_link;
- outSrcQueue = new flitBuffer_d();
- out_link->setSourceQueue(outSrcQueue);
+ outNetLink = out_link;
+ outSrcQueue = new flitBuffer_d();
+ out_link->setSourceQueue(outSrcQueue);
}
-void NetworkInterface_d::addNode(vector<MessageBuffer*>& in, vector<MessageBuffer*>& out)
+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
- }
+ ASSERT(in.size() == m_virtual_networks);
+ inNode_ptr = in;
+ outNode_ptr = out;
+ for (int j = 0; j < m_virtual_networks; j++) {
+
+ // the protocol injects messages into the NI
+ inNode_ptr[j]->setConsumer(this);
+ }
}
-bool NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet)
+bool
+NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet)
{
- NetworkMessage *net_msg_ptr =
- safe_cast<NetworkMessage *>(msg_ptr.get());
- 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->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->clone();
- NodeID destID = dest_nodes[ctr];
-
- NetworkMessage *new_net_msg_ptr =
- safe_cast<NetworkMessage *>(new_msg_ptr.get());
- if(dest_nodes.size() > 1)
- {
- NetDest personal_dest;
- for(int m = 0; m < (int) MachineType_NUM; m++)
- {
- if((destID >= MachineType_base_number((MachineType) m)) && destID < MachineType_base_number((MachineType) (m+1)))
- {
- // calculating the NetDest associated with this 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->getTime());
- m_ni_buffers[vc]->insert(fl);
+ NetworkMessage *net_msg_ptr = safe_cast<NetworkMessage *>(msg_ptr.get());
+ NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
+
+ // gets all the destinations associated with this message.
+ vector<NodeID> dest_nodes = net_msg_dest.getAllDest();
+
+ // Number of flits is dependent on the link bandwidth available.
+ // This is expressed in terms of bytes/cycle or the flit size
+ int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(
+ net_msg_ptr->getMessageSize())/m_net_ptr->getFlitSize() );
+
+ // loop to convert all multicast messages into unicast messages
+ for (int ctr = 0; ctr < dest_nodes.size(); ctr++) {
+
+ // this will return a free output virtual channel
+ int vc = calculateVC(vnet);
+
+ if (vc == -1) {
+ return false ;
+ }
+ MsgPtr new_msg_ptr = msg_ptr->clone();
+ NodeID destID = dest_nodes[ctr];
+
+ NetworkMessage *new_net_msg_ptr =
+ safe_cast<NetworkMessage *>(new_msg_ptr.get());
+ if (dest_nodes.size() > 1) {
+ NetDest personal_dest;
+ for (int m = 0; m < (int) MachineType_NUM; m++) {
+ if ((destID >= MachineType_base_number((MachineType) m)) &&
+ destID < MachineType_base_number((MachineType) (m+1))) {
+ // calculating the NetDest associated with this destID
+ personal_dest.clear();
+ personal_dest.add((MachineID) {(MachineType) m, (destID -
+ MachineType_base_number((MachineType) m))});
+ new_net_msg_ptr->getInternalDestination() = personal_dest;
+ break;
}
- m_ni_enqueue_time[vc] = g_eventQueue_ptr->getTime();
- m_out_vc_state[vc]->setState(ACTIVE_, g_eventQueue_ptr->getTime());
+ }
+ net_msg_dest.removeNetDest(personal_dest);
+ // removing the destination from the original message to reflect
+ // that a message with this particular destination has been
+ // flitisized and an output vc is acquired
+ net_msg_ptr->getInternalDestination().removeNetDest(personal_dest);
+ }
+ 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->getTime());
+ m_ni_buffers[vc]->insert(fl);
}
- return true ;
+ 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)
+int
+NetworkInterface_d::calculateVC(int vnet)
{
- for(int i = 0; i < m_vc_per_vnet; i++)
- {
+ 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()))
- {
+ if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState(
+ IDLE_, g_eventQueue_ptr->getTime())) {
return ((vnet*m_vc_per_vnet) + delta);
}
}
@@ -179,176 +193,178 @@ int NetworkInterface_d::calculateVC(int vnet)
}
/*
- * 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.
+ * 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()
+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;
- }
- }
+ 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
+ // can pick up a message/cycle for each virtual net
+ for (int vnet = 0; vnet < m_virtual_networks; vnet++) {
+ 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->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;
+ }
+
+ 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;
+ // When we are doing network only testing, the messages do not
+ // have to be buffered into the protocol buffers
+ if (!m_net_ptr->isNetworkTesting()) {
+ outNode_ptr[t_flit->get_vnet()]->
+ enqueue(t_flit->get_msg_ptr(), 1);
+ }
}
-
- /****************** 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;
- }
+ // Simply send a credit back since we are not buffering
+ // this flit in the NI
+ flit_d *credit_flit = new flit_d(t_flit->get_vc(), free_signal);
+ creditQueue->insert(credit_flit);
+ g_eventQueue_ptr->scheduleEvent(m_ni_credit_link, 1);
+
+ m_net_ptr->increment_received_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
+/** This function looks at the NI buffers
+ * if some buffer has flits which are ready to traverse the link in the next
+ * cycle, and the downstream output vc associated with this flit has buffers
+ * left, the link is scheduled for the next cycle
+ */
-void NetworkInterface_d::scheduleOutputLink()
+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_;
+ int vc = m_vc_round_robin;
+ m_vc_round_robin++;
+ if (m_vc_round_robin == m_num_vcs)
+ m_vc_round_robin = 0;
+
+ for (int i = 0; i < m_num_vcs; i++) {
+ vc++;
+ if (vc == m_num_vcs)
+ vc = 0;
+
+ // model buffer backpressure
+ if (m_ni_buffers[vc]->isReady() && m_out_vc_state[vc]->has_credits()) {
+ bool is_candidate_vc = true;
+ int t_vnet = get_vnet(vc);
+ int vc_base = t_vnet * m_vc_per_vnet;
+
+ if (m_net_ptr->isVNetOrdered(t_vnet)) {
+ for (int vc_offset = 0; vc_offset < m_vc_per_vnet;
+ vc_offset++) {
+ int t_vc = vc_base + vc_offset;
+ if (m_ni_buffers[t_vc]->isReady()) {
+ if (m_ni_enqueue_time[t_vc] < m_ni_enqueue_time[vc]) {
+ is_candidate_vc = false;
+ break;
}
- return;
+ }
}
+ }
+ if (!is_candidate_vc)
+ continue;
+
+ m_out_vc_state[vc]->decrement_credit();
+ // Just removing the flit
+ flit_d *t_flit = m_ni_buffers[vc]->getTopFlit();
+ t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
+ outSrcQueue->insert(t_flit);
+ // schedule the out link
+ g_eventQueue_ptr->scheduleEvent(outNetLink, 1);
+
+ 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)
+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;
- }
+ 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;
+ }
+ ERROR_MSG("Could not determine vc");
+ return -1;
}
-void NetworkInterface_d::checkReschedule()
+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 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;
- }
+ }
+ 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(std::ostream& out) const
+void
+NetworkInterface_d::printConfig(std::ostream& out) const
{
- out << "[Network Interface " << m_id << "] - ";
- out << "[inLink " << inNetLink->get_id() << "] - ";
- out << "[outLink " << outNetLink->get_id() << "]" << std::endl;
+ out << "[Network Interface " << m_id << "] - ";
+ out << "[inLink " << inNetLink->get_id() << "] - ";
+ out << "[outLink " << outNetLink->get_id() << "]" << std::endl;
}
-void NetworkInterface_d::print(std::ostream& out) const
+void
+NetworkInterface_d::print(std::ostream& out) const
{
- out << "[Network Interface]";
+ 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
index 0da162f82..f1a577e4c 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef NET_INTERFACE_D_H
-#define NET_INTERFACE_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_INTERFACE_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_INTERFACE_D_HH__
#include <iostream>
#include <vector>
@@ -46,49 +46,53 @@ class NetworkMessage;
class MessageBuffer;
class flitBuffer_d;
-class NetworkInterface_d : public Consumer {
-public:
- NetworkInterface_d(int id, int virtual_networks, GarnetNetwork_d* network_ptr);
+class NetworkInterface_d : public Consumer
+{
+ public:
+ NetworkInterface_d(int id, int virtual_networks,
+ GarnetNetwork_d* network_ptr);
- ~NetworkInterface_d();
+ ~NetworkInterface_d();
- void addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link);
- void addOutPort(NetworkLink_d *out_link, CreditLink_d *credit_link);
+ void addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link);
+ void addOutPort(NetworkLink_d *out_link, CreditLink_d *credit_link);
- void wakeup();
- void addNode(std::vector<MessageBuffer *> &inNode,
- std::vector<MessageBuffer *> &outNode);
- void printConfig(std::ostream& out) const;
- void print(std::ostream& out) const;
- int get_vnet(int vc);
+ void wakeup();
+ void addNode(std::vector<MessageBuffer *> &inNode,
+ std::vector<MessageBuffer *> &outNode);
+ void printConfig(std::ostream& out) const;
+ void print(std::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;
- std::vector<OutVcState_d *> m_out_vc_state;
- std::vector<int > m_vc_allocator;
- int m_vc_round_robin; // For round robin scheduling
- flitBuffer_d *outSrcQueue; // For modelling link contention
- flitBuffer_d *creditQueue;
+ private:
+ GarnetNetwork_d *m_net_ptr;
+ int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
+ NodeID m_id;
+ std::vector<OutVcState_d *> m_out_vc_state;
+ std::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;
+ NetworkLink_d *inNetLink;
+ NetworkLink_d *outNetLink;
+ CreditLink_d *m_credit_link;
+ CreditLink_d *m_ni_credit_link;
- // Input Flit Buffers
- std::vector<flitBuffer_d *> m_ni_buffers; // The flit buffers which will serve the Consumer
- std::vector<Time > m_ni_enqueue_time;
+ // Input Flit Buffers
+ // The flit buffers which will serve the Consumer
+ std::vector<flitBuffer_d *> m_ni_buffers;
+ std::vector<Time> m_ni_enqueue_time;
- std::vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
- std::vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
+ // The Message buffers that takes messages from the protocol
+ std::vector<MessageBuffer *> inNode_ptr;
+ // The Message buffers that provides messages to the protocol
+ std::vector<MessageBuffer *> outNode_ptr;
- bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
- int calculateVC(int vnet);
- void scheduleOutputLink();
- void checkReschedule();
+ bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
+ int calculateVC(int vnet);
+ void scheduleOutputLink();
+ void checkReschedule();
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_INTERFACE_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
index b45a7be06..518281414 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
@@ -31,68 +31,61 @@
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.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.resize(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.resize(m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks());
+ m_net_ptr = net_ptr;
+ m_id = id;
+ m_latency = link_latency;
+ linkBuffer = new flitBuffer_d();
+ m_link_utilized = 0;
+ m_vc_load.resize(m_net_ptr->getVCsPerClass() *
+ net_ptr->getNumberOfVirtualNetworks());
- for(int i = 0; i < m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks(); i++)
- m_vc_load[i] = 0;
+ for (int i = 0;
+ i < m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks();
+ i++) {
+ m_vc_load[i] = 0;
+ }
}
NetworkLink_d::~NetworkLink_d()
{
- delete linkBuffer;
+ delete linkBuffer;
}
-void NetworkLink_d::setLinkConsumer(Consumer *consumer)
+void
+NetworkLink_d::setLinkConsumer(Consumer *consumer)
{
- link_consumer = consumer;
+ link_consumer = consumer;
}
-void NetworkLink_d::setSourceQueue(flitBuffer_d *srcQueue)
+void
+NetworkLink_d::setSourceQueue(flitBuffer_d *srcQueue)
{
- link_srcQueue = srcQueue;
+ link_srcQueue = srcQueue;
}
-void NetworkLink_d::wakeup()
+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()]++;
- }
+ 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()]++;
+ }
}
-std::vector<int> NetworkLink_d::getVcLoad()
+std::vector<int>
+NetworkLink_d::getVcLoad()
{
- return m_vc_load;
+ return m_vc_load;
}
-int NetworkLink_d::getLinkUtilization()
+int
+NetworkLink_d::getLinkUtilization()
{
- return m_link_utilized;
+ 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
index 39fdd3c6f..8f64baa37 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef NETWORK_LINK_D_H
-#define NETWORK_LINK_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_LINK_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_LINK_D_HH__
#include <iostream>
#include <vector>
@@ -41,48 +41,39 @@
class GarnetNetwork_d;
-class NetworkLink_d : public Consumer {
-public:
- //NetworkLink_d(int id);
- ~NetworkLink_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(std::ostream& out) const{}
- int getLinkUtilization();
- std::vector<int> getVcLoad();
- int get_id(){return m_id;}
- void wakeup();
+ NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr);
+ void setLinkConsumer(Consumer *consumer);
+ void setSourceQueue(flitBuffer_d *srcQueue);
+ void print(std::ostream& out) const{}
+ int getLinkUtilization();
+ std::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();
- }
+ 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;
+ 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;
- std::vector<int> m_vc_load;
- int m_flit_width;
+ flitBuffer_d *linkBuffer;
+ Consumer *link_consumer;
+ flitBuffer_d *link_srcQueue;
+ int m_link_utilized;
+ std::vector<int> m_vc_load;
+ int m_flit_width;
};
-#endif
-
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_NETWORK_LINK_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
index 921f8701a..202a4537e 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
@@ -33,9 +33,9 @@
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->getBufferSize();
+ m_network_ptr = network_ptr;
+ m_id = id;
+ m_vc_state = IDLE_;
+ m_time = g_eventQueue_ptr->getTime();
+ m_credit_count = m_network_ptr->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
index a6b063d4a..f3fb4384a 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh
@@ -28,56 +28,45 @@
* Authors: Niket Agarwal
*/
-#ifndef OUT_VC_STATE_D_H
-#define OUT_VC_STATE_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
-class OutVcState_d {
-public:
- OutVcState_d(int id, GarnetNetwork_d *network_ptr);
+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; }
+ 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--; }
- 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;
+ 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
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
index 6e0508e75..c2fba3ffd 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
@@ -37,73 +37,83 @@ using m5::stl_helpers::deletePointers;
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();
+ m_id = id;
+ m_router = router;
+ m_num_vcs = m_router->get_num_vcs();
+ m_out_buffer = new flitBuffer_d();
- for(int i = 0; i < m_num_vcs; i++)
- {
- m_outvc_state.push_back(new OutVcState_d(i, m_router->get_net_ptr()));
- }
+ for (int i = 0; i < m_num_vcs; i++) {
+ m_outvc_state.push_back(new OutVcState_d(i, m_router->get_net_ptr()));
+ }
}
OutputUnit_d::~OutputUnit_d()
{
- delete m_out_buffer;
- deletePointers(m_outvc_state);
+ delete m_out_buffer;
+ deletePointers(m_outvc_state);
}
-void OutputUnit_d::decrement_credit(int out_vc)
+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());
+ 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()
+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 (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);
+ if (t_flit->is_free_signal())
+ set_vc_state(IDLE_, out_vc);
- delete t_flit;
- }
+ delete t_flit;
+ }
}
-flitBuffer_d* OutputUnit_d::getOutQueue()
+flitBuffer_d*
+OutputUnit_d::getOutQueue()
{
- return m_out_buffer;
+ return m_out_buffer;
}
-void OutputUnit_d::set_out_link(NetworkLink_d *link)
+void
+OutputUnit_d::set_out_link(NetworkLink_d *link)
{
- m_out_link = link;
+ m_out_link = link;
}
-void OutputUnit_d::set_credit_link(CreditLink_d *credit_link)
+void
+OutputUnit_d::set_credit_link(CreditLink_d *credit_link)
{
- m_credit_link = credit_link;
+ m_credit_link = credit_link;
}
-void OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
+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());
+ 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)
+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;
+ 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
index 3daf8a76c..98d6147de 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef OUTPUT_UNIT_D_H
-#define OUTPUT_UNIT_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUTPUT_UNIT_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUTPUT_UNIT_D_HH__
#include <iostream>
#include <vector>
@@ -43,51 +43,62 @@
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(std::ostream& out);
- void update_vc(int vc, int in_port, int in_vc);
- void print(std::ostream& out) const {};
- int get_credit_cnt(int vc) { return m_outvc_state[vc]->get_credit_count(); }
- void decrement_credit(int out_vc);
+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(std::ostream& out);
+ void update_vc(int vc, int in_port, int in_vc);
+ void print(std::ostream& out) const {};
+ void decrement_credit(int out_vc);
- inline int get_outlink_id()
- {
- return m_out_link->get_id();
- }
+ int
+ get_credit_cnt(int vc)
+ {
+ return m_outvc_state[vc]->get_credit_count();
+ }
- 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);
- }
+ 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()));
+ }
-private:
- int m_id;
- int m_num_vcs;
- Router_d *m_router;
- NetworkLink_d *m_out_link;
- CreditLink_d *m_credit_link;
+ inline void
+ insert_flit(flit_d *t_flit)
+ {
+ m_out_buffer->insert(t_flit);
+ g_eventQueue_ptr->scheduleEvent(m_out_link, 1);
+ }
- flitBuffer_d *m_out_buffer; // This is for the network link to consume
- std::vector<OutVcState_d *> m_outvc_state; // vc state of downstream router
+ private:
+ int m_id;
+ int m_num_vcs;
+ Router_d *m_router;
+ NetworkLink_d *m_out_link;
+ CreditLink_d *m_credit_link;
+
+ flitBuffer_d *m_out_buffer; // This is for the network link to consume
+ std::vector<OutVcState_d *> m_outvc_state; // vc state of downstream router
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUTPUT_UNIT_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
index e7b766dd7..44c3a5d64 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
@@ -45,122 +45,136 @@ using m5::stl_helpers::deletePointers;
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->getVCsPerClass();
- m_num_vcs = m_virtual_networks*m_vc_per_vnet;
- m_flit_width = m_network_ptr->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;
+ m_id = id;
+ m_network_ptr = network_ptr;
+ m_virtual_networks = network_ptr->getNumberOfVirtualNetworks();
+ m_vc_per_vnet = m_network_ptr->getVCsPerClass();
+ m_num_vcs = m_virtual_networks*m_vc_per_vnet;
+ m_flit_width = m_network_ptr->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()
{
- deletePointers(m_input_unit);
- deletePointers(m_output_unit);
- delete m_routing_unit;
- delete m_vc_alloc;
- delete m_sw_alloc;
- delete m_switch;
+ deletePointers(m_input_unit);
+ deletePointers(m_output_unit);
+ delete m_routing_unit;
+ delete m_vc_alloc;
+ delete m_sw_alloc;
+ delete m_switch;
}
-void Router_d::init()
+void
+Router_d::init()
{
- m_vc_alloc->init();
- m_sw_alloc->init();
- m_switch->init();
+ m_vc_alloc->init();
+ m_sw_alloc->init();
+ m_switch->init();
}
-void Router_d::addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link)
+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);
+ 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());
+ input_unit->set_in_link(in_link);
+ input_unit->set_credit_link(credit_link);
+ in_link->setLinkConsumer(input_unit);
+ credit_link->setSourceQueue(input_unit->getCreditQueue());
- m_input_unit.push_back(input_unit);
+ m_input_unit.push_back(input_unit);
}
-void Router_d::addOutPort(NetworkLink_d *out_link, const NetDest& routing_table_entry, int link_weight, CreditLink_d *credit_link)
+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);
+ 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());
+ output_unit->set_out_link(out_link);
+ output_unit->set_credit_link(credit_link);
+ credit_link->setLinkConsumer(output_unit);
+ out_link->setSourceQueue(output_unit->getOutQueue());
- m_output_unit.push_back(output_unit);
+ m_output_unit.push_back(output_unit);
- m_routing_unit->addRoute(routing_table_entry);
- m_routing_unit->addWeight(link_weight);
+ 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)
+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);
+ m_routing_unit->RC_stage(t_flit, in_unit, invc);
}
-void Router_d::vcarb_req()
+
+void
+Router_d::vcarb_req()
{
- g_eventQueue_ptr->scheduleEvent(m_vc_alloc, 1);
+ g_eventQueue_ptr->scheduleEvent(m_vc_alloc, 1);
}
-void Router_d::swarb_req()
+
+void
+Router_d::swarb_req()
{
- g_eventQueue_ptr->scheduleEvent(m_sw_alloc, 1);
+ g_eventQueue_ptr->scheduleEvent(m_sw_alloc, 1);
}
-void Router_d::update_incredit(int in_port, int in_vc, int credit)
+
+void
+Router_d::update_incredit(int in_port, int in_vc, int credit)
{
- m_input_unit[in_port]->update_credit(in_vc, credit);
+ m_input_unit[in_port]->update_credit(in_vc, credit);
}
-void Router_d::update_sw_winner(int inport, flit_d *t_flit)
+
+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);
+ m_switch->update_sw_winner(inport, t_flit);
+ g_eventQueue_ptr->scheduleEvent(m_switch, 1);
}
-void Router_d::calculate_performance_numbers()
+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();
+ 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)
+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;
+ 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
index f1b1e26aa..4af37cdbe 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef ROUTER_D_H
-#define ROUTER_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__
#include <iostream>
#include <vector>
@@ -49,51 +49,58 @@ class VCallocator_d;
class SWallocator_d;
class Switch_d;
-class Router_d {
-public:
- Router_d(int id, GarnetNetwork_d *network_ptr);
+class Router_d
+{
+ public:
+ Router_d(int id, GarnetNetwork_d *network_ptr);
- ~Router_d();
+ ~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(std::ostream& out);
- int get_id() { return m_id; }
- GarnetNetwork_d* get_net_ptr() { return m_network_ptr; }
+ 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);
- std::vector<InputUnit_d *>& get_inputUnit_ref() { return m_input_unit; }
- std::vector<OutputUnit_d *>& get_outputUnit_ref() { return m_output_unit; }
+ 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(); }
+ int get_id() { return m_id; }
- 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();
+ GarnetNetwork_d* get_net_ptr() { return m_network_ptr; }
+ std::vector<InputUnit_d *>& get_inputUnit_ref() { return m_input_unit; }
+ std::vector<OutputUnit_d *>& get_outputUnit_ref() { return m_output_unit; }
- void power_router_initialize(power_router *router, power_router_info *info);
+ 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 printConfig(std::ostream& out);
+
+ 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();
+ 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;
+ 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;
+ double buf_read_count, buf_write_count;
+ double crossbar_count;
+ double vc_local_arbit_count, vc_global_arbit_count;
+ double sw_local_arbit_count, sw_global_arbit_count;
- std::vector<InputUnit_d *> m_input_unit;
- std::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;
+ std::vector<InputUnit_d *> m_input_unit;
+ std::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
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTER_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc
index a152c35d7..5d7dc9015 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc
@@ -35,54 +35,55 @@
RoutingUnit_d::RoutingUnit_d(Router_d *router)
{
- m_router = router;
- m_routing_table.clear();
- m_weight_table.clear();
+ m_router = router;
+ m_routing_table.clear();
+ m_weight_table.clear();
}
-void RoutingUnit_d::addRoute(const NetDest& routing_table_entry)
+void
+RoutingUnit_d::addRoute(const NetDest& routing_table_entry)
{
- m_routing_table.push_back(routing_table_entry);
+ m_routing_table.push_back(routing_table_entry);
}
-void RoutingUnit_d::addWeight(int link_weight)
+void
+RoutingUnit_d::addWeight(int link_weight)
{
- m_weight_table.push_back(link_weight);
+ m_weight_table.push_back(link_weight);
}
-void RoutingUnit_d::RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc)
+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 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)
+int
+RoutingUnit_d::routeCompute(flit_d *t_flit)
{
- MsgPtr msg_ptr = t_flit->get_msg_ptr();
- NetworkMessage* net_msg_ptr =
- safe_cast<NetworkMessage*>(msg_ptr.get());
- NetDest msg_destination = net_msg_ptr->getInternalDestination();
+ MsgPtr msg_ptr = t_flit->get_msg_ptr();
+ NetworkMessage* net_msg_ptr = safe_cast<NetworkMessage *>(msg_ptr.get());
+ NetDest msg_destination = net_msg_ptr->getInternalDestination();
- int output_link = -1;
- int min_weight = INFINITE_;
+ 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];
- }
+ 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;
+ }
+
+ 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
index 409eb70f9..7ae216049 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef ROUTING_UNIT_D_H
-#define ROUTING_UNIT_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTING_UNIT_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTING_UNIT_D_HH__
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/common/Consumer.hh"
@@ -39,18 +39,19 @@
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);
+class RoutingUnit_d
+{
+ public:
+ RoutingUnit_d(Router_d *router);
+ void addRoute(const NetDest& routing_table_entry);
+ int routeCompute(flit_d *t_flit);
+ void addWeight(int link_weight);
+ void RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc);
-private:
- Router_d *m_router;
- std::vector<NetDest > m_routing_table;
- std::vector<int > m_weight_table;
+ private:
+ Router_d *m_router;
+ std::vector<NetDest> m_routing_table;
+ std::vector<int> m_weight_table;
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_ROUTING_UNIT_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
index c72a66189..17daad1de 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
@@ -36,190 +36,191 @@
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_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;
+ m_local_arbiter_activity = 0;
+ m_global_arbiter_activity = 0;
}
-void SWallocator_d::init()
+void
+SWallocator_d::init()
{
- m_input_unit = m_router->get_inputUnit_ref();
- m_output_unit = m_router->get_outputUnit_ref();
-
- m_num_inports = m_router->get_num_inports();
- m_num_outports = m_router->get_num_outports();
- m_round_robin_outport.resize(m_num_outports);
- m_round_robin_inport.resize(m_num_inports);
- m_port_req.resize(m_num_outports);
- m_vc_winners.resize(m_num_outports);
-
- for(int i = 0; i < m_num_inports; i++)
- {
- m_round_robin_inport[i] = 0;
- }
+ m_input_unit = m_router->get_inputUnit_ref();
+ m_output_unit = m_router->get_outputUnit_ref();
- for(int i = 0; i < m_num_outports; i++)
- {
- m_port_req[i].resize(m_num_inports);
- m_vc_winners[i].resize(m_num_inports);
+ m_num_inports = m_router->get_num_inports();
+ m_num_outports = m_router->get_num_outports();
+ m_round_robin_outport.resize(m_num_outports);
+ m_round_robin_inport.resize(m_num_inports);
+ m_port_req.resize(m_num_outports);
+ m_vc_winners.resize(m_num_outports);
- m_round_robin_outport[i] = 0;
+ for (int i = 0; i < m_num_inports; i++) {
+ m_round_robin_inport[i] = 0;
+ }
- for(int j = 0; j < m_num_inports; j++)
- {
- m_port_req[i][j] = false; // [outport][inport]
- }
+ for (int i = 0; i < m_num_outports; i++) {
+ m_port_req[i].resize(m_num_inports);
+ m_vc_winners[i].resize(m_num_inports);
+
+ m_round_robin_outport[i] = 0;
+
+ for (int j = 0; j < m_num_inports; j++) {
+ m_port_req[i][j] = false; // [outport][inport]
}
+ }
}
-void SWallocator_d::wakeup()
+void
+SWallocator_d::wakeup()
{
- arbitrate_inports(); // First stage of allocation
- arbitrate_outports(); // Second stage of allocation
+ arbitrate_inports(); // First stage of allocation
+ arbitrate_outports(); // Second stage of allocation
- clear_request_vector();
- check_for_wakeup();
+ clear_request_vector();
+ check_for_wakeup();
}
-void SWallocator_d::arbitrate_inports()
+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
- }
- }
+ // First do round robin arbitration on a set of input vc requests
+ for (int inport = 0; inport < m_num_inports; inport++) {
+ int invc = m_round_robin_inport[inport];
+ 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)
+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;
- }
- }
+ 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;
+ }
+ return true;
}
-void SWallocator_d::arbitrate_outports()
+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
- }
+ // Now there are a set of input vc requests for output vcs.
+ // Again do round robin arbitration on these requests
+ for (int outport = 0; outport < m_num_outports; outport++) {
+ int 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;
+
+ // in_port has a request this cycle for outport:
+ if (m_port_req[outport][in_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);
+
+ // remove flit from Input Unit
+ flit_d *t_flit = m_input_unit[in_port]->getTopFlit(invc);
+ 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_) {
+ // Send a credit back
+ // along with the information that this VC is now idle
+ m_input_unit[in_port]->increment_credit(invc, true);
+ // This Input VC should now be empty
+ assert(m_input_unit[in_port]->isReady(invc) == false);
+
+ m_input_unit[in_port]->set_vc_state(IDLE_, invc);
+ m_input_unit[in_port]->set_enqueue_time(invc, INFINITE_);
+ } else {
+ // Send a credit back
+ // but do not indicate that the VC is idle
+ m_input_unit[in_port]->increment_credit(invc, false);
}
+ break; // got a in request for this outport
+ }
}
+ }
}
-void SWallocator_d::check_for_wakeup()
+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;
- }
- }
+ 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)
+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;
- }
+ 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;
+ }
+ ERROR_MSG("Could not determine vc");
+ return -1;
}
-void SWallocator_d::clear_request_vector()
+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;
- }
+ 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
index db175e445..66b522950 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef SW_ALLOCATOR_D_H
-#define SW_ALLOCATOR_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SW_ALLOCATOR_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SW_ALLOCATOR_D_HH__
#include <iostream>
#include <vector>
@@ -41,40 +41,44 @@ class Router_d;
class InputUnit_d;
class OutputUnit_d;
-class SWallocator_d : public Consumer {
-public:
- SWallocator_d(Router_d *router);
- void wakeup();
- void init();
- void clear_request_vector();
- void check_for_wakeup();
- int get_vnet (int invc);
- void print(std::ostream& out) const {};
- void arbitrate_inports();
- void arbitrate_outports();
- bool is_candidate_inport(int inport, int invc);
- inline double get_local_arbit_count()
- {
- return m_local_arbiter_activity;
- }
- inline double get_global_arbit_count()
- {
- return m_global_arbiter_activity;
- }
+class SWallocator_d : public Consumer
+{
+ public:
+ SWallocator_d(Router_d *router);
+ void wakeup();
+ void init();
+ void clear_request_vector();
+ void check_for_wakeup();
+ int get_vnet (int invc);
+ void print(std::ostream& out) const {};
+ void arbitrate_inports();
+ void arbitrate_outports();
+ bool is_candidate_inport(int inport, int invc);
-private:
- int m_num_inports, m_num_outports;
- int m_num_vcs, m_vc_per_vnet;
+ inline double
+ get_local_arbit_count()
+ {
+ return m_local_arbiter_activity;
+ }
+ inline double
+ get_global_arbit_count()
+ {
+ return m_global_arbiter_activity;
+ }
- double m_local_arbiter_activity, m_global_arbiter_activity;
+ private:
+ int m_num_inports, m_num_outports;
+ int m_num_vcs, m_vc_per_vnet;
- Router_d *m_router;
- std::vector<int> m_round_robin_outport;
- std::vector<int> m_round_robin_inport;
- std::vector<std::vector<bool> > m_port_req;
- std::vector<std::vector<int> > m_vc_winners; // a list for each outport
- std::vector<InputUnit_d *> m_input_unit;
- std::vector<OutputUnit_d *> m_output_unit;
+ double m_local_arbiter_activity, m_global_arbiter_activity;
+
+ Router_d *m_router;
+ std::vector<int> m_round_robin_outport;
+ std::vector<int> m_round_robin_inport;
+ std::vector<std::vector<bool> > m_port_req;
+ std::vector<std::vector<int> > m_vc_winners; // a list for each outport
+ std::vector<InputUnit_d *> m_input_unit;
+ std::vector<OutputUnit_d *> m_output_unit;
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SW_ALLOCATOR_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
index 22ec2c1f4..de57944f1 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
@@ -37,9 +37,9 @@ using m5::stl_helpers::deletePointers;
Switch_d::Switch_d(Router_d *router)
{
- m_router = router;
- m_num_vcs = m_router->get_num_vcs();
- m_crossbar_activity = 0;
+ m_router = router;
+ m_num_vcs = m_router->get_num_vcs();
+ m_crossbar_activity = 0;
}
Switch_d::~Switch_d()
@@ -47,50 +47,49 @@ Switch_d::~Switch_d()
deletePointers(m_switch_buffer);
}
-void Switch_d::init()
+void
+Switch_d::init()
{
- m_output_unit = m_router->get_outputUnit_ref();
+ m_output_unit = m_router->get_outputUnit_ref();
- m_num_inports = m_router->get_num_inports();
- m_switch_buffer.resize(m_num_inports);
- for(int i = 0; i < m_num_inports; i++)
- {
- m_switch_buffer[i] = new flitBuffer_d();
- }
+ m_num_inports = m_router->get_num_inports();
+ m_switch_buffer.resize(m_num_inports);
+ for (int i = 0; i < m_num_inports; i++) {
+ m_switch_buffer[i] = new flitBuffer_d();
+ }
}
-void Switch_d::wakeup()
+void
+Switch_d::wakeup()
{
- DEBUG_MSG(NETWORK_COMP, HighPrio, "Switch woke up");
- DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
+ 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);
- 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++;
- }
+ // This will take care of waking up the Network Link
+ m_output_unit[outport]->insert_flit(t_flit);
+ m_switch_buffer[inport]->getTopFlit();
+ m_crossbar_activity++;
}
- check_for_wakeup();
+ }
+ check_for_wakeup();
}
-void Switch_d::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;
- }
+ 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
index 83817b353..2ba761c69 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef SWITCH_D_H
-#define SWITCH_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SWITCH_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SWITCH_D_HH__
#include <iostream>
#include <vector>
@@ -41,31 +41,35 @@
class Router_d;
class OutputUnit_d;
-class Switch_d : public Consumer {
-public:
- Switch_d(Router_d *router);
- ~Switch_d();
- void wakeup();
- void init();
- void check_for_wakeup();
- void print(std::ostream& out) const {};
- inline void update_sw_winner(int inport, flit_d *t_flit)
- {
- m_switch_buffer[inport]->insert(t_flit);
- }
- inline double get_crossbar_count()
- {
- return m_crossbar_activity;
- }
+class Switch_d : public Consumer
+{
+ public:
+ Switch_d(Router_d *router);
+ ~Switch_d();
+ void wakeup();
+ void init();
+ void check_for_wakeup();
+ void print(std::ostream& out) const {};
+ inline void
+ update_sw_winner(int inport, flit_d *t_flit)
+ {
+ m_switch_buffer[inport]->insert(t_flit);
+ }
-private:
- int m_num_vcs;
- int m_num_inports;
- double m_crossbar_activity;
- Router_d *m_router;
- std::vector<flitBuffer_d *> m_switch_buffer;
- std::vector<OutputUnit_d *> m_output_unit;
+ 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;
+ std::vector<flitBuffer_d *> m_switch_buffer;
+ std::vector<OutputUnit_d *> m_output_unit;
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_SWITCH_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
index af1c608eb..b3954e3bc 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
@@ -36,230 +36,224 @@
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;
+ 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()
+void
+VCallocator_d::init()
{
- m_input_unit = m_router->get_inputUnit_ref();
- m_output_unit = m_router->get_outputUnit_ref();
+ m_input_unit = m_router->get_inputUnit_ref();
+ m_output_unit = m_router->get_outputUnit_ref();
- m_num_inports = m_router->get_num_inports();
- m_num_outports = m_router->get_num_outports();
- m_round_robin_invc.resize(m_num_inports);
- m_round_robin_outvc.resize(m_num_outports);
- m_outvc_req.resize(m_num_outports);
- m_outvc_is_req.resize(m_num_outports);
+ m_num_inports = m_router->get_num_inports();
+ m_num_outports = m_router->get_num_outports();
+ m_round_robin_invc.resize(m_num_inports);
+ m_round_robin_outvc.resize(m_num_outports);
+ m_outvc_req.resize(m_num_outports);
+ m_outvc_is_req.resize(m_num_outports);
- for(int i = 0; i < m_num_inports; i++)
- {
- m_round_robin_invc[i].resize(m_num_vcs);
+ for (int i = 0; i < m_num_inports; i++) {
+ m_round_robin_invc[i].resize(m_num_vcs);
- for(int j = 0; j < m_num_vcs; j++)
- {
- m_round_robin_invc[i][j] = 0;
- }
+ for (int j = 0; j < m_num_vcs; j++) {
+ m_round_robin_invc[i][j] = 0;
}
+ }
- for(int i = 0; i < m_num_outports; i++)
- {
- m_round_robin_outvc[i].resize(m_num_vcs);
- m_outvc_req[i].resize(m_num_vcs);
- m_outvc_is_req[i].resize(m_num_vcs);
+ for (int i = 0; i < m_num_outports; i++) {
+ m_round_robin_outvc[i].resize(m_num_vcs);
+ m_outvc_req[i].resize(m_num_vcs);
+ m_outvc_is_req[i].resize(m_num_vcs);
- for(int j = 0; j < m_num_vcs; j++)
- {
- m_round_robin_outvc[i][j].first = 0;
- m_round_robin_outvc[i][j].second = 0;
- m_outvc_is_req[i][j] = false;
+ for (int j = 0; j < m_num_vcs; j++) {
+ m_round_robin_outvc[i][j].first = 0;
+ m_round_robin_outvc[i][j].second = 0;
+ m_outvc_is_req[i][j] = false;
- m_outvc_req[i][j].resize(m_num_inports);
+ m_outvc_req[i][j].resize(m_num_inports);
- for(int k = 0; k < m_num_inports; k++)
- {
- m_outvc_req[i][j][k].resize(m_num_vcs);
- for(int l = 0; l < m_num_vcs; l++)
- {
- m_outvc_req[i][j][k][l] = false;
- }
- }
+ for (int k = 0; k < m_num_inports; k++) {
+ m_outvc_req[i][j][k].resize(m_num_vcs);
+ for (int l = 0; l < m_num_vcs; l++) {
+ m_outvc_req[i][j][k][l] = false;
}
+ }
}
+ }
}
-void VCallocator_d::clear_request_vector()
+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;
- }
- }
+ 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()
+void
+VCallocator_d::wakeup()
{
- arbitrate_invcs(); // First stage of allocation
- arbitrate_outvcs(); // Second stage of allocation
+ arbitrate_invcs(); // First stage of allocation
+ arbitrate_outvcs(); // Second stage of allocation
- clear_request_vector();
- check_for_wakeup();
+ clear_request_vector();
+ check_for_wakeup();
}
-bool VCallocator_d::is_invc_candidate(int inport_iter, int invc_iter)
+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 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;
+ 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;
- }
- }
+ 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;
+ }
+ return true;
}
-void VCallocator_d::select_outvc(int inport_iter, int invc_iter)
+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 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]++;
+ 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;
+ 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
- }
+ 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()
+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;
+ 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);
- }
- }
+ select_outvc(inport_iter, invc_iter);
+ }
}
+ }
}
-void VCallocator_d::arbitrate_outvcs()
+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;
+ 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;
+ 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;
- }
- }
+ 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)
+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;
- }
+ 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;
+ }
+ ERROR_MSG("Could not determine vc");
+ return -1;
}
-void VCallocator_d::check_for_wakeup()
+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;
- }
- }
+ 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
index 942a3c6b0..3d3e9a4e6 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef VC_ALLOCATOR_D_H
-#define VC_ALLOCATOR_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VC_ALLOCATOR_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VC_ALLOCATOR_D_HH__
#include <iostream>
#include <vector>
@@ -42,44 +42,57 @@ class Router_d;
class InputUnit_d;
class OutputUnit_d;
-class VCallocator_d : public Consumer {
-public:
- VCallocator_d(Router_d *router);
- void init();
- void wakeup();
- void check_for_wakeup();
- void clear_request_vector();
- int get_vnet(int invc);
- void print(std::ostream& out) const {};
- void arbitrate_invcs();
- void arbitrate_outvcs();
- bool is_invc_candidate(int inport_iter, int invc_iter);
- void select_outvc(int inport_iter, int invc_iter);
- 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;
- std::vector<std::vector<int > > m_round_robin_invc; // First stage of arbitration where all vcs select an output vc to content for
- std::vector<std::vector<std::pair<int, int> > > m_round_robin_outvc; // Arbiter for every output vc
- std::vector<std::vector<std::vector<std::vector<bool> > > > m_outvc_req; // [outport][outvc][inpotr][invc]. set true in the first phase of allocation
- std::vector<std::vector<bool> > m_outvc_is_req;
-
- std::vector<InputUnit_d *> m_input_unit ;
- std::vector<OutputUnit_d *> m_output_unit ;
+class VCallocator_d : public Consumer
+{
+ public:
+ VCallocator_d(Router_d *router);
+ void init();
+ void wakeup();
+ void check_for_wakeup();
+ void clear_request_vector();
+ int get_vnet(int invc);
+ void print(std::ostream& out) const {}
+ void arbitrate_invcs();
+ void arbitrate_outvcs();
+ bool is_invc_candidate(int inport_iter, int invc_iter);
+ void select_outvc(int inport_iter, int invc_iter);
+ 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;
+
+ // First stage of arbitration
+ // where all vcs select an output vc to contend for
+ std::vector<std::vector<int> > m_round_robin_invc;
+
+ // Arbiter for every output vc
+ std::vector<std::vector<std::pair<int, int> > > m_round_robin_outvc;
+
+ // [outport][outvc][inport][invc]
+ // set true in the first phase of allocation
+ std::vector<std::vector<std::vector<std::vector<bool> > > > m_outvc_req;
+
+ std::vector<std::vector<bool> > m_outvc_is_req;
+
+ std::vector<InputUnit_d *> m_input_unit;
+ std::vector<OutputUnit_d *> m_output_unit;
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VC_ALLOCATOR_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
index 94e78196c..a36e58771 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
@@ -32,56 +32,57 @@
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_;
+ 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;
+ delete m_input_buffer;
}
-void VirtualChannel_d::set_outport(int outport)
+void
+VirtualChannel_d::set_outport(int outport)
{
- route = outport;
+ route = outport;
}
-void VirtualChannel_d::grant_vc(int out_vc)
+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_);
+ 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)
+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)) ;
- }
+ 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;
+ }
+ return false;
}
-bool VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage)
+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)) ;
- }
+ 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;
+ }
+ 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
index 645506af7..075e2ee02 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
@@ -28,89 +28,69 @@
* Authors: Niket Agarwal
*/
-#ifndef VIRTUAL_CHANNEL_D_H
-#define VIRTUAL_CHANNEL_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VIRTUAL_CHANNEL_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VIRTUAL_CHANNEL_D_HH__
#include <utility>
#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();
+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);
+ 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 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 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 set_enqueue_time(Time time)
- {
- m_enqueue_time = time;
- }
+ inline bool isReady() { return m_input_buffer->isReady(); }
- 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 void
+ insertFlit(flit_d *t_flit)
+ {
+ m_input_buffer->insert(t_flit);
+ }
- inline flit_d* peekTopFlit()
- {
- return m_input_buffer->peekTopFlit();
- }
+ 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* getTopFlit()
- {
- return m_input_buffer->getTopFlit();
- }
+ inline flit_d*
+ peekTopFlit()
+ {
+ return m_input_buffer->peekTopFlit();
+ }
-private:
- int m_id;
- flitBuffer_d *m_input_buffer;
- std::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;
+ inline flit_d*
+ getTopFlit()
+ {
+ return m_input_buffer->getTopFlit();
+ }
+
+ private:
+ int m_id;
+ flitBuffer_d *m_input_buffer;
+ std::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
+
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_VIRTUAL_CHANNEL_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
index 5387604d4..bba917597 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
@@ -32,52 +32,56 @@
flitBuffer_d::flitBuffer_d()
{
- max_size = INFINITE_;
+ max_size = INFINITE_;
}
flitBuffer_d::flitBuffer_d(int maximum_size)
{
- max_size = maximum_size;
+ max_size = maximum_size;
}
-bool flitBuffer_d::isEmpty()
+bool
+flitBuffer_d::isEmpty()
{
- return (m_buffer.size() == 0);
+ return (m_buffer.size() == 0);
}
-bool flitBuffer_d::isReady()
+bool
+flitBuffer_d::isReady()
{
- if(m_buffer.size() != 0 )
- {
- flit_d *t_flit = peekTopFlit();
- if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
- return true;
- }
- return false;
+ if (m_buffer.size() != 0 ) {
+ flit_d *t_flit = peekTopFlit();
+ if (t_flit->get_time() <= g_eventQueue_ptr->getTime())
+ return true;
+ }
+ return false;
}
-bool flitBuffer_d::isReadyForNext()
+bool
+flitBuffer_d::isReadyForNext()
{
- if(m_buffer.size() != 0 )
- {
- flit_d *t_flit = peekTopFlit();
- if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
- return true;
- }
- return false;
+ if (m_buffer.size() != 0 ) {
+ flit_d *t_flit = peekTopFlit();
+ if (t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
+ return true;
+ }
+ return false;
}
-void flitBuffer_d::print(std::ostream& out) const
+void
+flitBuffer_d::print(std::ostream& out) const
{
- out << "[flitBuffer: ";
- out << m_buffer.size() << "] " << std::endl;
+ out << "[flitBuffer: " << m_buffer.size() << "] " << std::endl;
}
-bool flitBuffer_d::isFull()
+bool
+flitBuffer_d::isFull()
{
- return (m_buffer.size() >= max_size);
+ return (m_buffer.size() >= max_size);
}
-void flitBuffer_d::setMaxSize(int maximum)
+
+void
+flitBuffer_d::setMaxSize(int maximum)
{
- max_size = 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
index 8aa869f82..3cfd9144f 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef FLIT_BUFFER_D_H
-#define FLIT_BUFFER_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_BUFFER_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_BUFFER_D_HH__
#include <algorithm>
#include <iostream>
@@ -38,38 +38,44 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
-class flitBuffer_d {
-public:
- flitBuffer_d();
- flitBuffer_d(int maximum_size);
+class flitBuffer_d
+{
+ public:
+ flitBuffer_d();
+ flitBuffer_d(int maximum_size);
+
+ bool isReady();
+ bool isReadyForNext();
+ bool isEmpty();
+ void print(std::ostream& out) const;
+ bool isFull();
+ void setMaxSize(int maximum);
+
+ flit_d *
+ getTopFlit()
+ {
+ flit_d *f = m_buffer.front();
+ std::pop_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
+ m_buffer.pop_back();
+ return f;
+ }
- bool isReady();
- bool isReadyForNext();
- bool isEmpty();
- void print(std::ostream& out) const;
- bool isFull();
- void setMaxSize(int maximum);
+ flit_d *
+ peekTopFlit()
+ {
+ return m_buffer.front();
+ }
- inline flit_d* getTopFlit()
- {
- flit_d *f = m_buffer.front();
- std::pop_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
- m_buffer.pop_back();
- return f;
- }
- inline flit_d* peekTopFlit()
- {
- return m_buffer.front();
- }
- inline void insert(flit_d *flt)
- {
- m_buffer.push_back(flt);
- std::push_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
- }
- /**********Data Members*********/
-private:
- std::vector<flit_d *> m_buffer;
- int size, max_size;
+ void
+ insert(flit_d *flt)
+ {
+ m_buffer.push_back(flt);
+ std::push_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
+ }
+
+ private:
+ std::vector<flit_d *> m_buffer;
+ int size, max_size;
};
inline std::ostream&
@@ -80,5 +86,4 @@ operator<<(std::ostream& out, const flitBuffer_d& obj)
return out;
}
-#endif
-
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_BUFFER_D_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
index 2e73cdc72..774b1bc62 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
@@ -32,98 +32,44 @@
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;
+ 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_;
+ 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();
+ 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(std::ostream& out) const
-{
- out << "[flit:: ";
- out << "Id=" << m_id << " ";
- out << "Type=" << m_type << " ";
- out << "Vnet=" << m_vnet << " ";
- out << "VC=" << m_vc << " ";
- out << "Enqueue Time=" << m_enqueue_time << " ";
- out << "]";
+
+void
+flit_d::print(std::ostream& out) const
+{
+ out << "[flit:: ";
+ out << "Id=" << m_id << " ";
+ out << "Type=" << m_type << " ";
+ out << "Vnet=" << m_vnet << " ";
+ out << "VC=" << m_vc << " ";
+ out << "Enqueue Time=" << m_enqueue_time << " ";
+ out << "]";
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
index ec2774a94..bde8618ee 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
@@ -28,118 +28,95 @@
* Authors: Niket Agarwal
*/
-#ifndef FLIT_D_H
-#define FLIT_D_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_D_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_D_HH__
#include <iostream>
#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(std::ostream& out) const;
- bool is_free_signal()
- {
- return m_is_free_signal;
- }
+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(std::ostream& out) const;
+ bool is_free_signal() { return m_is_free_signal; }
+ int get_size() { return m_size; }
+ Time get_enqueue_time() { return m_enqueue_time; }
+ int get_id() { return m_id; }
+ Time get_time() { return m_time; }
+ void set_time(Time time) { m_time = time; }
+ int get_vnet() { return m_vnet; }
+ int get_vc() { return m_vc; }
+ void set_vc(int vc) { m_vc = vc; }
+ MsgPtr& get_msg_ptr() { return m_msg_ptr; }
+ flit_type get_type() { return m_type; }
- 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 std::pair<flit_stage, Time> get_stage()
- {
- return m_stage;
- }
- inline void set_delay(int delay)
- {
- src_delay = delay;
- }
+ bool
+ is_stage(flit_stage t_stage)
+ {
+ return (m_stage.first == t_stage &&
+ g_eventQueue_ptr->getTime() >= m_stage.second);
+ }
- inline int get_delay()
- {
- return src_delay;
- }
+ bool
+ is_next_stage(flit_stage t_stage)
+ {
+ return (m_stage.first == t_stage &&
+ (g_eventQueue_ptr->getTime() + 1) >= m_stage.second);
+ }
- static bool
- greater(flit_d* n1, flit_d* n2)
- {
- if (n1->get_time() == n2->get_time()) {
- //ASSERT(n1->flit_id != n2->flit_id);
- return (n1->get_id() > n2->get_id());
- } else {
- return (n1->get_time() > n2->get_time());
- }
- }
+ void
+ advance_stage(flit_stage t_stage)
+ {
+ m_stage.first = t_stage;
+ m_stage.second = g_eventQueue_ptr->getTime() + 1;
+ }
+ std::pair<flit_stage, Time>
+ get_stage()
+ {
+ return m_stage;
+ }
+
+ void
+ set_delay(int delay)
+ {
+ src_delay = delay;
+ }
+
+ 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;
- std::pair<flit_stage, Time> m_stage;
+ static bool
+ greater(flit_d* n1, flit_d* n2)
+ {
+ if (n1->get_time() == n2->get_time()) {
+ //ASSERT(n1->flit_id != n2->flit_id);
+ return (n1->get_id() > n2->get_id());
+ } else {
+ return (n1->get_time() > n2->get_time());
+ }
+ }
+ private:
+ 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;
+ std::pair<flit_stage, Time> m_stage;
};
inline std::ostream&
@@ -150,4 +127,4 @@ operator<<(std::ostream& out, const flit_d& obj)
return out;
}
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_FLIT_D_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
index fd12b4ec8..2f38fc158 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
@@ -28,19 +28,21 @@
* Authors: Niket Agarwal
*/
-#ifndef FLEXIBLE_CONSUMER_H
-#define FLEXIBLE_CONSUMER_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLEXIBLE_CONSUMER_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLEXIBLE_CONSUMER_HH__
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/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) {}
+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
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLEXIBLE_CONSUMER_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
index 232898c52..a2b74d8dc 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
@@ -44,251 +44,263 @@ using namespace std;
using m5::stl_helpers::deletePointers;
GarnetNetwork::GarnetNetwork(const Params *p)
- : BaseGarnetNetwork(p)
+ : BaseGarnetNetwork(p)
{
m_ruby_start = 0;
-
+
// Allocate to and from queues
- m_toNetQueues.resize(m_nodes); // Queues that are getting messages from protocol
- m_fromNetQueues.resize(m_nodes); // Queues that are feeding the protocol
+
+ // Queues that are getting messages from protocol
+ m_toNetQueues.resize(m_nodes);
+
+ // Queues that are feeding the protocol
+ m_fromNetQueues.resize(m_nodes);
+
m_in_use.resize(m_virtual_networks);
m_ordered.resize(m_virtual_networks);
- for (int i = 0; i < m_virtual_networks; i++)
- {
+ 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
+
+ for (int node = 0; node < m_nodes; node++) {
+ //Setting number of virtual message buffers per Network Queue
m_toNetQueues[node].resize(m_virtual_networks);
m_fromNetQueues[node].resize(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
+
+ // Instantiating the Message Buffers that
+ // interact with the coherence protocol
+ for (int j = 0; j < m_virtual_networks; j++) {
+ m_toNetQueues[node][j] = new MessageBuffer();
m_fromNetQueues[node][j] = new MessageBuffer();
}
}
}
-void GarnetNetwork::init()
+void
+GarnetNetwork::init()
{
BaseGarnetNetwork::init();
// Setup the network switches
assert (m_topology_ptr!=NULL);
-
+
int number_of_routers = m_topology_ptr->numSwitches();
for (int i=0; i<number_of_routers; i++) {
m_router_ptr_vector.push_back(new Router(i, this));
}
-
+
for (int i=0; i < m_nodes; i++) {
- NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks, this);
+ NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks,
+ this);
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
m_ni_ptr_vector.push_back(ni);
}
- m_topology_ptr->createLinks(this, false); // false because this isn't a reconfiguration
+
+ // false because this isn't a reconfiguration :
+ m_topology_ptr->createLinks(this, false);
}
GarnetNetwork::~GarnetNetwork()
{
- for (int i = 0; i < m_nodes; i++)
- {
- deletePointers(m_toNetQueues[i]);
- deletePointers(m_fromNetQueues[i]);
- }
- deletePointers(m_router_ptr_vector);
- deletePointers(m_ni_ptr_vector);
- deletePointers(m_link_ptr_vector);
- delete m_topology_ptr;
+ for (int i = 0; i < m_nodes; i++) {
+ deletePointers(m_toNetQueues[i]);
+ deletePointers(m_fromNetQueues[i]);
+ }
+ deletePointers(m_router_ptr_vector);
+ deletePointers(m_ni_ptr_vector);
+ deletePointers(m_link_ptr_vector);
+ delete m_topology_ptr;
}
-void GarnetNetwork::reset()
+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();
- }
+ 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)
+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.push_back(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
- }
+ assert(src < m_nodes);
+
+ if (!isReconfiguration) {
+ NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(),
+ link_latency, this);
+ m_link_ptr_vector.push_back(net_link);
+ m_router_ptr_vector[dest]->addInPort(net_link);
+ m_ni_ptr_vector[src]->addOutPort(net_link);
+ } 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)
+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.push_back(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
- }
+ 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.push_back(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)
+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.push_back(net_link);
- m_router_ptr_vector[dest]->addInPort(net_link);
- m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight);
- }
- else
- {
- ERROR_MSG("Fatal Error:: Reconfiguration not allowed here");
- // do nothing
- }
+ if (!isReconfiguration) {
+ NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(),
+ link_latency, this);
+ m_link_ptr_vector.push_back(net_link);
+ m_router_ptr_vector[dest]->addInPort(net_link);
+ m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
+ link_weight);
+ } else {
+ ERROR_MSG("Fatal Error:: Reconfiguration not allowed here");
+ // do nothing
+ }
}
-void GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num)
+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);
+ 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;
+ if (ordered) {
+ m_ordered[network_num] = true;
+ }
+ m_in_use[network_num] = true;
}
-MessageBuffer* GarnetNetwork::getToNetQueue(NodeID id, bool ordered, int network_num)
+MessageBuffer*
+GarnetNetwork::getToNetQueue(NodeID id, bool ordered, int network_num)
{
- checkNetworkAllocation(id, ordered, network_num);
- return m_toNetQueues[id][network_num];
+ checkNetworkAllocation(id, ordered, network_num);
+ return m_toNetQueues[id][network_num];
}
-MessageBuffer* GarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num)
+MessageBuffer*
+GarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num)
{
- checkNetworkAllocation(id, ordered, network_num);
- return m_fromNetQueues[id][network_num];
+ checkNetworkAllocation(id, ordered, network_num);
+ return m_fromNetQueues[id][network_num];
}
-void GarnetNetwork::clearStats()
+void
+GarnetNetwork::clearStats()
{
- m_ruby_start = g_eventQueue_ptr->getTime();
+ m_ruby_start = g_eventQueue_ptr->getTime();
}
-Time GarnetNetwork::getRubyStartTime()
+Time
+GarnetNetwork::getRubyStartTime()
{
- return m_ruby_start;
+ return m_ruby_start;
}
-void GarnetNetwork::printStats(ostream& out) const
-{ double average_link_utilization = 0;
- std::vector<double> average_vc_load;
- average_vc_load.resize(m_virtual_networks*m_vcs_per_class);
+void
+GarnetNetwork::printStats(ostream& out) const
+{
+ double average_link_utilization = 0;
+ vector<double> average_vc_load;
+ average_vc_load.resize(m_virtual_networks*m_vcs_per_class);
- for(int i = 0; i < m_virtual_networks*m_vcs_per_class; i++)
- {
- average_vc_load[i] = 0;
- }
+ for (int i = 0; i < m_virtual_networks*m_vcs_per_class; 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();
- std::vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
- for(int j = 0; j < vc_load.size(); j++)
- {
- assert(vc_load.size() == m_vcs_per_class*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_vcs_per_class*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 << "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_vcs_per_class*m_virtual_networks);
+ average_vc_load[j] += vc_load[j];
}
- out << "-------------" << endl;
+ }
+ 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_vcs_per_class*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
+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;
+ 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_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);
+ 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;
}
- m_topology_ptr->printConfig(out);
+ }
+ 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
+void
+GarnetNetwork::print(ostream& out) const
{
- out << "[GarnetNetwork]";
+ out << "[GarnetNetwork]";
}
GarnetNetwork *
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
index 62857223e..96aa5fd10 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef GARNET_NETWORK_H
-#define GARNET_NETWORK_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_GARNET_NETWORK_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_GARNET_NETWORK_HH__
#include <iostream>
#include <vector>
@@ -46,61 +46,65 @@ class Topology;
class NetDest;
class NetworkLink;
-class GarnetNetwork : public BaseGarnetNetwork {
-public:
+class GarnetNetwork : public BaseGarnetNetwork
+{
+ public:
typedef GarnetNetworkParams Params;
GarnetNetwork(const Params *p);
~GarnetNetwork();
- void init();
-
- // 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 init();
- void clearStats();
- void printStats(std::ostream& out) const;
- void printConfig(std::ostream& out) const;
- void print(std::ostream& out) const;
+ // 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);
- bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
- bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
+ void clearStats();
+ void printStats(std::ostream& out) const;
+ void printConfig(std::ostream& out) const;
+ void print(std::ostream& out) const;
- Time getRubyStartTime();
- int getNumNodes(){ return m_nodes; }
+ bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
+ bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
- void reset();
+ Time getRubyStartTime();
+ int getNumNodes(){ return m_nodes; }
- // Methods used by Topology to setup the network
- void makeOutLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration);
- void makeInLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int bw_multiplier, bool isReconfiguration);
- void makeInternalLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration);
+ void reset();
-private:
- void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
+ // 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 copy constructor and assignment operator
- GarnetNetwork(const GarnetNetwork& obj);
- GarnetNetwork& operator=(const GarnetNetwork& obj);
+ private:
+ void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
+ GarnetNetwork(const GarnetNetwork& obj);
+ GarnetNetwork& operator=(const GarnetNetwork& obj);
-/***********Data Members*************/
-// int m_virtual_networks;
-// int m_nodes;
+ // int m_virtual_networks;
+ // int m_nodes;
- std::vector<bool> m_in_use;
- std::vector<bool> m_ordered;
+ std::vector<bool> m_in_use;
+ std::vector<bool> m_ordered;
- std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
- std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
+ std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
+ std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
- std::vector<Router *> m_router_ptr_vector; // All Routers in Network
- std::vector<NetworkLink *> m_link_ptr_vector; // All links in the network
- std::vector<NetworkInterface *> m_ni_ptr_vector; // All NI's in Network
+ std::vector<Router *> m_router_ptr_vector; // All Routers in Network
+ std::vector<NetworkLink *> m_link_ptr_vector; // All links in network
+ std::vector<NetworkInterface *> m_ni_ptr_vector; // All NI's in Network
-// Topology* m_topology_ptr;
- Time m_ruby_start;
+ // Topology* m_topology_ptr;
+ Time m_ruby_start;
};
inline std::ostream&
@@ -111,4 +115,5 @@ operator<<(std::ostream& out, const GarnetNetwork& obj)
return out;
}
-#endif //NETWORK_H
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_GARNET_NETWORK_HH__
+
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc b/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc
index 84196e45e..d688dc1fd 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc
@@ -32,39 +32,45 @@
InVcState::InVcState(int id)
{
- m_id = id;
- m_vc_state = IDLE_;
+ m_id = id;
+ m_vc_state = IDLE_;
}
-bool InVcState::isInState(VC_state_type state, Time request_time)
+bool
+InVcState::isInState(VC_state_type state, Time request_time)
{
- return ((m_vc_state == state) && (request_time >= m_time) );
+ return ((m_vc_state == state) && (request_time >= m_time) );
}
-void InVcState::setRoute(int route)
+void
+InVcState::setRoute(int route)
{
- m_route = route;
+ m_route = route;
}
-void InVcState::setState(VC_state_type state, Time time)
+void
+InVcState::setState(VC_state_type state, Time time)
{
- m_vc_state = state;
- m_time = time;
+ m_vc_state = state;
+ m_time = time;
}
-void InVcState::grant_vc(int out_vc, Time grant_time)
+void
+InVcState::grant_vc(int out_vc, Time grant_time)
{
- m_vc_state = ACTIVE_;
- m_time = grant_time;
- m_output_vc = out_vc;
+ m_vc_state = ACTIVE_;
+ m_time = grant_time;
+ m_output_vc = out_vc;
}
-int InVcState::get_outport()
+int
+InVcState::get_outport()
{
- return m_route;
+ return m_route;
}
-int InVcState::get_outvc()
+int
+InVcState::get_outvc()
{
- return m_output_vc;
+ 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
index d84bbe81f..829509f64 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh
@@ -28,28 +28,29 @@
* Authors: Niket Agarwal
*/
-#ifndef IN_VC_STATE_H
-#define IN_VC_STATE_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__
#include "mem/ruby/network/garnet/NetworkHeader.hh"
-class InVcState {
-public:
- InVcState(int id);
+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);
+ 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;
+ private:
+ int m_id;
+ int m_route;
+ int m_output_vc;
+ VC_state_type m_vc_state;
+ Time m_time;
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index b233ca0f5..86f9483c6 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -39,271 +39,307 @@
using namespace std;
using m5::stl_helpers::deletePointers;
-NetworkInterface::NetworkInterface(int id, int virtual_networks, GarnetNetwork *network_ptr)
+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->getVCsPerClass();
- m_num_vcs = m_vc_per_vnet*m_virtual_networks;
-
- m_vc_round_robin = 0;
- m_ni_buffers.resize(m_num_vcs);
- inNode_ptr.resize(m_virtual_networks);
- outNode_ptr.resize(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.resize(m_virtual_networks);
- for(int i = 0; i < m_virtual_networks; i++)
- {
- m_vc_allocator[i] = 0;
- }
-
- for(int i = 0; i < m_num_vcs; i++)
- {
- m_out_vc_state.push_back(new OutVcState(i));
- m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
- }
+ m_id = id;
+ m_net_ptr = network_ptr;
+ m_virtual_networks = virtual_networks;
+ m_vc_per_vnet = m_net_ptr->getVCsPerClass();
+ m_num_vcs = m_vc_per_vnet*m_virtual_networks;
+
+ m_vc_round_robin = 0;
+ m_ni_buffers.resize(m_num_vcs);
+ inNode_ptr.resize(m_virtual_networks);
+ outNode_ptr.resize(m_virtual_networks);
+
+ // instantiating the NI flit buffers
+ for (int i =0; i < m_num_vcs; i++)
+ m_ni_buffers[i] = new flitBuffer();
+
+ m_vc_allocator.resize(m_virtual_networks);
+ for (int i = 0; i < m_virtual_networks; i++) {
+ m_vc_allocator[i] = 0;
+ }
+
+ for (int i = 0; i < m_num_vcs; i++) {
+ m_out_vc_state.push_back(new OutVcState(i));
+ m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+ }
}
NetworkInterface::~NetworkInterface()
{
- deletePointers(m_out_vc_state);
- deletePointers(m_ni_buffers);
- delete outSrcQueue;
+ deletePointers(m_out_vc_state);
+ deletePointers(m_ni_buffers);
+ delete outSrcQueue;
}
-void NetworkInterface::addInPort(NetworkLink *in_link)
+void
+NetworkInterface::addInPort(NetworkLink *in_link)
{
- inNetLink = in_link;
- in_link->setLinkConsumer(this);
+ inNetLink = in_link;
+ in_link->setLinkConsumer(this);
}
-void NetworkInterface::addOutPort(NetworkLink *out_link)
+void
+NetworkInterface::addOutPort(NetworkLink *out_link)
{
- outNetLink = out_link;
- outSrcQueue = new flitBuffer();
- out_link->setSourceQueue(outSrcQueue);
- out_link->setSource(this);
+ outNetLink = out_link;
+ outSrcQueue = new flitBuffer();
+ out_link->setSourceQueue(outSrcQueue);
+ out_link->setSource(this);
}
-void NetworkInterface::addNode(vector<MessageBuffer*>& in, vector<MessageBuffer*>& out)
+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
- }
+ ASSERT(in.size() == m_virtual_networks);
+ inNode_ptr = in;
+ outNode_ptr = out;
+
+ // protocol injects messages into the NI
+ for (int j = 0; j < m_virtual_networks; j++) {
+ inNode_ptr[j]->setConsumer(this);
+ }
}
-void NetworkInterface::request_vc(int in_vc, int in_port, NetDest destination, Time request_time)
+void
+NetworkInterface::request_vc(int in_vc, int in_port, NetDest destination,
+ Time request_time)
{
- inNetLink->grant_vc_link(in_vc, request_time);
+ inNetLink->grant_vc_link(in_vc, request_time);
}
-bool NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
+bool
+NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
{
- NetworkMessage *net_msg_ptr =
- safe_cast<NetworkMessage*>(msg_ptr.get());
- 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->getFlitSize() ); // Number of flits is dependent on the link bandwidth available. This is expressed in terms of bytes/cycle or the flit size
+ NetworkMessage *net_msg_ptr = safe_cast<NetworkMessage *>(msg_ptr.get());
+ NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
- 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
+ // get all the destinations associated with this message.
+ vector<NodeID> dest_nodes = net_msg_dest.getAllDest();
- if(vc == -1)
- {
- // did not find a free output vc
- return false ;
- }
- MsgPtr new_msg_ptr = msg_ptr->clone();
- NodeID destID = dest_nodes[ctr];
-
- NetworkMessage *new_net_msg_ptr =
- safe_cast<NetworkMessage*>(new_msg_ptr.get());
- if(dest_nodes.size() > 1)
- {
- NetDest personal_dest;
- for(int m = 0; m < (int) MachineType_NUM; m++)
- {
- if((destID >= MachineType_base_number((MachineType) m)) && destID < MachineType_base_number((MachineType) (m+1)))
- {
- // calculating the NetDest associated with this 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);
+ // Number of flits is dependent on the link bandwidth available.
+ // This is expressed in terms of bytes/cycle or the flit size
+
+ int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(
+ net_msg_ptr->getMessageSize())/m_net_ptr->getFlitSize() );
+
+ // loop to convert all multicast messages into unicast messages
+ for (int ctr = 0; ctr < dest_nodes.size(); ctr++) {
+ int vc = calculateVC(vnet); // this will return a free output vc
+
+ if (vc == -1) {
+ // did not find a free output vc
+ return false ;
+ }
+ MsgPtr new_msg_ptr = msg_ptr->clone();
+ NodeID destID = dest_nodes[ctr];
+
+ NetworkMessage *new_net_msg_ptr =
+ safe_cast<NetworkMessage *>(new_msg_ptr.get());
+ if (dest_nodes.size() > 1) {
+ NetDest personal_dest;
+ for (int m = 0; m < (int) MachineType_NUM; m++) {
+ if ((destID >= MachineType_base_number((MachineType) m)) &&
+ destID < MachineType_base_number((MachineType) (m+1))) {
+ // calculating the NetDest associated with this destID
+ personal_dest.clear();
+ personal_dest.add((MachineID) {(MachineType) m, (destID -
+ MachineType_base_number((MachineType) m))});
+ new_net_msg_ptr->getInternalDestination() = personal_dest;
+ break;
}
+ }
+ net_msg_dest.removeNetDest(personal_dest);
- 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
+ // removing the destination from the original message to reflect
+ // that a message with this particular destination has been
+ // flitisized and an output vc is acquired
+ net_msg_ptr->getInternalDestination().removeNetDest(personal_dest);
}
+ 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());
- return true ;
+ // setting an output vc request for the next hop.
+ // This flit will be ready to traverse the link and into the next hop
+ // only when an output vc is acquired at the next hop
+ outNetLink->request_vc_link(vc,
+ new_net_msg_ptr->getInternalDestination(),
+ g_eventQueue_ptr->getTime());
+ }
+
+ 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)
+// 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);
+ 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)
+// 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);
+ 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
+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);
- }
+ 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;
+ }
+ 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.
+ * 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()
+void
+NetworkInterface::wakeup()
{
- MsgPtr msg_ptr;
+ 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
+ //Checking for messages coming from the protocol
+ // can pick up a message/cycle for each virtual net
+ for (int vnet = 0; vnet < m_virtual_networks; vnet++) {
+ while (inNode_ptr[vnet]->isReady()) // Is there a message waiting
{
- 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;
- }
- }
+ 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->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;
+ }
+
+ 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());
+
+ // When we are doing network only testing, the messages do not
+ // have to be buffered into the message buffers of the protocol
+ if (!m_net_ptr->isNetworkTesting()) {
+ outNode_ptr[t_flit->get_vnet()]->enqueue(
+ t_flit->get_msg_ptr(), 1);
+ }
+
+ // signal the upstream router that this vc can be freed now
+ inNetLink->release_vc_link(t_flit->get_vc(),
+ g_eventQueue_ptr->getTime() + 1);
}
+ 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()
+/* This function looks at the NI buffers and if some buffer has flits which
+ * are ready to traverse the link in the next cycle and also the downstream
+ * output vc associated with this flit has buffers left, the link is scheduled
+ * for the next cycle
+ */
+
+void
+NetworkInterface::scheduleOutputLink()
{
- int vc = m_vc_round_robin;
- m_vc_round_robin++;
- if(m_vc_round_robin == m_num_vcs)
- m_vc_round_robin = 0;
+ 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;
- }
- }
+ 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)) { // buffer backpressure
+
+ // Just removing the flit
+ flit *t_flit = m_ni_buffers[vc]->getTopFlit();
+ t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
+ outSrcQueue->insert(t_flit);
+
+ // schedule the out link
+ g_eventQueue_ptr->scheduleEvent(outNetLink, 1);
+ return;
+ }
}
+ }
}
-void NetworkInterface::checkReschedule()
+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 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;
- }
+ }
+ 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(std::ostream& out) const
+void
+NetworkInterface::printConfig(std::ostream& out) const
{
- out << "[Network Interface " << m_id << "] - ";
- out << "[inLink " << inNetLink->get_id() << "] - ";
- out << "[outLink " << outNetLink->get_id() << "]" << std::endl;
+ out << "[Network Interface " << m_id << "] - ";
+ out << "[inLink " << inNetLink->get_id() << "] - ";
+ out << "[outLink " << outNetLink->get_id() << "]" << std::endl;
}
-void NetworkInterface::print(std::ostream& out) const
+void
+NetworkInterface::print(std::ostream& out) const
{
- out << "[Network Interface]";
+ 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
index 01608498d..401a8bc23 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef NET_INTERFACE_H
-#define NET_INTERFACE_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_INTERFACE_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_INTERFACE_HH__
#include <iostream>
#include <vector>
@@ -45,52 +45,62 @@ class NetworkMessage;
class MessageBuffer;
class flitBuffer;
-class NetworkInterface : public FlexibleConsumer {
-public:
- NetworkInterface(int id, int virtual_networks, GarnetNetwork* network_ptr);
+class NetworkInterface : public FlexibleConsumer
+{
+ public:
+ NetworkInterface(int id, int virtual_networks,
+ GarnetNetwork* network_ptr);
- ~NetworkInterface();
+ ~NetworkInterface();
- void addInPort(NetworkLink *in_link);
- void addOutPort(NetworkLink *out_link);
+ void addInPort(NetworkLink *in_link);
+ void addOutPort(NetworkLink *out_link);
- void wakeup();
- void addNode(std::vector<MessageBuffer *> &inNode, std::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 wakeup();
+ void addNode(std::vector<MessageBuffer *> &inNode,
+ std::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);
- void printConfig(std::ostream& out) const;
- void print(std::ostream& out) const;
+ bool
+ isBufferNotFull(int vc, int inport)
+ {
+ return true;
+ }
+ void request_vc(int in_vc, int in_port, NetDest destination,
+ Time request_time);
-private:
-/**************Data Members*************/
- GarnetNetwork *m_net_ptr;
- int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
- NodeID m_id;
+ void printConfig(std::ostream& out) const;
+ void print(std::ostream& out) const;
- std::vector<OutVcState *> m_out_vc_state;
- std::vector<int> m_vc_allocator;
- int m_vc_round_robin; // For round robin scheduling
- flitBuffer *outSrcQueue; // For modelling link contention
+ private:
+ GarnetNetwork *m_net_ptr;
+ int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
+ NodeID m_id;
- NetworkLink *inNetLink;
- NetworkLink *outNetLink;
+ std::vector<OutVcState *> m_out_vc_state;
+ std::vector<int> m_vc_allocator;
+ int m_vc_round_robin; // For round robin scheduling
+ flitBuffer *outSrcQueue; // For modelling link contention
- // Input Flit Buffers
- std::vector<flitBuffer *> m_ni_buffers; // The flit buffers which will serve the Consumer
+ NetworkLink *inNetLink;
+ NetworkLink *outNetLink;
- std::vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
- std::vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
+ // Input Flit Buffers
- bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
- int calculateVC(int vnet);
- void scheduleOutputLink();
- void checkReschedule();
+ // The flit buffers which will serve the Consumer
+ std::vector<flitBuffer *> m_ni_buffers;
+
+ // The Message buffers that takes messages from the protocol
+ std::vector<MessageBuffer *> inNode_ptr;
+
+ // The Message buffers that provides messages to the protocol
+ std::vector<MessageBuffer *> outNode_ptr;
+
+ bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
+ int calculateVC(int vnet);
+ void scheduleOutputLink();
+ void checkReschedule();
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_INTERFACE_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
index 2947ce8ec..24b93c975 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
@@ -33,109 +33,128 @@
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->getVCsPerClass();
- m_vc_load.resize(num_net * num_vc);
+ m_id = id;
+ linkBuffer = new flitBuffer();
+ m_in_port = 0;
+ m_out_port = 0;
+ m_link_utilized = 0;
+ m_net_ptr = net_ptr;
+ m_latency = latency;
+ int num_net = net_ptr->getNumberOfVirtualNetworks();
+ int num_vc = m_net_ptr->getVCsPerClass();
+ m_vc_load.resize(num_net * num_vc);
- for(int i = 0; i < num_net*num_vc; i++)
- m_vc_load[i] = 0;
+ for (int i = 0; i < num_net * num_vc; i++)
+ m_vc_load[i] = 0;
}
NetworkLink::~NetworkLink()
{
- delete linkBuffer;
+ delete linkBuffer;
}
-int NetworkLink::get_id()
+int
+NetworkLink::get_id()
{
- return m_id;
+ return m_id;
}
-void NetworkLink::setLinkConsumer(FlexibleConsumer *consumer)
+void
+NetworkLink::setLinkConsumer(FlexibleConsumer *consumer)
{
- link_consumer = consumer;
+ link_consumer = consumer;
}
-void NetworkLink::setSourceQueue(flitBuffer *srcQueue)
+void
+NetworkLink::setSourceQueue(flitBuffer *srcQueue)
{
- link_srcQueue = srcQueue;
+ link_srcQueue = srcQueue;
}
-void NetworkLink::setSource(FlexibleConsumer *source)
+void
+NetworkLink::setSource(FlexibleConsumer *source)
{
- link_source = source;
+ link_source = source;
}
-void NetworkLink::request_vc_link(int vc, NetDest destination, Time request_time)
+
+void
+NetworkLink::request_vc_link(int vc, NetDest destination, Time request_time)
{
- link_consumer->request_vc(vc, m_in_port, destination, request_time);
+ link_consumer->request_vc(vc, m_in_port, destination, request_time);
}
-bool NetworkLink::isBufferNotFull_link(int vc)
+
+bool
+NetworkLink::isBufferNotFull_link(int vc)
{
- return link_consumer->isBufferNotFull(vc, m_in_port);
+ return link_consumer->isBufferNotFull(vc, m_in_port);
}
-void NetworkLink::grant_vc_link(int vc, Time grant_time)
+void
+NetworkLink::grant_vc_link(int vc, Time grant_time)
{
- link_source->grant_vc(m_out_port, vc, grant_time);
+ link_source->grant_vc(m_out_port, vc, grant_time);
}
-void NetworkLink::release_vc_link(int vc, Time release_time)
+void
+NetworkLink::release_vc_link(int vc, Time release_time)
{
- link_source->release_vc(m_out_port, vc, release_time);
+ link_source->release_vc(m_out_port, vc, release_time);
}
-std::vector<int> NetworkLink::getVcLoad()
+std::vector<int>
+NetworkLink::getVcLoad()
{
- return m_vc_load;
+ return m_vc_load;
}
-double NetworkLink::getLinkUtilization()
+double
+NetworkLink::getLinkUtilization()
{
- Time m_ruby_start = m_net_ptr->getRubyStartTime();
- return (double(m_link_utilized)) / (double(g_eventQueue_ptr->getTime()-m_ruby_start));
+ Time m_ruby_start = m_net_ptr->getRubyStartTime();
+ return (double(m_link_utilized)) /
+ (double(g_eventQueue_ptr->getTime()-m_ruby_start));
}
-bool NetworkLink::isReady()
+bool
+NetworkLink::isReady()
{
- return linkBuffer->isReady();
+ return linkBuffer->isReady();
}
-void NetworkLink::setInPort(int port)
+void
+NetworkLink::setInPort(int port)
{
- m_in_port = port;
+ m_in_port = port;
}
-void NetworkLink::setOutPort(int port)
+void
+NetworkLink::setOutPort(int port)
{
- m_out_port = port;
+ m_out_port = port;
}
-void NetworkLink::wakeup()
+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()]++;
- }
+ if (!link_srcQueue->isReady())
+ return;
+
+ 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()
+flit*
+NetworkLink::peekLink()
{
- return linkBuffer->peekTopFlit();
+ return linkBuffer->peekTopFlit();
}
-flit* NetworkLink::consumeLink()
+flit*
+NetworkLink::consumeLink()
{
- return linkBuffer->getTopFlit();
+ 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
index 9f1311dce..3915448c5 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef NETWORK_LINK_H
-#define NETWORK_LINK_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_LINK_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_LINK_HH__
#include <iostream>
#include <vector>
@@ -41,46 +41,46 @@
class GarnetNetwork;
-class NetworkLink : public FlexibleConsumer {
-public:
- NetworkLink();
- NetworkLink(int id, int latency, GarnetNetwork *net_ptr);
- ~NetworkLink();
+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 setLinkConsumer(FlexibleConsumer *consumer);
+ void setSourceQueue(flitBuffer *srcQueue);
+ flit *peekLink();
+ flit *consumeLink();
- void print(std::ostream& out) const {}
+ void print(std::ostream& out) const {}
- bool is_vc_ready(flit *t_flit);
+ 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();
- std::vector<int> getVcLoad();
+ 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();
+ std::vector<int> getVcLoad();
-protected:
- int m_id, m_latency;
- int m_in_port, m_out_port;
- int m_link_utilized;
- std::vector<int> m_vc_load;
- GarnetNetwork *m_net_ptr;
+ protected:
+ int m_id, m_latency;
+ int m_in_port, m_out_port;
+ int m_link_utilized;
+ std::vector<int> m_vc_load;
+ GarnetNetwork *m_net_ptr;
- flitBuffer *linkBuffer;
- FlexibleConsumer *link_consumer;
- FlexibleConsumer *link_source;
- flitBuffer *link_srcQueue;
+ flitBuffer *linkBuffer;
+ FlexibleConsumer *link_consumer;
+ FlexibleConsumer *link_source;
+ flitBuffer *link_srcQueue;
};
-#endif
-
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_NETWORK_LINK_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
index e17db5dcf..c1696a551 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
@@ -32,24 +32,26 @@
OutVcState::OutVcState(int id)
{
- m_id = id;
- m_vc_state = IDLE_;
+ m_id = id;
+ m_vc_state = IDLE_;
}
-bool OutVcState::isInState(VC_state_type state, Time request_time)
+bool
+OutVcState::isInState(VC_state_type state, Time request_time)
{
- return ((m_vc_state == state) && (request_time >= m_time) );
+ return ((m_vc_state == state) && (request_time >= m_time));
}
-void OutVcState::grant_vc(Time grant_time)
+void
+OutVcState::grant_vc(Time grant_time)
{
- m_time = grant_time;
- m_vc_state = ACTIVE_;
+ m_time = grant_time;
+ m_vc_state = ACTIVE_;
}
-void OutVcState::setState(VC_state_type state, Time time)
+void
+OutVcState::setState(VC_state_type state, Time time)
{
- m_vc_state = state;
- m_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
index a1c0fdfac..17fa9141e 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh
@@ -28,23 +28,24 @@
* Authors: Niket Agarwal
*/
-#ifndef OUT_VC_STATE_H
-#define OUT_VC_STATE_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_OUT_VC_STATE_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_OUT_VC_STATE_HH__
#include "mem/ruby/network/garnet/NetworkHeader.hh"
-class OutVcState {
-public:
- OutVcState(int id);
+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);
+ 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;
+ private:
+ int m_id ;
+ Time m_time;
+ VC_state_type m_vc_state;
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_OUT_VC_STATE_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
index 95b92d49d..ca75edb58 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
@@ -40,351 +40,370 @@ using m5::stl_helpers::deletePointers;
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->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);
+ m_id = id;
+ m_net_ptr = network_ptr;
+ m_virtual_networks = m_net_ptr->getNumberOfVirtualNetworks();
+ m_vc_per_vnet = m_net_ptr->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++)
- {
- deletePointers(m_in_vc_state[i]);
- }
- for (int i = 0; i < m_out_link.size(); i++)
- {
- deletePointers(m_out_vc_state[i]);
- deletePointers(m_router_buffers[i]);
- }
- deletePointers(m_out_src_queue);
- delete m_vc_arbiter;
-
+ for (int i = 0; i < m_in_link.size(); i++) {
+ deletePointers(m_in_vc_state[i]);
+ }
+ for (int i = 0; i < m_out_link.size(); i++) {
+ deletePointers(m_out_vc_state[i]);
+ deletePointers(m_router_buffers[i]);
+ }
+ deletePointers(m_out_src_queue);
+ delete m_vc_arbiter;
}
-void Router::addInPort(NetworkLink *in_link)
+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.push_back(new InVcState(i));
- in_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
- }
- m_in_vc_state.push_back(in_vc_vector);
- m_in_link.push_back(in_link);
- in_link->setLinkConsumer(this);
- in_link->setInPort(port);
-
- int start = 0;
- m_round_robin_invc.push_back(start);
-
+ int port = m_in_link.size();
+ vector<InVcState *> in_vc_vector;
+ for (int i = 0; i < m_num_vcs; i++) {
+ in_vc_vector.push_back(new InVcState(i));
+ in_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+ }
+ m_in_vc_state.push_back(in_vc_vector);
+ m_in_link.push_back(in_link);
+ in_link->setLinkConsumer(this);
+ in_link->setInPort(port);
+
+ int start = 0;
+ m_round_robin_invc.push_back(start);
}
-void Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entry, int link_weight)
+void
+Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entry,
+ int link_weight)
{
- int port = m_out_link.size();
- out_link->setOutPort(port);
- int start = 0;
- m_vc_round_robin.push_back(start);
-
- m_out_src_queue.push_back(new flitBuffer());
-
- m_out_link.push_back(out_link);
- m_routing_table.push_back(routing_table_entry);
- out_link->setSourceQueue(m_out_src_queue[port]);
- out_link->setSource(this);
-
- vector<flitBuffer *> intermediateQueues;
- for(int i = 0; i < m_num_vcs; i++)
- {
- intermediateQueues.push_back(new flitBuffer(m_net_ptr->getBufferSize()));
- }
- m_router_buffers.push_back(intermediateQueues);
-
- vector<OutVcState *> out_vc_vector;
- for(int i = 0; i < m_num_vcs; i++)
- {
- out_vc_vector.push_back(new OutVcState(i));
- out_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
- }
- m_out_vc_state.push_back(out_vc_vector);
- m_link_weights.push_back(link_weight);
+ int port = m_out_link.size();
+ out_link->setOutPort(port);
+ int start = 0;
+ m_vc_round_robin.push_back(start);
+
+ m_out_src_queue.push_back(new flitBuffer());
+
+ m_out_link.push_back(out_link);
+ m_routing_table.push_back(routing_table_entry);
+ out_link->setSourceQueue(m_out_src_queue[port]);
+ out_link->setSource(this);
+
+ vector<flitBuffer *> intermediateQueues;
+ for (int i = 0; i < m_num_vcs; i++) {
+ intermediateQueues.push_back(new flitBuffer(
+ m_net_ptr->getBufferSize()));
+ }
+ m_router_buffers.push_back(intermediateQueues);
+
+ vector<OutVcState *> out_vc_vector;
+ for (int i = 0; i < m_num_vcs; i++) {
+ out_vc_vector.push_back(new OutVcState(i));
+ out_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+ }
+ m_out_vc_state.push_back(out_vc_vector);
+ m_link_weights.push_back(link_weight);
}
-bool Router::isBufferNotFull(int vc, int inport)
+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();
+ 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());
+ 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)
+// 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();
+ 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()
+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;
- }
- }
- }
+ 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>
+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.push_back(base+offset);
- }
- break;
- }
+ 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.push_back(base+offset);
+ }
+ break;
}
- return vc_list;
+ }
+ return vc_list;
}
-void Router::grant_vc(int out_port, int vc, Time grant_time)
+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);
+ 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)
+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);
+ 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
+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];
- }
+ 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;
+ }
+ return output_link;
}
-void Router::routeCompute(flit *m_flit, int inport)
+void
+Router::routeCompute(flit *m_flit, int inport)
{
- int invc = m_flit->get_vc();
- int outport = m_in_vc_state[inport][invc]->get_outport();
- int outvc = m_in_vc_state[inport][invc]->get_outvc();
-
- assert(m_net_ptr->getNumPipeStages() >= 1);
- m_flit->set_time(g_eventQueue_ptr->getTime() + (m_net_ptr->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->getNumPipeStages() > 1)
- g_eventQueue_ptr->scheduleEvent(this, m_net_ptr->getNumPipeStages() -1 );
- if((m_flit->get_type() == HEAD_) || (m_flit->get_type() == HEAD_TAIL_))
- {
- NetworkMessage *nm =
- safe_cast<NetworkMessage*>(m_flit->get_msg_ptr().get());
- NetDest destination = nm->getInternalDestination();
- if(m_net_ptr->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);
+ int invc = m_flit->get_vc();
+ int outport = m_in_vc_state[inport][invc]->get_outport();
+ int outvc = m_in_vc_state[inport][invc]->get_outvc();
+
+ assert(m_net_ptr->getNumPipeStages() >= 1);
+
+ // Subtract 1 as 1 cycle will be consumed in scheduling the output link
+ m_flit->set_time(g_eventQueue_ptr->getTime() +
+ (m_net_ptr->getNumPipeStages() - 1));
+ m_flit->set_vc(outvc);
+ m_router_buffers[outport][outvc]->insert(m_flit);
+
+ if (m_net_ptr->getNumPipeStages() > 1)
+ g_eventQueue_ptr->scheduleEvent(this,
+ m_net_ptr->getNumPipeStages() - 1 );
+ if ((m_flit->get_type() == HEAD_) || (m_flit->get_type() == HEAD_TAIL_)) {
+ NetworkMessage *nm =
+ safe_cast<NetworkMessage*>(m_flit->get_msg_ptr().get());
+ NetDest destination = nm->getInternalDestination();
+
+ if (m_net_ptr->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()
+void
+Router::wakeup()
{
- flit *t_flit;
+ 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();
- }
+ // This is for round-robin scheduling of incoming ports
+ int incoming_port = m_round_robin_start;
+ m_round_robin_start++;
+ if (m_round_robin_start >= m_in_link.size()) {
+ m_round_robin_start = 0;
+ }
+
+ for (int port = 0; port < m_in_link.size(); port++) {
+ // Round robin scheduling
+ incoming_port++;
+ if (incoming_port >= m_in_link.size())
+ incoming_port = 0;
+
+ // checking the incoming link
+ if (m_in_link[incoming_port]->isReady()) {
+ 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();
+ }
+ scheduleOutputLinks();
+ checkReschedule(); // This is for flits lying in the router buffers
+ vc_arbitrate();
+ check_arbiter_reschedule();
}
-void Router::scheduleOutputLinks()
+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
- }
- }
+ 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()) {
+
+ // models buffer backpressure
+ if (m_out_vc_state[port][vc_tolookat]->isInState(ACTIVE_,
+ g_eventQueue_ptr->getTime()) &&
+ m_out_link[port]->isBufferNotFull_link(vc_tolookat)) {
+
+ 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()
+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;
- }
- }
+ 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()
+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;
- }
- }
+ 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
+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;
-*/
+ 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;
+#if 0
+ out << "---------- routing table -------------" << endl;
+ for (int i = 0; i < m_routing_table.size(); i++)
+ out << m_routing_table[i] << endl;
+#endif
}
-void Router::print(ostream& out) const
+void
+Router::print(ostream& out) const
{
- out << "[Router]";
+ out << "[Router]";
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
index 16b19204a..20a4abd54 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef ROUTER_H
-#define ROUTER_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_ROUTER_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_ROUTER_HH__
#include <iostream>
#include <vector>
@@ -45,51 +45,55 @@
class VCarbiter;
-class Router : public FlexibleConsumer {
-public:
- Router(int id, GarnetNetwork *network_ptr);
+class Router : public FlexibleConsumer
+{
+ public:
+ Router(int id, GarnetNetwork *network_ptr);
- ~Router();
+ ~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 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(std::ostream& out) const;
- void print(std::ostream& out) const;
+ void printConfig(std::ostream& out) const;
+ void print(std::ostream& out) const;
-private:
-/***************Data Members******************/
- int m_id;
- int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
- GarnetNetwork *m_net_ptr;
- std::vector<int> m_vc_round_robin; // For scheduling of out source queues
- int m_round_robin_inport, m_round_robin_start; // for vc arbitration
- std::vector<int> m_round_robin_invc; // For every outport. for vc arbitration
+ private:
+ int m_id;
+ int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
+ GarnetNetwork *m_net_ptr;
+ std::vector<int> m_vc_round_robin; // For scheduling of out source queues
+ int m_round_robin_inport, m_round_robin_start; // for vc arbitration
+ std::vector<int> m_round_robin_invc; // For vc arbitration of each outport
- std::vector<std::vector<flitBuffer *> > m_router_buffers; // These are essentially output buffers
- std::vector<flitBuffer *> m_out_src_queue; // These are source queues for the output link
- std::vector<NetworkLink *> m_in_link;
- std::vector<NetworkLink *> m_out_link;
- std::vector<std::vector<InVcState *> > m_in_vc_state;
- std::vector<std::vector<OutVcState *> > m_out_vc_state;
- std::vector<NetDest> m_routing_table;
- std::vector<int> m_link_weights;
- VCarbiter *m_vc_arbiter;
+ // These are essentially output buffers
+ std::vector<std::vector<flitBuffer *> > m_router_buffers;
-/*********** Private methods *************/
- int getRoute(NetDest destination);
- std::vector<int> get_valid_vcs(int invc);
- void routeCompute(flit *m_flit, int inport);
- void checkReschedule();
- void check_arbiter_reschedule();
- void scheduleOutputLinks();
-};
+ // These are source queues for the output link
+ std::vector<flitBuffer *> m_out_src_queue;
+
+ std::vector<NetworkLink *> m_in_link;
+ std::vector<NetworkLink *> m_out_link;
+ std::vector<std::vector<InVcState *> > m_in_vc_state;
+ std::vector<std::vector<OutVcState *> > m_out_vc_state;
+ std::vector<NetDest> m_routing_table;
+ std::vector<int> m_link_weights;
+ VCarbiter *m_vc_arbiter;
-#endif
+ int getRoute(NetDest destination);
+ std::vector<int> get_valid_vcs(int invc);
+ void routeCompute(flit *m_flit, int inport);
+ void checkReschedule();
+ void check_arbiter_reschedule();
+ void scheduleOutputLinks();
+};
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_ROUTER_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc
index fdf9aadb0..f1960d62d 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc
@@ -33,10 +33,12 @@
VCarbiter::VCarbiter(Router *router)
{
- m_router = router;
+ m_router = router;
}
-void VCarbiter::wakeup()
+void
+VCarbiter::wakeup()
{
- m_router->vc_arbitrate();
+ 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
index 3f3223f29..7aa6f9fc1 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef VC_ARBITER_H
-#define VC_ARBITER_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_VC_ARBITER_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_VC_ARBITER_HH__
#include <iostream>
@@ -38,16 +38,17 @@
class Router;
-class VCarbiter : public Consumer{
-public:
- VCarbiter(Router *router);
- ~VCarbiter() {}
+class VCarbiter : public Consumer
+{
+ public:
+ VCarbiter(Router *router);
+ ~VCarbiter() {}
- void print(std::ostream& out) const {}
- void wakeup();
+ void print(std::ostream& out) const {}
+ void wakeup();
-private:
- Router *m_router;
+ private:
+ Router *m_router;
};
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_VC_ARBITER_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
index dd0525754..1227b70f0 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
@@ -32,77 +32,94 @@
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;
+ 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_;
+ 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()
+int
+flit::get_size()
{
- return m_size;
+ return m_size;
}
-int flit::get_id()
+
+int
+flit::get_id()
{
- return m_id;
+ return m_id;
}
-Time flit::get_time()
+
+Time
+flit::get_time()
{
- return m_time;
+ return m_time;
}
-Time flit::get_enqueue_time()
+Time
+flit::get_enqueue_time()
{
- return m_enqueue_time;
+ return m_enqueue_time;
}
-void flit::set_time(Time time)
+
+void
+flit::set_time(Time time)
{
- m_time = time;
+ m_time = time;
}
-int flit::get_vnet()
+int
+flit::get_vnet()
{
- return m_vnet;
+ return m_vnet;
}
-int flit::get_vc()
+
+int
+flit::get_vc()
{
- return m_vc;
+ return m_vc;
}
-void flit::set_vc(int vc)
+
+void
+flit::set_vc(int vc)
{
- m_vc = vc;
+ m_vc = vc;
}
-MsgPtr& flit::get_msg_ptr()
+
+MsgPtr&
+flit::get_msg_ptr()
{
- return m_msg_ptr;
+ return m_msg_ptr;
}
-flit_type flit::get_type()
+
+flit_type
+flit::get_type()
{
- return m_type;
+ return m_type;
}
-void flit::print(std::ostream& out) const
+void
+flit::print(std::ostream& out) const
{
- out << "[flit:: ";
- out << "Id=" << m_id << " ";
- out << "Type=" << m_type << " ";
- out << "Vnet=" << m_vnet << " ";
- out << "VC=" << m_vc << " ";
- out << "Enqueue Time=" << m_enqueue_time << " ";
- out << "]";
+ 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
index 5aa01c5e7..e0825f3ab 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
@@ -33,44 +33,44 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/slicc_interface/Message.hh"
-#ifndef FLIT_H
-#define FLIT_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_HH__
-class flit {
-public:
- flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr);
+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(std::ostream& out) const;
+ 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(std::ostream& out) const;
- static bool
- greater(flit* n1, flit* n2)
- {
- if (n1->get_time() == n2->get_time())
- //ASSERT(n1->flit_id != n2->flit_id);
- return (n1->get_id() > n2->get_id());
- else
- return (n1->get_time() > n2->get_time());
- }
+ static bool
+ greater(flit* n1, flit* n2)
+ {
+ if (n1->get_time() == n2->get_time())
+ //ASSERT(n1->flit_id != n2->flit_id);
+ return (n1->get_id() > n2->get_id());
+ else
+ return (n1->get_time() > n2->get_time());
+ }
-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;
+ private:
+ 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;
};
@@ -82,4 +82,4 @@ operator<<(std::ostream& out, const flit& obj)
return out;
}
-#endif
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_HH__
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
index 82eb08902..2bb297e03 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
@@ -36,72 +36,79 @@ using namespace std;
flitBuffer::flitBuffer()
{
- max_size = INFINITE_;
+ max_size = INFINITE_;
}
flitBuffer::flitBuffer(int maximum_size)
{
- max_size = maximum_size;
+ max_size = maximum_size;
}
-bool flitBuffer::isEmpty()
+bool
+flitBuffer::isEmpty()
{
- return (m_buffer.size() == 0);
+ return (m_buffer.size() == 0);
}
-bool flitBuffer::isReady()
+bool
+flitBuffer::isReady()
{
- if(m_buffer.size() != 0 )
- {
- flit *t_flit = m_buffer.front();
- if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
- return true;
- }
- return false;
+ if (m_buffer.size() != 0 ) {
+ flit *t_flit = m_buffer.front();
+ if (t_flit->get_time() <= g_eventQueue_ptr->getTime())
+ return true;
+ }
+ return false;
}
-bool flitBuffer::isReadyForNext()
+bool
+flitBuffer::isReadyForNext()
{
- if(m_buffer.size() != 0 )
- {
- flit *t_flit = m_buffer.front();
- if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
- return true;
- }
- return false;
+ if (m_buffer.size() != 0 ) {
+ flit *t_flit = m_buffer.front();
+ if (t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
+ return true;
+ }
+ return false;
}
-bool flitBuffer::isFull()
+bool
+flitBuffer::isFull()
{
- return (m_buffer.size() >= max_size);
+ return (m_buffer.size() >= max_size);
}
-void flitBuffer::setMaxSize(int maximum)
+void
+flitBuffer::setMaxSize(int maximum)
{
- max_size = maximum;
+ max_size = maximum;
}
-flit* flitBuffer:: getTopFlit()
+flit*
+flitBuffer:: getTopFlit()
{
- flit *f = m_buffer.front();
- pop_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
- m_buffer.pop_back();
- return f;
+ flit *f = m_buffer.front();
+ pop_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
+ m_buffer.pop_back();
+ return f;
}
-flit* flitBuffer::peekTopFlit()
+flit*
+flitBuffer::peekTopFlit()
{
- return m_buffer.front();
+ return m_buffer.front();
}
-void flitBuffer::insert(flit *flt)
+void
+flitBuffer::insert(flit *flt)
{
- m_buffer.push_back(flt);
- push_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
+ m_buffer.push_back(flt);
+ push_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
}
-void flitBuffer::print(std::ostream& out) const
+void
+flitBuffer::print(std::ostream& out) const
{
- out << "[flitBuffer: ";
- out << m_buffer.size() << "] " << std::endl;
+ out << "[flitBuffer: ";
+ out << m_buffer.size() << "] " << std::endl;
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
index a5ec25590..619f3285f 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
@@ -28,8 +28,8 @@
* Authors: Niket Agarwal
*/
-#ifndef FLIT_BUFFER_H
-#define FLIT_BUFFER_H
+#ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_BUFFER_HH__
+#define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_BUFFER_HH__
#include <iostream>
#include <vector>
@@ -37,25 +37,25 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flit.hh"
-class flitBuffer {
-public:
- flitBuffer();
- flitBuffer(int maximum_size);
+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(std::ostream& out) const;
+ bool isReady();
+ bool isReadyForNext();
+ bool isFull();
+ bool isEmpty();
+ void setMaxSize(int maximum);
+ flit *getTopFlit();
+ flit *peekTopFlit();
+ void insert(flit *flt);
+ void print(std::ostream& out) const;
-/**********Data Members*********/
-private:
- std::vector<flit *> m_buffer;
- int size, max_size;
+ private:
+ std::vector<flit *> m_buffer;
+ int size, max_size;
};
inline std::ostream&
@@ -66,5 +66,4 @@ operator<<(std::ostream& out, const flitBuffer& obj)
return out;
}
-#endif
-
+#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLIT_BUFFER_HH__
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
index e60f1921d..000000000
--- a/src/mem/ruby/network/garnet/flexible-pipeline/netconfig.defaults
+++ /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