mem-cache: Fix set and way of sub-entries

Set and way of sub-entries were not being set previously.
They must be set after the sub-blocks have been assigned
to the main block.

Change-Id: I7b6921b8437b29c472d691cd78cf20f2bb6c7e07
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19669
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel R. Carvalho
2019-07-30 09:41:14 +02:00
committed by Daniel Carvalho
parent 55580e6a88
commit afc30c07f5
5 changed files with 26 additions and 7 deletions

View File

@@ -76,7 +76,9 @@ class ReplaceableEntry
* @param set The set of this entry.
* @param way The way of this entry.
*/
void setPosition(const uint32_t set, const uint32_t way) {
virtual void
setPosition(const uint32_t set, const uint32_t way)
{
_set = set;
_way = way;
}

View File

@@ -67,9 +67,6 @@ CompressedTags::tagsInit()
// allocation conditions
superblock->setBlkSize(blkSize);
// Link block to indexing policy
indexingPolicy->setEntry(superblock, superblock_index);
// Associate a replacement data entry to the block
superblock->replacementData = replacementPolicy->instantiateEntry();
@@ -97,6 +94,9 @@ CompressedTags::tagsInit()
// Update block index
++blk_index;
}
// Link block to indexing policy
indexingPolicy->setEntry(superblock, superblock_index);
}
}

View File

@@ -167,3 +167,12 @@ SectorBlk::setSecure()
{
_secureBit = true;
}
void
SectorBlk::setPosition(const uint32_t set, const uint32_t way)
{
ReplaceableEntry::setPosition(set, way);
for (auto& blk : blks) {
blk->setPosition(set, way);
}
}

View File

@@ -214,6 +214,14 @@ class SectorBlk : public ReplaceableEntry
* Set secure bit.
*/
void setSecure();
/**
* Sets the position of the sub-entries, besides its own.
*
* @param set The set of this entry and sub-entries.
* @param way The way of this entry and sub-entries.
*/
void setPosition(const uint32_t set, const uint32_t way) override;
};
#endif //__MEM_CACHE_TAGS_SECTOR_BLK_HH__

View File

@@ -77,9 +77,6 @@ SectorTags::tagsInit()
// Locate next cache sector
SectorBlk* sec_blk = &secBlks[sec_blk_index];
// Link block to indexing policy
indexingPolicy->setEntry(sec_blk, sec_blk_index);
// Associate a replacement data entry to the sector
sec_blk->replacementData = replacementPolicy->instantiateEntry();
@@ -107,6 +104,9 @@ SectorTags::tagsInit()
// Update block index
++blk_index;
}
// Link block to indexing policy
indexingPolicy->setEntry(sec_blk, sec_blk_index);
}
}