summaryrefslogtreecommitdiff
path: root/src/mem/ruby/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/common')
-rw-r--r--src/mem/ruby/common/Address.cc10
-rw-r--r--src/mem/ruby/common/Address.hh1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/mem/ruby/common/Address.cc b/src/mem/ruby/common/Address.cc
index d9fadf128..f0aa71ac6 100644
--- a/src/mem/ruby/common/Address.cc
+++ b/src/mem/ruby/common/Address.cc
@@ -121,3 +121,13 @@ makeNextStrideAddress(Addr addr, int stride)
return maskLowOrderBits(addr, RubySystem::getBlockSizeBits())
+ RubySystem::getBlockSizeBytes() * stride;
}
+
+std::string
+printAddress(Addr addr)
+{
+ std::stringstream out;
+ out << "[" << std::hex << "0x" << addr << "," << " line 0x"
+ << maskLowOrderBits(addr, RubySystem::getBlockSizeBits())
+ << std::dec << "]";
+ return out.str();
+}
diff --git a/src/mem/ruby/common/Address.hh b/src/mem/ruby/common/Address.hh
index 6210baa5c..90955447b 100644
--- a/src/mem/ruby/common/Address.hh
+++ b/src/mem/ruby/common/Address.hh
@@ -47,5 +47,6 @@ Addr shiftLowOrderBits(Addr addr, unsigned int number);
Addr getOffset(Addr addr);
Addr makeLineAddress(Addr addr);
Addr makeNextStrideAddress(Addr addr, int stride);
+std::string printAddress(Addr addr);
#endif // __MEM_RUBY_COMMON_ADDRESS_HH__