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 <seanyukigeek@gmail.com> Maintainer: ZHENGRONG WANG <seanyukigeek@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -195,7 +195,7 @@ Scoreboard::clearInstDests(MinorDynInstPtr inst, bool clear_unpredictable)
|
||||
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 @@ Scoreboard::canInstIssue(MinorDynInstPtr inst,
|
||||
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 ?
|
||||
|
||||
@@ -96,6 +96,7 @@ class Scoreboard : public Named
|
||||
|
||||
/** 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 @@ class Scoreboard : public Named
|
||||
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)
|
||||
{ }
|
||||
|
||||
Reference in New Issue
Block a user