/*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
* Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
: ClockedObject(p), Consumer(this), m_id(p->link_id),
m_type(NUM_LINK_TYPES_),
m_latency(p->link_latency),
- linkBuffer(new flitBuffer()), link_consumer(nullptr),
+ linkBuffer(), link_consumer(nullptr),
link_srcQueue(nullptr), m_link_utilized(0),
m_vc_load(p->vcs_per_vnet * p->virt_nets)
{
}
-NetworkLink::~NetworkLink()
-{
- delete linkBuffer;
-}
-
void
NetworkLink::setLinkConsumer(Consumer *consumer)
{
}
void
-NetworkLink::setSourceQueue(flitBuffer *srcQueue)
+NetworkLink::setSourceQueue(flitBuffer* src_queue)
{
- link_srcQueue = srcQueue;
+ link_srcQueue = src_queue;
}
void
NetworkLink::wakeup()
{
+ assert(link_srcQueue != nullptr);
if (link_srcQueue->isReady(curCycle())) {
flit *t_flit = link_srcQueue->getTopFlit();
t_flit->set_time(curCycle() + m_latency);
- linkBuffer->insert(t_flit);
+ linkBuffer.insert(t_flit);
link_consumer->scheduleEventAbsolute(clockEdge(m_latency));
m_link_utilized++;
m_vc_load[t_flit->get_vc()]++;
uint32_t
NetworkLink::functionalWrite(Packet *pkt)
{
- return linkBuffer->functionalWrite(pkt);
+ return linkBuffer.functionalWrite(pkt);
}
/*
- * Copyright (c) 2008 Princeton University
+ * Copyright (c) 2020 Inria
* Copyright (c) 2016 Georgia Institute of Technology
+ * Copyright (c) 2008 Princeton University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
public:
typedef NetworkLinkParams Params;
NetworkLink(const Params *p);
- ~NetworkLink();
+ ~NetworkLink() = default;
void setLinkConsumer(Consumer *consumer);
- void setSourceQueue(flitBuffer *srcQueue);
+ void setSourceQueue(flitBuffer *src_queue);
void setType(link_type type) { m_type = type; }
link_type getType() { return m_type; }
void print(std::ostream& out) const {}
unsigned int getLinkUtilization() const { return m_link_utilized; }
const std::vector<unsigned int> & getVcLoad() const { return m_vc_load; }
- inline bool isReady(Cycles curTime)
- { return linkBuffer->isReady(curTime); }
+ inline bool isReady(Cycles curTime) { return linkBuffer.isReady(curTime); }
- inline flit* peekLink() { return linkBuffer->peekTopFlit(); }
- inline flit* consumeLink() { return linkBuffer->getTopFlit(); }
+ inline flit* peekLink() { return linkBuffer.peekTopFlit(); }
+ inline flit* consumeLink() { return linkBuffer.getTopFlit(); }
uint32_t functionalWrite(Packet *);
void resetStats();
link_type m_type;
const Cycles m_latency;
- flitBuffer *linkBuffer;
+ flitBuffer linkBuffer;
Consumer *link_consumer;
flitBuffer *link_srcQueue;