diff options
author | Daniel R. Carvalho <odanrc@yahoo.com.br> | 2019-05-06 18:23:34 +0200 |
---|---|---|
committer | Daniel Carvalho <odanrc@yahoo.com.br> | 2019-05-12 17:22:01 +0000 |
commit | 129101524aee88d2e25f3d835a59dcd1db607fb8 (patch) | |
tree | 5d6440aadfa389d553d35c3d2e85b2122cc0a6e9 /src/mem/ruby | |
parent | 8ddec45de48ddca443064212600c2583df2fe882 (diff) | |
download | gem5-129101524aee88d2e25f3d835a59dcd1db607fb8.tar.xz |
mem-ruby: Replace string parameter in MultiBitSelBloomFilter
Replace string parameter from MultiBitSelBloomFilter's constructor
by their tokenized counterparts.
Change-Id: I2e3db109dc4814fa0e9c13259f1136a6c4083092
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18728
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/mem/ruby')
-rw-r--r-- | src/mem/ruby/filters/MultiBitSelBloomFilter.cc | 32 | ||||
-rw-r--r-- | src/mem/ruby/filters/MultiBitSelBloomFilter.hh | 5 |
2 files changed, 10 insertions, 27 deletions
diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc index e2ca4d08c..cee28db04 100644 --- a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc +++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc @@ -32,35 +32,17 @@ #include "base/intmath.hh" #include "base/logging.hh" -#include "base/str.hh" using namespace std; -MultiBitSelBloomFilter::MultiBitSelBloomFilter(string str) +MultiBitSelBloomFilter::MultiBitSelBloomFilter(std::size_t filter_size, + int num_hashes, int skip_bits, bool is_parallel) + : m_filter_size(filter_size), m_num_hashes(num_hashes), + m_filter_size_bits(floorLog2(m_filter_size)), m_skip_bits(skip_bits), + m_par_filter_size(m_filter_size / m_num_hashes), + m_par_filter_size_bits(floorLog2(m_par_filter_size)), + isParallel(is_parallel) { - vector<string> items; - tokenize(items, str, '_'); - assert(items.size() == 4); - - // head contains filter size, tail contains bit offset from block number - m_filter_size = atoi(items[0].c_str()); - m_num_hashes = atoi(items[1].c_str()); - m_skip_bits = atoi(items[2].c_str()); - - if (items[3] == "Regular") { - isParallel = false; - } else if (items[3] == "Parallel") { - isParallel = true; - } else { - panic("ERROR: Incorrect config string for MultiBitSel Bloom! :%s", - str); - } - - m_filter_size_bits = floorLog2(m_filter_size); - - m_par_filter_size = m_filter_size / m_num_hashes; - m_par_filter_size_bits = floorLog2(m_par_filter_size); - m_filter.resize(m_filter_size); clear(); } diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.hh b/src/mem/ruby/filters/MultiBitSelBloomFilter.hh index b4fac0671..23d970a2e 100644 --- a/src/mem/ruby/filters/MultiBitSelBloomFilter.hh +++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.hh @@ -30,7 +30,6 @@ #define __MEM_RUBY_FILTERS_MULTIBITSELBLOOMFILTER_HH__ #include <iostream> -#include <string> #include <vector> #include "mem/ruby/common/Address.hh" @@ -40,7 +39,8 @@ class MultiBitSelBloomFilter : public AbstractBloomFilter { public: - MultiBitSelBloomFilter(std::string config); + MultiBitSelBloomFilter(std::size_t filter_size, int num_hashes, + int skip_bits, bool is_parallel); ~MultiBitSelBloomFilter(); void clear(); @@ -75,6 +75,7 @@ class MultiBitSelBloomFilter : public AbstractBloomFilter int m_filter_size; int m_num_hashes; int m_filter_size_bits; + // Bit offset from block number int m_skip_bits; int m_par_filter_size; |