diff options
Diffstat (limited to 'src/mem/ruby')
-rw-r--r-- | src/mem/ruby/filters/BlockBloomFilter.cc | 8 | ||||
-rw-r--r-- | src/mem/ruby/filters/BulkBloomFilter.cc | 47 | ||||
-rw-r--r-- | src/mem/ruby/filters/H3BloomFilter.cc | 6 | ||||
-rw-r--r-- | src/mem/ruby/filters/LSB_CountingBloomFilter.cc | 4 | ||||
-rw-r--r-- | src/mem/ruby/filters/MultiBitSelBloomFilter.cc | 7 | ||||
-rw-r--r-- | src/mem/ruby/filters/MultiGrainBloomFilter.cc | 8 | ||||
-rw-r--r-- | src/mem/ruby/filters/NonCountingBloomFilter.cc | 5 |
7 files changed, 44 insertions, 41 deletions
diff --git a/src/mem/ruby/filters/BlockBloomFilter.cc b/src/mem/ruby/filters/BlockBloomFilter.cc index 009eb07c1..0718c96ef 100644 --- a/src/mem/ruby/filters/BlockBloomFilter.cc +++ b/src/mem/ruby/filters/BlockBloomFilter.cc @@ -28,7 +28,7 @@ #include "mem/ruby/filters/BlockBloomFilter.hh" -#include "mem/ruby/common/Address.hh" +#include "base/bitfield.hh" #include "params/BlockBloomFilter.hh" BlockBloomFilter::BlockBloomFilter(const BlockBloomFilterParams* p) @@ -64,10 +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, offsetBits, 2 * offsetBits - 1); + Addr block_bits = bits(addr, 2 * offsetBits - 1, offsetBits); int offset = 5; - Addr other_bits = bitSelect(addr, 2 * offsetBits + offset, - 2 * offsetBits + offset + sizeBits - 1); + Addr other_bits = bits(addr, 2 * offsetBits + offset + sizeBits - 1, + 2 * offsetBits + offset); int index = block_bits ^ other_bits; assert(index < filter.size()); return index; diff --git a/src/mem/ruby/filters/BulkBloomFilter.cc b/src/mem/ruby/filters/BulkBloomFilter.cc index 00c4dcdb9..f2b76aab2 100644 --- a/src/mem/ruby/filters/BulkBloomFilter.cc +++ b/src/mem/ruby/filters/BulkBloomFilter.cc @@ -28,7 +28,9 @@ #include "mem/ruby/filters/BulkBloomFilter.hh" -#include "mem/ruby/common/Address.hh" +#include <limits> + +#include "base/bitfield.hh" #include "params/BulkBloomFilter.hh" BulkBloomFilter::BulkBloomFilter(const BulkBloomFilterParams* p) @@ -44,12 +46,11 @@ void BulkBloomFilter::set(Addr addr) { // c0 contains the cache index bits - int set_bits = sectorBits; - int c0 = bitSelect(addr, offsetBits, offsetBits + set_bits - 1); + int c0 = bits(addr, offsetBits + sectorBits - 1, offsetBits); // 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, offsetBits+set_bits, (offsetBits+2*set_bits) - 1); + int c1 = bits(addr, (offsetBits + 2 * sectorBits) - 1, + offsetBits + sectorBits); //assert(c0 < (filter_size/2)); //assert(c0 + (filter_size/2) < filter_size); //assert(c1 < (filter_size/2)); @@ -64,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 c0 = bitSelect(addr, offsetBits, offsetBits + set_bits - 1); + int c0 = bits(addr, offsetBits + sectorBits - 1, offsetBits); // 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, offsetBits+set_bits, (offsetBits+2*set_bits) - 1); + int c1 = bits(addr, (offsetBits + 2 * sectorBits) - 1, + offsetBits + sectorBits); //assert(c0 < (filter_size/2)); //assert(c0 + (filter_size/2) < filter_size); //assert(c1 < (filter_size/2)); @@ -127,27 +127,26 @@ Addr BulkBloomFilter::hash(Addr addr) const { // permutes the original address bits according to Table 5 - 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 part1 = bits(addr, offsetBits + 6, offsetBits), + part2 = bits(addr, offsetBits + 9), + part3 = bits(addr, offsetBits + 11), + part4 = bits(addr, offsetBits + 17), + part5 = bits(addr, offsetBits + 8, offsetBits + 7), + part6 = bits(addr, offsetBits + 10), + part7 = bits(addr, offsetBits + 12), + part8 = bits(addr, offsetBits + 13), + part9 = bits(addr, offsetBits + 16, offsetBits + 15), + part10 = bits(addr, offsetBits + 20, offsetBits + 18), + part11 = bits(addr, offsetBits + 14); Addr result = (part1 << 14) | (part2 << 13) | (part3 << 12) | (part4 << 11) | (part5 << 9) | (part6 << 8) | (part7 << 7) | (part8 << 6) | (part9 << 4) | (part10 << 1) | (part11); - // assume 32 bit addresses (both virtual and physical) - // select the remaining high-order 11 bits - Addr remaining_bits = - bitSelect(addr, offsetBits + 21, 31) << 21; + // Select the remaining high-order bits + Addr remaining_bits = bits(addr, std::numeric_limits<Addr>::digits - 1, + offsetBits + 21) << 21; result = result | remaining_bits; return result; diff --git a/src/mem/ruby/filters/H3BloomFilter.cc b/src/mem/ruby/filters/H3BloomFilter.cc index 1e2ab88dd..4e4f95d52 100644 --- a/src/mem/ruby/filters/H3BloomFilter.cc +++ b/src/mem/ruby/filters/H3BloomFilter.cc @@ -28,8 +28,10 @@ #include "mem/ruby/filters/H3BloomFilter.hh" +#include <limits> + #include "base/logging.hh" -#include "mem/ruby/common/Address.hh" +#include "base/bitfield.hh" #include "params/H3BloomFilter.hh" static int H3[64][16] = { @@ -396,7 +398,7 @@ H3BloomFilter::getCount(Addr addr) const int H3BloomFilter::hash(Addr addr, int hash_number) const { - uint64_t x = maskLowOrderBits(addr, offsetBits); + uint64_t x = bits(addr, std::numeric_limits<Addr>::digits - 1, 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 1dd9fb1ee..b999a2cb0 100644 --- a/src/mem/ruby/filters/LSB_CountingBloomFilter.cc +++ b/src/mem/ruby/filters/LSB_CountingBloomFilter.cc @@ -28,7 +28,7 @@ #include "mem/ruby/filters/LSB_CountingBloomFilter.hh" -#include "mem/ruby/common/Address.hh" +#include "base/bitfield.hh" #include "params/LSB_CountingBloomFilter.hh" LSB_CountingBloomFilter::LSB_CountingBloomFilter( @@ -66,7 +66,7 @@ LSB_CountingBloomFilter::getCount(Addr addr) const int LSB_CountingBloomFilter::hash(Addr addr) const { - return bitSelect(addr, offsetBits, offsetBits + sizeBits - 1); + return bits(addr, offsetBits + sizeBits - 1, offsetBits); } LSB_CountingBloomFilter* diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc index 6274606de..007de8e8b 100644 --- a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc +++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc @@ -28,7 +28,9 @@ #include "mem/ruby/filters/MultiBitSelBloomFilter.hh" -#include "mem/ruby/common/Address.hh" +#include <limits> + +#include "base/bitfield.hh" #include "params/MultiBitSelBloomFilter.hh" MultiBitSelBloomFilter::MultiBitSelBloomFilter( @@ -76,7 +78,8 @@ MultiBitSelBloomFilter::getCount(Addr addr) const int MultiBitSelBloomFilter::hash(Addr addr, int hash_number) const { - uint64_t x = (maskLowOrderBits(addr, offsetBits) >> skipBits); + uint64_t x = bits(addr, std::numeric_limits<Addr>::digits - 1, + 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 8cfc3ebda..d91eb7fd0 100644 --- a/src/mem/ruby/filters/MultiGrainBloomFilter.cc +++ b/src/mem/ruby/filters/MultiGrainBloomFilter.cc @@ -28,7 +28,7 @@ #include "mem/ruby/filters/MultiGrainBloomFilter.hh" -#include "mem/ruby/common/Address.hh" +#include "base/bitfield.hh" #include "params/MultiGrainBloomFilter.hh" MultiGrainBloomFilter::MultiGrainBloomFilter( @@ -87,16 +87,16 @@ int MultiGrainBloomFilter::hash(Addr addr) const { // grap a chunk of bits after byte offset - return bitSelect(addr, offsetBits, offsetBits + sizeBits - 1); + return bits(addr, offsetBits + sizeBits - 1, offsetBits); } int MultiGrainBloomFilter::pageHash(Addr addr) const { - int bits = offsetBits + sizeBits - 1; + int num_bits = offsetBits + sizeBits - 1; // grap a chunk of bits after first chunk - return bitSelect(addr, bits, bits + pageFilterSizeBits - 1); + return bits(addr, num_bits + pageFilterSizeBits - 1, num_bits); } MultiGrainBloomFilter* diff --git a/src/mem/ruby/filters/NonCountingBloomFilter.cc b/src/mem/ruby/filters/NonCountingBloomFilter.cc index eea9126ba..6fd39a09d 100644 --- a/src/mem/ruby/filters/NonCountingBloomFilter.cc +++ b/src/mem/ruby/filters/NonCountingBloomFilter.cc @@ -28,7 +28,7 @@ #include "mem/ruby/filters/NonCountingBloomFilter.hh" -#include "mem/ruby/common/Address.hh" +#include "base/bitfield.hh" #include "params/NonCountingBloomFilter.hh" NonCountingBloomFilter::NonCountingBloomFilter( @@ -72,8 +72,7 @@ NonCountingBloomFilter::getCount(Addr addr) const int NonCountingBloomFilter::hash(Addr addr) const { - return bitSelect(addr, offsetBits + skipBits, - offsetBits + skipBits + sizeBits - 1); + return bits(addr, offsetBits + skipBits + sizeBits - 1, offsetBits + skipBits); } NonCountingBloomFilter* |