diff options
author | Nathan Binkert <nate@binkert.org> | 2010-06-10 23:17:07 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2010-06-10 23:17:07 -0700 |
commit | dd133c7b24aba128546d24e6042b0e0d46673aaf (patch) | |
tree | 60f82f2f2b708a0fdb6967a7bf1262b435b5e6e0 /src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh | |
parent | 3df84fd8a0ce3959c0deb4c206d910fc0d050f47 (diff) | |
download | gem5-dd133c7b24aba128546d24e6042b0e0d46673aaf.tar.xz |
ruby: get rid of PrioHeap and use STL
One big difference is that PrioHeap puts the smallest element at the
top of the heap, whereas stl puts the largest element on top, so I
changed all comparisons so they did the right thing.
Some usage of PrioHeap was simply changed to a std::vector, using sort
at the right time, other usage had me just use the various heap functions
in the stl.
Diffstat (limited to 'src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh')
-rw-r--r-- | src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh | 15 |
1 files changed, 10 insertions, 5 deletions
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; }; |