diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2012-12-11 10:05:53 -0600 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2012-12-11 10:05:53 -0600 |
commit | d5023847951dcebcb38838cae0a141bd1a62e407 (patch) | |
tree | d479196286e1426ac558958acdfab518a2516a29 /src/mem/ruby/common/Address.cc | |
parent | 2fca1af71f69bf17e90981dc69c96cccdc62fc11 (diff) | |
download | gem5-d5023847951dcebcb38838cae0a141bd1a62e407.tar.xz |
ruby: add functions for computing next stride/page address
Diffstat (limited to 'src/mem/ruby/common/Address.cc')
-rw-r--r-- | src/mem/ruby/common/Address.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mem/ruby/common/Address.cc b/src/mem/ruby/common/Address.cc index d3f678863..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" @@ -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; +} |