summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mem/ruby/filters/AbstractBloomFilter.hh7
-rw-r--r--src/mem/ruby/filters/BlockBloomFilter.cc10
-rw-r--r--src/mem/ruby/filters/BloomFilters.py3
-rw-r--r--src/mem/ruby/filters/BulkBloomFilter.cc36
-rw-r--r--src/mem/ruby/filters/H3BloomFilter.cc2
-rw-r--r--src/mem/ruby/filters/LSB_CountingBloomFilter.cc5
-rw-r--r--src/mem/ruby/filters/MultiBitSelBloomFilter.cc2
-rw-r--r--src/mem/ruby/filters/MultiGrainBloomFilter.cc7
-rw-r--r--src/mem/ruby/filters/NonCountingBloomFilter.cc6
9 files changed, 34 insertions, 44 deletions
diff --git a/src/mem/ruby/filters/AbstractBloomFilter.hh b/src/mem/ruby/filters/AbstractBloomFilter.hh
index 301a78122..6a62d0ab1 100644
--- a/src/mem/ruby/filters/AbstractBloomFilter.hh
+++ b/src/mem/ruby/filters/AbstractBloomFilter.hh
@@ -42,6 +42,9 @@
class AbstractBloomFilter : public SimObject
{
protected:
+ /** Number of LSB bits to ignore from the the addresses. */
+ const unsigned offsetBits;
+
/** The filter itself. */
std::vector<int> filter;
@@ -56,8 +59,8 @@ class AbstractBloomFilter : public SimObject
* Create and clear the filter.
*/
AbstractBloomFilter(const AbstractBloomFilterParams* p)
- : SimObject(p), filter(p->size), sizeBits(floorLog2(p->size)),
- setThreshold(p->threshold)
+ : SimObject(p), offsetBits(p->offset_bits), filter(p->size),
+ sizeBits(floorLog2(p->size)), setThreshold(p->threshold)
{
clear();
}
diff --git a/src/mem/ruby/filters/BlockBloomFilter.cc b/src/mem/ruby/filters/BlockBloomFilter.cc
index a93e8ff2c..009eb07c1 100644
--- a/src/mem/ruby/filters/BlockBloomFilter.cc
+++ b/src/mem/ruby/filters/BlockBloomFilter.cc
@@ -29,7 +29,6 @@
#include "mem/ruby/filters/BlockBloomFilter.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/system/RubySystem.hh"
#include "params/BlockBloomFilter.hh"
BlockBloomFilter::BlockBloomFilter(const BlockBloomFilterParams* p)
@@ -65,13 +64,10 @@ BlockBloomFilter::hash(Addr addr) const
// Pull out some bit field ==> B1
// Pull out additional bits, not the same as B1 ==> B2
// XOR B1 and B2 to get hash index
- Addr block_bits = bitSelect(addr, RubySystem::getBlockSizeBits(),
- 2 * RubySystem::getBlockSizeBits() - 1);
+ Addr block_bits = bitSelect(addr, offsetBits, 2 * offsetBits - 1);
int offset = 5;
- Addr other_bits = bitSelect(addr,
- 2 * RubySystem::getBlockSizeBits() + offset,
- 2 * RubySystem::getBlockSizeBits() + offset +
- sizeBits - 1);
+ Addr other_bits = bitSelect(addr, 2 * offsetBits + offset,
+ 2 * offsetBits + offset + sizeBits - 1);
int index = block_bits ^ other_bits;
assert(index < filter.size());
return index;
diff --git a/src/mem/ruby/filters/BloomFilters.py b/src/mem/ruby/filters/BloomFilters.py
index 49ebaa3bf..93d4dec31 100644
--- a/src/mem/ruby/filters/BloomFilters.py
+++ b/src/mem/ruby/filters/BloomFilters.py
@@ -37,6 +37,9 @@ class AbstractBloomFilter(SimObject):
size = Param.Int(4096, "Number of entries in the filter")
+ # By default assume that bloom filters are used for 64-byte cache lines
+ offset_bits = Param.Unsigned(6, "Number of bits in a cache line offset")
+
# Most of the filters are booleans, and thus saturate on 1
threshold = Param.Int(1, "Value at which an entry is considered as set")
diff --git a/src/mem/ruby/filters/BulkBloomFilter.cc b/src/mem/ruby/filters/BulkBloomFilter.cc
index f2a2108b0..00c4dcdb9 100644
--- a/src/mem/ruby/filters/BulkBloomFilter.cc
+++ b/src/mem/ruby/filters/BulkBloomFilter.cc
@@ -29,7 +29,6 @@
#include "mem/ruby/filters/BulkBloomFilter.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/system/RubySystem.hh"
#include "params/BulkBloomFilter.hh"
BulkBloomFilter::BulkBloomFilter(const BulkBloomFilterParams* p)
@@ -46,12 +45,11 @@ BulkBloomFilter::set(Addr addr)
{
// c0 contains the cache index bits
int set_bits = sectorBits;
- int block_bits = RubySystem::getBlockSizeBits();
- int c0 = bitSelect(addr, block_bits, block_bits + set_bits - 1);
+ int c0 = bitSelect(addr, offsetBits, offsetBits + set_bits - 1);
// c1 contains the lower sectorBits permuted bits
//Address permuted_bits = permute(addr);
//int c1 = permuted_bits.bitSelect(0, set_bits-1);
- int c1 = bitSelect(addr, block_bits+set_bits, (block_bits+2*set_bits) - 1);
+ int c1 = bitSelect(addr, offsetBits+set_bits, (offsetBits+2*set_bits) - 1);
//assert(c0 < (filter_size/2));
//assert(c0 + (filter_size/2) < filter_size);
//assert(c1 < (filter_size/2));
@@ -67,12 +65,11 @@ BulkBloomFilter::isSet(Addr addr) const
// c0 contains the cache index bits
const int filter_size = filter.size();
int set_bits = sectorBits;
- int block_bits = RubySystem::getBlockSizeBits();
- int c0 = bitSelect(addr, block_bits, block_bits + set_bits - 1);
+ int c0 = bitSelect(addr, offsetBits, offsetBits + set_bits - 1);
// c1 contains the lower 10 permuted bits
//Address permuted_bits = permute(addr);
//int c1 = permuted_bits.bitSelect(0, set_bits-1);
- int c1 = bitSelect(addr, block_bits+set_bits, (block_bits+2*set_bits) - 1);
+ int c1 = bitSelect(addr, offsetBits+set_bits, (offsetBits+2*set_bits) - 1);
//assert(c0 < (filter_size/2));
//assert(c0 + (filter_size/2) < filter_size);
//assert(c1 < (filter_size/2));
@@ -130,18 +127,17 @@ Addr
BulkBloomFilter::hash(Addr addr) const
{
// permutes the original address bits according to Table 5
- int block_offset = RubySystem::getBlockSizeBits();
- Addr part1 = bitSelect(addr, block_offset, block_offset + 6),
- part2 = bitSelect(addr, block_offset + 9, block_offset + 9),
- part3 = bitSelect(addr, block_offset + 11, block_offset + 11),
- part4 = bitSelect(addr, block_offset + 17, block_offset + 17),
- part5 = bitSelect(addr, block_offset + 7, block_offset + 8),
- part6 = bitSelect(addr, block_offset + 10, block_offset + 10),
- part7 = bitSelect(addr, block_offset + 12, block_offset + 12),
- part8 = bitSelect(addr, block_offset + 13, block_offset + 13),
- part9 = bitSelect(addr, block_offset + 15, block_offset + 16),
- part10 = bitSelect(addr, block_offset + 18, block_offset + 20),
- part11 = bitSelect(addr, block_offset + 14, block_offset + 14);
+ Addr part1 = bitSelect(addr, offsetBits, offsetBits + 6),
+ part2 = bitSelect(addr, offsetBits + 9, offsetBits + 9),
+ part3 = bitSelect(addr, offsetBits + 11, offsetBits + 11),
+ part4 = bitSelect(addr, offsetBits + 17, offsetBits + 17),
+ part5 = bitSelect(addr, offsetBits + 7, offsetBits + 8),
+ part6 = bitSelect(addr, offsetBits + 10, offsetBits + 10),
+ part7 = bitSelect(addr, offsetBits + 12, offsetBits + 12),
+ part8 = bitSelect(addr, offsetBits + 13, offsetBits + 13),
+ part9 = bitSelect(addr, offsetBits + 15, offsetBits + 16),
+ part10 = bitSelect(addr, offsetBits + 18, offsetBits + 20),
+ part11 = bitSelect(addr, offsetBits + 14, offsetBits + 14);
Addr result =
(part1 << 14) | (part2 << 13) | (part3 << 12) | (part4 << 11) |
@@ -151,7 +147,7 @@ BulkBloomFilter::hash(Addr addr) const
// assume 32 bit addresses (both virtual and physical)
// select the remaining high-order 11 bits
Addr remaining_bits =
- bitSelect(addr, block_offset + 21, 31) << 21;
+ bitSelect(addr, offsetBits + 21, 31) << 21;
result = result | remaining_bits;
return result;
diff --git a/src/mem/ruby/filters/H3BloomFilter.cc b/src/mem/ruby/filters/H3BloomFilter.cc
index 2b641722b..1e2ab88dd 100644
--- a/src/mem/ruby/filters/H3BloomFilter.cc
+++ b/src/mem/ruby/filters/H3BloomFilter.cc
@@ -396,7 +396,7 @@ H3BloomFilter::getCount(Addr addr) const
int
H3BloomFilter::hash(Addr addr, int hash_number) const
{
- uint64_t x = makeLineAddress(addr);
+ uint64_t x = maskLowOrderBits(addr, offsetBits);
int y = hashH3(x, hash_number);
if (isParallel) {
diff --git a/src/mem/ruby/filters/LSB_CountingBloomFilter.cc b/src/mem/ruby/filters/LSB_CountingBloomFilter.cc
index 0d899a76e..1dd9fb1ee 100644
--- a/src/mem/ruby/filters/LSB_CountingBloomFilter.cc
+++ b/src/mem/ruby/filters/LSB_CountingBloomFilter.cc
@@ -29,7 +29,6 @@
#include "mem/ruby/filters/LSB_CountingBloomFilter.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/system/RubySystem.hh"
#include "params/LSB_CountingBloomFilter.hh"
LSB_CountingBloomFilter::LSB_CountingBloomFilter(
@@ -67,9 +66,7 @@ LSB_CountingBloomFilter::getCount(Addr addr) const
int
LSB_CountingBloomFilter::hash(Addr addr) const
{
- return bitSelect(addr, RubySystem::getBlockSizeBits(),
- RubySystem::getBlockSizeBits() +
- sizeBits - 1);
+ return bitSelect(addr, offsetBits, offsetBits + sizeBits - 1);
}
LSB_CountingBloomFilter*
diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc
index 88fb8d366..6274606de 100644
--- a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc
+++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc
@@ -76,7 +76,7 @@ MultiBitSelBloomFilter::getCount(Addr addr) const
int
MultiBitSelBloomFilter::hash(Addr addr, int hash_number) const
{
- uint64_t x = (makeLineAddress(addr) >> skipBits);
+ uint64_t x = (maskLowOrderBits(addr, offsetBits) >> skipBits);
int y = hashBitsel(x, hash_number, numHashes, 30, sizeBits);
//36-bit addresses, 6-bit cache lines
diff --git a/src/mem/ruby/filters/MultiGrainBloomFilter.cc b/src/mem/ruby/filters/MultiGrainBloomFilter.cc
index 8360564c9..8cfc3ebda 100644
--- a/src/mem/ruby/filters/MultiGrainBloomFilter.cc
+++ b/src/mem/ruby/filters/MultiGrainBloomFilter.cc
@@ -29,7 +29,6 @@
#include "mem/ruby/filters/MultiGrainBloomFilter.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/system/RubySystem.hh"
#include "params/MultiGrainBloomFilter.hh"
MultiGrainBloomFilter::MultiGrainBloomFilter(
@@ -88,15 +87,13 @@ int
MultiGrainBloomFilter::hash(Addr addr) const
{
// grap a chunk of bits after byte offset
- return bitSelect(addr, RubySystem::getBlockSizeBits(),
- RubySystem::getBlockSizeBits() +
- sizeBits - 1);
+ return bitSelect(addr, offsetBits, offsetBits + sizeBits - 1);
}
int
MultiGrainBloomFilter::pageHash(Addr addr) const
{
- int bits = RubySystem::getBlockSizeBits() + sizeBits - 1;
+ int bits = offsetBits + sizeBits - 1;
// grap a chunk of bits after first chunk
return bitSelect(addr, bits, bits + pageFilterSizeBits - 1);
diff --git a/src/mem/ruby/filters/NonCountingBloomFilter.cc b/src/mem/ruby/filters/NonCountingBloomFilter.cc
index 61bc26f60..eea9126ba 100644
--- a/src/mem/ruby/filters/NonCountingBloomFilter.cc
+++ b/src/mem/ruby/filters/NonCountingBloomFilter.cc
@@ -29,7 +29,6 @@
#include "mem/ruby/filters/NonCountingBloomFilter.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/system/RubySystem.hh"
#include "params/NonCountingBloomFilter.hh"
NonCountingBloomFilter::NonCountingBloomFilter(
@@ -73,9 +72,8 @@ NonCountingBloomFilter::getCount(Addr addr) const
int
NonCountingBloomFilter::hash(Addr addr) const
{
- return bitSelect(addr, RubySystem::getBlockSizeBits() + skipBits,
- RubySystem::getBlockSizeBits() + skipBits +
- sizeBits - 1);
+ return bitSelect(addr, offsetBits + skipBits,
+ offsetBits + skipBits + sizeBits - 1);
}
NonCountingBloomFilter*