X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Fruby%2Fcommon%2FAddress.cc;h=b075ef3c5aabed2373f292daff8b07c29cc757c6;hb=aa86800e7a142f41a8fe957c367c133dea8d61bf;hp=cc87f4ece882e90a1e6a5d83558aa69f242f7e8b;hpb=6bf7153104637c18133fa36c02ca6a4a9b015799;p=gem5.git diff --git a/src/mem/ruby/common/Address.cc b/src/mem/ruby/common/Address.cc index cc87f4ece..b075ef3c5 100644 --- a/src/mem/ruby/common/Address.cc +++ b/src/mem/ruby/common/Address.cc @@ -26,6 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "arch/isa_traits.hh" +#include "config/the_isa.hh" #include "mem/ruby/common/Address.hh" #include "mem/ruby/system/System.hh" @@ -55,10 +57,10 @@ Address::makeNextStrideAddress(int stride) + RubySystem::getBlockSizeBytes()*stride; } -integer_t +Index Address::memoryModuleIndex() const { - integer_t index = + Index index = bitSelect(RubySystem::getBlockSizeBits() + RubySystem::getMemorySizeBits(), ADDRESS_WIDTH); assert (index >= 0); @@ -134,3 +136,24 @@ Address::operator=(const Address& obj) return *this; } +void +Address::makePageAddress() +{ + m_address = maskLowOrderBits(TheISA::LogVMPageSize); +} + +Address +page_address(const Address& addr) +{ + Address temp = addr; + temp.makePageAddress(); + return temp; +} + +Address +next_stride_address(const Address& addr, int stride) +{ + Address temp = addr; + temp.makeNextStrideAddress(stride); + return temp; +}