MIPS Compiles scons/MIPS_SE/arch/mips/decoder.do!!!!!!
authorKorey Sewell <ksewell@umich.edu>
Wed, 22 Feb 2006 08:33:35 +0000 (03:33 -0500)
committerKorey Sewell <ksewell@umich.edu>
Wed, 22 Feb 2006 08:33:35 +0000 (03:33 -0500)
arch/mips/faults.hh:
    remove nonsense
arch/mips/isa/base.isa:
    define R31
arch/mips/isa/bitfields.isa:
    forgotten bitfields
arch/mips/isa/decoder.isa:
    INT64 -> int64_t
arch/mips/isa/formats.isa:
    fix comments
arch/mips/isa/formats/branch.isa:
    Branch -> BranchLikely
    RB -> RT
arch/mips/isa/formats/fp.isa:
    Make FP ops generates
arch/mips/isa/formats/mem.isa:
    RA,RB -> RS,RT
arch/mips/isa/formats/noop.isa:
    Rc -> Rd
arch/mips/isa/formats/util.isa:
    forgot brace and semicolon
arch/mips/isa/includes.isa:
    remove unnecessary files
arch/mips/isa_traits.hh:
    spacing
cpu/static_inst.hh:
    add cond_delay_slot flag

--HG--
extra : convert_revision : 3bc7353b437f9a764e85cc462bed86c9d654eb37

13 files changed:
arch/mips/faults.hh
arch/mips/isa/base.isa
arch/mips/isa/bitfields.isa
arch/mips/isa/decoder.isa
arch/mips/isa/formats.isa
arch/mips/isa/formats/branch.isa
arch/mips/isa/formats/fp.isa
arch/mips/isa/formats/mem.isa
arch/mips/isa/formats/noop.isa
arch/mips/isa/formats/util.isa
arch/mips/isa/includes.isa
arch/mips/isa_traits.hh
cpu/static_inst.hh

index 4e1cb5ed69d84f482e0c013b3d3d41ac238c028c..60c9e735c5423a26471814b896c36014650c90d8 100644 (file)
@@ -32,9 +32,6 @@
 #include "sim/faults.hh"
 #include "arch/isa_traits.hh" //For the Addr type
 
