diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-03-21 21:22:21 -0700 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-03-21 21:22:21 -0700 |
commit | 4f044605e8a87873228933b4700e3e0ac9af27e5 (patch) | |
tree | f540e138a27ca0a4d9d1905d4f5199b470c1508b /src/mem/ruby/common | |
parent | 8b15ed7ebf939688e68ed2e6b1b2099972e1d295 (diff) | |
download | gem5-4f044605e8a87873228933b4700e3e0ac9af27e5.tar.xz |
ruby: Adds configurable bit selection for numa mapping
Diffstat (limited to 'src/mem/ruby/common')
-rw-r--r-- | src/mem/ruby/common/Address.hh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mem/ruby/common/Address.hh b/src/mem/ruby/common/Address.hh index 44dff7d83..7da5ed0fe 100644 --- a/src/mem/ruby/common/Address.hh +++ b/src/mem/ruby/common/Address.hh @@ -66,6 +66,7 @@ public: physical_address_t getAddress() const {return m_address;} // selects bits inclusive physical_address_t bitSelect(int small, int big) const; + physical_address_t bitRemove(int small, int big) const; physical_address_t maskLowOrderBits(int number) const; physical_address_t maskHighOrderBits(int number) const; physical_address_t shiftLowOrderBits(int number) const; @@ -162,6 +163,35 @@ physical_address_t Address::bitSelect(int small, int big) const // rips bits inc } } +// removes bits inclusive +inline +physical_address_t Address::bitRemove(int small, int big) const +{ + physical_address_t mask; + assert((unsigned)big >= (unsigned)small); + + if (small >= ADDRESS_WIDTH - 1) { + return m_address; + } else if (big >= ADDRESS_WIDTH - 1) { + mask = (physical_address_t)~0 >> small; + return (m_address & mask); + } else if (small == 0) { + mask = (physical_address_t)~0 << big; + return (m_address & mask); + } else { + mask = ~((physical_address_t)~0 << small); + physical_address_t lower_bits = m_address & mask; + mask = (physical_address_t)~0 << (big + 1); + physical_address_t higher_bits = m_address & mask; + + // + // Shift the valid high bits over the removed section + // + higher_bits = higher_bits >> (big - small); + return (higher_bits | lower_bits); + } +} + inline physical_address_t Address::maskLowOrderBits(int number) const { |