From 96c999fe88a5f600a1a5ddf8c15eadba3051508b Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Fri, 18 Sep 2015 13:27:47 -0500 Subject: 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. --- src/mem/ruby/common/Address.cc | 10 ++++++++++ src/mem/ruby/common/Address.hh | 1 + 2 files changed, 11 insertions(+) (limited to 'src/mem/ruby/common') 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__ -- cgit v1.2.3