last changes before big merge
authorKorey Sewell <ksewell@umich.edu>
Thu, 9 Mar 2006 08:27:51 +0000 (03:27 -0500)
committerKorey Sewell <ksewell@umich.edu>
Thu, 9 Mar 2006 08:27:51 +0000 (03:27 -0500)
arch/alpha/isa_traits.hh:
arch/sparc/isa_traits.hh:
    add nnpc for compiling purposes in exec_context setNextNPC function
cpu/exec_context.hh:
    set NNPC function
cpu/simple/cpu.cc:
    use NNPC in determining what PC we are using

--HG--
extra : convert_revision : e810cfbc5dc31879b20d2cc40bf9871613203532

arch/alpha/isa_traits.hh
arch/mips/isa_traits.hh
arch/sparc/isa_traits.hh
cpu/exec_context.hh
cpu/simple/cpu.cc

index 9db16a1bf31669d60804d2df9513833d6a1b7147..940e3f300f7692305d8fbf1e6f43501564792823 100644 (file)
@@ -200,6 +200,8 @@ extern const int reg_redir[NumIntRegs];
         MiscRegFile miscRegs;          // control register file
         Addr pc;                       // program counter
         Addr npc;                      // next-cycle program counter
+        Addr nnpc;
+
 #if FULL_SYSTEM
         int intrflag;                  // interrupt flag
         inline int instAsid()
index 408cc3463f51ebe4d7721679b55736424b26830a..1dfa0dc7ae604de59d59bd79a440349b75ea7b32 100644 (file)
@@ -65,7 +65,7 @@ namespace MipsISA
 
         NumIntRegs = 32,
         NumFloatRegs = 32,
-        NumMiscRegs = 256,
+        NumMiscRegs = 258, //account for hi,lo regs
 
         MaxRegsOfAnyType = 32,
         // Static instruction parameters
@@ -127,8 +127,50 @@ namespace MipsISA
 
     // cop-0/cop-1 system control register file
     typedef uint64_t MiscReg;
