#include "mem/ruby/common/Address.hh"
+#include "base/bitfield.hh"
#include "mem/ruby/system/RubySystem.hh"
Addr
Addr
maskLowOrderBits(Addr addr, unsigned int number)
{
- Addr mask;
-
- if (number >= ADDRESS_WIDTH - 1) {
- mask = ~0;
- } else {
- mask = (Addr)~0 << number;
- }
- return (addr & mask);
+ return mbits<Addr>(addr, 63, number);
}
Addr
Addr
makeLineAddress(Addr addr)
{
- return maskLowOrderBits(addr, RubySystem::getBlockSizeBits());
+ return mbits<Addr>(addr, 63, RubySystem::getBlockSizeBits());
}
// returns the next stride address based on line address
Addr
makeNextStrideAddress(Addr addr, int stride)
{
- return maskLowOrderBits(addr, RubySystem::getBlockSizeBits())
- + RubySystem::getBlockSizeBytes() * stride;
+ return makeLineAddress(addr) + RubySystem::getBlockSizeBytes() * stride;
}
std::string
{
std::stringstream out;
out << "[" << std::hex << "0x" << addr << "," << " line 0x"
- << maskLowOrderBits(addr, RubySystem::getBlockSizeBits())
- << std::dec << "]";
+ << makeLineAddress(addr) << std::dec << "]";
return out.str();
}
#include <vector>
+#include "base/bitfield.hh"
#include "base/stl_helpers.hh"
#include "mem/ruby/profiler/Profiler.hh"
#include "mem/ruby/protocol/RubyRequest.hh"
// record macro data address trace info
// 6 for datablock, 4 to make it 16x more coarse
- Addr macro_addr = maskLowOrderBits(data_addr, 10);
+ Addr macro_addr = mbits<Addr>(data_addr, 63, 10);
lookupTraceForAddress(macro_addr, m_macroBlockAccessTrace).
update(type, access_mode, id, sharing_miss);
#include "mem/ruby/structures/Prefetcher.hh"
+#include "base/bitfield.hh"
#include "debug/RubyPrefetcher.hh"
#include "mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh"
#include "mem/ruby/system/RubySystem.hh"
Addr
Prefetcher::pageAddress(Addr addr) const
{
- return maskLowOrderBits(addr, m_page_shift);
+ return mbits<Addr>(addr, 63, m_page_shift);
}