summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2015-10-14 00:29:38 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2015-10-14 00:29:38 -0500
commit7defb594b3d271f61079bec1b929a89277fc678c (patch)
treeac120fbb1fe75a7b24a75ed9a6a85d00d2cbbce4 /src
parent2ac04c11accb46f92cf7f2b7abe40404dbf8c5d6 (diff)
downloadgem5-7defb594b3d271f61079bec1b929a89277fc678c.tar.xz
ruby: garnet: flexible: refactor flit
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc2
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.cc80
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.hh33
3 files changed, 20 insertions, 95 deletions
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index 3d75ef8c2..d2a6ed4b1 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -274,7 +274,7 @@ NetworkInterface::wakeup()
int vnet = t_flit->get_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();
m_net_ptr->increment_network_latency(network_delay, vnet);
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
index 7cf68560f..aaf19b3b5 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
@@ -31,14 +31,10 @@
#include "mem/ruby/network/garnet/flexible-pipeline/flit.hh"
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_enqueue_time = curTime;
m_time = curTime;
- m_id = id;
- m_vnet = vnet;
- m_vc = vc;
if (size == 1) {
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_;
}
-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
flit::print(std::ostream& out) const
{
@@ -132,7 +56,7 @@ flit::print(std::ostream& out) const
out << "Type=" << m_type << " ";
out << "Vnet=" << m_vnet << " ";
out << "VC=" << m_vc << " ";
- out << "Enqueue Time=" << m_enqueue_time << " ";
+ out << "Creation Time=" << m_creation_time << " ";
out << "]";
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
index ff4afbc08..4049a9212 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
@@ -43,18 +43,18 @@ class flit
public:
flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime);
- int get_size();
- int get_id();
- Cycles get_time();
- Cycles get_enqueue_time();
- void set_time(Cycles time);
- int get_vnet();
- int get_vc();
- void set_vc(int vc);
- MsgPtr& get_msg_ptr();
- flit_type get_type();
- void set_delay(Cycles delay);
- Cycles get_delay();
+ int get_size() const { return m_size; }
+ int get_id() const { return m_id; }
+ Cycles get_time() const { return m_time; }
+ Cycles get_creation_time() const { return m_creation_time; }
+ void set_time(Cycles time) { m_time = time; }
+ int get_vnet() const { return m_vnet; }
+ int get_vc() const { return m_vc; }
+ void set_vc(int vc) { m_vc = vc; }
+ MsgPtr& get_msg_ptr() { return m_msg_ptr; }
+ flit_type get_type() const { return m_type; }
+ void set_delay(Cycles delay) { src_delay = delay; }
+ Cycles get_delay() const { return src_delay; }
void print(std::ostream& out) const;
static bool
@@ -71,11 +71,12 @@ class flit
bool functionalWrite(Packet *pkt);
private:
- int m_id;
- int m_vnet;
+ const int m_id;
+ const int m_vnet;
int m_vc;
- int m_size;
- Cycles m_enqueue_time, m_time;
+ const int m_size;
+ const Cycles m_creation_time;
+ Cycles m_time;
flit_type m_type;
MsgPtr m_msg_ptr;
Cycles src_delay;