#include "params/ReplacementPolicy.hh"
#include "sim/sim_object.hh"
+class CacheMemory;
+
class AbstractReplacementPolicy : public SimObject
{
public:
virtual bool useOccupancy() const { return false; }
+ void setCache(CacheMemory * pCache) {m_cache = pCache;}
+ CacheMemory * m_cache;
+
protected:
unsigned m_num_sets; /** total number of sets */
unsigned m_assoc; /** set associativity */
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;
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);
+}
Cycles getTagLatency() const { return tagArray.getLatency(); }
Cycles getDataLatency() const { return dataArray.getLatency(); }
+ bool isBlockInvalid(int64 cache_set, int64 loc);
+ bool isBlockNotBusy(int64 cache_set, int64 loc);
// Hook for checkpointing the contents of the cache
void recordCacheContents(int cntrl, CacheRecorder* tr) const;