summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2015-09-23 11:23:11 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2015-09-23 11:23:11 -0500
commitb3a3b0b6cfd7e1fab192982170973d3e968a17cd (patch)
tree4bef7334834f1c661f793900204e15dad4ec1d2f /src/mem/ruby/network
parent6bd7aa1f201253905458efaf8bf1202ffbd0d70a (diff)
downloadgem5-b3a3b0b6cfd7e1fab192982170973d3e968a17cd.tar.xz
ruby: garnet: refactor code in network links
Diffstat (limited to 'src/mem/ruby/network')
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc16
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh10
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc19
3 files changed, 15 insertions, 30 deletions
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 32fce83ce..8d9acd433 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
@@ -32,18 +32,12 @@
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
NetworkLink_d::NetworkLink_d(const Params *p)
- : ClockedObject(p), Consumer(this)
+ : ClockedObject(p), Consumer(this), m_id(p->link_id),
+ m_latency(p->link_latency), channel_width(p->channel_width),
+ linkBuffer(new flitBuffer_d()), link_consumer(nullptr),
+ link_srcQueue(nullptr), m_link_utilized(0),
+ m_vc_load(p->vcs_per_vnet * p->virt_nets)
{
- m_latency = p->link_latency;
- channel_width = p->channel_width;
- m_id = p->link_id;
- linkBuffer = new flitBuffer_d();
- m_link_utilized = 0;
- m_vc_load.resize(p->vcs_per_vnet * p->virt_nets);
-
- for (int i = 0; i < (p->vcs_per_vnet * p->virt_nets); i++) {
- m_vc_load[i] = 0;
- }
}
NetworkLink_d::~NetworkLink_d()
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 22ca27a7e..ad9fef2f4 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
@@ -51,8 +51,8 @@ class NetworkLink_d : public ClockedObject, public Consumer
void setLinkConsumer(Consumer *consumer);
void setSourceQueue(flitBuffer_d *srcQueue);
- void print(std::ostream& out) const{}
- int get_id(){return m_id;}
+ void print(std::ostream& out) const {}
+ int get_id() const { return m_id; }
void wakeup();
unsigned int getLinkUtilization() const { return m_link_utilized; }
@@ -67,9 +67,9 @@ class NetworkLink_d : public ClockedObject, public Consumer
uint32_t functionalWrite(Packet *);
private:
- int m_id;
- Cycles m_latency;
- int channel_width;
+ const int m_id;
+ const Cycles m_latency;
+ const int channel_width;
flitBuffer_d *linkBuffer;
Consumer *link_consumer;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
index f007422bd..f445b5d07 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
@@ -32,21 +32,12 @@
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
NetworkLink::NetworkLink(const Params *p)
- : ClockedObject(p), Consumer(this)
+ : ClockedObject(p), Consumer(this), m_id(p->link_id),
+ m_latency(p->link_latency), m_in_port(0), m_out_port(0),
+ linkBuffer(new flitBuffer()), link_consumer(nullptr),
+ link_source(nullptr), link_srcQueue(nullptr), m_link_utilized(0),
+ m_vc_load(p->virt_nets * p->vcs_per_vnet)
{
- linkBuffer = new flitBuffer();
- m_in_port = 0;
- m_out_port = 0;
- m_link_utilized = 0;
- m_latency = p->link_latency;
- m_id = p->link_id;
-
- int num_net = p->virt_nets;
- int num_vc = p->vcs_per_vnet;
- m_vc_load.resize(num_net * num_vc);
-
- for (int i = 0; i < num_net * num_vc; i++)
- m_vc_load[i] = 0;
}
NetworkLink::~NetworkLink()