-    typedef MiscReg MiscRegFile[NumMiscRegs];
+//typedef MiscReg MiscRegFile[NumMiscRegs];
+    class MiscRegFile {
+      public:
+        MiscReg
+      protected:
+        uint64_t       fpcr;           // floating point condition codes
+        uint64_t       uniq;           // process-unique register
+        bool           lock_flag;      // lock flag for LL/SC
+        Addr           lock_addr;      // lock address for LL/SC
 
+        MiscReg miscRegFile[NumMiscRegs];
+
+      public:
+        //These functions should be removed once the simplescalar cpu model
+        //has been replaced.
+        int getInstAsid();
+        int getDataAsid();
+
+        MiscReg readReg(int misc_reg)
+        { return miscRegFile[misc_reg]; }
+
+        MiscReg readRegWithEffect(int misc_reg, Fault &fault, ExecContext *xc)
+        { return miscRegFile[misc_reg];}
+
+        Fault setReg(int misc_reg, const MiscReg &val)
+        { miscRegFile[misc_reg] = val; return NoFault; }
+
+        Fault setRegWithEffect(int misc_reg, const MiscReg &val,
+                               ExecContext *xc)
+        { miscRegFile[misc_reg] = val; return NoFault; }
+
+#if FULL_SYSTEM
+        void clearIprs() { };
+
+      protected:
+        InternalProcReg ipr[NumInternalProcRegs]; // Internal processor regs
+
+      private:
+        MiscReg readIpr(int idx, Fault &fault, ExecContext *xc) { }
+
+        Fault setIpr(int idx, uint64_t val, ExecContext *xc) { }
+#endif
+        friend class RegFile;
+    };
 
     enum MiscRegTags {
         //Coprocessor 0 Registers
@@ -207,10 +249,10 @@ namespace MipsISA
 
         EPC = 105,//105-112        //14-0 Program counter at last exception
 
-        PrId = 113//113-120,       //15-0 Processor identification and revision
+        PRId = 113//113-120,       //15-0 Processor identification and revision
         EBase = 114,      //15-1 Exception vector base register
 
-        Config = 121,//121-128
+        Config = 121,//Bank 16: 121-128
         Config1 = 122,
         Config2 = 123,
         Config3 = 124,
@@ -218,9 +260,9 @@ namespace MipsISA
         Config7 = 128,
 
 
-        LLAddr = 129,//129-136
+        LLAddr = 129,//Bank 17: 129-136
 
-        WatchLo0 = 137,//137-144
+        WatchLo0 = 137,//Bank 18: 137-144
         WatchLo1 = 138,
         WatchLo2 = 139,
         WatchLo3 = 140,
@@ -229,7 +271,7 @@ namespace MipsISA
         WatchLo6 = 143,
         WatchLo7 = 144,
 
-        WatchHi0 = 145,//145-152
+        WatchHi0 = 145,//Bank 19: 145-152
         WatchHi1 = 146,
         WatchHi2 = 147,
         WatchHi3 = 148,
@@ -238,21 +280,21 @@ namespace MipsISA
         WatchHi6 = 151,
         WatchHi7 = 152,
 
-        XCContext64 = 153,//153-160
+        XCContext64 = 153,//Bank 20: 153-160
 
-        //161-168
+        //Bank 21: 161-168
 
-        //169-176
+        //Bank 22: 169-176
 
-        Debug = 177, //177-184
+        Debug = 177, //Bank 23: 177-184
         TraceControl1 = 178,
         TraceControl2 = 179,
         UserTraceData = 180,
         TraceBPC = 181,
 
-        DEPC = 185,//185-192
+        DEPC = 185,//Bank 24: 185-192
 
-        PerfCnt0 = 193,//193 - 200
+        PerfCnt0 = 193,//Bank 25: 193 - 200
         PerfCnt1 = 194,
         PerfCnt2 = 195,
         PerfCnt3 = 196,
@@ -261,48 +303,47 @@ namespace MipsISA
         PerfCnt6 = 199,
         PerfCnt7 = 200,
 
-        ErrCtl = 201, //201 - 208
+        ErrCtl = 201, //Bank 26: 201 - 208
 
-        CacheErr0 = 209, //209 - 216
+        CacheErr0 = 209, //Bank 27: 209 - 216
         CacheErr1 = 210,
         CacheErr2 = 211,
         CacheErr3 = 212,
 
-        TagLo0 = 217,//217 - 224
+        TagLo0 = 217,//Bank 28: 217 - 224
+        DataLo1 = 218,
         TagLo2 = 219,
+        DataLo3 = 220,
         TagLo4 = 221,
+        DataLo5 = 222,
         TagLo6 = 223,
+        DataLo7 = 234,
 
-        DataLo1 = 226,//225 - 232
-        DataLo3 = 228,
-        DataLo5 = 220,
-        DataLo7 = 232,
-
-        TagHi0 = 233,//233 - 240
+        TagHi0 = 233,//Bank 29: 233 - 240
+        DataHi1 = 234,
         TagHi2 = 235,
+        DataHi3 = 236,
         TagHi4 = 237,
+        DataHi5 = 238,
         TagHi6 = 239,
+        DataHi7 = 240,
 
-        DataHi0 = 241,//241 - 248
-        DataHi2 = 243,
-        DataHi4 = 245,
-        DataHi6 = 247,
 
-        ErrorEPC = 249,//249 - 256
+        ErrorEPC = 249,//Bank 30: 241 - 248
 
-        DESAVE = 257,
+        DESAVE = 257,//Bank 31: 249-256
 
         //More Misc. Regs
         Hi,
         Lo,
         FCSR,
         FPCR,
-        LockAddr,
-        LockFlag,
 
         //Alpha Regs, but here now, for
         //compiling sake
-        UNIQ
+        UNIQ,
+        LockAddr,
+        LockFlag
     };
 
 extern const Addr PageShift;
index c592a05edb81bc4d5ea30aa9cfcf4c03edf1340c..1752ed1944a480e47b5bf7e9a51e8258f1436672 100644 (file)
@@ -409,6 +409,7 @@ namespace SparcISA
 
         Addr pc;               // Program Counter
         Addr npc;              // Next Program Counter
+        Addr nnpc;
 
         void serialize(std::ostream &os);
         void unserialize(Checkpoint *cp, const std::string &section);
index bc3551b4fa0b0d0e0fd48284ec0a48e38e2d176c..550a1ca23592c23faf831e86cc29a05d12860f81 100644 (file)
@@ -422,6 +422,12 @@ class ExecContext
         regs.npc = val;
     }
 
+    void setNextNPC(uint64_t val)
+    {
+        regs.nnpc = val;
+    }
+
+
     MiscReg readMiscReg(int misc_reg)
     {
         return regs.miscRegs.readReg(misc_reg);
index 51d679a631ad7590e796daad5f12db754fbfd1a5..f1a3ebd0be66f30f6de4eb183e0d392710d5c4a3 100644 (file)
@@ -818,9 +818,17 @@ SimpleCPU::tick()
 #endif // FULL_SYSTEM
     }
     else {
+#if THE_ISA != MIPS_ISA
         // go to the next instruction
         xc->regs.pc = xc->regs.npc;
         xc->regs.npc += sizeof(MachInst);
+#else
+        // go to the next instruction
+        xc->regs.pc = xc->regs.npc;
+        xc->regs.npc = xc->regs.nnpc;
+        xc->regs.nnpc += sizeof(MachInst);
+#endif
+
     }
 
 #if FULL_SYSTEM