decoder.isa revision 6037
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 { 492686Sksewell@umich.edu 0: movf({{ Rd = (getCondCode(FCSR, CC) == 0) ? Rd : Rs; }}); 502686Sksewell@umich.edu 1: movt({{ Rd = (getCondCode(FCSR, CC) == 1) ? Rd : Rs; }}); 512101SN/A } 522101SN/A } 532101SN/A 542046SN/A format BasicOp { 552686Sksewell@umich.edu //Table A-3 Note: "Specific encodings of the rd, rs, and 562686Sksewell@umich.edu //rt fields are used to distinguish SLL, SSNOP, and EHB 572686Sksewell@umich.edu //functions 582470SN/A 0x0: decode RS { 592686Sksewell@umich.edu 0x0: decode RT_RD { 604661Sksewell@umich.edu 0x0: decode SA default Nop::nop() { 615222Sksewell@umich.edu 0x1: ssnop({{;}}); 625222Sksewell@umich.edu 0x3: ehb({{;}}); 632686Sksewell@umich.edu } 642686Sksewell@umich.edu default: sll({{ Rd = Rt.uw << SA; }}); 652470SN/A } 662241SN/A } 672101SN/A 682495SN/A 0x2: decode RS_SRL { 692495SN/A 0x0:decode SRL { 702495SN/A 0: srl({{ Rd = Rt.uw >> SA; }}); 712101SN/A 722495SN/A //Hardcoded assuming 32-bit ISA, probably need parameter here 732495SN/A 1: rotr({{ Rd = (Rt.uw << (32 - SA)) | (Rt.uw >> SA);}}); 742495SN/A } 752101SN/A } 762101SN/A 772495SN/A 0x3: decode RS { 782495SN/A 0x0: sra({{ 792495SN/A uint32_t temp = Rt >> SA; 802495SN/A if ( (Rt & 0x80000000) > 0 ) { 812495SN/A uint32_t mask = 0x80000000; 822495SN/A for(int i=0; i < SA; i++) { 832495SN/A temp |= mask; 842495SN/A mask = mask >> 1; 852495SN/A } 862495SN/A } 872495SN/A Rd = temp; 882495SN/A }}); 892495SN/A } 902101SN/A 912101SN/A 0x4: sllv({{ Rd = Rt.uw << Rs<4:0>; }}); 922101SN/A 932101SN/A 0x6: decode SRLV { 942101SN/A 0: srlv({{ Rd = Rt.uw >> Rs<4:0>; }}); 952101SN/A 962101SN/A //Hardcoded assuming 32-bit ISA, probably need parameter here 972101SN/A 1: rotrv({{ Rd = (Rt.uw << (32 - Rs<4:0>)) | (Rt.uw >> Rs<4:0>);}}); 982101SN/A } 992101SN/A 1002495SN/A 0x7: srav({{ 1012495SN/A int shift_amt = Rs<4:0>; 1022495SN/A 1032495SN/A uint32_t temp = Rt >> shift_amt; 1042495SN/A 1052495SN/A if ( (Rt & 0x80000000) > 0 ) { 1062495SN/A uint32_t mask = 0x80000000; 1072495SN/A for(int i=0; i < shift_amt; i++) { 1082495SN/A temp |= mask; 1092495SN/A mask = mask >> 1; 1102495SN/A } 1112495SN/A } 1122495SN/A 1132495SN/A Rd = temp; 1142495SN/A }}); 1152043SN/A } 1162043SN/A } 1172025SN/A 1182043SN/A 0x1: decode FUNCTION_LO { 1192686Sksewell@umich.edu //Table A-3 Note: "Specific encodings of the hint field are 1202686Sksewell@umich.edu //used to distinguish JR from JR.HB and JALR from JALR.HB" 1212123SN/A format Jump { 1222101SN/A 0x0: decode HINT { 1235222Sksewell@umich.edu 0x1: jr_hb({{ if(Config1_CA == 0){NNPC = Rs;}else{panic("MIPS16e not supported\n");}; }}, IsReturn, ClearHazards); 1245222Sksewell@umich.edu default: jr({{ if(Config1_CA == 0){NNPC = Rs;}else{panic("MIPS16e not supported\n");};}}, IsReturn); 1252101SN/A } 1262042SN/A 1272101SN/A 0x1: decode HINT { 1284661Sksewell@umich.edu 0x1: jalr_hb({{ Rd = NNPC; NNPC = Rs; }}, IsCall 1292686Sksewell@umich.edu , ClearHazards); 1304661Sksewell@umich.edu default: jalr({{ Rd = NNPC; NNPC = Rs; }}, IsCall); 1312101SN/A } 1322101SN/A } 1332042SN/A 1342101SN/A format BasicOp { 1352686Sksewell@umich.edu 0x2: movz({{ Rd = (Rt == 0) ? Rs : Rd; }}); 1362686Sksewell@umich.edu 0x3: movn({{ Rd = (Rt != 0) ? Rs : Rd; }}); 1375222Sksewell@umich.edu#if FULL_SYSTEM 1386036Sksewell@umich.edu 0x4: syscall({{ 1395222Sksewell@umich.edu fault = new SystemCallFault(); 1405222Sksewell@umich.edu }}); 1415222Sksewell@umich.edu#else 1422965Sksewell@umich.edu 0x4: syscall({{ xc->syscall(R2); }}, 1436037Sksewell@umich.edu IsSerializeAfter, IsNonSpeculative); 1445222Sksewell@umich.edu#endif 1452686Sksewell@umich.edu 0x7: sync({{ ; }}, IsMemBarrier); 1465222Sksewell@umich.edu 0x5: break({{fault = new BreakpointFault();}}); 1472101SN/A } 1482083SN/A 1492043SN/A } 1502025SN/A 1512043SN/A 0x2: decode FUNCTION_LO { 1525222Sksewell@umich.edu 0x0: HiLoRsSelOp::mfhi({{ Rd = HI_RS_SEL; }}, IntMultOp, IsIprAccess); 1534661Sksewell@umich.edu 0x1: HiLoRdSelOp::mthi({{ HI_RD_SEL = Rs; }}); 1545222Sksewell@umich.edu 0x2: HiLoRsSelOp::mflo({{ Rd = LO_RS_SEL; }}, IntMultOp, IsIprAccess); 1554661Sksewell@umich.edu 0x3: HiLoRdSelOp::mtlo({{ LO_RD_SEL = Rs; }}); 1562083SN/A } 1572025SN/A 1582043SN/A 0x3: decode FUNCTION_LO { 1594661Sksewell@umich.edu format HiLoRdSelValOp { 1605222Sksewell@umich.edu 0x0: mult({{ val = Rs.sd * Rt.sd; }}, IntMultOp); 1615222Sksewell@umich.edu 0x1: multu({{ val = Rs.ud * Rt.ud; }}, IntMultOp); 1624661Sksewell@umich.edu } 1634661Sksewell@umich.edu 1642686Sksewell@umich.edu format HiLoOp { 1654661Sksewell@umich.edu 0x2: div({{ if (Rt.sd != 0) { 1664661Sksewell@umich.edu HI0 = Rs.sd % Rt.sd; 1674661Sksewell@umich.edu LO0 = Rs.sd / Rt.sd; 1684661Sksewell@umich.edu } 1695222Sksewell@umich.edu }}, IntDivOp); 1705222Sksewell@umich.edu 1714661Sksewell@umich.edu 0x3: divu({{ if (Rt.ud != 0) { 1724661Sksewell@umich.edu HI0 = Rs.ud % Rt.ud; 1734661Sksewell@umich.edu LO0 = Rs.ud / Rt.ud; 1744661Sksewell@umich.edu } 1755222Sksewell@umich.edu }}, IntDivOp); 1762101SN/A } 1772084SN/A } 1782025SN/A 1792495SN/A 0x4: decode HINT { 1802495SN/A 0x0: decode FUNCTION_LO { 1812495SN/A format IntOp { 1825222Sksewell@umich.edu 0x0: add({{ /* More complicated since an ADD can cause an arithmetic overflow exception */ 1835222Sksewell@umich.edu int64_t Src1 = Rs.sw; 1845222Sksewell@umich.edu int64_t Src2 = Rt.sw; 1855222Sksewell@umich.edu int64_t temp_result; 1865222Sksewell@umich.edu#if FULL_SYSTEM 1875222Sksewell@umich.edu if(((Src1 >> 31) & 1) == 1) 1885222Sksewell@umich.edu Src1 |= 0x100000000LL; 1895222Sksewell@umich.edu#endif 1905222Sksewell@umich.edu temp_result = Src1 + Src2; 1915222Sksewell@umich.edu#if FULL_SYSTEM 1925222Sksewell@umich.edu if(((temp_result >> 31) & 1) == ((temp_result >> 32) & 1)){ 1935222Sksewell@umich.edu#endif 1945222Sksewell@umich.edu Rd.sw = temp_result; 1955222Sksewell@umich.edu#if FULL_SYSTEM 1965222Sksewell@umich.edu } else{ 1975222Sksewell@umich.edu fault = new ArithmeticFault(); 1985222Sksewell@umich.edu } 1995222Sksewell@umich.edu#endif 2005222Sksewell@umich.edu 2015222Sksewell@umich.edu }}); 2022495SN/A 0x1: addu({{ Rd.sw = Rs.sw + Rt.sw;}}); 2035222Sksewell@umich.edu 0x2: sub({{ 2045222Sksewell@umich.edu /* More complicated since an SUB can cause an arithmetic overflow exception */ 2055222Sksewell@umich.edu int64_t Src1 = Rs.sw; 2065222Sksewell@umich.edu int64_t Src2 = Rt.sw; 2075222Sksewell@umich.edu int64_t temp_result = Src1 - Src2; 2085222Sksewell@umich.edu#if FULL_SYSTEM 2095222Sksewell@umich.edu if(((temp_result >> 31) & 1) == ((temp_result>>32) & 1)){ 2105222Sksewell@umich.edu#endif 2115222Sksewell@umich.edu Rd.sw = temp_result; 2125222Sksewell@umich.edu#if FULL_SYSTEM 2135222Sksewell@umich.edu } else{ 2145222Sksewell@umich.edu fault = new ArithmeticFault(); 2155222Sksewell@umich.edu } 2165222Sksewell@umich.edu#endif 2175222Sksewell@umich.edu }}); 2182495SN/A 0x3: subu({{ Rd.sw = Rs.sw - Rt.sw;}}); 2192495SN/A 0x4: and({{ Rd = Rs & Rt;}}); 2202495SN/A 0x5: or({{ Rd = Rs | Rt;}}); 2212495SN/A 0x6: xor({{ Rd = Rs ^ Rt;}}); 2222495SN/A 0x7: nor({{ Rd = ~(Rs | Rt);}}); 2232495SN/A } 2242101SN/A } 2252043SN/A } 2262025SN/A 2272495SN/A 0x5: decode HINT { 2282495SN/A 0x0: decode FUNCTION_LO { 2292495SN/A format IntOp{ 2302495SN/A 0x2: slt({{ Rd.sw = ( Rs.sw < Rt.sw ) ? 1 : 0}}); 2312495SN/A 0x3: sltu({{ Rd.uw = ( Rs.uw < Rt.uw ) ? 1 : 0}}); 2322495SN/A } 2332101SN/A } 2342084SN/A } 2352024SN/A 2362043SN/A 0x6: decode FUNCTION_LO { 2372239SN/A format Trap { 2382239SN/A 0x0: tge({{ cond = (Rs.sw >= Rt.sw); }}); 2392101SN/A 0x1: tgeu({{ cond = (Rs.uw >= Rt.uw); }}); 2402101SN/A 0x2: tlt({{ cond = (Rs.sw < Rt.sw); }}); 2415222Sksewell@umich.edu 0x3: tltu({{ cond = (Rs.uw < Rt.uw); }}); 2422101SN/A 0x4: teq({{ cond = (Rs.sw == Rt.sw); }}); 2432101SN/A 0x6: tne({{ cond = (Rs.sw != Rt.sw); }}); 2442101SN/A } 2452043SN/A } 2462043SN/A } 2472025SN/A 2482043SN/A 0x1: decode REGIMM_HI { 2492043SN/A 0x0: decode REGIMM_LO { 2502101SN/A format Branch { 2512101SN/A 0x0: bltz({{ cond = (Rs.sw < 0); }}); 2522101SN/A 0x1: bgez({{ cond = (Rs.sw >= 0); }}); 2532686Sksewell@umich.edu 0x2: bltzl({{ cond = (Rs.sw < 0); }}, Likely); 2542686Sksewell@umich.edu 0x3: bgezl({{ cond = (Rs.sw >= 0); }}, Likely); 2552101SN/A } 2562043SN/A } 2572025SN/A 2582043SN/A 0x1: decode REGIMM_LO { 2595222Sksewell@umich.edu format TrapImm { 2605222Sksewell@umich.edu 0x0: tgei( {{ cond = (Rs.sw >= (int16_t)INTIMM); }}); 2615222Sksewell@umich.edu 0x1: tgeiu({{ cond = (Rs.uw >= (uint32_t)((int32_t)((int16_t)INTIMM))); }}); 2625222Sksewell@umich.edu 0x2: tlti( {{ cond = (Rs.sw < (int16_t)INTIMM); }}); 2635222Sksewell@umich.edu 0x3: tltiu({{ cond = (Rs.uw < (uint32_t)((int32_t)((int16_t)INTIMM))); }}); 2645222Sksewell@umich.edu 0x4: teqi( {{ cond = (Rs.sw == (int16_t)INTIMM);}}); 2655222Sksewell@umich.edu 0x6: tnei( {{ cond = (Rs.sw != (int16_t)INTIMM);}}); 2662101SN/A } 2672043SN/A } 2682043SN/A 2692043SN/A 0x2: decode REGIMM_LO { 2702101SN/A format Branch { 2712686Sksewell@umich.edu 0x0: bltzal({{ cond = (Rs.sw < 0); }}, Link); 2722686Sksewell@umich.edu 0x1: decode RS { 2732686Sksewell@umich.edu 0x0: bal ({{ cond = 1; }}, IsCall, Link); 2742686Sksewell@umich.edu default: bgezal({{ cond = (Rs.sw >= 0); }}, Link); 2752686Sksewell@umich.edu } 2762686Sksewell@umich.edu 0x2: bltzall({{ cond = (Rs.sw < 0); }}, Link, Likely); 2772686Sksewell@umich.edu 0x3: bgezall({{ cond = (Rs.sw >= 0); }}, Link, Likely); 2782101SN/A } 2792043SN/A } 2802043SN/A 2812043SN/A 0x3: decode REGIMM_LO { 2824661Sksewell@umich.edu // from Table 5-4 MIPS32 REGIMM Encoding of rt Field (DSP ASE MANUAL) 2834661Sksewell@umich.edu 0x4: DspBranch::bposge32({{ cond = (dspctl<5:0> >= 32); }}); 2842101SN/A format WarnUnimpl { 2852101SN/A 0x7: synci(); 2862101SN/A } 2872043SN/A } 2882043SN/A } 2892043SN/A 2902123SN/A format Jump { 2912239SN/A 0x2: j({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2);}}); 2922686Sksewell@umich.edu 0x3: jal({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }}, IsCall, 2932686Sksewell@umich.edu Link); 2942043SN/A } 2952043SN/A 2962100SN/A format Branch { 2972686Sksewell@umich.edu 0x4: decode RS_RT { 2982686Sksewell@umich.edu 0x0: b({{ cond = 1; }}); 2992686Sksewell@umich.edu default: beq({{ cond = (Rs.sw == Rt.sw); }}); 3002686Sksewell@umich.edu } 3012239SN/A 0x5: bne({{ cond = (Rs.sw != Rt.sw); }}); 3022686Sksewell@umich.edu 0x6: blez({{ cond = (Rs.sw <= 0); }}); 3032686Sksewell@umich.edu 0x7: bgtz({{ cond = (Rs.sw > 0); }}); 3042043SN/A } 3052084SN/A } 3062024SN/A 3072101SN/A 0x1: decode OPCODE_LO { 3082686Sksewell@umich.edu format IntImmOp { 3095222Sksewell@umich.edu 0x0: addi({{ 3105222Sksewell@umich.edu int64_t Src1 = Rs.sw; 3115222Sksewell@umich.edu int64_t Src2 = imm; 3125222Sksewell@umich.edu int64_t temp_result; 3135222Sksewell@umich.edu#if FULL_SYSTEM 3145222Sksewell@umich.edu if(((Src1 >> 31) & 1) == 1) 3155222Sksewell@umich.edu Src1 |= 0x100000000LL; 3165222Sksewell@umich.edu#endif 3175222Sksewell@umich.edu temp_result = Src1 + Src2; 3185222Sksewell@umich.edu#if FULL_SYSTEM 3195222Sksewell@umich.edu if(((temp_result >> 31) & 1) == ((temp_result >> 32) & 1)){ 3205222Sksewell@umich.edu#endif 3215222Sksewell@umich.edu Rt.sw = temp_result; 3225222Sksewell@umich.edu#if FULL_SYSTEM 3235222Sksewell@umich.edu } else{ 3245222Sksewell@umich.edu fault = new ArithmeticFault(); 3255222Sksewell@umich.edu } 3265222Sksewell@umich.edu#endif 3275222Sksewell@umich.edu }}); 3282239SN/A 0x1: addiu({{ Rt.sw = Rs.sw + imm;}}); 3292239SN/A 0x2: slti({{ Rt.sw = ( Rs.sw < imm) ? 1 : 0 }}); 3304661Sksewell@umich.edu 3314661Sksewell@umich.edu //Edited to include MIPS AVP Pass/Fail instructions and 3324661Sksewell@umich.edu //default to the sltiu instruction 3334661Sksewell@umich.edu 0x3: decode RS_RT_INTIMM { 3344661Sksewell@umich.edu 0xabc1: BasicOp::fail({{ exitSimLoop("AVP/SRVP Test Failed"); }}); 3354661Sksewell@umich.edu 0xabc2: BasicOp::pass({{ exitSimLoop("AVP/SRVP Test Passed"); }}); 3364661Sksewell@umich.edu default: sltiu({{ Rt.uw = ( Rs.uw < (uint32_t)sextImm ) ? 1 : 0 }}); 3374661Sksewell@umich.edu } 3384661Sksewell@umich.edu 3392495SN/A 0x4: andi({{ Rt.sw = Rs.sw & zextImm;}}); 3402495SN/A 0x5: ori({{ Rt.sw = Rs.sw | zextImm;}}); 3412495SN/A 0x6: xori({{ Rt.sw = Rs.sw ^ zextImm;}}); 3422495SN/A 3432495SN/A 0x7: decode RS { 3442495SN/A 0x0: lui({{ Rt = imm << 16}}); 3452495SN/A } 3462084SN/A } 3472084SN/A } 3482024SN/A 3492101SN/A 0x2: decode OPCODE_LO { 3502101SN/A //Table A-11 MIPS32 COP0 Encoding of rs Field 3512101SN/A 0x0: decode RS_MSB { 3522101SN/A 0x0: decode RS { 3535222Sksewell@umich.edu format CP0Control { 3545222Sksewell@umich.edu 0x0: mfc0({{ Rt = CP0_RD_SEL; 3555222Sksewell@umich.edu /* Hack for PageMask */ 3565222Sksewell@umich.edu if(RD == 5) // PageMask 3575222Sksewell@umich.edu if(Config3_SP == 0 || PageGrain_ESP == 0) 3585222Sksewell@umich.edu Rt &= 0xFFFFE7FF; 3595222Sksewell@umich.edu }}); 3605222Sksewell@umich.edu 0x4: mtc0({{ CP0_RD_SEL = Rt; 3612052SN/A 3625222Sksewell@umich.edu if(RD == 11) // Compare{ 3635222Sksewell@umich.edu if(Cause_TI == 1){ 3645222Sksewell@umich.edu Cause_TI = 0; 3655222Sksewell@umich.edu MiscReg cause = xc->readMiscRegNoEffect(MipsISA::Cause); 3665222Sksewell@umich.edu int Offset = 10; // corresponding to Cause_IP0 3675222Sksewell@umich.edu Offset += ((IntCtl_IPTI) - 2); 3685222Sksewell@umich.edu replaceBits(cause,Offset,Offset,0); 3695222Sksewell@umich.edu xc->setMiscRegNoEffect(MipsISA::Cause,cause); 3705222Sksewell@umich.edu } 3714661Sksewell@umich.edu 3725222Sksewell@umich.edu }}); 3735222Sksewell@umich.edu } 3745222Sksewell@umich.edu format CP0Unimpl { 3755222Sksewell@umich.edu 0x1: dmfc0(); 3765222Sksewell@umich.edu 0x5: dmtc0(); 3775222Sksewell@umich.edu default: unknown(); 3785222Sksewell@umich.edu } 3794661Sksewell@umich.edu format MT_MFTR { // Decode MIPS MT MFTR instruction into sub-instructions 3804661Sksewell@umich.edu 0x8: decode MT_U { 3814661Sksewell@umich.edu 0x0: mftc0({{ data = xc->readRegOtherThread((RT << 3 | SEL) + 3824661Sksewell@umich.edu Ctrl_Base_DepTag); 3834661Sksewell@umich.edu }}); 3844661Sksewell@umich.edu 0x1: decode SEL { 3854661Sksewell@umich.edu 0x0: mftgpr({{ data = xc->readRegOtherThread(RT); }}); 3864661Sksewell@umich.edu 0x1: decode RT { 3874661Sksewell@umich.edu 0x0: mftlo_dsp0({{ data = xc->readRegOtherThread(MipsISA::DSPLo0); }}); 3884661Sksewell@umich.edu 0x1: mfthi_dsp0({{ data = xc->readRegOtherThread(MipsISA::DSPHi0); }}); 3894661Sksewell@umich.edu 0x2: mftacx_dsp0({{ data = xc->readRegOtherThread(MipsISA::DSPACX0); }}); 3904661Sksewell@umich.edu 0x4: mftlo_dsp1({{ data = xc->readRegOtherThread(MipsISA::DSPLo1); }}); 3914661Sksewell@umich.edu 0x5: mfthi_dsp1({{ data = xc->readRegOtherThread(MipsISA::DSPHi1); }}); 3924661Sksewell@umich.edu 0x6: mftacx_dsp1({{ data = xc->readRegOtherThread(MipsISA::DSPACX1); }}); 3934661Sksewell@umich.edu 0x8: mftlo_dsp2({{ data = xc->readRegOtherThread(MipsISA::DSPLo2); }}); 3944661Sksewell@umich.edu 0x9: mfthi_dsp2({{ data = xc->readRegOtherThread(MipsISA::DSPHi2); }}); 3954661Sksewell@umich.edu 0x10: mftacx_dsp2({{ data = xc->readRegOtherThread(MipsISA::DSPACX2); }}); 3964661Sksewell@umich.edu 0x12: mftlo_dsp3({{ data = xc->readRegOtherThread(MipsISA::DSPLo3); }}); 3974661Sksewell@umich.edu 0x13: mfthi_dsp3({{ data = xc->readRegOtherThread(MipsISA::DSPHi3); }}); 3984661Sksewell@umich.edu 0x14: mftacx_dsp3({{ data = xc->readRegOtherThread(MipsISA::DSPACX3); }}); 3994661Sksewell@umich.edu 0x16: mftdsp({{ data = xc->readRegOtherThread(MipsISA::DSPControl); }}); 4005222Sksewell@umich.edu default: CP0Unimpl::unknown(); 4012686Sksewell@umich.edu } 4024661Sksewell@umich.edu 0x2: decode MT_H { 4034661Sksewell@umich.edu 0x0: mftc1({{ data = xc->readRegOtherThread(RT + 4044661Sksewell@umich.edu FP_Base_DepTag); 4054661Sksewell@umich.edu }}); 4064661Sksewell@umich.edu 0x1: mfthc1({{ data = xc->readRegOtherThread(RT + 4074661Sksewell@umich.edu FP_Base_DepTag); 4084661Sksewell@umich.edu }}); 4095222Sksewell@umich.edu } 4104661Sksewell@umich.edu 0x3: cftc1({{ uint32_t fcsr_val = xc->readRegOtherThread(MipsISA::FCSR + 4114661Sksewell@umich.edu FP_Base_DepTag); 4124661Sksewell@umich.edu switch (RT) 4134661Sksewell@umich.edu { 4144661Sksewell@umich.edu case 0: 4154661Sksewell@umich.edu data = xc->readRegOtherThread(MipsISA::FIR + 4164661Sksewell@umich.edu Ctrl_Base_DepTag); 4174661Sksewell@umich.edu break; 4184661Sksewell@umich.edu case 25: 4195570Snate@binkert.org data = (fcsr_val & 0xFE000000 >> 24) 4205570Snate@binkert.org | (fcsr_val & 0x00800000 >> 23); 4214661Sksewell@umich.edu break; 4224661Sksewell@umich.edu case 26: 4235570Snate@binkert.org data = fcsr_val & 0x0003F07C; 4244661Sksewell@umich.edu break; 4254661Sksewell@umich.edu case 28: 4265570Snate@binkert.org data = (fcsr_val & 0x00000F80) 4275570Snate@binkert.org | (fcsr_val & 0x01000000 >> 21) 4285570Snate@binkert.org | (fcsr_val & 0x00000003); 4294661Sksewell@umich.edu break; 4304661Sksewell@umich.edu case 31: 4314661Sksewell@umich.edu data = fcsr_val; 4324661Sksewell@umich.edu break; 4334661Sksewell@umich.edu default: 4344661Sksewell@umich.edu fatal("FP Control Value (%d) Not Valid"); 4354661Sksewell@umich.edu } 4364661Sksewell@umich.edu }}); 4375222Sksewell@umich.edu default: CP0Unimpl::unknown(); 4382101SN/A } 4395222Sksewell@umich.edu } 4402686Sksewell@umich.edu } 4412027SN/A 4424661Sksewell@umich.edu format MT_MTTR { // Decode MIPS MT MTTR instruction into sub-instructions 4434661Sksewell@umich.edu 0xC: decode MT_U { 4444661Sksewell@umich.edu 0x0: mttc0({{ xc->setRegOtherThread((RD << 3 | SEL) + Ctrl_Base_DepTag, 4454661Sksewell@umich.edu Rt); 4464661Sksewell@umich.edu }}); 4474661Sksewell@umich.edu 0x1: decode SEL { 4484661Sksewell@umich.edu 0x0: mttgpr({{ xc->setRegOtherThread(RD, Rt); }}); 4494661Sksewell@umich.edu 0x1: decode RT { 4504661Sksewell@umich.edu 0x0: mttlo_dsp0({{ xc->setRegOtherThread(MipsISA::DSPLo0, Rt); 4514661Sksewell@umich.edu }}); 4524661Sksewell@umich.edu 0x1: mtthi_dsp0({{ xc->setRegOtherThread(MipsISA::DSPHi0, 4534661Sksewell@umich.edu Rt); 4544661Sksewell@umich.edu }}); 4554661Sksewell@umich.edu 0x2: mttacx_dsp0({{ xc->setRegOtherThread(MipsISA::DSPACX0, 4564661Sksewell@umich.edu Rt); 4574661Sksewell@umich.edu }}); 4584661Sksewell@umich.edu 0x4: mttlo_dsp1({{ xc->setRegOtherThread(MipsISA::DSPLo1, 4594661Sksewell@umich.edu Rt); 4604661Sksewell@umich.edu }}); 4614661Sksewell@umich.edu 0x5: mtthi_dsp1({{ xc->setRegOtherThread(MipsISA::DSPHi1, 4624661Sksewell@umich.edu Rt); 4634661Sksewell@umich.edu }}); 4644661Sksewell@umich.edu 0x6: mttacx_dsp1({{ xc->setRegOtherThread(MipsISA::DSPACX1, 4654661Sksewell@umich.edu Rt); 4664661Sksewell@umich.edu }}); 4674661Sksewell@umich.edu 0x8: mttlo_dsp2({{ xc->setRegOtherThread(MipsISA::DSPLo2, 4684661Sksewell@umich.edu Rt); 4694661Sksewell@umich.edu }}); 4704661Sksewell@umich.edu 0x9: mtthi_dsp2({{ xc->setRegOtherThread(MipsISA::DSPHi2, 4714661Sksewell@umich.edu Rt); 4724661Sksewell@umich.edu }}); 4734661Sksewell@umich.edu 0x10: mttacx_dsp2({{ xc->setRegOtherThread(MipsISA::DSPACX2, 4744661Sksewell@umich.edu Rt); 4754661Sksewell@umich.edu }}); 4764661Sksewell@umich.edu 0x12: mttlo_dsp3({{ xc->setRegOtherThread(MipsISA::DSPLo3, 4774661Sksewell@umich.edu Rt); 4784661Sksewell@umich.edu }}); 4794661Sksewell@umich.edu 0x13: mtthi_dsp3({{ xc->setRegOtherThread(MipsISA::DSPHi3, 4804661Sksewell@umich.edu Rt); 4814661Sksewell@umich.edu }}); 4824661Sksewell@umich.edu 0x14: mttacx_dsp3({{ xc->setRegOtherThread(MipsISA::DSPACX3, Rt); 4834661Sksewell@umich.edu }}); 4844661Sksewell@umich.edu 0x16: mttdsp({{ xc->setRegOtherThread(MipsISA::DSPControl, Rt); }}); 4855222Sksewell@umich.edu default: CP0Unimpl::unknown(); 4865222Sksewell@umich.edu 4874661Sksewell@umich.edu } 4884661Sksewell@umich.edu 0x2: mttc1({{ uint64_t data = xc->readRegOtherThread(RD + 4894661Sksewell@umich.edu FP_Base_DepTag); 4904661Sksewell@umich.edu data = insertBits(data, top_bit, bottom_bit, Rt); 4914661Sksewell@umich.edu xc->setRegOtherThread(RD + FP_Base_DepTag, data); 4924661Sksewell@umich.edu }}); 4934661Sksewell@umich.edu 0x3: cttc1({{ uint32_t data; 4944661Sksewell@umich.edu switch (RD) 4954661Sksewell@umich.edu { 4964661Sksewell@umich.edu case 25: 4974661Sksewell@umich.edu data = 0 | (Rt.uw<7:1> << 25) // move 31...25 4984661Sksewell@umich.edu | (FCSR & 0x01000000) // bit 24 4994661Sksewell@umich.edu | (FCSR & 0x004FFFFF);// bit 22...0 5004661Sksewell@umich.edu break; 5014661Sksewell@umich.edu 5024661Sksewell@umich.edu case 26: 5034661Sksewell@umich.edu data = 0 | (FCSR & 0xFFFC0000) // move 31...18 5044661Sksewell@umich.edu | Rt.uw<17:12> << 12 // bit 17...12 5054661Sksewell@umich.edu | (FCSR & 0x00000F80) << 7// bit 11...7 5064661Sksewell@umich.edu | Rt.uw<6:2> << 2 // bit 6...2 5074661Sksewell@umich.edu | (FCSR & 0x00000002); // bit 1...0 5084661Sksewell@umich.edu break; 5094661Sksewell@umich.edu 5104661Sksewell@umich.edu case 28: 5114661Sksewell@umich.edu data = 0 | (FCSR & 0xFE000000) // move 31...25 5124661Sksewell@umich.edu | Rt.uw<2:2> << 24 // bit 24 5134661Sksewell@umich.edu | (FCSR & 0x00FFF000) << 23// bit 23...12 5144661Sksewell@umich.edu | Rt.uw<11:7> << 7 // bit 24 5154661Sksewell@umich.edu | (FCSR & 0x000007E) 5164661Sksewell@umich.edu | Rt.uw<1:0>;// bit 22...0 5174661Sksewell@umich.edu break; 5184661Sksewell@umich.edu 5194661Sksewell@umich.edu case 31: 5204661Sksewell@umich.edu data = Rt.uw; 5214661Sksewell@umich.edu break; 5224661Sksewell@umich.edu 5234661Sksewell@umich.edu default: 5244661Sksewell@umich.edu panic("FP Control Value (%d) Not Available. Ignoring Access to" 5254661Sksewell@umich.edu "Floating Control Status Register", FS); 5264661Sksewell@umich.edu } 5274661Sksewell@umich.edu xc->setRegOtherThread(FCSR, data); 5284661Sksewell@umich.edu }}); 5295222Sksewell@umich.edu default: CP0Unimpl::unknown(); 5304661Sksewell@umich.edu } 5314661Sksewell@umich.edu } 5322101SN/A } 5334661Sksewell@umich.edu 5344661Sksewell@umich.edu 5354661Sksewell@umich.edu 0xB: decode RD { 5364661Sksewell@umich.edu format MT_Control { 5374661Sksewell@umich.edu 0x0: decode POS { 5384661Sksewell@umich.edu 0x0: decode SEL { 5394661Sksewell@umich.edu 0x1: decode SC { 5404661Sksewell@umich.edu 0x0: dvpe({{ Rt = MVPControl; 5414661Sksewell@umich.edu if (VPEConf0<VPEC0_MVP:> == 1) { 5424661Sksewell@umich.edu MVPControl = insertBits(MVPControl, MVPC_EVP, 0); 5434661Sksewell@umich.edu } 5444661Sksewell@umich.edu }}); 5454661Sksewell@umich.edu 0x1: evpe({{ Rt = MVPControl; 5464661Sksewell@umich.edu if (VPEConf0<VPEC0_MVP:> == 1) { 5474661Sksewell@umich.edu MVPControl = insertBits(MVPControl, MVPC_EVP, 1); 5484661Sksewell@umich.edu } 5494661Sksewell@umich.edu }}); 5505222Sksewell@umich.edu default:CP0Unimpl::unknown(); 5514661Sksewell@umich.edu } 5525222Sksewell@umich.edu default:CP0Unimpl::unknown(); 5534661Sksewell@umich.edu } 5545222Sksewell@umich.edu default:CP0Unimpl::unknown(); 5555222Sksewell@umich.edu } 5564661Sksewell@umich.edu 5574661Sksewell@umich.edu 0x1: decode POS { 5584661Sksewell@umich.edu 0xF: decode SEL { 5594661Sksewell@umich.edu 0x1: decode SC { 5604661Sksewell@umich.edu 0x0: dmt({{ Rt = VPEControl; 5614661Sksewell@umich.edu VPEControl = insertBits(VPEControl, VPEC_TE, 0); 5624661Sksewell@umich.edu }}); 5634661Sksewell@umich.edu 0x1: emt({{ Rt = VPEControl; 5644661Sksewell@umich.edu VPEControl = insertBits(VPEControl, VPEC_TE, 1); 5654661Sksewell@umich.edu }}); 5665222Sksewell@umich.edu default:CP0Unimpl::unknown(); 5674661Sksewell@umich.edu } 5685222Sksewell@umich.edu default:CP0Unimpl::unknown(); 5694661Sksewell@umich.edu } 5705222Sksewell@umich.edu default:CP0Unimpl::unknown(); 5714661Sksewell@umich.edu } 5724661Sksewell@umich.edu } 5734661Sksewell@umich.edu 0xC: decode POS { 5744661Sksewell@umich.edu 0x0: decode SC { 5754661Sksewell@umich.edu 0x0: CP0Control::di({{ 5764661Sksewell@umich.edu if(Config_AR >= 1) // Rev 2.0 or beyond? 5774661Sksewell@umich.edu { 5784661Sksewell@umich.edu Rt = Status; 5794661Sksewell@umich.edu Status_IE = 0; 5804661Sksewell@umich.edu } 5814661Sksewell@umich.edu else // Enable this else branch once we actually set values for Config on init 5824661Sksewell@umich.edu { 5834661Sksewell@umich.edu fault = new ReservedInstructionFault(); 5844661Sksewell@umich.edu } 5854661Sksewell@umich.edu }}); 5864661Sksewell@umich.edu 0x1: CP0Control::ei({{ 5874661Sksewell@umich.edu if(Config_AR >= 1) 5884661Sksewell@umich.edu { 5894661Sksewell@umich.edu Rt = Status; 5904661Sksewell@umich.edu Status_IE = 1; 5914661Sksewell@umich.edu } 5924661Sksewell@umich.edu else 5934661Sksewell@umich.edu { 5944661Sksewell@umich.edu fault = new ReservedInstructionFault(); 5954661Sksewell@umich.edu } 5964661Sksewell@umich.edu }}); 5975222Sksewell@umich.edu default:CP0Unimpl::unknown(); 5984661Sksewell@umich.edu } 5994661Sksewell@umich.edu } 6005222Sksewell@umich.edu default: CP0Unimpl::unknown(); 6014661Sksewell@umich.edu } 6024661Sksewell@umich.edu format CP0Control { 6034661Sksewell@umich.edu 0xA: rdpgpr({{ 6044661Sksewell@umich.edu if(Config_AR >= 1) 6054661Sksewell@umich.edu { // Rev 2 of the architecture 6065585Sksewell@umich.edu panic("Shadow Sets Not Fully Implemented.\n"); 6075585Sksewell@umich.edu //Rd = xc->tcBase()->readIntReg(RT + NumIntRegs * SRSCtl_PSS); 6084661Sksewell@umich.edu } 6094661Sksewell@umich.edu else 6104661Sksewell@umich.edu { 6114661Sksewell@umich.edu fault = new ReservedInstructionFault(); 6124661Sksewell@umich.edu } 6134661Sksewell@umich.edu }}); 6144661Sksewell@umich.edu 0xE: wrpgpr({{ 6154661Sksewell@umich.edu if(Config_AR >= 1) 6164661Sksewell@umich.edu { // Rev 2 of the architecture 6175585Sksewell@umich.edu panic("Shadow Sets Not Fully Implemented.\n"); 6185585Sksewell@umich.edu //xc->tcBase()->setIntReg(RD + NumIntRegs * SRSCtl_PSS,Rt); 6195222Sksewell@umich.edu // warn("Writing %d to %d, PSS: %d, SRS: %x\n",Rt,RD + NumIntRegs * SRSCtl_PSS, SRSCtl_PSS,SRSCtl); 6204661Sksewell@umich.edu } 6214661Sksewell@umich.edu else 6224661Sksewell@umich.edu { 6234661Sksewell@umich.edu fault = new ReservedInstructionFault(); 6244661Sksewell@umich.edu } 6254661Sksewell@umich.edu 6264661Sksewell@umich.edu }}); 6274661Sksewell@umich.edu } 6284661Sksewell@umich.edu 6295222Sksewell@umich.edu } 6302101SN/A 6312101SN/A //Table A-12 MIPS32 COP0 Encoding of Function Field When rs=CO 6322101SN/A 0x1: decode FUNCTION { 6334661Sksewell@umich.edu format CP0Control { 6344661Sksewell@umich.edu 0x18: eret({{ 6355222Sksewell@umich.edu DPRINTF(MipsPRA,"Restoring PC - %x\n",EPC); 6365222Sksewell@umich.edu // Ugly hack to get the value of Status_EXL 6375222Sksewell@umich.edu if(Status_EXL == 1){ 6385222Sksewell@umich.edu DPRINTF(MipsPRA,"ERET EXL Hack\n"); 6395222Sksewell@umich.edu } 6404661Sksewell@umich.edu if(Status_ERL == 1){ 6414661Sksewell@umich.edu Status_ERL = 0; 6424661Sksewell@umich.edu NPC = ErrorEPC; 6435222Sksewell@umich.edu NNPC = ErrorEPC + sizeof(MachInst); // Need to adjust NNPC, otherwise things break 6444661Sksewell@umich.edu } 6455222Sksewell@umich.edu else { 6464661Sksewell@umich.edu NPC = EPC; 6475222Sksewell@umich.edu NNPC = EPC + sizeof(MachInst); // Need to adjust NNPC, otherwise things break 6484661Sksewell@umich.edu Status_EXL = 0; 6495222Sksewell@umich.edu if(Config_AR >=1 && SRSCtl_HSS > 0 && Status_BEV == 0){ 6504661Sksewell@umich.edu SRSCtl_CSS = SRSCtl_PSS; 6515250Sksewell@umich.edu //xc->setShadowSet(SRSCtl_PSS); 6524661Sksewell@umich.edu } 6534661Sksewell@umich.edu } 6545222Sksewell@umich.edu LLFlag = 0; 6555222Sksewell@umich.edu }},IsReturn,IsSerializing,IsERET); 6565222Sksewell@umich.edu 6575222Sksewell@umich.edu 0x1F: deret({{ 6585222Sksewell@umich.edu // if(EJTagImplemented()) { 6595222Sksewell@umich.edu if(Debug_DM == 1){ 6605222Sksewell@umich.edu Debug_DM = 1; 6615222Sksewell@umich.edu Debug_IEXI = 0; 6625222Sksewell@umich.edu NPC = DEPC; 6635222Sksewell@umich.edu } 6645222Sksewell@umich.edu else 6655222Sksewell@umich.edu { 6665222Sksewell@umich.edu // Undefined; 6675222Sksewell@umich.edu } 6685222Sksewell@umich.edu //} // EJTag Implemented 6695222Sksewell@umich.edu //else { 6705222Sksewell@umich.edu // Reserved Instruction Exception 6715222Sksewell@umich.edu //} 6725222Sksewell@umich.edu }},IsReturn,IsSerializing,IsERET); 6735222Sksewell@umich.edu } 6745222Sksewell@umich.edu format CP0TLB { 6755222Sksewell@umich.edu 0x01: tlbr({{ 6765222Sksewell@umich.edu MipsISA::PTE *PTEntry = xc->tcBase()->getITBPtr()->getEntry(Index & 0x7FFFFFFF); 6775222Sksewell@umich.edu if(PTEntry == NULL) 6785222Sksewell@umich.edu { 6795222Sksewell@umich.edu fatal("Invalid PTE Entry received on a TLBR instruction\n"); 6805222Sksewell@umich.edu } 6815222Sksewell@umich.edu /* Setup PageMask */ 6825222Sksewell@umich.edu PageMask = (PTEntry->Mask << 11); // If 1KB pages are not enabled, a read of PageMask must return 0b00 in bits 12, 11 6835222Sksewell@umich.edu /* Setup EntryHi */ 6845222Sksewell@umich.edu EntryHi = ((PTEntry->VPN << 11) | (PTEntry->asid)); 6855222Sksewell@umich.edu /* Setup Entry Lo0 */ 6865222Sksewell@umich.edu EntryLo0 = ((PTEntry->PFN0 << 6) | (PTEntry->C0 << 3) | (PTEntry->D0 << 2) | (PTEntry->V0 << 1) | PTEntry->G); 6875222Sksewell@umich.edu /* Setup Entry Lo1 */ 6885222Sksewell@umich.edu EntryLo1 = ((PTEntry->PFN1 << 6) | (PTEntry->C1 << 3) | (PTEntry->D1 << 2) | (PTEntry->V1 << 1) | PTEntry->G); 6895222Sksewell@umich.edu }}); // Need to hook up to TLB 6905222Sksewell@umich.edu 6915222Sksewell@umich.edu 0x02: tlbwi({{ 6925222Sksewell@umich.edu //Create PTE 6935222Sksewell@umich.edu MipsISA::PTE NewEntry; 6945222Sksewell@umich.edu //Write PTE 6955222Sksewell@umich.edu NewEntry.Mask = (Addr)(PageMask >> 11); 6965222Sksewell@umich.edu NewEntry.VPN = (Addr)(EntryHi >> 11); 6975222Sksewell@umich.edu /* PageGrain _ ESP Config3 _ SP */ 6985222Sksewell@umich.edu if(((PageGrain>>28) & 1) == 0 || ((Config3>>4)&1) ==0) { 6995222Sksewell@umich.edu NewEntry.Mask |= 0x3; // If 1KB pages are *NOT* enabled, lowest bits of the mask are 0b11 for TLB writes 7005222Sksewell@umich.edu NewEntry.VPN &= 0xFFFFFFFC; // Reset bits 0 and 1 if 1KB pages are not enabled 7015222Sksewell@umich.edu } 7025222Sksewell@umich.edu NewEntry.asid = (uint8_t)(EntryHi & 0xFF); 7035222Sksewell@umich.edu 7045222Sksewell@umich.edu NewEntry.PFN0 = (Addr)(EntryLo0 >> 6); 7055222Sksewell@umich.edu NewEntry.PFN1 = (Addr)(EntryLo1 >> 6); 7065222Sksewell@umich.edu NewEntry.D0 = (bool)((EntryLo0 >> 2) & 1); 7075222Sksewell@umich.edu NewEntry.D1 = (bool)((EntryLo1 >> 2) & 1); 7085222Sksewell@umich.edu NewEntry.V1 = (bool)((EntryLo1 >> 1) & 1); 7095222Sksewell@umich.edu NewEntry.V0 = (bool)((EntryLo0 >> 1) & 1); 7105222Sksewell@umich.edu NewEntry.G = (bool)((EntryLo0 & EntryLo1) & 1); 7115222Sksewell@umich.edu NewEntry.C0 = (uint8_t)((EntryLo0 >> 3) & 0x7); 7125222Sksewell@umich.edu NewEntry.C1 = (uint8_t)((EntryLo1 >> 3) & 0x7); 7135222Sksewell@umich.edu /* Now, compute the AddrShiftAmount and OffsetMask - TLB optimizations */ 7145222Sksewell@umich.edu /* Addr Shift Amount for 1KB or larger pages */ 7155222Sksewell@umich.edu // warn("PTE->Mask: %x\n",pte->Mask); 7165222Sksewell@umich.edu if((NewEntry.Mask & 0xFFFF) == 3){ 7175222Sksewell@umich.edu NewEntry.AddrShiftAmount = 12; 7185222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFFFF) == 0x0000){ 7195222Sksewell@umich.edu NewEntry.AddrShiftAmount = 10; 7205222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFFFC) == 0x000C){ 7215222Sksewell@umich.edu NewEntry.AddrShiftAmount = 14; 7225222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFFF0) == 0x0030){ 7235222Sksewell@umich.edu NewEntry.AddrShiftAmount = 16; 7245222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFFC0) == 0x00C0){ 7255222Sksewell@umich.edu NewEntry.AddrShiftAmount = 18; 7265222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFF00) == 0x0300){ 7275222Sksewell@umich.edu NewEntry.AddrShiftAmount = 20; 7285222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFC00) == 0x0C00){ 7295222Sksewell@umich.edu NewEntry.AddrShiftAmount = 22; 7305222Sksewell@umich.edu } else if((NewEntry.Mask & 0xF000) == 0x3000){ 7315222Sksewell@umich.edu NewEntry.AddrShiftAmount = 24; 7325222Sksewell@umich.edu } else if((NewEntry.Mask & 0xC000) == 0xC000){ 7335222Sksewell@umich.edu NewEntry.AddrShiftAmount = 26; 7345222Sksewell@umich.edu } else if((NewEntry.Mask & 0x30000) == 0x30000){ 7355222Sksewell@umich.edu NewEntry.AddrShiftAmount = 28; 7365222Sksewell@umich.edu } else { 7375222Sksewell@umich.edu fatal("Invalid Mask Pattern Detected!\n"); 7385222Sksewell@umich.edu } 7395222Sksewell@umich.edu NewEntry.OffsetMask = ((1<<NewEntry.AddrShiftAmount)-1); 7405222Sksewell@umich.edu 7415222Sksewell@umich.edu MipsISA::TLB *Ptr=xc->tcBase()->getITBPtr(); 7425222Sksewell@umich.edu MiscReg c3=xc->readMiscReg(MipsISA::Config3); 7435222Sksewell@umich.edu MiscReg pg=xc->readMiscReg(MipsISA::PageGrain); 7445222Sksewell@umich.edu int SP=0; 7455222Sksewell@umich.edu if(bits(c3,Config3_SP)==1 && bits(pg,PageGrain_ESP)==1){ 7465222Sksewell@umich.edu SP=1; 7475222Sksewell@umich.edu } 7485222Sksewell@umich.edu Ptr->insertAt(NewEntry,Index & 0x7FFFFFFF,SP); 7495222Sksewell@umich.edu }}); 7505222Sksewell@umich.edu 0x06: tlbwr({{ 7515222Sksewell@umich.edu //Create PTE 7525222Sksewell@umich.edu MipsISA::PTE NewEntry; 7535222Sksewell@umich.edu //Write PTE 7545222Sksewell@umich.edu NewEntry.Mask = (Addr)(PageMask >> 11); 7555222Sksewell@umich.edu NewEntry.VPN = (Addr)(EntryHi >> 11); 7565222Sksewell@umich.edu /* PageGrain _ ESP Config3 _ SP */ 7575222Sksewell@umich.edu if(((PageGrain>>28) & 1) == 0 || ((Config3>>4)&1) ==0) { 7585222Sksewell@umich.edu NewEntry.Mask |= 0x3; // If 1KB pages are *NOT* enabled, lowest bits of the mask are 0b11 for TLB writes 7595222Sksewell@umich.edu NewEntry.VPN &= 0xFFFFFFFC; // Reset bits 0 and 1 if 1KB pages are not enabled 7605222Sksewell@umich.edu } 7615222Sksewell@umich.edu NewEntry.asid = (uint8_t)(EntryHi & 0xFF); 7625222Sksewell@umich.edu 7635222Sksewell@umich.edu NewEntry.PFN0 = (Addr)(EntryLo0 >> 6); 7645222Sksewell@umich.edu NewEntry.PFN1 = (Addr)(EntryLo1 >> 6); 7655222Sksewell@umich.edu NewEntry.D0 = (bool)((EntryLo0 >> 2) & 1); 7665222Sksewell@umich.edu NewEntry.D1 = (bool)((EntryLo1 >> 2) & 1); 7675222Sksewell@umich.edu NewEntry.V1 = (bool)((EntryLo1 >> 1) & 1); 7685222Sksewell@umich.edu NewEntry.V0 = (bool)((EntryLo0 >> 1) & 1); 7695222Sksewell@umich.edu NewEntry.G = (bool)((EntryLo0 & EntryLo1) & 1); 7705222Sksewell@umich.edu NewEntry.C0 = (uint8_t)((EntryLo0 >> 3) & 0x7); 7715222Sksewell@umich.edu NewEntry.C1 = (uint8_t)((EntryLo1 >> 3) & 0x7); 7725222Sksewell@umich.edu /* Now, compute the AddrShiftAmount and OffsetMask - TLB optimizations */ 7735222Sksewell@umich.edu /* Addr Shift Amount for 1KB or larger pages */ 7745222Sksewell@umich.edu // warn("PTE->Mask: %x\n",pte->Mask); 7755222Sksewell@umich.edu if((NewEntry.Mask & 0xFFFF) == 3){ 7765222Sksewell@umich.edu NewEntry.AddrShiftAmount = 12; 7775222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFFFF) == 0x0000){ 7785222Sksewell@umich.edu NewEntry.AddrShiftAmount = 10; 7795222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFFFC) == 0x000C){ 7805222Sksewell@umich.edu NewEntry.AddrShiftAmount = 14; 7815222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFFF0) == 0x0030){ 7825222Sksewell@umich.edu NewEntry.AddrShiftAmount = 16; 7835222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFFC0) == 0x00C0){ 7845222Sksewell@umich.edu NewEntry.AddrShiftAmount = 18; 7855222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFF00) == 0x0300){ 7865222Sksewell@umich.edu NewEntry.AddrShiftAmount = 20; 7875222Sksewell@umich.edu } else if((NewEntry.Mask & 0xFC00) == 0x0C00){ 7885222Sksewell@umich.edu NewEntry.AddrShiftAmount = 22; 7895222Sksewell@umich.edu } else if((NewEntry.Mask & 0xF000) == 0x3000){ 7905222Sksewell@umich.edu NewEntry.AddrShiftAmount = 24; 7915222Sksewell@umich.edu } else if((NewEntry.Mask & 0xC000) == 0xC000){ 7925222Sksewell@umich.edu NewEntry.AddrShiftAmount = 26; 7935222Sksewell@umich.edu } else if((NewEntry.Mask & 0x30000) == 0x30000){ 7945222Sksewell@umich.edu NewEntry.AddrShiftAmount = 28; 7955222Sksewell@umich.edu } else { 7965222Sksewell@umich.edu fatal("Invalid Mask Pattern Detected!\n"); 7975222Sksewell@umich.edu } 7985222Sksewell@umich.edu NewEntry.OffsetMask = ((1<<NewEntry.AddrShiftAmount)-1); 7995222Sksewell@umich.edu 8005222Sksewell@umich.edu MipsISA::TLB *Ptr=xc->tcBase()->getITBPtr(); 8015222Sksewell@umich.edu MiscReg c3=xc->readMiscReg(MipsISA::Config3); 8025222Sksewell@umich.edu MiscReg pg=xc->readMiscReg(MipsISA::PageGrain); 8035222Sksewell@umich.edu int SP=0; 8045222Sksewell@umich.edu if(bits(c3,Config3_SP)==1 && bits(pg,PageGrain_ESP)==1){ 8055222Sksewell@umich.edu SP=1; 8065222Sksewell@umich.edu } 8075222Sksewell@umich.edu Ptr->insertAt(NewEntry,Random,SP); 8084661Sksewell@umich.edu }}); 8092101SN/A 8105222Sksewell@umich.edu 0x08: tlbp({{ 8115222Sksewell@umich.edu int TLB_Index; 8125222Sksewell@umich.edu Addr VPN; 8135222Sksewell@umich.edu if(PageGrain_ESP == 1 && Config3_SP ==1){ 8145222Sksewell@umich.edu VPN = EntryHi >> 11; 8155222Sksewell@umich.edu } else { 8165222Sksewell@umich.edu VPN = ((EntryHi >> 11) & 0xFFFFFFFC); // Mask off lower 2 bits 8175222Sksewell@umich.edu } 8185222Sksewell@umich.edu TLB_Index = xc->tcBase()->getITBPtr()->probeEntry(VPN,EntryHi_ASID); 8195222Sksewell@umich.edu if(TLB_Index != -1){ // Check TLB for entry matching EntryHi 8205222Sksewell@umich.edu Index=TLB_Index; 8215222Sksewell@umich.edu // warn("\ntlbp: Match Found!\n"); 8225222Sksewell@umich.edu } else {// else, set Index = 1<<31 8235222Sksewell@umich.edu Index = (1<<31); 8245222Sksewell@umich.edu } 8255222Sksewell@umich.edu }}); 8264661Sksewell@umich.edu } 8275222Sksewell@umich.edu format CP0Unimpl { 8285222Sksewell@umich.edu 0x20: wait(); 8295222Sksewell@umich.edu } 8305222Sksewell@umich.edu default: CP0Unimpl::unknown(); 8314661Sksewell@umich.edu 8322101SN/A } 8332043SN/A } 8342027SN/A 8352101SN/A //Table A-13 MIPS32 COP1 Encoding of rs Field 8362101SN/A 0x1: decode RS_MSB { 8372041SN/A 8382101SN/A 0x0: decode RS_HI { 8392101SN/A 0x0: decode RS_LO { 8402686Sksewell@umich.edu format CP1Control { 8412742Sksewell@umich.edu 0x0: mfc1 ({{ Rt.uw = Fs.uw; }}); 8422495SN/A 8432495SN/A 0x2: cfc1({{ 8442573SN/A switch (FS) 8452573SN/A { 8462573SN/A case 0: 8472616SN/A Rt = FIR; 8482573SN/A break; 8492573SN/A case 25: 8502616SN/A Rt = 0 | (FCSR & 0xFE000000) >> 24 | (FCSR & 0x00800000) >> 23; 8512573SN/A break; 8522573SN/A case 26: 8532616SN/A Rt = 0 | (FCSR & 0x0003F07C); 8542573SN/A break; 8552573SN/A case 28: 8562616SN/A Rt = 0 | (FCSR & 0x00000F80) | (FCSR & 0x01000000) >> 21 | (FCSR & 0x00000003); 8572573SN/A break; 8582573SN/A case 31: 8592616SN/A Rt = FCSR; 8602573SN/A break; 8612573SN/A default: 8625222Sksewell@umich.edu warn("FP Control Value (%d) Not Valid"); 8632573SN/A } 8645222Sksewell@umich.edu // warn("FCSR: %x, FS: %d, FIR: %x, Rt: %x\n",FCSR, FS, FIR, Rt); 8652573SN/A }}); 8662573SN/A 8672686Sksewell@umich.edu 0x3: mfhc1({{ Rt.uw = Fs.ud<63:32>;}}); 8682686Sksewell@umich.edu 8692686Sksewell@umich.edu 0x4: mtc1 ({{ Fs.uw = Rt.uw; }}); 8702686Sksewell@umich.edu 8712573SN/A 0x6: ctc1({{ 8722573SN/A switch (FS) 8732573SN/A { 8742573SN/A case 25: 8752616SN/A FCSR = 0 | (Rt.uw<7:1> << 25) // move 31...25 8762616SN/A | (FCSR & 0x01000000) // bit 24 8772616SN/A | (FCSR & 0x004FFFFF);// bit 22...0 8782573SN/A break; 8792573SN/A 8802573SN/A case 26: 8812616SN/A FCSR = 0 | (FCSR & 0xFFFC0000) // move 31...18 8822573SN/A | Rt.uw<17:12> << 12 // bit 17...12 8832616SN/A | (FCSR & 0x00000F80) << 7// bit 11...7 8842573SN/A | Rt.uw<6:2> << 2 // bit 6...2 8852616SN/A | (FCSR & 0x00000002); // bit 1...0 8862573SN/A break; 8872573SN/A 8882573SN/A case 28: 8892616SN/A FCSR = 0 | (FCSR & 0xFE000000) // move 31...25 8902573SN/A | Rt.uw<2:2> << 24 // bit 24 8912616SN/A | (FCSR & 0x00FFF000) << 23// bit 23...12 8922573SN/A | Rt.uw<11:7> << 7 // bit 24 8932616SN/A | (FCSR & 0x000007E) 8942573SN/A | Rt.uw<1:0>;// bit 22...0 8952573SN/A break; 8962573SN/A 8972573SN/A case 31: 8982616SN/A FCSR = Rt.uw; 8992573SN/A break; 9002573SN/A 9012573SN/A default: 9022495SN/A panic("FP Control Value (%d) Not Available. Ignoring Access to" 9032616SN/A "Floating Control Status Register", FS); 9042495SN/A } 9052495SN/A }}); 9062686Sksewell@umich.edu 9072686Sksewell@umich.edu 0x7: mthc1({{ 9082686Sksewell@umich.edu uint64_t fs_hi = Rt.uw; 9092686Sksewell@umich.edu uint64_t fs_lo = Fs.ud & 0x0FFFFFFFF; 9102686Sksewell@umich.edu Fs.ud = (fs_hi << 32) | fs_lo; 9112686Sksewell@umich.edu }}); 9122686Sksewell@umich.edu 9132101SN/A } 9145222Sksewell@umich.edu format CP1Unimpl { 9155222Sksewell@umich.edu 0x1: dmfc1(); 9165222Sksewell@umich.edu 0x5: dmtc1(); 9175222Sksewell@umich.edu } 9185222Sksewell@umich.edu } 9192025SN/A 9205222Sksewell@umich.edu 0x1: 9215222Sksewell@umich.edu decode RS_LO { 9225222Sksewell@umich.edu 0x0: 9235222Sksewell@umich.edu decode ND { 9245222Sksewell@umich.edu format Branch { 9255222Sksewell@umich.edu 0x0: decode TF { 9265222Sksewell@umich.edu 0x0: bc1f({{ cond = getCondCode(FCSR, BRANCH_CC) == 0; 9275222Sksewell@umich.edu }}); 9285222Sksewell@umich.edu 0x1: bc1t({{ cond = getCondCode(FCSR, BRANCH_CC) == 1; 9295222Sksewell@umich.edu }}); 9305222Sksewell@umich.edu } 9315222Sksewell@umich.edu 0x1: decode TF { 9325222Sksewell@umich.edu 0x0: bc1fl({{ cond = getCondCode(FCSR, BRANCH_CC) == 0; 9335222Sksewell@umich.edu }}, Likely); 9345222Sksewell@umich.edu 0x1: bc1tl({{ cond = getCondCode(FCSR, BRANCH_CC) == 1; 9355222Sksewell@umich.edu }}, Likely); 9365222Sksewell@umich.edu } 9375222Sksewell@umich.edu } 9385222Sksewell@umich.edu } 9395222Sksewell@umich.edu format CP1Unimpl { 9405222Sksewell@umich.edu 0x1: bc1any2(); 9415222Sksewell@umich.edu 0x2: bc1any4(); 9425222Sksewell@umich.edu default: unknown(); 9435222Sksewell@umich.edu } 9445222Sksewell@umich.edu } 9452043SN/A } 9462027SN/A 9472101SN/A 0x1: decode RS_HI { 9482101SN/A 0x2: decode RS_LO { 9492101SN/A //Table A-14 MIPS32 COP1 Encoding of Function Field When rs=S 9502686Sksewell@umich.edu //(( single-precision floating point)) 9512572SN/A 0x0: decode FUNCTION_HI { 9522572SN/A 0x0: decode FUNCTION_LO { 9532101SN/A format FloatOp { 9542601SN/A 0x0: add_s({{ Fd.sf = Fs.sf + Ft.sf;}}); 9552601SN/A 0x1: sub_s({{ Fd.sf = Fs.sf - Ft.sf;}}); 9562601SN/A 0x2: mul_s({{ Fd.sf = Fs.sf * Ft.sf;}}); 9572601SN/A 0x3: div_s({{ Fd.sf = Fs.sf / Ft.sf;}}); 9582601SN/A 0x4: sqrt_s({{ Fd.sf = sqrt(Fs.sf);}}); 9592601SN/A 0x5: abs_s({{ Fd.sf = fabs(Fs.sf);}}); 9602686Sksewell@umich.edu 0x7: neg_s({{ Fd.sf = -Fs.sf;}}); 9612101SN/A } 9622742Sksewell@umich.edu 9632742Sksewell@umich.edu 0x6: BasicOp::mov_s({{ Fd.sf = Fs.sf;}}); 9642101SN/A } 9652027SN/A 9662572SN/A 0x1: decode FUNCTION_LO { 9672686Sksewell@umich.edu format FloatConvertOp { 9682686Sksewell@umich.edu 0x0: round_l_s({{ val = Fs.sf; }}, ToLong, 9692686Sksewell@umich.edu Round); 9702686Sksewell@umich.edu 0x1: trunc_l_s({{ val = Fs.sf; }}, ToLong, 9712686Sksewell@umich.edu Trunc); 9722686Sksewell@umich.edu 0x2: ceil_l_s({{ val = Fs.sf; }}, ToLong, 9732686Sksewell@umich.edu Ceil); 9742686Sksewell@umich.edu 0x3: floor_l_s({{ val = Fs.sf; }}, ToLong, 9752686Sksewell@umich.edu Floor); 9762686Sksewell@umich.edu 0x4: round_w_s({{ val = Fs.sf; }}, ToWord, 9772686Sksewell@umich.edu Round); 9782686Sksewell@umich.edu 0x5: trunc_w_s({{ val = Fs.sf; }}, ToWord, 9792686Sksewell@umich.edu Trunc); 9802686Sksewell@umich.edu 0x6: ceil_w_s({{ val = Fs.sf; }}, ToWord, 9812686Sksewell@umich.edu Ceil); 9822686Sksewell@umich.edu 0x7: floor_w_s({{ val = Fs.sf; }}, ToWord, 9832686Sksewell@umich.edu Floor); 9842101SN/A } 9852101SN/A } 9862027SN/A 9872572SN/A 0x2: decode FUNCTION_LO { 9882101SN/A 0x1: decode MOVCF { 9892686Sksewell@umich.edu format BasicOp { 9902686Sksewell@umich.edu 0x0: movf_s({{ Fd = (getCondCode(FCSR,CC) == 0) ? Fs : Fd; }}); 9912686Sksewell@umich.edu 0x1: movt_s({{ Fd = (getCondCode(FCSR,CC) == 1) ? Fs : Fd; }}); 9922101SN/A } 9932101SN/A } 9942027SN/A 9952686Sksewell@umich.edu format BasicOp { 9962686Sksewell@umich.edu 0x2: movz_s({{ Fd = (Rt == 0) ? Fs : Fd; }}); 9972686Sksewell@umich.edu 0x3: movn_s({{ Fd = (Rt != 0) ? Fs : Fd; }}); 9982686Sksewell@umich.edu } 9992686Sksewell@umich.edu 10002602SN/A format FloatOp { 10012602SN/A 0x5: recip_s({{ Fd = 1 / Fs; }}); 10022602SN/A 0x6: rsqrt_s({{ Fd = 1 / sqrt(Fs);}}); 10032101SN/A } 10045222Sksewell@umich.edu format CP1Unimpl { 10055222Sksewell@umich.edu default: unknown(); 10065222Sksewell@umich.edu } 10072101SN/A } 10085222Sksewell@umich.edu 0x3: CP1Unimpl::unknown(); 10092027SN/A 10102572SN/A 0x4: decode FUNCTION_LO { 10112603SN/A format FloatConvertOp { 10122686Sksewell@umich.edu 0x1: cvt_d_s({{ val = Fs.sf; }}, ToDouble); 10132686Sksewell@umich.edu 0x4: cvt_w_s({{ val = Fs.sf; }}, ToWord); 10142686Sksewell@umich.edu 0x5: cvt_l_s({{ val = Fs.sf; }}, ToLong); 10152101SN/A } 10162055SN/A 10172686Sksewell@umich.edu 0x6: FloatOp::cvt_ps_s({{ 10182686Sksewell@umich.edu Fd.ud = (uint64_t) Fs.uw << 32 | 10192686Sksewell@umich.edu (uint64_t) Ft.uw; 10202101SN/A }}); 10215222Sksewell@umich.edu format CP1Unimpl { 10225222Sksewell@umich.edu default: unknown(); 10235222Sksewell@umich.edu } 10242101SN/A } 10255222Sksewell@umich.edu 0x5: CP1Unimpl::unknown(); 10262602SN/A 10272602SN/A 0x6: decode FUNCTION_LO { 10282603SN/A format FloatCompareOp { 10292686Sksewell@umich.edu 0x0: c_f_s({{ cond = 0; }}, SinglePrecision, 10302686Sksewell@umich.edu UnorderedFalse); 10312686Sksewell@umich.edu 0x1: c_un_s({{ cond = 0; }}, SinglePrecision, 10322686Sksewell@umich.edu UnorderedTrue); 10332686Sksewell@umich.edu 0x2: c_eq_s({{ cond = (Fs.sf == Ft.sf); }}, 10342686Sksewell@umich.edu UnorderedFalse); 10352686Sksewell@umich.edu 0x3: c_ueq_s({{ cond = (Fs.sf == Ft.sf); }}, 10362686Sksewell@umich.edu UnorderedTrue); 10372686Sksewell@umich.edu 0x4: c_olt_s({{ cond = (Fs.sf < Ft.sf); }}, 10382686Sksewell@umich.edu UnorderedFalse); 10392686Sksewell@umich.edu 0x5: c_ult_s({{ cond = (Fs.sf < Ft.sf); }}, 10402686Sksewell@umich.edu UnorderedTrue); 10412686Sksewell@umich.edu 0x6: c_ole_s({{ cond = (Fs.sf <= Ft.sf); }}, 10422686Sksewell@umich.edu UnorderedFalse); 10432686Sksewell@umich.edu 0x7: c_ule_s({{ cond = (Fs.sf <= Ft.sf); }}, 10442686Sksewell@umich.edu UnorderedTrue); 10452602SN/A } 10462602SN/A } 10472602SN/A 10482602SN/A 0x7: decode FUNCTION_LO { 10492686Sksewell@umich.edu format FloatCompareOp { 10502686Sksewell@umich.edu 0x0: c_sf_s({{ cond = 0; }}, SinglePrecision, 10512686Sksewell@umich.edu UnorderedFalse, QnanException); 10522686Sksewell@umich.edu 0x1: c_ngle_s({{ cond = 0; }}, SinglePrecision, 10532686Sksewell@umich.edu UnorderedTrue, QnanException); 10542686Sksewell@umich.edu 0x2: c_seq_s({{ cond = (Fs.sf == Ft.sf);}}, 10552686Sksewell@umich.edu UnorderedFalse, QnanException); 10562686Sksewell@umich.edu 0x3: c_ngl_s({{ cond = (Fs.sf == Ft.sf); }}, 10572686Sksewell@umich.edu UnorderedTrue, QnanException); 10582686Sksewell@umich.edu 0x4: c_lt_s({{ cond = (Fs.sf < Ft.sf); }}, 10592686Sksewell@umich.edu UnorderedFalse, QnanException); 10602686Sksewell@umich.edu 0x5: c_nge_s({{ cond = (Fs.sf < Ft.sf); }}, 10612686Sksewell@umich.edu UnorderedTrue, QnanException); 10622686Sksewell@umich.edu 0x6: c_le_s({{ cond = (Fs.sf <= Ft.sf); }}, 10632686Sksewell@umich.edu UnorderedFalse, QnanException); 10642686Sksewell@umich.edu 0x7: c_ngt_s({{ cond = (Fs.sf <= Ft.sf); }}, 10652686Sksewell@umich.edu UnorderedTrue, QnanException); 10662602SN/A } 10672602SN/A } 10682101SN/A } 10692055SN/A 10702101SN/A //Table A-15 MIPS32 COP1 Encoding of Function Field When rs=D 10712572SN/A 0x1: decode FUNCTION_HI { 10722572SN/A 0x0: decode FUNCTION_LO { 10732101SN/A format FloatOp { 10742686Sksewell@umich.edu 0x0: add_d({{ Fd.df = Fs.df + Ft.df; }}); 10752686Sksewell@umich.edu 0x1: sub_d({{ Fd.df = Fs.df - Ft.df; }}); 10762686Sksewell@umich.edu 0x2: mul_d({{ Fd.df = Fs.df * Ft.df; }}); 10772686Sksewell@umich.edu 0x3: div_d({{ Fd.df = Fs.df / Ft.df; }}); 10782686Sksewell@umich.edu 0x4: sqrt_d({{ Fd.df = sqrt(Fs.df); }}); 10792686Sksewell@umich.edu 0x5: abs_d({{ Fd.df = fabs(Fs.df); }}); 10802686Sksewell@umich.edu 0x7: neg_d({{ Fd.df = -1 * Fs.df; }}); 10812101SN/A } 10822742Sksewell@umich.edu 10832742Sksewell@umich.edu 0x6: BasicOp::mov_d({{ Fd.df = Fs.df; }}); 10842101SN/A } 10852027SN/A 10862572SN/A 0x1: decode FUNCTION_LO { 10872686Sksewell@umich.edu format FloatConvertOp { 10882686Sksewell@umich.edu 0x0: round_l_d({{ val = Fs.df; }}, ToLong, 10892686Sksewell@umich.edu Round); 10902686Sksewell@umich.edu 0x1: trunc_l_d({{ val = Fs.df; }}, ToLong, 10912686Sksewell@umich.edu Trunc); 10922686Sksewell@umich.edu 0x2: ceil_l_d({{ val = Fs.df; }}, ToLong, 10932686Sksewell@umich.edu Ceil); 10942686Sksewell@umich.edu 0x3: floor_l_d({{ val = Fs.df; }}, ToLong, 10952686Sksewell@umich.edu Floor); 10962686Sksewell@umich.edu 0x4: round_w_d({{ val = Fs.df; }}, ToWord, 10972686Sksewell@umich.edu Round); 10982686Sksewell@umich.edu 0x5: trunc_w_d({{ val = Fs.df; }}, ToWord, 10992686Sksewell@umich.edu Trunc); 11002686Sksewell@umich.edu 0x6: ceil_w_d({{ val = Fs.df; }}, ToWord, 11012686Sksewell@umich.edu Ceil); 11022686Sksewell@umich.edu 0x7: floor_w_d({{ val = Fs.df; }}, ToWord, 11032686Sksewell@umich.edu Floor); 11042101SN/A } 11052101SN/A } 11062027SN/A 11072572SN/A 0x2: decode FUNCTION_LO { 11082101SN/A 0x1: decode MOVCF { 11092686Sksewell@umich.edu format BasicOp { 11102686Sksewell@umich.edu 0x0: movf_d({{ Fd.df = (getCondCode(FCSR,CC) == 0) ? 11112686Sksewell@umich.edu Fs.df : Fd.df; 11122686Sksewell@umich.edu }}); 11132686Sksewell@umich.edu 0x1: movt_d({{ Fd.df = (getCondCode(FCSR,CC) == 1) ? 11142686Sksewell@umich.edu Fs.df : Fd.df; 11152686Sksewell@umich.edu }}); 11162101SN/A } 11172101SN/A } 11182027SN/A 11192101SN/A format BasicOp { 11202686Sksewell@umich.edu 0x2: movz_d({{ Fd.df = (Rt == 0) ? Fs.df : Fd.df; }}); 11212686Sksewell@umich.edu 0x3: movn_d({{ Fd.df = (Rt != 0) ? Fs.df : Fd.df; }}); 11222101SN/A } 11232027SN/A 11242605SN/A format FloatOp { 11252686Sksewell@umich.edu 0x5: recip_d({{ Fd.df = 1 / Fs.df }}); 11262605SN/A 0x6: rsqrt_d({{ Fd.df = 1 / sqrt(Fs.df) }}); 11272101SN/A } 11285222Sksewell@umich.edu format CP1Unimpl { 11295222Sksewell@umich.edu default: unknown(); 11305222Sksewell@umich.edu } 11315222Sksewell@umich.edu 11322101SN/A } 11332572SN/A 0x4: decode FUNCTION_LO { 11342686Sksewell@umich.edu format FloatConvertOp { 11352686Sksewell@umich.edu 0x0: cvt_s_d({{ val = Fs.df; }}, ToSingle); 11362686Sksewell@umich.edu 0x4: cvt_w_d({{ val = Fs.df; }}, ToWord); 11372686Sksewell@umich.edu 0x5: cvt_l_d({{ val = Fs.df; }}, ToLong); 11382101SN/A } 11395222Sksewell@umich.edu default: CP1Unimpl::unknown(); 11402101SN/A } 11412602SN/A 11422602SN/A 0x6: decode FUNCTION_LO { 11432604SN/A format FloatCompareOp { 11442686Sksewell@umich.edu 0x0: c_f_d({{ cond = 0; }}, DoublePrecision, 11452686Sksewell@umich.edu UnorderedFalse); 11462686Sksewell@umich.edu 0x1: c_un_d({{ cond = 0; }}, DoublePrecision, 11472686Sksewell@umich.edu UnorderedTrue); 11482686Sksewell@umich.edu 0x2: c_eq_d({{ cond = (Fs.df == Ft.df); }}, 11492686Sksewell@umich.edu UnorderedFalse); 11502686Sksewell@umich.edu 0x3: c_ueq_d({{ cond = (Fs.df == Ft.df); }}, 11512686Sksewell@umich.edu UnorderedTrue); 11522686Sksewell@umich.edu 0x4: c_olt_d({{ cond = (Fs.df < Ft.df); }}, 11532686Sksewell@umich.edu UnorderedFalse); 11542686Sksewell@umich.edu 0x5: c_ult_d({{ cond = (Fs.df < Ft.df); }}, 11552686Sksewell@umich.edu UnorderedTrue); 11562686Sksewell@umich.edu 0x6: c_ole_d({{ cond = (Fs.df <= Ft.df); }}, 11572686Sksewell@umich.edu UnorderedFalse); 11582686Sksewell@umich.edu 0x7: c_ule_d({{ cond = (Fs.df <= Ft.df); }}, 11592686Sksewell@umich.edu UnorderedTrue); 11602602SN/A } 11612602SN/A } 11622602SN/A 11632602SN/A 0x7: decode FUNCTION_LO { 11642686Sksewell@umich.edu format FloatCompareOp { 11652686Sksewell@umich.edu 0x0: c_sf_d({{ cond = 0; }}, DoublePrecision, 11662686Sksewell@umich.edu UnorderedFalse, QnanException); 11672686Sksewell@umich.edu 0x1: c_ngle_d({{ cond = 0; }}, DoublePrecision, 11682686Sksewell@umich.edu UnorderedTrue, QnanException); 11692686Sksewell@umich.edu 0x2: c_seq_d({{ cond = (Fs.df == Ft.df); }}, 11702686Sksewell@umich.edu UnorderedFalse, QnanException); 11712686Sksewell@umich.edu 0x3: c_ngl_d({{ cond = (Fs.df == Ft.df); }}, 11722686Sksewell@umich.edu UnorderedTrue, QnanException); 11732686Sksewell@umich.edu 0x4: c_lt_d({{ cond = (Fs.df < Ft.df); }}, 11742686Sksewell@umich.edu UnorderedFalse, QnanException); 11752686Sksewell@umich.edu 0x5: c_nge_d({{ cond = (Fs.df < Ft.df); }}, 11762686Sksewell@umich.edu UnorderedTrue, QnanException); 11772686Sksewell@umich.edu 0x6: c_le_d({{ cond = (Fs.df <= Ft.df); }}, 11782686Sksewell@umich.edu UnorderedFalse, QnanException); 11792686Sksewell@umich.edu 0x7: c_ngt_d({{ cond = (Fs.df <= Ft.df); }}, 11802686Sksewell@umich.edu UnorderedTrue, QnanException); 11812602SN/A } 11822602SN/A } 11835222Sksewell@umich.edu default: CP1Unimpl::unknown(); 11842101SN/A } 11855222Sksewell@umich.edu 0x2: CP1Unimpl::unknown(); 11865222Sksewell@umich.edu 0x3: CP1Unimpl::unknown(); 11875222Sksewell@umich.edu 0x7: CP1Unimpl::unknown(); 11882027SN/A 11892101SN/A //Table A-16 MIPS32 COP1 Encoding of Function Field When rs=W 11902101SN/A 0x4: decode FUNCTION { 11912605SN/A format FloatConvertOp { 11922686Sksewell@umich.edu 0x20: cvt_s_w({{ val = Fs.uw; }}, ToSingle); 11932686Sksewell@umich.edu 0x21: cvt_d_w({{ val = Fs.uw; }}, ToDouble); 11945222Sksewell@umich.edu 0x26: CP1Unimpl::cvt_ps_w(); 11952101SN/A } 11965222Sksewell@umich.edu default: CP1Unimpl::unknown(); 11972101SN/A } 11982027SN/A 11992101SN/A //Table A-16 MIPS32 COP1 Encoding of Function Field When rs=L1 12002101SN/A //Note: "1. Format type L is legal only if 64-bit floating point operations 12012101SN/A //are enabled." 12022101SN/A 0x5: decode FUNCTION_HI { 12032686Sksewell@umich.edu format FloatConvertOp { 12042686Sksewell@umich.edu 0x20: cvt_s_l({{ val = Fs.ud; }}, ToSingle); 12052686Sksewell@umich.edu 0x21: cvt_d_l({{ val = Fs.ud; }}, ToDouble); 12065222Sksewell@umich.edu 0x26: CP1Unimpl::cvt_ps_l(); 12072101SN/A } 12085222Sksewell@umich.edu default: CP1Unimpl::unknown(); 12092101SN/A } 12102101SN/A 12112101SN/A //Table A-17 MIPS64 COP1 Encoding of Function Field When rs=PS1 12122101SN/A //Note: "1. Format type PS is legal only if 64-bit floating point operations 12132101SN/A //are enabled. " 12142572SN/A 0x6: decode FUNCTION_HI { 12152572SN/A 0x0: decode FUNCTION_LO { 12162101SN/A format Float64Op { 12172605SN/A 0x0: add_ps({{ 12182607SN/A Fd1.sf = Fs1.sf + Ft2.sf; 12192607SN/A Fd2.sf = Fs2.sf + Ft2.sf; 12202101SN/A }}); 12212605SN/A 0x1: sub_ps({{ 12222607SN/A Fd1.sf = Fs1.sf - Ft2.sf; 12232607SN/A Fd2.sf = Fs2.sf - Ft2.sf; 12242101SN/A }}); 12252605SN/A 0x2: mul_ps({{ 12262607SN/A Fd1.sf = Fs1.sf * Ft2.sf; 12272607SN/A Fd2.sf = Fs2.sf * Ft2.sf; 12282101SN/A }}); 12292605SN/A 0x5: abs_ps({{ 12302607SN/A Fd1.sf = fabs(Fs1.sf); 12312607SN/A Fd2.sf = fabs(Fs2.sf); 12322101SN/A }}); 12332605SN/A 0x6: mov_ps({{ 12342607SN/A Fd1.sf = Fs1.sf; 12352607SN/A Fd2.sf = Fs2.sf; 12362101SN/A }}); 12372605SN/A 0x7: neg_ps({{ 12382686Sksewell@umich.edu Fd1.sf = -(Fs1.sf); 12392686Sksewell@umich.edu Fd2.sf = -(Fs2.sf); 12402101SN/A }}); 12415222Sksewell@umich.edu default: CP1Unimpl::unknown(); 12422101SN/A } 12432101SN/A } 12445222Sksewell@umich.edu 0x1: CP1Unimpl::unknown(); 12452572SN/A 0x2: decode FUNCTION_LO { 12462101SN/A 0x1: decode MOVCF { 12472101SN/A format Float64Op { 12482607SN/A 0x0: movf_ps({{ 12492686Sksewell@umich.edu Fd1 = (getCondCode(FCSR, CC) == 0) ? 12502686Sksewell@umich.edu Fs1 : Fd1; 12512686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC+1) == 0) ? 12522686Sksewell@umich.edu Fs2 : Fd2; 12532607SN/A }}); 12542607SN/A 0x1: movt_ps({{ 12552686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC) == 1) ? 12562686Sksewell@umich.edu Fs1 : Fd1; 12572686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC+1) == 1) ? 12582686Sksewell@umich.edu Fs2 : Fd2; 12592607SN/A }}); 12602101SN/A } 12612101SN/A } 12622101SN/A 12632605SN/A format Float64Op { 12642607SN/A 0x2: movz_ps({{ 12652686Sksewell@umich.edu Fd1 = (getCondCode(FCSR, CC) == 0) ? 12662686Sksewell@umich.edu Fs1 : Fd1; 12672686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC) == 0) ? 12682686Sksewell@umich.edu Fs2 : Fd2; 12692607SN/A }}); 12702607SN/A 0x3: movn_ps({{ 12712686Sksewell@umich.edu Fd1 = (getCondCode(FCSR, CC) == 1) ? 12722686Sksewell@umich.edu Fs1 : Fd1; 12732686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC) == 1) ? 12742686Sksewell@umich.edu Fs2 : Fd2; 12752607SN/A }}); 12762135SN/A } 12775222Sksewell@umich.edu default: CP1Unimpl::unknown(); 12782135SN/A 12792101SN/A } 12805222Sksewell@umich.edu 0x3: CP1Unimpl::unknown(); 12812572SN/A 0x4: decode FUNCTION_LO { 12822686Sksewell@umich.edu 0x0: FloatOp::cvt_s_pu({{ Fd.sf = Fs2.sf; }}); 12835222Sksewell@umich.edu default: CP1Unimpl::unknown(); 12842101SN/A } 12852101SN/A 12862572SN/A 0x5: decode FUNCTION_LO { 12872686Sksewell@umich.edu 0x0: FloatOp::cvt_s_pl({{ Fd.sf = Fs1.sf; }}); 12882686Sksewell@umich.edu 12892101SN/A format Float64Op { 12902686Sksewell@umich.edu 0x4: pll({{ Fd.ud = (uint64_t) Fs1.uw << 32 | 12912686Sksewell@umich.edu Ft1.uw; 12922686Sksewell@umich.edu }}); 12932686Sksewell@umich.edu 0x5: plu({{ Fd.ud = (uint64_t) Fs1.uw << 32 | 12942686Sksewell@umich.edu Ft2.uw; 12952686Sksewell@umich.edu }}); 12962686Sksewell@umich.edu 0x6: pul({{ Fd.ud = (uint64_t) Fs2.uw << 32 | 12972686Sksewell@umich.edu Ft1.uw; 12982686Sksewell@umich.edu }}); 12992686Sksewell@umich.edu 0x7: puu({{ Fd.ud = (uint64_t) Fs2.uw << 32 | 13002686Sksewell@umich.edu Ft2.uw; 13012686Sksewell@umich.edu }}); 13022101SN/A } 13035222Sksewell@umich.edu default: CP1Unimpl::unknown(); 13042101SN/A } 13052602SN/A 13062602SN/A 0x6: decode FUNCTION_LO { 13072608SN/A format FloatPSCompareOp { 13082686Sksewell@umich.edu 0x0: c_f_ps({{ cond1 = 0; }}, {{ cond2 = 0; }}, 13092686Sksewell@umich.edu UnorderedFalse); 13102686Sksewell@umich.edu 0x1: c_un_ps({{ cond1 = 0; }}, {{ cond2 = 0; }}, 13112686Sksewell@umich.edu UnorderedTrue); 13122686Sksewell@umich.edu 0x2: c_eq_ps({{ cond1 = (Fs1.sf == Ft1.sf); }}, 13132686Sksewell@umich.edu {{ cond2 = (Fs2.sf == Ft2.sf); }}, 13142686Sksewell@umich.edu UnorderedFalse); 13152686Sksewell@umich.edu 0x3: c_ueq_ps({{ cond1 = (Fs1.sf == Ft1.sf); }}, 13162686Sksewell@umich.edu {{ cond2 = (Fs2.sf == Ft2.sf); }}, 13172686Sksewell@umich.edu UnorderedTrue); 13182686Sksewell@umich.edu 0x4: c_olt_ps({{ cond1 = (Fs1.sf < Ft1.sf); }}, 13192686Sksewell@umich.edu {{ cond2 = (Fs2.sf < Ft2.sf); }}, 13202686Sksewell@umich.edu UnorderedFalse); 13212686Sksewell@umich.edu 0x5: c_ult_ps({{ cond1 = (Fs.sf < Ft.sf); }}, 13222686Sksewell@umich.edu {{ cond2 = (Fs2.sf < Ft2.sf); }}, 13232686Sksewell@umich.edu UnorderedTrue); 13242686Sksewell@umich.edu 0x6: c_ole_ps({{ cond1 = (Fs.sf <= Ft.sf); }}, 13252686Sksewell@umich.edu {{ cond2 = (Fs2.sf <= Ft2.sf); }}, 13262686Sksewell@umich.edu UnorderedFalse); 13272686Sksewell@umich.edu 0x7: c_ule_ps({{ cond1 = (Fs1.sf <= Ft1.sf); }}, 13282686Sksewell@umich.edu {{ cond2 = (Fs2.sf <= Ft2.sf); }}, 13292686Sksewell@umich.edu UnorderedTrue); 13302602SN/A } 13312602SN/A } 13322602SN/A 13332602SN/A 0x7: decode FUNCTION_LO { 13342686Sksewell@umich.edu format FloatPSCompareOp { 13352686Sksewell@umich.edu 0x0: c_sf_ps({{ cond1 = 0; }}, {{ cond2 = 0; }}, 13362686Sksewell@umich.edu UnorderedFalse, QnanException); 13372686Sksewell@umich.edu 0x1: c_ngle_ps({{ cond1 = 0; }}, 13382686Sksewell@umich.edu {{ cond2 = 0; }}, 13392686Sksewell@umich.edu UnorderedTrue, QnanException); 13402686Sksewell@umich.edu 0x2: c_seq_ps({{ cond1 = (Fs1.sf == Ft1.sf); }}, 13412686Sksewell@umich.edu {{ cond2 = (Fs2.sf == Ft2.sf); }}, 13422686Sksewell@umich.edu UnorderedFalse, QnanException); 13432686Sksewell@umich.edu 0x3: c_ngl_ps({{ cond1 = (Fs1.sf == Ft1.sf); }}, 13442686Sksewell@umich.edu {{ cond2 = (Fs2.sf == Ft2.sf); }}, 13452686Sksewell@umich.edu UnorderedTrue, QnanException); 13462686Sksewell@umich.edu 0x4: c_lt_ps({{ cond1 = (Fs1.sf < Ft1.sf); }}, 13472686Sksewell@umich.edu {{ cond2 = (Fs2.sf < Ft2.sf); }}, 13482686Sksewell@umich.edu UnorderedFalse, QnanException); 13492686Sksewell@umich.edu 0x5: c_nge_ps({{ cond1 = (Fs1.sf < Ft1.sf); }}, 13502686Sksewell@umich.edu {{ cond2 = (Fs2.sf < Ft2.sf); }}, 13512686Sksewell@umich.edu UnorderedTrue, QnanException); 13522686Sksewell@umich.edu 0x6: c_le_ps({{ cond1 = (Fs1.sf <= Ft1.sf); }}, 13532686Sksewell@umich.edu {{ cond2 = (Fs2.sf <= Ft2.sf); }}, 13542686Sksewell@umich.edu UnorderedFalse, QnanException); 13552686Sksewell@umich.edu 0x7: c_ngt_ps({{ cond1 = (Fs1.sf <= Ft1.sf); }}, 13562686Sksewell@umich.edu {{ cond2 = (Fs2.sf <= Ft2.sf); }}, 13572686Sksewell@umich.edu UnorderedTrue, QnanException); 13582602SN/A } 13592602SN/A } 13602101SN/A } 13612101SN/A } 13625222Sksewell@umich.edu default: CP1Unimpl::unknown(); 13632101SN/A } 13642101SN/A } 13652101SN/A 13662101SN/A //Table A-19 MIPS32 COP2 Encoding of rs Field 13672101SN/A 0x2: decode RS_MSB { 13685222Sksewell@umich.edu format CP2Unimpl { 13692686Sksewell@umich.edu 0x0: decode RS_HI { 13702686Sksewell@umich.edu 0x0: decode RS_LO { 13712101SN/A 0x0: mfc2(); 13722101SN/A 0x2: cfc2(); 13732101SN/A 0x3: mfhc2(); 13742101SN/A 0x4: mtc2(); 13752101SN/A 0x6: ctc2(); 13762101SN/A 0x7: mftc2(); 13775222Sksewell@umich.edu default: unknown(); 13782101SN/A } 13792101SN/A 13802686Sksewell@umich.edu 0x1: decode ND { 13812686Sksewell@umich.edu 0x0: decode TF { 13822101SN/A 0x0: bc2f(); 13832101SN/A 0x1: bc2t(); 13845222Sksewell@umich.edu default: unknown(); 13852101SN/A } 13862101SN/A 13872686Sksewell@umich.edu 0x1: decode TF { 13882101SN/A 0x0: bc2fl(); 13892101SN/A 0x1: bc2tl(); 13905222Sksewell@umich.edu default: unknown(); 13912101SN/A } 13925222Sksewell@umich.edu default: unknown(); 13935222Sksewell@umich.edu 13945222Sksewell@umich.edu } 13955222Sksewell@umich.edu default: unknown(); 13965222Sksewell@umich.edu 13975222Sksewell@umich.edu } 13985222Sksewell@umich.edu default: unknown(); 13992101SN/A } 14002101SN/A } 14012101SN/A 14022101SN/A //Table A-20 MIPS64 COP1X Encoding of Function Field 1 14032101SN/A //Note: "COP1X instructions are legal only if 64-bit floating point 14042101SN/A //operations are enabled." 14052101SN/A 0x3: decode FUNCTION_HI { 14062101SN/A 0x0: decode FUNCTION_LO { 14072686Sksewell@umich.edu format LoadIndexedMemory { 14082742Sksewell@umich.edu 0x0: lwxc1({{ Fd.uw = Mem.uw;}}); 14092742Sksewell@umich.edu 0x1: ldxc1({{ Fd.ud = Mem.ud;}}); 14102750Sksewell@umich.edu 0x5: luxc1({{ Fd.ud = Mem.ud;}}, 14112742Sksewell@umich.edu {{ EA = (Rs + Rt) & ~7; }}); 14122101SN/A } 14132043SN/A } 14142027SN/A 14152101SN/A 0x1: decode FUNCTION_LO { 14162686Sksewell@umich.edu format StoreIndexedMemory { 14172742Sksewell@umich.edu 0x0: swxc1({{ Mem.uw = Fs.uw;}}); 14182742Sksewell@umich.edu 0x1: sdxc1({{ Mem.ud = Fs.ud;}}); 14192742Sksewell@umich.edu 0x5: suxc1({{ Mem.ud = Fs.ud;}}, 14202742Sksewell@umich.edu {{ EA = (Rs + Rt) & ~7; }}); 14212046SN/A } 14222084SN/A 14232686Sksewell@umich.edu 0x7: Prefetch::prefx({{ EA = Rs + Rt; }}); 14242101SN/A } 14252027SN/A 14262686Sksewell@umich.edu 0x3: decode FUNCTION_LO { 14272686Sksewell@umich.edu 0x6: Float64Op::alnv_ps({{ if (Rs<2:0> == 0) { 14282686Sksewell@umich.edu Fd.ud = Fs.ud; 14292686Sksewell@umich.edu } else if (Rs<2:0> == 4) { 14302686Sksewell@umich.edu #if BYTE_ORDER == BIG_ENDIAN 14312686Sksewell@umich.edu Fd.ud = Fs.ud<31:0> << 32 | 14322686Sksewell@umich.edu Ft.ud<63:32>; 14332686Sksewell@umich.edu #elif BYTE_ORDER == LITTLE_ENDIAN 14342686Sksewell@umich.edu Fd.ud = Ft.ud<31:0> << 32 | 14352686Sksewell@umich.edu Fs.ud<63:32>; 14362686Sksewell@umich.edu #endif 14372686Sksewell@umich.edu } else { 14382686Sksewell@umich.edu Fd.ud = Fd.ud; 14392686Sksewell@umich.edu } 14402686Sksewell@umich.edu }}); 14412686Sksewell@umich.edu } 14422027SN/A 14432686Sksewell@umich.edu format FloatAccOp { 14442686Sksewell@umich.edu 0x4: decode FUNCTION_LO { 14452686Sksewell@umich.edu 0x0: madd_s({{ Fd.sf = (Fs.sf * Ft.sf) + Fr.sf; }}); 14462686Sksewell@umich.edu 0x1: madd_d({{ Fd.df = (Fs.df * Ft.df) + Fr.df; }}); 14472686Sksewell@umich.edu 0x6: madd_ps({{ 14482686Sksewell@umich.edu Fd1.sf = (Fs1.df * Ft1.df) + Fr1.df; 14492686Sksewell@umich.edu Fd2.sf = (Fs2.df * Ft2.df) + Fr2.df; 14502686Sksewell@umich.edu }}); 14512686Sksewell@umich.edu } 14522027SN/A 14532686Sksewell@umich.edu 0x5: decode FUNCTION_LO { 14542686Sksewell@umich.edu 0x0: msub_s({{ Fd.sf = (Fs.sf * Ft.sf) - Fr.sf; }}); 14552686Sksewell@umich.edu 0x1: msub_d({{ Fd.df = (Fs.df * Ft.df) - Fr.df; }}); 14562686Sksewell@umich.edu 0x6: msub_ps({{ 14572686Sksewell@umich.edu Fd1.sf = (Fs1.df * Ft1.df) - Fr1.df; 14582686Sksewell@umich.edu Fd2.sf = (Fs2.df * Ft2.df) - Fr2.df; 14592686Sksewell@umich.edu }}); 14602686Sksewell@umich.edu } 14612027SN/A 14622686Sksewell@umich.edu 0x6: decode FUNCTION_LO { 14632686Sksewell@umich.edu 0x0: nmadd_s({{ Fd.sf = (-1 * Fs.sf * Ft.sf) - Fr.sf; }}); 14642686Sksewell@umich.edu 0x1: nmadd_d({{ Fd.df = (-1 * Fs.df * Ft.df) + Fr.df; }}); 14652686Sksewell@umich.edu 0x6: nmadd_ps({{ 14662686Sksewell@umich.edu Fd1.sf = -((Fs1.df * Ft1.df) + Fr1.df); 14672686Sksewell@umich.edu Fd2.sf = -((Fs2.df * Ft2.df) + Fr2.df); 14682686Sksewell@umich.edu }}); 14692686Sksewell@umich.edu } 14702027SN/A 14712686Sksewell@umich.edu 0x7: decode FUNCTION_LO { 14722686Sksewell@umich.edu 0x0: nmsub_s({{ Fd.sf = (-1 * Fs.sf * Ft.sf) - Fr.sf; }}); 14732686Sksewell@umich.edu 0x1: nmsub_d({{ Fd.df = (-1 * Fs.df * Ft.df) - Fr.df; }}); 14742686Sksewell@umich.edu 0x6: nmsub_ps({{ 14752686Sksewell@umich.edu Fd1.sf = -((Fs1.df * Ft1.df) - Fr1.df); 14762686Sksewell@umich.edu Fd2.sf = -((Fs2.df * Ft2.df) - Fr2.df); 14772686Sksewell@umich.edu }}); 14782046SN/A } 14792686Sksewell@umich.edu 14802101SN/A } 14812043SN/A } 14822025SN/A 14832686Sksewell@umich.edu format Branch { 14842686Sksewell@umich.edu 0x4: beql({{ cond = (Rs.sw == Rt.sw); }}, Likely); 14852686Sksewell@umich.edu 0x5: bnel({{ cond = (Rs.sw != Rt.sw); }}, Likely); 14862686Sksewell@umich.edu 0x6: blezl({{ cond = (Rs.sw <= 0); }}, Likely); 14872686Sksewell@umich.edu 0x7: bgtzl({{ cond = (Rs.sw > 0); }}, Likely); 14882046SN/A } 14892084SN/A } 14902024SN/A 14912686Sksewell@umich.edu 0x3: decode OPCODE_LO { 14922043SN/A //Table A-5 MIPS32 SPECIAL2 Encoding of Function Field 14932043SN/A 0x4: decode FUNCTION_HI { 14942686Sksewell@umich.edu 0x0: decode FUNCTION_LO { 14952686Sksewell@umich.edu 0x2: IntOp::mul({{ int64_t temp1 = Rs.sd * Rt.sd; 14964661Sksewell@umich.edu Rd.sw = temp1<31:0>; 14975222Sksewell@umich.edu }}, IntMultOp); 14982027SN/A 14994661Sksewell@umich.edu format HiLoRdSelValOp { 15005222Sksewell@umich.edu 0x0: madd({{ val = ((int64_t)HI_RD_SEL << 32 | LO_RD_SEL) + (Rs.sd * Rt.sd); }}, IntMultOp); 15015222Sksewell@umich.edu 0x1: maddu({{ val = ((uint64_t)HI_RD_SEL << 32 | LO_RD_SEL) + (Rs.ud * Rt.ud); }}, IntMultOp); 15025222Sksewell@umich.edu 0x4: msub({{ val = ((int64_t)HI_RD_SEL << 32 | LO_RD_SEL) - (Rs.sd * Rt.sd); }}, IntMultOp); 15035222Sksewell@umich.edu 0x5: msubu({{ val = ((uint64_t)HI_RD_SEL << 32 | LO_RD_SEL) - (Rs.ud * Rt.ud); }}, IntMultOp); 15042043SN/A } 15052043SN/A } 15062027SN/A 15072043SN/A 0x4: decode FUNCTION_LO { 15082101SN/A format BasicOp { 15092686Sksewell@umich.edu 0x0: clz({{ int cnt = 32; 15104661Sksewell@umich.edu for (int idx = 31; idx >= 0; idx--) { 15114661Sksewell@umich.edu if( Rs<idx:idx> == 1) { 15124661Sksewell@umich.edu cnt = 31 - idx; 15134661Sksewell@umich.edu break; 15144661Sksewell@umich.edu } 15154661Sksewell@umich.edu } 15164661Sksewell@umich.edu Rd.uw = cnt; 15174661Sksewell@umich.edu }}); 15182686Sksewell@umich.edu 0x1: clo({{ int cnt = 32; 15194661Sksewell@umich.edu for (int idx = 31; idx >= 0; idx--) { 15204661Sksewell@umich.edu if( Rs<idx:idx> == 0) { 15214661Sksewell@umich.edu cnt = 31 - idx; 15224661Sksewell@umich.edu break; 15234661Sksewell@umich.edu } 15244661Sksewell@umich.edu } 15254661Sksewell@umich.edu Rd.uw = cnt; 15264661Sksewell@umich.edu }}); 15272101SN/A } 15282043SN/A } 15292027SN/A 15302043SN/A 0x7: decode FUNCTION_LO { 15312686Sksewell@umich.edu 0x7: FailUnimpl::sdbbp(); 15322043SN/A } 15332043SN/A } 15342024SN/A 15352686Sksewell@umich.edu //Table A-6 MIPS32 SPECIAL3 Encoding of Function Field for Release 2 15362686Sksewell@umich.edu //of the Architecture 15372043SN/A 0x7: decode FUNCTION_HI { 15382101SN/A 0x0: decode FUNCTION_LO { 15392686Sksewell@umich.edu format BasicOp { 15402742Sksewell@umich.edu 0x0: ext({{ Rt.uw = bits(Rs.uw, MSB+LSB, LSB); }}); 15412686Sksewell@umich.edu 0x4: ins({{ Rt.uw = bits(Rt.uw, 31, MSB+1) << (MSB+1) | 15422686Sksewell@umich.edu bits(Rs.uw, MSB-LSB, 0) << LSB | 15432686Sksewell@umich.edu bits(Rt.uw, LSB-1, 0); 15442686Sksewell@umich.edu }}); 15452046SN/A } 15462101SN/A } 15472026SN/A 15482101SN/A 0x1: decode FUNCTION_LO { 15494661Sksewell@umich.edu format MT_Control { 15504661Sksewell@umich.edu 0x0: fork({{ forkThread(xc->tcBase(), fault, RD, Rs, Rt); }}, 15514661Sksewell@umich.edu UserMode); 15524661Sksewell@umich.edu 0x1: yield({{ Rd.sw = yieldThread(xc->tcBase(), fault, Rs.sw, YQMask); }}, 15534661Sksewell@umich.edu UserMode); 15544661Sksewell@umich.edu } 15554661Sksewell@umich.edu 15564661Sksewell@umich.edu //Table 5-9 MIPS32 LX Encoding of the op Field (DSP ASE MANUAL) 15574661Sksewell@umich.edu 0x2: decode OP_HI { 15584661Sksewell@umich.edu 0x0: decode OP_LO { 15594661Sksewell@umich.edu format LoadIndexedMemory { 15604661Sksewell@umich.edu 0x0: lwx({{ Rd.sw = Mem.sw; }}); 15614661Sksewell@umich.edu 0x4: lhx({{ Rd.sw = Mem.sh; }}); 15624661Sksewell@umich.edu 0x6: lbux({{ Rd.uw = Mem.ub; }}); 15634661Sksewell@umich.edu } 15644661Sksewell@umich.edu } 15654661Sksewell@umich.edu } 15664661Sksewell@umich.edu 0x4: DspIntOp::insv({{ int pos = dspctl<5:0>; 15674661Sksewell@umich.edu int size = dspctl<12:7>-1; 15684661Sksewell@umich.edu Rt.uw = insertBits( Rt.uw, pos+size, pos, Rs.uw<size:0> ); }}); 15694661Sksewell@umich.edu } 15704661Sksewell@umich.edu 15714661Sksewell@umich.edu 0x2: decode FUNCTION_LO { 15724661Sksewell@umich.edu 15734661Sksewell@umich.edu //Table 5-5 MIPS32 ADDU.QB Encoding of the op Field (DSP ASE MANUAL) 15744661Sksewell@umich.edu 0x0: decode OP_HI { 15754661Sksewell@umich.edu 0x0: decode OP_LO { 15764661Sksewell@umich.edu format DspIntOp { 15774661Sksewell@umich.edu 0x0: addu_qb({{ Rd.uw = dspAdd( Rs.uw, Rt.uw, SIMD_FMT_QB, 15784661Sksewell@umich.edu NOSATURATE, UNSIGNED, &dspctl ); }}); 15794661Sksewell@umich.edu 0x1: subu_qb({{ Rd.uw = dspSub( Rs.uw, Rt.uw, SIMD_FMT_QB, 15804661Sksewell@umich.edu NOSATURATE, UNSIGNED, &dspctl ); }}); 15814661Sksewell@umich.edu 0x4: addu_s_qb({{ Rd.uw = dspAdd( Rs.uw, Rt.uw, SIMD_FMT_QB, 15824661Sksewell@umich.edu SATURATE, UNSIGNED, &dspctl ); }}); 15834661Sksewell@umich.edu 0x5: subu_s_qb({{ Rd.uw = dspSub( Rs.uw, Rt.uw, SIMD_FMT_QB, 15844661Sksewell@umich.edu SATURATE, UNSIGNED, &dspctl ); }}); 15854661Sksewell@umich.edu 0x6: muleu_s_ph_qbl({{ Rd.uw = dspMuleu( Rs.uw, Rt.uw, 15865222Sksewell@umich.edu MODE_L, &dspctl ); }}, IntMultOp); 15874661Sksewell@umich.edu 0x7: muleu_s_ph_qbr({{ Rd.uw = dspMuleu( Rs.uw, Rt.uw, 15885222Sksewell@umich.edu MODE_R, &dspctl ); }}, IntMultOp); 15894661Sksewell@umich.edu } 15904661Sksewell@umich.edu } 15914661Sksewell@umich.edu 0x1: decode OP_LO { 15924661Sksewell@umich.edu format DspIntOp { 15934661Sksewell@umich.edu 0x0: addu_ph({{ Rd.uw = dspAdd( Rs.uw, Rt.uw, SIMD_FMT_PH, 15944661Sksewell@umich.edu NOSATURATE, UNSIGNED, &dspctl ); }}); 15954661Sksewell@umich.edu 0x1: subu_ph({{ Rd.uw = dspSub( Rs.uw, Rt.uw, SIMD_FMT_PH, 15964661Sksewell@umich.edu NOSATURATE, UNSIGNED, &dspctl ); }}); 15974661Sksewell@umich.edu 0x2: addq_ph({{ Rd.uw = dspAdd( Rs.uw, Rt.uw, SIMD_FMT_PH, 15984661Sksewell@umich.edu NOSATURATE, SIGNED, &dspctl ); }}); 15994661Sksewell@umich.edu 0x3: subq_ph({{ Rd.uw = dspSub( Rs.uw, Rt.uw, SIMD_FMT_PH, 16004661Sksewell@umich.edu NOSATURATE, SIGNED, &dspctl ); }}); 16014661Sksewell@umich.edu 0x4: addu_s_ph({{ Rd.uw = dspAdd( Rs.uw, Rt.uw, SIMD_FMT_PH, 16024661Sksewell@umich.edu SATURATE, UNSIGNED, &dspctl ); }}); 16034661Sksewell@umich.edu 0x5: subu_s_ph({{ Rd.uw = dspSub( Rs.uw, Rt.uw, SIMD_FMT_PH, 16044661Sksewell@umich.edu SATURATE, UNSIGNED, &dspctl ); }}); 16054661Sksewell@umich.edu 0x6: addq_s_ph({{ Rd.uw = dspAdd( Rs.uw, Rt.uw, SIMD_FMT_PH, 16064661Sksewell@umich.edu SATURATE, SIGNED, &dspctl ); }}); 16074661Sksewell@umich.edu 0x7: subq_s_ph({{ Rd.uw = dspSub( Rs.uw, Rt.uw, SIMD_FMT_PH, 16084661Sksewell@umich.edu SATURATE, SIGNED, &dspctl ); }}); 16094661Sksewell@umich.edu } 16104661Sksewell@umich.edu } 16114661Sksewell@umich.edu 0x2: decode OP_LO { 16124661Sksewell@umich.edu format DspIntOp { 16134661Sksewell@umich.edu 0x0: addsc({{ int64_t dresult; 16144661Sksewell@umich.edu dresult = Rs.ud + Rt.ud; 16154661Sksewell@umich.edu Rd.sw = dresult<31:0>; 16164661Sksewell@umich.edu dspctl = insertBits( dspctl, 13, 13, 16174661Sksewell@umich.edu dresult<32:32> ); }}); 16184661Sksewell@umich.edu 0x1: addwc({{ int64_t dresult; 16194661Sksewell@umich.edu dresult = Rs.sd + Rt.sd + dspctl<13:13>; 16204661Sksewell@umich.edu Rd.sw = dresult<31:0>; 16214661Sksewell@umich.edu if( dresult<32:32> != dresult<31:31> ) 16224661Sksewell@umich.edu dspctl = insertBits( dspctl, 20, 20, 1 ); }}); 16234661Sksewell@umich.edu 0x2: modsub({{ Rd.sw = (Rs.sw == 0) ? Rt.sw<23:8> : Rs.sw - Rt.sw<7:0>; }}); 16244661Sksewell@umich.edu 0x4: raddu_w_qb({{ Rd.uw = Rs.uw<31:24> + Rs.uw<23:16> + 16254661Sksewell@umich.edu Rs.uw<15:8> + Rs.uw<7:0>; }}); 16264661Sksewell@umich.edu 0x6: addq_s_w({{ Rd.sw = dspAdd( Rs.sw, Rt.sw, SIMD_FMT_W, 16274661Sksewell@umich.edu SATURATE, SIGNED, &dspctl ); }}); 16284661Sksewell@umich.edu 0x7: subq_s_w({{ Rd.sw = dspSub( Rs.sw, Rt.sw, SIMD_FMT_W, 16294661Sksewell@umich.edu SATURATE, SIGNED, &dspctl ); }}); 16304661Sksewell@umich.edu } 16314661Sksewell@umich.edu } 16324661Sksewell@umich.edu 0x3: decode OP_LO { 16334661Sksewell@umich.edu format DspIntOp { 16344661Sksewell@umich.edu 0x4: muleq_s_w_phl({{ Rd.sw = dspMuleq( Rs.sw, Rt.sw, 16355222Sksewell@umich.edu MODE_L, &dspctl ); }}, IntMultOp); 16364661Sksewell@umich.edu 0x5: muleq_s_w_phr({{ Rd.sw = dspMuleq( Rs.sw, Rt.sw, 16375222Sksewell@umich.edu MODE_R, &dspctl ); }}, IntMultOp); 16384661Sksewell@umich.edu 0x6: mulq_s_ph({{ Rd.sw = dspMulq( Rs.sw, Rt.sw, SIMD_FMT_PH, 16395222Sksewell@umich.edu SATURATE, NOROUND, &dspctl ); }}, IntMultOp); 16404661Sksewell@umich.edu 0x7: mulq_rs_ph({{ Rd.sw = dspMulq( Rs.sw, Rt.sw, SIMD_FMT_PH, 16415222Sksewell@umich.edu SATURATE, ROUND, &dspctl ); }}, IntMultOp); 16424661Sksewell@umich.edu } 16434661Sksewell@umich.edu } 16444661Sksewell@umich.edu } 16454661Sksewell@umich.edu 16464661Sksewell@umich.edu //Table 5-6 MIPS32 CMPU_EQ_QB Encoding of the op Field (DSP ASE MANUAL) 16474661Sksewell@umich.edu 0x1: decode OP_HI { 16484661Sksewell@umich.edu 0x0: decode OP_LO { 16494661Sksewell@umich.edu format DspIntOp { 16504661Sksewell@umich.edu 0x0: cmpu_eq_qb({{ dspCmp( Rs.uw, Rt.uw, SIMD_FMT_QB, 16514661Sksewell@umich.edu UNSIGNED, CMP_EQ, &dspctl ); }}); 16524661Sksewell@umich.edu 0x1: cmpu_lt_qb({{ dspCmp( Rs.uw, Rt.uw, SIMD_FMT_QB, 16534661Sksewell@umich.edu UNSIGNED, CMP_LT, &dspctl ); }}); 16544661Sksewell@umich.edu 0x2: cmpu_le_qb({{ dspCmp( Rs.uw, Rt.uw, SIMD_FMT_QB, 16554661Sksewell@umich.edu UNSIGNED, CMP_LE, &dspctl ); }}); 16564661Sksewell@umich.edu 0x3: pick_qb({{ Rd.uw = dspPick( Rs.uw, Rt.uw, 16574661Sksewell@umich.edu SIMD_FMT_QB, &dspctl ); }}); 16584661Sksewell@umich.edu 0x4: cmpgu_eq_qb({{ Rd.uw = dspCmpg( Rs.uw, Rt.uw, SIMD_FMT_QB, 16594661Sksewell@umich.edu UNSIGNED, CMP_EQ ); }}); 16604661Sksewell@umich.edu 0x5: cmpgu_lt_qb({{ Rd.uw = dspCmpg( Rs.uw, Rt.uw, SIMD_FMT_QB, 16614661Sksewell@umich.edu UNSIGNED, CMP_LT ); }}); 16624661Sksewell@umich.edu 0x6: cmpgu_le_qb({{ Rd.uw = dspCmpg( Rs.uw, Rt.uw, SIMD_FMT_QB, 16634661Sksewell@umich.edu UNSIGNED, CMP_LE ); }}); 16644661Sksewell@umich.edu } 16654661Sksewell@umich.edu } 16664661Sksewell@umich.edu 0x1: decode OP_LO { 16674661Sksewell@umich.edu format DspIntOp { 16684661Sksewell@umich.edu 0x0: cmp_eq_ph({{ dspCmp( Rs.uw, Rt.uw, SIMD_FMT_PH, 16694661Sksewell@umich.edu SIGNED, CMP_EQ, &dspctl ); }}); 16704661Sksewell@umich.edu 0x1: cmp_lt_ph({{ dspCmp( Rs.uw, Rt.uw, SIMD_FMT_PH, 16714661Sksewell@umich.edu SIGNED, CMP_LT, &dspctl ); }}); 16724661Sksewell@umich.edu 0x2: cmp_le_ph({{ dspCmp( Rs.uw, Rt.uw, SIMD_FMT_PH, 16734661Sksewell@umich.edu SIGNED, CMP_LE, &dspctl ); }}); 16744661Sksewell@umich.edu 0x3: pick_ph({{ Rd.uw = dspPick( Rs.uw, Rt.uw, 16754661Sksewell@umich.edu SIMD_FMT_PH, &dspctl ); }}); 16764661Sksewell@umich.edu 0x4: precrq_qb_ph({{ Rd.uw = Rs.uw<31:24> << 24 | 16774661Sksewell@umich.edu Rs.uw<15:8> << 16 | 16784661Sksewell@umich.edu Rt.uw<31:24> << 8 | 16794661Sksewell@umich.edu Rt.uw<15:8>; }}); 16804661Sksewell@umich.edu 0x5: precr_qb_ph({{ Rd.uw = Rs.uw<23:16> << 24 | 16814661Sksewell@umich.edu Rs.uw<7:0> << 16 | 16824661Sksewell@umich.edu Rt.uw<23:16> << 8 | 16834661Sksewell@umich.edu Rt.uw<7:0>; }}); 16844661Sksewell@umich.edu 0x6: packrl_ph({{ Rd.uw = dspPack( Rs.uw, Rt.uw, 16854661Sksewell@umich.edu SIMD_FMT_PH ); }}); 16864661Sksewell@umich.edu 0x7: precrqu_s_qb_ph({{ Rd.uw = dspPrecrqu( Rs.uw, Rt.uw, &dspctl ); }}); 16874661Sksewell@umich.edu } 16884661Sksewell@umich.edu } 16894661Sksewell@umich.edu 0x2: decode OP_LO { 16904661Sksewell@umich.edu format DspIntOp { 16914661Sksewell@umich.edu 0x4: precrq_ph_w({{ Rd.uw = Rs.uw<31:16> << 16 | Rt.uw<31:16>; }}); 16924661Sksewell@umich.edu 0x5: precrq_rs_ph_w({{ Rd.uw = dspPrecrq( Rs.uw, Rt.uw, SIMD_FMT_W, &dspctl ); }}); 16934661Sksewell@umich.edu } 16944661Sksewell@umich.edu } 16954661Sksewell@umich.edu 0x3: decode OP_LO { 16964661Sksewell@umich.edu format DspIntOp { 16974661Sksewell@umich.edu 0x0: cmpgdu_eq_qb({{ Rd.uw = dspCmpgd( Rs.uw, Rt.uw, SIMD_FMT_QB, 16984661Sksewell@umich.edu UNSIGNED, CMP_EQ, &dspctl ); }}); 16994661Sksewell@umich.edu 0x1: cmpgdu_lt_qb({{ Rd.uw = dspCmpgd( Rs.uw, Rt.uw, SIMD_FMT_QB, 17004661Sksewell@umich.edu UNSIGNED, CMP_LT, &dspctl ); }}); 17014661Sksewell@umich.edu 0x2: cmpgdu_le_qb({{ Rd.uw = dspCmpgd( Rs.uw, Rt.uw, SIMD_FMT_QB, 17024661Sksewell@umich.edu UNSIGNED, CMP_LE, &dspctl ); }}); 17034661Sksewell@umich.edu 0x6: precr_sra_ph_w({{ Rt.uw = dspPrecrSra( Rt.uw, Rs.uw, RD, 17044661Sksewell@umich.edu SIMD_FMT_W, NOROUND ); }}); 17054661Sksewell@umich.edu 0x7: precr_sra_r_ph_w({{ Rt.uw = dspPrecrSra( Rt.uw, Rs.uw, RD, 17064661Sksewell@umich.edu SIMD_FMT_W, ROUND ); }}); 17074661Sksewell@umich.edu } 17084661Sksewell@umich.edu } 17094661Sksewell@umich.edu } 17104661Sksewell@umich.edu 17114661Sksewell@umich.edu //Table 5-7 MIPS32 ABSQ_S.PH Encoding of the op Field (DSP ASE MANUAL) 17124661Sksewell@umich.edu 0x2: decode OP_HI { 17134661Sksewell@umich.edu 0x0: decode OP_LO { 17144661Sksewell@umich.edu format DspIntOp { 17154661Sksewell@umich.edu 0x1: absq_s_qb({{ Rd.sw = dspAbs( Rt.sw, SIMD_FMT_QB, &dspctl );}}); 17164661Sksewell@umich.edu 0x2: repl_qb({{ Rd.uw = RS_RT<7:0> << 24 | 17174661Sksewell@umich.edu RS_RT<7:0> << 16 | 17184661Sksewell@umich.edu RS_RT<7:0> << 8 | 17194661Sksewell@umich.edu RS_RT<7:0>; }}); 17204661Sksewell@umich.edu 0x3: replv_qb({{ Rd.sw = Rt.uw<7:0> << 24 | 17214661Sksewell@umich.edu Rt.uw<7:0> << 16 | 17224661Sksewell@umich.edu Rt.uw<7:0> << 8 | 17234661Sksewell@umich.edu Rt.uw<7:0>; }}); 17244661Sksewell@umich.edu 0x4: precequ_ph_qbl({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_QB, UNSIGNED, 17254661Sksewell@umich.edu SIMD_FMT_PH, SIGNED, MODE_L ); }}); 17264661Sksewell@umich.edu 0x5: precequ_ph_qbr({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_QB, UNSIGNED, 17274661Sksewell@umich.edu SIMD_FMT_PH, SIGNED, MODE_R ); }}); 17284661Sksewell@umich.edu 0x6: precequ_ph_qbla({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_QB, UNSIGNED, 17294661Sksewell@umich.edu SIMD_FMT_PH, SIGNED, MODE_LA ); }}); 17304661Sksewell@umich.edu 0x7: precequ_ph_qbra({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_QB, UNSIGNED, 17314661Sksewell@umich.edu SIMD_FMT_PH, SIGNED, MODE_RA ); }}); 17324661Sksewell@umich.edu } 17334661Sksewell@umich.edu } 17344661Sksewell@umich.edu 0x1: decode OP_LO { 17354661Sksewell@umich.edu format DspIntOp { 17364661Sksewell@umich.edu 0x1: absq_s_ph({{ Rd.sw = dspAbs( Rt.sw, SIMD_FMT_PH, &dspctl ); }}); 17374661Sksewell@umich.edu 0x2: repl_ph({{ Rd.uw = (sext<10>(RS_RT))<15:0> << 16 | 17384661Sksewell@umich.edu (sext<10>(RS_RT))<15:0>; }}); 17394661Sksewell@umich.edu 0x3: replv_ph({{ Rd.uw = Rt.uw<15:0> << 16 | 17404661Sksewell@umich.edu Rt.uw<15:0>; }}); 17414661Sksewell@umich.edu 0x4: preceq_w_phl({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_PH, SIGNED, 17424661Sksewell@umich.edu SIMD_FMT_W, SIGNED, MODE_L ); }}); 17434661Sksewell@umich.edu 0x5: preceq_w_phr({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_PH, SIGNED, 17444661Sksewell@umich.edu SIMD_FMT_W, SIGNED, MODE_R ); }}); 17454661Sksewell@umich.edu } 17464661Sksewell@umich.edu } 17474661Sksewell@umich.edu 0x2: decode OP_LO { 17484661Sksewell@umich.edu format DspIntOp { 17494661Sksewell@umich.edu 0x1: absq_s_w({{ Rd.sw = dspAbs( Rt.sw, SIMD_FMT_W, &dspctl ); }}); 17504661Sksewell@umich.edu } 17514661Sksewell@umich.edu } 17524661Sksewell@umich.edu 0x3: decode OP_LO { 17534661Sksewell@umich.edu 0x3: IntOp::bitrev({{ Rd.uw = bitrev( Rt.uw<15:0> ); }}); 17544661Sksewell@umich.edu format DspIntOp { 17554661Sksewell@umich.edu 0x4: preceu_ph_qbl({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_QB, UNSIGNED, 17564661Sksewell@umich.edu SIMD_FMT_PH, UNSIGNED, MODE_L ); }}); 17574661Sksewell@umich.edu 0x5: preceu_ph_qbr({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_QB, UNSIGNED, 17584661Sksewell@umich.edu SIMD_FMT_PH, UNSIGNED, MODE_R ); }}); 17594661Sksewell@umich.edu 0x6: preceu_ph_qbla({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_QB, UNSIGNED, 17604661Sksewell@umich.edu SIMD_FMT_PH, UNSIGNED, MODE_LA ); }}); 17614661Sksewell@umich.edu 0x7: preceu_ph_qbra({{ Rd.uw = dspPrece( Rt.uw, SIMD_FMT_QB, UNSIGNED, 17624661Sksewell@umich.edu SIMD_FMT_PH, UNSIGNED, MODE_RA ); }}); 17634661Sksewell@umich.edu } 17644661Sksewell@umich.edu } 17654661Sksewell@umich.edu } 17664661Sksewell@umich.edu 17674661Sksewell@umich.edu //Table 5-8 MIPS32 SHLL.QB Encoding of the op Field (DSP ASE MANUAL) 17684661Sksewell@umich.edu 0x3: decode OP_HI { 17694661Sksewell@umich.edu 0x0: decode OP_LO { 17704661Sksewell@umich.edu format DspIntOp { 17714661Sksewell@umich.edu 0x0: shll_qb({{ Rd.sw = dspShll( Rt.sw, RS, SIMD_FMT_QB, 17724661Sksewell@umich.edu NOSATURATE, UNSIGNED, &dspctl ); }}); 17734661Sksewell@umich.edu 0x1: shrl_qb({{ Rd.sw = dspShrl( Rt.sw, RS, SIMD_FMT_QB, 17744661Sksewell@umich.edu UNSIGNED ); }}); 17754661Sksewell@umich.edu 0x2: shllv_qb({{ Rd.sw = dspShll( Rt.sw, Rs.sw, SIMD_FMT_QB, 17764661Sksewell@umich.edu NOSATURATE, UNSIGNED, &dspctl ); }}); 17774661Sksewell@umich.edu 0x3: shrlv_qb({{ Rd.sw = dspShrl( Rt.sw, Rs.sw, SIMD_FMT_QB, 17784661Sksewell@umich.edu UNSIGNED ); }}); 17794661Sksewell@umich.edu 0x4: shra_qb({{ Rd.sw = dspShra( Rt.sw, RS, SIMD_FMT_QB, 17804661Sksewell@umich.edu NOROUND, SIGNED, &dspctl ); }}); 17814661Sksewell@umich.edu 0x5: shra_r_qb({{ Rd.sw = dspShra( Rt.sw, RS, SIMD_FMT_QB, 17824661Sksewell@umich.edu ROUND, SIGNED, &dspctl ); }}); 17834661Sksewell@umich.edu 0x6: shrav_qb({{ Rd.sw = dspShra( Rt.sw, Rs.sw, SIMD_FMT_QB, 17844661Sksewell@umich.edu NOROUND, SIGNED, &dspctl ); }}); 17854661Sksewell@umich.edu 0x7: shrav_r_qb({{ Rd.sw = dspShra( Rt.sw, Rs.sw, SIMD_FMT_QB, 17864661Sksewell@umich.edu ROUND, SIGNED, &dspctl ); }}); 17874661Sksewell@umich.edu } 17884661Sksewell@umich.edu } 17894661Sksewell@umich.edu 0x1: decode OP_LO { 17904661Sksewell@umich.edu format DspIntOp { 17914661Sksewell@umich.edu 0x0: shll_ph({{ Rd.uw = dspShll( Rt.uw, RS, SIMD_FMT_PH, 17924661Sksewell@umich.edu NOSATURATE, SIGNED, &dspctl ); }}); 17934661Sksewell@umich.edu 0x1: shra_ph({{ Rd.sw = dspShra( Rt.sw, RS, SIMD_FMT_PH, 17944661Sksewell@umich.edu NOROUND, SIGNED, &dspctl ); }}); 17954661Sksewell@umich.edu 0x2: shllv_ph({{ Rd.sw = dspShll( Rt.sw, Rs.sw, SIMD_FMT_PH, 17964661Sksewell@umich.edu NOSATURATE, SIGNED, &dspctl ); }}); 17974661Sksewell@umich.edu 0x3: shrav_ph({{ Rd.sw = dspShra( Rt.sw, Rs.sw, SIMD_FMT_PH, 17984661Sksewell@umich.edu NOROUND, SIGNED, &dspctl ); }}); 17994661Sksewell@umich.edu 0x4: shll_s_ph({{ Rd.sw = dspShll( Rt.sw, RS, SIMD_FMT_PH, 18004661Sksewell@umich.edu SATURATE, SIGNED, &dspctl ); }}); 18014661Sksewell@umich.edu 0x5: shra_r_ph({{ Rd.sw = dspShra( Rt.sw, RS, SIMD_FMT_PH, 18024661Sksewell@umich.edu ROUND, SIGNED, &dspctl ); }}); 18034661Sksewell@umich.edu 0x6: shllv_s_ph({{ Rd.sw = dspShll( Rt.sw, Rs.sw, SIMD_FMT_PH, 18044661Sksewell@umich.edu SATURATE, SIGNED, &dspctl ); }}); 18054661Sksewell@umich.edu 0x7: shrav_r_ph({{ Rd.sw = dspShra( Rt.sw, Rs.sw, SIMD_FMT_PH, 18064661Sksewell@umich.edu ROUND, SIGNED, &dspctl ); }}); 18074661Sksewell@umich.edu } 18084661Sksewell@umich.edu } 18094661Sksewell@umich.edu 0x2: decode OP_LO { 18104661Sksewell@umich.edu format DspIntOp { 18114661Sksewell@umich.edu 0x4: shll_s_w({{ Rd.sw = dspShll( Rt.sw, RS, SIMD_FMT_W, 18124661Sksewell@umich.edu SATURATE, SIGNED, &dspctl ); }}); 18134661Sksewell@umich.edu 0x5: shra_r_w({{ Rd.sw = dspShra( Rt.sw, RS, SIMD_FMT_W, 18144661Sksewell@umich.edu ROUND, SIGNED, &dspctl ); }}); 18154661Sksewell@umich.edu 0x6: shllv_s_w({{ Rd.sw = dspShll( Rt.sw, Rs.sw, SIMD_FMT_W, 18164661Sksewell@umich.edu SATURATE, SIGNED, &dspctl ); }}); 18174661Sksewell@umich.edu 0x7: shrav_r_w({{ Rd.sw = dspShra( Rt.sw, Rs.sw, SIMD_FMT_W, 18184661Sksewell@umich.edu ROUND, SIGNED, &dspctl ); }}); 18194661Sksewell@umich.edu } 18204661Sksewell@umich.edu } 18214661Sksewell@umich.edu 0x3: decode OP_LO { 18224661Sksewell@umich.edu format DspIntOp { 18234661Sksewell@umich.edu 0x1: shrl_ph({{ Rd.sw = dspShrl( Rt.sw, RS, SIMD_FMT_PH, 18244661Sksewell@umich.edu UNSIGNED ); }}); 18254661Sksewell@umich.edu 0x3: shrlv_ph({{ Rd.sw = dspShrl( Rt.sw, Rs.sw, SIMD_FMT_PH, 18264661Sksewell@umich.edu UNSIGNED ); }}); 18274661Sksewell@umich.edu } 18284661Sksewell@umich.edu } 18294661Sksewell@umich.edu } 18304661Sksewell@umich.edu } 18314661Sksewell@umich.edu 18324661Sksewell@umich.edu 0x3: decode FUNCTION_LO { 18334661Sksewell@umich.edu 18344661Sksewell@umich.edu //Table 3.12 MIPS32 ADDUH.QB Encoding of the op Field (DSP ASE Rev2 Manual) 18354661Sksewell@umich.edu 0x0: decode OP_HI { 18364661Sksewell@umich.edu 0x0: decode OP_LO { 18374661Sksewell@umich.edu format DspIntOp { 18384661Sksewell@umich.edu 0x0: adduh_qb({{ Rd.uw = dspAddh( Rs.sw, Rt.sw, SIMD_FMT_QB, 18394661Sksewell@umich.edu NOROUND, UNSIGNED ); }}); 18404661Sksewell@umich.edu 0x1: subuh_qb({{ Rd.uw = dspSubh( Rs.sw, Rt.sw, SIMD_FMT_QB, 18414661Sksewell@umich.edu NOROUND, UNSIGNED ); }}); 18424661Sksewell@umich.edu 0x2: adduh_r_qb({{ Rd.uw = dspAddh( Rs.sw, Rt.sw, SIMD_FMT_QB, 18434661Sksewell@umich.edu ROUND, UNSIGNED ); }}); 18444661Sksewell@umich.edu 0x3: subuh_r_qb({{ Rd.uw = dspSubh( Rs.sw, Rt.sw, SIMD_FMT_QB, 18454661Sksewell@umich.edu ROUND, UNSIGNED ); }}); 18464661Sksewell@umich.edu } 18474661Sksewell@umich.edu } 18484661Sksewell@umich.edu 0x1: decode OP_LO { 18494661Sksewell@umich.edu format DspIntOp { 18504661Sksewell@umich.edu 0x0: addqh_ph({{ Rd.uw = dspAddh( Rs.sw, Rt.sw, SIMD_FMT_PH, 18514661Sksewell@umich.edu NOROUND, SIGNED ); }}); 18524661Sksewell@umich.edu 0x1: subqh_ph({{ Rd.uw = dspSubh( Rs.sw, Rt.sw, SIMD_FMT_PH, 18534661Sksewell@umich.edu NOROUND, SIGNED ); }}); 18544661Sksewell@umich.edu 0x2: addqh_r_ph({{ Rd.uw = dspAddh( Rs.sw, Rt.sw, SIMD_FMT_PH, 18554661Sksewell@umich.edu ROUND, SIGNED ); }}); 18564661Sksewell@umich.edu 0x3: subqh_r_ph({{ Rd.uw = dspSubh( Rs.sw, Rt.sw, SIMD_FMT_PH, 18574661Sksewell@umich.edu ROUND, SIGNED ); }}); 18584661Sksewell@umich.edu 0x4: mul_ph({{ Rd.sw = dspMul( Rs.sw, Rt.sw, SIMD_FMT_PH, 18595222Sksewell@umich.edu NOSATURATE, &dspctl ); }}, IntMultOp); 18604661Sksewell@umich.edu 0x6: mul_s_ph({{ Rd.sw = dspMul( Rs.sw, Rt.sw, SIMD_FMT_PH, 18615222Sksewell@umich.edu SATURATE, &dspctl ); }}, IntMultOp); 18625222Sksewell@umich.edu 18634661Sksewell@umich.edu } 18644661Sksewell@umich.edu } 18654661Sksewell@umich.edu 0x2: decode OP_LO { 18664661Sksewell@umich.edu format DspIntOp { 18674661Sksewell@umich.edu 0x0: addqh_w({{ Rd.uw = dspAddh( Rs.sw, Rt.sw, SIMD_FMT_W, 18684661Sksewell@umich.edu NOROUND, SIGNED ); }}); 18694661Sksewell@umich.edu 0x1: subqh_w({{ Rd.uw = dspSubh( Rs.sw, Rt.sw, SIMD_FMT_W, 18704661Sksewell@umich.edu NOROUND, SIGNED ); }}); 18714661Sksewell@umich.edu 0x2: addqh_r_w({{ Rd.uw = dspAddh( Rs.sw, Rt.sw, SIMD_FMT_W, 18724661Sksewell@umich.edu ROUND, SIGNED ); }}); 18734661Sksewell@umich.edu 0x3: subqh_r_w({{ Rd.uw = dspSubh( Rs.sw, Rt.sw, SIMD_FMT_W, 18744661Sksewell@umich.edu ROUND, SIGNED ); }}); 18754661Sksewell@umich.edu 0x6: mulq_s_w({{ Rd.sw = dspMulq( Rs.sw, Rt.sw, SIMD_FMT_W, 18765222Sksewell@umich.edu SATURATE, NOROUND, &dspctl ); }}, IntMultOp); 18774661Sksewell@umich.edu 0x7: mulq_rs_w({{ Rd.sw = dspMulq( Rs.sw, Rt.sw, SIMD_FMT_W, 18785222Sksewell@umich.edu SATURATE, ROUND, &dspctl ); }}, IntMultOp); 18794661Sksewell@umich.edu } 18804661Sksewell@umich.edu } 18812061SN/A } 18822101SN/A } 18832061SN/A 18842101SN/A //Table A-10 MIPS32 BSHFL Encoding of sa Field 18852101SN/A 0x4: decode SA { 18862046SN/A format BasicOp { 18872686Sksewell@umich.edu 0x02: wsbh({{ Rd.uw = Rt.uw<23:16> << 24 | 18884661Sksewell@umich.edu Rt.uw<31:24> << 16 | 18894661Sksewell@umich.edu Rt.uw<7:0> << 8 | 18904661Sksewell@umich.edu Rt.uw<15:8>; 18912686Sksewell@umich.edu }}); 18922742Sksewell@umich.edu 0x10: seb({{ Rd.sw = Rt.sb; }}); 18932742Sksewell@umich.edu 0x18: seh({{ Rd.sw = Rt.sh; }}); 18942046SN/A } 18952101SN/A } 18962043SN/A 18972101SN/A 0x6: decode FUNCTION_LO { 18984661Sksewell@umich.edu 18994661Sksewell@umich.edu //Table 5-10 MIPS32 DPAQ.W.PH Encoding of the op Field (DSP ASE MANUAL) 19004661Sksewell@umich.edu 0x0: decode OP_HI { 19014661Sksewell@umich.edu 0x0: decode OP_LO { 19024661Sksewell@umich.edu format DspHiLoOp { 19034661Sksewell@umich.edu 0x0: dpa_w_ph({{ dspac = dspDpa( dspac, Rs.sw, Rt.sw, ACDST, 19045222Sksewell@umich.edu SIMD_FMT_PH, SIGNED, MODE_L ); }}, IntMultOp); 19054661Sksewell@umich.edu 0x1: dps_w_ph({{ dspac = dspDps( dspac, Rs.sw, Rt.sw, ACDST, 19065222Sksewell@umich.edu SIMD_FMT_PH, SIGNED, MODE_L ); }}, IntMultOp); 19074661Sksewell@umich.edu 0x2: mulsa_w_ph({{ dspac = dspMulsa( dspac, Rs.sw, Rt.sw, 19085222Sksewell@umich.edu ACDST, SIMD_FMT_PH ); }}, IntMultOp); 19094661Sksewell@umich.edu 0x3: dpau_h_qbl({{ dspac = dspDpa( dspac, Rs.sw, Rt.sw, ACDST, 19105222Sksewell@umich.edu SIMD_FMT_QB, UNSIGNED, MODE_L ); }}, IntMultOp); 19114661Sksewell@umich.edu 0x4: dpaq_s_w_ph({{ dspac = dspDpaq( dspac, Rs.sw, Rt.sw, ACDST, SIMD_FMT_PH, 19125222Sksewell@umich.edu SIMD_FMT_W, NOSATURATE, MODE_L, &dspctl ); }}, IntMultOp); 19134661Sksewell@umich.edu 0x5: dpsq_s_w_ph({{ dspac = dspDpsq( dspac, Rs.sw, Rt.sw, ACDST, SIMD_FMT_PH, 19145222Sksewell@umich.edu SIMD_FMT_W, NOSATURATE, MODE_L, &dspctl ); }}, IntMultOp); 19154661Sksewell@umich.edu 0x6: mulsaq_s_w_ph({{ dspac = dspMulsaq( dspac, Rs.sw, Rt.sw, 19165222Sksewell@umich.edu ACDST, SIMD_FMT_PH, &dspctl ); }}, IntMultOp); 19174661Sksewell@umich.edu 0x7: dpau_h_qbr({{ dspac = dspDpa( dspac, Rs.sw, Rt.sw, ACDST, 19185222Sksewell@umich.edu SIMD_FMT_QB, UNSIGNED, MODE_R ); }}, IntMultOp); 19194661Sksewell@umich.edu } 19204661Sksewell@umich.edu } 19214661Sksewell@umich.edu 0x1: decode OP_LO { 19224661Sksewell@umich.edu format DspHiLoOp { 19234661Sksewell@umich.edu 0x0: dpax_w_ph({{ dspac = dspDpa( dspac, Rs.sw, Rt.sw, ACDST, 19245222Sksewell@umich.edu SIMD_FMT_PH, SIGNED, MODE_X ); }}, IntMultOp); 19254661Sksewell@umich.edu 0x1: dpsx_w_ph({{ dspac = dspDps( dspac, Rs.sw, Rt.sw, ACDST, 19265222Sksewell@umich.edu SIMD_FMT_PH, SIGNED, MODE_X ); }}, IntMultOp); 19274661Sksewell@umich.edu 0x3: dpsu_h_qbl({{ dspac = dspDps( dspac, Rs.sw, Rt.sw, ACDST, 19285222Sksewell@umich.edu SIMD_FMT_QB, UNSIGNED, MODE_L ); }}, IntMultOp); 19294661Sksewell@umich.edu 0x4: dpaq_sa_l_w({{ dspac = dspDpaq( dspac, Rs.sw, Rt.sw, ACDST, SIMD_FMT_W, 19305222Sksewell@umich.edu SIMD_FMT_L, SATURATE, MODE_L, &dspctl ); }}, IntMultOp); 19314661Sksewell@umich.edu 0x5: dpsq_sa_l_w({{ dspac = dspDpsq( dspac, Rs.sw, Rt.sw, ACDST, SIMD_FMT_W, 19325222Sksewell@umich.edu SIMD_FMT_L, SATURATE, MODE_L, &dspctl ); }}, IntMultOp); 19334661Sksewell@umich.edu 0x7: dpsu_h_qbr({{ dspac = dspDps( dspac, Rs.sw, Rt.sw, ACDST, 19345222Sksewell@umich.edu SIMD_FMT_QB, UNSIGNED, MODE_R ); }}, IntMultOp); 19354661Sksewell@umich.edu } 19364661Sksewell@umich.edu } 19374661Sksewell@umich.edu 0x2: decode OP_LO { 19384661Sksewell@umich.edu format DspHiLoOp { 19394661Sksewell@umich.edu 0x0: maq_sa_w_phl({{ dspac = dspMaq( dspac, Rs.uw, Rt.uw, ACDST, SIMD_FMT_PH, 19405222Sksewell@umich.edu MODE_L, SATURATE, &dspctl ); }}, IntMultOp); 19414661Sksewell@umich.edu 0x2: maq_sa_w_phr({{ dspac = dspMaq( dspac, Rs.uw, Rt.uw, ACDST, SIMD_FMT_PH, 19425222Sksewell@umich.edu MODE_R, SATURATE, &dspctl ); }}, IntMultOp); 19434661Sksewell@umich.edu 0x4: maq_s_w_phl({{ dspac = dspMaq( dspac, Rs.uw, Rt.uw, ACDST, SIMD_FMT_PH, 19445222Sksewell@umich.edu MODE_L, NOSATURATE, &dspctl ); }}, IntMultOp); 19454661Sksewell@umich.edu 0x6: maq_s_w_phr({{ dspac = dspMaq( dspac, Rs.uw, Rt.uw, ACDST, SIMD_FMT_PH, 19465222Sksewell@umich.edu MODE_R, NOSATURATE, &dspctl ); }}, IntMultOp); 19474661Sksewell@umich.edu } 19484661Sksewell@umich.edu } 19494661Sksewell@umich.edu 0x3: decode OP_LO { 19504661Sksewell@umich.edu format DspHiLoOp { 19514661Sksewell@umich.edu 0x0: dpaqx_s_w_ph({{ dspac = dspDpaq( dspac, Rs.sw, Rt.sw, ACDST, SIMD_FMT_PH, 19525222Sksewell@umich.edu SIMD_FMT_W, NOSATURATE, MODE_X, &dspctl ); }}, IntMultOp); 19534661Sksewell@umich.edu 0x1: dpsqx_s_w_ph({{ dspac = dspDpsq( dspac, Rs.sw, Rt.sw, ACDST, SIMD_FMT_PH, 19545222Sksewell@umich.edu SIMD_FMT_W, NOSATURATE, MODE_X, &dspctl ); }}, IntMultOp); 19554661Sksewell@umich.edu 0x2: dpaqx_sa_w_ph({{ dspac = dspDpaq( dspac, Rs.sw, Rt.sw, ACDST, SIMD_FMT_PH, 19565222Sksewell@umich.edu SIMD_FMT_W, SATURATE, MODE_X, &dspctl ); }}, IntMultOp); 19574661Sksewell@umich.edu 0x3: dpsqx_sa_w_ph({{ dspac = dspDpsq( dspac, Rs.sw, Rt.sw, ACDST, SIMD_FMT_PH, 19585222Sksewell@umich.edu SIMD_FMT_W, SATURATE, MODE_X, &dspctl ); }}, IntMultOp); 19594661Sksewell@umich.edu } 19604661Sksewell@umich.edu } 19614661Sksewell@umich.edu } 19624661Sksewell@umich.edu 19634661Sksewell@umich.edu //Table 3.3 MIPS32 APPEND Encoding of the op Field 19644661Sksewell@umich.edu 0x1: decode OP_HI { 19654661Sksewell@umich.edu 0x0: decode OP_LO { 19664661Sksewell@umich.edu format IntOp { 19674661Sksewell@umich.edu 0x0: append({{ Rt.uw = (Rt.uw << RD) | bits(Rs.uw,RD-1,0); }}); 19685570Snate@binkert.org 0x1: prepend({{ Rt.uw = (Rt.uw >> RD) | (bits(Rs.uw, RD - 1, 0) << (32 - RD)); }}); 19694661Sksewell@umich.edu } 19704661Sksewell@umich.edu } 19714661Sksewell@umich.edu 0x2: decode OP_LO { 19724661Sksewell@umich.edu format IntOp { 19734661Sksewell@umich.edu 0x0: balign({{ Rt.uw = (Rt.uw << (8*BP)) | (Rs.uw >> (8*(4-BP))); }}); 19744661Sksewell@umich.edu } 19754661Sksewell@umich.edu } 19764661Sksewell@umich.edu } 19774661Sksewell@umich.edu 19782101SN/A } 19794661Sksewell@umich.edu 0x7: decode FUNCTION_LO { 19804661Sksewell@umich.edu 19814661Sksewell@umich.edu //Table 5-11 MIPS32 EXTR.W Encoding of the op Field (DSP ASE MANUAL) 19824661Sksewell@umich.edu 0x0: decode OP_HI { 19834661Sksewell@umich.edu 0x0: decode OP_LO { 19844661Sksewell@umich.edu format DspHiLoOp { 19854661Sksewell@umich.edu 0x0: extr_w({{ Rt.uw = dspExtr( dspac, SIMD_FMT_W, RS, 19864661Sksewell@umich.edu NOROUND, NOSATURATE, &dspctl ); }}); 19874661Sksewell@umich.edu 0x1: extrv_w({{ Rt.uw = dspExtr( dspac, SIMD_FMT_W, Rs.uw, 19884661Sksewell@umich.edu NOROUND, NOSATURATE, &dspctl ); }}); 19894661Sksewell@umich.edu 0x2: extp({{ Rt.uw = dspExtp( dspac, RS, &dspctl ); }}); 19904661Sksewell@umich.edu 0x3: extpv({{ Rt.uw = dspExtp( dspac, Rs.uw, &dspctl ); }}); 19914661Sksewell@umich.edu 0x4: extr_r_w({{ Rt.uw = dspExtr( dspac, SIMD_FMT_W, RS, 19924661Sksewell@umich.edu ROUND, NOSATURATE, &dspctl ); }}); 19934661Sksewell@umich.edu 0x5: extrv_r_w({{ Rt.uw = dspExtr( dspac, SIMD_FMT_W, Rs.uw, 19944661Sksewell@umich.edu ROUND, NOSATURATE, &dspctl ); }}); 19954661Sksewell@umich.edu 0x6: extr_rs_w({{ Rt.uw = dspExtr( dspac, SIMD_FMT_W, RS, 19964661Sksewell@umich.edu ROUND, SATURATE, &dspctl ); }}); 19974661Sksewell@umich.edu 0x7: extrv_rs_w({{ Rt.uw = dspExtr( dspac, SIMD_FMT_W, Rs.uw, 19984661Sksewell@umich.edu ROUND, SATURATE, &dspctl ); }}); 19994661Sksewell@umich.edu } 20004661Sksewell@umich.edu } 20014661Sksewell@umich.edu 0x1: decode OP_LO { 20024661Sksewell@umich.edu format DspHiLoOp { 20034661Sksewell@umich.edu 0x2: extpdp({{ Rt.uw = dspExtpd( dspac, RS, &dspctl ); }}); 20044661Sksewell@umich.edu 0x3: extpdpv({{ Rt.uw = dspExtpd( dspac, Rs.uw, &dspctl ); }}); 20054661Sksewell@umich.edu 0x6: extr_s_h({{ Rt.uw = dspExtr( dspac, SIMD_FMT_PH, RS, 20064661Sksewell@umich.edu NOROUND, SATURATE, &dspctl ); }}); 20074661Sksewell@umich.edu 0x7: extrv_s_h({{ Rt.uw = dspExtr( dspac, SIMD_FMT_PH, Rs.uw, 20084661Sksewell@umich.edu NOROUND, SATURATE, &dspctl ); }}); 20094661Sksewell@umich.edu } 20104661Sksewell@umich.edu } 20114661Sksewell@umich.edu 0x2: decode OP_LO { 20124661Sksewell@umich.edu format DspIntOp { 20134661Sksewell@umich.edu 0x2: rddsp({{ Rd.uw = readDSPControl( &dspctl, RDDSPMASK ); }}); 20144661Sksewell@umich.edu 0x3: wrdsp({{ writeDSPControl( &dspctl, Rs.uw, WRDSPMASK ); }}); 20154661Sksewell@umich.edu } 20164661Sksewell@umich.edu } 20174661Sksewell@umich.edu 0x3: decode OP_LO { 20184661Sksewell@umich.edu format DspHiLoOp { 20194661Sksewell@umich.edu 0x2: shilo({{ if( sext<6>(HILOSA) < 0 ) 20204661Sksewell@umich.edu dspac = (uint64_t)dspac << -sext<6>(HILOSA); 20214661Sksewell@umich.edu else 20224661Sksewell@umich.edu dspac = (uint64_t)dspac >> sext<6>(HILOSA); }}); 20234661Sksewell@umich.edu 0x3: shilov({{ if( sext<6>(Rs.sw<5:0>) < 0 ) 20244661Sksewell@umich.edu dspac = (uint64_t)dspac << -sext<6>(Rs.sw<5:0>); 20254661Sksewell@umich.edu else 20264661Sksewell@umich.edu dspac = (uint64_t)dspac >> sext<6>(Rs.sw<5:0>); }}); 20274661Sksewell@umich.edu 0x7: mthlip({{ dspac = dspac << 32; 20284661Sksewell@umich.edu dspac |= Rs.uw; 20294661Sksewell@umich.edu dspctl = insertBits( dspctl, 5, 0, 20304661Sksewell@umich.edu dspctl<5:0>+32 ); }}); 20314661Sksewell@umich.edu } 20324661Sksewell@umich.edu } 20334661Sksewell@umich.edu } 20345222Sksewell@umich.edu 0x3: decode OP_HI { 20355222Sksewell@umich.edu 0x2: decode OP_LO { 20365222Sksewell@umich.edu 0x3: FailUnimpl::rdhwr(); 20375222Sksewell@umich.edu } 20385222Sksewell@umich.edu } 20394661Sksewell@umich.edu } 20402043SN/A } 20412084SN/A } 20422024SN/A 20432686Sksewell@umich.edu 0x4: decode OPCODE_LO { 20442124SN/A format LoadMemory { 20455222Sksewell@umich.edu 0x0: lb({{ Rt.sw = Mem.sb; }}, mem_flags = NO_ALIGN_FAULT); 20465222Sksewell@umich.edu 0x1: lh({{ Rt.sw = Mem.sh; }}, mem_flags = NO_HALF_WORD_ALIGN_FAULT); 20472479SN/A 0x3: lw({{ Rt.sw = Mem.sw; }}); 20485222Sksewell@umich.edu 0x4: lbu({{ Rt.uw = Mem.ub;}}, mem_flags = NO_ALIGN_FAULT); 20495222Sksewell@umich.edu 0x5: lhu({{ Rt.uw = Mem.uh; }}, mem_flags = NO_HALF_WORD_ALIGN_FAULT); 20502686Sksewell@umich.edu } 20512495SN/A 20522686Sksewell@umich.edu format LoadUnalignedMemory { 20532686Sksewell@umich.edu 0x2: lwl({{ uint32_t mem_shift = 24 - (8 * byte_offset); 20542686Sksewell@umich.edu Rt.uw = mem_word << mem_shift | 20555570Snate@binkert.org (Rt.uw & mask(mem_shift)); 20562686Sksewell@umich.edu }}); 20572686Sksewell@umich.edu 0x6: lwr({{ uint32_t mem_shift = 8 * byte_offset; 20585570Snate@binkert.org Rt.uw = (Rt.uw & (mask(mem_shift) << (32 - mem_shift))) | 20595570Snate@binkert.org (mem_word >> mem_shift); 20602686Sksewell@umich.edu }}); 20614661Sksewell@umich.edu } 20622084SN/A } 20632024SN/A 20642686Sksewell@umich.edu 0x5: decode OPCODE_LO { 20652124SN/A format StoreMemory { 20665222Sksewell@umich.edu 0x0: sb({{ Mem.ub = Rt<7:0>; }}, mem_flags = NO_ALIGN_FAULT); 20675222Sksewell@umich.edu 0x1: sh({{ Mem.uh = Rt<15:0>; }}, mem_flags = NO_HALF_WORD_ALIGN_FAULT); 20682479SN/A 0x3: sw({{ Mem.uw = Rt<31:0>; }}); 20692084SN/A } 20702024SN/A 20712686Sksewell@umich.edu format StoreUnalignedMemory { 20722686Sksewell@umich.edu 0x2: swl({{ uint32_t reg_shift = 24 - (8 * byte_offset); 20732686Sksewell@umich.edu uint32_t mem_shift = 32 - reg_shift; 20745570Snate@binkert.org mem_word = (mem_word & (mask(reg_shift) << mem_shift)) | 20755570Snate@binkert.org (Rt.uw >> reg_shift); 20762686Sksewell@umich.edu }}); 20772686Sksewell@umich.edu 0x6: swr({{ uint32_t reg_shift = 8 * byte_offset; 20782686Sksewell@umich.edu mem_word = Rt.uw << reg_shift | 20795570Snate@binkert.org (mem_word & (mask(reg_shift))); 20802686Sksewell@umich.edu }}); 20812084SN/A } 20825222Sksewell@umich.edu format CP0Control { 20835222Sksewell@umich.edu 0x7: cache({{ 20845254Sksewell@umich.edu //Addr CacheEA = Rs.uw + OFFSET; 20855250Sksewell@umich.edu //fault = xc->CacheOp((uint8_t)CACHE_OP,(Addr) CacheEA); 20865222Sksewell@umich.edu }}); 20875222Sksewell@umich.edu } 20882084SN/A } 20892024SN/A 20902686Sksewell@umich.edu 0x6: decode OPCODE_LO { 20912686Sksewell@umich.edu format LoadMemory { 20922686Sksewell@umich.edu 0x0: ll({{ Rt.uw = Mem.uw; }}, mem_flags=LOCKED); 20932686Sksewell@umich.edu 0x1: lwc1({{ Ft.uw = Mem.uw; }}); 20942573SN/A 0x5: ldc1({{ Ft.ud = Mem.ud; }}); 20952084SN/A } 20965222Sksewell@umich.edu 0x2: CP2Unimpl::lwc2(); 20975222Sksewell@umich.edu 0x6: CP2Unimpl::ldc2(); 20982686Sksewell@umich.edu 0x3: Prefetch::pref(); 20992084SN/A } 21002024SN/A 21012239SN/A 21022686Sksewell@umich.edu 0x7: decode OPCODE_LO { 21032686Sksewell@umich.edu 0x0: StoreCond::sc({{ Mem.uw = Rt.uw;}}, 21042686Sksewell@umich.edu {{ uint64_t tmp = write_result; 21052686Sksewell@umich.edu Rt.uw = (tmp == 0 || tmp == 1) ? tmp : Rt.uw; 21062935Sksewell@umich.edu }}, mem_flags=LOCKED, inst_flags = IsStoreConditional); 21072055SN/A 21082686Sksewell@umich.edu format StoreMemory { 21095222Sksewell@umich.edu 0x1: swc1({{ Mem.uw = Ft.uw;}}); 21105222Sksewell@umich.edu 0x5: sdc1({{ Mem.ud = Ft.ud;}}); 21112084SN/A } 21125222Sksewell@umich.edu 21135222Sksewell@umich.edu 0x2: CP2Unimpl::swc2(); 21145222Sksewell@umich.edu 0x6: CP2Unimpl::sdc2(); 21155222Sksewell@umich.edu 21162027SN/A } 21172024SN/A} 21182022SN/A 21192027SN/A 2120