diff options
Diffstat (limited to 'src/mem/cache')
-rw-r--r-- | src/mem/cache/base.cc | 4 | ||||
-rw-r--r-- | src/mem/cache/blk.hh | 9 | ||||
-rw-r--r-- | src/mem/cache/sector_blk.cc | 8 | ||||
-rw-r--r-- | src/mem/cache/sector_blk.hh | 7 | ||||
-rw-r--r-- | src/mem/cache/tags/base.cc | 3 | ||||
-rw-r--r-- | src/mem/cache/tags/base_set_assoc.hh | 4 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.cc | 6 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.hh | 7 | ||||
-rw-r--r-- | src/mem/cache/tags/sector_tags.cc | 5 |
9 files changed, 38 insertions, 15 deletions
diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index 736f16761..0eeb19252 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -52,6 +52,7 @@ #include "base/logging.hh" #include "debug/Cache.hh" #include "debug/CachePort.hh" +#include "debug/CacheRepl.hh" #include "debug/CacheVerbose.hh" #include "mem/cache/mshr.hh" #include "mem/cache/prefetch/base.hh" @@ -1237,6 +1238,9 @@ BaseCache::allocateBlock(const PacketPtr pkt, PacketList &writebacks) if (!victim) return nullptr; + // Print victim block's information + DPRINTF(CacheRepl, "Replacement victim: %s\n", victim->print()); + // Check for transient state allocations. If any of the entries listed // for eviction has a transient state, the allocation fails for (const auto& blk : evict_blks) { diff --git a/src/mem/cache/blk.hh b/src/mem/cache/blk.hh index cc6d90571..6d91e5584 100644 --- a/src/mem/cache/blk.hh +++ b/src/mem/cache/blk.hh @@ -292,12 +292,12 @@ class CacheBlk : public ReplaceableEntry } /** - * Pretty-print a tag, and interpret state bits to readable form + * Pretty-print tag, set and way, and interpret state bits to readable form * including mapping to a MOESI state. * * @return string with basic state information */ - std::string print() const + virtual std::string print() const { /** * state M O E S I @@ -334,8 +334,9 @@ class CacheBlk : public ReplaceableEntry default: s = 'T'; break; // @TODO add other types } return csprintf("state: %x (%c) valid: %d writable: %d readable: %d " - "dirty: %d tag: %x", status, s, isValid(), - isWritable(), isReadable(), isDirty(), tag); + "dirty: %d | tag: %#x set: %#x way: %#x", status, s, + isValid(), isWritable(), isReadable(), isDirty(), tag, + getSet(), getWay()); } /** diff --git a/src/mem/cache/sector_blk.cc b/src/mem/cache/sector_blk.cc index 07d9e9543..5607f4ccc 100644 --- a/src/mem/cache/sector_blk.cc +++ b/src/mem/cache/sector_blk.cc @@ -37,6 +37,7 @@ #include <cassert> +#include "base/cprintf.hh" #include "base/logging.hh" void @@ -86,6 +87,13 @@ SectorSubBlk::insert(const Addr tag, const bool is_secure, _sectorBlk->setTag(tag); } +std::string +SectorSubBlk::print() const +{ + return csprintf("%s sector offset: %#x", CacheBlk::print(), + getSectorOffset()); +} + bool SectorBlk::isValid() const { diff --git a/src/mem/cache/sector_blk.hh b/src/mem/cache/sector_blk.hh index f8f8cd5e6..66d83a230 100644 --- a/src/mem/cache/sector_blk.hh +++ b/src/mem/cache/sector_blk.hh @@ -114,6 +114,13 @@ class SectorSubBlk : public CacheBlk */ void insert(const Addr tag, const bool is_secure, const int src_master_ID, const uint32_t task_ID) override; + + /** + * Pretty-print sector offset and other CacheBlk information. + * + * @return string with basic state information + */ + std::string print() const override; }; /** diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc index dddb8c71d..965e4ba16 100644 --- a/src/mem/cache/tags/base.cc +++ b/src/mem/cache/tags/base.cc @@ -201,8 +201,7 @@ BaseTags::print() auto print_blk = [&str](CacheBlk &blk) { if (blk.isValid()) - str += csprintf("\tset: %x, way: %x %s\n", blk.getSet(), - blk.getWay(), blk.print()); + str += csprintf("\tBlock: %s\n", blk.print()); }; forEachBlk(print_blk); diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh index 01bfa05b2..11c0c8d11 100644 --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -54,7 +54,6 @@ #include "base/logging.hh" #include "base/types.hh" -#include "debug/CacheRepl.hh" #include "mem/cache/base.hh" #include "mem/cache/blk.hh" #include "mem/cache/replacement_policies/base.hh" @@ -187,9 +186,6 @@ class BaseSetAssoc : public BaseTags // There is only one eviction for this replacement evict_blks.push_back(victim); - DPRINTF(CacheRepl, "set %x, way %x: selecting blk for replacement\n", - victim->getSet(), victim->getWay()); - return victim; } diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc index fa7c6595f..319d5602d 100644 --- a/src/mem/cache/tags/fa_lru.cc +++ b/src/mem/cache/tags/fa_lru.cc @@ -57,6 +57,12 @@ #include "base/logging.hh" #include "mem/cache/base.hh" +std::string +FALRUBlk::print() const +{ + return csprintf("%s inCachesMask: %#x", CacheBlk::print(), inCachesMask); +} + FALRU::FALRU(const Params *p) : BaseTags(p), diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh index 0d9a8d440..c2f983468 100644 --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -92,6 +92,13 @@ class FALRUBlk : public CacheBlk /** A bit mask of the caches that fit this block. */ CachesMask inCachesMask; + + /** + * Pretty-print inCachesMask and other CacheBlk information. + * + * @return string with basic state information + */ + std::string print() const override; }; /** diff --git a/src/mem/cache/tags/sector_tags.cc b/src/mem/cache/tags/sector_tags.cc index f256807e2..e993e296b 100644 --- a/src/mem/cache/tags/sector_tags.cc +++ b/src/mem/cache/tags/sector_tags.cc @@ -42,7 +42,6 @@ #include "base/intmath.hh" #include "base/logging.hh" #include "base/types.hh" -#include "debug/CacheRepl.hh" #include "mem/cache/base.hh" #include "mem/cache/replacement_policies/base.hh" #include "mem/cache/tags/indexing_policies/base.hh" @@ -277,10 +276,6 @@ SectorTags::findVictim(Addr addr, const bool is_secure, } } - DPRINTF(CacheRepl, "set %x, way %x, sector offset %x: selecting blk " \ - "for replacement\n", victim->getSet(), victim->getWay(), - victim->getSectorOffset()); - return victim; } |