ruby: add functions for computing next stride/page address
This commit is contained in:
parent
2fca1af71f
commit
d502384795
2 changed files with 28 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "base/hashmap.hh"
|
||||
#include "mem/ruby/common/TypeDefines.hh"
|
||||
|
||||
const int ADDRESS_WIDTH = 64; // address width in bytes
|
||||
const uint32_t ADDRESS_WIDTH = 64; // address width in bytes
|
||||
|
||||
class Address;
|
||||
typedef Address PhysAddress;
|
||||
|
@ -69,6 +69,7 @@ class Address
|
|||
physical_address_t getLineAddress() const;
|
||||
physical_address_t getOffset() const;
|
||||
void makeLineAddress();
|
||||
void makePageAddress();
|
||||
void makeNextStrideAddress(int stride);
|
||||
|
||||
int getBankSetNum() const;
|
||||
|
@ -202,6 +203,9 @@ Address::shiftLowOrderBits(int number) const
|
|||
return (m_address >> number);
|
||||
}
|
||||
|
||||
Address next_stride_address(const Address& addr, int stride);
|
||||
Address page_address(const Address& addr);
|
||||
|
||||
__hash_namespace_begin
|
||||
template <> struct hash<Address>
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue