diff options
Diffstat (limited to 'src/mem/cache/tags')
-rw-r--r-- | src/mem/cache/tags/base.hh | 5 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.hh | 5 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.cc | 30 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.hh | 5 |
4 files changed, 45 insertions, 0 deletions
diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh index 3539f2bfd..aae442636 100644 --- a/src/mem/cache/tags/base.hh +++ b/src/mem/cache/tags/base.hh @@ -159,6 +159,11 @@ class BaseTags *Needed to clear all lock tracking at once */ virtual void clearLocks() {} + + /** + * Print all tags used + */ + virtual std::string print() const = 0; }; class BaseTagsCallback : public Callback diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh index 7604d8d43..3c8cc5bec 100644 --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -301,6 +301,11 @@ public: virtual void clearLocks(); /** + * @todo Implement as in lru. Currently not used + */ + virtual std::string print() const { return ""; } + + /** * Visit each block in the tag store and apply a visitor to the * block. * diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc index 00b13e2d8..f515ed053 100644 --- a/src/mem/cache/tags/lru.cc +++ b/src/mem/cache/tags/lru.cc @@ -1,4 +1,16 @@ /* + * Copyright (c) 2012 ARM Limited + * All rights reserved. + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 2003-2005 The Regents of The University of Michigan * All rights reserved. * @@ -36,6 +48,7 @@ #include <string> #include "base/intmath.hh" +#include "debug/Cache.hh" #include "debug/CacheRepl.hh" #include "mem/cache/tags/cacheset.hh" #include "mem/cache/tags/lru.hh" @@ -226,6 +239,23 @@ LRU::clearLocks() } } +std::string +LRU::print() const { + std::string cache_state; + for (unsigned i = 0; i < numSets; ++i) { + // link in the data blocks + for (unsigned j = 0; j < assoc; ++j) { + BlkType *blk = sets[i].blks[j]; + if (blk->isValid()) + cache_state += csprintf("\tset: %d block: %d %s\n", i, j, + blk->print()); + } + } + if (cache_state.empty()) + cache_state = "no valid tags\n"; + return cache_state; +} + void LRU::cleanupRefs() { diff --git a/src/mem/cache/tags/lru.hh b/src/mem/cache/tags/lru.hh index 431e3eb1e..2e44aa84f 100644 --- a/src/mem/cache/tags/lru.hh +++ b/src/mem/cache/tags/lru.hh @@ -249,6 +249,11 @@ public: virtual void cleanupRefs(); /** + * Print all tags used + */ + virtual std::string print() const; + + /** * Visit each block in the tag store and apply a visitor to the * block. * |