From: Daniel R. Carvalho Date: Mon, 6 May 2019 16:23:34 +0000 (+0200) Subject: mem-ruby: Replace string parameter in MultiBitSelBloomFilter X-Git-Tag: v19.0.0.0~863 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=129101524aee88d2e25f3d835a59dcd1db607fb8;p=gem5.git 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18728 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- 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 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 -#include #include #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;