From: Nilay Vaish Date: Sat, 5 Sep 2015 14:35:31 +0000 (-0500) Subject: ruby: adds set and way indices to AbstractCacheEntry X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f29298bc7a9aee1572ba3de66ed12db5995509c;p=gem5.git ruby: adds set and way indices to AbstractCacheEntry --- diff --git a/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh b/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh index 2b318957f..926556781 100644 --- a/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh +++ b/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh @@ -62,9 +62,22 @@ class AbstractCacheEntry : public AbstractEntry void clearLocked(); bool isLocked(int context) const; - Addr m_Address; // Address of this block, required by CacheMemory - int m_locked; // Holds info whether the address is locked, - // required for implementing LL/SC + void setSetIndex(uint32_t s) { m_set_index = s; } + uint32_t getSetIndex() const { return m_set_index; } + + void setWayIndex(uint32_t s) { m_way_index = s; } + uint32_t getWayIndex() const { return m_way_index; } + + // Address of this block, required by CacheMemory + Addr m_Address; + // Holds info whether the address is locked. + // Required for implementing LL/SC operations. + int m_locked; + + private: + // Set and way coordinates of the entry within the cache memory object. + uint32_t m_set_index; + uint32_t m_way_index; }; inline std::ostream& diff --git a/src/mem/ruby/structures/CacheMemory.cc b/src/mem/ruby/structures/CacheMemory.cc index 17c13502d..ab2647759 100644 --- a/src/mem/ruby/structures/CacheMemory.cc +++ b/src/mem/ruby/structures/CacheMemory.cc @@ -251,7 +251,7 @@ CacheMemory::cacheAvail(Addr address) const } AbstractCacheEntry* -CacheMemory::allocate(Addr address, AbstractCacheEntry* entry, bool touch) +CacheMemory::allocate(Addr address, AbstractCacheEntry *entry, bool touch) { assert(address == makeLineAddress(address)); assert(!isTagPresent(address)); @@ -270,6 +270,8 @@ CacheMemory::allocate(Addr address, AbstractCacheEntry* entry, bool touch) address); set[i]->m_locked = -1; m_tag_index[address] = i; + entry->setSetIndex(cacheSet); + entry->setWayIndex(i); if (touch) { m_replacementPolicy_ptr->touch(cacheSet, i, curTick());