diff options
Diffstat (limited to 'src/mem/cache/tags/base.cc')
-rw-r--r-- | src/mem/cache/tags/base.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc index 7f848e0d8..9358652bf 100644 --- a/src/mem/cache/tags/base.cc +++ b/src/mem/cache/tags/base.cc @@ -78,6 +78,35 @@ BaseTags::setCache(BaseCache *_cache) cache = _cache; } +std::vector<ReplaceableEntry*> +BaseTags::getPossibleLocations(const Addr addr) const +{ + panic("Unimplemented getPossibleLocations for tags subclass"); +} + +CacheBlk* +BaseTags::findBlock(Addr addr, bool is_secure) const +{ + // Extract block tag + Addr tag = extractTag(addr); + + // Find possible locations for the given address + const std::vector<ReplaceableEntry*> locations = + getPossibleLocations(addr); + + // Search for block + for (const auto& location : locations) { + CacheBlk* blk = static_cast<CacheBlk*>(location); + if ((blk->tag == tag) && blk->isValid() && + (blk->isSecure() == is_secure)) { + return blk; + } + } + + // Did not find block + return nullptr; +} + void BaseTags::insertBlock(const Addr addr, const bool is_secure, const int src_master_ID, const uint32_t task_ID, |