summaryrefslogtreecommitdiff
path: root/src/mem/ruby
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2015-08-14 19:28:44 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2015-08-14 19:28:44 -0500
commit85506f1c2107cab1760ba915cf55d9e447d0625c (patch)
treeb3c073cf53abd3b6757c360829572ba3d283c7e4 /src/mem/ruby
parentae87d68551b06f0e9ca9046f7c0674a58961e837 (diff)
downloadgem5-85506f1c2107cab1760ba915cf55d9e447d0625c.tar.xz
ruby: garnet: flexible: refactor flit
Diffstat (limited to 'src/mem/ruby')
-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 d834ea1a3..f72cea5a8 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -281,7 +281,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;