summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()