summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-01-26 16:38:29 -0500
committerGabe Black <gblack@eecs.umich.edu>2007-01-26 16:38:29 -0500
commit47b2aa634627a93b125af1f07c6e5c249360b0d1 (patch)
treed687bec34682951e7b85fc228b36595ff8308138 /src
parent5407a6bc3223aacbb3f243327b62550e5773c292 (diff)
downloadgem5-47b2aa634627a93b125af1f07c6e5c249360b0d1.tar.xz
Fixed the number of integer registers. There are MaxGL+1 sets of globals, not just MaxGL.
--HG-- extra : convert_revision : 6fd090f112611db1e72a1f129dff03687d52930a
Diffstat (limited to 'src')
-rw-r--r--src/arch/sparc/intregfile.hh2
-rw-r--r--src/arch/sparc/regfile.cc10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/arch/sparc/intregfile.hh b/src/arch/sparc/intregfile.hh
index 716d45a65..665c7aa31 100644
--- a/src/arch/sparc/intregfile.hh
+++ b/src/arch/sparc/intregfile.hh
@@ -48,7 +48,7 @@ namespace SparcISA
std::string getIntRegName(RegIndex);
const int NumIntArchRegs = 32;
- const int NumIntRegs = MaxGL * 8 + NWindows * 16 + NumMicroIntRegs;
+ const int NumIntRegs = (MaxGL + 1) * 8 + NWindows * 16 + NumMicroIntRegs;
class IntRegFile
{
diff --git a/src/arch/sparc/regfile.cc b/src/arch/sparc/regfile.cc
index 4be411d17..d39892e73 100644
--- a/src/arch/sparc/regfile.cc
+++ b/src/arch/sparc/regfile.cc
@@ -157,6 +157,8 @@ int SparcISA::flattenIntIndex(ThreadContext * tc, int reg)
int cwp = tc->readMiscReg(MISCREG_CWP);
//DPRINTF(Sparc, "Global Level = %d, Current Window Pointer = %d\n", gl, cwp);
int newReg;
+ //The total number of global registers
+ int numGlobals = (MaxGL + 1) * 8;
if(reg < 8)
{
//Global register
@@ -167,14 +169,14 @@ int SparcISA::flattenIntIndex(ThreadContext * tc, int reg)
{
//Regular windowed register
//Put it in the window pointed to by cwp
- newReg = MaxGL * 8 +
+ newReg = numGlobals +
((reg - 8 - cwp * 16 + NWindows * 16) % (NWindows * 16));
}
else if(reg < NumIntArchRegs + NumMicroIntRegs)
{
//Microcode register
//Displace from the end of the regular registers
- newReg = reg - NumIntArchRegs + MaxGL * 8 + NWindows * 16;
+ newReg = reg - NumIntArchRegs + numGlobals + NWindows * 16;
}
else if(reg < 2 * NumIntArchRegs + NumMicroIntRegs)
{
@@ -189,7 +191,7 @@ int SparcISA::flattenIntIndex(ThreadContext * tc, int reg)
{
//Windowed register from the previous window
//Put it in the window before the one pointed to by cwp
- newReg = MaxGL * 8 +
+ newReg = numGlobals +
((reg - 8 - (cwp - 1) * 16 + NWindows * 16) % (NWindows * 16));
}
}
@@ -206,7 +208,7 @@ int SparcISA::flattenIntIndex(ThreadContext * tc, int reg)
{
//Windowed register from the next window
//Put it in the window after the one pointed to by cwp
- newReg = MaxGL * 8 +
+ newReg = numGlobals +
((reg - 8 - (cwp + 1) * 16 + NWindows * 16) % (NWindows * 16));
}
}