ruby: allocate a block in CacheMemory without updating LRU state

This commit is contained in:
David Hashe 2015-07-20 09:15:18 -05:00
parent 7e00772bda
commit 7e9562013b
3 changed files with 13 additions and 4 deletions

View file

@ -146,6 +146,7 @@ structure (CacheMemory, external = "yes") {
bool cacheAvail(Address);
Address cacheProbe(Address);
AbstractCacheEntry allocate(Address, AbstractCacheEntry);
AbstractCacheEntry allocate(Address, AbstractCacheEntry, bool);
void allocateVoid(Address, AbstractCacheEntry);
void deallocate(Address);
AbstractCacheEntry lookup(Address);

View file

@ -251,7 +251,7 @@ CacheMemory::cacheAvail(const Address& address) const
}
AbstractCacheEntry*
CacheMemory::allocate(const Address& address, AbstractCacheEntry* entry)
CacheMemory::allocate(const Address& address, AbstractCacheEntry* entry, bool touch)
{
assert(address == line_address(address));
assert(!isTagPresent(address));
@ -271,7 +271,9 @@ CacheMemory::allocate(const Address& address, AbstractCacheEntry* entry)
set[i]->m_locked = -1;
m_tag_index[address] = i;
m_replacementPolicy_ptr->touch(cacheSet, i, curTick());
if (touch) {
m_replacementPolicy_ptr->touch(cacheSet, i, curTick());
}
return entry;
}

View file

@ -74,10 +74,16 @@ class CacheMemory : public SimObject
bool cacheAvail(const Address& address) const;
// find an unused entry and sets the tag appropriate for the address
AbstractCacheEntry* allocate(const Address& address, AbstractCacheEntry* new_entry);
AbstractCacheEntry* allocate(const Address& address,
AbstractCacheEntry* new_entry, bool touch);
AbstractCacheEntry* allocate(const Address& address,
AbstractCacheEntry* new_entry)
{
return allocate(address, new_entry, true);
}
void allocateVoid(const Address& address, AbstractCacheEntry* new_entry)
{
allocate(address, new_entry);
allocate(address, new_entry, true);
}
// Explicitly free up this address