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/structures/CacheMemory.cc | 22 +++++++++++----------- src/mem/ruby/structures/DirectoryMemory.cc | 4 ++-- src/mem/ruby/structures/Prefetcher.cc | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/mem/ruby/structures') diff --git a/src/mem/ruby/structures/CacheMemory.cc b/src/mem/ruby/structures/CacheMemory.cc index a269d4f5b..b0e54ec99 100644 --- a/src/mem/ruby/structures/CacheMemory.cc +++ b/src/mem/ruby/structures/CacheMemory.cc @@ -163,7 +163,7 @@ CacheMemory::tryCacheAccess(Addr address, RubyRequestType type, DataBlock*& data_ptr) { assert(address == makeLineAddress(address)); - DPRINTF(RubyCache, "address: %s\n", address); + DPRINTF(RubyCache, "address: %#x\n", address); int64_t cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); if (loc != -1) { @@ -190,7 +190,7 @@ CacheMemory::testCacheAccess(Addr address, RubyRequestType type, DataBlock*& data_ptr) { assert(address == makeLineAddress(address)); - DPRINTF(RubyCache, "address: %s\n", address); + DPRINTF(RubyCache, "address: %#x\n", address); int64_t cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); @@ -218,10 +218,10 @@ CacheMemory::isTagPresent(Addr address) const if (loc == -1) { // We didn't find the tag - DPRINTF(RubyCache, "No tag match for address: %s\n", address); + DPRINTF(RubyCache, "No tag match for address: %#x\n", address); return false; } - DPRINTF(RubyCache, "address: %s found\n", address); + DPRINTF(RubyCache, "address: %#x found\n", address); return true; } @@ -256,7 +256,7 @@ CacheMemory::allocate(Addr address, AbstractCacheEntry *entry, bool touch) assert(address == makeLineAddress(address)); assert(!isTagPresent(address)); assert(cacheAvail(address)); - DPRINTF(RubyCache, "address: %s\n", address); + DPRINTF(RubyCache, "address: %#x\n", address); // Find the first open slot int64_t cacheSet = addressToCacheSet(address); @@ -288,7 +288,7 @@ CacheMemory::deallocate(Addr address) { assert(address == makeLineAddress(address)); assert(isTagPresent(address)); - DPRINTF(RubyCache, "address: %s\n", address); + DPRINTF(RubyCache, "address: %#x\n", address); int64_t cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); if (loc != -1) { @@ -417,7 +417,7 @@ CacheMemory::printData(ostream& out) const void CacheMemory::setLocked(Addr address, int context) { - DPRINTF(RubyCache, "Setting Lock for addr: %x to %d\n", address, context); + DPRINTF(RubyCache, "Setting Lock for addr: %#x to %d\n", address, context); assert(address == makeLineAddress(address)); int64_t cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); @@ -428,7 +428,7 @@ CacheMemory::setLocked(Addr address, int context) void CacheMemory::clearLocked(Addr address) { - DPRINTF(RubyCache, "Clear Lock for addr: %x\n", address); + DPRINTF(RubyCache, "Clear Lock for addr: %#x\n", address); assert(address == makeLineAddress(address)); int64_t cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); @@ -443,7 +443,7 @@ CacheMemory::isLocked(Addr address, int context) int64_t cacheSet = addressToCacheSet(address); int loc = findTagInSet(cacheSet, address); assert(loc != -1); - DPRINTF(RubyCache, "Testing Lock for addr: %llx cur %d con %d\n", + DPRINTF(RubyCache, "Testing Lock for addr: %#llx cur %d con %d\n", address, m_cache[cacheSet][loc]->m_locked, context); return m_cache[cacheSet][loc]->isLocked(context); } @@ -582,7 +582,7 @@ CacheMemory::checkResourceAvailable(CacheResourceType res, Addr addr) if (tagArray.tryAccess(addressToCacheSet(addr))) return true; else { DPRINTF(RubyResourceStalls, - "Tag array stall on addr %s in set %d\n", + "Tag array stall on addr %#x in set %d\n", addr, addressToCacheSet(addr)); numTagArrayStalls++; return false; @@ -591,7 +591,7 @@ CacheMemory::checkResourceAvailable(CacheResourceType res, Addr addr) if (dataArray.tryAccess(addressToCacheSet(addr))) return true; else { DPRINTF(RubyResourceStalls, - "Data array stall on addr %s in set %d\n", + "Data array stall on addr %#x in set %d\n", addr, addressToCacheSet(addr)); numDataArrayStalls++; return false; diff --git a/src/mem/ruby/structures/DirectoryMemory.cc b/src/mem/ruby/structures/DirectoryMemory.cc index 267c07174..8aad6f4fa 100644 --- a/src/mem/ruby/structures/DirectoryMemory.cc +++ b/src/mem/ruby/structures/DirectoryMemory.cc @@ -114,7 +114,7 @@ AbstractEntry* DirectoryMemory::lookup(Addr address) { assert(isPresent(address)); - DPRINTF(RubyCache, "Looking up address: %s\n", address); + DPRINTF(RubyCache, "Looking up address: %#x\n", address); uint64_t idx = mapAddressToLocalIdx(address); assert(idx < m_num_entries); @@ -126,7 +126,7 @@ DirectoryMemory::allocate(Addr address, AbstractEntry *entry) { assert(isPresent(address)); uint64_t idx; - DPRINTF(RubyCache, "Looking up address: %s\n", address); + DPRINTF(RubyCache, "Looking up address: %#x\n", address); idx = mapAddressToLocalIdx(address); assert(idx < m_num_entries); diff --git a/src/mem/ruby/structures/Prefetcher.cc b/src/mem/ruby/structures/Prefetcher.cc index d12665ae9..ce6d36c04 100644 --- a/src/mem/ruby/structures/Prefetcher.cc +++ b/src/mem/ruby/structures/Prefetcher.cc @@ -135,7 +135,7 @@ Prefetcher::regStats() void Prefetcher::observeMiss(Addr address, const RubyRequestType& type) { - DPRINTF(RubyPrefetcher, "Observed miss for %s\n", address); + DPRINTF(RubyPrefetcher, "Observed miss for %#x\n", address); Addr line_addr = makeLineAddress(address); numMissObserved++; @@ -204,7 +204,7 @@ void Prefetcher::observePfMiss(Addr address) { numPartialHits++; - DPRINTF(RubyPrefetcher, "Observed partial hit for %s\n", address); + DPRINTF(RubyPrefetcher, "Observed partial hit for %#x\n", address); issueNextPrefetch(address, NULL); } @@ -212,7 +212,7 @@ void Prefetcher::observePfHit(Addr address) { numHits++; - DPRINTF(RubyPrefetcher, "Observed hit for %s\n", address); + DPRINTF(RubyPrefetcher, "Observed hit for %#x\n", address); issueNextPrefetch(address, NULL); } @@ -250,7 +250,7 @@ Prefetcher::issueNextPrefetch(Addr address, PrefetchEntry *stream) // launch next prefetch stream->m_address = line_addr; stream->m_use_time = m_controller->curCycle(); - DPRINTF(RubyPrefetcher, "Requesting prefetch for %s\n", line_addr); + DPRINTF(RubyPrefetcher, "Requesting prefetch for %#x\n", line_addr); m_controller->enqueuePrefetch(line_addr, stream->m_type); } @@ -314,7 +314,7 @@ Prefetcher::initializeStream(Addr address, int stride, // launch prefetch numPrefetchRequested++; - DPRINTF(RubyPrefetcher, "Requesting prefetch for %s\n", line_addr); + DPRINTF(RubyPrefetcher, "Requesting prefetch for %#x\n", line_addr); m_controller->enqueuePrefetch(line_addr, m_array[index].m_type); } -- cgit v1.2.3