Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/22605 )

Change subject: mem-cache: Add getter for the number of valid sub-blks
......................................................................

mem-cache: Add getter for the number of valid sub-blks

Add a getter function so that the number of valid sub-blocks can be
retrieved. As a side effect, make the respective counter private.

Change-Id: Icef8b51164c8e165872dcaebc65f5c330f16cb29
Signed-off-by: Daniel R. Carvalho <oda...@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22605
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikole...@arm.com>
---
M src/mem/cache/tags/sector_blk.cc
M src/mem/cache/tags/sector_blk.hh
2 files changed, 21 insertions(+), 7 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/cache/tags/sector_blk.cc b/src/mem/cache/tags/sector_blk.cc
index 7e4468d..13c90b6 100644
--- a/src/mem/cache/tags/sector_blk.cc
+++ b/src/mem/cache/tags/sector_blk.cc
@@ -116,7 +116,7 @@
 }

 SectorBlk::SectorBlk()
- : ReplaceableEntry(), _tag(MaxAddr), _validCounter(0), _secureBit(false) + : ReplaceableEntry(), _validCounter(0), _tag(MaxAddr), _secureBit(false)
 {
 }

@@ -127,6 +127,12 @@
     return _validCounter > 0;
 }

+uint8_t
+SectorBlk::getNumValid() const
+{
+    return _validCounter;
+}
+
 bool
 SectorBlk::isSecure() const
 {
diff --git a/src/mem/cache/tags/sector_blk.hh b/src/mem/cache/tags/sector_blk.hh
index a30fb81..cfe6772 100644
--- a/src/mem/cache/tags/sector_blk.hh
+++ b/src/mem/cache/tags/sector_blk.hh
@@ -144,18 +144,19 @@
  */
 class SectorBlk : public ReplaceableEntry
 {
-  protected:
-    /**
-     * Sector tag value. A sector's tag is the tag of all its sub-blocks.
-     */
-    Addr _tag;
-
+  private:
     /**
* Counter of the number of valid sub-blocks. The sector is valid if any
      * of its sub-blocks is valid.
      */
     uint8_t _validCounter;

+  protected:
+    /**
+     * Sector tag value. A sector's tag is the tag of all its sub-blocks.
+     */
+    Addr _tag;
+
     /**
      * Whether sector blk is in secure-space or not.
      */
@@ -178,6 +179,13 @@
     bool isValid() const;

     /**
+     * Get the number of sub-blocks that have been validated.
+     *
+     * @return The number of valid sub-blocks.
+     */
+    uint8_t getNumValid() const;
+
+    /**
      * Checks that a sector block is secure. A single secure block suffices
      * to imply that the whole sector is secure, as the insertion proccess
* asserts that different secure spaces can't coexist in the same sector.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/22605
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Icef8b51164c8e165872dcaebc65f5c330f16cb29
Gerrit-Change-Number: 22605
Gerrit-PatchSet: 6
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to