ruby: garnet: flexible: refactor flit

This commit is contained in:
Nilay Vaish 2015-08-14 19:28:44 -05:00
parent ae87d68551
commit 85506f1c21
3 changed files with 20 additions and 95 deletions

View file

@ -281,7 +281,7 @@ NetworkInterface::wakeup()
int vnet = t_flit->get_vnet(); int vnet = t_flit->get_vnet();
m_net_ptr->increment_received_flits(vnet); m_net_ptr->increment_received_flits(vnet);
Cycles network_delay = curCycle() - t_flit->get_enqueue_time(); Cycles network_delay = curCycle() - t_flit->get_creation_time();
Cycles queueing_delay = t_flit->get_delay(); Cycles queueing_delay = t_flit->get_delay();
m_net_ptr->increment_network_latency(network_delay, vnet); m_net_ptr->increment_network_latency(network_delay, vnet);

View file

@ -31,14 +31,10 @@
#include "mem/ruby/network/garnet/flexible-pipeline/flit.hh" #include "mem/ruby/network/garnet/flexible-pipeline/flit.hh"
flit::flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime) flit::flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime)
: m_id(id), m_vnet(vnet), m_vc(vc), m_size(size), m_creation_time(curTime)
{ {
m_size = size;
m_msg_ptr = msg_ptr; m_msg_ptr = msg_ptr;
m_enqueue_time = curTime;
m_time = curTime; m_time = curTime;
m_id = id;
m_vnet = vnet;
m_vc = vc;
if (size == 1) { if (size == 1) {
m_type = HEAD_TAIL_; m_type = HEAD_TAIL_;
@ -52,78 +48,6 @@ flit::flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime)
m_type = BODY_; m_type = BODY_;
} }
int
flit::get_size()
{
return m_size;
}
int
flit::get_id()
{
return m_id;
}
Cycles
flit::get_time()
{
return m_time;
}
Cycles
flit::get_enqueue_time()
{
return m_enqueue_time;
}
void
flit::set_time(Cycles time)
{
m_time = time;
}
int
flit::get_vnet()
{
return m_vnet;
}
int
flit::get_vc()
{
return m_vc;
}
void
flit::set_vc(int vc)
{
m_vc = vc;
}
MsgPtr&
flit::get_msg_ptr()
{
return m_msg_ptr;
}
flit_type
flit::get_type()
{
return m_type;
}
void
flit::set_delay(Cycles delay)
{
src_delay = delay;
}
Cycles
flit::get_delay()
{
return src_delay;
}
void void
flit::print(std::ostream& out) const flit::print(std::ostream& out) const
{ {
@ -132,7 +56,7 @@ flit::print(std::ostream& out) const
out << "Type=" << m_type << " "; out << "Type=" << m_type << " ";
out << "Vnet=" << m_vnet << " "; out << "Vnet=" << m_vnet << " ";
out << "VC=" << m_vc << " "; out << "VC=" << m_vc << " ";
out << "Enqueue Time=" << m_enqueue_time << " "; out << "Creation Time=" << m_creation_time << " ";
out << "]"; out << "]";
} }

View file

@ -43,18 +43,18 @@ class flit
public: public:
flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime); flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime);
int get_size(); int get_size() const { return m_size; }
int get_id(); int get_id() const { return m_id; }
Cycles get_time(); Cycles get_time() const { return m_time; }
Cycles get_enqueue_time(); Cycles get_creation_time() const { return m_creation_time; }
void set_time(Cycles time); void set_time(Cycles time) { m_time = time; }
int get_vnet(); int get_vnet() const { return m_vnet; }
int get_vc(); int get_vc() const { return m_vc; }
void set_vc(int vc); void set_vc(int vc) { m_vc = vc; }
MsgPtr& get_msg_ptr(); MsgPtr& get_msg_ptr() { return m_msg_ptr; }
flit_type get_type(); flit_type get_type() const { return m_type; }
void set_delay(Cycles delay); void set_delay(Cycles delay) { src_delay = delay; }
Cycles get_delay(); Cycles get_delay() const { return src_delay; }
void print(std::ostream& out) const; void print(std::ostream& out) const;
static bool static bool
@ -71,11 +71,12 @@ class flit
bool functionalWrite(Packet *pkt); bool functionalWrite(Packet *pkt);
private: private:
int m_id; const int m_id;
int m_vnet; const int m_vnet;
int m_vc; int m_vc;
int m_size; const int m_size;
Cycles m_enqueue_time, m_time; const Cycles m_creation_time;
Cycles m_time;
flit_type m_type; flit_type m_type;
MsgPtr m_msg_ptr; MsgPtr m_msg_ptr;
Cycles src_delay; Cycles src_delay;