decoder.isa revision 2470
12889Sbinkertn@umich.edu// -*- mode:c++ -*-
22889Sbinkertn@umich.edu
32889Sbinkertn@umich.edu////////////////////////////////////////////////////////////////////
42889Sbinkertn@umich.edu//
52889Sbinkertn@umich.edu// The actual MIPS32 ISA decoder
62889Sbinkertn@umich.edu// -----------------------------
72889Sbinkertn@umich.edu// The following instructions are specified in the MIPS32 ISA
82889Sbinkertn@umich.edu// Specification. Decoding closely follows the style specified
92889Sbinkertn@umich.edu// in the MIPS32 ISAthe specification document starting with Table
102889Sbinkertn@umich.edu// A-2 (document available @ www.mips.com)
112889Sbinkertn@umich.edu//
122889Sbinkertn@umich.edu//@todo: Distinguish "unknown/future" use insts from "reserved"
132889Sbinkertn@umich.edu// ones
142889Sbinkertn@umich.edudecode OPCODE_HI default Unknown::unknown() {
152889Sbinkertn@umich.edu
162889Sbinkertn@umich.edu    // Derived From ... Table A-2 MIPS32 ISA Manual
172889Sbinkertn@umich.edu    0x0: decode OPCODE_LO {
182889Sbinkertn@umich.edu
192889Sbinkertn@umich.edu        0x0: decode FUNCTION_HI {
202889Sbinkertn@umich.edu            0x0: decode FUNCTION_LO {
212889Sbinkertn@umich.edu                0x1: decode MOVCI {
222889Sbinkertn@umich.edu                    format BasicOp {
232889Sbinkertn@umich.edu                        0: movf({{ if (xc->readMiscReg(FPCR) != CC) Rd = Rs}});
242889Sbinkertn@umich.edu                        1: movt({{ if (xc->readMiscReg(FPCR) == CC) Rd = Rs}});
252889Sbinkertn@umich.edu                    }
262889Sbinkertn@umich.edu                }
272889Sbinkertn@umich.edu
282889Sbinkertn@umich.edu                format BasicOp {
294850Snate@binkert.org
304850Snate@binkert.org                    //Table A-3 Note: "1. Specific encodings of the rt, rd, and sa fields
314850Snate@binkert.org                    //are used to distinguish among the SLL, NOP, SSNOP and EHB functions."
324850Snate@binkert.org
334850Snate@binkert.org                    0x0: decode RS  {
344850Snate@binkert.org                        0x0: decode RT {
355467Snate@binkert.org                                 0x0: decode RD default Nop::nop() {
365471Snate@binkert.org                                  0x0: decode SA {
375470Snate@binkert.org                                      0x1: ssnop({{ ; }});  //really sll r0,r0,1
382889Sbinkertn@umich.edu                                      0x3: ehb({{ ; }});  //really sll r0,r0,3
392889Sbinkertn@umich.edu                                  }
402889Sbinkertn@umich.edu                             }
414053Sbinkertn@umich.edu                        }
424053Sbinkertn@umich.edu
434053Sbinkertn@umich.edu                      default: sll({{ Rd = Rt.uw << SA; }});
444053Sbinkertn@umich.edu                    }
454053Sbinkertn@umich.edu
464053Sbinkertn@umich.edu                    0x2: decode SRL {
474053Sbinkertn@umich.edu                        0: srl({{ Rd = Rt.uw >> SA; }});
484053Sbinkertn@umich.edu
494053Sbinkertn@umich.edu                        //Hardcoded assuming 32-bit ISA, probably need parameter here
504053Sbinkertn@umich.edu                        1: rotr({{ Rd = (Rt.uw << (32 - SA)) | (Rt.uw >> SA);}});
514053Sbinkertn@umich.edu                    }
524053Sbinkertn@umich.edu
534053Sbinkertn@umich.edu                    0x3: sra({{ Rd = Rt.sw >> SA; }});
545470Snate@binkert.org
555470Snate@binkert.org                    0x4: sllv({{ Rd = Rt.uw << Rs<4:0>; }});
565470Snate@binkert.org
575470Snate@binkert.org                    0x6: decode SRLV {
585470Snate@binkert.org                        0: srlv({{ Rd = Rt.uw >> Rs<4:0>; }});
595470Snate@binkert.org
605470Snate@binkert.org                        //Hardcoded assuming 32-bit ISA, probably need parameter here
612889Sbinkertn@umich.edu                        1: rotrv({{ Rd = (Rt.uw << (32 - Rs<4:0>)) | (Rt.uw >> Rs<4:0>);}});
625470Snate@binkert.org                    }
635470Snate@binkert.org
645470Snate@binkert.org                    0x7: srav({{ Rd = Rt.sw >> Rs<4:0>; }});
655470Snate@binkert.org                }
665470Snate@binkert.org            }
672889Sbinkertn@umich.edu
682889Sbinkertn@umich.edu            0x1: decode FUNCTION_LO {
692889Sbinkertn@umich.edu
702889Sbinkertn@umich.edu                //Table A-3 Note: "Specific encodings of the hint field are used
714850Snate@binkert.org                //to distinguish JR from JR.HB and JALR from JALR.HB"
724850Snate@binkert.org                format Jump {
732889Sbinkertn@umich.edu                    0x0: decode HINT {
742889Sbinkertn@umich.edu                        0:jr({{ NNPC = Rs & ~1; }},IsReturn);
752889Sbinkertn@umich.edu
762889Sbinkertn@umich.edu                        1:jr_hb({{ NNPC = Rs & ~1; clear_exe_inst_hazards(); }},IsReturn);
772889Sbinkertn@umich.edu                    }
782889Sbinkertn@umich.edu
792889Sbinkertn@umich.edu                    0x1: decode HINT {
802889Sbinkertn@umich.edu                        0: jalr({{ NNPC = Rs; }},IsCall,IsReturn);
812889Sbinkertn@umich.edu
822889Sbinkertn@umich.edu                        1: jalr_hb({{ NNPC = Rs; clear_exe_inst_hazards();}},IsCall,IsReturn);
835524Sstever@gmail.com                    }
845524Sstever@gmail.com                }
855524Sstever@gmail.com
865524Sstever@gmail.com                format BasicOp {
875524Sstever@gmail.com                    0x2: movz({{ if (Rt == 0) Rd = Rs; }});
885524Sstever@gmail.com                    0x3: movn({{ if (Rt != 0) Rd = Rs; }});
895524Sstever@gmail.com                }
905524Sstever@gmail.com
912889Sbinkertn@umich.edu                format WarnUnimpl {
922889Sbinkertn@umich.edu                    0x4: syscall();//{{ xc->syscall()}},IsNonSpeculative
932899Sbinkertn@umich.edu                    0x5: break();
942899Sbinkertn@umich.edu                    0x7: sync();
952889Sbinkertn@umich.edu                }
962889Sbinkertn@umich.edu            }
972889Sbinkertn@umich.edu
982889Sbinkertn@umich.edu            0x2: decode FUNCTION_LO {
992889Sbinkertn@umich.edu                format BasicOp {
1002889Sbinkertn@umich.edu                    0x0: mfhi({{ Rd = xc->readMiscReg(Hi); }});
1012889Sbinkertn@umich.edu                    0x1: mthi({{ xc->setMiscReg(Hi,Rs); }});
1022889Sbinkertn@umich.edu                    0x2: mflo({{ Rd = xc->readMiscReg(Lo); }});
1032889Sbinkertn@umich.edu                    0x3: mtlo({{ xc->setMiscReg(Lo,Rs); }});
1042889Sbinkertn@umich.edu                }
1052889Sbinkertn@umich.edu            }
1062889Sbinkertn@umich.edu
1072889Sbinkertn@umich.edu            0x3: decode FUNCTION_LO {
1082889Sbinkertn@umich.edu                format IntOp {
1092889Sbinkertn@umich.edu                    0x0: mult({{
1102889Sbinkertn@umich.edu                        int64_t temp1 = Rs.sw * Rt.sw;
1115512SMichael.Adler@intel.com                        xc->setMiscReg(Hi,temp1<63:32>);
1125512SMichael.Adler@intel.com                        xc->setMiscReg(Lo,temp1<31:0>);
1132889Sbinkertn@umich.edu                    }});
1142889Sbinkertn@umich.edu
1152889Sbinkertn@umich.edu                    0x1: multu({{
1164053Sbinkertn@umich.edu                        int64_t temp1 = Rs.uw * Rt.uw;
1174053Sbinkertn@umich.edu                        xc->setMiscReg(Hi,temp1<63:32>);
1182889Sbinkertn@umich.edu                        xc->setMiscReg(Lo,temp1<31:0>);
1194053Sbinkertn@umich.edu                    }});
1204044Sbinkertn@umich.edu
1214044Sbinkertn@umich.edu                    0x2: div({{
1222889Sbinkertn@umich.edu                        xc->setMiscReg(Hi,Rs.sw % Rt.sw);
1232889Sbinkertn@umich.edu                        xc->setMiscReg(Lo,Rs.sw / Rt.sw);
1242889Sbinkertn@umich.edu                    }});
1252889Sbinkertn@umich.edu
1262889Sbinkertn@umich.edu                    0x3: divu({{
1275473Snate@binkert.org                        xc->setMiscReg(Hi,Rs.uw % Rt.uw);
1285473Snate@binkert.org                        xc->setMiscReg(Lo,Rs.uw / Rt.uw);
1295473Snate@binkert.org                    }});
1305473Snate@binkert.org                }
1315473Snate@binkert.org            }
1322889Sbinkertn@umich.edu
1334167Sbinkertn@umich.edu            0x4: decode FUNCTION_LO {
1344042Sbinkertn@umich.edu                format IntOp {
1353624Sbinkertn@umich.edu                    0x0: add({{  Rd.sw = Rs.sw + Rt.sw;/*Trap on Overflow*/}});
1362889Sbinkertn@umich.edu                    0x1: addu({{ Rd.sw = Rs.sw + Rt.sw;}});
1375472Snate@binkert.org                    0x2: sub({{ Rd.sw = Rs.sw - Rt.sw; /*Trap on Overflow*/}});
1385472Snate@binkert.org                    0x3: subu({{ Rd.sw = Rs.sw - Rt.uw;}});
1395472Snate@binkert.org                    0x4: and({{ Rd = Rs & Rt;}});
1405472Snate@binkert.org                    0x5: or({{ Rd = Rs | Rt;}});
1415472Snate@binkert.org                    0x6: xor({{ Rd = Rs ^ Rt;}});
1425472Snate@binkert.org                    0x7: nor({{ Rd = ~(Rs | Rt);}});
1435472Snate@binkert.org                }
1445470Snate@binkert.org            }
1452889Sbinkertn@umich.edu
1465524Sstever@gmail.com            0x5: decode FUNCTION_LO {
1475524Sstever@gmail.com                format IntOp{
1485524Sstever@gmail.com                    0x2: slt({{  Rd.sw = ( Rs.sw < Rt.sw ) ? 1 : 0}});
1495524Sstever@gmail.com                    0x3: sltu({{ Rd.uw = ( Rs.uw < Rt.uw ) ? 1 : 0}});
1505524Sstever@gmail.com                }
1515524Sstever@gmail.com            }
1525524Sstever@gmail.com
1535524Sstever@gmail.com            0x6: decode FUNCTION_LO {
1545524Sstever@gmail.com                format Trap {
1555524Sstever@gmail.com                    0x0: tge({{  cond = (Rs.sw >= Rt.sw); }});
1565524Sstever@gmail.com                    0x1: tgeu({{ cond = (Rs.uw >= Rt.uw); }});
1575524Sstever@gmail.com                    0x2: tlt({{ cond = (Rs.sw < Rt.sw); }});
1585524Sstever@gmail.com                    0x3: tltu({{ cond = (Rs.uw >= Rt.uw); }});
1595524Sstever@gmail.com                    0x4: teq({{ cond = (Rs.sw == Rt.sw); }});
1605524Sstever@gmail.com                    0x6: tne({{ cond = (Rs.sw != Rt.sw); }});
1615524Sstever@gmail.com                }
1625524Sstever@gmail.com            }
1635524Sstever@gmail.com        }
1645524Sstever@gmail.com
1655524Sstever@gmail.com        0x1: decode REGIMM_HI {
1665524Sstever@gmail.com            0x0: decode REGIMM_LO {
1675524Sstever@gmail.com                format Branch {
1685524Sstever@gmail.com                    0x0: bltz({{ cond = (Rs.sw < 0); }});
1695524Sstever@gmail.com                    0x1: bgez({{ cond = (Rs.sw >= 0); }});
1705524Sstever@gmail.com                }
1715524Sstever@gmail.com
1725524Sstever@gmail.com                format BranchLikely {
1732889Sbinkertn@umich.edu                    //MIPS obsolete instructions
1744850Snate@binkert.org                    0x2: bltzl({{ cond = (Rs.sw < 0); }});
1754850Snate@binkert.org                    0x3: bgezl({{ cond = (Rs.sw >= 0); }});
1765586Snate@binkert.org                }
1775586Snate@binkert.org            }
1784850Snate@binkert.org
1794850Snate@binkert.org            0x1: decode REGIMM_LO {
1804850Snate@binkert.org                format Trap {
1814850Snate@binkert.org                    0x0: tgei( {{ cond = (Rs.sw >= INTIMM); }});
1825528Sstever@gmail.com                    0x1: tgeiu({{ cond = (Rs.uw >= INTIMM); }});
1835528Sstever@gmail.com                    0x2: tlti( {{ cond = (Rs.sw < INTIMM); }});
1844850Snate@binkert.org                    0x3: tltiu({{ cond = (Rs.uw < INTIMM); }});
1854850Snate@binkert.org                    0x4: teqi( {{ cond = (Rs.sw == INTIMM);}});
1864850Snate@binkert.org                    0x6: tnei( {{ cond = (Rs.sw != INTIMM);}});
1874850Snate@binkert.org                }
1884850Snate@binkert.org            }
1894850Snate@binkert.org
1904850Snate@binkert.org            0x2: decode REGIMM_LO {
1914850Snate@binkert.org                format Branch {
1922889Sbinkertn@umich.edu                    0x0: bltzal({{ cond = (Rs.sw < 0); }}, IsCall,IsReturn);
1932889Sbinkertn@umich.edu                    0x1: bgezal({{ cond = (Rs.sw >= 0); }}, IsCall,IsReturn);
1942889Sbinkertn@umich.edu                }
1952889Sbinkertn@umich.edu
1962889Sbinkertn@umich.edu                format BranchLikely {
1972889Sbinkertn@umich.edu                    //Will be removed in future MIPS releases
1982889Sbinkertn@umich.edu                    0x2: bltzall({{ cond = (Rs.sw < 0); }}, IsCall, IsReturn);
1992889Sbinkertn@umich.edu                    0x3: bgezall({{ cond = (Rs.sw >= 0); }}, IsCall, IsReturn);
2002889Sbinkertn@umich.edu                }
2012889Sbinkertn@umich.edu            }
2022889Sbinkertn@umich.edu
2032889Sbinkertn@umich.edu            0x3: decode REGIMM_LO {
2042889Sbinkertn@umich.edu                format WarnUnimpl {
2052889Sbinkertn@umich.edu                    0x7: synci();
2062889Sbinkertn@umich.edu                }
2072889Sbinkertn@umich.edu            }
2082889Sbinkertn@umich.edu        }
2092889Sbinkertn@umich.edu
2102889Sbinkertn@umich.edu        format Jump {
2112889Sbinkertn@umich.edu            0x2: j({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2);}});
2122889Sbinkertn@umich.edu
2132889Sbinkertn@umich.edu            0x3: jal({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }},IsCall,IsReturn);
2142889Sbinkertn@umich.edu        }
2152889Sbinkertn@umich.edu
2162889Sbinkertn@umich.edu        format Branch {
2172889Sbinkertn@umich.edu            0x4: beq({{ cond = (Rs.sw == Rt.sw); }});
2184053Sbinkertn@umich.edu            0x5: bne({{ cond = (Rs.sw != Rt.sw); }});
2195586Snate@binkert.org            0x6: blez({{ cond = (Rs.sw <= 0); }});
2205586Snate@binkert.org            0x7: bgtz({{ cond = (Rs.sw > 0); }});
2214053Sbinkertn@umich.edu        }
2224053Sbinkertn@umich.edu    }
2234053Sbinkertn@umich.edu
2244053Sbinkertn@umich.edu    0x1: decode OPCODE_LO {
2254053Sbinkertn@umich.edu        format IntOp {
2264053Sbinkertn@umich.edu            0x0: addi({{ Rt.sw = Rs.sw + imm; /*Trap If Overflow*/}});
2274053Sbinkertn@umich.edu            0x1: addiu({{ Rt.sw = Rs.sw + imm;}});
2284053Sbinkertn@umich.edu            0x2: slti({{ Rt.sw = ( Rs.sw < imm) ? 1 : 0 }});
2294053Sbinkertn@umich.edu            0x3: sltiu({{ Rt.sw = ( Rs.sw < imm ) ? 1 : 0 }});
2304053Sbinkertn@umich.edu            0x4: andi({{ Rt.sw = Rs.sw & INTIMM;}});
2314053Sbinkertn@umich.edu            0x5: ori({{ Rt.sw = Rs.sw | INTIMM;}});
2324053Sbinkertn@umich.edu            0x6: xori({{ Rt.sw = Rs.sw ^ INTIMM;}});
2335473Snate@binkert.org            0x7: lui({{ Rt = INTIMM << 16}});
2345473Snate@binkert.org        }
2355473Snate@binkert.org    }
2365473Snate@binkert.org
2375473Snate@binkert.org    0x2: decode OPCODE_LO {
2385473Snate@binkert.org
2395473Snate@binkert.org        //Table A-11 MIPS32 COP0 Encoding of rs Field
2405473Snate@binkert.org        0x0: decode RS_MSB {
2415473Snate@binkert.org            0x0: decode RS {
2425473Snate@binkert.org                format System {
2435473Snate@binkert.org                    0x0: mfc0({{
2445473Snate@binkert.org                        //uint64_t reg_num = Rd.uw;
2455473Snate@binkert.org
2465473Snate@binkert.org                        Rt = xc->readMiscReg(RD << 5 | SEL);
2475473Snate@binkert.org                    }});
2485473Snate@binkert.org
2495473Snate@binkert.org                    0x4: mtc0({{
2505473Snate@binkert.org                        //uint64_t reg_num = Rd.uw;
2515473Snate@binkert.org
2525473Snate@binkert.org                        xc->setMiscReg(RD << 5 | SEL,Rt);
2535473Snate@binkert.org                    }});
2542889Sbinkertn@umich.edu
2552889Sbinkertn@umich.edu                    0x8: mftr({{
2562889Sbinkertn@umich.edu                        //The contents of the coprocessor 0 register specified by the
2575470Snate@binkert.org                        //combination of rd and sel are loaded into general register
2585470Snate@binkert.org                        //rt. Note that not all coprocessor 0 registers support the
2595470Snate@binkert.org                        //sel field. In those instances, the sel field must be zero.
2605470Snate@binkert.org
2615470Snate@binkert.org                        //MT Code Needed Here
2622889Sbinkertn@umich.edu                    }});
2632889Sbinkertn@umich.edu
2642889Sbinkertn@umich.edu                    0xC: mttr({{
2652889Sbinkertn@umich.edu                        //The contents of the coprocessor 0 register specified by the
2664123Sbinkertn@umich.edu                        //combination of rd and sel are loaded into general register
2675456Ssaidi@eecs.umich.edu                        //rt. Note that not all coprocessor 0 registers support the
2685456Ssaidi@eecs.umich.edu                        //sel field. In those instances, the sel field must be zero.
2695456Ssaidi@eecs.umich.edu
2705528Sstever@gmail.com                        //MT Code Needed Here
2715528Sstever@gmail.com                    }});
2725528Sstever@gmail.com
2732967Sktlim@umich.edu
2742967Sktlim@umich.edu                    0xA: rdpgpr({{
2752967Sktlim@umich.edu                        //Accessing Previous Shadow Set Register Number
2762967Sktlim@umich.edu                        //uint64_t prev = xc->readMiscReg(SRSCtl)/*[PSS]*/;
2772889Sbinkertn@umich.edu                        //uint64_t reg_num = Rt.uw;
2782889Sbinkertn@umich.edu
2792889Sbinkertn@umich.edu                        //Rd = xc->regs.IntRegFile[prev];
2802922Sktlim@umich.edu                       //Rd = xc->shadowIntRegFile[prev][reg_num];
2812922Sktlim@umich.edu                    }});
2824053Sbinkertn@umich.edu
2835470Snate@binkert.org                    0xB: decode RD {
2842889Sbinkertn@umich.edu
2852889Sbinkertn@umich.edu                        0x0: decode SC {
2864123Sbinkertn@umich.edu                            0x0: dvpe({{
2872889Sbinkertn@umich.edu                                Rt.sw = xc->readMiscReg(MVPControl);
2882889Sbinkertn@umich.edu                                xc->setMiscReg(MVPControl,0);
2892889Sbinkertn@umich.edu                            }});
2902889Sbinkertn@umich.edu
2912889Sbinkertn@umich.edu                            0x1: evpe({{
2922889Sbinkertn@umich.edu                                Rt.sw = xc->readMiscReg(MVPControl);
2932889Sbinkertn@umich.edu                                xc->setMiscReg(MVPControl,1);
2944078Sbinkertn@umich.edu                            }});
2952889Sbinkertn@umich.edu                        }
2962889Sbinkertn@umich.edu
2975512SMichael.Adler@intel.com                        0x1: decode SC {
2983645Sbinkertn@umich.edu                            0x0: dmt({{
2993645Sbinkertn@umich.edu                                Rt.sw = xc->readMiscReg(VPEControl);
3002889Sbinkertn@umich.edu                                xc->setMiscReg(VPEControl,0);
3015586Snate@binkert.org                            }});
3025586Snate@binkert.org
3034053Sbinkertn@umich.edu                            0x1: emt({{
3045586Snate@binkert.org                                Rt.sw = xc->readMiscReg(VPEControl);
3055586Snate@binkert.org                                xc->setMiscReg(VPEControl,1);
3065586Snate@binkert.org                            }});
3075586Snate@binkert.org                        }
3085586Snate@binkert.org
3095586Snate@binkert.org                        0xC: decode SC {
3105586Snate@binkert.org                            0x0: di({{
3115586Snate@binkert.org                                Rt.sw = xc->readMiscReg(Status);
3125586Snate@binkert.org                                xc->setMiscReg(Status,0);
3135586Snate@binkert.org                            }});
3144053Sbinkertn@umich.edu
3155586Snate@binkert.org                            0x1: ei({{
3165586Snate@binkert.org                                Rt.sw = xc->readMiscReg(Status);
3175586Snate@binkert.org                                xc->setMiscReg(Status,1);
3185586Snate@binkert.org                            }});
3194042Sbinkertn@umich.edu                        }
3205586Snate@binkert.org                    }
3215586Snate@binkert.org
3225586Snate@binkert.org                    0xE: wrpgpr({{
3235586Snate@binkert.org                        //Accessing Previous Shadow Set Register Number
3245586Snate@binkert.org                        //uint64_t prev = xc->readMiscReg(SRSCtl/*[PSS]*/);
3254053Sbinkertn@umich.edu                        //uint64_t reg_num = Rd.uw;
3264074Sbinkertn@umich.edu
3274042Sbinkertn@umich.edu                        //xc->regs.IntRegFile[prev];
3284074Sbinkertn@umich.edu                        //xc->shadowIntRegFile[prev][reg_num] = Rt;
3294167Sbinkertn@umich.edu                    }});
3304074Sbinkertn@umich.edu                }
3314087Sbinkertn@umich.edu            }
3324042Sbinkertn@umich.edu
3334046Sbinkertn@umich.edu            //Table A-12 MIPS32 COP0 Encoding of Function Field When rs=CO
3344042Sbinkertn@umich.edu            0x1: decode FUNCTION {
3354042Sbinkertn@umich.edu                format System {
3364042Sbinkertn@umich.edu                    0x01: tlbr({{ }});
3372889Sbinkertn@umich.edu                    0x02: tlbwi({{ }});
3382889Sbinkertn@umich.edu                    0x06: tlbwr({{ }});
3392889Sbinkertn@umich.edu                    0x08: tlbp({{ }});
3402891Sbinkertn@umich.edu                }
3415604Snate@binkert.org
3425604Snate@binkert.org                format WarnUnimpl {
3435604Snate@binkert.org                    0x18: eret();
3445604Snate@binkert.org                    0x1F: deret();
3453887Sbinkertn@umich.edu                    0x20: wait();
3462899Sbinkertn@umich.edu                }
3472899Sbinkertn@umich.edu            }
3482899Sbinkertn@umich.edu        }
3494042Sbinkertn@umich.edu
3502899Sbinkertn@umich.edu        //Table A-13 MIPS32 COP1 Encoding of rs Field
3512899Sbinkertn@umich.edu        0x1: decode RS_MSB {
3522899Sbinkertn@umich.edu
3532899Sbinkertn@umich.edu            0x0: decode RS_HI {
3545604Snate@binkert.org                0x0: decode RS_LO {
3555604Snate@binkert.org                    format FloatOp {
3565604Snate@binkert.org                        0x0: mfc1({{ /*Rt.uw = Fs.ud<31:0>;*/ }});
3575604Snate@binkert.org                        0x2: cfc1({{ /*Rt.uw = xc->readMiscReg(FPCR[Fs]);*/}});
3585604Snate@binkert.org                        0x3: mfhc1({{ /*Rt.uw = Fs.ud<63:32>*/;}});
3595604Snate@binkert.org                        0x4: mtc1({{ /*Fs = Rt.uw*/}});
3605604Snate@binkert.org                        0x6: ctc1({{ /*xc->setMiscReg(FPCR[Fs],Rt);*/}});
3615604Snate@binkert.org                        0x7: mthc1({{ /*Fs<63:32> = Rt.uw*/}});
3625604Snate@binkert.org                    }
3635604Snate@binkert.org                }
3645604Snate@binkert.org
3655604Snate@binkert.org                0x1: decode ND {
3665604Snate@binkert.org                    0x0: decode TF {
3675604Snate@binkert.org                        format Branch {
3685604Snate@binkert.org                            0x0: bc1f({{ cond = (xc->readMiscReg(FPCR) == 0); }});
3695604Snate@binkert.org                            0x1: bc1t({{ cond = (xc->readMiscReg(FPCR) == 1); }});
3702899Sbinkertn@umich.edu                        }
3715604Snate@binkert.org                    }
3722889Sbinkertn@umich.edu
3732889Sbinkertn@umich.edu                    0x1: decode TF {
3742889Sbinkertn@umich.edu                        format BranchLikely {
3752889Sbinkertn@umich.edu                            0x0: bc1fl({{ cond = (xc->readMiscReg(FPCR) == 0); }});
3762889Sbinkertn@umich.edu                            0x1: bc1tl({{ cond = (xc->readMiscReg(FPCR) == 1); }});
3772889Sbinkertn@umich.edu                        }
3782889Sbinkertn@umich.edu                    }
3792889Sbinkertn@umich.edu                }
3802889Sbinkertn@umich.edu            }
3815586Snate@binkert.org
3825586Snate@binkert.org            0x1: decode RS_HI {
3835586Snate@binkert.org                0x2: decode RS_LO {
3845586Snate@binkert.org
3855586Snate@binkert.org                    //Table A-14 MIPS32 COP1 Encoding of Function Field When rs=S
3865586Snate@binkert.org                    //(( single-word ))
3875586Snate@binkert.org                    0x0: decode RS_HI {
3885586Snate@binkert.org                        0x0: decode RS_LO {
3892889Sbinkertn@umich.edu                            format FloatOp {
3902889Sbinkertn@umich.edu                                0x0: adds({{ Fd.sf = Fs.sf + Ft.sf;}});
3912889Sbinkertn@umich.edu                                0x1: subs({{ Fd.sf = Fs.sf - Ft.sf;}});
3922889Sbinkertn@umich.edu                                0x2: muls({{ Fd.sf = Fs.sf * Ft.sf;}});
3932889Sbinkertn@umich.edu                                0x3: divs({{ Fd.sf = Fs.sf / Ft.sf;}});
3942889Sbinkertn@umich.edu                                0x4: sqrts({{ Fd.sf = sqrt(Fs.sf);}});
3952889Sbinkertn@umich.edu                                0x5: abss({{ Fd.sf = fabs(Fs.sf);}});
396                                0x6: movs({{ Fd.sf = Fs.sf;}});
397                                0x7: negs({{ Fd.sf = -1 * Fs.sf;}});
398                            }
399                        }
400
401                        0x1: decode RS_LO {
402                            //only legal for 64 bit-FP
403                            format Float64Op {
404                                0x0: round_l_s({{ Fd = convert_and_round(Fs.sf,RND_NEAREST,FP_LONG,FP_SINGLE);}});
405                                0x1: trunc_l_s({{ Fd = convert_and_round(Fs.sf,RND_ZERO,FP_LONG,FP_SINGLE);}});
406                                0x2: ceil_l_s({{ Fd = convert_and_round(Fs.sf,RND_UP,FP_LONG,FP_SINGLE);}});
407                                0x3: floor_l_s({{ Fd = convert_and_round(Fs.sf,RND_DOWN,FP_LONG,FP_SINGLE);}});
408                            }
409
410                            format FloatOp {
411                                0x4: round_w_s({{ Fd = convert_and_round(Fs.sf,RND_NEAREST,FP_WORD,FP_SINGLE);}});
412                                0x5: trunc_w_s({{ Fd = convert_and_round(Fs.sf,RND_ZERO,FP_WORD,FP_SINGLE);}});
413                                0x6: ceil_w_s({{  Fd = convert_and_round(Fs.sf,RND_UP,FP_WORD,FP_SINGLE);}});
414                                0x7: floor_w_s({{ Fd = convert_and_round(Fs.sf,RND_DOWN,FP_WORD,FP_SINGLE);}});
415                            }
416                        }
417
418                        0x2: decode RS_LO {
419                            0x1: decode MOVCF {
420                                format FloatOp {
421                                    0x0: movfs({{if (xc->readMiscReg(FPCR) != CC) Fd = Fs; }});
422                                    0x1: movts({{if (xc->readMiscReg(FPCR) == CC) Fd = Fs;}});
423                                }
424                            }
425
426                            format BasicOp {
427                                0x2: movzs({{ if (Rt == 0) Fd = Fs; }});
428                                0x3: movns({{ if (Rt != 0) Fd = Fs; }});
429                            }
430
431                            format Float64Op {
432                                0x5: recips({{ Fd = 1 / Fs; }});
433                                0x6: rsqrts({{ Fd = 1 / sqrt((double)Fs.ud);}});
434                            }
435                        }
436
437                        0x4: decode RS_LO {
438
439                            format FloatOp {
440                                0x1: cvt_d_s({{ int rnd_mode = xc->readMiscReg(FCSR);
441                                Fd = convert_and_round(Fs.sf,rnd_mode,FP_DOUBLE,FP_SINGLE);
442                                }});
443
444                                0x4: cvt_w_s({{ int rnd_mode = xc->readMiscReg(FCSR);
445                                Fd = convert_and_round(Fs.sf,rnd_mode,FP_WORD,FP_SINGLE);
446                                }});
447                            }
448
449                            //only legal for 64 bit
450                            format Float64Op {
451                                0x5: cvt_l_s({{ int rnd_mode = xc->readMiscReg(FCSR);
452                                Fd = convert_and_round(Fs.sf,rnd_mode,FP_LONG,FP_SINGLE);
453                                }});
454
455                                0x6: cvt_ps_s({{ /*Fd.df = Fs.df<31:0> | Ft.df<31:0>;*/ }});
456                            }
457                        }
458                    }
459
460                    //Table A-15 MIPS32 COP1 Encoding of Function Field When rs=D
461                    0x1: decode RS_HI {
462                        0x0: decode RS_LO {
463                            format FloatOp {
464                                0x0: addd({{ Fd.df = Fs.df + Ft.df;}});
465                                0x1: subd({{ Fd.df = Fs.df - Ft.df;}});
466                                0x2: muld({{ Fd.df = Fs.df * Ft.df;}});
467                                0x3: divd({{ Fd.df = Fs.df / Ft.df;}});
468                                0x4: sqrtd({{ Fd.df = sqrt(Fs.df);}});
469                                0x5: absd({{ Fd.df = fabs(Fs.df);}});
470                                0x6: movd({{ Fd.df = Fs.df;}});
471                                0x7: negd({{ Fd.df = -1 * Fs.df;}});
472                            }
473                        }
474
475                        0x1: decode RS_LO {
476                            //only legal for 64 bit
477                            format Float64Op {
478                                0x0: round_l_d({{ Fd = convert_and_round(Fs.df,RND_NEAREST,FP_LONG,FP_DOUBLE); }});
479                                0x1: trunc_l_d({{ Fd = convert_and_round(Fs.df,RND_ZERO,FP_LONG,FP_DOUBLE);}});
480                                0x2: ceil_l_d({{ Fd = convert_and_round(Fs.df,RND_UP,FP_LONG,FP_DOUBLE);}});
481                                0x3: floor_l_d({{ Fd = convert_and_round(Fs.df,RND_DOWN,FP_LONG,FP_DOUBLE);}});
482                            }
483
484                            format FloatOp {
485                                0x4: round_w_d({{ Fd = convert_and_round(Fs.df,RND_NEAREST,FP_LONG,FP_DOUBLE); }});
486                                0x5: trunc_w_d({{ Fd = convert_and_round(Fs.df,RND_ZERO,FP_LONG,FP_DOUBLE); }});
487                                0x6: ceil_w_d({{  Fd = convert_and_round(Fs.df,RND_UP,FP_LONG,FP_DOUBLE); }});
488                                0x7: floor_w_d({{ Fd = convert_and_round(Fs.df,RND_DOWN,FP_LONG,FP_DOUBLE); }});
489                            }
490                        }
491
492                        0x2: decode RS_LO {
493                            0x1: decode MOVCF {
494                                format FloatOp {
495                                    0x0: movfd({{if (xc->readMiscReg(FPCR) != CC) Fd.df = Fs.df; }});
496                                    0x1: movtd({{if (xc->readMiscReg(FPCR) == CC) Fd.df = Fs.df; }});
497                                }
498                            }
499
500                            format BasicOp {
501                                0x2: movzd({{ if (Rt == 0) Fd.df = Fs.df; }});
502                                0x3: movnd({{ if (Rt != 0) Fd.df = Fs.df; }});
503                            }
504
505                            format Float64Op {
506                                0x5: recipd({{ Fd.df = 1 / Fs.df}});
507                                0x6: rsqrtd({{ Fd.df = 1 / sqrt(Fs.df) }});
508                            }
509                        }
510
511                        0x4: decode RS_LO {
512                            format FloatOp {
513                                0x0: cvt_s_d({{
514                                    int rnd_mode = xc->readMiscReg(FCSR);
515                                    Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_DOUBLE);
516                                }});
517
518                                0x4: cvt_w_d({{
519                                    int rnd_mode = xc->readMiscReg(FCSR);
520                                    Fd = convert_and_round(Fs.df,rnd_mode,FP_WORD,FP_DOUBLE);
521                                }});
522                            }
523
524                            //only legal for 64 bit
525                            format Float64Op {
526                                0x5: cvt_l_d({{
527                                    int rnd_mode = xc->readMiscReg(FCSR);
528                                    Fd = convert_and_round(Fs.df,rnd_mode,FP_LONG,FP_DOUBLE);
529                                }});
530                            }
531                        }
532                    }
533
534                    //Table A-16 MIPS32 COP1 Encoding of Function Field When rs=W
535                    0x4: decode FUNCTION {
536                        format FloatOp {
537                            0x20: cvt_s({{
538                                int rnd_mode = xc->readMiscReg(FCSR);
539                                Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_WORD);
540                            }});
541
542                            0x21: cvt_d({{
543                                int rnd_mode = xc->readMiscReg(FCSR);
544                                Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_WORD);
545                            }});
546                        }
547                    }
548
549                    //Table A-16 MIPS32 COP1 Encoding of Function Field When rs=L1
550                    //Note: "1. Format type L is legal only if 64-bit floating point operations
551                    //are enabled."
552                    0x5: decode FUNCTION_HI {
553                        format FloatOp {
554                            0x10: cvt_s_l({{
555                                int rnd_mode = xc->readMiscReg(FCSR);
556                                Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_LONG);
557                            }});
558
559                            0x11: cvt_d_l({{
560                                int rnd_mode = xc->readMiscReg(FCSR);
561                                Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_LONG);
562                            }});
563                        }
564                    }
565
566                    //Table A-17 MIPS64 COP1 Encoding of Function Field When rs=PS1
567                    //Note: "1. Format type PS is legal only if 64-bit floating point operations
568                    //are enabled. "
569                    0x6: decode RS_HI {
570                        0x0: decode RS_LO {
571                            format Float64Op {
572                                0x0: addps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
573                                    //Lower Halves Independently but we take simulator shortcut
574                                    Fd.df = Fs.df + Ft.df;
575                                }});
576
577                                0x1: subps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
578                                    //Lower Halves Independently but we take simulator shortcut
579                                    Fd.df = Fs.df - Ft.df;
580                                }});
581
582                                0x2: mulps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
583                                    //Lower Halves Independently but we take simulator shortcut
584                                    Fd.df = Fs.df * Ft.df;
585                                }});
586
587                                0x5: absps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
588                                    //Lower Halves Independently but we take simulator shortcut
589                                    Fd.df = fabs(Fs.df);
590                                }});
591
592                                0x6: movps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
593                                    //Lower Halves Independently but we take simulator shortcut
594                                    //Fd.df = Fs<31:0> |  Ft<31:0>;
595                                }});
596
597                                0x7: negps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
598                                    //Lower Halves Independently but we take simulator shortcut
599                                    Fd.df = -1 * Fs.df;
600                                }});
601                            }
602                        }
603
604                        0x2: decode RS_LO {
605                            0x1: decode MOVCF {
606                                format Float64Op {
607                                    0x0: movfps({{if (xc->readMiscReg(FPCR) != CC) Fd = Fs;}});
608                                    0x1: movtps({{if (xc->readMiscReg(FPCR) == CC) Fd = Fs;}});
609                                }
610                            }
611
612                            format BasicOp {
613                                0x2: movzps({{if (xc->readMiscReg(FPCR) != CC) Fd = Fs; }});
614                                0x3: movnps({{if (xc->readMiscReg(FPCR) == CC) Fd = Fs; }});
615                            }
616
617                        }
618
619                        0x4: decode RS_LO {
620                            0x0: Float64Op::cvt_s_pu({{
621                                int rnd_mode = xc->readMiscReg(FCSR);
622                                Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_PS_HI);
623                            }});
624                        }
625
626                        0x5: decode RS_LO {
627                            format Float64Op {
628                                0x0: cvt_s_pl({{
629                                    int rnd_mode = xc->readMiscReg(FCSR);
630                                    Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_PS_LO);
631                                }});
632                                0x4: pll({{ /*Fd.df = Fs<31:0> | Ft<31:0>*/}});
633                                0x5: plu({{ /*Fd.df = Fs<31:0> | Ft<63:32>*/}});
634                                0x6: pul({{ /*Fd.df = Fs<63:32> | Ft<31:0>*/}});
635                                0x7: puu({{ /*Fd.df = Fs<63:32 | Ft<63:32>*/}});
636                            }
637                        }
638                    }
639                }
640            }
641        }
642
643        //Table A-19 MIPS32 COP2 Encoding of rs Field
644        0x2: decode RS_MSB {
645            0x0: decode RS_HI {
646                0x0: decode RS_LO {
647                    format WarnUnimpl {
648                        0x0: mfc2();
649                        0x2: cfc2();
650                        0x3: mfhc2();
651                        0x4: mtc2();
652                        0x6: ctc2();
653                        0x7: mftc2();
654                    }
655                }
656
657                0x1: decode ND {
658                    0x0: decode TF {
659                        format WarnUnimpl {
660                            0x0: bc2f();
661                            0x1: bc2t();
662                        }
663                    }
664
665                    0x1: decode TF {
666                        format WarnUnimpl {
667                            0x0: bc2fl();
668                            0x1: bc2tl();
669                        }
670                    }
671                }
672            }
673        }
674
675        //Table A-20 MIPS64 COP1X Encoding of Function Field 1
676        //Note: "COP1X instructions are legal only if 64-bit floating point
677        //operations are enabled."
678        0x3: decode FUNCTION_HI {
679            0x0: decode FUNCTION_LO {
680                format LoadMemory2 {
681                    0x0: lwxc1({{ EA = Rs + Rt; }},{{ /*F_t<31:0> = Mem.sf; */}});
682                    0x1: ldxc1({{ EA = Rs + Rt; }},{{ /*F_t<63:0> = Mem.df;*/ }});
683                    0x5: luxc1({{ //Need to make EA<2:0> = 0
684                        EA = Rs + Rt;
685                    }},
686                {{ /*F_t<31:0> = Mem.df; */}});
687                }
688            }
689
690            0x1: decode FUNCTION_LO {
691                format StoreMemory2 {
692                    0x0: swxc1({{ EA = Rs + Rt; }},{{ /*Mem.sf = Ft<31:0>; */}});
693                    0x1: sdxc1({{ EA = Rs + Rt; }},{{ /*Mem.df = Ft<63:0> */}});
694                    0x5: suxc1({{ //Need to make EA<2:0> = 0
695                        EA = Rs + Rt;
696                    }},
697                {{ /*Mem.df = F_t<63:0>;*/}});
698                }
699
700                0x7: WarnUnimpl::prefx();
701            }
702
703            format FloatOp {
704                0x3: WarnUnimpl::alnv_ps();
705
706                format BasicOp {
707                    0x4: decode FUNCTION_LO {
708                        0x0: madd_s({{ Fd.sf = (Fs.sf * Fs.sf) + Fr.sf; }});
709                        0x1: madd_d({{ Fd.df = (Fs.df * Fs.df) + Fr.df; }});
710                        0x6: madd_ps({{
711                            //Must Check for Exception Here... Supposed to Operate on Upper and
712                            //Lower Halves Independently but we take simulator shortcut
713                            Fd.df = (Fs.df * Fs.df) + Fr.df;
714                        }});
715                    }
716
717                    0x5: decode FUNCTION_LO {
718                        0x0: msub_s({{ Fd.sf = (Fs.sf * Fs.sf) - Fr.sf; }});
719                        0x1: msub_d({{ Fd.df = (Fs.df * Fs.df) - Fr.df; }});
720                        0x6: msub_ps({{
721                            //Must Check for Exception Here... Supposed to Operate on Upper and
722                            //Lower Halves Independently but we take simulator shortcut
723                            Fd.df = (Fs.df * Fs.df) - Fr.df;
724                        }});
725                    }
726
727                    0x6: decode FUNCTION_LO {
728                        0x0: nmadd_s({{ Fd.sf = (-1 * Fs.sf * Fs.sf) - Fr.sf; }});
729                        0x1: nmadd_d({{ Fd.df = (-1 * Fs.df * Fs.df) + Fr.df; }});
730                        0x6: nmadd_ps({{
731                            //Must Check for Exception Here... Supposed to Operate on Upper and
732                            //Lower Halves Independently but we take simulator shortcut
733                            Fd.df = (-1 * Fs.df * Fs.df) + Fr.df;
734                        }});
735                    }
736
737                    0x7: decode FUNCTION_LO {
738                        0x0: nmsub_s({{ Fd.sf = (-1 * Fs.sf * Fs.sf) - Fr.sf; }});
739                        0x1: nmsub_d({{ Fd.df = (-1 * Fs.df * Fs.df) - Fr.df; }});
740                        0x6: nmsub_ps({{
741                            //Must Check for Exception Here... Supposed to Operate on Upper and
742                            //Lower Halves Independently but we take simulator shortcut
743                            Fd.df = (-1 * Fs.df * Fs.df) + Fr.df;
744                        }});
745                    }
746                }
747            }
748        }
749
750        //MIPS obsolete instructions
751        format BranchLikely {
752            0x4: beql({{ cond = (Rs.sw == 0); }});
753            0x5: bnel({{ cond = (Rs.sw != 0); }});
754            0x6: blezl({{ cond = (Rs.sw <= 0); }});
755            0x7: bgtzl({{ cond = (Rs.sw > 0); }});
756        }
757    }
758
759    0x3: decode OPCODE_LO default FailUnimpl::reserved() {
760
761        //Table A-5 MIPS32 SPECIAL2 Encoding of Function Field
762        0x4: decode FUNCTION_HI {
763
764            0x0: decode FUNCTION_LO {
765                format IntOp {
766                    0x0: madd({{
767                        int64_t temp1 = xc->readMiscReg(Hi) << 32 | xc->readMiscReg(Lo) >> 32;
768                        temp1 = temp1 + (Rs.sw * Rt.sw);
769                        xc->setMiscReg(Hi,temp1<63:32>);
770                        xc->setMiscReg(Lo,temp1<31:0>);
771                            }});
772
773                    0x1: maddu({{
774                        int64_t temp1 = xc->readMiscReg(Hi) << 32 | xc->readMiscReg(Lo) >> 32;
775                        temp1 = temp1 + (Rs.uw * Rt.uw);
776                        xc->setMiscReg(Hi,temp1<63:32>);
777                        xc->setMiscReg(Lo,temp1<31:0>);
778                            }});
779
780                    0x2: mul({{ Rd.sw = Rs.sw * Rt.sw; 	}});
781
782                    0x4: msub({{
783                        int64_t temp1 = xc->readMiscReg(Hi) << 32 | xc->readMiscReg(Lo) >> 32;
784                        temp1 = temp1 - (Rs.sw * Rt.sw);
785                        xc->setMiscReg(Hi,temp1<63:32>);
786                        xc->setMiscReg(Lo,temp1<31:0>);
787                            }});
788
789                    0x5: msubu({{
790                        int64_t temp1 = xc->readMiscReg(Hi) << 32 | xc->readMiscReg(Lo) >> 32;
791                        temp1 = temp1 - (Rs.uw * Rt.uw);
792                        xc->setMiscReg(Hi,temp1<63:32>);
793                        xc->setMiscReg(Lo,temp1<31:0>);
794                            }});
795                }
796            }
797
798            0x4: decode FUNCTION_LO {
799                format BasicOp {
800                    0x0: clz({{
801                        /*int cnt = 0;
802                        int idx = 0;
803                        while ( Rs.uw<idx> != 1) {
804                            cnt++;
805                            idx--;
806                        }
807
808                        Rd.uw = cnt;*/
809                    }});
810
811                    0x1: clo({{
812                        /*int cnt = 0;
813                        int idx = 0;
814                        while ( Rs.uw<idx> != 0) {
815                            cnt++;
816                            idx--;
817                        }
818
819                        Rd.uw = cnt;*/
820                    }});
821                }
822            }
823
824            0x7: decode FUNCTION_LO {
825                0x7: WarnUnimpl::sdbbp();
826            }
827        }
828
829        //Table A-6 MIPS32 SPECIAL3 Encoding of Function Field for Release 2 of the Architecture
830        0x7: decode FUNCTION_HI {
831
832            0x0: decode FUNCTION_LO {
833                format WarnUnimpl {
834                    0x1: ext();
835                    0x4: ins();
836                }
837            }
838
839            0x1: decode FUNCTION_LO {
840                format WarnUnimpl {
841                    0x0: fork();
842                    0x1: yield();
843                }
844            }
845
846
847            //Table A-10 MIPS32 BSHFL Encoding of sa Field
848            0x4: decode SA {
849
850                0x02: WarnUnimpl::wsbh();
851
852                format BasicOp {
853                    0x10: seb({{ Rd.sw = /* sext32(Rt<7>,24)  | */ Rt<7:0>}});
854                    0x18: seh({{ Rd.sw = /* sext32(Rt<15>,16) | */ Rt<15:0>}});
855                }
856            }
857
858            0x6: decode FUNCTION_LO {
859                0x7: BasicOp::rdhwr({{ /*Rt = xc->hwRegs[RD];*/ }});
860            }
861        }
862    }
863
864    0x4: decode OPCODE_LO default FailUnimpl::reserved() {
865        format LoadMemory {
866            0x0: lb({{ Rt.sw = Mem.sb; }});
867            0x1: lh({{ Rt.sw = Mem.sh; }});
868            0x2: lwl({{ Rt.sw = Mem.sw; }});//, WordAlign);
869            0x3: lw({{ Rt.sw = Mem.sb; }});
870            0x4: lbu({{ Rt.uw = Mem.ub; }});
871            0x5: lhu({{ Rt.uw = Mem.uh; }});
872            0x6: lwr({{ Rt.uw = Mem.uw; }});//, WordAlign);
873        }
874
875        0x7: FailUnimpl::reserved();
876    }
877
878    0x5: decode OPCODE_LO default FailUnimpl::reserved() {
879        format StoreMemory {
880            0x0: sb({{ Mem.ub = Rt<7:0>; }});
881            0x1: sh({{ Mem.uh = Rt<15:0>; }});
882            0x2: swl({{ Mem.ub = Rt<31:0>; }});//,WordAlign);
883            0x3: sw({{ Mem.ub = Rt<31:0>; }});
884            0x6: swr({{ Mem.ub = Rt<31:0>; }});//,WordAlign);
885        }
886
887        format WarnUnimpl {
888            0x7: cache();
889        }
890
891    }
892
893    0x6: decode OPCODE_LO default FailUnimpl::reserved() {
894        0x0: WarnUnimpl::ll();
895
896        format LoadMemory {
897            0x1: lwc1({{ /*F_t<31:0> = Mem.sf; */}});
898            0x5: ldc1({{ /*F_t<63:0> = Mem.df; */}});
899        }
900    }
901
902
903    0x7: decode OPCODE_LO default FailUnimpl::reserved() {
904        0x0: WarnUnimpl::sc();
905
906        format StoreMemory {
907            0x1: swc1({{ //Mem.sf = Ft<31:0>; }});
908            0x5: sdc1({{ //Mem.df = Ft<63:0>; }});
909        }
910    }
911}
912
913
914