Alpha: Fix Alpha NumMiscArchRegs constant.
Also add asserts in O3's Scoreboard class to catch bad indexes.
This commit is contained in:
parent
538acf2082
commit
d4492190e6
3 changed files with 26 additions and 5 deletions
|
@ -63,7 +63,8 @@ enum MiscRegIndex
|
|||
MISCREG_UNIQ,
|
||||
MISCREG_LOCKFLAG,
|
||||
MISCREG_LOCKADDR,
|
||||
MISCREG_INTR
|
||||
MISCREG_INTR,
|
||||
NUM_MISCREGS
|
||||
};
|
||||
|
||||
// semantically meaningful register indices
|
||||
|
@ -84,15 +85,14 @@ const RegIndex SyscallSuccessReg = 19;
|
|||
const int NumIntArchRegs = 32;
|
||||
const int NumPALShadowRegs = 8;
|
||||
const int NumFloatArchRegs = 32;
|
||||
// @todo: Figure out what this number really should be.
|
||||
const int NumMiscArchRegs = 77;
|
||||
const int NumMiscArchRegs = NUM_MISCREGS;
|
||||
|
||||
const int NumIntRegs = NumIntArchRegs + NumPALShadowRegs;
|
||||
const int NumFloatRegs = NumFloatArchRegs;
|
||||
const int NumMiscRegs = NumMiscArchRegs;
|
||||
|
||||
const int TotalNumRegs =
|
||||
NumIntRegs + NumFloatRegs + NumMiscRegs + NumInternalProcRegs;
|
||||
NumIntRegs + NumFloatRegs + NumMiscRegs;
|
||||
|
||||
const int TotalDataRegs = NumIntRegs + NumFloatRegs;
|
||||
|
||||
|
|
|
@ -51,22 +51,25 @@ Scoreboard::Scoreboard(unsigned activeThreads,
|
|||
numPhysicalRegs = numPhysicalIntRegs + numPhysicalFloatRegs;
|
||||
|
||||
//Resize scoreboard appropriately
|
||||
regScoreBoard.resize(numPhysicalRegs + (numMiscRegs * activeThreads));
|
||||
resize(numPhysicalRegs + (numMiscRegs * activeThreads));
|
||||
|
||||
//Initialize values
|
||||
for (int i=0; i < numLogicalIntRegs * activeThreads; i++) {
|
||||
assert(indexInBounds(i));
|
||||
regScoreBoard[i] = 1;
|
||||
}
|
||||
|
||||
for (int i= numPhysicalIntRegs;
|
||||
i < numPhysicalIntRegs + (numLogicalFloatRegs * activeThreads);
|
||||
i++) {
|
||||
assert(indexInBounds(i));
|
||||
regScoreBoard[i] = 1;
|
||||
}
|
||||
|
||||
for (int i = numPhysicalRegs;
|
||||
i < numPhysicalRegs + (numMiscRegs * activeThreads);
|
||||
i++) {
|
||||
assert(indexInBounds(i));
|
||||
regScoreBoard[i] = 1;
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +96,7 @@ Scoreboard::getReg(PhysRegIndex phys_reg)
|
|||
}
|
||||
#endif
|
||||
|
||||
assert(indexInBounds(phys_reg));
|
||||
return regScoreBoard[phys_reg];
|
||||
}
|
||||
|
||||
|
@ -101,6 +105,7 @@ Scoreboard::setReg(PhysRegIndex phys_reg)
|
|||
{
|
||||
DPRINTF(Scoreboard, "Setting reg %i as ready\n", phys_reg);
|
||||
|
||||
assert(indexInBounds(phys_reg));
|
||||
regScoreBoard[phys_reg] = 1;
|
||||
}
|
||||
|
||||
|
@ -120,5 +125,6 @@ Scoreboard::unsetReg(PhysRegIndex ready_reg)
|
|||
}
|
||||
#endif
|
||||
|
||||
assert(indexInBounds(ready_reg));
|
||||
regScoreBoard[ready_reg] = 0;
|
||||
}
|
||||
|
|
|
@ -111,6 +111,21 @@ class Scoreboard
|
|||
|
||||
/** The logical index of the zero register. */
|
||||
int zeroRegIdx;
|
||||
|
||||
int currentSize;
|
||||
|
||||
void
|
||||
resize(int newSize)
|
||||
{
|
||||
currentSize = newSize;
|
||||
regScoreBoard.resize(newSize);
|
||||
}
|
||||
|
||||
bool
|
||||
indexInBounds(int idx)
|
||||
{
|
||||
return idx < currentSize;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue