Make two simple utility functions to determine if a MiscReg index corresponding to...
authorGabe Black <gblack@eecs.umich.edu>
Tue, 31 Oct 2006 22:50:57 +0000 (17:50 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 31 Oct 2006 22:50:57 +0000 (17:50 -0500)
--HG--
extra : convert_revision : 89eebba5eec01e629213997d24c734a6acad0ecb

src/arch/alpha/ipr.hh
src/arch/alpha/isa/decoder.isa

index 17518c0fe07406d5c9004a42d9826d5e1de2a1d6..51c1489b83ba575297471044b3c7962463b04adb 100644 (file)
@@ -218,6 +218,15 @@ namespace AlphaISA
         NumInternalProcRegs            // number of IPR registers
     };
 
+    inline bool IprIsWritable(int index)
+    {
+        return index < minReadOnlyIpr || index > maxReadOnlyIpr;
+    }
+
+    inline bool IprIsReadable(int index)
+    {
+        return index < minWriteOnlyIpr || index > maxWriteOnlyIpr;
+    }
 
     extern md_ipr_names MiscRegIndexToIpr[NumInternalProcRegs];
     extern int IprToMiscRegIndex[MaxInternalProcRegs];
index 0cbe38cebbaf718d2e4bc67c416c690bbde11b45..550aa62a3bcd854e0ec0c980b797bee502ecda62 100644 (file)
@@ -746,9 +746,7 @@ decode OPCODE default Unknown::unknown() {
         format HwMoveIPR {
             1: hw_mfpr({{
                 int miscRegIndex = IprToMiscRegIndex[ipr_index];
-                if(miscRegIndex < 0 ||
-                    (miscRegIndex >= MinWriteOnlyIpr &&
-                     miscRegIndex <= MaxWriteOnlyIpr))
+                if(miscRegIndex < 0 || !IprIsReadable(miscRegIndex))
                         fault = new UnimplementedOpcodeFault;
                 else
                     Ra = xc->readMiscRegWithEffect(miscRegIndex, fault);
@@ -761,9 +759,7 @@ decode OPCODE default Unknown::unknown() {
         format HwMoveIPR {
             1: hw_mtpr({{
                 int miscRegIndex = IprToMiscRegIndex[ipr_index];
-                if(miscRegIndex < 0 ||
-                    (miscRegIndex >= MinReadOnlyIpr &&
-                     miscRegIndex <= MaxWriteOnlyIpr))
+                if(miscRegIndex < 0 || !IprIsWritable(miscRegIndex))
                         fault = new UnimplementedOpcodeFault;
                 else
                     xc->setMiscRegWithEffect(miscRegIndex, Ra);