-class Garbage;
-class Fault;
-
 class AlphaFault : public Fault
 {
   public:
index 49de59e551af6ccadd9b8450d17e197136d8ec3a..7600632d3bbc88133315a016c377bd0a5a0e83a5 100644 (file)
@@ -7,6 +7,8 @@
 
 //Outputs to decoder.hh
 output header {{
+#define R31 31
+
     /**
      * Base class for all MIPS static instructions.
      */
index 532b3793a0ea988742bbd2ce715fc520f58a754e..3a01b64ee4a04cd42a9043bac72a1be15a984bfd 100644 (file)
@@ -5,9 +5,15 @@
 // Bitfield definitions.
 //
 
+def bitfield OPCODE     <31:26>;
 def bitfield OPCODE_HI  <31:29>;
 def bitfield OPCODE_LO  <28:26>;
 
+def bitfield REGIMM      <20:16>;
+def bitfield REGIMM_HI   <20:19>;
+def bitfield REGIMM_LO   <18:16>;
+
+def bitfield FUNCTION      < 5: 0>;
 def bitfield FUNCTION_HI   < 5: 3>;
 def bitfield FUNCTION_LO   < 2: 0>;
 
@@ -31,6 +37,8 @@ def bitfield FT             <20:16>;
 def bitfield FS              <15:11>;
 def bitfield FD              <10:6>;
 
+def bitfield ND       <17:17>;
+def bitfield TF       <16:16>;
 def bitfield MOVCI    <16:16>;
 def bitfield MOVCF    <16:16>;
 def bitfield SRL      <21:21>;
@@ -45,7 +53,7 @@ def bitfield OFFSET <15: 0>; // displacement
 
 // Jmp format
 def bitfield JMPTARG   <25: 0>;
-def bitfield JMPHINT   <10: 6>;
+def bitfield HINT      <10: 6>;
 
 def bitfield SYSCALLCODE <25: 6>;
 def bitfield TRAPCODE    <15:13>;
index 7dd08ac49d2a42f5e62fc91fb0e3db733c703875..f16da7f878a7525b272b251b2e8e20bf6762f28c 100644 (file)
@@ -96,13 +96,13 @@ decode OPCODE_HI default Unknown::unknown() {
             0x3: decode FUNCTION_LO {
                 format IntOp {
                     0x0: mult({{
-                        INT64 temp1 = Rs.sw * Rt.sw;
+                        int64_t temp1 = Rs.sw * Rt.sw;
                         xc->miscRegs.hi->temp1<63:32>;
                         xc->miscRegs.lo->temp1<31:0>;
                     }});
 
                     0x1: multu({{
-                        INT64 temp1 = Rs.uw * Rt.uw;
+                        int64_t temp1 = Rs.uw * Rt.uw;
                         xc->miscRegs.hi->temp1<63:32>;
                         xc->miscRegs.lo->temp1<31:0>
                             Rd.sw = Rs.uw * Rt.uw;
@@ -141,7 +141,7 @@ decode OPCODE_HI default Unknown::unknown() {
             }
 
             0x6: decode FUNCTION_LO {
-                format Trap {
+                format BasicOp {
                     0x0: tge({{ cond = (Rs.sw >= Rt.sw); }});
                     0x1: tgeu({{ cond = (Rs.uw >= Rt.uw); }});
                     0x2: tlt({{ cond = (Rs.sw < Rt.sw); }});
@@ -167,7 +167,7 @@ decode OPCODE_HI default Unknown::unknown() {
             }
 
             0x1: decode REGIMM_LO {
-                format Trap {
+                format BasicOp {
                     0x0: tgei( {{ cond = (Rs.sw >= INTIMM); }});
                     0x1: tgeiu({{ cond = (Rs.uw >= INTIMM); }});
                     0x2: tlti( {{ cond = (Rs.sw < INTIMM); }});
@@ -179,14 +179,14 @@ decode OPCODE_HI default Unknown::unknown() {
 
             0x2: decode REGIMM_LO {
                 format Branch {
-                    0x0: bltzal({{ cond = (Rs.sw < 0); }}, IsLink);
-                    0x1: bgezal({{ cond = (Rs.sw >= 0); }}, IsLink);
+                    0x0: bltzal({{ cond = (Rs.sw < 0); }}, IsCall,IsReturn);
+                    0x1: bgezal({{ cond = (Rs.sw >= 0); }}, IsCall,IsReturn);
                 }
 
                 format BranchLikely {
                     //Will be removed in future MIPS releases
-                    0x2: bltzall({{ cond = (Rs.sw < 0); }}, IsLink);
-                    0x3: bgezall({{ cond = (Rs.sw >= 0); }}, IsLink);
+                    0x2: bltzall({{ cond = (Rs.sw < 0); }}, IsCall, IsReturn);
+                    0x3: bgezall({{ cond = (Rs.sw >= 0); }}, IsCall, IsReturn);
                 }
             }
 
@@ -336,7 +336,7 @@ decode OPCODE_HI default Unknown::unknown() {
 
             //Table A-12 MIPS32 COP0 Encoding of Function Field When rs=CO
             0x1: decode FUNCTION {
-                format Trap {
+                format BasicOp {
                     0x01: tlbr({{ }});
                     0x02: tlbwi({{ }});
                     0x06: tlbwr({{ }});
@@ -433,8 +433,8 @@ decode OPCODE_HI default Unknown::unknown() {
                             }
 
                             format Float64Op {
-                                0x2: recips({{ Fd = 1 / Fs; }});
-                                0x3: rsqrts({{ Fd = 1 / sqrt(Fs.ud);}});
+                                0x5: recips({{ Fd = 1 / Fs; }});
+                                0x6: rsqrts({{ Fd = 1 / sqrt(Fs.ud);}});
                             }
                         }
 
@@ -502,8 +502,8 @@ decode OPCODE_HI default Unknown::unknown() {
                             }
 
                             format BasicOp {
-                                0x2: movz({{ if (Rt == 0) Fd.df = Fs.df; }});
-                                0x3: movn({{ if (Rt != 0) Fd.df = Fs.df; }});
+                                0x2: movzd({{ if (Rt == 0) Fd.df = Fs.df; }});
+                                0x3: movnd({{ if (Rt != 0) Fd.df = Fs.df; }});
                             }
 
                             format Float64Op {
@@ -538,12 +538,12 @@ decode OPCODE_HI default Unknown::unknown() {
                     //Table A-16 MIPS32 COP1 Encoding of Function Field When rs=W
                     0x4: decode FUNCTION {
                         format FloatOp {
-                            0x10: cvt_s({{
+                            0x20: cvt_s({{
                                 int rnd_mode = xc->miscRegs.fcsr;
                                 Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_WORD);
                             }});
 
-                            0x10: cvt_d({{
+                            0x21: cvt_d({{
                                 int rnd_mode = xc->miscRegs.fcsr;
                                 Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_WORD);
                             }});
@@ -613,6 +613,11 @@ decode OPCODE_HI default Unknown::unknown() {
                                 }
                             }
 
+                            format BasicOp {
+                                0x2: movzps({{ if ( FPConditionCode(CC) == 0) Fd = Fs; }});
+                                0x3: movnps({{ if ( FPConditionCode(CC) == 0) Fd = Fs; }});
+                            }
+
                         }
 
                         0x4: decode RS_LO {
@@ -763,14 +768,14 @@ decode OPCODE_HI default Unknown::unknown() {
             0x0: decode FUNCTION_LO {
                 format IntOp {
                     0x0: madd({{
-                        INT64 temp1 = Hi.sw << 32 | Lo.sw >> 32;
+                        int64_t temp1 = Hi.sw << 32 | Lo.sw >> 32;
                         temp1 = temp1 + (Rs.sw * Rt.sw);
                         xc->miscRegs.hi->temp1<63:32>;
                         xc->miscRegs.lo->temp1<31:0>
                             }});
 
                     0x1: maddu({{
-                        INT64 temp1 = Hi.uw << 32 | Lo.uw >> 32;
+                        int64_t temp1 = Hi.uw << 32 | Lo.uw >> 32;
                         temp1 = temp1 + (Rs.uw * Rt.uw);
                         xc->miscRegs.hi->temp1<63:32>;
                         xc->miscRegs.lo->temp1<31:0>
@@ -779,14 +784,14 @@ decode OPCODE_HI default Unknown::unknown() {
                     0x2: mul({{        Rd.sw = Rs.sw * Rt.sw;  }});
 
                     0x4: msub({{
-                        INT64 temp1 = Hi.sw << 32 | Lo.sw >> 32;
+                        int64_t temp1 = Hi.sw << 32 | Lo.sw >> 32;
                         temp1 = temp1 - (Rs.sw * Rt.sw);
                         xc->miscRegs.hi->temp1<63:32>;
                         xc->miscRegs.lo->temp1<31:0>
                             }});
 
                     0x5: msubu({{
-                        INT64 temp1 = Hi.uw << 32 | Lo.uw >> 32;
+                        int64_t temp1 = Hi.uw << 32 | Lo.uw >> 32;
                         temp1 = temp1 - (Rs.uw * Rt.uw);
                         xc->miscRegs.hi->temp1<63:32>;
                         xc->miscRegs.lo->temp1<31:0>
index c244013dffaabea7df0e735168afb1df943ce2dd..a6aec9437112dd95ec95fb9689af79827e51b0cd 100644 (file)
@@ -10,7 +10,7 @@
 //Include utility formats/functions
 ##include "m5/arch/mips/isa/formats/util.isa"
 
-//Include the integerOp and integerOpCc format
+//Include the integer formats
 ##include "m5/arch/mips/isa/formats/int.isa"
 
 //Include the floatOp format
@@ -30,4 +30,3 @@
 
 //Include the noop format
 ##include "m5/arch/mips/isa/formats/unknown.isa"
-
index fc207fd3f3e61e600b4daa213c97d9db1f63571a..c896e9b2d02ea43f5ad839edd0f18b2fc640caab 100644 (file)
@@ -70,7 +70,7 @@ output header {{
         int32_t disp;
 
         /// Constructor.
-        Branch(const char *mnem, MachInst _machInst, OpClass __opClass)
+        BranchLikely(const char *mnem, MachInst _machInst, OpClass __opClass)
             : PCDependentDisassembly(mnem, _machInst, __opClass),
               disp(OFFSET << 2)
         {
@@ -243,7 +243,7 @@ output decoder {{
             ss << ",";
         }
 
-        ccprintf(ss, "(r%d)", RB);
+        ccprintf(ss, "(r%d)", RT);
 
         return ss.str();
     }
index 23fcbaa679c427d147e564ab67112e82effa2aac..7dd1e8442b372a132fca49a13e25628b05e76a94 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:c++ -*-
+
 ////////////////////////////////////////////////////////////////////
 //
 // Floating Point operate instructions
@@ -5,7 +7,7 @@
 
 output header {{
         /**
-         * Base class for integer operations.
+         * Base class for FP operations.
          */
         class FPOp : public MipsStaticInst
         {
@@ -70,62 +72,19 @@ def template FloatingPointExecute {{
 }};
 
 // Primary format for integer operate instructions:
-def format FloatOp(code, *opt_flags) {{
-        orig_code = code
-        cblk = CodeBlock(code)
-        checkPriv = (code.find('checkPriv') != -1)
-        code.replace('checkPriv', '')
-        if checkPriv:
-                code.replace('checkPriv;', 'if(!xc->regs.miscRegFile.pstateFields.priv) throw privileged_opcode;')
-        else:
-                code.replace('checkPriv;', '')
-        for (marker, value) in (('ivValue', '0'), ('icValue', '0'),
-                       ('xvValue', '0'), ('xcValue', '0')):
-                code.replace(marker, value)
-        iop = InstObjParams(name, Name, 'MipsStaticInst', cblk, opt_flags)
+def format FloatOp(code, *flags) {{
+        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
         header_output = BasicDeclare.subst(iop)
         decoder_output = BasicConstructor.subst(iop)
-        decode_block = BasicDecodeWithMnemonic.subst(iop)
-        exec_output = FloatingPointExecute.subst(iop)
+        decode_block = BasicDecode.subst(iop)
+        exec_output = BasicExecute.subst(iop)
 }};
 
 // Primary format for integer operate instructions:
-def format Float64Op(code, *opt_flags) {{
-        orig_code = code
-        cblk = CodeBlock(code)
-        checkPriv = (code.find('checkPriv') != -1)
-        code.replace('checkPriv', '')
-        if checkPriv:
-                code.replace('checkPriv;', 'if(!xc->regs.miscRegFile.pstateFields.priv) throw privileged_opcode;')
-        else:
-                code.replace('checkPriv;', '')
-        for (marker, value) in (('ivValue', '0'), ('icValue', '0'),
-                       ('xvValue', '0'), ('xcValue', '0')):
-                code.replace(marker, value)
-        iop = InstObjParams(name, Name, 'MipsStaticInst', cblk, opt_flags)
-        header_output = BasicDeclare.subst(iop)
-        decoder_output = BasicConstructor.subst(iop)
-        decode_block = BasicDecodeWithMnemonic.subst(iop)
-        exec_output = FloatingPointExecute.subst(iop)
-}};
-
-// Primary format for integer operate instructions:
-def format FPOpCc(code, icValue, ivValue, xcValue, xvValue, *opt_flags) {{
-        orig_code = code
-
-        cblk = CodeBlock(code)
-        checkPriv = (code.find('checkPriv') != -1)
-        code.replace('checkPriv', '')
-        if checkPriv:
-                code.replace('checkPriv;', 'if(!xc->regs.miscRegFile.pstateFields.priv) throw privileged_opcode;')
-        else:
-                code.replace('checkPriv;', '')
-        for (marker, value) in (('ivValue', ivValue), ('icValue', icValue),
-                       ('xvValue', xvValue), ('xcValue', xcValue)):
-                code.replace(marker, value)
-        iop = InstObjParams(name, Name, 'MipsStaticInst', cblk, opt_flags)
+def format Float64Op(code, *flags) {{
+        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
         header_output = BasicDeclare.subst(iop)
         decoder_output = BasicConstructor.subst(iop)
-        decode_block = BasicDecodeWithMnemonic.subst(iop)
-        exec_output = IntegerExecute.subst(iop)
+        decode_block = BasicDecode.subst(iop)
+        exec_output = BasicExecute.subst(iop)
 }};
index 134548746195919922cec0c105d09a75129b50ea..fcdb577c6e88436696b172a96bfa23b158d29ccb 100644 (file)
@@ -70,7 +70,7 @@ output decoder {{
     Memory::generateDisassembly(Addr pc, const SymbolTable *symtab) const
     {
         return csprintf("%-10s %c%d,%d(r%d)", mnemonic,
-                        flags[IsFloating] ? 'f' : 'r', RA, MEMDISP, RB);
+                        flags[IsFloating] ? 'f' : 'r', RS, JMPTARG, RT);
     }
 
 }};
index d366461e2ae75f03dae60e9bd01ee5f2c20af236..05c5ac10fb4db595e8d7eb38dc4fa3f64a1cfcf2 100644 (file)
@@ -63,12 +63,12 @@ output exec {{
     }
 }};
 
-// integer & FP operate instructions use Rc as dest, so check for
-// Rc == 31 to detect nops
+// integer & FP operate instructions use RT as dest, so check for
+// RT == 0 to detect nops
 def template OperateNopCheckDecode {{
  {
      MipsStaticInst *i = new %(class_name)s(machInst);
-     if (RC == 31) {
+     if (RD == 0) {
          i = makeNop(i);
      }
      return i;
index f0671726c2ca649f95c53e3b5cf26b4c5fe0ec9e..c06877b3501a1e859c96e59fdd46913034728e23 100644 (file)
@@ -122,4 +122,4 @@ output exec {{
     {
         //CODE HERE
     }
-}
+}};
index ff7cb7d1da5a5d6fab1e3d08f92e6a651bdf36b3..da919be001637a0027e9af86d6dfa1b26ac8c02b 100644 (file)
@@ -9,7 +9,6 @@ output header {{
 #include <iomanip>
 
 #include "cpu/static_inst.hh"
-#include "traps.hh"
 #include "mem/mem_req.hh"  // some constructors use MemReq flags
 }};
 
index c636cd2412784e567b9cc0f6b7d91d4842817a2d..71da82ffa3b716d9175759f2e1cb5ed685d5763e 100644 (file)
@@ -56,7 +56,7 @@ namespace MipsISA
 {
 
     typedef uint32_t MachInst;
-//    typedef uint64_t Addr;
+//  typedef uint64_t Addr;
     typedef uint8_t  RegIndex;
 
     enum {
index 5106dcf06e706081be92c428ad155f41b999215b..db9e73714e6bc954f29b9b1f43593d8ec3663336 100644 (file)
@@ -109,6 +109,8 @@ class StaticInstBase : public RefCounted
         IsCall,                        ///< Subroutine call.
         IsReturn,              ///< Subroutine return.
 
+        IsCondDelaySlot,///< Conditional Delay-Slot Instruction
+
         IsThreadSync,  ///< Thread synchronization operation.
 
         IsSerializing, ///< Serializes pipeline: won't execute until all