From: Daniel R. Carvalho Date: Tue, 30 Jul 2019 07:41:14 +0000 (+0200) Subject: mem-cache: Fix set and way of sub-entries X-Git-Tag: v19.0.0.0~702 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=afc30c07f598a8dd45ea4bc458f89d3485c50025;p=gem5.git 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19669 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- diff --git a/src/mem/cache/replacement_policies/replaceable_entry.hh b/src/mem/cache/replacement_policies/replaceable_entry.hh index bf54e2264..dffa4cf10 100644 --- a/src/mem/cache/replacement_policies/replaceable_entry.hh +++ b/src/mem/cache/replacement_policies/replaceable_entry.hh @@ -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; } diff --git a/src/mem/cache/tags/compressed_tags.cc b/src/mem/cache/tags/compressed_tags.cc index 0896a1b9a..1394be855 100644 --- a/src/mem/cache/tags/compressed_tags.cc +++ b/src/mem/cache/tags/compressed_tags.cc @@ -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); } } diff --git a/src/mem/cache/tags/sector_blk.cc b/src/mem/cache/tags/sector_blk.cc index 93b1961d8..7e4468dc3 100644 --- a/src/mem/cache/tags/sector_blk.cc +++ b/src/mem/cache/tags/sector_blk.cc @@ -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); + } +} diff --git a/src/mem/cache/tags/sector_blk.hh b/src/mem/cache/tags/sector_blk.hh index ca0d9a806..a30fb817c 100644 --- a/src/mem/cache/tags/sector_blk.hh +++ b/src/mem/cache/tags/sector_blk.hh @@ -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__ diff --git a/src/mem/cache/tags/sector_tags.cc b/src/mem/cache/tags/sector_tags.cc index 535badb8d..1098885c2 100644 --- a/src/mem/cache/tags/sector_tags.cc +++ b/src/mem/cache/tags/sector_tags.cc @@ -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); } }