#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()
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; }
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;
#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()