summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/garnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/network/garnet')
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh1
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh15
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh23
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh1
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/Router.hh1
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.hh23
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc18
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh4
9 files changed, 47 insertions, 43 deletions
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
index 29699562d..39fdd3c6f 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
@@ -37,7 +37,6 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/network/orion/power_bus.hh"
class GarnetNetwork_d;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
index 38510c758..5387604d4 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
@@ -49,7 +49,7 @@ bool flitBuffer_d::isReady()
{
if(m_buffer.size() != 0 )
{
- flit_d *t_flit = m_buffer.peekMin();
+ flit_d *t_flit = peekTopFlit();
if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
return true;
}
@@ -60,7 +60,7 @@ bool flitBuffer_d::isReadyForNext()
{
if(m_buffer.size() != 0 )
{
- flit_d *t_flit = m_buffer.peekMin();
+ flit_d *t_flit = peekTopFlit();
if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
return true;
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
index 976fa4053..8aa869f82 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
@@ -31,10 +31,11 @@
#ifndef FLIT_BUFFER_D_H
#define FLIT_BUFFER_D_H
+#include <algorithm>
#include <iostream>
+#include <vector>
#include "mem/ruby/network/garnet/NetworkHeader.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
class flitBuffer_d {
@@ -51,19 +52,23 @@ public:
inline flit_d* getTopFlit()
{
- return m_buffer.extractMin();
+ flit_d *f = m_buffer.front();
+ std::pop_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
+ m_buffer.pop_back();
+ return f;
}
inline flit_d* peekTopFlit()
{
- return m_buffer.peekMin();
+ return m_buffer.front();
}
inline void insert(flit_d *flt)
{
- m_buffer.insert(flt);
+ m_buffer.push_back(flt);
+ std::push_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
}
/**********Data Members*********/
private:
- PrioHeap <flit_d *> m_buffer;
+ std::vector<flit_d *> m_buffer;
int size, max_size;
};
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
index 39bbe011d..ec2774a94 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
@@ -115,6 +115,16 @@ public:
return src_delay;
}
+ static bool
+ greater(flit_d* n1, flit_d* n2)
+ {
+ if (n1->get_time() == n2->get_time()) {
+ //ASSERT(n1->flit_id != n2->flit_id);
+ return (n1->get_id() > n2->get_id());
+ } else {
+ return (n1->get_time() > n2->get_time());
+ }
+ }
private:
/************Data Members*************/
@@ -132,19 +142,6 @@ private:
};
-inline extern bool node_less_then_eq(flit_d* n1, flit_d* n2);
-
-inline extern
-bool node_less_then_eq(flit_d* n1, flit_d* n2)
-{
- if (n1->get_time() == n2->get_time()) {
-// ASSERT(n1->flit_id != n2->flit_id);
- return (n1->get_id() <= n2->get_id());
- } else {
- return (n1->get_time() <= n2->get_time());
- }
-}
-
inline std::ostream&
operator<<(std::ostream& out, const flit_d& obj)
{
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
index c23d55b48..9f1311dce 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
@@ -37,7 +37,6 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/common/NetDest.hh"
class GarnetNetwork;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
index b6ebb601f..16b19204a 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
@@ -37,7 +37,6 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
#include "mem/ruby/common/NetDest.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
index 1cc8806e9..5aa01c5e7 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
@@ -52,6 +52,16 @@ public:
flit_type get_type();
void print(std::ostream& out) const;
+ static bool
+ greater(flit* n1, flit* n2)
+ {
+ if (n1->get_time() == n2->get_time())
+ //ASSERT(n1->flit_id != n2->flit_id);
+ return (n1->get_id() > n2->get_id());
+ else
+ return (n1->get_time() > n2->get_time());
+ }
+
private:
/************Data Members*************/
int m_id;
@@ -64,19 +74,6 @@ private:
};
-inline extern bool node_less_then_eq(flit* n1, flit* n2);
-
-inline extern
-bool node_less_then_eq(flit* n1, flit* n2)
-{
- if (n1->get_time() == n2->get_time()) {
-// ASSERT(n1->flit_id != n2->flit_id);
- return (n1->get_id() <= n2->get_id());
- } else {
- return (n1->get_time() <= n2->get_time());
- }
-}
-
inline std::ostream&
operator<<(std::ostream& out, const flit& obj)
{
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
index 7f41d6f8c..82eb08902 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
@@ -28,8 +28,12 @@
* Authors: Niket Agarwal
*/
+#include <algorithm>
+
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
+using namespace std;
+
flitBuffer::flitBuffer()
{
max_size = INFINITE_;
@@ -49,7 +53,7 @@ bool flitBuffer::isReady()
{
if(m_buffer.size() != 0 )
{
- flit *t_flit = m_buffer.peekMin();
+ flit *t_flit = m_buffer.front();
if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
return true;
}
@@ -60,7 +64,7 @@ bool flitBuffer::isReadyForNext()
{
if(m_buffer.size() != 0 )
{
- flit *t_flit = m_buffer.peekMin();
+ flit *t_flit = m_buffer.front();
if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
return true;
}
@@ -79,17 +83,21 @@ void flitBuffer::setMaxSize(int maximum)
flit* flitBuffer:: getTopFlit()
{
- return m_buffer.extractMin();
+ flit *f = m_buffer.front();
+ pop_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
+ m_buffer.pop_back();
+ return f;
}
flit* flitBuffer::peekTopFlit()
{
- return m_buffer.peekMin();
+ return m_buffer.front();
}
void flitBuffer::insert(flit *flt)
{
- m_buffer.insert(flt);
+ m_buffer.push_back(flt);
+ push_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
}
void flitBuffer::print(std::ostream& out) const
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
index 646cd99c7..a5ec25590 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
@@ -32,9 +32,9 @@
#define FLIT_BUFFER_H
#include <iostream>
+#include <vector>
#include "mem/ruby/network/garnet/NetworkHeader.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flit.hh"
class flitBuffer {
@@ -54,7 +54,7 @@ public:
/**********Data Members*********/
private:
- PrioHeap <flit *> m_buffer;
+ std::vector<flit *> m_buffer;
int size, max_size;
};