diff options
author | David Hashe <david.hashe@amd.com> | 2015-07-20 09:15:18 -0500 |
---|---|---|
committer | David Hashe <david.hashe@amd.com> | 2015-07-20 09:15:18 -0500 |
commit | c4ffd4989c35a4afea1097fec97ac5bcd52974b3 (patch) | |
tree | 04796c3fd4ba631f20d47f17906b47c7bbb84a59 /src/mem/ruby/structures/CacheMemory.cc | |
parent | 967cfa939afca4a5752ce9c1d64d5c51092e7f1a (diff) | |
download | gem5-c4ffd4989c35a4afea1097fec97ac5bcd52974b3.tar.xz |
ruby: expose access permission to replacement policies
This patch adds support that allows the replacement policy to identify each
cache block's access permission. This information can be useful when making
replacement decisions.
Diffstat (limited to 'src/mem/ruby/structures/CacheMemory.cc')
-rw-r--r-- | src/mem/ruby/structures/CacheMemory.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mem/ruby/structures/CacheMemory.cc b/src/mem/ruby/structures/CacheMemory.cc index d08724cff..e444ae09c 100644 --- a/src/mem/ruby/structures/CacheMemory.cc +++ b/src/mem/ruby/structures/CacheMemory.cc @@ -63,6 +63,7 @@ CacheMemory::CacheMemory(const Params *p) m_latency = p->latency; m_cache_assoc = p->assoc; m_replacementPolicy_ptr = p->replacement_policy; + m_replacementPolicy_ptr->setCache(this); m_start_index_bit = p->start_index_bit; m_is_instruction_only_cache = p->is_icache; m_resource_stalls = p->resourceStalls; @@ -592,3 +593,15 @@ CacheMemory::checkResourceAvailable(CacheResourceType res, Address addr) return true; } } + +bool +CacheMemory::isBlockInvalid(int64 cache_set, int64 loc) +{ + return (m_cache[cache_set][loc]->m_Permission == AccessPermission_Invalid); +} + +bool +CacheMemory::isBlockNotBusy(int64 cache_set, int64 loc) +{ + return (m_cache[cache_set][loc]->m_Permission != AccessPermission_Busy); +} |