diff options
author | Daniel R. Carvalho <odanrc@yahoo.com.br> | 2018-03-09 15:04:20 +0100 |
---|---|---|
committer | Daniel Carvalho <odanrc@yahoo.com.br> | 2018-10-10 18:17:42 +0000 |
commit | d204e56b2b9b8ad561fc258ebdc50ae8365159e1 (patch) | |
tree | 52783a7a32db7d055cb85e5454e6512c22cb2b1c /src/mem/cache/tags/base.cc | |
parent | 99a6c94e58b6375c0d524530cab2a27b6ea0f2bc (diff) | |
download | gem5-d204e56b2b9b8ad561fc258ebdc50ae8365159e1.tar.xz |
mem-cache: Use possible locations to find block
Use possible locations to find block to make it placement policy
independent.
Change-Id: I4c9d9e1e1ff91ce12e85ca1970f927d8f4f5a93b
Reviewed-on: https://gem5-review.googlesource.com/c/8884
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
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, |