Daecheol You has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/50287 )

Change subject: cpu-minor: Fix for minor CPU scoreboard
......................................................................

cpu-minor: Fix for minor CPU scoreboard

When the scoreboard checks RAW dependency, it determines whether
the source registers can be forwarded or not to evaluate
relative latency. To do that, fuIndices[index] should be used
as an index for accessing cant_forward_from_fu_indices, not register
index itself. Moreover, since fuIndices[index] is cleared as -1
by clearInstDests(), the first compare should be fuIndices[index] != -1
instead of 1.

Change-Id: Ic62546855a8ad5365064d2ea2e2a0fbc1ccc6f41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50287
Reviewed-by: ZHENGRONG WANG <[email protected]>
Maintainer: ZHENGRONG WANG <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/cpu/minor/scoreboard.cc
M src/cpu/minor/scoreboard.hh
2 files changed, 7 insertions(+), 5 deletions(-)

Approvals:
  ZHENGRONG WANG: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/cpu/minor/scoreboard.cc b/src/cpu/minor/scoreboard.cc
index b957c3d..4637b8d 100644
--- a/src/cpu/minor/scoreboard.cc
+++ b/src/cpu/minor/scoreboard.cc
@@ -195,7 +195,7 @@
             if (numResults[index] == 0) {
                 returnCycle[index] = Cycles(0);
                 writingInst[index] = 0;
-                fuIndices[index] = -1;
+                fuIndices[index] = invalidFUIndex;
             }

             DPRINTF(MinorScoreboard, "Clearing inst: %s"
@@ -245,10 +245,11 @@
         unsigned short int index;

         if (findIndex(reg, index)) {
-            bool cant_forward = fuIndices[index] != 1 &&
+            int src_reg_fu = fuIndices[index];
+            bool cant_forward = src_reg_fu != invalidFUIndex &&
                 cant_forward_from_fu_indices &&
-                index < cant_forward_from_fu_indices->size() &&
-                (*cant_forward_from_fu_indices)[index];
+                src_reg_fu < cant_forward_from_fu_indices->size() &&
+                (*cant_forward_from_fu_indices)[src_reg_fu];

             Cycles relative_latency = (cant_forward ? Cycles(0) :
                 (src_index >= num_relative_latencies ?
diff --git a/src/cpu/minor/scoreboard.hh b/src/cpu/minor/scoreboard.hh
index a928444..3ae0b65 100644
--- a/src/cpu/minor/scoreboard.hh
+++ b/src/cpu/minor/scoreboard.hh
@@ -96,6 +96,7 @@

     /** Index of the FU generating this result */
     std::vector<int> fuIndices;
+    static constexpr int invalidFUIndex = -1;

     /** The estimated cycle number that the result will be presented.
      *  This can be offset from to allow forwarding to be simulated as
@@ -121,7 +122,7 @@
         zeroReg(reg_classes.at(IntRegClass).zeroReg()),
         numResults(numRegs, 0),
         numUnpredictableResults(numRegs, 0),
-        fuIndices(numRegs, 0),
+        fuIndices(numRegs, invalidFUIndex),
         returnCycle(numRegs, Cycles(0)),
         writingInst(numRegs, 0)
     { }

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

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ic62546855a8ad5365064d2ea2e2a0fbc1ccc6f41
Gerrit-Change-Number: 50287
Gerrit-PatchSet: 3
Gerrit-Owner: Daecheol You <[email protected]>
Gerrit-Reviewer: Daecheol You <[email protected]>
Gerrit-Reviewer: ZHENGRONG WANG <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to