decoder.isa revision 9918
12686Sksewell@umich.edu// -*- mode:c++ -*-
22100SN/A
35254Sksewell@umich.edu// Copyright (c) 2007 MIPS Technologies, Inc.
45254Sksewell@umich.edu// All rights reserved.
55254Sksewell@umich.edu//
65254Sksewell@umich.edu// Redistribution and use in source and binary forms, with or without
75254Sksewell@umich.edu// modification, are permitted provided that the following conditions are
85254Sksewell@umich.edu// met: redistributions of source code must retain the above copyright
95254Sksewell@umich.edu// notice, this list of conditions and the following disclaimer;
105254Sksewell@umich.edu// redistributions in binary form must reproduce the above copyright
115254Sksewell@umich.edu// notice, this list of conditions and the following disclaimer in the
125254Sksewell@umich.edu// documentation and/or other materials provided with the distribution;
135254Sksewell@umich.edu// neither the name of the copyright holders nor the names of its
145254Sksewell@umich.edu// contributors may be used to endorse or promote products derived from
155254Sksewell@umich.edu// this software without specific prior written permission.
165254Sksewell@umich.edu//
175254Sksewell@umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
185254Sksewell@umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
195254Sksewell@umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
205254Sksewell@umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
215254Sksewell@umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
225254Sksewell@umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
235254Sksewell@umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
245254Sksewell@umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
255254Sksewell@umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
265254Sksewell@umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
275254Sksewell@umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
285254Sksewell@umich.edu//
295254Sksewell@umich.edu// Authors: Korey Sewell
305254Sksewell@umich.edu//          Brett Miller
315254Sksewell@umich.edu//          Jaidev Patwardhan
322706Sksewell@umich.edu
332022SN/A////////////////////////////////////////////////////////////////////
342022SN/A//
352043SN/A// The actual MIPS32 ISA decoder
362024SN/A// -----------------------------
372024SN/A// The following instructions are specified in the MIPS32 ISA
382043SN/A// Specification. Decoding closely follows the style specified
392686Sksewell@umich.edu// in the MIPS32 ISA specification document starting with Table
404661Sksewell@umich.edu// A-2 (document available @ http://www.mips.com)
412022SN/A//
422083SN/Adecode OPCODE_HI default Unknown::unknown() {
432686Sksewell@umich.edu    //Table A-2
442101SN/A    0x0: decode OPCODE_LO {
452043SN/A        0x0: decode FUNCTION_HI {
462043SN/A            0x0: decode FUNCTION_LO {
472101SN/A                0x1: decode MOVCI {
482101SN/A                    format BasicOp {
496384Sgblack@eecs.umich.edu                        0: movf({{
506384Sgblack@eecs.umich.edu                            Rd = (getCondCode(FCSR, CC) == 0) ? Rd : Rs;
516384Sgblack@eecs.umich.edu                        }});
526384Sgblack@eecs.umich.edu                        1: movt({{
536384Sgblack@eecs.umich.edu                            Rd = (getCondCode(FCSR, CC) == 1) ? Rd : Rs;
546384Sgblack@eecs.umich.edu                        }});
552101SN/A                    }
562101SN/A                }
572101SN/A
582046SN/A                format BasicOp {
592686Sksewell@umich.edu                    //Table A-3 Note: "Specific encodings of the rd, rs, and
602686Sksewell@umich.edu                    //rt fields are used to distinguish SLL, SSNOP, and EHB
612686Sksewell@umich.edu                    //functions
622470SN/A                    0x0: decode RS  {
632686Sksewell@umich.edu                        0x0: decode RT_RD {
644661Sksewell@umich.edu                            0x0: decode SA default Nop::nop() {
655222Sksewell@umich.edu                                 0x1: ssnop({{;}});
665222Sksewell@umich.edu                                 0x3: ehb({{;}});
672686Sksewell@umich.edu                            }
688588Sgblack@eecs.umich.edu                            default: sll({{ Rd = Rt_uw << SA; }});
692470SN/A                        }
702241SN/A                    }
712101SN/A
722495SN/A                    0x2: decode RS_SRL {
732495SN/A                        0x0:decode SRL {
748588Sgblack@eecs.umich.edu                            0: srl({{ Rd = Rt_uw >> SA; }});
752101SN/A
766384Sgblack@eecs.umich.edu                            //Hardcoded assuming 32-bit ISA,
776384Sgblack@eecs.umich.edu                            //probably need parameter here
786384Sgblack@eecs.umich.edu                            1: rotr({{
798588Sgblack@eecs.umich.edu                                Rd = (Rt_uw << (32 - SA)) | (Rt_uw >> SA);
806384Sgblack@eecs.umich.edu                            }});
812495SN/A                        }
822101SN/A                    }
832101SN/A
842495SN/A                    0x3: decode RS {
852495SN/A                        0x0: sra({{
862495SN/A                            uint32_t temp = Rt >> SA;
872495SN/A                            if ( (Rt & 0x80000000) > 0 ) {
882495SN/A                                uint32_t mask = 0x80000000;
892495SN/A                                for(int i=0; i < SA; i++) {
902495SN/A                                    temp |= mask;
912495SN/A                                    mask = mask >> 1;
922495SN/A                                }
932495SN/A                            }
942495SN/A                            Rd = temp;
952495SN/A                        }});
962495SN/A                    }
972101SN/A
988588Sgblack@eecs.umich.edu                    0x4: sllv({{ Rd = Rt_uw << Rs<4:0>; }});
992101SN/A
1002101SN/A                    0x6: decode SRLV {
1018588Sgblack@eecs.umich.edu                        0: srlv({{ Rd = Rt_uw >> Rs<4:0>; }});
1022101SN/A
1036384Sgblack@eecs.umich.edu                        //Hardcoded assuming 32-bit ISA,
1046384Sgblack@eecs.umich.edu                        //probably need parameter here
1056384Sgblack@eecs.umich.edu                        1: rotrv({{
1068588Sgblack@eecs.umich.edu                            Rd = (Rt_uw << (32 - Rs<4:0>)) |
1078588Sgblack@eecs.umich.edu                                 (Rt_uw >> Rs<4:0>);
1086384Sgblack@eecs.umich.edu                        }});
1092101SN/A                    }
1102101SN/A
1112495SN/A                    0x7: srav({{
1122495SN/A                        int shift_amt = Rs<4:0>;
1132495SN/A
1142495SN/A                        uint32_t temp = Rt >> shift_amt;
1152495SN/A
1166384Sgblack@eecs.umich.edu                        if ((Rt & 0x80000000) > 0) {
1176384Sgblack@eecs.umich.edu                            uint32_t mask = 0x80000000;
1186384Sgblack@eecs.umich.edu                            for (int i = 0; i < shift_amt; i++) {
1196384Sgblack@eecs.umich.edu                                temp |= mask;
1206384Sgblack@eecs.umich.edu                                mask = mask >> 1;
1212495SN/A                            }
1226384Sgblack@eecs.umich.edu                        }
1232495SN/A                        Rd = temp;
1242495SN/A                    }});
1252043SN/A                }
1262043SN/A            }
1272025SN/A
1282043SN/A            0x1: decode FUNCTION_LO {
1292686Sksewell@umich.edu                //Table A-3 Note: "Specific encodings of the hint field are
1302686Sksewell@umich.edu                //used to distinguish JR from JR.HB and JALR from JALR.HB"
1312123SN/A                format Jump {
1322101SN/A                    0x0: decode HINT {
1336376Sgblack@eecs.umich.edu                        0x1: jr_hb({{
1346376Sgblack@eecs.umich.edu                            Config1Reg config1 = Config1;
1356376Sgblack@eecs.umich.edu                            if (config1.ca == 0) {
1367792Sgblack@eecs.umich.edu                                NNPC = Rs;
1376376Sgblack@eecs.umich.edu                            } else {
1386376Sgblack@eecs.umich.edu                                panic("MIPS16e not supported\n");
1396376Sgblack@eecs.umich.edu                            }
1406376Sgblack@eecs.umich.edu                        }}, IsReturn, ClearHazards);
1416376Sgblack@eecs.umich.edu                        default: jr({{
1426376Sgblack@eecs.umich.edu                            Config1Reg config1 = Config1;
1436376Sgblack@eecs.umich.edu                            if (config1.ca == 0) {
1447792Sgblack@eecs.umich.edu                                NNPC = Rs;
1456376Sgblack@eecs.umich.edu                            } else {
1466376Sgblack@eecs.umich.edu                                panic("MIPS16e not supported\n");
1476376Sgblack@eecs.umich.edu                            }
1486376Sgblack@eecs.umich.edu                        }}, IsReturn);
1492101SN/A                    }
1502042SN/A
1512101SN/A                    0x1: decode HINT {
1527720Sgblack@eecs.umich.edu                        0x1: jalr_hb({{
1537792Sgblack@eecs.umich.edu                            Rd = NNPC;
1547792Sgblack@eecs.umich.edu                            NNPC = Rs;
1557720Sgblack@eecs.umich.edu                        }}, IsCall, ClearHazards);
1567720Sgblack@eecs.umich.edu                        default: jalr({{
1577792Sgblack@eecs.umich.edu                            Rd = NNPC;
1587792Sgblack@eecs.umich.edu                            NNPC = Rs;
1597720Sgblack@eecs.umich.edu                        }}, IsCall);
1602101SN/A                    }
1612101SN/A                }
1622042SN/A
1632101SN/A                format BasicOp {
1642686Sksewell@umich.edu                    0x2: movz({{ Rd = (Rt == 0) ? Rs : Rd; }});
1652686Sksewell@umich.edu                    0x3: movn({{ Rd = (Rt != 0) ? Rs : Rd; }});
1668901Sandreas.hansson@arm.com                    0x4: decode FullSystemInt {
1678564Sgblack@eecs.umich.edu                        0: syscall_se({{ xc->syscall(R2); }},
1688564Sgblack@eecs.umich.edu                                IsSerializeAfter, IsNonSpeculative);
1698564Sgblack@eecs.umich.edu                        default: syscall({{ fault = new SystemCallFault(); }});
1708564Sgblack@eecs.umich.edu                    }
1712686Sksewell@umich.edu                    0x7: sync({{ ; }}, IsMemBarrier);
1725222Sksewell@umich.edu                    0x5: break({{fault = new BreakpointFault();}});
1732101SN/A                }
1742083SN/A
1752043SN/A            }
1762025SN/A
1772043SN/A            0x2: decode FUNCTION_LO {
1786384Sgblack@eecs.umich.edu                0x0: HiLoRsSelOp::mfhi({{ Rd = HI_RS_SEL; }},
1796384Sgblack@eecs.umich.edu                             IntMultOp, IsIprAccess);
1804661Sksewell@umich.edu                0x1: HiLoRdSelOp::mthi({{ HI_RD_SEL = Rs; }});
1816384Sgblack@eecs.umich.edu                0x2: HiLoRsSelOp::mflo({{ Rd = LO_RS_SEL; }},
1826384Sgblack@eecs.umich.edu                             IntMultOp, IsIprAccess);
1834661Sksewell@umich.edu                0x3: HiLoRdSelOp::mtlo({{ LO_RD_SEL = Rs; }});
1842083SN/A            }
1852025SN/A
1862043SN/A            0x3: decode FUNCTION_LO {
1874661Sksewell@umich.edu                format HiLoRdSelValOp {
1888588Sgblack@eecs.umich.edu                    0x0: mult({{ val = Rs_sd * Rt_sd; }}, IntMultOp);
1898588Sgblack@eecs.umich.edu                    0x1: multu({{ val = Rs_ud * Rt_ud; }}, IntMultOp);
1904661Sksewell@umich.edu                }
1914661Sksewell@umich.edu
1922686Sksewell@umich.edu                format HiLoOp {
1936384Sgblack@eecs.umich.edu                    0x2: div({{
1948588Sgblack@eecs.umich.edu                        if (Rt_sd != 0) {
1958588Sgblack@eecs.umich.edu                            HI0 = Rs_sd % Rt_sd;
1968588Sgblack@eecs.umich.edu                            LO0 = Rs_sd / Rt_sd;
1976384Sgblack@eecs.umich.edu                        }
1985222Sksewell@umich.edu                    }}, IntDivOp);
1995222Sksewell@umich.edu
2006384Sgblack@eecs.umich.edu                    0x3: divu({{
2018588Sgblack@eecs.umich.edu                        if (Rt_ud != 0) {
2028588Sgblack@eecs.umich.edu                            HI0 = Rs_ud % Rt_ud;
2038588Sgblack@eecs.umich.edu                            LO0 = Rs_ud / Rt_ud;
2046384Sgblack@eecs.umich.edu                        }
2055222Sksewell@umich.edu                    }}, IntDivOp);
2062101SN/A                }
2072084SN/A            }
2082025SN/A
2092495SN/A            0x4: decode HINT {
2102495SN/A                0x0: decode FUNCTION_LO {
2112495SN/A                    format IntOp {
2126384Sgblack@eecs.umich.edu                        0x0: add({{
2138564Sgblack@eecs.umich.edu                            IntReg result;
2148564Sgblack@eecs.umich.edu                            Rd = result = Rs + Rt;
2158738Sgblack@eecs.umich.edu                            if (FullSystem &&
2168564Sgblack@eecs.umich.edu                                    findOverflow(32, result, Rs, Rt)) {
2178568Sgblack@eecs.umich.edu                                fault = new IntegerOverflowFault();
2186384Sgblack@eecs.umich.edu                            }
2196384Sgblack@eecs.umich.edu                        }});
2208588Sgblack@eecs.umich.edu                        0x1: addu({{ Rd_sw = Rs_sw + Rt_sw;}});
2215222Sksewell@umich.edu                        0x2: sub({{
2228564Sgblack@eecs.umich.edu                            IntReg result;
2238564Sgblack@eecs.umich.edu                            Rd = result = Rs - Rt;
2248738Sgblack@eecs.umich.edu                            if (FullSystem &&
2258564Sgblack@eecs.umich.edu                                    findOverflow(32, result, Rs, ~Rt)) {
2268568Sgblack@eecs.umich.edu                                fault = new IntegerOverflowFault();
2276384Sgblack@eecs.umich.edu                            }
2286384Sgblack@eecs.umich.edu                        }});
2298588Sgblack@eecs.umich.edu                        0x3: subu({{ Rd_sw = Rs_sw - Rt_sw; }});
2306384Sgblack@eecs.umich.edu                        0x4: and({{ Rd = Rs & Rt; }});
2316384Sgblack@eecs.umich.edu                        0x5: or({{ Rd = Rs | Rt; }});
2326384Sgblack@eecs.umich.edu                        0x6: xor({{ Rd = Rs ^ Rt; }});
2336384Sgblack@eecs.umich.edu                        0x7: nor({{ Rd = ~(Rs | Rt); }});
2342495SN/A                    }
2352101SN/A                }
2362043SN/A            }
2372025SN/A
2382495SN/A            0x5: decode HINT {
2392495SN/A                0x0: decode FUNCTION_LO {
2402495SN/A                    format IntOp{
2418588Sgblack@eecs.umich.edu                        0x2: slt({{  Rd_sw = (Rs_sw < Rt_sw) ? 1 : 0 }});
2428588Sgblack@eecs.umich.edu                        0x3: sltu({{ Rd_uw = (Rs_uw < Rt_uw) ? 1 : 0 }});
2432495SN/A                    }
2442101SN/A                }
2452084SN/A            }
2462024SN/A
2472043SN/A            0x6: decode FUNCTION_LO {
2482239SN/A                format Trap {
2498588Sgblack@eecs.umich.edu                    0x0: tge({{  cond = (Rs_sw >= Rt_sw); }});
2508588Sgblack@eecs.umich.edu                    0x1: tgeu({{ cond = (Rs_uw >= Rt_uw); }});
2518588Sgblack@eecs.umich.edu                    0x2: tlt({{ cond = (Rs_sw < Rt_sw); }});
2528588Sgblack@eecs.umich.edu                    0x3: tltu({{ cond = (Rs_uw < Rt_uw); }});
2538588Sgblack@eecs.umich.edu                    0x4: teq({{ cond = (Rs_sw == Rt_sw); }});
2548588Sgblack@eecs.umich.edu                    0x6: tne({{ cond = (Rs_sw != Rt_sw); }});
2552101SN/A                }
2562043SN/A            }
2572043SN/A        }
2582025SN/A
2592043SN/A        0x1: decode REGIMM_HI {
2602043SN/A            0x0: decode REGIMM_LO {
2612101SN/A                format Branch {
2628588Sgblack@eecs.umich.edu                    0x0: bltz({{ cond = (Rs_sw < 0); }});
2638588Sgblack@eecs.umich.edu                    0x1: bgez({{ cond = (Rs_sw >= 0); }});
2648588Sgblack@eecs.umich.edu                    0x2: bltzl({{ cond = (Rs_sw < 0); }}, Likely);
2658588Sgblack@eecs.umich.edu                    0x3: bgezl({{ cond = (Rs_sw >= 0); }}, Likely);
2662101SN/A                }
2672043SN/A            }
2682025SN/A
2692043SN/A            0x1: decode REGIMM_LO {
2705222Sksewell@umich.edu                format TrapImm {
2718588Sgblack@eecs.umich.edu                    0x0: tgei( {{ cond = (Rs_sw >= (int16_t)INTIMM); }});
2726384Sgblack@eecs.umich.edu                    0x1: tgeiu({{
2738588Sgblack@eecs.umich.edu                        cond = (Rs_uw >= (uint32_t)(int32_t)(int16_t)INTIMM);
2746384Sgblack@eecs.umich.edu                    }});
2758588Sgblack@eecs.umich.edu                    0x2: tlti( {{ cond = (Rs_sw < (int16_t)INTIMM); }});
2766384Sgblack@eecs.umich.edu                    0x3: tltiu({{
2778588Sgblack@eecs.umich.edu                        cond = (Rs_uw < (uint32_t)(int32_t)(int16_t)INTIMM);
2786384Sgblack@eecs.umich.edu                    }});
2798588Sgblack@eecs.umich.edu                    0x4: teqi( {{ cond = (Rs_sw == (int16_t)INTIMM); }});
2808588Sgblack@eecs.umich.edu                    0x6: tnei( {{ cond = (Rs_sw != (int16_t)INTIMM); }});
2812101SN/A                }
2822043SN/A            }
2832043SN/A
2842043SN/A            0x2: decode REGIMM_LO {
2852101SN/A                format Branch {
2868588Sgblack@eecs.umich.edu                    0x0: bltzal({{ cond = (Rs_sw < 0); }}, Link);
2872686Sksewell@umich.edu                    0x1: decode RS {
2882686Sksewell@umich.edu                        0x0: bal ({{ cond = 1; }}, IsCall, Link);
2898588Sgblack@eecs.umich.edu                        default: bgezal({{ cond = (Rs_sw >= 0); }}, Link);
2902686Sksewell@umich.edu                    }
2918588Sgblack@eecs.umich.edu                    0x2: bltzall({{ cond = (Rs_sw < 0); }}, Link, Likely);
2928588Sgblack@eecs.umich.edu                    0x3: bgezall({{ cond = (Rs_sw >= 0); }}, Link, Likely);
2932101SN/A                }
2942043SN/A            }
2952043SN/A
2962043SN/A            0x3: decode REGIMM_LO {
2976384Sgblack@eecs.umich.edu                // from Table 5-4 MIPS32 REGIMM Encoding of rt Field
2986384Sgblack@eecs.umich.edu                // (DSP ASE MANUAL)
2994661Sksewell@umich.edu                0x4: DspBranch::bposge32({{ cond = (dspctl<5:0> >= 32); }});
3002101SN/A                format WarnUnimpl {
3012101SN/A                    0x7: synci();
3022101SN/A                }
3032043SN/A            }
3042043SN/A        }
3052043SN/A
3062123SN/A        format Jump {
3077792Sgblack@eecs.umich.edu            0x2: j({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }});
3087792Sgblack@eecs.umich.edu            0x3: jal({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }},
3097792Sgblack@eecs.umich.edu                     IsCall, Link);
3102043SN/A        }
3112043SN/A
3122100SN/A        format Branch {
3132686Sksewell@umich.edu            0x4: decode RS_RT  {
3142686Sksewell@umich.edu                0x0: b({{ cond = 1; }});
3158588Sgblack@eecs.umich.edu                default: beq({{ cond = (Rs_sw == Rt_sw); }});
3162686Sksewell@umich.edu            }
3178588Sgblack@eecs.umich.edu            0x5: bne({{ cond = (Rs_sw != Rt_sw); }});
3188588Sgblack@eecs.umich.edu            0x6: blez({{ cond = (Rs_sw <= 0); }});
3198588Sgblack@eecs.umich.edu            0x7: bgtz({{ cond = (Rs_sw > 0); }});
3202043SN/A        }
3212084SN/A    }
3222024SN/A
3232101SN/A    0x1: decode OPCODE_LO {
3242686Sksewell@umich.edu        format IntImmOp {
3255222Sksewell@umich.edu            0x0: addi({{
3268564Sgblack@eecs.umich.edu                IntReg result;
3278564Sgblack@eecs.umich.edu                Rt = result = Rs + imm;
3288738Sgblack@eecs.umich.edu                if (FullSystem &&
3298564Sgblack@eecs.umich.edu                        findOverflow(32, result, Rs, imm)) {
3308568Sgblack@eecs.umich.edu                    fault = new IntegerOverflowFault();
3316384Sgblack@eecs.umich.edu                }
3326384Sgblack@eecs.umich.edu            }});
3338588Sgblack@eecs.umich.edu            0x1: addiu({{ Rt_sw = Rs_sw + imm; }});
3348588Sgblack@eecs.umich.edu            0x2: slti({{ Rt_sw = (Rs_sw < imm) ? 1 : 0 }});
3358588Sgblack@eecs.umich.edu            0x3: sltiu({{ Rt_uw = (Rs_uw < (uint32_t)sextImm) ? 1 : 0;}});
3368588Sgblack@eecs.umich.edu            0x4: andi({{ Rt_sw = Rs_sw & zextImm; }});
3378588Sgblack@eecs.umich.edu            0x5: ori({{ Rt_sw = Rs_sw | zextImm; }});
3388588Sgblack@eecs.umich.edu            0x6: xori({{ Rt_sw = Rs_sw ^ zextImm; }});
3392495SN/A
3402495SN/A            0x7: decode RS {
3416384Sgblack@eecs.umich.edu                0x0: lui({{ Rt = imm << 16; }});
3422495SN/A            }
3432084SN/A        }
3442084SN/A    }
3452024SN/A
3462101SN/A    0x2: decode OPCODE_LO {
3472101SN/A        //Table A-11 MIPS32 COP0 Encoding of rs Field
3482101SN/A        0x0: decode RS_MSB {
3492101SN/A            0x0: decode RS {
3506384Sgblack@eecs.umich.edu                format CP0Control {
3516384Sgblack@eecs.umich.edu                    0x0: mfc0({{
3526384Sgblack@eecs.umich.edu                        Config3Reg config3 = Config3;
3536384Sgblack@eecs.umich.edu                        PageGrainReg pageGrain = PageGrain;
3546384Sgblack@eecs.umich.edu                        Rt = CP0_RD_SEL;
3556384Sgblack@eecs.umich.edu                        /* Hack for PageMask */
3566384Sgblack@eecs.umich.edu                        if (RD == 5) {
3576384Sgblack@eecs.umich.edu                            // PageMask
3586384Sgblack@eecs.umich.edu                            if (config3.sp == 0 || pageGrain.esp == 0)
3596384Sgblack@eecs.umich.edu                                Rt &= 0xFFFFE7FF;
3606384Sgblack@eecs.umich.edu                        }
3616384Sgblack@eecs.umich.edu                    }});
3626384Sgblack@eecs.umich.edu                    0x4: mtc0({{ 
3636384Sgblack@eecs.umich.edu                        CP0_RD_SEL = Rt;
3646384Sgblack@eecs.umich.edu                        CauseReg cause = Cause;
3656384Sgblack@eecs.umich.edu                        IntCtlReg intCtl = IntCtl;
3666384Sgblack@eecs.umich.edu                        if (RD == 11) {
3676384Sgblack@eecs.umich.edu                            // Compare
3686384Sgblack@eecs.umich.edu                            if (cause.ti == 1) {
3696384Sgblack@eecs.umich.edu                                cause.ti = 0;
3706384Sgblack@eecs.umich.edu                                int offset = 10; // corresponding to cause.ip0
3716384Sgblack@eecs.umich.edu                                offset += intCtl.ipti - 2;
3726384Sgblack@eecs.umich.edu                                replaceBits(cause, offset, offset, 0);
3736384Sgblack@eecs.umich.edu                            }
3746384Sgblack@eecs.umich.edu                        }
3756384Sgblack@eecs.umich.edu                        Cause = cause;
3766384Sgblack@eecs.umich.edu                    }});
3776384Sgblack@eecs.umich.edu                }
3786384Sgblack@eecs.umich.edu                format CP0Unimpl {
3796384Sgblack@eecs.umich.edu                    0x1: dmfc0();
3806384Sgblack@eecs.umich.edu                    0x5: dmtc0();
3816384Sgblack@eecs.umich.edu                    default: unknown();
3826384Sgblack@eecs.umich.edu                }
3836384Sgblack@eecs.umich.edu                format MT_MFTR {
3846384Sgblack@eecs.umich.edu                    // Decode MIPS MT MFTR instruction into sub-instructions
3854661Sksewell@umich.edu                    0x8: decode MT_U {
3866376Sgblack@eecs.umich.edu                        0x0: mftc0({{
3876376Sgblack@eecs.umich.edu                            data = xc->readRegOtherThread((RT << 3 | SEL) +
3889918Ssteve.reinhardt@amd.com                                                          Misc_Reg_Base);
3896376Sgblack@eecs.umich.edu                        }});
3904661Sksewell@umich.edu                        0x1: decode SEL {
3916384Sgblack@eecs.umich.edu                            0x0: mftgpr({{
3926384Sgblack@eecs.umich.edu                                data = xc->readRegOtherThread(RT);
3936384Sgblack@eecs.umich.edu                            }});
3944661Sksewell@umich.edu                            0x1: decode RT {
3956383Sgblack@eecs.umich.edu                                0x0: mftlo_dsp0({{ data = xc->readRegOtherThread(INTREG_DSP_LO0); }});
3966383Sgblack@eecs.umich.edu                                0x1: mfthi_dsp0({{ data = xc->readRegOtherThread(INTREG_DSP_HI0); }});
3976383Sgblack@eecs.umich.edu                                0x2: mftacx_dsp0({{ data = xc->readRegOtherThread(INTREG_DSP_ACX0); }});
3986383Sgblack@eecs.umich.edu                                0x4: mftlo_dsp1({{ data = xc->readRegOtherThread(INTREG_DSP_LO1); }});
3996383Sgblack@eecs.umich.edu                                0x5: mfthi_dsp1({{ data = xc->readRegOtherThread(INTREG_DSP_HI1); }});
4006383Sgblack@eecs.umich.edu                                0x6: mftacx_dsp1({{ data = xc->readRegOtherThread(INTREG_DSP_ACX1); }});
4016383Sgblack@eecs.umich.edu                                0x8: mftlo_dsp2({{ data = xc->readRegOtherThread(INTREG_DSP_LO2); }});
4026383Sgblack@eecs.umich.edu                                0x9: mfthi_dsp2({{ data = xc->readRegOtherThread(INTREG_DSP_HI2); }});
4036383Sgblack@eecs.umich.edu                                0x10: mftacx_dsp2({{ data = xc->readRegOtherThread(INTREG_DSP_ACX2); }});
4046383Sgblack@eecs.umich.edu                                0x12: mftlo_dsp3({{ data = xc->readRegOtherThread(INTREG_DSP_LO3); }});
4056383Sgblack@eecs.umich.edu                                0x13: mfthi_dsp3({{ data = xc->readRegOtherThread(INTREG_DSP_HI3); }});
4066383Sgblack@eecs.umich.edu                                0x14: mftacx_dsp3({{ data = xc->readRegOtherThread(INTREG_DSP_ACX3); }});
4076383Sgblack@eecs.umich.edu                                0x16: mftdsp({{ data = xc->readRegOtherThread(INTREG_DSP_CONTROL); }});
4086384Sgblack@eecs.umich.edu                                default: CP0Unimpl::unknown();
4092686Sksewell@umich.edu                            }
4104661Sksewell@umich.edu                            0x2: decode MT_H {
4114661Sksewell@umich.edu                                0x0: mftc1({{ data = xc->readRegOtherThread(RT +
4129918Ssteve.reinhardt@amd.com                                                                            FP_Reg_Base);
4136384Sgblack@eecs.umich.edu                                }});
4144661Sksewell@umich.edu                                0x1: mfthc1({{ data = xc->readRegOtherThread(RT +
4159918Ssteve.reinhardt@amd.com                                                                             FP_Reg_Base);
4166384Sgblack@eecs.umich.edu                                }});
4176384Sgblack@eecs.umich.edu                            }
4186384Sgblack@eecs.umich.edu                            0x3: cftc1({{
4196384Sgblack@eecs.umich.edu                                uint32_t fcsr_val = xc->readRegOtherThread(FLOATREG_FCSR +
4209918Ssteve.reinhardt@amd.com                                                                            FP_Reg_Base);
4216384Sgblack@eecs.umich.edu                                switch (RT) {
4226384Sgblack@eecs.umich.edu                                  case 0:
4236384Sgblack@eecs.umich.edu                                    data = xc->readRegOtherThread(FLOATREG_FIR +
4249918Ssteve.reinhardt@amd.com                                                                  Misc_Reg_Base);
4256384Sgblack@eecs.umich.edu                                    break;
4266384Sgblack@eecs.umich.edu                                  case 25:
4276384Sgblack@eecs.umich.edu                                    data = (fcsr_val & 0xFE000000 >> 24) |
4286384Sgblack@eecs.umich.edu                                           (fcsr_val & 0x00800000 >> 23);
4296384Sgblack@eecs.umich.edu                                    break;
4306384Sgblack@eecs.umich.edu                                  case 26:
4316384Sgblack@eecs.umich.edu                                    data = fcsr_val & 0x0003F07C;
4326384Sgblack@eecs.umich.edu                                    break;
4336384Sgblack@eecs.umich.edu                                  case 28:
4346384Sgblack@eecs.umich.edu                                    data = (fcsr_val & 0x00000F80) |
4356384Sgblack@eecs.umich.edu                                           (fcsr_val & 0x01000000 >> 21) |
4366384Sgblack@eecs.umich.edu                                           (fcsr_val & 0x00000003);
4376384Sgblack@eecs.umich.edu                                    break;
4386384Sgblack@eecs.umich.edu                                  case 31:
4396384Sgblack@eecs.umich.edu                                    data = fcsr_val;
4406384Sgblack@eecs.umich.edu                                    break;
4416384Sgblack@eecs.umich.edu                                  default:
4426384Sgblack@eecs.umich.edu                                    fatal("FP Control Value (%d) Not Valid");
4436384Sgblack@eecs.umich.edu                                }
4446384Sgblack@eecs.umich.edu                            }});
4456384Sgblack@eecs.umich.edu                            default: CP0Unimpl::unknown();
4462101SN/A                        }
4476384Sgblack@eecs.umich.edu                    }
4482686Sksewell@umich.edu                }
4492027SN/A
4506384Sgblack@eecs.umich.edu                format MT_MTTR {
4516384Sgblack@eecs.umich.edu                    // Decode MIPS MT MTTR instruction into sub-instructions
4524661Sksewell@umich.edu                    0xC: decode MT_U {
4539918Ssteve.reinhardt@amd.com                        0x0: mttc0({{ xc->setRegOtherThread((RD << 3 | SEL) + Misc_Reg_Base,
4544661Sksewell@umich.edu                                                            Rt);
4554661Sksewell@umich.edu                                   }});
4564661Sksewell@umich.edu                        0x1: decode SEL {
4574661Sksewell@umich.edu                            0x0: mttgpr({{ xc->setRegOtherThread(RD, Rt); }});
4584661Sksewell@umich.edu                            0x1: decode RT {
4596383Sgblack@eecs.umich.edu                                0x0: mttlo_dsp0({{ xc->setRegOtherThread(INTREG_DSP_LO0, Rt);
4604661Sksewell@umich.edu                                                }});
4616383Sgblack@eecs.umich.edu                                0x1: mtthi_dsp0({{ xc->setRegOtherThread(INTREG_DSP_HI0,
4624661Sksewell@umich.edu                                                                         Rt);
4634661Sksewell@umich.edu                                                }});
4646383Sgblack@eecs.umich.edu                                0x2: mttacx_dsp0({{ xc->setRegOtherThread(INTREG_DSP_ACX0,
4654661Sksewell@umich.edu                                                                          Rt);
4664661Sksewell@umich.edu                                                 }});
4676383Sgblack@eecs.umich.edu                                0x4: mttlo_dsp1({{ xc->setRegOtherThread(INTREG_DSP_LO1,
4684661Sksewell@umich.edu                                                                         Rt);
4694661Sksewell@umich.edu                                                }});
4706383Sgblack@eecs.umich.edu                                0x5: mtthi_dsp1({{ xc->setRegOtherThread(INTREG_DSP_HI1,
4714661Sksewell@umich.edu                                                                         Rt);
4724661Sksewell@umich.edu                                                }});
4736383Sgblack@eecs.umich.edu                                0x6: mttacx_dsp1({{ xc->setRegOtherThread(INTREG_DSP_ACX1,
4744661Sksewell@umich.edu                                                                          Rt);
4754661Sksewell@umich.edu                                                 }});
4766383Sgblack@eecs.umich.edu                                0x8: mttlo_dsp2({{ xc->setRegOtherThread(INTREG_DSP_LO2,
4774661Sksewell@umich.edu                                                                         Rt);
4784661Sksewell@umich.edu                                                }});
4796383Sgblack@eecs.umich.edu                                0x9: mtthi_dsp2({{ xc->setRegOtherThread(INTREG_DSP_HI2,
4804661Sksewell@umich.edu                                                                         Rt);
4814661Sksewell@umich.edu                                                }});
4826383Sgblack@eecs.umich.edu                                0x10: mttacx_dsp2({{ xc->setRegOtherThread(INTREG_DSP_ACX2,
4834661Sksewell@umich.edu                                                                           Rt);
4844661Sksewell@umich.edu                                                  }});
4856383Sgblack@eecs.umich.edu                                0x12: mttlo_dsp3({{ xc->setRegOtherThread(INTREG_DSP_LO3,
4864661Sksewell@umich.edu                                                                          Rt);
4874661Sksewell@umich.edu                                                 }});
4886383Sgblack@eecs.umich.edu                                0x13: mtthi_dsp3({{ xc->setRegOtherThread(INTREG_DSP_HI3,
4894661Sksewell@umich.edu                                                                          Rt);
4904661Sksewell@umich.edu                                                 }});
4916383Sgblack@eecs.umich.edu                                0x14: mttacx_dsp3({{ xc->setRegOtherThread(INTREG_DSP_ACX3, Rt);
4924661Sksewell@umich.edu                                                  }});
4936383Sgblack@eecs.umich.edu                                0x16: mttdsp({{ xc->setRegOtherThread(INTREG_DSP_CONTROL, Rt); }});
4946384Sgblack@eecs.umich.edu                                default: CP0Unimpl::unknown();
4955222Sksewell@umich.edu
4964661Sksewell@umich.edu                            }
4976384Sgblack@eecs.umich.edu                            0x2: mttc1({{
4986384Sgblack@eecs.umich.edu                                uint64_t data = xc->readRegOtherThread(RD +
4999918Ssteve.reinhardt@amd.com                                                                       FP_Reg_Base);
5008607Sgblack@eecs.umich.edu                                data = insertBits(data, MT_H ? 63 : 31,
5018607Sgblack@eecs.umich.edu                                                  MT_H ? 32 : 0, Rt);
5029918Ssteve.reinhardt@amd.com                                xc->setRegOtherThread(RD + FP_Reg_Base,
5036384Sgblack@eecs.umich.edu                                                      data);
5046384Sgblack@eecs.umich.edu                            }});
5056384Sgblack@eecs.umich.edu                            0x3: cttc1({{
5066384Sgblack@eecs.umich.edu                                uint32_t data;
5076384Sgblack@eecs.umich.edu                                switch (RD) {
5086384Sgblack@eecs.umich.edu                                  case 25:
5098588Sgblack@eecs.umich.edu                                    data = (Rt_uw<7:1> << 25) |  // move 31-25
5106384Sgblack@eecs.umich.edu                                           (FCSR & 0x01000000) | // bit 24
5116384Sgblack@eecs.umich.edu                                           (FCSR & 0x004FFFFF);  // bit 22-0
5126384Sgblack@eecs.umich.edu                                    break;
5136384Sgblack@eecs.umich.edu                                  case 26:
5146384Sgblack@eecs.umich.edu                                    data = (FCSR & 0xFFFC0000) | // move 31-18
5158588Sgblack@eecs.umich.edu                                           Rt_uw<17:12> << 12 |  // bit 17-12
5166384Sgblack@eecs.umich.edu                                           (FCSR & 0x00000F80) << 7 | // bit 11-7
5178588Sgblack@eecs.umich.edu                                           Rt_uw<6:2> << 2 |     // bit 6-2
5186384Sgblack@eecs.umich.edu                                           (FCSR & 0x00000002);  // bit 1...0
5196384Sgblack@eecs.umich.edu                                    break;
5206384Sgblack@eecs.umich.edu                                  case 28:
5216384Sgblack@eecs.umich.edu                                    data = (FCSR & 0xFE000000) | // move 31-25
5228588Sgblack@eecs.umich.edu                                           Rt_uw<2:2> << 24 |    // bit 24
5236384Sgblack@eecs.umich.edu                                           (FCSR & 0x00FFF000) << 23 | // bit 23-12
5248588Sgblack@eecs.umich.edu                                           Rt_uw<11:7> << 7 |    // bit 24
5256384Sgblack@eecs.umich.edu                                           (FCSR & 0x000007E) |
5268588Sgblack@eecs.umich.edu                                           Rt_uw<1:0>;           // bit 22-0
5276384Sgblack@eecs.umich.edu                                    break;
5286384Sgblack@eecs.umich.edu                                  case 31:
5298588Sgblack@eecs.umich.edu                                    data = Rt_uw;
5306384Sgblack@eecs.umich.edu                                    break;
5316384Sgblack@eecs.umich.edu                                  default:
5326384Sgblack@eecs.umich.edu                                    panic("FP Control Value (%d) "
5336384Sgblack@eecs.umich.edu                                            "Not Available. Ignoring "
5346384Sgblack@eecs.umich.edu                                            "Access to Floating Control "
5358607Sgblack@eecs.umich.edu                                            "S""tatus Register", FS);
5366384Sgblack@eecs.umich.edu                                }
5379918Ssteve.reinhardt@amd.com                                xc->setRegOtherThread(FLOATREG_FCSR + FP_Reg_Base, data);
5386384Sgblack@eecs.umich.edu                            }});
5396384Sgblack@eecs.umich.edu                            default: CP0Unimpl::unknown();
5404661Sksewell@umich.edu                        }
5414661Sksewell@umich.edu                    }
5422101SN/A                }
5434661Sksewell@umich.edu                0xB: decode RD {
5444661Sksewell@umich.edu                    format MT_Control {
5454661Sksewell@umich.edu                        0x0: decode POS {
5464661Sksewell@umich.edu                            0x0: decode SEL {
5474661Sksewell@umich.edu                                0x1: decode SC {
5486376Sgblack@eecs.umich.edu                                    0x0: dvpe({{
5496376Sgblack@eecs.umich.edu                                        MVPControlReg mvpControl = MVPControl;
5506376Sgblack@eecs.umich.edu                                        VPEConf0Reg vpeConf0 = VPEConf0;
5516376Sgblack@eecs.umich.edu                                        Rt = MVPControl;
5526376Sgblack@eecs.umich.edu                                        if (vpeConf0.mvp == 1)
5536376Sgblack@eecs.umich.edu                                            mvpControl.evp = 0;
5546376Sgblack@eecs.umich.edu                                        MVPControl = mvpControl;
5556376Sgblack@eecs.umich.edu                                    }});
5566376Sgblack@eecs.umich.edu                                    0x1: evpe({{
5576376Sgblack@eecs.umich.edu                                        MVPControlReg mvpControl = MVPControl;
5586376Sgblack@eecs.umich.edu                                        VPEConf0Reg vpeConf0 = VPEConf0;
5596376Sgblack@eecs.umich.edu                                        Rt = MVPControl;
5606376Sgblack@eecs.umich.edu                                        if (vpeConf0.mvp == 1)
5616376Sgblack@eecs.umich.edu                                            mvpControl.evp = 1;
5626376Sgblack@eecs.umich.edu                                        MVPControl = mvpControl;
5636376Sgblack@eecs.umich.edu                                    }});
5645222Sksewell@umich.edu                                   default:CP0Unimpl::unknown();
5654661Sksewell@umich.edu                                }
5666384Sgblack@eecs.umich.edu                                default:CP0Unimpl::unknown();
5674661Sksewell@umich.edu                            }
5686384Sgblack@eecs.umich.edu                            default:CP0Unimpl::unknown();
5696384Sgblack@eecs.umich.edu                        }
5704661Sksewell@umich.edu                        0x1: decode POS {
5714661Sksewell@umich.edu                            0xF: decode SEL {
5724661Sksewell@umich.edu                                0x1: decode SC {
5736376Sgblack@eecs.umich.edu                                    0x0: dmt({{
5746376Sgblack@eecs.umich.edu                                        VPEControlReg vpeControl = VPEControl;
5756376Sgblack@eecs.umich.edu                                        Rt = vpeControl;
5766376Sgblack@eecs.umich.edu                                        vpeControl.te = 0;
5776376Sgblack@eecs.umich.edu                                        VPEControl = vpeControl;
5786376Sgblack@eecs.umich.edu                                    }});
5796376Sgblack@eecs.umich.edu                                    0x1: emt({{
5806376Sgblack@eecs.umich.edu                                        VPEControlReg vpeControl = VPEControl;
5816376Sgblack@eecs.umich.edu                                        Rt = vpeControl;
5826376Sgblack@eecs.umich.edu                                        vpeControl.te = 1;
5836376Sgblack@eecs.umich.edu                                        VPEControl = vpeControl;
5846376Sgblack@eecs.umich.edu                                    }});
5855222Sksewell@umich.edu                                   default:CP0Unimpl::unknown();
5864661Sksewell@umich.edu                                }
5876384Sgblack@eecs.umich.edu                                default:CP0Unimpl::unknown();
5884661Sksewell@umich.edu                            }
5895222Sksewell@umich.edu                            default:CP0Unimpl::unknown();
5904661Sksewell@umich.edu                        }
5914661Sksewell@umich.edu                    }
5924661Sksewell@umich.edu                    0xC: decode POS {
5936384Sgblack@eecs.umich.edu                        0x0: decode SC {
5946384Sgblack@eecs.umich.edu                            0x0: CP0Control::di({{
5956384Sgblack@eecs.umich.edu                                StatusReg status = Status;
5966384Sgblack@eecs.umich.edu                                ConfigReg config = Config;
5976384Sgblack@eecs.umich.edu                                // Rev 2.0 or beyond?
5986384Sgblack@eecs.umich.edu                                if (config.ar >= 1) {
5996384Sgblack@eecs.umich.edu                                    Rt = status;
6006384Sgblack@eecs.umich.edu                                    status.ie = 0;
6016384Sgblack@eecs.umich.edu                                } else {
6026384Sgblack@eecs.umich.edu                                    // Enable this else branch once we
6036384Sgblack@eecs.umich.edu                                    // actually set values for Config on init
6046384Sgblack@eecs.umich.edu                                    fault = new ReservedInstructionFault();
6056384Sgblack@eecs.umich.edu                                }
6066384Sgblack@eecs.umich.edu                                Status = status;
6076384Sgblack@eecs.umich.edu                            }});
6086384Sgblack@eecs.umich.edu                            0x1: CP0Control::ei({{
6096384Sgblack@eecs.umich.edu                                StatusReg status = Status;
6106384Sgblack@eecs.umich.edu                                ConfigReg config = Config;
6116384Sgblack@eecs.umich.edu                                if (config.ar >= 1) {
6126384Sgblack@eecs.umich.edu                                    Rt = status;
6136384Sgblack@eecs.umich.edu                                    status.ie = 1;
6146384Sgblack@eecs.umich.edu                                } else {
6156384Sgblack@eecs.umich.edu                                    fault = new ReservedInstructionFault();
6166384Sgblack@eecs.umich.edu                                }
6176384Sgblack@eecs.umich.edu                            }});
6186384Sgblack@eecs.umich.edu                            default:CP0Unimpl::unknown();
6196384Sgblack@eecs.umich.edu                        }
6204661Sksewell@umich.edu                    }
6216384Sgblack@eecs.umich.edu                    default: CP0Unimpl::unknown();
6224661Sksewell@umich.edu                }
6234661Sksewell@umich.edu                format CP0Control {
6244661Sksewell@umich.edu                    0xA: rdpgpr({{
6256376Sgblack@eecs.umich.edu                        ConfigReg config = Config;
6266376Sgblack@eecs.umich.edu                        if (config.ar >= 1) {
6276376Sgblack@eecs.umich.edu                            // Rev 2 of the architecture
6286376Sgblack@eecs.umich.edu                            panic("Shadow Sets Not Fully Implemented.\n");
6296376Sgblack@eecs.umich.edu                        } else {
6304661Sksewell@umich.edu                          fault = new ReservedInstructionFault();
6314661Sksewell@umich.edu                        }
6326376Sgblack@eecs.umich.edu                    }});
6334661Sksewell@umich.edu                    0xE: wrpgpr({{
6346376Sgblack@eecs.umich.edu                        ConfigReg config = Config;
6356376Sgblack@eecs.umich.edu                        if (config.ar >= 1) {
6366376Sgblack@eecs.umich.edu                            // Rev 2 of the architecture
6376376Sgblack@eecs.umich.edu                            panic("Shadow Sets Not Fully Implemented.\n");
6386376Sgblack@eecs.umich.edu                        } else {
6396376Sgblack@eecs.umich.edu                            fault = new ReservedInstructionFault();
6404661Sksewell@umich.edu                        }
6416376Sgblack@eecs.umich.edu                    }});
6424661Sksewell@umich.edu                }
6436384Sgblack@eecs.umich.edu            }
6442101SN/A
6452101SN/A            //Table A-12 MIPS32 COP0 Encoding of Function Field When rs=CO
6462101SN/A            0x1: decode FUNCTION {
6476384Sgblack@eecs.umich.edu                format CP0Control {
6486384Sgblack@eecs.umich.edu                    0x18: eret({{
6496384Sgblack@eecs.umich.edu                        StatusReg status = Status;
6506384Sgblack@eecs.umich.edu                        ConfigReg config = Config;
6516384Sgblack@eecs.umich.edu                        SRSCtlReg srsCtl = SRSCtl;
6526384Sgblack@eecs.umich.edu                        DPRINTF(MipsPRA,"Restoring PC - %x\n",EPC);
6536384Sgblack@eecs.umich.edu                        if (status.erl == 1) {
6546384Sgblack@eecs.umich.edu                            status.erl = 0;
6557792Sgblack@eecs.umich.edu                            NPC = ErrorEPC;
6566384Sgblack@eecs.umich.edu                            // Need to adjust NNPC, otherwise things break
6577792Sgblack@eecs.umich.edu                            NNPC = ErrorEPC + sizeof(MachInst);
6586384Sgblack@eecs.umich.edu                        } else {
6597792Sgblack@eecs.umich.edu                            NPC = EPC;
6606384Sgblack@eecs.umich.edu                            // Need to adjust NNPC, otherwise things break
6617792Sgblack@eecs.umich.edu                            NNPC = EPC + sizeof(MachInst);
6626384Sgblack@eecs.umich.edu                            status.exl = 0;
6636384Sgblack@eecs.umich.edu                            if (config.ar >=1 &&
6646384Sgblack@eecs.umich.edu                                    srsCtl.hss > 0 &&
6656384Sgblack@eecs.umich.edu                                    status.bev == 0) {
6666384Sgblack@eecs.umich.edu                                srsCtl.css = srsCtl.pss;
6676384Sgblack@eecs.umich.edu                                //xc->setShadowSet(srsCtl.pss);
6686384Sgblack@eecs.umich.edu                            }
6696376Sgblack@eecs.umich.edu                        }
6706384Sgblack@eecs.umich.edu                        LLFlag = 0;
6716384Sgblack@eecs.umich.edu                        Status = status;
6726384Sgblack@eecs.umich.edu                        SRSCtl = srsCtl;
6736384Sgblack@eecs.umich.edu                    }}, IsReturn, IsSerializing, IsERET);
6745222Sksewell@umich.edu
6756384Sgblack@eecs.umich.edu                    0x1F: deret({{
6766384Sgblack@eecs.umich.edu                        DebugReg debug = Debug;
6776384Sgblack@eecs.umich.edu                        if (debug.dm == 1) {
6786384Sgblack@eecs.umich.edu                            debug.dm = 1;
6796384Sgblack@eecs.umich.edu                            debug.iexi = 0;
6807792Sgblack@eecs.umich.edu                            NPC = DEPC;
6816384Sgblack@eecs.umich.edu                        } else {
6827792Sgblack@eecs.umich.edu                            NPC = NPC;
6836384Sgblack@eecs.umich.edu                            // Undefined;
6846384Sgblack@eecs.umich.edu                        }
6856384Sgblack@eecs.umich.edu                        Debug = debug;
6866384Sgblack@eecs.umich.edu                    }}, IsReturn, IsSerializing, IsERET);
6876384Sgblack@eecs.umich.edu                }
6886384Sgblack@eecs.umich.edu                format CP0TLB {
6896384Sgblack@eecs.umich.edu                    0x01: tlbr({{
6906384Sgblack@eecs.umich.edu                        MipsISA::PTE *PTEntry =
6916384Sgblack@eecs.umich.edu                            xc->tcBase()->getITBPtr()->
6926384Sgblack@eecs.umich.edu                                getEntry(Index & 0x7FFFFFFF);
6936384Sgblack@eecs.umich.edu                        if (PTEntry == NULL) {
6946384Sgblack@eecs.umich.edu                            fatal("Invalid PTE Entry received on "
6956384Sgblack@eecs.umich.edu                                "a TLBR instruction\n");
6966384Sgblack@eecs.umich.edu                        }
6976384Sgblack@eecs.umich.edu                        /* Setup PageMask */
6986384Sgblack@eecs.umich.edu                        // If 1KB pages are not enabled, a read of PageMask
6996384Sgblack@eecs.umich.edu                        // must return 0b00 in bits 12, 11
7006384Sgblack@eecs.umich.edu                        PageMask = (PTEntry->Mask << 11);
7016384Sgblack@eecs.umich.edu                        /* Setup EntryHi */
7026384Sgblack@eecs.umich.edu                        EntryHi = ((PTEntry->VPN << 11) | (PTEntry->asid));
7036384Sgblack@eecs.umich.edu                        /* Setup Entry Lo0 */
7046384Sgblack@eecs.umich.edu                        EntryLo0 = ((PTEntry->PFN0 << 6) |
7056384Sgblack@eecs.umich.edu                                    (PTEntry->C0 << 3) |
7066384Sgblack@eecs.umich.edu                                    (PTEntry->D0 << 2) |
7076384Sgblack@eecs.umich.edu                                    (PTEntry->V0 << 1) |
7086384Sgblack@eecs.umich.edu                                    PTEntry->G);
7096384Sgblack@eecs.umich.edu                        /* Setup Entry Lo1 */
7106384Sgblack@eecs.umich.edu                        EntryLo1 = ((PTEntry->PFN1 << 6) |
7116384Sgblack@eecs.umich.edu                                    (PTEntry->C1 << 3) |
7126384Sgblack@eecs.umich.edu                                    (PTEntry->D1 << 2) |
7136384Sgblack@eecs.umich.edu                                    (PTEntry->V1 << 1) |
7146384Sgblack@eecs.umich.edu                                    PTEntry->G);
7156384Sgblack@eecs.umich.edu                    }}); // Need to hook up to TLB
7165222Sksewell@umich.edu
7176384Sgblack@eecs.umich.edu                    0x02: tlbwi({{
7186384Sgblack@eecs.umich.edu                        //Create PTE
7196384Sgblack@eecs.umich.edu                        MipsISA::PTE newEntry;
7206384Sgblack@eecs.umich.edu                        //Write PTE
7216384Sgblack@eecs.umich.edu                        newEntry.Mask = (Addr)(PageMask >> 11);
7226384Sgblack@eecs.umich.edu                        newEntry.VPN = (Addr)(EntryHi >> 11);
7236384Sgblack@eecs.umich.edu                        /*  PageGrain _ ESP                    Config3 _ SP */
7246384Sgblack@eecs.umich.edu                        if (bits(PageGrain, 28) == 0 || bits(Config3, 4) ==0) {
7256384Sgblack@eecs.umich.edu                            // If 1KB pages are *NOT* enabled, lowest bits of
7266384Sgblack@eecs.umich.edu                            // the mask are 0b11 for TLB writes
7276384Sgblack@eecs.umich.edu                            newEntry.Mask |= 0x3;
7286384Sgblack@eecs.umich.edu                            // Reset bits 0 and 1 if 1KB pages are not enabled
7296384Sgblack@eecs.umich.edu                            newEntry.VPN &= 0xFFFFFFFC;
7306384Sgblack@eecs.umich.edu                        }
7316384Sgblack@eecs.umich.edu                        newEntry.asid = (uint8_t)(EntryHi & 0xFF);
7325222Sksewell@umich.edu
7336384Sgblack@eecs.umich.edu                        newEntry.PFN0 = (Addr)(EntryLo0 >> 6);
7346384Sgblack@eecs.umich.edu                        newEntry.PFN1 = (Addr)(EntryLo1 >> 6);
7356384Sgblack@eecs.umich.edu                        newEntry.D0 = (bool)((EntryLo0 >> 2) & 1);
7366384Sgblack@eecs.umich.edu                        newEntry.D1 = (bool)((EntryLo1 >> 2) & 1);
7376384Sgblack@eecs.umich.edu                        newEntry.V1 = (bool)((EntryLo1 >> 1) & 1);
7386384Sgblack@eecs.umich.edu                        newEntry.V0 = (bool)((EntryLo0 >> 1) & 1);
7396384Sgblack@eecs.umich.edu                        newEntry.G = (bool)((EntryLo0 & EntryLo1) & 1);
7406384Sgblack@eecs.umich.edu                        newEntry.C0 = (uint8_t)((EntryLo0 >> 3) & 0x7);
7416384Sgblack@eecs.umich.edu                        newEntry.C1 = (uint8_t)((EntryLo1 >> 3) & 0x7);
7426384Sgblack@eecs.umich.edu                        /* Now, compute the AddrShiftAmount and OffsetMask -
7436384Sgblack@eecs.umich.edu                           TLB optimizations */
7446384Sgblack@eecs.umich.edu                        /* Addr Shift Amount for 1KB or larger pages */
7456384Sgblack@eecs.umich.edu                        if ((newEntry.Mask & 0xFFFF) == 3) {
7466384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 12;
7476384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFFFF) == 0x0000) {
7486384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 10;
7496384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFFFC) == 0x000C) {
7506384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 14;
7516384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFFF0) == 0x0030) {
7526384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 16;
7536384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFFC0) == 0x00C0) {
7546384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 18;
7556384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFF00) == 0x0300) {
7566384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 20;
7576384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFC00) == 0x0C00) {
7586384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 22;
7596384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xF000) == 0x3000) {
7606384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 24;
7616384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xC000) == 0xC000) {
7626384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 26;
7636384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0x30000) == 0x30000) {
7646384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 28;
7656384Sgblack@eecs.umich.edu                        } else {
7666384Sgblack@eecs.umich.edu                            fatal("Invalid Mask Pattern Detected!\n");
7676384Sgblack@eecs.umich.edu                        }
7686384Sgblack@eecs.umich.edu                        newEntry.OffsetMask =
7696384Sgblack@eecs.umich.edu                            (1 << newEntry.AddrShiftAmount) - 1;
7705222Sksewell@umich.edu
7716384Sgblack@eecs.umich.edu                        MipsISA::TLB *Ptr = xc->tcBase()->getITBPtr();
7726384Sgblack@eecs.umich.edu                        Config3Reg config3 = Config3;
7736384Sgblack@eecs.umich.edu                        PageGrainReg pageGrain = PageGrain;
7746384Sgblack@eecs.umich.edu                        int SP = 0;
7756384Sgblack@eecs.umich.edu                        if (bits(config3, config3.sp) == 1 &&
7766384Sgblack@eecs.umich.edu                            bits(pageGrain, pageGrain.esp) == 1) {
7776384Sgblack@eecs.umich.edu                            SP = 1;
7786384Sgblack@eecs.umich.edu                        }
7796384Sgblack@eecs.umich.edu                        Ptr->insertAt(newEntry, Index & 0x7FFFFFFF, SP);
7806384Sgblack@eecs.umich.edu                    }});
7816384Sgblack@eecs.umich.edu                    0x06: tlbwr({{
7826384Sgblack@eecs.umich.edu                        //Create PTE
7836384Sgblack@eecs.umich.edu                        MipsISA::PTE newEntry;
7846384Sgblack@eecs.umich.edu                        //Write PTE
7856384Sgblack@eecs.umich.edu                        newEntry.Mask = (Addr)(PageMask >> 11);
7866384Sgblack@eecs.umich.edu                        newEntry.VPN = (Addr)(EntryHi >> 11);
7876384Sgblack@eecs.umich.edu                        /*  PageGrain _ ESP                    Config3 _ SP */
7886384Sgblack@eecs.umich.edu                        if (bits(PageGrain, 28) == 0 ||
7896384Sgblack@eecs.umich.edu                            bits(Config3, 4) == 0) {
7906384Sgblack@eecs.umich.edu                            // If 1KB pages are *NOT* enabled, lowest bits of
7916384Sgblack@eecs.umich.edu                            // the mask are 0b11 for TLB writes
7926384Sgblack@eecs.umich.edu                            newEntry.Mask |= 0x3;
7936384Sgblack@eecs.umich.edu                            // Reset bits 0 and 1 if 1KB pages are not enabled
7946384Sgblack@eecs.umich.edu                            newEntry.VPN &= 0xFFFFFFFC;
7956384Sgblack@eecs.umich.edu                        }
7966384Sgblack@eecs.umich.edu                        newEntry.asid = (uint8_t)(EntryHi & 0xFF);
7975222Sksewell@umich.edu
7986384Sgblack@eecs.umich.edu                        newEntry.PFN0 = (Addr)(EntryLo0 >> 6);
7996384Sgblack@eecs.umich.edu                        newEntry.PFN1 = (Addr)(EntryLo1 >> 6);
8006384Sgblack@eecs.umich.edu                        newEntry.D0 = (bool)((EntryLo0 >> 2) & 1);
8016384Sgblack@eecs.umich.edu                        newEntry.D1 = (bool)((EntryLo1 >> 2) & 1);
8026384Sgblack@eecs.umich.edu                        newEntry.V1 = (bool)((EntryLo1 >> 1) & 1);
8036384Sgblack@eecs.umich.edu                        newEntry.V0 = (bool)((EntryLo0 >> 1) & 1);
8046384Sgblack@eecs.umich.edu                        newEntry.G = (bool)((EntryLo0 & EntryLo1) & 1);
8056384Sgblack@eecs.umich.edu                        newEntry.C0 = (uint8_t)((EntryLo0 >> 3) & 0x7);
8066384Sgblack@eecs.umich.edu                        newEntry.C1 = (uint8_t)((EntryLo1 >> 3) & 0x7);
8076384Sgblack@eecs.umich.edu                        /* Now, compute the AddrShiftAmount and OffsetMask -
8086384Sgblack@eecs.umich.edu                           TLB optimizations */
8096384Sgblack@eecs.umich.edu                        /* Addr Shift Amount for 1KB or larger pages */
8106384Sgblack@eecs.umich.edu                        if ((newEntry.Mask & 0xFFFF) == 3){
8116384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 12;
8126384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFFFF) == 0x0000) {
8136384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 10;
8146384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFFFC) == 0x000C) {
8156384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 14;
8166384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFFF0) == 0x0030) {
8176384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 16;
8186384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFFC0) == 0x00C0) {
8196384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 18;
8206384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFF00) == 0x0300) {
8216384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 20;
8226384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xFC00) == 0x0C00) {
8236384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 22;
8246384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xF000) == 0x3000) {
8256384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 24;
8266384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0xC000) == 0xC000) {
8276384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 26;
8286384Sgblack@eecs.umich.edu                        } else if ((newEntry.Mask & 0x30000) == 0x30000) {
8296384Sgblack@eecs.umich.edu                            newEntry.AddrShiftAmount = 28;
8306384Sgblack@eecs.umich.edu                        } else {
8316384Sgblack@eecs.umich.edu                            fatal("Invalid Mask Pattern Detected!\n");
8326384Sgblack@eecs.umich.edu                        }
8336384Sgblack@eecs.umich.edu                        newEntry.OffsetMask =
8346384Sgblack@eecs.umich.edu                            (1 << newEntry.AddrShiftAmount) - 1;
8355222Sksewell@umich.edu
8366384Sgblack@eecs.umich.edu                        MipsISA::TLB *Ptr = xc->tcBase()->getITBPtr();
8376384Sgblack@eecs.umich.edu                        Config3Reg config3 = Config3;
8386384Sgblack@eecs.umich.edu                        PageGrainReg pageGrain = PageGrain;
8396384Sgblack@eecs.umich.edu                        int SP = 0;
8406384Sgblack@eecs.umich.edu                        if (bits(config3, config3.sp) == 1 &&
8416384Sgblack@eecs.umich.edu                            bits(pageGrain, pageGrain.esp) == 1) {
8426384Sgblack@eecs.umich.edu                            SP = 1;
8436384Sgblack@eecs.umich.edu                        }
8446384Sgblack@eecs.umich.edu                        Ptr->insertAt(newEntry, Random, SP);
8456384Sgblack@eecs.umich.edu                    }});
8462101SN/A
8476384Sgblack@eecs.umich.edu                    0x08: tlbp({{
8486384Sgblack@eecs.umich.edu                        Config3Reg config3 = Config3;
8496384Sgblack@eecs.umich.edu                        PageGrainReg pageGrain = PageGrain;
8506384Sgblack@eecs.umich.edu                        EntryHiReg entryHi = EntryHi;
8516384Sgblack@eecs.umich.edu                        int tlbIndex;
8526384Sgblack@eecs.umich.edu                        Addr vpn;
8536384Sgblack@eecs.umich.edu                        if (pageGrain.esp == 1 && config3.sp ==1) {
8546384Sgblack@eecs.umich.edu                            vpn = EntryHi >> 11;
8556384Sgblack@eecs.umich.edu                        } else {
8566384Sgblack@eecs.umich.edu                            // Mask off lower 2 bits
8576384Sgblack@eecs.umich.edu                            vpn = ((EntryHi >> 11) & 0xFFFFFFFC);
8586384Sgblack@eecs.umich.edu                        }
8596384Sgblack@eecs.umich.edu                        tlbIndex = xc->tcBase()->getITBPtr()->
8606385Sgblack@eecs.umich.edu                                   probeEntry(vpn, entryHi.asid);
8616384Sgblack@eecs.umich.edu                        // Check TLB for entry matching EntryHi
8626384Sgblack@eecs.umich.edu                        if (tlbIndex != -1) {
8636384Sgblack@eecs.umich.edu                            Index = tlbIndex;
8646384Sgblack@eecs.umich.edu                        } else {
8656384Sgblack@eecs.umich.edu                            // else, set Index = 1 << 31
8666384Sgblack@eecs.umich.edu                            Index = (1 << 31);
8676384Sgblack@eecs.umich.edu                        }
8686384Sgblack@eecs.umich.edu                    }});
8696384Sgblack@eecs.umich.edu                }
8706384Sgblack@eecs.umich.edu                format CP0Unimpl {
8716384Sgblack@eecs.umich.edu                    0x20: wait();
8726384Sgblack@eecs.umich.edu                }
8736384Sgblack@eecs.umich.edu                default: CP0Unimpl::unknown();
8742101SN/A            }
8752043SN/A        }
8762027SN/A
8772101SN/A        //Table A-13 MIPS32 COP1 Encoding of rs Field
8782101SN/A        0x1: decode RS_MSB {
8792101SN/A            0x0: decode RS_HI {
8802101SN/A                0x0: decode RS_LO {
8812686Sksewell@umich.edu                    format CP1Control {
8828588Sgblack@eecs.umich.edu                        0x0: mfc1 ({{ Rt_uw = Fs_uw; }});
8832495SN/A
8842495SN/A                        0x2: cfc1({{
8856384Sgblack@eecs.umich.edu                            switch (FS) {
8862573SN/A                              case 0:
8872616SN/A                                Rt = FIR;
8882573SN/A                                break;
8892573SN/A                              case 25:
8906384Sgblack@eecs.umich.edu                                Rt = (FCSR & 0xFE000000) >> 24 |
8916384Sgblack@eecs.umich.edu                                     (FCSR & 0x00800000) >> 23;
8922573SN/A                                break;
8932573SN/A                              case 26:
8946384Sgblack@eecs.umich.edu                                Rt = (FCSR & 0x0003F07C);
8952573SN/A                                break;
8962573SN/A                              case 28:
8976384Sgblack@eecs.umich.edu                                Rt = (FCSR & 0x00000F80) |
8986384Sgblack@eecs.umich.edu                                     (FCSR & 0x01000000) >> 21 |
8996384Sgblack@eecs.umich.edu                                     (FCSR & 0x00000003);
9002573SN/A                                break;
9012573SN/A                              case 31:
9022616SN/A                                Rt = FCSR;
9032573SN/A                                break;
9042573SN/A                              default:
9055222Sksewell@umich.edu                                warn("FP Control Value (%d) Not Valid");
9062573SN/A                            }
9072573SN/A                        }});
9082573SN/A
9098588Sgblack@eecs.umich.edu                        0x3: mfhc1({{ Rt_uw = Fs_ud<63:32>; }});
9102686Sksewell@umich.edu
9118588Sgblack@eecs.umich.edu                        0x4: mtc1({{ Fs_uw = Rt_uw; }});
9122686Sksewell@umich.edu
9132573SN/A                        0x6: ctc1({{
9146384Sgblack@eecs.umich.edu                            switch (FS) {
9152573SN/A                              case 25:
9168588Sgblack@eecs.umich.edu                                FCSR = (Rt_uw<7:1> << 25) |  // move 31-25
9176384Sgblack@eecs.umich.edu                                       (FCSR & 0x01000000) | // bit 24
9186384Sgblack@eecs.umich.edu                                       (FCSR & 0x004FFFFF);  // bit 22-0
9192573SN/A                                break;
9202573SN/A                              case 26:
9216384Sgblack@eecs.umich.edu                                FCSR = (FCSR & 0xFFFC0000) | // move 31-18
9228588Sgblack@eecs.umich.edu                                       Rt_uw<17:12> << 12 |  // bit 17-12
9236384Sgblack@eecs.umich.edu                                       (FCSR & 0x00000F80) << 7 | // bit 11-7
9248588Sgblack@eecs.umich.edu                                       Rt_uw<6:2> << 2 |     // bit 6-2
9256384Sgblack@eecs.umich.edu                                       (FCSR & 0x00000002);  // bit 1-0
9262573SN/A                                break;
9272573SN/A                              case 28:
9286384Sgblack@eecs.umich.edu                                FCSR = (FCSR & 0xFE000000) | // move 31-25
9298588Sgblack@eecs.umich.edu                                       Rt_uw<2:2> << 24 |    // bit 24
9306384Sgblack@eecs.umich.edu                                       (FCSR & 0x00FFF000) << 23 | // bit 23-12
9318588Sgblack@eecs.umich.edu                                       Rt_uw<11:7> << 7 |    // bit 24
9326384Sgblack@eecs.umich.edu                                       (FCSR & 0x000007E) |
9338588Sgblack@eecs.umich.edu                                       Rt_uw<1:0>;           // bit 22-0
9342573SN/A                                break;
9352573SN/A                              case 31:
9368588Sgblack@eecs.umich.edu                                FCSR = Rt_uw;
9372573SN/A                                break;
9382573SN/A
9392573SN/A                              default:
9406384Sgblack@eecs.umich.edu                                panic("FP Control Value (%d) "
9416384Sgblack@eecs.umich.edu                                        "Not Available. Ignoring Access "
9426384Sgblack@eecs.umich.edu                                        "to Floating Control Status "
9436384Sgblack@eecs.umich.edu                                        "Register", FS);
9442495SN/A                            }
9452495SN/A                        }});
9462686Sksewell@umich.edu
9472686Sksewell@umich.edu                        0x7: mthc1({{
9488588Sgblack@eecs.umich.edu                             uint64_t fs_hi = Rt_uw;
9498588Sgblack@eecs.umich.edu                             uint64_t fs_lo = Fs_ud & 0x0FFFFFFFF;
9508588Sgblack@eecs.umich.edu                             Fs_ud = (fs_hi << 32) | fs_lo;
9512686Sksewell@umich.edu                        }});
9522686Sksewell@umich.edu
9532101SN/A                    }
9545222Sksewell@umich.edu                    format CP1Unimpl {
9555222Sksewell@umich.edu                      0x1: dmfc1();
9565222Sksewell@umich.edu                      0x5: dmtc1();
9575222Sksewell@umich.edu                    }
9586384Sgblack@eecs.umich.edu                }
9592025SN/A
9606384Sgblack@eecs.umich.edu                0x1: decode RS_LO {
9616384Sgblack@eecs.umich.edu                    0x0: decode ND {
9626384Sgblack@eecs.umich.edu                        format Branch {
9636384Sgblack@eecs.umich.edu                            0x0: decode TF {
9646384Sgblack@eecs.umich.edu                                0x0: bc1f({{
9656384Sgblack@eecs.umich.edu                                    cond = getCondCode(FCSR, BRANCH_CC) == 0;
9666384Sgblack@eecs.umich.edu                                }});
9676384Sgblack@eecs.umich.edu                                0x1: bc1t({{
9686384Sgblack@eecs.umich.edu                                    cond = getCondCode(FCSR, BRANCH_CC) == 1;
9696384Sgblack@eecs.umich.edu                                }});
9706384Sgblack@eecs.umich.edu                            }
9716384Sgblack@eecs.umich.edu                            0x1: decode TF {
9726384Sgblack@eecs.umich.edu                                0x0: bc1fl({{
9736384Sgblack@eecs.umich.edu                                    cond = getCondCode(FCSR, BRANCH_CC) == 0;
9746384Sgblack@eecs.umich.edu                                }}, Likely);
9756384Sgblack@eecs.umich.edu                                0x1: bc1tl({{
9766384Sgblack@eecs.umich.edu                                    cond = getCondCode(FCSR, BRANCH_CC) == 1;
9776384Sgblack@eecs.umich.edu                                }}, Likely);
9786384Sgblack@eecs.umich.edu                            }
9796384Sgblack@eecs.umich.edu                        }
9806384Sgblack@eecs.umich.edu                    }
9816384Sgblack@eecs.umich.edu                    format CP1Unimpl {
9826384Sgblack@eecs.umich.edu                        0x1: bc1any2();
9836384Sgblack@eecs.umich.edu                        0x2: bc1any4();
9846384Sgblack@eecs.umich.edu                        default: unknown();
9856384Sgblack@eecs.umich.edu                    }
9866384Sgblack@eecs.umich.edu                }
9872043SN/A            }
9882027SN/A
9892101SN/A            0x1: decode RS_HI {
9902101SN/A                0x2: decode RS_LO {
9916384Sgblack@eecs.umich.edu                    //Table A-14 MIPS32 COP1 Encoding of Function Field When
9926384Sgblack@eecs.umich.edu                    //rs=S (( single-precision floating point))
9932572SN/A                    0x0: decode FUNCTION_HI {
9942572SN/A                        0x0: decode FUNCTION_LO {
9952101SN/A                            format FloatOp {
9968588Sgblack@eecs.umich.edu                                0x0: add_s({{ Fd_sf = Fs_sf + Ft_sf; }});
9978588Sgblack@eecs.umich.edu                                0x1: sub_s({{ Fd_sf = Fs_sf - Ft_sf; }});
9988588Sgblack@eecs.umich.edu                                0x2: mul_s({{ Fd_sf = Fs_sf * Ft_sf; }});
9998588Sgblack@eecs.umich.edu                                0x3: div_s({{ Fd_sf = Fs_sf / Ft_sf; }});
10008588Sgblack@eecs.umich.edu                                0x4: sqrt_s({{ Fd_sf = sqrt(Fs_sf); }});
10018588Sgblack@eecs.umich.edu                                0x5: abs_s({{ Fd_sf = fabs(Fs_sf); }});
10028588Sgblack@eecs.umich.edu                                0x7: neg_s({{ Fd_sf = -Fs_sf; }});
10032101SN/A                            }
10048588Sgblack@eecs.umich.edu                            0x6: BasicOp::mov_s({{ Fd_sf = Fs_sf; }});
10052101SN/A                        }
10062572SN/A                        0x1: decode FUNCTION_LO {
10072686Sksewell@umich.edu                            format FloatConvertOp {
10088588Sgblack@eecs.umich.edu                                0x0: round_l_s({{ val = Fs_sf; }},
10096384Sgblack@eecs.umich.edu                                               ToLong, Round);
10108588Sgblack@eecs.umich.edu                                0x1: trunc_l_s({{ val = Fs_sf; }},
10116384Sgblack@eecs.umich.edu                                               ToLong, Trunc);
10128588Sgblack@eecs.umich.edu                                0x2: ceil_l_s({{ val = Fs_sf;}},
10136384Sgblack@eecs.umich.edu                                              ToLong, Ceil);
10148588Sgblack@eecs.umich.edu                                0x3: floor_l_s({{ val = Fs_sf; }},
10156384Sgblack@eecs.umich.edu                                               ToLong, Floor);
10168588Sgblack@eecs.umich.edu                                0x4: round_w_s({{ val = Fs_sf; }},
10176384Sgblack@eecs.umich.edu                                               ToWord, Round);
10188588Sgblack@eecs.umich.edu                                0x5: trunc_w_s({{ val = Fs_sf; }},
10196384Sgblack@eecs.umich.edu                                               ToWord, Trunc);
10208588Sgblack@eecs.umich.edu                                0x6: ceil_w_s({{ val = Fs_sf; }},
10216384Sgblack@eecs.umich.edu                                              ToWord, Ceil);
10228588Sgblack@eecs.umich.edu                                0x7: floor_w_s({{ val = Fs_sf; }},
10236384Sgblack@eecs.umich.edu                                               ToWord, Floor);
10242101SN/A                            }
10252101SN/A                        }
10262027SN/A
10272572SN/A                        0x2: decode FUNCTION_LO {
10282101SN/A                            0x1: decode MOVCF {
10292686Sksewell@umich.edu                                format BasicOp {
10306384Sgblack@eecs.umich.edu                                    0x0: movf_s({{
10316384Sgblack@eecs.umich.edu                                        Fd = (getCondCode(FCSR,CC) == 0) ?
10326384Sgblack@eecs.umich.edu                                             Fs : Fd;
10336384Sgblack@eecs.umich.edu                                    }});
10346384Sgblack@eecs.umich.edu                                    0x1: movt_s({{
10356384Sgblack@eecs.umich.edu                                        Fd = (getCondCode(FCSR,CC) == 1) ?
10366384Sgblack@eecs.umich.edu                                             Fs : Fd;
10376384Sgblack@eecs.umich.edu                                    }});
10382101SN/A                                }
10392101SN/A                            }
10402027SN/A
10412686Sksewell@umich.edu                            format BasicOp {
10422686Sksewell@umich.edu                                0x2: movz_s({{ Fd = (Rt == 0) ? Fs : Fd; }});
10432686Sksewell@umich.edu                                0x3: movn_s({{ Fd = (Rt != 0) ? Fs : Fd; }});
10442686Sksewell@umich.edu                            }
10452686Sksewell@umich.edu
10462602SN/A                            format FloatOp {
10472602SN/A                                0x5: recip_s({{ Fd = 1 / Fs; }});
10486384Sgblack@eecs.umich.edu                                0x6: rsqrt_s({{ Fd = 1 / sqrt(Fs); }});
10492101SN/A                            }
10505222Sksewell@umich.edu                            format CP1Unimpl {
10516384Sgblack@eecs.umich.edu                                default: unknown();
10525222Sksewell@umich.edu                            }
10532101SN/A                        }
10545222Sksewell@umich.edu                        0x3: CP1Unimpl::unknown();
10552027SN/A
10562572SN/A                        0x4: decode FUNCTION_LO {
10572603SN/A                            format FloatConvertOp {
10588588Sgblack@eecs.umich.edu                                0x1: cvt_d_s({{ val = Fs_sf; }}, ToDouble);
10598588Sgblack@eecs.umich.edu                                0x4: cvt_w_s({{ val = Fs_sf; }}, ToWord);
10608588Sgblack@eecs.umich.edu                                0x5: cvt_l_s({{ val = Fs_sf; }}, ToLong);
10612101SN/A                            }
10622055SN/A
10632686Sksewell@umich.edu                            0x6: FloatOp::cvt_ps_s({{
10648588Sgblack@eecs.umich.edu                                Fd_ud = (uint64_t) Fs_uw << 32 |
10658588Sgblack@eecs.umich.edu                                        (uint64_t) Ft_uw;
10666384Sgblack@eecs.umich.edu                            }});
10675222Sksewell@umich.edu                            format CP1Unimpl {
10686384Sgblack@eecs.umich.edu                                default: unknown();
10695222Sksewell@umich.edu                            }
10702101SN/A                        }
10715222Sksewell@umich.edu                        0x5: CP1Unimpl::unknown();
10722602SN/A
10732602SN/A                        0x6: decode FUNCTION_LO {
10742603SN/A                            format FloatCompareOp {
10756384Sgblack@eecs.umich.edu                                0x0: c_f_s({{ cond = 0; }},
10766384Sgblack@eecs.umich.edu                                           SinglePrecision, UnorderedFalse);
10776384Sgblack@eecs.umich.edu                                0x1: c_un_s({{ cond = 0; }},
10786384Sgblack@eecs.umich.edu                                            SinglePrecision, UnorderedTrue);
10798588Sgblack@eecs.umich.edu                                0x2: c_eq_s({{ cond = (Fs_sf == Ft_sf); }},
10802686Sksewell@umich.edu                                            UnorderedFalse);
10818588Sgblack@eecs.umich.edu                                0x3: c_ueq_s({{ cond = (Fs_sf == Ft_sf); }},
10822686Sksewell@umich.edu                                             UnorderedTrue);
10838588Sgblack@eecs.umich.edu                                0x4: c_olt_s({{ cond = (Fs_sf < Ft_sf); }},
10842686Sksewell@umich.edu                                             UnorderedFalse);
10858588Sgblack@eecs.umich.edu                                0x5: c_ult_s({{ cond = (Fs_sf < Ft_sf); }},
10862686Sksewell@umich.edu                                             UnorderedTrue);
10878588Sgblack@eecs.umich.edu                                0x6: c_ole_s({{ cond = (Fs_sf <= Ft_sf); }},
10882686Sksewell@umich.edu                                             UnorderedFalse);
10898588Sgblack@eecs.umich.edu                                0x7: c_ule_s({{ cond = (Fs_sf <= Ft_sf); }},
10902686Sksewell@umich.edu                                             UnorderedTrue);
10912602SN/A                            }
10922602SN/A                        }
10932602SN/A
10942602SN/A                        0x7: decode FUNCTION_LO {
10952686Sksewell@umich.edu                            format FloatCompareOp {
10962686Sksewell@umich.edu                                0x0: c_sf_s({{ cond = 0; }}, SinglePrecision,
10972686Sksewell@umich.edu                                            UnorderedFalse, QnanException);
10982686Sksewell@umich.edu                                0x1: c_ngle_s({{ cond = 0; }}, SinglePrecision,
10992686Sksewell@umich.edu                                              UnorderedTrue, QnanException);
11008588Sgblack@eecs.umich.edu                                0x2: c_seq_s({{ cond = (Fs_sf == Ft_sf); }},
11012686Sksewell@umich.edu                                             UnorderedFalse, QnanException);
11028588Sgblack@eecs.umich.edu                                0x3: c_ngl_s({{ cond = (Fs_sf == Ft_sf); }},
11032686Sksewell@umich.edu                                             UnorderedTrue, QnanException);
11048588Sgblack@eecs.umich.edu                                0x4: c_lt_s({{ cond = (Fs_sf < Ft_sf); }},
11052686Sksewell@umich.edu                                            UnorderedFalse, QnanException);
11068588Sgblack@eecs.umich.edu                                0x5: c_nge_s({{ cond = (Fs_sf < Ft_sf); }},
11072686Sksewell@umich.edu                                             UnorderedTrue, QnanException);
11088588Sgblack@eecs.umich.edu                                0x6: c_le_s({{ cond = (Fs_sf <= Ft_sf); }},
11092686Sksewell@umich.edu                                            UnorderedFalse, QnanException);
11108588Sgblack@eecs.umich.edu                                0x7: c_ngt_s({{ cond = (Fs_sf <= Ft_sf); }},
11112686Sksewell@umich.edu                                             UnorderedTrue, QnanException);
11122602SN/A                            }
11132602SN/A                        }
11142101SN/A                    }
11152055SN/A
11166384Sgblack@eecs.umich.edu                    //Table A-15 MIPS32 COP1 Encoding of Function Field When
11176384Sgblack@eecs.umich.edu                    //rs=D
11182572SN/A                    0x1: decode FUNCTION_HI {
11192572SN/A                        0x0: decode FUNCTION_LO {
11202101SN/A                            format FloatOp {
11218588Sgblack@eecs.umich.edu                                0x0: add_d({{ Fd_df = Fs_df + Ft_df; }});
11228588Sgblack@eecs.umich.edu                                0x1: sub_d({{ Fd_df = Fs_df - Ft_df; }});
11238588Sgblack@eecs.umich.edu                                0x2: mul_d({{ Fd_df = Fs_df * Ft_df; }});
11248588Sgblack@eecs.umich.edu                                0x3: div_d({{ Fd_df = Fs_df / Ft_df; }});
11258588Sgblack@eecs.umich.edu                                0x4: sqrt_d({{ Fd_df = sqrt(Fs_df); }});
11268588Sgblack@eecs.umich.edu                                0x5: abs_d({{ Fd_df = fabs(Fs_df); }});
11278588Sgblack@eecs.umich.edu                                0x7: neg_d({{ Fd_df = -1 * Fs_df; }});
11282101SN/A                            }
11298588Sgblack@eecs.umich.edu                            0x6: BasicOp::mov_d({{ Fd_df = Fs_df; }});
11302101SN/A                        }
11312027SN/A
11322572SN/A                        0x1: decode FUNCTION_LO {
11332686Sksewell@umich.edu                            format FloatConvertOp {
11348588Sgblack@eecs.umich.edu                                0x0: round_l_d({{ val = Fs_df; }},
11356384Sgblack@eecs.umich.edu                                               ToLong, Round);
11368588Sgblack@eecs.umich.edu                                0x1: trunc_l_d({{ val = Fs_df; }},
11376384Sgblack@eecs.umich.edu                                               ToLong, Trunc);
11388588Sgblack@eecs.umich.edu                                0x2: ceil_l_d({{ val = Fs_df; }},
11396384Sgblack@eecs.umich.edu                                              ToLong, Ceil);
11408588Sgblack@eecs.umich.edu                                0x3: floor_l_d({{ val = Fs_df; }},
11416384Sgblack@eecs.umich.edu                                               ToLong, Floor);
11428588Sgblack@eecs.umich.edu                                0x4: round_w_d({{ val = Fs_df; }},
11436384Sgblack@eecs.umich.edu                                               ToWord, Round);
11448588Sgblack@eecs.umich.edu                                0x5: trunc_w_d({{ val = Fs_df; }},
11456384Sgblack@eecs.umich.edu                                               ToWord, Trunc);
11468588Sgblack@eecs.umich.edu                                0x6: ceil_w_d({{ val = Fs_df; }},
11476384Sgblack@eecs.umich.edu                                              ToWord, Ceil);
11488588Sgblack@eecs.umich.edu                                0x7: floor_w_d({{ val = Fs_df; }},
11496384Sgblack@eecs.umich.edu                                               ToWord, Floor);
11502101SN/A                            }
11512101SN/A                        }
11522027SN/A
11532572SN/A                        0x2: decode FUNCTION_LO {
11542101SN/A                            0x1: decode MOVCF {
11552686Sksewell@umich.edu                                format BasicOp {
11566384Sgblack@eecs.umich.edu                                    0x0: movf_d({{
11578588Sgblack@eecs.umich.edu                                        Fd_df = (getCondCode(FCSR,CC) == 0) ?
11588588Sgblack@eecs.umich.edu                                                       Fs_df : Fd_df;
11596384Sgblack@eecs.umich.edu                                    }});
11606384Sgblack@eecs.umich.edu                                    0x1: movt_d({{
11618588Sgblack@eecs.umich.edu                                        Fd_df = (getCondCode(FCSR,CC) == 1) ?
11628588Sgblack@eecs.umich.edu                                                       Fs_df : Fd_df;
11636384Sgblack@eecs.umich.edu                                    }});
11642101SN/A                                }
11652101SN/A                            }
11662027SN/A
11672101SN/A                            format BasicOp {
11686384Sgblack@eecs.umich.edu                                0x2: movz_d({{
11698588Sgblack@eecs.umich.edu                                    Fd_df = (Rt == 0) ? Fs_df : Fd_df;
11706384Sgblack@eecs.umich.edu                                }});
11716384Sgblack@eecs.umich.edu                                0x3: movn_d({{
11728588Sgblack@eecs.umich.edu                                    Fd_df = (Rt != 0) ? Fs_df : Fd_df;
11736384Sgblack@eecs.umich.edu                                }});
11742101SN/A                            }
11752027SN/A
11762605SN/A                            format FloatOp {
11778588Sgblack@eecs.umich.edu                                0x5: recip_d({{ Fd_df = 1 / Fs_df; }});
11788588Sgblack@eecs.umich.edu                                0x6: rsqrt_d({{ Fd_df = 1 / sqrt(Fs_df); }});
11792101SN/A                            }
11805222Sksewell@umich.edu                            format CP1Unimpl {
11816384Sgblack@eecs.umich.edu                                default: unknown();
11825222Sksewell@umich.edu                            }
11835222Sksewell@umich.edu
11842101SN/A                        }
11852572SN/A                        0x4: decode FUNCTION_LO {
11862686Sksewell@umich.edu                            format FloatConvertOp {
11878588Sgblack@eecs.umich.edu                                0x0: cvt_s_d({{ val = Fs_df; }}, ToSingle);
11888588Sgblack@eecs.umich.edu                                0x4: cvt_w_d({{ val = Fs_df; }}, ToWord);
11898588Sgblack@eecs.umich.edu                                0x5: cvt_l_d({{ val = Fs_df; }}, ToLong);
11902101SN/A                            }
11916384Sgblack@eecs.umich.edu                            default: CP1Unimpl::unknown();
11922101SN/A                        }
11932602SN/A
11942602SN/A                        0x6: decode FUNCTION_LO {
11952604SN/A                            format FloatCompareOp {
11966384Sgblack@eecs.umich.edu                                0x0: c_f_d({{ cond = 0; }},
11976384Sgblack@eecs.umich.edu                                           DoublePrecision, UnorderedFalse);
11986384Sgblack@eecs.umich.edu                                0x1: c_un_d({{ cond = 0; }},
11996384Sgblack@eecs.umich.edu                                            DoublePrecision, UnorderedTrue);
12008588Sgblack@eecs.umich.edu                                0x2: c_eq_d({{ cond = (Fs_df == Ft_df); }},
12012686Sksewell@umich.edu                                            UnorderedFalse);
12028588Sgblack@eecs.umich.edu                                0x3: c_ueq_d({{ cond = (Fs_df == Ft_df); }},
12032686Sksewell@umich.edu                                             UnorderedTrue);
12048588Sgblack@eecs.umich.edu                                0x4: c_olt_d({{ cond = (Fs_df < Ft_df); }},
12052686Sksewell@umich.edu                                             UnorderedFalse);
12068588Sgblack@eecs.umich.edu                                0x5: c_ult_d({{ cond = (Fs_df < Ft_df); }},
12072686Sksewell@umich.edu                                             UnorderedTrue);
12088588Sgblack@eecs.umich.edu                                0x6: c_ole_d({{ cond = (Fs_df <= Ft_df); }},
12092686Sksewell@umich.edu                                             UnorderedFalse);
12108588Sgblack@eecs.umich.edu                                0x7: c_ule_d({{ cond = (Fs_df <= Ft_df); }},
12112686Sksewell@umich.edu                                             UnorderedTrue);
12122602SN/A                            }
12132602SN/A                        }
12142602SN/A
12152602SN/A                        0x7: decode FUNCTION_LO {
12162686Sksewell@umich.edu                            format FloatCompareOp {
12172686Sksewell@umich.edu                                0x0: c_sf_d({{ cond = 0; }}, DoublePrecision,
12182686Sksewell@umich.edu                                            UnorderedFalse, QnanException);
12192686Sksewell@umich.edu                                0x1: c_ngle_d({{ cond = 0; }}, DoublePrecision,
12202686Sksewell@umich.edu                                              UnorderedTrue, QnanException);
12218588Sgblack@eecs.umich.edu                                0x2: c_seq_d({{ cond = (Fs_df == Ft_df); }},
12222686Sksewell@umich.edu                                             UnorderedFalse, QnanException);
12238588Sgblack@eecs.umich.edu                                0x3: c_ngl_d({{ cond = (Fs_df == Ft_df); }},
12242686Sksewell@umich.edu                                             UnorderedTrue, QnanException);
12258588Sgblack@eecs.umich.edu                                0x4: c_lt_d({{ cond = (Fs_df < Ft_df); }},
12262686Sksewell@umich.edu                                            UnorderedFalse, QnanException);
12278588Sgblack@eecs.umich.edu                                0x5: c_nge_d({{ cond = (Fs_df < Ft_df); }},
12282686Sksewell@umich.edu                                             UnorderedTrue, QnanException);
12298588Sgblack@eecs.umich.edu                                0x6: c_le_d({{ cond = (Fs_df <= Ft_df); }},
12302686Sksewell@umich.edu                                            UnorderedFalse, QnanException);
12318588Sgblack@eecs.umich.edu                                0x7: c_ngt_d({{ cond = (Fs_df <= Ft_df); }},
12322686Sksewell@umich.edu                                             UnorderedTrue, QnanException);
12332602SN/A                            }
12342602SN/A                        }
12356384Sgblack@eecs.umich.edu                        default: CP1Unimpl::unknown();
12362101SN/A                    }
12375222Sksewell@umich.edu                    0x2: CP1Unimpl::unknown();
12385222Sksewell@umich.edu                    0x3: CP1Unimpl::unknown();
12395222Sksewell@umich.edu                    0x7: CP1Unimpl::unknown();
12402027SN/A
12416384Sgblack@eecs.umich.edu                    //Table A-16 MIPS32 COP1 Encoding of Function 
12426384Sgblack@eecs.umich.edu                    //Field When rs=W
12432101SN/A                    0x4: decode FUNCTION {
12442605SN/A                        format FloatConvertOp {
12458588Sgblack@eecs.umich.edu                            0x20: cvt_s_w({{ val = Fs_uw; }}, ToSingle);
12468588Sgblack@eecs.umich.edu                            0x21: cvt_d_w({{ val = Fs_uw; }}, ToDouble);
12475222Sksewell@umich.edu                            0x26: CP1Unimpl::cvt_ps_w();
12482101SN/A                        }
12496384Sgblack@eecs.umich.edu                        default: CP1Unimpl::unknown();
12502101SN/A                    }
12512027SN/A
12526384Sgblack@eecs.umich.edu                    //Table A-16 MIPS32 COP1 Encoding of Function Field
12536384Sgblack@eecs.umich.edu                    //When rs=L1
12546384Sgblack@eecs.umich.edu                    //Note: "1. Format type L is legal only if 64-bit
12556384Sgblack@eecs.umich.edu                    //floating point operations are enabled."
12568695Sguodeyuan@tsinghua.org.cn                    0x5: decode FUNCTION {
12572686Sksewell@umich.edu                        format FloatConvertOp {
12588588Sgblack@eecs.umich.edu                            0x20: cvt_s_l({{ val = Fs_ud; }}, ToSingle);
12598588Sgblack@eecs.umich.edu                            0x21: cvt_d_l({{ val = Fs_ud; }}, ToDouble);
12605222Sksewell@umich.edu                            0x26: CP1Unimpl::cvt_ps_l();
12612101SN/A                        }
12626384Sgblack@eecs.umich.edu                        default: CP1Unimpl::unknown();
12632101SN/A                    }
12642101SN/A
12656384Sgblack@eecs.umich.edu                    //Table A-17 MIPS64 COP1 Encoding of Function Field
12666384Sgblack@eecs.umich.edu                    //When rs=PS1
12676384Sgblack@eecs.umich.edu                    //Note: "1. Format type PS is legal only if 64-bit
12686384Sgblack@eecs.umich.edu                    //floating point operations are enabled. "
12692572SN/A                    0x6: decode FUNCTION_HI {
12702572SN/A                        0x0: decode FUNCTION_LO {
12712101SN/A                            format Float64Op {
12722605SN/A                                0x0: add_ps({{
12738588Sgblack@eecs.umich.edu                                    Fd1_sf = Fs1_sf + Ft2_sf;
12748588Sgblack@eecs.umich.edu                                    Fd2_sf = Fs2_sf + Ft2_sf;
12752101SN/A                                }});
12762605SN/A                                0x1: sub_ps({{
12778588Sgblack@eecs.umich.edu                                    Fd1_sf = Fs1_sf - Ft2_sf;
12788588Sgblack@eecs.umich.edu                                    Fd2_sf = Fs2_sf - Ft2_sf;
12792101SN/A                                }});
12802605SN/A                                0x2: mul_ps({{
12818588Sgblack@eecs.umich.edu                                    Fd1_sf = Fs1_sf * Ft2_sf;
12828588Sgblack@eecs.umich.edu                                    Fd2_sf = Fs2_sf * Ft2_sf;
12832101SN/A                                }});
12842605SN/A                                0x5: abs_ps({{
12858588Sgblack@eecs.umich.edu                                    Fd1_sf = fabs(Fs1_sf);
12868588Sgblack@eecs.umich.edu                                    Fd2_sf = fabs(Fs2_sf);
12872101SN/A                                }});
12882605SN/A                                0x6: mov_ps({{
12898588Sgblack@eecs.umich.edu                                    Fd1_sf = Fs1_sf;
12908588Sgblack@eecs.umich.edu                                    Fd2_sf = Fs2_sf;
12912101SN/A                                }});
12922605SN/A                                0x7: neg_ps({{
12938588Sgblack@eecs.umich.edu                                    Fd1_sf = -(Fs1_sf);
12948588Sgblack@eecs.umich.edu                                    Fd2_sf = -(Fs2_sf);
12952101SN/A                                }});
12966384Sgblack@eecs.umich.edu                                default: CP1Unimpl::unknown();
12972101SN/A                            }
12982101SN/A                        }
12995222Sksewell@umich.edu                        0x1: CP1Unimpl::unknown();
13002572SN/A                        0x2: decode FUNCTION_LO {
13012101SN/A                            0x1: decode MOVCF {
13022101SN/A                                format Float64Op {
13032607SN/A                                    0x0: movf_ps({{
13042686Sksewell@umich.edu                                        Fd1 = (getCondCode(FCSR, CC) == 0) ?
13052686Sksewell@umich.edu                                            Fs1 : Fd1;
13062686Sksewell@umich.edu                                        Fd2 = (getCondCode(FCSR, CC+1) == 0) ?
13072686Sksewell@umich.edu                                            Fs2 : Fd2;
13082607SN/A                                    }});
13092607SN/A                                    0x1: movt_ps({{
13102686Sksewell@umich.edu                                        Fd2 = (getCondCode(FCSR, CC) == 1) ?
13112686Sksewell@umich.edu                                            Fs1 : Fd1;
13122686Sksewell@umich.edu                                        Fd2 = (getCondCode(FCSR, CC+1) == 1) ?
13132686Sksewell@umich.edu                                            Fs2 : Fd2;
13142607SN/A                                    }});
13152101SN/A                                }
13162101SN/A                            }
13172101SN/A
13182605SN/A                            format Float64Op {
13192607SN/A                                0x2: movz_ps({{
13202686Sksewell@umich.edu                                    Fd1 = (getCondCode(FCSR, CC) == 0) ?
13212686Sksewell@umich.edu                                        Fs1 : Fd1;
13222686Sksewell@umich.edu                                    Fd2 = (getCondCode(FCSR, CC) == 0) ?
13232686Sksewell@umich.edu                                        Fs2 : Fd2;
13242607SN/A                                }});
13252607SN/A                                0x3: movn_ps({{
13262686Sksewell@umich.edu                                    Fd1 = (getCondCode(FCSR, CC) == 1) ?
13272686Sksewell@umich.edu                                        Fs1 : Fd1;
13282686Sksewell@umich.edu                                    Fd2 = (getCondCode(FCSR, CC) == 1) ?
13292686Sksewell@umich.edu                                        Fs2 : Fd2;
13302607SN/A                                }});
13312135SN/A                            }
13326384Sgblack@eecs.umich.edu                            default: CP1Unimpl::unknown();
13332101SN/A                        }
13345222Sksewell@umich.edu                        0x3: CP1Unimpl::unknown();
13352572SN/A                        0x4: decode FUNCTION_LO {
13368588Sgblack@eecs.umich.edu                            0x0: FloatOp::cvt_s_pu({{ Fd_sf = Fs2_sf; }});
13375222Sksewell@umich.edu                            default: CP1Unimpl::unknown();
13382101SN/A                        }
13392101SN/A
13402572SN/A                        0x5: decode FUNCTION_LO {
13418588Sgblack@eecs.umich.edu                            0x0: FloatOp::cvt_s_pl({{ Fd_sf = Fs1_sf; }});
13422101SN/A                            format Float64Op {
13436384Sgblack@eecs.umich.edu                                0x4: pll({{
13448588Sgblack@eecs.umich.edu                                    Fd_ud = (uint64_t)Fs1_uw << 32 | Ft1_uw;
13456384Sgblack@eecs.umich.edu                                }});
13466384Sgblack@eecs.umich.edu                                0x5: plu({{
13478588Sgblack@eecs.umich.edu                                    Fd_ud = (uint64_t)Fs1_uw << 32 | Ft2_uw;
13486384Sgblack@eecs.umich.edu                                }});
13496384Sgblack@eecs.umich.edu                                0x6: pul({{
13508588Sgblack@eecs.umich.edu                                    Fd_ud = (uint64_t)Fs2_uw << 32 | Ft1_uw;
13516384Sgblack@eecs.umich.edu                                }});
13526384Sgblack@eecs.umich.edu                                0x7: puu({{
13538588Sgblack@eecs.umich.edu                                    Fd_ud = (uint64_t)Fs2_uw << 32 | Ft2_uw;
13546384Sgblack@eecs.umich.edu                                }});
13552101SN/A                            }
13565222Sksewell@umich.edu                            default: CP1Unimpl::unknown();
13572101SN/A                        }
13582602SN/A
13592602SN/A                        0x6: decode FUNCTION_LO {
13602608SN/A                            format FloatPSCompareOp {
13612686Sksewell@umich.edu                                0x0: c_f_ps({{ cond1 = 0; }}, {{ cond2 = 0; }},
13622686Sksewell@umich.edu                                            UnorderedFalse);
13632686Sksewell@umich.edu                                0x1: c_un_ps({{ cond1 = 0; }}, {{ cond2 = 0; }},
13642686Sksewell@umich.edu                                             UnorderedTrue);
13658588Sgblack@eecs.umich.edu                                0x2: c_eq_ps({{ cond1 = (Fs1_sf == Ft1_sf); }},
13668588Sgblack@eecs.umich.edu                                             {{ cond2 = (Fs2_sf == Ft2_sf); }},
13672686Sksewell@umich.edu                                             UnorderedFalse);
13688588Sgblack@eecs.umich.edu                                0x3: c_ueq_ps({{ cond1 = (Fs1_sf == Ft1_sf); }},
13698588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf == Ft2_sf); }},
13702686Sksewell@umich.edu                                              UnorderedTrue);
13718588Sgblack@eecs.umich.edu                                0x4: c_olt_ps({{ cond1 = (Fs1_sf < Ft1_sf); }},
13728588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf < Ft2_sf); }},
13732686Sksewell@umich.edu                                              UnorderedFalse);
13748588Sgblack@eecs.umich.edu                                0x5: c_ult_ps({{ cond1 = (Fs_sf < Ft_sf); }},
13758588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf < Ft2_sf); }},
13762686Sksewell@umich.edu                                              UnorderedTrue);
13778588Sgblack@eecs.umich.edu                                0x6: c_ole_ps({{ cond1 = (Fs_sf <= Ft_sf); }},
13788588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf <= Ft2_sf); }},
13792686Sksewell@umich.edu                                              UnorderedFalse);
13808588Sgblack@eecs.umich.edu                                0x7: c_ule_ps({{ cond1 = (Fs1_sf <= Ft1_sf); }},
13818588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf <= Ft2_sf); }},
13822686Sksewell@umich.edu                                              UnorderedTrue);
13832602SN/A                            }
13842602SN/A                        }
13852602SN/A
13862602SN/A                        0x7: decode FUNCTION_LO {
13872686Sksewell@umich.edu                            format FloatPSCompareOp {
13882686Sksewell@umich.edu                                0x0: c_sf_ps({{ cond1 = 0; }}, {{ cond2 = 0; }},
13892686Sksewell@umich.edu                                             UnorderedFalse, QnanException);
13902686Sksewell@umich.edu                                0x1: c_ngle_ps({{ cond1 = 0; }},
13912686Sksewell@umich.edu                                               {{ cond2 = 0; }},
13922686Sksewell@umich.edu                                               UnorderedTrue, QnanException);
13938588Sgblack@eecs.umich.edu                                0x2: c_seq_ps({{ cond1 = (Fs1_sf == Ft1_sf); }},
13948588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf == Ft2_sf); }},
13952686Sksewell@umich.edu                                              UnorderedFalse, QnanException);
13968588Sgblack@eecs.umich.edu                                0x3: c_ngl_ps({{ cond1 = (Fs1_sf == Ft1_sf); }},
13978588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf == Ft2_sf); }},
13982686Sksewell@umich.edu                                              UnorderedTrue, QnanException);
13998588Sgblack@eecs.umich.edu                                0x4: c_lt_ps({{ cond1 = (Fs1_sf < Ft1_sf); }},
14008588Sgblack@eecs.umich.edu                                             {{ cond2 = (Fs2_sf < Ft2_sf); }},
14012686Sksewell@umich.edu                                             UnorderedFalse, QnanException);
14028588Sgblack@eecs.umich.edu                                0x5: c_nge_ps({{ cond1 = (Fs1_sf < Ft1_sf); }},
14038588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf < Ft2_sf); }},
14042686Sksewell@umich.edu                                              UnorderedTrue, QnanException);
14058588Sgblack@eecs.umich.edu                                0x6: c_le_ps({{ cond1 = (Fs1_sf <= Ft1_sf); }},
14068588Sgblack@eecs.umich.edu                                             {{ cond2 = (Fs2_sf <= Ft2_sf); }},
14072686Sksewell@umich.edu                                             UnorderedFalse, QnanException);
14088588Sgblack@eecs.umich.edu                                0x7: c_ngt_ps({{ cond1 = (Fs1_sf <= Ft1_sf); }},
14098588Sgblack@eecs.umich.edu                                              {{ cond2 = (Fs2_sf <= Ft2_sf); }},
14102686Sksewell@umich.edu                                              UnorderedTrue, QnanException);
14112602SN/A                            }
14122602SN/A                        }
14132101SN/A                    }
14142101SN/A                }
14156384Sgblack@eecs.umich.edu                default: CP1Unimpl::unknown();
14162101SN/A            }
14172101SN/A        }
14182101SN/A
14192101SN/A        //Table A-19 MIPS32 COP2 Encoding of rs Field
14202101SN/A        0x2: decode RS_MSB {
14215222Sksewell@umich.edu            format CP2Unimpl {
14222686Sksewell@umich.edu                0x0: decode RS_HI {
14232686Sksewell@umich.edu                    0x0: decode RS_LO {
14242101SN/A                        0x0: mfc2();
14252101SN/A                        0x2: cfc2();
14262101SN/A                        0x3: mfhc2();
14272101SN/A                        0x4: mtc2();
14282101SN/A                        0x6: ctc2();
14292101SN/A                        0x7: mftc2();
14306384Sgblack@eecs.umich.edu                        default: unknown();
14312101SN/A                    }
14322101SN/A
14332686Sksewell@umich.edu                    0x1: decode ND {
14342686Sksewell@umich.edu                        0x0: decode TF {
14352101SN/A                            0x0: bc2f();
14362101SN/A                            0x1: bc2t();
14376384Sgblack@eecs.umich.edu                            default: unknown();
14382101SN/A                        }
14392101SN/A
14402686Sksewell@umich.edu                        0x1: decode TF {
14412101SN/A                            0x0: bc2fl();
14422101SN/A                            0x1: bc2tl();
14436384Sgblack@eecs.umich.edu                            default: unknown();
14442101SN/A                        }
14456384Sgblack@eecs.umich.edu                        default: unknown();
14465222Sksewell@umich.edu
14476384Sgblack@eecs.umich.edu                    }
14486384Sgblack@eecs.umich.edu                    default: unknown();
14496384Sgblack@eecs.umich.edu                }
14506384Sgblack@eecs.umich.edu                default: unknown();
14512101SN/A            }
14522101SN/A        }
14532101SN/A
14542101SN/A        //Table A-20 MIPS64 COP1X Encoding of Function Field 1
14552101SN/A        //Note: "COP1X instructions are legal only if 64-bit floating point
14562101SN/A        //operations are enabled."
14572101SN/A        0x3: decode FUNCTION_HI {
14582101SN/A            0x0: decode FUNCTION_LO {
14592686Sksewell@umich.edu                format LoadIndexedMemory {
14608588Sgblack@eecs.umich.edu                    0x0: lwxc1({{ Fd_uw = Mem_uw; }});
14618588Sgblack@eecs.umich.edu                    0x1: ldxc1({{ Fd_ud = Mem_ud; }});
14628588Sgblack@eecs.umich.edu                    0x5: luxc1({{ Fd_ud = Mem_ud; }},
14632742Sksewell@umich.edu                               {{ EA = (Rs + Rt) & ~7; }});
14642101SN/A                }
14652043SN/A            }
14662027SN/A
14672101SN/A            0x1: decode FUNCTION_LO {
14682686Sksewell@umich.edu                format StoreIndexedMemory {
14698588Sgblack@eecs.umich.edu                    0x0: swxc1({{ Mem_uw = Fs_uw; }});
14708588Sgblack@eecs.umich.edu                    0x1: sdxc1({{ Mem_ud = Fs_ud; }});
14718588Sgblack@eecs.umich.edu                    0x5: suxc1({{ Mem_ud = Fs_ud; }},
14722742Sksewell@umich.edu                               {{ EA = (Rs + Rt) & ~7; }});
14732046SN/A                }
14742686Sksewell@umich.edu                0x7: Prefetch::prefx({{ EA = Rs + Rt; }});
14752101SN/A            }
14762027SN/A
14772686Sksewell@umich.edu            0x3: decode FUNCTION_LO {
14786384Sgblack@eecs.umich.edu                0x6: Float64Op::alnv_ps({{
14796384Sgblack@eecs.umich.edu                    if (Rs<2:0> == 0) {
14808588Sgblack@eecs.umich.edu                        Fd_ud = Fs_ud;
14816384Sgblack@eecs.umich.edu                    } else if (Rs<2:0> == 4) {
14828564Sgblack@eecs.umich.edu                        if (GuestByteOrder == BigEndianByteOrder)
14838588Sgblack@eecs.umich.edu                            Fd_ud = Fs_ud<31:0> << 32 | Ft_ud<63:32>;
14848564Sgblack@eecs.umich.edu                        else
14858588Sgblack@eecs.umich.edu                            Fd_ud = Ft_ud<31:0> << 32 | Fs_ud<63:32>;
14866384Sgblack@eecs.umich.edu                    } else {
14878588Sgblack@eecs.umich.edu                        Fd_ud = Fd_ud;
14886384Sgblack@eecs.umich.edu                    }
14896384Sgblack@eecs.umich.edu                }});
14902686Sksewell@umich.edu            }
14912027SN/A
14922686Sksewell@umich.edu            format FloatAccOp {
14932686Sksewell@umich.edu                0x4: decode FUNCTION_LO {
14948588Sgblack@eecs.umich.edu                    0x0: madd_s({{ Fd_sf = (Fs_sf * Ft_sf) + Fr_sf; }});
14958588Sgblack@eecs.umich.edu                    0x1: madd_d({{ Fd_df = (Fs_df * Ft_df) + Fr_df; }});
14962686Sksewell@umich.edu                    0x6: madd_ps({{
14978588Sgblack@eecs.umich.edu                        Fd1_sf = (Fs1_df * Ft1_df) + Fr1_df;
14988588Sgblack@eecs.umich.edu                        Fd2_sf = (Fs2_df * Ft2_df) + Fr2_df;
14992686Sksewell@umich.edu                    }});
15002686Sksewell@umich.edu                }
15012027SN/A
15022686Sksewell@umich.edu                0x5: decode FUNCTION_LO {
15038588Sgblack@eecs.umich.edu                    0x0: msub_s({{ Fd_sf = (Fs_sf * Ft_sf) - Fr_sf; }});
15048588Sgblack@eecs.umich.edu                    0x1: msub_d({{ Fd_df = (Fs_df * Ft_df) - Fr_df; }});
15052686Sksewell@umich.edu                    0x6: msub_ps({{
15068588Sgblack@eecs.umich.edu                        Fd1_sf = (Fs1_df * Ft1_df) - Fr1_df;
15078588Sgblack@eecs.umich.edu                        Fd2_sf = (Fs2_df * Ft2_df) - Fr2_df;
15082686Sksewell@umich.edu                    }});
15092686Sksewell@umich.edu                }
15102027SN/A
15112686Sksewell@umich.edu                0x6: decode FUNCTION_LO {
15128588Sgblack@eecs.umich.edu                    0x0: nmadd_s({{ Fd_sf = (-1 * Fs_sf * Ft_sf) - Fr_sf; }});
15138588Sgblack@eecs.umich.edu                    0x1: nmadd_d({{ Fd_df = (-1 * Fs_df * Ft_df) - Fr_df; }});
15142686Sksewell@umich.edu                    0x6: nmadd_ps({{
15158588Sgblack@eecs.umich.edu                        Fd1_sf = -((Fs1_df * Ft1_df) + Fr1_df);
15168588Sgblack@eecs.umich.edu                        Fd2_sf = -((Fs2_df * Ft2_df) + Fr2_df);
15172686Sksewell@umich.edu                    }});
15182686Sksewell@umich.edu                }
15192027SN/A
15202686Sksewell@umich.edu                0x7: decode FUNCTION_LO {
15218588Sgblack@eecs.umich.edu                    0x0: nmsub_s({{ Fd_sf = (-1 * Fs_sf * Ft_sf) + Fr_sf; }});
15228588Sgblack@eecs.umich.edu                    0x1: nmsub_d({{ Fd_df = (-1 * Fs_df * Ft_df) + Fr_df; }});
15232686Sksewell@umich.edu                    0x6: nmsub_ps({{
15248588Sgblack@eecs.umich.edu                        Fd1_sf = -((Fs1_df * Ft1_df) - Fr1_df);
15258588Sgblack@eecs.umich.edu                        Fd2_sf = -((Fs2_df * Ft2_df) - Fr2_df);
15262686Sksewell@umich.edu                    }});
15272046SN/A                }
15282101SN/A            }
15292043SN/A        }
15302025SN/A
15312686Sksewell@umich.edu        format Branch {
15328588Sgblack@eecs.umich.edu            0x4: beql({{ cond = (Rs_sw == Rt_sw); }}, Likely);
15338588Sgblack@eecs.umich.edu            0x5: bnel({{ cond = (Rs_sw != Rt_sw); }}, Likely);
15348588Sgblack@eecs.umich.edu            0x6: blezl({{ cond = (Rs_sw <= 0); }}, Likely);
15358588Sgblack@eecs.umich.edu            0x7: bgtzl({{ cond = (Rs_sw > 0); }}, Likely);
15362046SN/A        }
15372084SN/A    }
15382024SN/A
15392686Sksewell@umich.edu    0x3: decode OPCODE_LO {
15402043SN/A        //Table A-5 MIPS32 SPECIAL2 Encoding of Function Field
15412043SN/A        0x4: decode FUNCTION_HI {
15422686Sksewell@umich.edu            0x0: decode FUNCTION_LO {
15436384Sgblack@eecs.umich.edu                0x2: IntOp::mul({{
15448588Sgblack@eecs.umich.edu                    int64_t temp1 = Rs_sd * Rt_sd;
15458588Sgblack@eecs.umich.edu                    Rd_sw = temp1<31:0>;
15466384Sgblack@eecs.umich.edu                }}, IntMultOp);
15472027SN/A
15484661Sksewell@umich.edu                format HiLoRdSelValOp {
15496384Sgblack@eecs.umich.edu                    0x0: madd({{
15506384Sgblack@eecs.umich.edu                        val = ((int64_t)HI_RD_SEL << 32 | LO_RD_SEL) +
15518588Sgblack@eecs.umich.edu                              (Rs_sd * Rt_sd);
15526384Sgblack@eecs.umich.edu                    }}, IntMultOp);
15536384Sgblack@eecs.umich.edu                    0x1: maddu({{
15546384Sgblack@eecs.umich.edu                        val = ((uint64_t)HI_RD_SEL << 32 | LO_RD_SEL) +
15558588Sgblack@eecs.umich.edu                              (Rs_ud * Rt_ud);
15566384Sgblack@eecs.umich.edu                    }}, IntMultOp);
15576384Sgblack@eecs.umich.edu                    0x4: msub({{
15586384Sgblack@eecs.umich.edu                        val = ((int64_t)HI_RD_SEL << 32 | LO_RD_SEL) -
15598588Sgblack@eecs.umich.edu                              (Rs_sd * Rt_sd);
15606384Sgblack@eecs.umich.edu                    }}, IntMultOp);
15616384Sgblack@eecs.umich.edu                    0x5: msubu({{
15626384Sgblack@eecs.umich.edu                        val = ((uint64_t)HI_RD_SEL << 32 | LO_RD_SEL) -
15638588Sgblack@eecs.umich.edu                              (Rs_ud * Rt_ud);
15646384Sgblack@eecs.umich.edu                    }}, IntMultOp);
15652043SN/A                }
15662043SN/A            }
15672027SN/A
15682043SN/A            0x4: decode FUNCTION_LO {
15692101SN/A                format BasicOp {
15706384Sgblack@eecs.umich.edu                    0x0: clz({{
15716384Sgblack@eecs.umich.edu                        int cnt = 32;
15726384Sgblack@eecs.umich.edu                        for (int idx = 31; idx >= 0; idx--) {
15736384Sgblack@eecs.umich.edu                            if (Rs<idx:idx> == 1) {
15746384Sgblack@eecs.umich.edu                                cnt = 31 - idx;
15756384Sgblack@eecs.umich.edu                                break;
15766384Sgblack@eecs.umich.edu                            }
15776384Sgblack@eecs.umich.edu                        }
15788588Sgblack@eecs.umich.edu                        Rd_uw = cnt;
15796384Sgblack@eecs.umich.edu                    }});
15806384Sgblack@eecs.umich.edu                    0x1: clo({{
15816384Sgblack@eecs.umich.edu                        int cnt = 32;
15826384Sgblack@eecs.umich.edu                        for (int idx = 31; idx >= 0; idx--) {
15836384Sgblack@eecs.umich.edu                            if (Rs<idx:idx> == 0) {
15846384Sgblack@eecs.umich.edu                                cnt = 31 - idx;
15856384Sgblack@eecs.umich.edu                                break;
15866384Sgblack@eecs.umich.edu                            }
15876384Sgblack@eecs.umich.edu                        }
15888588Sgblack@eecs.umich.edu                        Rd_uw = cnt;
15896384Sgblack@eecs.umich.edu                    }});
15902101SN/A                }
15912043SN/A            }
15922027SN/A
15932043SN/A            0x7: decode FUNCTION_LO {
15942686Sksewell@umich.edu                0x7: FailUnimpl::sdbbp();
15952043SN/A            }
15962043SN/A        }
15972024SN/A
15982686Sksewell@umich.edu        //Table A-6 MIPS32 SPECIAL3 Encoding of Function Field for Release 2
15992686Sksewell@umich.edu        //of the Architecture
16002043SN/A        0x7: decode FUNCTION_HI {
16012101SN/A            0x0: decode FUNCTION_LO {
16022686Sksewell@umich.edu                format BasicOp {
16038588Sgblack@eecs.umich.edu                    0x0: ext({{ Rt_uw = bits(Rs_uw, MSB+LSB, LSB); }});
16046384Sgblack@eecs.umich.edu                    0x4: ins({{
16058588Sgblack@eecs.umich.edu                        Rt_uw = bits(Rt_uw, 31, MSB+1) << (MSB+1) |
16068588Sgblack@eecs.umich.edu                                bits(Rs_uw, MSB-LSB, 0) << LSB |
16078588Sgblack@eecs.umich.edu                                bits(Rt_uw, LSB-1, 0);
16086384Sgblack@eecs.umich.edu                    }});
16092046SN/A                }
16102101SN/A            }
16112026SN/A
16122101SN/A            0x1: decode FUNCTION_LO {
16134661Sksewell@umich.edu                format MT_Control {
16146384Sgblack@eecs.umich.edu                    0x0: fork({{
16156384Sgblack@eecs.umich.edu                        forkThread(xc->tcBase(), fault, RD, Rs, Rt);
16166384Sgblack@eecs.umich.edu                    }}, UserMode);
16176384Sgblack@eecs.umich.edu                    0x1: yield({{
16188588Sgblack@eecs.umich.edu                        Rd_sw = yieldThread(xc->tcBase(), fault, Rs_sw,
16196384Sgblack@eecs.umich.edu                                            YQMask);
16206384Sgblack@eecs.umich.edu                    }}, UserMode);
16214661Sksewell@umich.edu                }
16224661Sksewell@umich.edu
16234661Sksewell@umich.edu                //Table 5-9 MIPS32 LX Encoding of the op Field (DSP ASE MANUAL)
16244661Sksewell@umich.edu                0x2: decode OP_HI {
16254661Sksewell@umich.edu                    0x0: decode OP_LO {
16264661Sksewell@umich.edu                        format LoadIndexedMemory {
16278588Sgblack@eecs.umich.edu                            0x0: lwx({{ Rd_sw = Mem_sw; }});
16288588Sgblack@eecs.umich.edu                            0x4: lhx({{ Rd_sw = Mem_sh; }});
16298588Sgblack@eecs.umich.edu                            0x6: lbux({{ Rd_uw = Mem_ub; }});
16304661Sksewell@umich.edu                        }
16314661Sksewell@umich.edu                    }
16324661Sksewell@umich.edu                }
16336384Sgblack@eecs.umich.edu                0x4: DspIntOp::insv({{
16346384Sgblack@eecs.umich.edu                    int pos = dspctl<5:0>;
16356384Sgblack@eecs.umich.edu                    int size = dspctl<12:7> - 1;
16368588Sgblack@eecs.umich.edu                    Rt_uw = insertBits(Rt_uw, pos+size,
16378588Sgblack@eecs.umich.edu                                       pos, Rs_uw<size:0>);
16386384Sgblack@eecs.umich.edu                }});
16394661Sksewell@umich.edu            }
16404661Sksewell@umich.edu
16414661Sksewell@umich.edu            0x2: decode FUNCTION_LO {
16424661Sksewell@umich.edu
16436384Sgblack@eecs.umich.edu                //Table 5-5 MIPS32 ADDU.QB Encoding of the op Field
16446384Sgblack@eecs.umich.edu                //(DSP ASE MANUAL)
16454661Sksewell@umich.edu                0x0: decode OP_HI {
16464661Sksewell@umich.edu                    0x0: decode OP_LO {
16474661Sksewell@umich.edu                        format DspIntOp {
16486384Sgblack@eecs.umich.edu                            0x0: addu_qb({{
16498588Sgblack@eecs.umich.edu                                Rd_uw = dspAdd(Rs_uw, Rt_uw, SIMD_FMT_QB,
16506384Sgblack@eecs.umich.edu                                               NOSATURATE, UNSIGNED, &dspctl);
16516384Sgblack@eecs.umich.edu                            }});
16526384Sgblack@eecs.umich.edu                            0x1: subu_qb({{
16538588Sgblack@eecs.umich.edu                                Rd_uw = dspSub(Rs_uw, Rt_uw, SIMD_FMT_QB,
16546384Sgblack@eecs.umich.edu                                               NOSATURATE, UNSIGNED, &dspctl);
16556384Sgblack@eecs.umich.edu                            }});
16566384Sgblack@eecs.umich.edu                            0x4: addu_s_qb({{
16578588Sgblack@eecs.umich.edu                                Rd_uw = dspAdd(Rs_uw, Rt_uw, SIMD_FMT_QB,
16586384Sgblack@eecs.umich.edu                                               SATURATE, UNSIGNED, &dspctl);
16596384Sgblack@eecs.umich.edu                            }});
16606384Sgblack@eecs.umich.edu                            0x5: subu_s_qb({{
16618588Sgblack@eecs.umich.edu                                Rd_uw = dspSub(Rs_uw, Rt_uw, SIMD_FMT_QB,
16626384Sgblack@eecs.umich.edu                                               SATURATE, UNSIGNED, &dspctl);
16636384Sgblack@eecs.umich.edu                            }});
16646384Sgblack@eecs.umich.edu                            0x6: muleu_s_ph_qbl({{
16658588Sgblack@eecs.umich.edu                                Rd_uw = dspMuleu(Rs_uw, Rt_uw,
16666384Sgblack@eecs.umich.edu                                                 MODE_L, &dspctl);
16676384Sgblack@eecs.umich.edu                            }}, IntMultOp);
16686384Sgblack@eecs.umich.edu                            0x7: muleu_s_ph_qbr({{
16698588Sgblack@eecs.umich.edu                                Rd_uw = dspMuleu(Rs_uw, Rt_uw,
16706384Sgblack@eecs.umich.edu                                                 MODE_R, &dspctl);
16716384Sgblack@eecs.umich.edu                            }}, IntMultOp);
16724661Sksewell@umich.edu                        }
16734661Sksewell@umich.edu                    }
16744661Sksewell@umich.edu                    0x1: decode OP_LO {
16754661Sksewell@umich.edu                        format DspIntOp {
16766384Sgblack@eecs.umich.edu                            0x0: addu_ph({{
16778588Sgblack@eecs.umich.edu                                Rd_uw = dspAdd(Rs_uw, Rt_uw, SIMD_FMT_PH,
16786384Sgblack@eecs.umich.edu                                               NOSATURATE, UNSIGNED, &dspctl);
16796384Sgblack@eecs.umich.edu                            }});
16806384Sgblack@eecs.umich.edu                            0x1: subu_ph({{
16818588Sgblack@eecs.umich.edu                                Rd_uw = dspSub(Rs_uw, Rt_uw, SIMD_FMT_PH,
16826384Sgblack@eecs.umich.edu                                               NOSATURATE, UNSIGNED, &dspctl);
16836384Sgblack@eecs.umich.edu                            }});
16846384Sgblack@eecs.umich.edu                            0x2: addq_ph({{
16858588Sgblack@eecs.umich.edu                                Rd_uw = dspAdd(Rs_uw, Rt_uw, SIMD_FMT_PH,
16866384Sgblack@eecs.umich.edu                                               NOSATURATE, SIGNED, &dspctl);
16876384Sgblack@eecs.umich.edu                            }});
16886384Sgblack@eecs.umich.edu                            0x3: subq_ph({{
16898588Sgblack@eecs.umich.edu                                Rd_uw = dspSub(Rs_uw, Rt_uw, SIMD_FMT_PH,
16906384Sgblack@eecs.umich.edu                                               NOSATURATE, SIGNED, &dspctl);
16916384Sgblack@eecs.umich.edu                            }});
16926384Sgblack@eecs.umich.edu                            0x4: addu_s_ph({{
16938588Sgblack@eecs.umich.edu                                Rd_uw = dspAdd(Rs_uw, Rt_uw, SIMD_FMT_PH,
16946384Sgblack@eecs.umich.edu                                               SATURATE, UNSIGNED, &dspctl);
16956384Sgblack@eecs.umich.edu                            }});
16966384Sgblack@eecs.umich.edu                            0x5: subu_s_ph({{
16978588Sgblack@eecs.umich.edu                                Rd_uw = dspSub(Rs_uw, Rt_uw, SIMD_FMT_PH,
16986384Sgblack@eecs.umich.edu                                               SATURATE, UNSIGNED, &dspctl);
16996384Sgblack@eecs.umich.edu                            }});
17006384Sgblack@eecs.umich.edu                            0x6: addq_s_ph({{
17018588Sgblack@eecs.umich.edu                                Rd_uw = dspAdd(Rs_uw, Rt_uw, SIMD_FMT_PH,
17026384Sgblack@eecs.umich.edu                                               SATURATE, SIGNED, &dspctl);
17036384Sgblack@eecs.umich.edu                            }});
17046384Sgblack@eecs.umich.edu                            0x7: subq_s_ph({{
17058588Sgblack@eecs.umich.edu                                Rd_uw = dspSub(Rs_uw, Rt_uw, SIMD_FMT_PH,
17066384Sgblack@eecs.umich.edu                                               SATURATE, SIGNED, &dspctl);
17076384Sgblack@eecs.umich.edu                            }});
17084661Sksewell@umich.edu                        }
17094661Sksewell@umich.edu                    }
17104661Sksewell@umich.edu                    0x2: decode OP_LO {
17114661Sksewell@umich.edu                        format DspIntOp {
17126384Sgblack@eecs.umich.edu                            0x0: addsc({{
17136384Sgblack@eecs.umich.edu                                int64_t dresult;
17148588Sgblack@eecs.umich.edu                                dresult = Rs_ud + Rt_ud;
17158588Sgblack@eecs.umich.edu                                Rd_sw = dresult<31:0>;
17166384Sgblack@eecs.umich.edu                                dspctl = insertBits(dspctl, 13, 13,
17176384Sgblack@eecs.umich.edu                                                    dresult<32:32>);
17186384Sgblack@eecs.umich.edu                            }});
17196384Sgblack@eecs.umich.edu                            0x1: addwc({{
17206384Sgblack@eecs.umich.edu                                int64_t dresult;
17218588Sgblack@eecs.umich.edu                                dresult = Rs_sd + Rt_sd + dspctl<13:13>;
17228588Sgblack@eecs.umich.edu                                Rd_sw = dresult<31:0>;
17236384Sgblack@eecs.umich.edu                                if (dresult<32:32> != dresult<31:31>)
17246384Sgblack@eecs.umich.edu                                    dspctl = insertBits(dspctl, 20, 20, 1);
17256384Sgblack@eecs.umich.edu                            }});
17266384Sgblack@eecs.umich.edu                            0x2: modsub({{
17278588Sgblack@eecs.umich.edu                                Rd_sw = (Rs_sw == 0) ? Rt_sw<23:8> :
17288588Sgblack@eecs.umich.edu                                                       Rs_sw - Rt_sw<7:0>;
17296384Sgblack@eecs.umich.edu                            }});
17306384Sgblack@eecs.umich.edu                            0x4: raddu_w_qb({{
17318588Sgblack@eecs.umich.edu                                Rd_uw = Rs_uw<31:24> + Rs_uw<23:16> +
17328588Sgblack@eecs.umich.edu                                        Rs_uw<15:8> + Rs_uw<7:0>;
17336384Sgblack@eecs.umich.edu                            }});
17346384Sgblack@eecs.umich.edu                            0x6: addq_s_w({{
17358588Sgblack@eecs.umich.edu                                Rd_sw = dspAdd(Rs_sw, Rt_sw, SIMD_FMT_W,
17366384Sgblack@eecs.umich.edu                                               SATURATE, SIGNED, &dspctl);
17376384Sgblack@eecs.umich.edu                            }});
17386384Sgblack@eecs.umich.edu                            0x7: subq_s_w({{
17398588Sgblack@eecs.umich.edu                                Rd_sw = dspSub(Rs_sw, Rt_sw, SIMD_FMT_W,
17406384Sgblack@eecs.umich.edu                                               SATURATE, SIGNED, &dspctl);
17416384Sgblack@eecs.umich.edu                            }});
17424661Sksewell@umich.edu                        }
17434661Sksewell@umich.edu                    }
17444661Sksewell@umich.edu                    0x3: decode OP_LO {
17454661Sksewell@umich.edu                        format DspIntOp {
17466384Sgblack@eecs.umich.edu                            0x4: muleq_s_w_phl({{
17478588Sgblack@eecs.umich.edu                                Rd_sw = dspMuleq(Rs_sw, Rt_sw,
17486384Sgblack@eecs.umich.edu                                                 MODE_L, &dspctl);
17496384Sgblack@eecs.umich.edu                            }}, IntMultOp);
17506384Sgblack@eecs.umich.edu                            0x5: muleq_s_w_phr({{
17518588Sgblack@eecs.umich.edu                                Rd_sw = dspMuleq(Rs_sw, Rt_sw,
17526384Sgblack@eecs.umich.edu                                                 MODE_R, &dspctl);
17536384Sgblack@eecs.umich.edu                            }}, IntMultOp);
17546384Sgblack@eecs.umich.edu                            0x6: mulq_s_ph({{
17558588Sgblack@eecs.umich.edu                                Rd_sw = dspMulq(Rs_sw, Rt_sw, SIMD_FMT_PH,
17566384Sgblack@eecs.umich.edu                                                SATURATE, NOROUND, &dspctl);
17576384Sgblack@eecs.umich.edu                            }}, IntMultOp);
17586384Sgblack@eecs.umich.edu                            0x7: mulq_rs_ph({{
17598588Sgblack@eecs.umich.edu                                Rd_sw = dspMulq(Rs_sw, Rt_sw, SIMD_FMT_PH,
17606384Sgblack@eecs.umich.edu                                                SATURATE, ROUND, &dspctl);
17616384Sgblack@eecs.umich.edu                            }}, IntMultOp);
17624661Sksewell@umich.edu                        }
17634661Sksewell@umich.edu                    }
17644661Sksewell@umich.edu                }
17654661Sksewell@umich.edu
17666384Sgblack@eecs.umich.edu                //Table 5-6 MIPS32 CMPU_EQ_QB Encoding of the op Field
17676384Sgblack@eecs.umich.edu                //(DSP ASE MANUAL)
17684661Sksewell@umich.edu                0x1: decode OP_HI {
17694661Sksewell@umich.edu                    0x0: decode OP_LO {
17704661Sksewell@umich.edu                        format DspIntOp {
17716384Sgblack@eecs.umich.edu                            0x0: cmpu_eq_qb({{
17728588Sgblack@eecs.umich.edu                                dspCmp(Rs_uw, Rt_uw, SIMD_FMT_QB,
17736384Sgblack@eecs.umich.edu                                       UNSIGNED, CMP_EQ, &dspctl);
17746384Sgblack@eecs.umich.edu                            }});
17756384Sgblack@eecs.umich.edu                            0x1: cmpu_lt_qb({{
17768588Sgblack@eecs.umich.edu                                dspCmp(Rs_uw, Rt_uw, SIMD_FMT_QB,
17776384Sgblack@eecs.umich.edu                                       UNSIGNED, CMP_LT, &dspctl);
17786384Sgblack@eecs.umich.edu                            }});
17796384Sgblack@eecs.umich.edu                            0x2: cmpu_le_qb({{
17808588Sgblack@eecs.umich.edu                                dspCmp(Rs_uw, Rt_uw, SIMD_FMT_QB,
17816384Sgblack@eecs.umich.edu                                       UNSIGNED, CMP_LE, &dspctl);
17826384Sgblack@eecs.umich.edu                            }});
17836384Sgblack@eecs.umich.edu                            0x3: pick_qb({{
17848588Sgblack@eecs.umich.edu                                Rd_uw = dspPick(Rs_uw, Rt_uw,
17856384Sgblack@eecs.umich.edu                                                SIMD_FMT_QB, &dspctl);
17866384Sgblack@eecs.umich.edu                            }});
17876384Sgblack@eecs.umich.edu                            0x4: cmpgu_eq_qb({{
17888588Sgblack@eecs.umich.edu                                Rd_uw = dspCmpg(Rs_uw, Rt_uw, SIMD_FMT_QB,
17896384Sgblack@eecs.umich.edu                                                UNSIGNED, CMP_EQ );
17906384Sgblack@eecs.umich.edu                            }});
17916384Sgblack@eecs.umich.edu                            0x5: cmpgu_lt_qb({{
17928588Sgblack@eecs.umich.edu                                Rd_uw = dspCmpg(Rs_uw, Rt_uw, SIMD_FMT_QB,
17936384Sgblack@eecs.umich.edu                                                UNSIGNED, CMP_LT);
17946384Sgblack@eecs.umich.edu                            }});
17956384Sgblack@eecs.umich.edu                            0x6: cmpgu_le_qb({{
17968588Sgblack@eecs.umich.edu                                Rd_uw = dspCmpg(Rs_uw, Rt_uw, SIMD_FMT_QB,
17976384Sgblack@eecs.umich.edu                                                UNSIGNED, CMP_LE);
17986384Sgblack@eecs.umich.edu                            }});
17994661Sksewell@umich.edu                        }
18004661Sksewell@umich.edu                    }
18014661Sksewell@umich.edu                    0x1: decode OP_LO {
18024661Sksewell@umich.edu                        format DspIntOp {
18036384Sgblack@eecs.umich.edu                            0x0: cmp_eq_ph({{
18048588Sgblack@eecs.umich.edu                                dspCmp(Rs_uw, Rt_uw, SIMD_FMT_PH,
18056384Sgblack@eecs.umich.edu                                       SIGNED, CMP_EQ, &dspctl);
18066384Sgblack@eecs.umich.edu                            }});
18076384Sgblack@eecs.umich.edu                            0x1: cmp_lt_ph({{
18088588Sgblack@eecs.umich.edu                                dspCmp(Rs_uw, Rt_uw, SIMD_FMT_PH,
18096384Sgblack@eecs.umich.edu                                       SIGNED, CMP_LT, &dspctl);
18106384Sgblack@eecs.umich.edu                            }});
18116384Sgblack@eecs.umich.edu                            0x2: cmp_le_ph({{
18128588Sgblack@eecs.umich.edu                                dspCmp(Rs_uw, Rt_uw, SIMD_FMT_PH,
18136384Sgblack@eecs.umich.edu                                       SIGNED, CMP_LE, &dspctl);
18146384Sgblack@eecs.umich.edu                            }});
18156384Sgblack@eecs.umich.edu                            0x3: pick_ph({{
18168588Sgblack@eecs.umich.edu                                Rd_uw = dspPick(Rs_uw, Rt_uw,
18176384Sgblack@eecs.umich.edu                                                SIMD_FMT_PH, &dspctl);
18186384Sgblack@eecs.umich.edu                            }});
18196384Sgblack@eecs.umich.edu                            0x4: precrq_qb_ph({{
18208588Sgblack@eecs.umich.edu                                Rd_uw = Rs_uw<31:24> << 24 |
18218588Sgblack@eecs.umich.edu                                        Rs_uw<15:8> << 16 |
18228588Sgblack@eecs.umich.edu                                        Rt_uw<31:24> << 8 |
18238588Sgblack@eecs.umich.edu                                        Rt_uw<15:8>;
18246384Sgblack@eecs.umich.edu                            }});
18256384Sgblack@eecs.umich.edu                            0x5: precr_qb_ph({{
18268588Sgblack@eecs.umich.edu                                Rd_uw = Rs_uw<23:16> << 24 |
18278588Sgblack@eecs.umich.edu                                        Rs_uw<7:0> << 16 |
18288588Sgblack@eecs.umich.edu                                        Rt_uw<23:16> << 8 |
18298588Sgblack@eecs.umich.edu                                        Rt_uw<7:0>;
18306384Sgblack@eecs.umich.edu                            }});
18316384Sgblack@eecs.umich.edu                            0x6: packrl_ph({{
18328588Sgblack@eecs.umich.edu                                Rd_uw = dspPack(Rs_uw, Rt_uw, SIMD_FMT_PH);
18336384Sgblack@eecs.umich.edu                            }});
18346384Sgblack@eecs.umich.edu                            0x7: precrqu_s_qb_ph({{
18358588Sgblack@eecs.umich.edu                                Rd_uw = dspPrecrqu(Rs_uw, Rt_uw, &dspctl);
18366384Sgblack@eecs.umich.edu                            }});
18374661Sksewell@umich.edu                        }
18384661Sksewell@umich.edu                    }
18394661Sksewell@umich.edu                    0x2: decode OP_LO {
18404661Sksewell@umich.edu                        format DspIntOp {
18416384Sgblack@eecs.umich.edu                            0x4: precrq_ph_w({{
18428588Sgblack@eecs.umich.edu                                Rd_uw = Rs_uw<31:16> << 16 | Rt_uw<31:16>;
18436384Sgblack@eecs.umich.edu                            }});
18446384Sgblack@eecs.umich.edu                            0x5: precrq_rs_ph_w({{
18458588Sgblack@eecs.umich.edu                                Rd_uw = dspPrecrq(Rs_uw, Rt_uw,
18466384Sgblack@eecs.umich.edu                                                  SIMD_FMT_W, &dspctl);
18476384Sgblack@eecs.umich.edu                            }});
18484661Sksewell@umich.edu                        }
18494661Sksewell@umich.edu                    }
18504661Sksewell@umich.edu                    0x3: decode OP_LO {
18514661Sksewell@umich.edu                        format DspIntOp {
18526384Sgblack@eecs.umich.edu                            0x0: cmpgdu_eq_qb({{
18538588Sgblack@eecs.umich.edu                                Rd_uw = dspCmpgd(Rs_uw, Rt_uw, SIMD_FMT_QB,
18546384Sgblack@eecs.umich.edu                                                 UNSIGNED, CMP_EQ, &dspctl);
18556384Sgblack@eecs.umich.edu                            }});
18566384Sgblack@eecs.umich.edu                            0x1: cmpgdu_lt_qb({{
18578588Sgblack@eecs.umich.edu                                Rd_uw = dspCmpgd(Rs_uw, Rt_uw, SIMD_FMT_QB,
18586384Sgblack@eecs.umich.edu                                                 UNSIGNED, CMP_LT, &dspctl);
18596384Sgblack@eecs.umich.edu                            }});
18606384Sgblack@eecs.umich.edu                            0x2: cmpgdu_le_qb({{
18618588Sgblack@eecs.umich.edu                                Rd_uw = dspCmpgd(Rs_uw, Rt_uw, SIMD_FMT_QB,
18626384Sgblack@eecs.umich.edu                                                 UNSIGNED, CMP_LE, &dspctl);
18636384Sgblack@eecs.umich.edu                            }});
18646384Sgblack@eecs.umich.edu                            0x6: precr_sra_ph_w({{
18658588Sgblack@eecs.umich.edu                                Rt_uw = dspPrecrSra(Rt_uw, Rs_uw, RD,
18666384Sgblack@eecs.umich.edu                                                    SIMD_FMT_W, NOROUND);
18676384Sgblack@eecs.umich.edu                            }});
18686384Sgblack@eecs.umich.edu                            0x7: precr_sra_r_ph_w({{
18698588Sgblack@eecs.umich.edu                                Rt_uw = dspPrecrSra(Rt_uw, Rs_uw, RD,
18706384Sgblack@eecs.umich.edu                                                    SIMD_FMT_W, ROUND); 
18716384Sgblack@eecs.umich.edu                            }});
18724661Sksewell@umich.edu                        }
18734661Sksewell@umich.edu                    }
18744661Sksewell@umich.edu                }
18754661Sksewell@umich.edu
18766384Sgblack@eecs.umich.edu                //Table 5-7 MIPS32 ABSQ_S.PH Encoding of the op Field
18776384Sgblack@eecs.umich.edu                //(DSP ASE MANUAL)
18784661Sksewell@umich.edu                0x2: decode OP_HI {
18794661Sksewell@umich.edu                    0x0: decode OP_LO {
18804661Sksewell@umich.edu                        format DspIntOp {
18816384Sgblack@eecs.umich.edu                            0x1: absq_s_qb({{
18828588Sgblack@eecs.umich.edu                                Rd_sw = dspAbs(Rt_sw, SIMD_FMT_QB, &dspctl);
18836384Sgblack@eecs.umich.edu                            }});
18846384Sgblack@eecs.umich.edu                            0x2: repl_qb({{
18858588Sgblack@eecs.umich.edu                                Rd_uw = RS_RT<7:0> << 24 |
18866384Sgblack@eecs.umich.edu                                        RS_RT<7:0> << 16 |
18876384Sgblack@eecs.umich.edu                                        RS_RT<7:0> << 8 |
18886384Sgblack@eecs.umich.edu                                        RS_RT<7:0>;
18896384Sgblack@eecs.umich.edu                            }});
18906384Sgblack@eecs.umich.edu                            0x3: replv_qb({{
18918588Sgblack@eecs.umich.edu                                Rd_sw = Rt_uw<7:0> << 24 |
18928588Sgblack@eecs.umich.edu                                        Rt_uw<7:0> << 16 |
18938588Sgblack@eecs.umich.edu                                        Rt_uw<7:0> << 8 |
18948588Sgblack@eecs.umich.edu                                        Rt_uw<7:0>;
18956384Sgblack@eecs.umich.edu                            }});
18966384Sgblack@eecs.umich.edu                            0x4: precequ_ph_qbl({{
18978588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_QB, UNSIGNED,
18986384Sgblack@eecs.umich.edu                                                 SIMD_FMT_PH, SIGNED, MODE_L);
18996384Sgblack@eecs.umich.edu                            }});
19006384Sgblack@eecs.umich.edu                            0x5: precequ_ph_qbr({{
19018588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_QB, UNSIGNED,
19026384Sgblack@eecs.umich.edu                                                 SIMD_FMT_PH, SIGNED, MODE_R);
19036384Sgblack@eecs.umich.edu                            }});
19046384Sgblack@eecs.umich.edu                            0x6: precequ_ph_qbla({{
19058588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_QB, UNSIGNED,
19066384Sgblack@eecs.umich.edu                                                 SIMD_FMT_PH, SIGNED, MODE_LA);
19076384Sgblack@eecs.umich.edu                            }});
19086384Sgblack@eecs.umich.edu                            0x7: precequ_ph_qbra({{
19098588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_QB, UNSIGNED,
19106384Sgblack@eecs.umich.edu                                                 SIMD_FMT_PH, SIGNED, MODE_RA);
19116384Sgblack@eecs.umich.edu                            }});
19124661Sksewell@umich.edu                        }
19134661Sksewell@umich.edu                    }
19144661Sksewell@umich.edu                    0x1: decode OP_LO {
19154661Sksewell@umich.edu                        format DspIntOp {
19166384Sgblack@eecs.umich.edu                            0x1: absq_s_ph({{
19178588Sgblack@eecs.umich.edu                                Rd_sw = dspAbs(Rt_sw, SIMD_FMT_PH, &dspctl);
19186384Sgblack@eecs.umich.edu                            }});
19196384Sgblack@eecs.umich.edu                            0x2: repl_ph({{
19208588Sgblack@eecs.umich.edu                                Rd_uw = (sext<10>(RS_RT))<15:0> << 16 |
19216384Sgblack@eecs.umich.edu                                        (sext<10>(RS_RT))<15:0>;
19226384Sgblack@eecs.umich.edu                            }});
19236384Sgblack@eecs.umich.edu                            0x3: replv_ph({{
19248588Sgblack@eecs.umich.edu                                Rd_uw = Rt_uw<15:0> << 16 |
19258588Sgblack@eecs.umich.edu                                        Rt_uw<15:0>;
19266384Sgblack@eecs.umich.edu                            }});
19276384Sgblack@eecs.umich.edu                            0x4: preceq_w_phl({{
19288588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_PH, SIGNED,
19296384Sgblack@eecs.umich.edu                                                 SIMD_FMT_W, SIGNED, MODE_L);
19306384Sgblack@eecs.umich.edu                            }});
19316384Sgblack@eecs.umich.edu                            0x5: preceq_w_phr({{
19328588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_PH, SIGNED,
19336384Sgblack@eecs.umich.edu                                                 SIMD_FMT_W, SIGNED, MODE_R);
19346384Sgblack@eecs.umich.edu                            }});
19354661Sksewell@umich.edu                        }
19364661Sksewell@umich.edu                    }
19374661Sksewell@umich.edu                    0x2: decode OP_LO {
19384661Sksewell@umich.edu                        format DspIntOp {
19396384Sgblack@eecs.umich.edu                            0x1: absq_s_w({{
19408588Sgblack@eecs.umich.edu                                Rd_sw = dspAbs(Rt_sw, SIMD_FMT_W, &dspctl);
19416384Sgblack@eecs.umich.edu                            }});
19424661Sksewell@umich.edu                        }
19434661Sksewell@umich.edu                    }
19444661Sksewell@umich.edu                    0x3: decode OP_LO {
19456384Sgblack@eecs.umich.edu                        0x3: IntOp::bitrev({{
19468588Sgblack@eecs.umich.edu                            Rd_uw = bitrev( Rt_uw<15:0> );
19476384Sgblack@eecs.umich.edu                        }});
19484661Sksewell@umich.edu                        format DspIntOp {
19496384Sgblack@eecs.umich.edu                            0x4: preceu_ph_qbl({{
19508588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_QB,
19516384Sgblack@eecs.umich.edu                                                 UNSIGNED, SIMD_FMT_PH,
19526384Sgblack@eecs.umich.edu                                                 UNSIGNED, MODE_L);
19536384Sgblack@eecs.umich.edu                            }});
19546384Sgblack@eecs.umich.edu                            0x5: preceu_ph_qbr({{
19558588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_QB,
19566384Sgblack@eecs.umich.edu                                                 UNSIGNED, SIMD_FMT_PH,
19576384Sgblack@eecs.umich.edu                                                 UNSIGNED, MODE_R );
19586384Sgblack@eecs.umich.edu                            }});
19596384Sgblack@eecs.umich.edu                            0x6: preceu_ph_qbla({{
19608588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_QB,
19616384Sgblack@eecs.umich.edu                                                 UNSIGNED, SIMD_FMT_PH,
19626384Sgblack@eecs.umich.edu                                                 UNSIGNED, MODE_LA );
19636384Sgblack@eecs.umich.edu                            }});
19646384Sgblack@eecs.umich.edu                            0x7: preceu_ph_qbra({{
19658588Sgblack@eecs.umich.edu                                Rd_uw = dspPrece(Rt_uw, SIMD_FMT_QB,
19666384Sgblack@eecs.umich.edu                                                 UNSIGNED, SIMD_FMT_PH,
19676384Sgblack@eecs.umich.edu                                                 UNSIGNED, MODE_RA);
19686384Sgblack@eecs.umich.edu                            }});
19694661Sksewell@umich.edu                        }
19704661Sksewell@umich.edu                    }
19714661Sksewell@umich.edu                }
19724661Sksewell@umich.edu
19736384Sgblack@eecs.umich.edu                //Table 5-8 MIPS32 SHLL.QB Encoding of the op Field
19746384Sgblack@eecs.umich.edu                //(DSP ASE MANUAL)
19754661Sksewell@umich.edu                0x3: decode OP_HI {
19764661Sksewell@umich.edu                    0x0: decode OP_LO {
19774661Sksewell@umich.edu                        format DspIntOp {
19786384Sgblack@eecs.umich.edu                            0x0: shll_qb({{
19798588Sgblack@eecs.umich.edu                                Rd_sw = dspShll(Rt_sw, RS, SIMD_FMT_QB,
19806384Sgblack@eecs.umich.edu                                                NOSATURATE, UNSIGNED, &dspctl);
19816384Sgblack@eecs.umich.edu                            }});
19826384Sgblack@eecs.umich.edu                            0x1: shrl_qb({{
19838588Sgblack@eecs.umich.edu                                Rd_sw = dspShrl(Rt_sw, RS, SIMD_FMT_QB,
19846384Sgblack@eecs.umich.edu                                                UNSIGNED);
19856384Sgblack@eecs.umich.edu                            }});
19866384Sgblack@eecs.umich.edu                            0x2: shllv_qb({{
19878588Sgblack@eecs.umich.edu                                Rd_sw = dspShll(Rt_sw, Rs_sw, SIMD_FMT_QB,
19886384Sgblack@eecs.umich.edu                                                NOSATURATE, UNSIGNED, &dspctl);
19896384Sgblack@eecs.umich.edu                            }});
19906384Sgblack@eecs.umich.edu                            0x3: shrlv_qb({{
19918588Sgblack@eecs.umich.edu                                Rd_sw = dspShrl(Rt_sw, Rs_sw, SIMD_FMT_QB,
19926384Sgblack@eecs.umich.edu                                                UNSIGNED);
19936384Sgblack@eecs.umich.edu                            }});
19946384Sgblack@eecs.umich.edu                            0x4: shra_qb({{
19958588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, RS, SIMD_FMT_QB,
19966384Sgblack@eecs.umich.edu                                                NOROUND, SIGNED, &dspctl);
19976384Sgblack@eecs.umich.edu                            }});
19986384Sgblack@eecs.umich.edu                            0x5: shra_r_qb({{
19998588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, RS, SIMD_FMT_QB,
20006384Sgblack@eecs.umich.edu                                                ROUND, SIGNED, &dspctl);
20016384Sgblack@eecs.umich.edu                            }});
20026384Sgblack@eecs.umich.edu                            0x6: shrav_qb({{
20038588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, Rs_sw, SIMD_FMT_QB,
20046384Sgblack@eecs.umich.edu                                                NOROUND, SIGNED, &dspctl);
20056384Sgblack@eecs.umich.edu                            }});
20066384Sgblack@eecs.umich.edu                            0x7: shrav_r_qb({{
20078588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, Rs_sw, SIMD_FMT_QB,
20086384Sgblack@eecs.umich.edu                                                ROUND, SIGNED, &dspctl);
20096384Sgblack@eecs.umich.edu                            }});
20104661Sksewell@umich.edu                        }
20114661Sksewell@umich.edu                    }
20124661Sksewell@umich.edu                    0x1: decode OP_LO {
20134661Sksewell@umich.edu                        format DspIntOp {
20146384Sgblack@eecs.umich.edu                            0x0: shll_ph({{
20158588Sgblack@eecs.umich.edu                                Rd_uw = dspShll(Rt_uw, RS, SIMD_FMT_PH,
20166384Sgblack@eecs.umich.edu                                                NOSATURATE, SIGNED, &dspctl);
20176384Sgblack@eecs.umich.edu                            }});
20186384Sgblack@eecs.umich.edu                            0x1: shra_ph({{
20198588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, RS, SIMD_FMT_PH,
20206384Sgblack@eecs.umich.edu                                                NOROUND, SIGNED, &dspctl);
20216384Sgblack@eecs.umich.edu                            }});
20226384Sgblack@eecs.umich.edu                            0x2: shllv_ph({{
20238588Sgblack@eecs.umich.edu                                Rd_sw = dspShll(Rt_sw, Rs_sw, SIMD_FMT_PH,
20246384Sgblack@eecs.umich.edu                                                NOSATURATE, SIGNED, &dspctl);
20256384Sgblack@eecs.umich.edu                            }});
20266384Sgblack@eecs.umich.edu                            0x3: shrav_ph({{
20278588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, Rs_sw, SIMD_FMT_PH,
20286384Sgblack@eecs.umich.edu                                                NOROUND, SIGNED, &dspctl);
20296384Sgblack@eecs.umich.edu                            }});
20306384Sgblack@eecs.umich.edu                            0x4: shll_s_ph({{
20318588Sgblack@eecs.umich.edu                                Rd_sw = dspShll(Rt_sw, RS, SIMD_FMT_PH,
20326384Sgblack@eecs.umich.edu                                                SATURATE, SIGNED, &dspctl);
20336384Sgblack@eecs.umich.edu                            }});
20346384Sgblack@eecs.umich.edu                            0x5: shra_r_ph({{
20358588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, RS, SIMD_FMT_PH,
20366384Sgblack@eecs.umich.edu                                                ROUND, SIGNED, &dspctl);
20376384Sgblack@eecs.umich.edu                            }});
20386384Sgblack@eecs.umich.edu                            0x6: shllv_s_ph({{
20398588Sgblack@eecs.umich.edu                                Rd_sw = dspShll(Rt_sw, Rs_sw, SIMD_FMT_PH,
20406384Sgblack@eecs.umich.edu                                                SATURATE, SIGNED, &dspctl);
20416384Sgblack@eecs.umich.edu                            }});
20426384Sgblack@eecs.umich.edu                            0x7: shrav_r_ph({{
20438588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, Rs_sw, SIMD_FMT_PH,
20446384Sgblack@eecs.umich.edu                                                ROUND, SIGNED, &dspctl);
20456384Sgblack@eecs.umich.edu                            }});
20464661Sksewell@umich.edu                        }
20474661Sksewell@umich.edu                    }
20484661Sksewell@umich.edu                    0x2: decode OP_LO {
20494661Sksewell@umich.edu                        format DspIntOp {
20506384Sgblack@eecs.umich.edu                            0x4: shll_s_w({{
20518588Sgblack@eecs.umich.edu                                Rd_sw = dspShll(Rt_sw, RS, SIMD_FMT_W,
20526384Sgblack@eecs.umich.edu                                                SATURATE, SIGNED, &dspctl);
20536384Sgblack@eecs.umich.edu                            }});
20546384Sgblack@eecs.umich.edu                            0x5: shra_r_w({{
20558588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, RS, SIMD_FMT_W,
20566384Sgblack@eecs.umich.edu                                                ROUND, SIGNED, &dspctl);
20576384Sgblack@eecs.umich.edu                            }});
20586384Sgblack@eecs.umich.edu                            0x6: shllv_s_w({{
20598588Sgblack@eecs.umich.edu                                Rd_sw = dspShll(Rt_sw, Rs_sw, SIMD_FMT_W,
20606384Sgblack@eecs.umich.edu                                                SATURATE, SIGNED, &dspctl);
20616384Sgblack@eecs.umich.edu                            }});
20626384Sgblack@eecs.umich.edu                            0x7: shrav_r_w({{
20638588Sgblack@eecs.umich.edu                                Rd_sw = dspShra(Rt_sw, Rs_sw, SIMD_FMT_W,
20646384Sgblack@eecs.umich.edu                                                ROUND, SIGNED, &dspctl);
20656384Sgblack@eecs.umich.edu                            }});
20664661Sksewell@umich.edu                        }
20674661Sksewell@umich.edu                    }
20684661Sksewell@umich.edu                    0x3: decode OP_LO {
20694661Sksewell@umich.edu                        format DspIntOp {
20706384Sgblack@eecs.umich.edu                            0x1: shrl_ph({{
20718588Sgblack@eecs.umich.edu                                Rd_sw = dspShrl(Rt_sw, RS, SIMD_FMT_PH,
20726384Sgblack@eecs.umich.edu                                                UNSIGNED);
20736384Sgblack@eecs.umich.edu                            }});
20746384Sgblack@eecs.umich.edu                            0x3: shrlv_ph({{
20758588Sgblack@eecs.umich.edu                                Rd_sw = dspShrl(Rt_sw, Rs_sw, SIMD_FMT_PH,
20766384Sgblack@eecs.umich.edu                                                UNSIGNED);
20776384Sgblack@eecs.umich.edu                            }});
20784661Sksewell@umich.edu                        }
20794661Sksewell@umich.edu                    }
20804661Sksewell@umich.edu                }
20814661Sksewell@umich.edu            }
20824661Sksewell@umich.edu
20834661Sksewell@umich.edu            0x3: decode FUNCTION_LO {
20844661Sksewell@umich.edu
20856384Sgblack@eecs.umich.edu                //Table 3.12 MIPS32 ADDUH.QB Encoding of the op Field
20866384Sgblack@eecs.umich.edu                //(DSP ASE Rev2 Manual)
20874661Sksewell@umich.edu                0x0: decode OP_HI {
20884661Sksewell@umich.edu                    0x0: decode OP_LO {
20894661Sksewell@umich.edu                        format DspIntOp {
20906384Sgblack@eecs.umich.edu                            0x0: adduh_qb({{
20918588Sgblack@eecs.umich.edu                                Rd_uw = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_QB,
20926384Sgblack@eecs.umich.edu                                                NOROUND, UNSIGNED);
20936384Sgblack@eecs.umich.edu                            }});
20946384Sgblack@eecs.umich.edu                            0x1: subuh_qb({{
20958588Sgblack@eecs.umich.edu                                Rd_uw = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_QB,
20966384Sgblack@eecs.umich.edu                                                NOROUND, UNSIGNED);
20976384Sgblack@eecs.umich.edu                            }});
20986384Sgblack@eecs.umich.edu                            0x2: adduh_r_qb({{
20998588Sgblack@eecs.umich.edu                                Rd_uw = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_QB,
21006384Sgblack@eecs.umich.edu                                                ROUND, UNSIGNED);
21016384Sgblack@eecs.umich.edu                            }});
21026384Sgblack@eecs.umich.edu                            0x3: subuh_r_qb({{
21038588Sgblack@eecs.umich.edu                                Rd_uw = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_QB,
21046384Sgblack@eecs.umich.edu                                                ROUND, UNSIGNED);
21056384Sgblack@eecs.umich.edu                            }});
21064661Sksewell@umich.edu                        }
21074661Sksewell@umich.edu                    }
21084661Sksewell@umich.edu                    0x1: decode OP_LO {
21094661Sksewell@umich.edu                        format DspIntOp {
21106384Sgblack@eecs.umich.edu                            0x0: addqh_ph({{
21118588Sgblack@eecs.umich.edu                                Rd_uw = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_PH,
21126384Sgblack@eecs.umich.edu                                                NOROUND, SIGNED);
21136384Sgblack@eecs.umich.edu                            }});
21146384Sgblack@eecs.umich.edu                            0x1: subqh_ph({{
21158588Sgblack@eecs.umich.edu                                Rd_uw = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_PH,
21166384Sgblack@eecs.umich.edu                                                NOROUND, SIGNED);
21176384Sgblack@eecs.umich.edu                            }});
21186384Sgblack@eecs.umich.edu                            0x2: addqh_r_ph({{
21198588Sgblack@eecs.umich.edu                                Rd_uw = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_PH,
21206384Sgblack@eecs.umich.edu                                                ROUND, SIGNED);
21216384Sgblack@eecs.umich.edu                            }});
21226384Sgblack@eecs.umich.edu                            0x3: subqh_r_ph({{
21238588Sgblack@eecs.umich.edu                                Rd_uw = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_PH,
21246384Sgblack@eecs.umich.edu                                                ROUND, SIGNED);
21256384Sgblack@eecs.umich.edu                            }});
21266384Sgblack@eecs.umich.edu                            0x4: mul_ph({{
21278588Sgblack@eecs.umich.edu                                Rd_sw = dspMul(Rs_sw, Rt_sw, SIMD_FMT_PH,
21286384Sgblack@eecs.umich.edu                                               NOSATURATE, &dspctl);
21296384Sgblack@eecs.umich.edu                            }}, IntMultOp);
21306384Sgblack@eecs.umich.edu                            0x6: mul_s_ph({{
21318588Sgblack@eecs.umich.edu                                Rd_sw = dspMul(Rs_sw, Rt_sw, SIMD_FMT_PH,
21326384Sgblack@eecs.umich.edu                                               SATURATE, &dspctl);
21336384Sgblack@eecs.umich.edu                            }}, IntMultOp);
21344661Sksewell@umich.edu                        }
21354661Sksewell@umich.edu                    }
21364661Sksewell@umich.edu                    0x2: decode OP_LO {
21374661Sksewell@umich.edu                        format DspIntOp {
21386384Sgblack@eecs.umich.edu                            0x0: addqh_w({{
21398588Sgblack@eecs.umich.edu                                Rd_uw = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_W,
21406384Sgblack@eecs.umich.edu                                                NOROUND, SIGNED);
21416384Sgblack@eecs.umich.edu                            }});
21426384Sgblack@eecs.umich.edu                            0x1: subqh_w({{
21438588Sgblack@eecs.umich.edu                                Rd_uw = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_W,
21446384Sgblack@eecs.umich.edu                                                NOROUND, SIGNED);
21456384Sgblack@eecs.umich.edu                            }});
21466384Sgblack@eecs.umich.edu                            0x2: addqh_r_w({{
21478588Sgblack@eecs.umich.edu                                Rd_uw = dspAddh(Rs_sw, Rt_sw, SIMD_FMT_W,
21486384Sgblack@eecs.umich.edu                                                ROUND, SIGNED);
21496384Sgblack@eecs.umich.edu                            }});
21506384Sgblack@eecs.umich.edu                            0x3: subqh_r_w({{
21518588Sgblack@eecs.umich.edu                                Rd_uw = dspSubh(Rs_sw, Rt_sw, SIMD_FMT_W,
21526384Sgblack@eecs.umich.edu                                                ROUND, SIGNED);
21536384Sgblack@eecs.umich.edu                            }});
21546384Sgblack@eecs.umich.edu                            0x6: mulq_s_w({{
21558588Sgblack@eecs.umich.edu                                Rd_sw = dspMulq(Rs_sw, Rt_sw, SIMD_FMT_W,
21566384Sgblack@eecs.umich.edu                                                SATURATE, NOROUND, &dspctl);
21576384Sgblack@eecs.umich.edu                            }}, IntMultOp);
21586384Sgblack@eecs.umich.edu                            0x7: mulq_rs_w({{
21598588Sgblack@eecs.umich.edu                                Rd_sw = dspMulq(Rs_sw, Rt_sw, SIMD_FMT_W,
21606384Sgblack@eecs.umich.edu                                                SATURATE, ROUND, &dspctl);
21616384Sgblack@eecs.umich.edu                            }}, IntMultOp);
21624661Sksewell@umich.edu                        }
21634661Sksewell@umich.edu                    }
21642061SN/A                }
21652101SN/A            }
21662061SN/A
21672101SN/A            //Table A-10 MIPS32 BSHFL Encoding of sa Field
21682101SN/A            0x4: decode SA {
21692046SN/A                format BasicOp {
21706384Sgblack@eecs.umich.edu                    0x02: wsbh({{
21718588Sgblack@eecs.umich.edu                        Rd_uw = Rt_uw<23:16> << 24 |
21728588Sgblack@eecs.umich.edu                                Rt_uw<31:24> << 16 |
21738588Sgblack@eecs.umich.edu                                Rt_uw<7:0>   << 8  |
21748588Sgblack@eecs.umich.edu                                Rt_uw<15:8>;
21752686Sksewell@umich.edu                    }});
21768588Sgblack@eecs.umich.edu                    0x10: seb({{ Rd_sw = Rt_sb; }});
21778588Sgblack@eecs.umich.edu                    0x18: seh({{ Rd_sw = Rt_sh; }});
21782046SN/A                }
21792101SN/A            }
21802043SN/A
21812101SN/A            0x6: decode FUNCTION_LO {
21824661Sksewell@umich.edu
21836384Sgblack@eecs.umich.edu                //Table 5-10 MIPS32 DPAQ.W.PH Encoding of the op Field
21846384Sgblack@eecs.umich.edu                //(DSP ASE MANUAL)
21854661Sksewell@umich.edu                0x0: decode OP_HI {
21864661Sksewell@umich.edu                    0x0: decode OP_LO {
21874661Sksewell@umich.edu                        format DspHiLoOp {
21886384Sgblack@eecs.umich.edu                            0x0: dpa_w_ph({{
21898588Sgblack@eecs.umich.edu                                dspac = dspDpa(dspac, Rs_sw, Rt_sw, ACDST,
21906384Sgblack@eecs.umich.edu                                               SIMD_FMT_PH, SIGNED, MODE_L);
21916384Sgblack@eecs.umich.edu                            }}, IntMultOp);
21926384Sgblack@eecs.umich.edu                            0x1: dps_w_ph({{
21938588Sgblack@eecs.umich.edu                                dspac = dspDps(dspac, Rs_sw, Rt_sw, ACDST,
21946384Sgblack@eecs.umich.edu                                               SIMD_FMT_PH, SIGNED, MODE_L);
21956384Sgblack@eecs.umich.edu                            }}, IntMultOp);
21966384Sgblack@eecs.umich.edu                            0x2: mulsa_w_ph({{
21978588Sgblack@eecs.umich.edu                                dspac = dspMulsa(dspac, Rs_sw, Rt_sw,
21986384Sgblack@eecs.umich.edu                                                 ACDST, SIMD_FMT_PH );
21996384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22006384Sgblack@eecs.umich.edu                            0x3: dpau_h_qbl({{
22018588Sgblack@eecs.umich.edu                                dspac = dspDpa(dspac, Rs_sw, Rt_sw, ACDST,
22026384Sgblack@eecs.umich.edu                                               SIMD_FMT_QB, UNSIGNED, MODE_L);
22036384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22046384Sgblack@eecs.umich.edu                            0x4: dpaq_s_w_ph({{
22058588Sgblack@eecs.umich.edu                                dspac = dspDpaq(dspac, Rs_sw, Rt_sw,
22066384Sgblack@eecs.umich.edu                                                ACDST, SIMD_FMT_PH,
22076384Sgblack@eecs.umich.edu                                                SIMD_FMT_W, NOSATURATE,
22086384Sgblack@eecs.umich.edu                                                MODE_L, &dspctl);
22096384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22106384Sgblack@eecs.umich.edu                            0x5: dpsq_s_w_ph({{
22118588Sgblack@eecs.umich.edu                                dspac = dspDpsq(dspac, Rs_sw, Rt_sw,
22126384Sgblack@eecs.umich.edu                                                ACDST, SIMD_FMT_PH,
22136384Sgblack@eecs.umich.edu                                                SIMD_FMT_W, NOSATURATE,
22146384Sgblack@eecs.umich.edu                                                MODE_L, &dspctl);
22156384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22166384Sgblack@eecs.umich.edu                            0x6: mulsaq_s_w_ph({{
22178588Sgblack@eecs.umich.edu                                dspac = dspMulsaq(dspac, Rs_sw, Rt_sw,
22186384Sgblack@eecs.umich.edu                                                  ACDST, SIMD_FMT_PH,
22196384Sgblack@eecs.umich.edu                                                  &dspctl);
22206384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22216384Sgblack@eecs.umich.edu                            0x7: dpau_h_qbr({{
22228588Sgblack@eecs.umich.edu                                dspac = dspDpa(dspac, Rs_sw, Rt_sw, ACDST,
22236384Sgblack@eecs.umich.edu                                               SIMD_FMT_QB, UNSIGNED, MODE_R);
22246384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22254661Sksewell@umich.edu                        }
22264661Sksewell@umich.edu                    }
22274661Sksewell@umich.edu                    0x1: decode OP_LO {
22284661Sksewell@umich.edu                        format DspHiLoOp {
22296384Sgblack@eecs.umich.edu                            0x0: dpax_w_ph({{
22308588Sgblack@eecs.umich.edu                                dspac = dspDpa(dspac, Rs_sw, Rt_sw, ACDST,
22316384Sgblack@eecs.umich.edu                                               SIMD_FMT_PH, SIGNED, MODE_X);
22326384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22336384Sgblack@eecs.umich.edu                            0x1: dpsx_w_ph({{
22348588Sgblack@eecs.umich.edu                                dspac = dspDps(dspac, Rs_sw, Rt_sw, ACDST,
22356384Sgblack@eecs.umich.edu                                               SIMD_FMT_PH, SIGNED, MODE_X);
22366384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22376384Sgblack@eecs.umich.edu                            0x3: dpsu_h_qbl({{
22388588Sgblack@eecs.umich.edu                                dspac = dspDps(dspac, Rs_sw, Rt_sw, ACDST,
22396384Sgblack@eecs.umich.edu                                               SIMD_FMT_QB, UNSIGNED, MODE_L);
22406384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22416384Sgblack@eecs.umich.edu                            0x4: dpaq_sa_l_w({{
22428588Sgblack@eecs.umich.edu                                dspac = dspDpaq(dspac, Rs_sw, Rt_sw,
22436384Sgblack@eecs.umich.edu                                                ACDST, SIMD_FMT_W,
22446384Sgblack@eecs.umich.edu                                                SIMD_FMT_L, SATURATE,
22456384Sgblack@eecs.umich.edu                                                MODE_L, &dspctl);
22466384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22476384Sgblack@eecs.umich.edu                            0x5: dpsq_sa_l_w({{
22488588Sgblack@eecs.umich.edu                                dspac = dspDpsq(dspac, Rs_sw, Rt_sw,
22496384Sgblack@eecs.umich.edu                                                ACDST, SIMD_FMT_W,
22506384Sgblack@eecs.umich.edu                                                SIMD_FMT_L, SATURATE,
22516384Sgblack@eecs.umich.edu                                                MODE_L, &dspctl);
22526384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22536384Sgblack@eecs.umich.edu                            0x7: dpsu_h_qbr({{
22548588Sgblack@eecs.umich.edu                                dspac = dspDps(dspac, Rs_sw, Rt_sw, ACDST,
22556384Sgblack@eecs.umich.edu                                               SIMD_FMT_QB, UNSIGNED, MODE_R);
22566384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22574661Sksewell@umich.edu                        }
22584661Sksewell@umich.edu                    }
22594661Sksewell@umich.edu                    0x2: decode OP_LO {
22604661Sksewell@umich.edu                        format DspHiLoOp {
22616384Sgblack@eecs.umich.edu                            0x0: maq_sa_w_phl({{
22628588Sgblack@eecs.umich.edu                                dspac = dspMaq(dspac, Rs_uw, Rt_uw,
22636384Sgblack@eecs.umich.edu                                               ACDST, SIMD_FMT_PH,
22646384Sgblack@eecs.umich.edu                                               MODE_L, SATURATE, &dspctl);
22656384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22666384Sgblack@eecs.umich.edu                            0x2: maq_sa_w_phr({{
22678588Sgblack@eecs.umich.edu                                dspac = dspMaq(dspac, Rs_uw, Rt_uw,
22686384Sgblack@eecs.umich.edu                                               ACDST, SIMD_FMT_PH,
22696384Sgblack@eecs.umich.edu                                               MODE_R, SATURATE, &dspctl);
22706384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22716384Sgblack@eecs.umich.edu                            0x4: maq_s_w_phl({{
22728588Sgblack@eecs.umich.edu                                dspac = dspMaq(dspac, Rs_uw, Rt_uw,
22736384Sgblack@eecs.umich.edu                                               ACDST, SIMD_FMT_PH,
22746384Sgblack@eecs.umich.edu                                               MODE_L, NOSATURATE, &dspctl);
22756384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22766384Sgblack@eecs.umich.edu                            0x6: maq_s_w_phr({{
22778588Sgblack@eecs.umich.edu                                dspac = dspMaq(dspac, Rs_uw, Rt_uw,
22786384Sgblack@eecs.umich.edu                                               ACDST, SIMD_FMT_PH,
22796384Sgblack@eecs.umich.edu                                               MODE_R, NOSATURATE, &dspctl);
22806384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22814661Sksewell@umich.edu                        }
22824661Sksewell@umich.edu                    }
22834661Sksewell@umich.edu                    0x3: decode OP_LO {
22844661Sksewell@umich.edu                        format DspHiLoOp {
22856384Sgblack@eecs.umich.edu                            0x0: dpaqx_s_w_ph({{
22868588Sgblack@eecs.umich.edu                                dspac = dspDpaq(dspac, Rs_sw, Rt_sw,
22876384Sgblack@eecs.umich.edu                                                ACDST, SIMD_FMT_PH,
22886384Sgblack@eecs.umich.edu                                                SIMD_FMT_W, NOSATURATE,
22896384Sgblack@eecs.umich.edu                                                MODE_X, &dspctl);
22906384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22916384Sgblack@eecs.umich.edu                            0x1: dpsqx_s_w_ph({{
22928588Sgblack@eecs.umich.edu                                dspac = dspDpsq(dspac, Rs_sw, Rt_sw,
22936384Sgblack@eecs.umich.edu                                                ACDST, SIMD_FMT_PH,
22946384Sgblack@eecs.umich.edu                                                SIMD_FMT_W, NOSATURATE,
22956384Sgblack@eecs.umich.edu                                                MODE_X, &dspctl);
22966384Sgblack@eecs.umich.edu                            }}, IntMultOp);
22976384Sgblack@eecs.umich.edu                            0x2: dpaqx_sa_w_ph({{
22988588Sgblack@eecs.umich.edu                                dspac = dspDpaq(dspac, Rs_sw, Rt_sw,
22996384Sgblack@eecs.umich.edu                                                ACDST, SIMD_FMT_PH,
23006384Sgblack@eecs.umich.edu                                                SIMD_FMT_W, SATURATE,
23016384Sgblack@eecs.umich.edu                                                MODE_X, &dspctl);
23026384Sgblack@eecs.umich.edu                            }}, IntMultOp);
23036384Sgblack@eecs.umich.edu                            0x3: dpsqx_sa_w_ph({{
23048588Sgblack@eecs.umich.edu                                dspac = dspDpsq(dspac, Rs_sw, Rt_sw,
23056384Sgblack@eecs.umich.edu                                                ACDST, SIMD_FMT_PH,
23066384Sgblack@eecs.umich.edu                                                SIMD_FMT_W, SATURATE,
23076384Sgblack@eecs.umich.edu                                                MODE_X, &dspctl);
23086384Sgblack@eecs.umich.edu                            }}, IntMultOp);
23094661Sksewell@umich.edu                        }
23104661Sksewell@umich.edu                    }
23114661Sksewell@umich.edu                }
23124661Sksewell@umich.edu
23134661Sksewell@umich.edu                //Table 3.3 MIPS32 APPEND Encoding of the op Field
23144661Sksewell@umich.edu                0x1: decode OP_HI {
23154661Sksewell@umich.edu                    0x0: decode OP_LO {
23164661Sksewell@umich.edu                        format IntOp {
23176384Sgblack@eecs.umich.edu                            0x0: append({{
23188588Sgblack@eecs.umich.edu                                Rt_uw = (Rt_uw << RD) | bits(Rs_uw, RD - 1, 0);
23196384Sgblack@eecs.umich.edu                                }});
23206384Sgblack@eecs.umich.edu                            0x1: prepend({{
23218588Sgblack@eecs.umich.edu                                Rt_uw = (Rt_uw >> RD) |
23228588Sgblack@eecs.umich.edu                                        (bits(Rs_uw, RD - 1, 0) << (32 - RD));
23236384Sgblack@eecs.umich.edu                            }});
23244661Sksewell@umich.edu                        }
23254661Sksewell@umich.edu                    }
23264661Sksewell@umich.edu                    0x2: decode OP_LO {
23274661Sksewell@umich.edu                        format IntOp {
23286384Sgblack@eecs.umich.edu                            0x0: balign({{
23298588Sgblack@eecs.umich.edu                                Rt_uw = (Rt_uw << (8 * BP)) |
23308588Sgblack@eecs.umich.edu                                        (Rs_uw >> (8 * (4 - BP)));
23316384Sgblack@eecs.umich.edu                            }});
23324661Sksewell@umich.edu                        }
23334661Sksewell@umich.edu                    }
23344661Sksewell@umich.edu                }
23354661Sksewell@umich.edu
23362101SN/A            }
23374661Sksewell@umich.edu            0x7: decode FUNCTION_LO {
23384661Sksewell@umich.edu
23396384Sgblack@eecs.umich.edu                //Table 5-11 MIPS32 EXTR.W Encoding of the op Field
23406384Sgblack@eecs.umich.edu                //(DSP ASE MANUAL)
23414661Sksewell@umich.edu                0x0: decode OP_HI {
23424661Sksewell@umich.edu                    0x0: decode OP_LO {
23434661Sksewell@umich.edu                        format DspHiLoOp {
23446384Sgblack@eecs.umich.edu                            0x0: extr_w({{
23458588Sgblack@eecs.umich.edu                                Rt_uw = dspExtr(dspac, SIMD_FMT_W, RS,
23466384Sgblack@eecs.umich.edu                                                NOROUND, NOSATURATE, &dspctl);
23476384Sgblack@eecs.umich.edu                            }});
23486384Sgblack@eecs.umich.edu                            0x1: extrv_w({{
23498588Sgblack@eecs.umich.edu                                Rt_uw = dspExtr(dspac, SIMD_FMT_W, Rs_uw,
23506384Sgblack@eecs.umich.edu                                                NOROUND, NOSATURATE, &dspctl);
23516384Sgblack@eecs.umich.edu                            }});
23526384Sgblack@eecs.umich.edu                            0x2: extp({{
23538588Sgblack@eecs.umich.edu                                Rt_uw = dspExtp(dspac, RS, &dspctl);
23546384Sgblack@eecs.umich.edu                            }});
23556384Sgblack@eecs.umich.edu                            0x3: extpv({{
23568588Sgblack@eecs.umich.edu                                Rt_uw = dspExtp(dspac, Rs_uw, &dspctl);
23576384Sgblack@eecs.umich.edu                            }});
23586384Sgblack@eecs.umich.edu                            0x4: extr_r_w({{
23598588Sgblack@eecs.umich.edu                                Rt_uw = dspExtr(dspac, SIMD_FMT_W, RS,
23606384Sgblack@eecs.umich.edu                                                ROUND, NOSATURATE, &dspctl);
23616384Sgblack@eecs.umich.edu                            }});
23626384Sgblack@eecs.umich.edu                            0x5: extrv_r_w({{
23638588Sgblack@eecs.umich.edu                                Rt_uw = dspExtr(dspac, SIMD_FMT_W, Rs_uw,
23646384Sgblack@eecs.umich.edu                                                ROUND, NOSATURATE, &dspctl);
23656384Sgblack@eecs.umich.edu                            }});
23666384Sgblack@eecs.umich.edu                            0x6: extr_rs_w({{
23678588Sgblack@eecs.umich.edu                                Rt_uw = dspExtr(dspac, SIMD_FMT_W, RS,
23686384Sgblack@eecs.umich.edu                                                ROUND, SATURATE, &dspctl);
23696384Sgblack@eecs.umich.edu                            }});
23706384Sgblack@eecs.umich.edu                            0x7: extrv_rs_w({{
23718588Sgblack@eecs.umich.edu                                Rt_uw = dspExtr(dspac, SIMD_FMT_W, Rs_uw,
23726384Sgblack@eecs.umich.edu                                                ROUND, SATURATE, &dspctl);
23736384Sgblack@eecs.umich.edu                            }});
23744661Sksewell@umich.edu                        }
23754661Sksewell@umich.edu                    }
23764661Sksewell@umich.edu                    0x1: decode OP_LO {
23774661Sksewell@umich.edu                        format DspHiLoOp {
23786384Sgblack@eecs.umich.edu                            0x2: extpdp({{
23798588Sgblack@eecs.umich.edu                                Rt_uw = dspExtpd(dspac, RS, &dspctl);
23806384Sgblack@eecs.umich.edu                            }});
23816384Sgblack@eecs.umich.edu                            0x3: extpdpv({{
23828588Sgblack@eecs.umich.edu                                Rt_uw = dspExtpd(dspac, Rs_uw, &dspctl);
23836384Sgblack@eecs.umich.edu                            }});
23846384Sgblack@eecs.umich.edu                            0x6: extr_s_h({{
23858588Sgblack@eecs.umich.edu                                Rt_uw = dspExtr(dspac, SIMD_FMT_PH, RS,
23866384Sgblack@eecs.umich.edu                                                NOROUND, SATURATE, &dspctl);
23876384Sgblack@eecs.umich.edu                            }});
23886384Sgblack@eecs.umich.edu                            0x7: extrv_s_h({{
23898588Sgblack@eecs.umich.edu                                Rt_uw = dspExtr(dspac, SIMD_FMT_PH, Rs_uw,
23906384Sgblack@eecs.umich.edu                                                NOROUND, SATURATE, &dspctl);
23916384Sgblack@eecs.umich.edu                            }});
23924661Sksewell@umich.edu                        }
23934661Sksewell@umich.edu                    }
23944661Sksewell@umich.edu                    0x2: decode OP_LO {
23954661Sksewell@umich.edu                        format DspIntOp {
23966384Sgblack@eecs.umich.edu                            0x2: rddsp({{
23978588Sgblack@eecs.umich.edu                                Rd_uw = readDSPControl(&dspctl, RDDSPMASK);
23986384Sgblack@eecs.umich.edu                            }});
23996384Sgblack@eecs.umich.edu                            0x3: wrdsp({{
24008588Sgblack@eecs.umich.edu                                writeDSPControl(&dspctl, Rs_uw, WRDSPMASK);
24016384Sgblack@eecs.umich.edu                            }});
24024661Sksewell@umich.edu                        }
24034661Sksewell@umich.edu                    }
24044661Sksewell@umich.edu                    0x3: decode OP_LO {
24054661Sksewell@umich.edu                        format DspHiLoOp {
24066384Sgblack@eecs.umich.edu                            0x2: shilo({{
24076384Sgblack@eecs.umich.edu                                if (sext<6>(HILOSA) < 0) {
24086384Sgblack@eecs.umich.edu                                    dspac = (uint64_t)dspac <<
24096384Sgblack@eecs.umich.edu                                                -sext<6>(HILOSA);
24106384Sgblack@eecs.umich.edu                                } else {
24116384Sgblack@eecs.umich.edu                                    dspac = (uint64_t)dspac >>
24126384Sgblack@eecs.umich.edu                                                sext<6>(HILOSA);
24136384Sgblack@eecs.umich.edu                                }
24146384Sgblack@eecs.umich.edu                            }});
24156384Sgblack@eecs.umich.edu                            0x3: shilov({{
24168588Sgblack@eecs.umich.edu                                if (sext<6>(Rs_sw<5:0>) < 0) {
24176384Sgblack@eecs.umich.edu                                    dspac = (uint64_t)dspac <<
24188588Sgblack@eecs.umich.edu                                                -sext<6>(Rs_sw<5:0>);
24196384Sgblack@eecs.umich.edu                                } else {
24206384Sgblack@eecs.umich.edu                                    dspac = (uint64_t)dspac >>
24218588Sgblack@eecs.umich.edu                                                sext<6>(Rs_sw<5:0>);
24226384Sgblack@eecs.umich.edu                                }
24236384Sgblack@eecs.umich.edu                            }});
24246384Sgblack@eecs.umich.edu                            0x7: mthlip({{
24256384Sgblack@eecs.umich.edu                                dspac = dspac << 32;
24268588Sgblack@eecs.umich.edu                                dspac |= Rs_uw;
24276384Sgblack@eecs.umich.edu                                dspctl = insertBits(dspctl, 5, 0,
24286384Sgblack@eecs.umich.edu                                                    dspctl<5:0> + 32);
24296384Sgblack@eecs.umich.edu                            }});
24304661Sksewell@umich.edu                        }
24314661Sksewell@umich.edu                    }
24324661Sksewell@umich.edu                }
24338564Sgblack@eecs.umich.edu                0x3: decode OP default FailUnimpl::rdhwr() {
24348901Sandreas.hansson@arm.com                    0x0: decode FullSystemInt {
24358564Sgblack@eecs.umich.edu                        0: decode RD {
24368564Sgblack@eecs.umich.edu                            29: BasicOp::rdhwr_se({{ Rt = TpValue; }});
24378564Sgblack@eecs.umich.edu                        }
24386810Sgblack@eecs.umich.edu                    }
24395222Sksewell@umich.edu                }
24404661Sksewell@umich.edu            }
24412043SN/A        }
24422084SN/A    }
24432024SN/A
24442686Sksewell@umich.edu    0x4: decode OPCODE_LO {
24452124SN/A        format LoadMemory {
24468588Sgblack@eecs.umich.edu          0x0: lb({{ Rt_sw = Mem_sb; }});
24478588Sgblack@eecs.umich.edu          0x1: lh({{ Rt_sw = Mem_sh; }});
24488588Sgblack@eecs.umich.edu            0x3: lw({{ Rt_sw = Mem_sw; }});
24498588Sgblack@eecs.umich.edu            0x4: lbu({{ Rt_uw = Mem_ub;}});
24508588Sgblack@eecs.umich.edu            0x5: lhu({{ Rt_uw = Mem_uh; }});
24512686Sksewell@umich.edu        }
24522495SN/A
24532686Sksewell@umich.edu        format LoadUnalignedMemory {
24546384Sgblack@eecs.umich.edu            0x2: lwl({{
24556384Sgblack@eecs.umich.edu                uint32_t mem_shift = 24 - (8 * byte_offset);
24568588Sgblack@eecs.umich.edu                Rt_uw = mem_word << mem_shift | (Rt_uw & mask(mem_shift));
24576384Sgblack@eecs.umich.edu            }});
24586384Sgblack@eecs.umich.edu            0x6: lwr({{
24596384Sgblack@eecs.umich.edu                uint32_t mem_shift = 8 * byte_offset;
24608588Sgblack@eecs.umich.edu                Rt_uw = (Rt_uw & (mask(mem_shift) << (32 - mem_shift))) |
24616384Sgblack@eecs.umich.edu                        (mem_word >> mem_shift);
24626384Sgblack@eecs.umich.edu            }});
24636384Sgblack@eecs.umich.edu        }
24642084SN/A    }
24652024SN/A
24662686Sksewell@umich.edu    0x5: decode OPCODE_LO {
24672124SN/A        format StoreMemory {
24688588Sgblack@eecs.umich.edu            0x0: sb({{ Mem_ub = Rt<7:0>; }});
24698588Sgblack@eecs.umich.edu            0x1: sh({{ Mem_uh = Rt<15:0>; }});
24708588Sgblack@eecs.umich.edu            0x3: sw({{ Mem_uw = Rt<31:0>; }});
24712084SN/A        }
24722024SN/A
24732686Sksewell@umich.edu        format StoreUnalignedMemory {
24746384Sgblack@eecs.umich.edu            0x2: swl({{
24756384Sgblack@eecs.umich.edu                uint32_t reg_shift = 24 - (8 * byte_offset);
24766384Sgblack@eecs.umich.edu                uint32_t mem_shift = 32 - reg_shift;
24776384Sgblack@eecs.umich.edu                mem_word = (mem_word & (mask(reg_shift) << mem_shift)) |
24788588Sgblack@eecs.umich.edu                           (Rt_uw >> reg_shift);
24796384Sgblack@eecs.umich.edu                }});
24806384Sgblack@eecs.umich.edu            0x6: swr({{
24816384Sgblack@eecs.umich.edu                uint32_t reg_shift = 8 * byte_offset;
24828588Sgblack@eecs.umich.edu                mem_word = Rt_uw << reg_shift |
24836384Sgblack@eecs.umich.edu                           (mem_word & (mask(reg_shift)));
24846384Sgblack@eecs.umich.edu            }});
24852084SN/A        }
24865222Sksewell@umich.edu        format CP0Control {
24875222Sksewell@umich.edu            0x7: cache({{
24888588Sgblack@eecs.umich.edu                //Addr CacheEA = Rs_uw + OFFSET;
24896384Sgblack@eecs.umich.edu                //fault = xc->CacheOp((uint8_t)CACHE_OP,(Addr) CacheEA);
24906384Sgblack@eecs.umich.edu            }});
24915222Sksewell@umich.edu        }
24922084SN/A    }
24932024SN/A
24942686Sksewell@umich.edu    0x6: decode OPCODE_LO {
24952686Sksewell@umich.edu        format LoadMemory {
24968588Sgblack@eecs.umich.edu            0x0: ll({{ Rt_uw = Mem_uw; }}, mem_flags=LLSC);
24978588Sgblack@eecs.umich.edu            0x1: lwc1({{ Ft_uw = Mem_uw; }});
24988588Sgblack@eecs.umich.edu            0x5: ldc1({{ Ft_ud = Mem_ud; }});
24992084SN/A        }
25005222Sksewell@umich.edu        0x2: CP2Unimpl::lwc2();
25015222Sksewell@umich.edu        0x6: CP2Unimpl::ldc2();
25022686Sksewell@umich.edu        0x3: Prefetch::pref();
25032084SN/A    }
25042024SN/A
25052239SN/A
25062686Sksewell@umich.edu    0x7: decode OPCODE_LO {
25078588Sgblack@eecs.umich.edu        0x0: StoreCond::sc({{ Mem_uw = Rt_uw; }},
25082686Sksewell@umich.edu                           {{ uint64_t tmp = write_result;
25098588Sgblack@eecs.umich.edu                              Rt_uw = (tmp == 0 || tmp == 1) ? tmp : Rt_uw;
25106384Sgblack@eecs.umich.edu                           }}, mem_flags=LLSC,
25116384Sgblack@eecs.umich.edu                               inst_flags = IsStoreConditional);
25122686Sksewell@umich.edu        format StoreMemory {
25138588Sgblack@eecs.umich.edu            0x1: swc1({{ Mem_uw = Ft_uw; }});
25148588Sgblack@eecs.umich.edu            0x5: sdc1({{ Mem_ud = Ft_ud; }});
25152084SN/A        }
25165222Sksewell@umich.edu        0x2: CP2Unimpl::swc2();
25175222Sksewell@umich.edu        0x6: CP2Unimpl::sdc2();
25182027SN/A    }
25192024SN/A}
25202022SN/A
25212027SN/A
2522