summaryrefslogtreecommitdiff
path: root/src/mem/ruby/common
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2015-09-18 13:27:47 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2015-09-18 13:27:47 -0500
commit96c999fe88a5f600a1a5ddf8c15eadba3051508b (patch)
treeb1fb5220ffcd3b0688d53cb7f41a6c016eadc0fa /src/mem/ruby/common
parent216529bf182f58830cfccad090f348e1b8730675 (diff)
downloadgem5-96c999fe88a5f600a1a5ddf8c15eadba3051508b.tar.xz
ruby: print addresses in hex
Changeset 4872dbdea907 replaced Address by Addr, but did not make changes to print statements. So the addresses which were being printed in hex earlier along with their line address, were now being printed in decimals. This patch adds a function printAddress(Addr) that can be used to print the address in hex along with the lines address. This function has been put to use in some of the places. At other places, change has been made to print just the address in hex.
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__