decoder.isa revision 7708
12686Sksewell@umich.edu// -*- mode:c++ -*- 22100SN/A 35254Sksewell@umich.edu// Copyright (c) 2007 MIPS Technologies, Inc. 45254Sksewell@umich.edu// All rights reserved. 55254Sksewell@umich.edu// 65254Sksewell@umich.edu// Redistribution and use in source and binary forms, with or without 75254Sksewell@umich.edu// modification, are permitted provided that the following conditions are 85254Sksewell@umich.edu// met: redistributions of source code must retain the above copyright 95254Sksewell@umich.edu// notice, this list of conditions and the following disclaimer; 105254Sksewell@umich.edu// redistributions in binary form must reproduce the above copyright 115254Sksewell@umich.edu// notice, this list of conditions and the following disclaimer in the 125254Sksewell@umich.edu// documentation and/or other materials provided with the distribution; 135254Sksewell@umich.edu// neither the name of the copyright holders nor the names of its 145254Sksewell@umich.edu// contributors may be used to endorse or promote products derived from 155254Sksewell@umich.edu// this software without specific prior written permission. 165254Sksewell@umich.edu// 175254Sksewell@umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 185254Sksewell@umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 195254Sksewell@umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 205254Sksewell@umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 215254Sksewell@umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 225254Sksewell@umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 235254Sksewell@umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 245254Sksewell@umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 255254Sksewell@umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 265254Sksewell@umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 275254Sksewell@umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 285254Sksewell@umich.edu// 295254Sksewell@umich.edu// Authors: Korey Sewell 305254Sksewell@umich.edu// Brett Miller 315254Sksewell@umich.edu// Jaidev Patwardhan 322706Sksewell@umich.edu 332022SN/A//////////////////////////////////////////////////////////////////// 342022SN/A// 352043SN/A// The actual MIPS32 ISA decoder 362024SN/A// ----------------------------- 372024SN/A// The following instructions are specified in the MIPS32 ISA 382043SN/A// Specification. Decoding closely follows the style specified 392686Sksewell@umich.edu// in the MIPS32 ISA specification document starting with Table 404661Sksewell@umich.edu// A-2 (document available @ http://www.mips.com) 412022SN/A// 422083SN/Adecode OPCODE_HI default Unknown::unknown() { 432686Sksewell@umich.edu //Table A-2 442101SN/A 0x0: decode OPCODE_LO { 452043SN/A 0x0: decode FUNCTION_HI { 462043SN/A 0x0: decode FUNCTION_LO { 472101SN/A 0x1: decode MOVCI { 482101SN/A format BasicOp { 496384Sgblack@eecs.umich.edu 0: movf({{ 506384Sgblack@eecs.umich.edu Rd = (getCondCode(FCSR, CC) == 0) ? Rd : Rs; 516384Sgblack@eecs.umich.edu }}); 526384Sgblack@eecs.umich.edu 1: movt({{ 536384Sgblack@eecs.umich.edu Rd = (getCondCode(FCSR, CC) == 1) ? Rd : Rs; 546384Sgblack@eecs.umich.edu }}); 552101SN/A } 562101SN/A } 572101SN/A 582046SN/A format BasicOp { 592686Sksewell@umich.edu //Table A-3 Note: "Specific encodings of the rd, rs, and 602686Sksewell@umich.edu //rt fields are used to distinguish SLL, SSNOP, and EHB 612686Sksewell@umich.edu //functions 622470SN/A 0x0: decode RS { 632686Sksewell@umich.edu 0x0: decode RT_RD { 644661Sksewell@umich.edu 0x0: decode SA default Nop::nop() { 655222Sksewell@umich.edu 0x1: ssnop({{;}}); 665222Sksewell@umich.edu 0x3: ehb({{;}}); 672686Sksewell@umich.edu } 682686Sksewell@umich.edu default: sll({{ Rd = Rt.uw << SA; }}); 692470SN/A } 702241SN/A } 712101SN/A 722495SN/A 0x2: decode RS_SRL { 732495SN/A 0x0:decode SRL { 742495SN/A 0: srl({{ Rd = Rt.uw >> SA; }}); 752101SN/A 766384Sgblack@eecs.umich.edu //Hardcoded assuming 32-bit ISA, 776384Sgblack@eecs.umich.edu //probably need parameter here 786384Sgblack@eecs.umich.edu 1: rotr({{ 796384Sgblack@eecs.umich.edu Rd = (Rt.uw << (32 - SA)) | (Rt.uw >> SA); 806384Sgblack@eecs.umich.edu }}); 812495SN/A } 822101SN/A } 832101SN/A 842495SN/A 0x3: decode RS { 852495SN/A 0x0: sra({{ 862495SN/A uint32_t temp = Rt >> SA; 872495SN/A if ( (Rt & 0x80000000) > 0 ) { 882495SN/A uint32_t mask = 0x80000000; 892495SN/A for(int i=0; i < SA; i++) { 902495SN/A temp |= mask; 912495SN/A mask = mask >> 1; 922495SN/A } 932495SN/A } 942495SN/A Rd = temp; 952495SN/A }}); 962495SN/A } 972101SN/A 982101SN/A 0x4: sllv({{ Rd = Rt.uw << Rs<4:0>; }}); 992101SN/A 1002101SN/A 0x6: decode SRLV { 1012101SN/A 0: srlv({{ Rd = Rt.uw >> Rs<4:0>; }}); 1022101SN/A 1036384Sgblack@eecs.umich.edu //Hardcoded assuming 32-bit ISA, 1046384Sgblack@eecs.umich.edu //probably need parameter here 1056384Sgblack@eecs.umich.edu 1: rotrv({{ 1066384Sgblack@eecs.umich.edu Rd = (Rt.uw << (32 - Rs<4:0>)) | 1076384Sgblack@eecs.umich.edu (Rt.uw >> Rs<4:0>); 1086384Sgblack@eecs.umich.edu }}); 1092101SN/A } 1102101SN/A 1112495SN/A 0x7: srav({{ 1122495SN/A int shift_amt = Rs<4:0>; 1132495SN/A 1142495SN/A uint32_t temp = Rt >> shift_amt; 1152495SN/A 1166384Sgblack@eecs.umich.edu if ((Rt & 0x80000000) > 0) { 1176384Sgblack@eecs.umich.edu uint32_t mask = 0x80000000; 1186384Sgblack@eecs.umich.edu for (int i = 0; i < shift_amt; i++) { 1196384Sgblack@eecs.umich.edu temp |= mask; 1206384Sgblack@eecs.umich.edu mask = mask >> 1; 1212495SN/A } 1226384Sgblack@eecs.umich.edu } 1232495SN/A Rd = temp; 1242495SN/A }}); 1252043SN/A } 1262043SN/A } 1272025SN/A 1282043SN/A 0x1: decode FUNCTION_LO { 1292686Sksewell@umich.edu //Table A-3 Note: "Specific encodings of the hint field are 1302686Sksewell@umich.edu //used to distinguish JR from JR.HB and JALR from JALR.HB" 1312123SN/A format Jump { 1322101SN/A 0x0: decode HINT { 1336376Sgblack@eecs.umich.edu 0x1: jr_hb({{ 1346376Sgblack@eecs.umich.edu Config1Reg config1 = Config1; 1356376Sgblack@eecs.umich.edu if (config1.ca == 0) { 1366376Sgblack@eecs.umich.edu NNPC = Rs; 1376376Sgblack@eecs.umich.edu } else { 1386376Sgblack@eecs.umich.edu panic("MIPS16e not supported\n"); 1396376Sgblack@eecs.umich.edu } 1406376Sgblack@eecs.umich.edu }}, IsReturn, ClearHazards); 1416376Sgblack@eecs.umich.edu default: jr({{ 1426376Sgblack@eecs.umich.edu Config1Reg config1 = Config1; 1436376Sgblack@eecs.umich.edu if (config1.ca == 0) { 1446376Sgblack@eecs.umich.edu NNPC = Rs; 1456376Sgblack@eecs.umich.edu } else { 1466376Sgblack@eecs.umich.edu panic("MIPS16e not supported\n"); 1476376Sgblack@eecs.umich.edu } 1486376Sgblack@eecs.umich.edu }}, IsReturn); 1492101SN/A } 1502042SN/A 1512101SN/A 0x1: decode HINT { 1524661Sksewell@umich.edu 0x1: jalr_hb({{ Rd = NNPC; NNPC = Rs; }}, IsCall 1532686Sksewell@umich.edu , ClearHazards); 1544661Sksewell@umich.edu default: jalr({{ Rd = NNPC; NNPC = Rs; }}, IsCall); 1552101SN/A } 1562101SN/A } 1572042SN/A 1582101SN/A format BasicOp { 1592686Sksewell@umich.edu 0x2: movz({{ Rd = (Rt == 0) ? Rs : Rd; }}); 1602686Sksewell@umich.edu 0x3: movn({{ Rd = (Rt != 0) ? Rs : Rd; }}); 1615222Sksewell@umich.edu#if FULL_SYSTEM 1626384Sgblack@eecs.umich.edu 0x4: syscall({{ fault = new SystemCallFault(); }}); 1635222Sksewell@umich.edu#else 1642965Sksewell@umich.edu 0x4: syscall({{ xc->syscall(R2); }}, 1656037Sksewell@umich.edu IsSerializeAfter, IsNonSpeculative); 1665222Sksewell@umich.edu#endif 1672686Sksewell@umich.edu 0x7: sync({{ ; }}, IsMemBarrier); 1685222Sksewell@umich.edu 0x5: break({{fault = new BreakpointFault();}}); 1692101SN/A } 1702083SN/A 1712043SN/A } 1722025SN/A 1732043SN/A 0x2: decode FUNCTION_LO { 1746384Sgblack@eecs.umich.edu 0x0: HiLoRsSelOp::mfhi({{ Rd = HI_RS_SEL; }}, 1756384Sgblack@eecs.umich.edu IntMultOp, IsIprAccess); 1764661Sksewell@umich.edu 0x1: HiLoRdSelOp::mthi({{ HI_RD_SEL = Rs; }}); 1776384Sgblack@eecs.umich.edu 0x2: HiLoRsSelOp::mflo({{ Rd = LO_RS_SEL; }}, 1786384Sgblack@eecs.umich.edu IntMultOp, IsIprAccess); 1794661Sksewell@umich.edu 0x3: HiLoRdSelOp::mtlo({{ LO_RD_SEL = Rs; }}); 1802083SN/A } 1812025SN/A 1822043SN/A 0x3: decode FUNCTION_LO { 1834661Sksewell@umich.edu format HiLoRdSelValOp { 1845222Sksewell@umich.edu 0x0: mult({{ val = Rs.sd * Rt.sd; }}, IntMultOp); 1855222Sksewell@umich.edu 0x1: multu({{ val = Rs.ud * Rt.ud; }}, IntMultOp); 1864661Sksewell@umich.edu } 1874661Sksewell@umich.edu 1882686Sksewell@umich.edu format HiLoOp { 1896384Sgblack@eecs.umich.edu 0x2: div({{ 1906384Sgblack@eecs.umich.edu if (Rt.sd != 0) { 1916384Sgblack@eecs.umich.edu HI0 = Rs.sd % Rt.sd; 1926384Sgblack@eecs.umich.edu LO0 = Rs.sd / Rt.sd; 1936384Sgblack@eecs.umich.edu } 1945222Sksewell@umich.edu }}, IntDivOp); 1955222Sksewell@umich.edu 1966384Sgblack@eecs.umich.edu 0x3: divu({{ 1976384Sgblack@eecs.umich.edu if (Rt.ud != 0) { 1986384Sgblack@eecs.umich.edu HI0 = Rs.ud % Rt.ud; 1996384Sgblack@eecs.umich.edu LO0 = Rs.ud / Rt.ud; 2006384Sgblack@eecs.umich.edu } 2015222Sksewell@umich.edu }}, IntDivOp); 2022101SN/A } 2032084SN/A } 2042025SN/A 2052495SN/A 0x4: decode HINT { 2062495SN/A 0x0: decode FUNCTION_LO { 2072495SN/A format IntOp { 2086384Sgblack@eecs.umich.edu 0x0: add({{ 2096384Sgblack@eecs.umich.edu /* More complicated since an ADD can cause 2106384Sgblack@eecs.umich.edu an arithmetic overflow exception */ 2116384Sgblack@eecs.umich.edu int64_t Src1 = Rs.sw; 2126384Sgblack@eecs.umich.edu int64_t Src2 = Rt.sw; 2136384Sgblack@eecs.umich.edu int64_t temp_result; 2146384Sgblack@eecs.umich.edu#if FULL_SYSTEM 2156384Sgblack@eecs.umich.edu if (((Src1 >> 31) & 1) == 1) 2166384Sgblack@eecs.umich.edu Src1 |= 0x100000000LL; 2175222Sksewell@umich.edu#endif 2186384Sgblack@eecs.umich.edu temp_result = Src1 + Src2; 2196384Sgblack@eecs.umich.edu#if FULL_SYSTEM 2206384Sgblack@eecs.umich.edu if (bits(temp_result, 31) == 2216384Sgblack@eecs.umich.edu bits(temp_result, 32)) { 2225222Sksewell@umich.edu#endif 2236384Sgblack@eecs.umich.edu Rd.sw = temp_result; 2246384Sgblack@eecs.umich.edu#if FULL_SYSTEM 2256384Sgblack@eecs.umich.edu } else { 2266384Sgblack@eecs.umich.edu fault = new ArithmeticFault(); 2276384Sgblack@eecs.umich.edu } 2285222Sksewell@umich.edu#endif 2296384Sgblack@eecs.umich.edu }}); 2302495SN/A 0x1: addu({{ Rd.sw = Rs.sw + Rt.sw;}}); 2315222Sksewell@umich.edu 0x2: sub({{ 2326384Sgblack@eecs.umich.edu /* More complicated since an SUB can cause 2336384Sgblack@eecs.umich.edu an arithmetic overflow exception */ 2346384Sgblack@eecs.umich.edu int64_t Src1 = Rs.sw; 2356384Sgblack@eecs.umich.edu int64_t Src2 = Rt.sw; 2366384Sgblack@eecs.umich.edu int64_t temp_result = Src1 - Src2; 2375222Sksewell@umich.edu#if FULL_SYSTEM 2386384Sgblack@eecs.umich.edu if (bits(temp_result, 31) == 2396384Sgblack@eecs.umich.edu bits(temp_result, 32)) { 2405222Sksewell@umich.edu#endif 2416384Sgblack@eecs.umich.edu Rd.sw = temp_result; 2425222Sksewell@umich.edu#if FULL_SYSTEM 2436384Sgblack@eecs.umich.edu } else { 2446384Sgblack@eecs.umich.edu fault = new ArithmeticFault(); 2456384Sgblack@eecs.umich.edu } 2465222Sksewell@umich.edu#endif 2476384Sgblack@eecs.umich.edu }}); 2486384Sgblack@eecs.umich.edu 0x3: subu({{ Rd.sw = Rs.sw - Rt.sw; }}); 2496384Sgblack@eecs.umich.edu 0x4: and({{ Rd = Rs & Rt; }}); 2506384Sgblack@eecs.umich.edu 0x5: or({{ Rd = Rs | Rt; }}); 2516384Sgblack@eecs.umich.edu 0x6: xor({{ Rd = Rs ^ Rt; }}); 2526384Sgblack@eecs.umich.edu 0x7: nor({{ Rd = ~(Rs | Rt); }}); 2532495SN/A } 2542101SN/A } 2552043SN/A } 2562025SN/A 2572495SN/A 0x5: decode HINT { 2582495SN/A 0x0: decode FUNCTION_LO { 2592495SN/A format IntOp{ 2606384Sgblack@eecs.umich.edu 0x2: slt({{ Rd.sw = (Rs.sw < Rt.sw) ? 1 : 0 }}); 2616384Sgblack@eecs.umich.edu 0x3: sltu({{ Rd.uw = (Rs.uw < Rt.uw) ? 1 : 0 }}); 2622495SN/A } 2632101SN/A } 2642084SN/A } 2652024SN/A 2662043SN/A 0x6: decode FUNCTION_LO { 2672239SN/A format Trap { 2682239SN/A 0x0: tge({{ cond = (Rs.sw >= Rt.sw); }}); 2692101SN/A 0x1: tgeu({{ cond = (Rs.uw >= Rt.uw); }}); 2702101SN/A 0x2: tlt({{ cond = (Rs.sw < Rt.sw); }}); 2715222Sksewell@umich.edu 0x3: tltu({{ cond = (Rs.uw < Rt.uw); }}); 2722101SN/A 0x4: teq({{ cond = (Rs.sw == Rt.sw); }}); 2732101SN/A 0x6: tne({{ cond = (Rs.sw != Rt.sw); }}); 2742101SN/A } 2752043SN/A } 2762043SN/A } 2772025SN/A 2782043SN/A 0x1: decode REGIMM_HI { 2792043SN/A 0x0: decode REGIMM_LO { 2802101SN/A format Branch { 2812101SN/A 0x0: bltz({{ cond = (Rs.sw < 0); }}); 2822101SN/A 0x1: bgez({{ cond = (Rs.sw >= 0); }}); 2832686Sksewell@umich.edu 0x2: bltzl({{ cond = (Rs.sw < 0); }}, Likely); 2842686Sksewell@umich.edu 0x3: bgezl({{ cond = (Rs.sw >= 0); }}, Likely); 2852101SN/A } 2862043SN/A } 2872025SN/A 2882043SN/A 0x1: decode REGIMM_LO { 2895222Sksewell@umich.edu format TrapImm { 2905222Sksewell@umich.edu 0x0: tgei( {{ cond = (Rs.sw >= (int16_t)INTIMM); }}); 2916384Sgblack@eecs.umich.edu 0x1: tgeiu({{ 2926384Sgblack@eecs.umich.edu cond = (Rs.uw >= (uint32_t)(int32_t)(int16_t)INTIMM); 2936384Sgblack@eecs.umich.edu }}); 2945222Sksewell@umich.edu 0x2: tlti( {{ cond = (Rs.sw < (int16_t)INTIMM); }}); 2956384Sgblack@eecs.umich.edu 0x3: tltiu({{ 2966384Sgblack@eecs.umich.edu cond = (Rs.uw < (uint32_t)(int32_t)(int16_t)INTIMM); 2976384Sgblack@eecs.umich.edu }}); 2986384Sgblack@eecs.umich.edu 0x4: teqi( {{ cond = (Rs.sw == (int16_t)INTIMM); }}); 2996384Sgblack@eecs.umich.edu 0x6: tnei( {{ cond = (Rs.sw != (int16_t)INTIMM); }}); 3002101SN/A } 3012043SN/A } 3022043SN/A 3032043SN/A 0x2: decode REGIMM_LO { 3042101SN/A format Branch { 3052686Sksewell@umich.edu 0x0: bltzal({{ cond = (Rs.sw < 0); }}, Link); 3062686Sksewell@umich.edu 0x1: decode RS { 3072686Sksewell@umich.edu 0x0: bal ({{ cond = 1; }}, IsCall, Link); 3082686Sksewell@umich.edu default: bgezal({{ cond = (Rs.sw >= 0); }}, Link); 3092686Sksewell@umich.edu } 3102686Sksewell@umich.edu 0x2: bltzall({{ cond = (Rs.sw < 0); }}, Link, Likely); 3112686Sksewell@umich.edu 0x3: bgezall({{ cond = (Rs.sw >= 0); }}, Link, Likely); 3122101SN/A } 3132043SN/A } 3142043SN/A 3152043SN/A 0x3: decode REGIMM_LO { 3166384Sgblack@eecs.umich.edu // from Table 5-4 MIPS32 REGIMM Encoding of rt Field 3176384Sgblack@eecs.umich.edu // (DSP ASE MANUAL) 3184661Sksewell@umich.edu 0x4: DspBranch::bposge32({{ cond = (dspctl<5:0> >= 32); }}); 3192101SN/A format WarnUnimpl { 3202101SN/A 0x7: synci(); 3212101SN/A } 3222043SN/A } 3232043SN/A } 3242043SN/A 3252123SN/A format Jump { 3266384Sgblack@eecs.umich.edu 0x2: j({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }}); 3276384Sgblack@eecs.umich.edu 0x3: jal({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }}, 3286384Sgblack@eecs.umich.edu IsCall, Link); 3292043SN/A } 3302043SN/A 3312100SN/A format Branch { 3322686Sksewell@umich.edu 0x4: decode RS_RT { 3332686Sksewell@umich.edu 0x0: b({{ cond = 1; }}); 3342686Sksewell@umich.edu default: beq({{ cond = (Rs.sw == Rt.sw); }}); 3352686Sksewell@umich.edu } 3362239SN/A 0x5: bne({{ cond = (Rs.sw != Rt.sw); }}); 3372686Sksewell@umich.edu 0x6: blez({{ cond = (Rs.sw <= 0); }}); 3382686Sksewell@umich.edu 0x7: bgtz({{ cond = (Rs.sw > 0); }}); 3392043SN/A } 3402084SN/A } 3412024SN/A 3422101SN/A 0x1: decode OPCODE_LO { 3432686Sksewell@umich.edu format IntImmOp { 3445222Sksewell@umich.edu 0x0: addi({{ 3456384Sgblack@eecs.umich.edu int64_t Src1 = Rs.sw; 3466384Sgblack@eecs.umich.edu int64_t Src2 = imm; 3476384Sgblack@eecs.umich.edu int64_t temp_result; 3485222Sksewell@umich.edu#if FULL_SYSTEM 3496384Sgblack@eecs.umich.edu if (((Src1 >> 31) & 1) == 1) 3506384Sgblack@eecs.umich.edu Src1 |= 0x100000000LL; 3515222Sksewell@umich.edu#endif 3526384Sgblack@eecs.umich.edu temp_result = Src1 + Src2; 3535222Sksewell@umich.edu#if FULL_SYSTEM 3546384Sgblack@eecs.umich.edu if (bits(temp_result, 31) == bits(temp_result, 32)) { 3555222Sksewell@umich.edu#endif 3566384Sgblack@eecs.umich.edu Rt.sw = temp_result; 3575222Sksewell@umich.edu#if FULL_SYSTEM 3586384Sgblack@eecs.umich.edu } else { 3596384Sgblack@eecs.umich.edu fault = new ArithmeticFault(); 3606384Sgblack@eecs.umich.edu } 3615222Sksewell@umich.edu#endif 3626384Sgblack@eecs.umich.edu }}); 3636384Sgblack@eecs.umich.edu 0x1: addiu({{ Rt.sw = Rs.sw + imm; }}); 3646384Sgblack@eecs.umich.edu 0x2: slti({{ Rt.sw = (Rs.sw < imm) ? 1 : 0 }}); 3654661Sksewell@umich.edu 3664661Sksewell@umich.edu //Edited to include MIPS AVP Pass/Fail instructions and 3674661Sksewell@umich.edu //default to the sltiu instruction 3684661Sksewell@umich.edu 0x3: decode RS_RT_INTIMM { 3696384Sgblack@eecs.umich.edu 0xabc1: BasicOp::fail({{ 3706384Sgblack@eecs.umich.edu exitSimLoop("AVP/SRVP Test Failed"); 3716384Sgblack@eecs.umich.edu }}); 3726384Sgblack@eecs.umich.edu 0xabc2: BasicOp::pass({{ 3736384Sgblack@eecs.umich.edu exitSimLoop("AVP/SRVP Test Passed"); 3746384Sgblack@eecs.umich.edu }}); 3756384Sgblack@eecs.umich.edu default: sltiu({{ 3766384Sgblack@eecs.umich.edu Rt.uw = (Rs.uw < (uint32_t)sextImm) ? 1 : 0; 3776384Sgblack@eecs.umich.edu }}); 3784661Sksewell@umich.edu } 3794661Sksewell@umich.edu 3806384Sgblack@eecs.umich.edu 0x4: andi({{ Rt.sw = Rs.sw & zextImm; }}); 3816384Sgblack@eecs.umich.edu 0x5: ori({{ Rt.sw = Rs.sw | zextImm; }}); 3826384Sgblack@eecs.umich.edu 0x6: xori({{ Rt.sw = Rs.sw ^ zextImm; }}); 3832495SN/A 3842495SN/A 0x7: decode RS { 3856384Sgblack@eecs.umich.edu 0x0: lui({{ Rt = imm << 16; }}); 3862495SN/A } 3872084SN/A } 3882084SN/A } 3892024SN/A 3902101SN/A 0x2: decode OPCODE_LO { 3912101SN/A //Table A-11 MIPS32 COP0 Encoding of rs Field 3922101SN/A 0x0: decode RS_MSB { 3932101SN/A 0x0: decode RS { 3946384Sgblack@eecs.umich.edu format CP0Control { 3956384Sgblack@eecs.umich.edu 0x0: mfc0({{ 3966384Sgblack@eecs.umich.edu Config3Reg config3 = Config3; 3976384Sgblack@eecs.umich.edu PageGrainReg pageGrain = PageGrain; 3986384Sgblack@eecs.umich.edu Rt = CP0_RD_SEL; 3996384Sgblack@eecs.umich.edu /* Hack for PageMask */ 4006384Sgblack@eecs.umich.edu if (RD == 5) { 4016384Sgblack@eecs.umich.edu // PageMask 4026384Sgblack@eecs.umich.edu if (config3.sp == 0 || pageGrain.esp == 0) 4036384Sgblack@eecs.umich.edu Rt &= 0xFFFFE7FF; 4046384Sgblack@eecs.umich.edu } 4056384Sgblack@eecs.umich.edu }}); 4066384Sgblack@eecs.umich.edu 0x4: mtc0({{ 4076384Sgblack@eecs.umich.edu CP0_RD_SEL = Rt; 4086384Sgblack@eecs.umich.edu CauseReg cause = Cause; 4096384Sgblack@eecs.umich.edu IntCtlReg intCtl = IntCtl; 4106384Sgblack@eecs.umich.edu if (RD == 11) { 4116384Sgblack@eecs.umich.edu // Compare 4126384Sgblack@eecs.umich.edu if (cause.ti == 1) { 4136384Sgblack@eecs.umich.edu cause.ti = 0; 4146384Sgblack@eecs.umich.edu int offset = 10; // corresponding to cause.ip0 4156384Sgblack@eecs.umich.edu offset += intCtl.ipti - 2; 4166384Sgblack@eecs.umich.edu replaceBits(cause, offset, offset, 0); 4176384Sgblack@eecs.umich.edu } 4186384Sgblack@eecs.umich.edu } 4196384Sgblack@eecs.umich.edu Cause = cause; 4206384Sgblack@eecs.umich.edu }}); 4216384Sgblack@eecs.umich.edu } 4226384Sgblack@eecs.umich.edu format CP0Unimpl { 4236384Sgblack@eecs.umich.edu 0x1: dmfc0(); 4246384Sgblack@eecs.umich.edu 0x5: dmtc0(); 4256384Sgblack@eecs.umich.edu default: unknown(); 4266384Sgblack@eecs.umich.edu } 4276384Sgblack@eecs.umich.edu format MT_MFTR { 4286384Sgblack@eecs.umich.edu // Decode MIPS MT MFTR instruction into sub-instructions 4294661Sksewell@umich.edu 0x8: decode MT_U { 4306376Sgblack@eecs.umich.edu 0x0: mftc0({{ 4316376Sgblack@eecs.umich.edu data = xc->readRegOtherThread((RT << 3 | SEL) + 4326376Sgblack@eecs.umich.edu Ctrl_Base_DepTag); 4336376Sgblack@eecs.umich.edu }}); 4344661Sksewell@umich.edu 0x1: decode SEL { 4356384Sgblack@eecs.umich.edu 0x0: mftgpr({{ 4366384Sgblack@eecs.umich.edu data = xc->readRegOtherThread(RT); 4376384Sgblack@eecs.umich.edu }}); 4384661Sksewell@umich.edu 0x1: decode RT { 4396383Sgblack@eecs.umich.edu 0x0: mftlo_dsp0({{ data = xc->readRegOtherThread(INTREG_DSP_LO0); }}); 4406383Sgblack@eecs.umich.edu 0x1: mfthi_dsp0({{ data = xc->readRegOtherThread(INTREG_DSP_HI0); }}); 4416383Sgblack@eecs.umich.edu 0x2: mftacx_dsp0({{ data = xc->readRegOtherThread(INTREG_DSP_ACX0); }}); 4426383Sgblack@eecs.umich.edu 0x4: mftlo_dsp1({{ data = xc->readRegOtherThread(INTREG_DSP_LO1); }}); 4436383Sgblack@eecs.umich.edu 0x5: mfthi_dsp1({{ data = xc->readRegOtherThread(INTREG_DSP_HI1); }}); 4446383Sgblack@eecs.umich.edu 0x6: mftacx_dsp1({{ data = xc->readRegOtherThread(INTREG_DSP_ACX1); }}); 4456383Sgblack@eecs.umich.edu 0x8: mftlo_dsp2({{ data = xc->readRegOtherThread(INTREG_DSP_LO2); }}); 4466383Sgblack@eecs.umich.edu 0x9: mfthi_dsp2({{ data = xc->readRegOtherThread(INTREG_DSP_HI2); }}); 4476383Sgblack@eecs.umich.edu 0x10: mftacx_dsp2({{ data = xc->readRegOtherThread(INTREG_DSP_ACX2); }}); 4486383Sgblack@eecs.umich.edu 0x12: mftlo_dsp3({{ data = xc->readRegOtherThread(INTREG_DSP_LO3); }}); 4496383Sgblack@eecs.umich.edu 0x13: mfthi_dsp3({{ data = xc->readRegOtherThread(INTREG_DSP_HI3); }}); 4506383Sgblack@eecs.umich.edu 0x14: mftacx_dsp3({{ data = xc->readRegOtherThread(INTREG_DSP_ACX3); }}); 4516383Sgblack@eecs.umich.edu 0x16: mftdsp({{ data = xc->readRegOtherThread(INTREG_DSP_CONTROL); }}); 4526384Sgblack@eecs.umich.edu default: CP0Unimpl::unknown(); 4532686Sksewell@umich.edu } 4544661Sksewell@umich.edu 0x2: decode MT_H { 4554661Sksewell@umich.edu 0x0: mftc1({{ data = xc->readRegOtherThread(RT + 4564661Sksewell@umich.edu FP_Base_DepTag); 4576384Sgblack@eecs.umich.edu }}); 4584661Sksewell@umich.edu 0x1: mfthc1({{ data = xc->readRegOtherThread(RT + 4594661Sksewell@umich.edu FP_Base_DepTag); 4606384Sgblack@eecs.umich.edu }}); 4616384Sgblack@eecs.umich.edu } 4626384Sgblack@eecs.umich.edu 0x3: cftc1({{ 4636384Sgblack@eecs.umich.edu uint32_t fcsr_val = xc->readRegOtherThread(FLOATREG_FCSR + 4644661Sksewell@umich.edu FP_Base_DepTag); 4656384Sgblack@eecs.umich.edu switch (RT) { 4666384Sgblack@eecs.umich.edu case 0: 4676384Sgblack@eecs.umich.edu data = xc->readRegOtherThread(FLOATREG_FIR + 4686384Sgblack@eecs.umich.edu Ctrl_Base_DepTag); 4696384Sgblack@eecs.umich.edu break; 4706384Sgblack@eecs.umich.edu case 25: 4716384Sgblack@eecs.umich.edu data = (fcsr_val & 0xFE000000 >> 24) | 4726384Sgblack@eecs.umich.edu (fcsr_val & 0x00800000 >> 23); 4736384Sgblack@eecs.umich.edu break; 4746384Sgblack@eecs.umich.edu case 26: 4756384Sgblack@eecs.umich.edu data = fcsr_val & 0x0003F07C; 4766384Sgblack@eecs.umich.edu break; 4776384Sgblack@eecs.umich.edu case 28: 4786384Sgblack@eecs.umich.edu data = (fcsr_val & 0x00000F80) | 4796384Sgblack@eecs.umich.edu (fcsr_val & 0x01000000 >> 21) | 4806384Sgblack@eecs.umich.edu (fcsr_val & 0x00000003); 4816384Sgblack@eecs.umich.edu break; 4826384Sgblack@eecs.umich.edu case 31: 4836384Sgblack@eecs.umich.edu data = fcsr_val; 4846384Sgblack@eecs.umich.edu break; 4856384Sgblack@eecs.umich.edu default: 4866384Sgblack@eecs.umich.edu fatal("FP Control Value (%d) Not Valid"); 4876384Sgblack@eecs.umich.edu } 4886384Sgblack@eecs.umich.edu }}); 4896384Sgblack@eecs.umich.edu default: CP0Unimpl::unknown(); 4902101SN/A } 4916384Sgblack@eecs.umich.edu } 4922686Sksewell@umich.edu } 4932027SN/A 4946384Sgblack@eecs.umich.edu format MT_MTTR { 4956384Sgblack@eecs.umich.edu // Decode MIPS MT MTTR instruction into sub-instructions 4964661Sksewell@umich.edu 0xC: decode MT_U { 4974661Sksewell@umich.edu 0x0: mttc0({{ xc->setRegOtherThread((RD << 3 | SEL) + Ctrl_Base_DepTag, 4984661Sksewell@umich.edu Rt); 4994661Sksewell@umich.edu }}); 5004661Sksewell@umich.edu 0x1: decode SEL { 5014661Sksewell@umich.edu 0x0: mttgpr({{ xc->setRegOtherThread(RD, Rt); }}); 5024661Sksewell@umich.edu 0x1: decode RT { 5036383Sgblack@eecs.umich.edu 0x0: mttlo_dsp0({{ xc->setRegOtherThread(INTREG_DSP_LO0, Rt); 5044661Sksewell@umich.edu }}); 5056383Sgblack@eecs.umich.edu 0x1: mtthi_dsp0({{ xc->setRegOtherThread(INTREG_DSP_HI0, 5064661Sksewell@umich.edu Rt); 5074661Sksewell@umich.edu }}); 5086383Sgblack@eecs.umich.edu 0x2: mttacx_dsp0({{ xc->setRegOtherThread(INTREG_DSP_ACX0, 5094661Sksewell@umich.edu Rt); 5104661Sksewell@umich.edu }}); 5116383Sgblack@eecs.umich.edu 0x4: mttlo_dsp1({{ xc->setRegOtherThread(INTREG_DSP_LO1, 5124661Sksewell@umich.edu Rt); 5134661Sksewell@umich.edu }}); 5146383Sgblack@eecs.umich.edu 0x5: mtthi_dsp1({{ xc->setRegOtherThread(INTREG_DSP_HI1, 5154661Sksewell@umich.edu Rt); 5164661Sksewell@umich.edu }}); 5176383Sgblack@eecs.umich.edu 0x6: mttacx_dsp1({{ xc->setRegOtherThread(INTREG_DSP_ACX1, 5184661Sksewell@umich.edu Rt); 5194661Sksewell@umich.edu }}); 5206383Sgblack@eecs.umich.edu 0x8: mttlo_dsp2({{ xc->setRegOtherThread(INTREG_DSP_LO2, 5214661Sksewell@umich.edu Rt); 5224661Sksewell@umich.edu }}); 5236383Sgblack@eecs.umich.edu 0x9: mtthi_dsp2({{ xc->setRegOtherThread(INTREG_DSP_HI2, 5244661Sksewell@umich.edu Rt); 5254661Sksewell@umich.edu }}); 5266383Sgblack@eecs.umich.edu 0x10: mttacx_dsp2({{ xc->setRegOtherThread(INTREG_DSP_ACX2, 5274661Sksewell@umich.edu Rt); 5284661Sksewell@umich.edu }}); 5296383Sgblack@eecs.umich.edu 0x12: mttlo_dsp3({{ xc->setRegOtherThread(INTREG_DSP_LO3, 5304661Sksewell@umich.edu Rt); 5314661Sksewell@umich.edu }}); 5326383Sgblack@eecs.umich.edu 0x13: mtthi_dsp3({{ xc->setRegOtherThread(INTREG_DSP_HI3, 5334661Sksewell@umich.edu Rt); 5344661Sksewell@umich.edu }}); 5356383Sgblack@eecs.umich.edu 0x14: mttacx_dsp3({{ xc->setRegOtherThread(INTREG_DSP_ACX3, Rt); 5364661Sksewell@umich.edu }}); 5376383Sgblack@eecs.umich.edu 0x16: mttdsp({{ xc->setRegOtherThread(INTREG_DSP_CONTROL, Rt); }}); 5386384Sgblack@eecs.umich.edu default: CP0Unimpl::unknown(); 5395222Sksewell@umich.edu 5404661Sksewell@umich.edu } 5416384Sgblack@eecs.umich.edu 0x2: mttc1({{ 5426384Sgblack@eecs.umich.edu uint64_t data = xc->readRegOtherThread(RD + 5436384Sgblack@eecs.umich.edu FP_Base_DepTag); 5446384Sgblack@eecs.umich.edu data = insertBits(data, top_bit, 5456384Sgblack@eecs.umich.edu bottom_bit, Rt); 5466384Sgblack@eecs.umich.edu xc->setRegOtherThread(RD + FP_Base_DepTag, 5476384Sgblack@eecs.umich.edu data); 5486384Sgblack@eecs.umich.edu }}); 5496384Sgblack@eecs.umich.edu 0x3: cttc1({{ 5506384Sgblack@eecs.umich.edu uint32_t data; 5516384Sgblack@eecs.umich.edu switch (RD) { 5526384Sgblack@eecs.umich.edu case 25: 5536384Sgblack@eecs.umich.edu data = (Rt.uw<7:1> << 25) | // move 31-25 5546384Sgblack@eecs.umich.edu (FCSR & 0x01000000) | // bit 24 5556384Sgblack@eecs.umich.edu (FCSR & 0x004FFFFF); // bit 22-0 5566384Sgblack@eecs.umich.edu break; 5576384Sgblack@eecs.umich.edu case 26: 5586384Sgblack@eecs.umich.edu data = (FCSR & 0xFFFC0000) | // move 31-18 5596384Sgblack@eecs.umich.edu Rt.uw<17:12> << 12 | // bit 17-12 5606384Sgblack@eecs.umich.edu (FCSR & 0x00000F80) << 7 | // bit 11-7 5616384Sgblack@eecs.umich.edu Rt.uw<6:2> << 2 | // bit 6-2 5626384Sgblack@eecs.umich.edu (FCSR & 0x00000002); // bit 1...0 5636384Sgblack@eecs.umich.edu break; 5646384Sgblack@eecs.umich.edu case 28: 5656384Sgblack@eecs.umich.edu data = (FCSR & 0xFE000000) | // move 31-25 5666384Sgblack@eecs.umich.edu Rt.uw<2:2> << 24 | // bit 24 5676384Sgblack@eecs.umich.edu (FCSR & 0x00FFF000) << 23 | // bit 23-12 5686384Sgblack@eecs.umich.edu Rt.uw<11:7> << 7 | // bit 24 5696384Sgblack@eecs.umich.edu (FCSR & 0x000007E) | 5706384Sgblack@eecs.umich.edu Rt.uw<1:0>; // bit 22-0 5716384Sgblack@eecs.umich.edu break; 5726384Sgblack@eecs.umich.edu case 31: 5736384Sgblack@eecs.umich.edu data = Rt.uw; 5746384Sgblack@eecs.umich.edu break; 5756384Sgblack@eecs.umich.edu default: 5766384Sgblack@eecs.umich.edu panic("FP Control Value (%d) " 5776384Sgblack@eecs.umich.edu "Not Available. Ignoring " 5786384Sgblack@eecs.umich.edu "Access to Floating Control " 5796384Sgblack@eecs.umich.edu "Status Register", FS); 5806384Sgblack@eecs.umich.edu } 5816384Sgblack@eecs.umich.edu xc->setRegOtherThread(FLOATREG_FCSR + FP_Base_DepTag, data); 5826384Sgblack@eecs.umich.edu }}); 5836384Sgblack@eecs.umich.edu default: CP0Unimpl::unknown(); 5844661Sksewell@umich.edu } 5854661Sksewell@umich.edu } 5862101SN/A } 5874661Sksewell@umich.edu 0xB: decode RD { 5884661Sksewell@umich.edu format MT_Control { 5894661Sksewell@umich.edu 0x0: decode POS { 5904661Sksewell@umich.edu 0x0: decode SEL { 5914661Sksewell@umich.edu 0x1: decode SC { 5926376Sgblack@eecs.umich.edu 0x0: dvpe({{ 5936376Sgblack@eecs.umich.edu MVPControlReg mvpControl = MVPControl; 5946376Sgblack@eecs.umich.edu VPEConf0Reg vpeConf0 = VPEConf0; 5956376Sgblack@eecs.umich.edu Rt = MVPControl; 5966376Sgblack@eecs.umich.edu if (vpeConf0.mvp == 1) 5976376Sgblack@eecs.umich.edu mvpControl.evp = 0; 5986376Sgblack@eecs.umich.edu MVPControl = mvpControl; 5996376Sgblack@eecs.umich.edu }}); 6006376Sgblack@eecs.umich.edu 0x1: evpe({{ 6016376Sgblack@eecs.umich.edu MVPControlReg mvpControl = MVPControl; 6026376Sgblack@eecs.umich.edu VPEConf0Reg vpeConf0 = VPEConf0; 6036376Sgblack@eecs.umich.edu Rt = MVPControl; 6046376Sgblack@eecs.umich.edu if (vpeConf0.mvp == 1) 6056376Sgblack@eecs.umich.edu mvpControl.evp = 1; 6066376Sgblack@eecs.umich.edu MVPControl = mvpControl; 6076376Sgblack@eecs.umich.edu }}); 6085222Sksewell@umich.edu default:CP0Unimpl::unknown(); 6094661Sksewell@umich.edu } 6106384Sgblack@eecs.umich.edu default:CP0Unimpl::unknown(); 6114661Sksewell@umich.edu } 6126384Sgblack@eecs.umich.edu default:CP0Unimpl::unknown(); 6136384Sgblack@eecs.umich.edu } 6144661Sksewell@umich.edu 0x1: decode POS { 6154661Sksewell@umich.edu 0xF: decode SEL { 6164661Sksewell@umich.edu 0x1: decode SC { 6176376Sgblack@eecs.umich.edu 0x0: dmt({{ 6186376Sgblack@eecs.umich.edu VPEControlReg vpeControl = VPEControl; 6196376Sgblack@eecs.umich.edu Rt = vpeControl; 6206376Sgblack@eecs.umich.edu vpeControl.te = 0; 6216376Sgblack@eecs.umich.edu VPEControl = vpeControl; 6226376Sgblack@eecs.umich.edu }}); 6236376Sgblack@eecs.umich.edu 0x1: emt({{ 6246376Sgblack@eecs.umich.edu VPEControlReg vpeControl = VPEControl; 6256376Sgblack@eecs.umich.edu Rt = vpeControl; 6266376Sgblack@eecs.umich.edu vpeControl.te = 1; 6276376Sgblack@eecs.umich.edu VPEControl = vpeControl; 6286376Sgblack@eecs.umich.edu }}); 6295222Sksewell@umich.edu default:CP0Unimpl::unknown(); 6304661Sksewell@umich.edu } 6316384Sgblack@eecs.umich.edu default:CP0Unimpl::unknown(); 6324661Sksewell@umich.edu } 6335222Sksewell@umich.edu default:CP0Unimpl::unknown(); 6344661Sksewell@umich.edu } 6354661Sksewell@umich.edu } 6364661Sksewell@umich.edu 0xC: decode POS { 6376384Sgblack@eecs.umich.edu 0x0: decode SC { 6386384Sgblack@eecs.umich.edu 0x0: CP0Control::di({{ 6396384Sgblack@eecs.umich.edu StatusReg status = Status; 6406384Sgblack@eecs.umich.edu ConfigReg config = Config; 6416384Sgblack@eecs.umich.edu // Rev 2.0 or beyond? 6426384Sgblack@eecs.umich.edu if (config.ar >= 1) { 6436384Sgblack@eecs.umich.edu Rt = status; 6446384Sgblack@eecs.umich.edu status.ie = 0; 6456384Sgblack@eecs.umich.edu } else { 6466384Sgblack@eecs.umich.edu // Enable this else branch once we 6476384Sgblack@eecs.umich.edu // actually set values for Config on init 6486384Sgblack@eecs.umich.edu fault = new ReservedInstructionFault(); 6496384Sgblack@eecs.umich.edu } 6506384Sgblack@eecs.umich.edu Status = status; 6516384Sgblack@eecs.umich.edu }}); 6526384Sgblack@eecs.umich.edu 0x1: CP0Control::ei({{ 6536384Sgblack@eecs.umich.edu StatusReg status = Status; 6546384Sgblack@eecs.umich.edu ConfigReg config = Config; 6556384Sgblack@eecs.umich.edu if (config.ar >= 1) { 6566384Sgblack@eecs.umich.edu Rt = status; 6576384Sgblack@eecs.umich.edu status.ie = 1; 6586384Sgblack@eecs.umich.edu } else { 6596384Sgblack@eecs.umich.edu fault = new ReservedInstructionFault(); 6606384Sgblack@eecs.umich.edu } 6616384Sgblack@eecs.umich.edu }}); 6626384Sgblack@eecs.umich.edu default:CP0Unimpl::unknown(); 6636384Sgblack@eecs.umich.edu } 6644661Sksewell@umich.edu } 6656384Sgblack@eecs.umich.edu default: CP0Unimpl::unknown(); 6664661Sksewell@umich.edu } 6674661Sksewell@umich.edu format CP0Control { 6684661Sksewell@umich.edu 0xA: rdpgpr({{ 6696376Sgblack@eecs.umich.edu ConfigReg config = Config; 6706376Sgblack@eecs.umich.edu if (config.ar >= 1) { 6716376Sgblack@eecs.umich.edu // Rev 2 of the architecture 6726376Sgblack@eecs.umich.edu panic("Shadow Sets Not Fully Implemented.\n"); 6736376Sgblack@eecs.umich.edu } else { 6744661Sksewell@umich.edu fault = new ReservedInstructionFault(); 6754661Sksewell@umich.edu } 6766376Sgblack@eecs.umich.edu }}); 6774661Sksewell@umich.edu 0xE: wrpgpr({{ 6786376Sgblack@eecs.umich.edu ConfigReg config = Config; 6796376Sgblack@eecs.umich.edu if (config.ar >= 1) { 6806376Sgblack@eecs.umich.edu // Rev 2 of the architecture 6816376Sgblack@eecs.umich.edu panic("Shadow Sets Not Fully Implemented.\n"); 6826376Sgblack@eecs.umich.edu } else { 6836376Sgblack@eecs.umich.edu fault = new ReservedInstructionFault(); 6844661Sksewell@umich.edu } 6856376Sgblack@eecs.umich.edu }}); 6864661Sksewell@umich.edu } 6876384Sgblack@eecs.umich.edu } 6882101SN/A 6892101SN/A //Table A-12 MIPS32 COP0 Encoding of Function Field When rs=CO 6902101SN/A 0x1: decode FUNCTION { 6916384Sgblack@eecs.umich.edu format CP0Control { 6926384Sgblack@eecs.umich.edu 0x18: eret({{ 6936384Sgblack@eecs.umich.edu StatusReg status = Status; 6946384Sgblack@eecs.umich.edu ConfigReg config = Config; 6956384Sgblack@eecs.umich.edu SRSCtlReg srsCtl = SRSCtl; 6966384Sgblack@eecs.umich.edu DPRINTF(MipsPRA,"Restoring PC - %x\n",EPC); 6976384Sgblack@eecs.umich.edu if (status.erl == 1) { 6986384Sgblack@eecs.umich.edu status.erl = 0; 6996384Sgblack@eecs.umich.edu NPC = ErrorEPC; 7006384Sgblack@eecs.umich.edu // Need to adjust NNPC, otherwise things break 7016384Sgblack@eecs.umich.edu NNPC = ErrorEPC + sizeof(MachInst); 7026384Sgblack@eecs.umich.edu } else { 7036384Sgblack@eecs.umich.edu NPC = EPC; 7046384Sgblack@eecs.umich.edu // Need to adjust NNPC, otherwise things break 7056384Sgblack@eecs.umich.edu NNPC = EPC + sizeof(MachInst); 7066384Sgblack@eecs.umich.edu status.exl = 0; 7076384Sgblack@eecs.umich.edu if (config.ar >=1 && 7086384Sgblack@eecs.umich.edu srsCtl.hss > 0 && 7096384Sgblack@eecs.umich.edu status.bev == 0) { 7106384Sgblack@eecs.umich.edu srsCtl.css = srsCtl.pss; 7116384Sgblack@eecs.umich.edu //xc->setShadowSet(srsCtl.pss); 7126384Sgblack@eecs.umich.edu } 7136376Sgblack@eecs.umich.edu } 7146384Sgblack@eecs.umich.edu LLFlag = 0; 7156384Sgblack@eecs.umich.edu Status = status; 7166384Sgblack@eecs.umich.edu SRSCtl = srsCtl; 7176384Sgblack@eecs.umich.edu }}, IsReturn, IsSerializing, IsERET); 7185222Sksewell@umich.edu 7196384Sgblack@eecs.umich.edu 0x1F: deret({{ 7206384Sgblack@eecs.umich.edu DebugReg debug = Debug; 7216384Sgblack@eecs.umich.edu if (debug.dm == 1) { 7226384Sgblack@eecs.umich.edu debug.dm = 1; 7236384Sgblack@eecs.umich.edu debug.iexi = 0; 7246384Sgblack@eecs.umich.edu NPC = DEPC; 7256384Sgblack@eecs.umich.edu } else { 7266384Sgblack@eecs.umich.edu // Undefined; 7276384Sgblack@eecs.umich.edu } 7286384Sgblack@eecs.umich.edu Debug = debug; 7296384Sgblack@eecs.umich.edu }}, IsReturn, IsSerializing, IsERET); 7306384Sgblack@eecs.umich.edu } 7316384Sgblack@eecs.umich.edu format CP0TLB { 7326384Sgblack@eecs.umich.edu 0x01: tlbr({{ 7336384Sgblack@eecs.umich.edu MipsISA::PTE *PTEntry = 7346384Sgblack@eecs.umich.edu xc->tcBase()->getITBPtr()-> 7356384Sgblack@eecs.umich.edu getEntry(Index & 0x7FFFFFFF); 7366384Sgblack@eecs.umich.edu if (PTEntry == NULL) { 7376384Sgblack@eecs.umich.edu fatal("Invalid PTE Entry received on " 7386384Sgblack@eecs.umich.edu "a TLBR instruction\n"); 7396384Sgblack@eecs.umich.edu } 7406384Sgblack@eecs.umich.edu /* Setup PageMask */ 7416384Sgblack@eecs.umich.edu // If 1KB pages are not enabled, a read of PageMask 7426384Sgblack@eecs.umich.edu // must return 0b00 in bits 12, 11 7436384Sgblack@eecs.umich.edu PageMask = (PTEntry->Mask << 11); 7446384Sgblack@eecs.umich.edu /* Setup EntryHi */ 7456384Sgblack@eecs.umich.edu EntryHi = ((PTEntry->VPN << 11) | (PTEntry->asid)); 7466384Sgblack@eecs.umich.edu /* Setup Entry Lo0 */ 7476384Sgblack@eecs.umich.edu EntryLo0 = ((PTEntry->PFN0 << 6) | 7486384Sgblack@eecs.umich.edu (PTEntry->C0 << 3) | 7496384Sgblack@eecs.umich.edu (PTEntry->D0 << 2) | 7506384Sgblack@eecs.umich.edu (PTEntry->V0 << 1) | 7516384Sgblack@eecs.umich.edu PTEntry->G); 7526384Sgblack@eecs.umich.edu /* Setup Entry Lo1 */ 7536384Sgblack@eecs.umich.edu EntryLo1 = ((PTEntry->PFN1 << 6) | 7546384Sgblack@eecs.umich.edu (PTEntry->C1 << 3) | 7556384Sgblack@eecs.umich.edu (PTEntry->D1 << 2) | 7566384Sgblack@eecs.umich.edu (PTEntry->V1 << 1) | 7576384Sgblack@eecs.umich.edu PTEntry->G); 7586384Sgblack@eecs.umich.edu }}); // Need to hook up to TLB 7595222Sksewell@umich.edu 7606384Sgblack@eecs.umich.edu 0x02: tlbwi({{ 7616384Sgblack@eecs.umich.edu //Create PTE 7626384Sgblack@eecs.umich.edu MipsISA::PTE newEntry; 7636384Sgblack@eecs.umich.edu //Write PTE 7646384Sgblack@eecs.umich.edu newEntry.Mask = (Addr)(PageMask >> 11); 7656384Sgblack@eecs.umich.edu newEntry.VPN = (Addr)(EntryHi >> 11); 7666384Sgblack@eecs.umich.edu /* PageGrain _ ESP Config3 _ SP */ 7676384Sgblack@eecs.umich.edu if (bits(PageGrain, 28) == 0 || bits(Config3, 4) ==0) { 7686384Sgblack@eecs.umich.edu // If 1KB pages are *NOT* enabled, lowest bits of 7696384Sgblack@eecs.umich.edu // the mask are 0b11 for TLB writes 7706384Sgblack@eecs.umich.edu newEntry.Mask |= 0x3; 7716384Sgblack@eecs.umich.edu // Reset bits 0 and 1 if 1KB pages are not enabled 7726384Sgblack@eecs.umich.edu newEntry.VPN &= 0xFFFFFFFC; 7736384Sgblack@eecs.umich.edu } 7746384Sgblack@eecs.umich.edu newEntry.asid = (uint8_t)(EntryHi & 0xFF); 7755222Sksewell@umich.edu 7766384Sgblack@eecs.umich.edu newEntry.PFN0 = (Addr)(EntryLo0 >> 6); 7776384Sgblack@eecs.umich.edu newEntry.PFN1 = (Addr)(EntryLo1 >> 6); 7786384Sgblack@eecs.umich.edu newEntry.D0 = (bool)((EntryLo0 >> 2) & 1); 7796384Sgblack@eecs.umich.edu newEntry.D1 = (bool)((EntryLo1 >> 2) & 1); 7806384Sgblack@eecs.umich.edu newEntry.V1 = (bool)((EntryLo1 >> 1) & 1); 7816384Sgblack@eecs.umich.edu newEntry.V0 = (bool)((EntryLo0 >> 1) & 1); 7826384Sgblack@eecs.umich.edu newEntry.G = (bool)((EntryLo0 & EntryLo1) & 1); 7836384Sgblack@eecs.umich.edu newEntry.C0 = (uint8_t)((EntryLo0 >> 3) & 0x7); 7846384Sgblack@eecs.umich.edu newEntry.C1 = (uint8_t)((EntryLo1 >> 3) & 0x7); 7856384Sgblack@eecs.umich.edu /* Now, compute the AddrShiftAmount and OffsetMask - 7866384Sgblack@eecs.umich.edu TLB optimizations */ 7876384Sgblack@eecs.umich.edu /* Addr Shift Amount for 1KB or larger pages */ 7886384Sgblack@eecs.umich.edu if ((newEntry.Mask & 0xFFFF) == 3) { 7896384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 12; 7906384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFFFF) == 0x0000) { 7916384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 10; 7926384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFFFC) == 0x000C) { 7936384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 14; 7946384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFFF0) == 0x0030) { 7956384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 16; 7966384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFFC0) == 0x00C0) { 7976384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 18; 7986384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFF00) == 0x0300) { 7996384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 20; 8006384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFC00) == 0x0C00) { 8016384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 22; 8026384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xF000) == 0x3000) { 8036384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 24; 8046384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xC000) == 0xC000) { 8056384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 26; 8066384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0x30000) == 0x30000) { 8076384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 28; 8086384Sgblack@eecs.umich.edu } else { 8096384Sgblack@eecs.umich.edu fatal("Invalid Mask Pattern Detected!\n"); 8106384Sgblack@eecs.umich.edu } 8116384Sgblack@eecs.umich.edu newEntry.OffsetMask = 8126384Sgblack@eecs.umich.edu (1 << newEntry.AddrShiftAmount) - 1; 8135222Sksewell@umich.edu 8146384Sgblack@eecs.umich.edu MipsISA::TLB *Ptr = xc->tcBase()->getITBPtr(); 8156384Sgblack@eecs.umich.edu Config3Reg config3 = Config3; 8166384Sgblack@eecs.umich.edu PageGrainReg pageGrain = PageGrain; 8176384Sgblack@eecs.umich.edu int SP = 0; 8186384Sgblack@eecs.umich.edu if (bits(config3, config3.sp) == 1 && 8196384Sgblack@eecs.umich.edu bits(pageGrain, pageGrain.esp) == 1) { 8206384Sgblack@eecs.umich.edu SP = 1; 8216384Sgblack@eecs.umich.edu } 8226384Sgblack@eecs.umich.edu IndexReg index = Index; 8236384Sgblack@eecs.umich.edu Ptr->insertAt(newEntry, Index & 0x7FFFFFFF, SP); 8246384Sgblack@eecs.umich.edu }}); 8256384Sgblack@eecs.umich.edu 0x06: tlbwr({{ 8266384Sgblack@eecs.umich.edu //Create PTE 8276384Sgblack@eecs.umich.edu MipsISA::PTE newEntry; 8286384Sgblack@eecs.umich.edu //Write PTE 8296384Sgblack@eecs.umich.edu newEntry.Mask = (Addr)(PageMask >> 11); 8306384Sgblack@eecs.umich.edu newEntry.VPN = (Addr)(EntryHi >> 11); 8316384Sgblack@eecs.umich.edu /* PageGrain _ ESP Config3 _ SP */ 8326384Sgblack@eecs.umich.edu if (bits(PageGrain, 28) == 0 || 8336384Sgblack@eecs.umich.edu bits(Config3, 4) == 0) { 8346384Sgblack@eecs.umich.edu // If 1KB pages are *NOT* enabled, lowest bits of 8356384Sgblack@eecs.umich.edu // the mask are 0b11 for TLB writes 8366384Sgblack@eecs.umich.edu newEntry.Mask |= 0x3; 8376384Sgblack@eecs.umich.edu // Reset bits 0 and 1 if 1KB pages are not enabled 8386384Sgblack@eecs.umich.edu newEntry.VPN &= 0xFFFFFFFC; 8396384Sgblack@eecs.umich.edu } 8406384Sgblack@eecs.umich.edu newEntry.asid = (uint8_t)(EntryHi & 0xFF); 8415222Sksewell@umich.edu 8426384Sgblack@eecs.umich.edu newEntry.PFN0 = (Addr)(EntryLo0 >> 6); 8436384Sgblack@eecs.umich.edu newEntry.PFN1 = (Addr)(EntryLo1 >> 6); 8446384Sgblack@eecs.umich.edu newEntry.D0 = (bool)((EntryLo0 >> 2) & 1); 8456384Sgblack@eecs.umich.edu newEntry.D1 = (bool)((EntryLo1 >> 2) & 1); 8466384Sgblack@eecs.umich.edu newEntry.V1 = (bool)((EntryLo1 >> 1) & 1); 8476384Sgblack@eecs.umich.edu newEntry.V0 = (bool)((EntryLo0 >> 1) & 1); 8486384Sgblack@eecs.umich.edu newEntry.G = (bool)((EntryLo0 & EntryLo1) & 1); 8496384Sgblack@eecs.umich.edu newEntry.C0 = (uint8_t)((EntryLo0 >> 3) & 0x7); 8506384Sgblack@eecs.umich.edu newEntry.C1 = (uint8_t)((EntryLo1 >> 3) & 0x7); 8516384Sgblack@eecs.umich.edu /* Now, compute the AddrShiftAmount and OffsetMask - 8526384Sgblack@eecs.umich.edu TLB optimizations */ 8536384Sgblack@eecs.umich.edu /* Addr Shift Amount for 1KB or larger pages */ 8546384Sgblack@eecs.umich.edu if ((newEntry.Mask & 0xFFFF) == 3){ 8556384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 12; 8566384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFFFF) == 0x0000) { 8576384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 10; 8586384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFFFC) == 0x000C) { 8596384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 14; 8606384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFFF0) == 0x0030) { 8616384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 16; 8626384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFFC0) == 0x00C0) { 8636384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 18; 8646384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFF00) == 0x0300) { 8656384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 20; 8666384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xFC00) == 0x0C00) { 8676384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 22; 8686384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xF000) == 0x3000) { 8696384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 24; 8706384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0xC000) == 0xC000) { 8716384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 26; 8726384Sgblack@eecs.umich.edu } else if ((newEntry.Mask & 0x30000) == 0x30000) { 8736384Sgblack@eecs.umich.edu newEntry.AddrShiftAmount = 28; 8746384Sgblack@eecs.umich.edu } else { 8756384Sgblack@eecs.umich.edu fatal("Invalid Mask Pattern Detected!\n"); 8766384Sgblack@eecs.umich.edu } 8776384Sgblack@eecs.umich.edu newEntry.OffsetMask = 8786384Sgblack@eecs.umich.edu (1 << newEntry.AddrShiftAmount) - 1; 8795222Sksewell@umich.edu 8806384Sgblack@eecs.umich.edu MipsISA::TLB *Ptr = xc->tcBase()->getITBPtr(); 8816384Sgblack@eecs.umich.edu Config3Reg config3 = Config3; 8826384Sgblack@eecs.umich.edu PageGrainReg pageGrain = PageGrain; 8836384Sgblack@eecs.umich.edu int SP = 0; 8846384Sgblack@eecs.umich.edu if (bits(config3, config3.sp) == 1 && 8856384Sgblack@eecs.umich.edu bits(pageGrain, pageGrain.esp) == 1) { 8866384Sgblack@eecs.umich.edu SP = 1; 8876384Sgblack@eecs.umich.edu } 8886384Sgblack@eecs.umich.edu IndexReg index = Index; 8896384Sgblack@eecs.umich.edu Ptr->insertAt(newEntry, Random, SP); 8906384Sgblack@eecs.umich.edu }}); 8912101SN/A 8926384Sgblack@eecs.umich.edu 0x08: tlbp({{ 8936384Sgblack@eecs.umich.edu Config3Reg config3 = Config3; 8946384Sgblack@eecs.umich.edu PageGrainReg pageGrain = PageGrain; 8956384Sgblack@eecs.umich.edu EntryHiReg entryHi = EntryHi; 8966384Sgblack@eecs.umich.edu int tlbIndex; 8976384Sgblack@eecs.umich.edu Addr vpn; 8986384Sgblack@eecs.umich.edu if (pageGrain.esp == 1 && config3.sp ==1) { 8996384Sgblack@eecs.umich.edu vpn = EntryHi >> 11; 9006384Sgblack@eecs.umich.edu } else { 9016384Sgblack@eecs.umich.edu // Mask off lower 2 bits 9026384Sgblack@eecs.umich.edu vpn = ((EntryHi >> 11) & 0xFFFFFFFC); 9036384Sgblack@eecs.umich.edu } 9046384Sgblack@eecs.umich.edu tlbIndex = xc->tcBase()->getITBPtr()-> 9056385Sgblack@eecs.umich.edu probeEntry(vpn, entryHi.asid); 9066384Sgblack@eecs.umich.edu // Check TLB for entry matching EntryHi 9076384Sgblack@eecs.umich.edu if (tlbIndex != -1) { 9086384Sgblack@eecs.umich.edu Index = tlbIndex; 9096384Sgblack@eecs.umich.edu } else { 9106384Sgblack@eecs.umich.edu // else, set Index = 1 << 31 9116384Sgblack@eecs.umich.edu Index = (1 << 31); 9126384Sgblack@eecs.umich.edu } 9136384Sgblack@eecs.umich.edu }}); 9146384Sgblack@eecs.umich.edu } 9156384Sgblack@eecs.umich.edu format CP0Unimpl { 9166384Sgblack@eecs.umich.edu 0x20: wait(); 9176384Sgblack@eecs.umich.edu } 9186384Sgblack@eecs.umich.edu default: CP0Unimpl::unknown(); 9192101SN/A } 9202043SN/A } 9212027SN/A 9222101SN/A //Table A-13 MIPS32 COP1 Encoding of rs Field 9232101SN/A 0x1: decode RS_MSB { 9242101SN/A 0x0: decode RS_HI { 9252101SN/A 0x0: decode RS_LO { 9262686Sksewell@umich.edu format CP1Control { 9272742Sksewell@umich.edu 0x0: mfc1 ({{ Rt.uw = Fs.uw; }}); 9282495SN/A 9292495SN/A 0x2: cfc1({{ 9306384Sgblack@eecs.umich.edu switch (FS) { 9312573SN/A case 0: 9322616SN/A Rt = FIR; 9332573SN/A break; 9342573SN/A case 25: 9356384Sgblack@eecs.umich.edu Rt = (FCSR & 0xFE000000) >> 24 | 9366384Sgblack@eecs.umich.edu (FCSR & 0x00800000) >> 23; 9372573SN/A break; 9382573SN/A case 26: 9396384Sgblack@eecs.umich.edu Rt = (FCSR & 0x0003F07C); 9402573SN/A break; 9412573SN/A case 28: 9426384Sgblack@eecs.umich.edu Rt = (FCSR & 0x00000F80) | 9436384Sgblack@eecs.umich.edu (FCSR & 0x01000000) >> 21 | 9446384Sgblack@eecs.umich.edu (FCSR & 0x00000003); 9452573SN/A break; 9462573SN/A case 31: 9472616SN/A Rt = FCSR; 9482573SN/A break; 9492573SN/A default: 9505222Sksewell@umich.edu warn("FP Control Value (%d) Not Valid"); 9512573SN/A } 9522573SN/A }}); 9532573SN/A 9546384Sgblack@eecs.umich.edu 0x3: mfhc1({{ Rt.uw = Fs.ud<63:32>; }}); 9552686Sksewell@umich.edu 9566384Sgblack@eecs.umich.edu 0x4: mtc1({{ Fs.uw = Rt.uw; }}); 9572686Sksewell@umich.edu 9582573SN/A 0x6: ctc1({{ 9596384Sgblack@eecs.umich.edu switch (FS) { 9602573SN/A case 25: 9616384Sgblack@eecs.umich.edu FCSR = (Rt.uw<7:1> << 25) | // move 31-25 9626384Sgblack@eecs.umich.edu (FCSR & 0x01000000) | // bit 24 9636384Sgblack@eecs.umich.edu (FCSR & 0x004FFFFF); // bit 22-0 9642573SN/A break; 9652573SN/A case 26: 9666384Sgblack@eecs.umich.edu FCSR = (FCSR & 0xFFFC0000) | // move 31-18 9676384Sgblack@eecs.umich.edu Rt.uw<17:12> << 12 | // bit 17-12 9686384Sgblack@eecs.umich.edu (FCSR & 0x00000F80) << 7 | // bit 11-7 9696384Sgblack@eecs.umich.edu Rt.uw<6:2> << 2 | // bit 6-2 9706384Sgblack@eecs.umich.edu (FCSR & 0x00000002); // bit 1-0 9712573SN/A break; 9722573SN/A case 28: 9736384Sgblack@eecs.umich.edu FCSR = (FCSR & 0xFE000000) | // move 31-25 9746384Sgblack@eecs.umich.edu Rt.uw<2:2> << 24 | // bit 24 9756384Sgblack@eecs.umich.edu (FCSR & 0x00FFF000) << 23 | // bit 23-12 9766384Sgblack@eecs.umich.edu Rt.uw<11:7> << 7 | // bit 24 9776384Sgblack@eecs.umich.edu (FCSR & 0x000007E) | 9786384Sgblack@eecs.umich.edu Rt.uw<1:0>; // bit 22-0 9792573SN/A break; 9802573SN/A case 31: 9816384Sgblack@eecs.umich.edu FCSR = Rt.uw; 9822573SN/A break; 9832573SN/A 9842573SN/A default: 9856384Sgblack@eecs.umich.edu panic("FP Control Value (%d) " 9866384Sgblack@eecs.umich.edu "Not Available. Ignoring Access " 9876384Sgblack@eecs.umich.edu "to Floating Control Status " 9886384Sgblack@eecs.umich.edu "Register", FS); 9892495SN/A } 9902495SN/A }}); 9912686Sksewell@umich.edu 9922686Sksewell@umich.edu 0x7: mthc1({{ 9932686Sksewell@umich.edu uint64_t fs_hi = Rt.uw; 9942686Sksewell@umich.edu uint64_t fs_lo = Fs.ud & 0x0FFFFFFFF; 9952686Sksewell@umich.edu Fs.ud = (fs_hi << 32) | fs_lo; 9962686Sksewell@umich.edu }}); 9972686Sksewell@umich.edu 9982101SN/A } 9995222Sksewell@umich.edu format CP1Unimpl { 10005222Sksewell@umich.edu 0x1: dmfc1(); 10015222Sksewell@umich.edu 0x5: dmtc1(); 10025222Sksewell@umich.edu } 10036384Sgblack@eecs.umich.edu } 10042025SN/A 10056384Sgblack@eecs.umich.edu 0x1: decode RS_LO { 10066384Sgblack@eecs.umich.edu 0x0: decode ND { 10076384Sgblack@eecs.umich.edu format Branch { 10086384Sgblack@eecs.umich.edu 0x0: decode TF { 10096384Sgblack@eecs.umich.edu 0x0: bc1f({{ 10106384Sgblack@eecs.umich.edu cond = getCondCode(FCSR, BRANCH_CC) == 0; 10116384Sgblack@eecs.umich.edu }}); 10126384Sgblack@eecs.umich.edu 0x1: bc1t({{ 10136384Sgblack@eecs.umich.edu cond = getCondCode(FCSR, BRANCH_CC) == 1; 10146384Sgblack@eecs.umich.edu }}); 10156384Sgblack@eecs.umich.edu } 10166384Sgblack@eecs.umich.edu 0x1: decode TF { 10176384Sgblack@eecs.umich.edu 0x0: bc1fl({{ 10186384Sgblack@eecs.umich.edu cond = getCondCode(FCSR, BRANCH_CC) == 0; 10196384Sgblack@eecs.umich.edu }}, Likely); 10206384Sgblack@eecs.umich.edu 0x1: bc1tl({{ 10216384Sgblack@eecs.umich.edu cond = getCondCode(FCSR, BRANCH_CC) == 1; 10226384Sgblack@eecs.umich.edu }}, Likely); 10236384Sgblack@eecs.umich.edu } 10246384Sgblack@eecs.umich.edu } 10256384Sgblack@eecs.umich.edu } 10266384Sgblack@eecs.umich.edu format CP1Unimpl { 10276384Sgblack@eecs.umich.edu 0x1: bc1any2(); 10286384Sgblack@eecs.umich.edu 0x2: bc1any4(); 10296384Sgblack@eecs.umich.edu default: unknown(); 10306384Sgblack@eecs.umich.edu } 10316384Sgblack@eecs.umich.edu } 10322043SN/A } 10332027SN/A 10342101SN/A 0x1: decode RS_HI { 10352101SN/A 0x2: decode RS_LO { 10366384Sgblack@eecs.umich.edu //Table A-14 MIPS32 COP1 Encoding of Function Field When 10376384Sgblack@eecs.umich.edu //rs=S (( single-precision floating point)) 10382572SN/A 0x0: decode FUNCTION_HI { 10392572SN/A 0x0: decode FUNCTION_LO { 10402101SN/A format FloatOp { 10416384Sgblack@eecs.umich.edu 0x0: add_s({{ Fd.sf = Fs.sf + Ft.sf; }}); 10426384Sgblack@eecs.umich.edu 0x1: sub_s({{ Fd.sf = Fs.sf - Ft.sf; }}); 10436384Sgblack@eecs.umich.edu 0x2: mul_s({{ Fd.sf = Fs.sf * Ft.sf; }}); 10446384Sgblack@eecs.umich.edu 0x3: div_s({{ Fd.sf = Fs.sf / Ft.sf; }}); 10456384Sgblack@eecs.umich.edu 0x4: sqrt_s({{ Fd.sf = sqrt(Fs.sf); }}); 10466384Sgblack@eecs.umich.edu 0x5: abs_s({{ Fd.sf = fabs(Fs.sf); }}); 10476384Sgblack@eecs.umich.edu 0x7: neg_s({{ Fd.sf = -Fs.sf; }}); 10482101SN/A } 10496384Sgblack@eecs.umich.edu 0x6: BasicOp::mov_s({{ Fd.sf = Fs.sf; }}); 10502101SN/A } 10512572SN/A 0x1: decode FUNCTION_LO { 10522686Sksewell@umich.edu format FloatConvertOp { 10536384Sgblack@eecs.umich.edu 0x0: round_l_s({{ val = Fs.sf; }}, 10546384Sgblack@eecs.umich.edu ToLong, Round); 10556384Sgblack@eecs.umich.edu 0x1: trunc_l_s({{ val = Fs.sf; }}, 10566384Sgblack@eecs.umich.edu ToLong, Trunc); 10576384Sgblack@eecs.umich.edu 0x2: ceil_l_s({{ val = Fs.sf;}}, 10586384Sgblack@eecs.umich.edu ToLong, Ceil); 10596384Sgblack@eecs.umich.edu 0x3: floor_l_s({{ val = Fs.sf; }}, 10606384Sgblack@eecs.umich.edu ToLong, Floor); 10616384Sgblack@eecs.umich.edu 0x4: round_w_s({{ val = Fs.sf; }}, 10626384Sgblack@eecs.umich.edu ToWord, Round); 10636384Sgblack@eecs.umich.edu 0x5: trunc_w_s({{ val = Fs.sf; }}, 10646384Sgblack@eecs.umich.edu ToWord, Trunc); 10656384Sgblack@eecs.umich.edu 0x6: ceil_w_s({{ val = Fs.sf; }}, 10666384Sgblack@eecs.umich.edu ToWord, Ceil); 10676384Sgblack@eecs.umich.edu 0x7: floor_w_s({{ val = Fs.sf; }}, 10686384Sgblack@eecs.umich.edu ToWord, Floor); 10692101SN/A } 10702101SN/A } 10712027SN/A 10722572SN/A 0x2: decode FUNCTION_LO { 10732101SN/A 0x1: decode MOVCF { 10742686Sksewell@umich.edu format BasicOp { 10756384Sgblack@eecs.umich.edu 0x0: movf_s({{ 10766384Sgblack@eecs.umich.edu Fd = (getCondCode(FCSR,CC) == 0) ? 10776384Sgblack@eecs.umich.edu Fs : Fd; 10786384Sgblack@eecs.umich.edu }}); 10796384Sgblack@eecs.umich.edu 0x1: movt_s({{ 10806384Sgblack@eecs.umich.edu Fd = (getCondCode(FCSR,CC) == 1) ? 10816384Sgblack@eecs.umich.edu Fs : Fd; 10826384Sgblack@eecs.umich.edu }}); 10832101SN/A } 10842101SN/A } 10852027SN/A 10862686Sksewell@umich.edu format BasicOp { 10872686Sksewell@umich.edu 0x2: movz_s({{ Fd = (Rt == 0) ? Fs : Fd; }}); 10882686Sksewell@umich.edu 0x3: movn_s({{ Fd = (Rt != 0) ? Fs : Fd; }}); 10892686Sksewell@umich.edu } 10902686Sksewell@umich.edu 10912602SN/A format FloatOp { 10922602SN/A 0x5: recip_s({{ Fd = 1 / Fs; }}); 10936384Sgblack@eecs.umich.edu 0x6: rsqrt_s({{ Fd = 1 / sqrt(Fs); }}); 10942101SN/A } 10955222Sksewell@umich.edu format CP1Unimpl { 10966384Sgblack@eecs.umich.edu default: unknown(); 10975222Sksewell@umich.edu } 10982101SN/A } 10995222Sksewell@umich.edu 0x3: CP1Unimpl::unknown(); 11002027SN/A 11012572SN/A 0x4: decode FUNCTION_LO { 11022603SN/A format FloatConvertOp { 11032686Sksewell@umich.edu 0x1: cvt_d_s({{ val = Fs.sf; }}, ToDouble); 11042686Sksewell@umich.edu 0x4: cvt_w_s({{ val = Fs.sf; }}, ToWord); 11052686Sksewell@umich.edu 0x5: cvt_l_s({{ val = Fs.sf; }}, ToLong); 11062101SN/A } 11072055SN/A 11082686Sksewell@umich.edu 0x6: FloatOp::cvt_ps_s({{ 11096384Sgblack@eecs.umich.edu Fd.ud = (uint64_t) Fs.uw << 32 | 11106384Sgblack@eecs.umich.edu (uint64_t) Ft.uw; 11116384Sgblack@eecs.umich.edu }}); 11125222Sksewell@umich.edu format CP1Unimpl { 11136384Sgblack@eecs.umich.edu default: unknown(); 11145222Sksewell@umich.edu } 11152101SN/A } 11165222Sksewell@umich.edu 0x5: CP1Unimpl::unknown(); 11172602SN/A 11182602SN/A 0x6: decode FUNCTION_LO { 11192603SN/A format FloatCompareOp { 11206384Sgblack@eecs.umich.edu 0x0: c_f_s({{ cond = 0; }}, 11216384Sgblack@eecs.umich.edu SinglePrecision, UnorderedFalse); 11226384Sgblack@eecs.umich.edu 0x1: c_un_s({{ cond = 0; }}, 11236384Sgblack@eecs.umich.edu SinglePrecision, UnorderedTrue); 11242686Sksewell@umich.edu 0x2: c_eq_s({{ cond = (Fs.sf == Ft.sf); }}, 11252686Sksewell@umich.edu UnorderedFalse); 11262686Sksewell@umich.edu 0x3: c_ueq_s({{ cond = (Fs.sf == Ft.sf); }}, 11272686Sksewell@umich.edu UnorderedTrue); 11282686Sksewell@umich.edu 0x4: c_olt_s({{ cond = (Fs.sf < Ft.sf); }}, 11292686Sksewell@umich.edu UnorderedFalse); 11302686Sksewell@umich.edu 0x5: c_ult_s({{ cond = (Fs.sf < Ft.sf); }}, 11312686Sksewell@umich.edu UnorderedTrue); 11322686Sksewell@umich.edu 0x6: c_ole_s({{ cond = (Fs.sf <= Ft.sf); }}, 11332686Sksewell@umich.edu UnorderedFalse); 11342686Sksewell@umich.edu 0x7: c_ule_s({{ cond = (Fs.sf <= Ft.sf); }}, 11352686Sksewell@umich.edu UnorderedTrue); 11362602SN/A } 11372602SN/A } 11382602SN/A 11392602SN/A 0x7: decode FUNCTION_LO { 11402686Sksewell@umich.edu format FloatCompareOp { 11412686Sksewell@umich.edu 0x0: c_sf_s({{ cond = 0; }}, SinglePrecision, 11422686Sksewell@umich.edu UnorderedFalse, QnanException); 11432686Sksewell@umich.edu 0x1: c_ngle_s({{ cond = 0; }}, SinglePrecision, 11442686Sksewell@umich.edu UnorderedTrue, QnanException); 11456384Sgblack@eecs.umich.edu 0x2: c_seq_s({{ cond = (Fs.sf == Ft.sf); }}, 11462686Sksewell@umich.edu UnorderedFalse, QnanException); 11472686Sksewell@umich.edu 0x3: c_ngl_s({{ cond = (Fs.sf == Ft.sf); }}, 11482686Sksewell@umich.edu UnorderedTrue, QnanException); 11492686Sksewell@umich.edu 0x4: c_lt_s({{ cond = (Fs.sf < Ft.sf); }}, 11502686Sksewell@umich.edu UnorderedFalse, QnanException); 11512686Sksewell@umich.edu 0x5: c_nge_s({{ cond = (Fs.sf < Ft.sf); }}, 11522686Sksewell@umich.edu UnorderedTrue, QnanException); 11532686Sksewell@umich.edu 0x6: c_le_s({{ cond = (Fs.sf <= Ft.sf); }}, 11542686Sksewell@umich.edu UnorderedFalse, QnanException); 11552686Sksewell@umich.edu 0x7: c_ngt_s({{ cond = (Fs.sf <= Ft.sf); }}, 11562686Sksewell@umich.edu UnorderedTrue, QnanException); 11572602SN/A } 11582602SN/A } 11592101SN/A } 11602055SN/A 11616384Sgblack@eecs.umich.edu //Table A-15 MIPS32 COP1 Encoding of Function Field When 11626384Sgblack@eecs.umich.edu //rs=D 11632572SN/A 0x1: decode FUNCTION_HI { 11642572SN/A 0x0: decode FUNCTION_LO { 11652101SN/A format FloatOp { 11662686Sksewell@umich.edu 0x0: add_d({{ Fd.df = Fs.df + Ft.df; }}); 11672686Sksewell@umich.edu 0x1: sub_d({{ Fd.df = Fs.df - Ft.df; }}); 11682686Sksewell@umich.edu 0x2: mul_d({{ Fd.df = Fs.df * Ft.df; }}); 11692686Sksewell@umich.edu 0x3: div_d({{ Fd.df = Fs.df / Ft.df; }}); 11706384Sgblack@eecs.umich.edu 0x4: sqrt_d({{ Fd.df = sqrt(Fs.df); }}); 11716384Sgblack@eecs.umich.edu 0x5: abs_d({{ Fd.df = fabs(Fs.df); }}); 11726384Sgblack@eecs.umich.edu 0x7: neg_d({{ Fd.df = -1 * Fs.df; }}); 11732101SN/A } 11746384Sgblack@eecs.umich.edu 0x6: BasicOp::mov_d({{ Fd.df = Fs.df; }}); 11752101SN/A } 11762027SN/A 11772572SN/A 0x1: decode FUNCTION_LO { 11782686Sksewell@umich.edu format FloatConvertOp { 11796384Sgblack@eecs.umich.edu 0x0: round_l_d({{ val = Fs.df; }}, 11806384Sgblack@eecs.umich.edu ToLong, Round); 11816384Sgblack@eecs.umich.edu 0x1: trunc_l_d({{ val = Fs.df; }}, 11826384Sgblack@eecs.umich.edu ToLong, Trunc); 11836384Sgblack@eecs.umich.edu 0x2: ceil_l_d({{ val = Fs.df; }}, 11846384Sgblack@eecs.umich.edu ToLong, Ceil); 11856384Sgblack@eecs.umich.edu 0x3: floor_l_d({{ val = Fs.df; }}, 11866384Sgblack@eecs.umich.edu ToLong, Floor); 11876384Sgblack@eecs.umich.edu 0x4: round_w_d({{ val = Fs.df; }}, 11886384Sgblack@eecs.umich.edu ToWord, Round); 11896384Sgblack@eecs.umich.edu 0x5: trunc_w_d({{ val = Fs.df; }}, 11906384Sgblack@eecs.umich.edu ToWord, Trunc); 11916384Sgblack@eecs.umich.edu 0x6: ceil_w_d({{ val = Fs.df; }}, 11926384Sgblack@eecs.umich.edu ToWord, Ceil); 11936384Sgblack@eecs.umich.edu 0x7: floor_w_d({{ val = Fs.df; }}, 11946384Sgblack@eecs.umich.edu ToWord, Floor); 11952101SN/A } 11962101SN/A } 11972027SN/A 11982572SN/A 0x2: decode FUNCTION_LO { 11992101SN/A 0x1: decode MOVCF { 12002686Sksewell@umich.edu format BasicOp { 12016384Sgblack@eecs.umich.edu 0x0: movf_d({{ 12026384Sgblack@eecs.umich.edu Fd.df = (getCondCode(FCSR,CC) == 0) ? 12032686Sksewell@umich.edu Fs.df : Fd.df; 12046384Sgblack@eecs.umich.edu }}); 12056384Sgblack@eecs.umich.edu 0x1: movt_d({{ 12066384Sgblack@eecs.umich.edu Fd.df = (getCondCode(FCSR,CC) == 1) ? 12072686Sksewell@umich.edu Fs.df : Fd.df; 12086384Sgblack@eecs.umich.edu }}); 12092101SN/A } 12102101SN/A } 12112027SN/A 12122101SN/A format BasicOp { 12136384Sgblack@eecs.umich.edu 0x2: movz_d({{ 12146384Sgblack@eecs.umich.edu Fd.df = (Rt == 0) ? Fs.df : Fd.df; 12156384Sgblack@eecs.umich.edu }}); 12166384Sgblack@eecs.umich.edu 0x3: movn_d({{ 12176384Sgblack@eecs.umich.edu Fd.df = (Rt != 0) ? Fs.df : Fd.df; 12186384Sgblack@eecs.umich.edu }}); 12192101SN/A } 12202027SN/A 12212605SN/A format FloatOp { 12226384Sgblack@eecs.umich.edu 0x5: recip_d({{ Fd.df = 1 / Fs.df; }}); 12236384Sgblack@eecs.umich.edu 0x6: rsqrt_d({{ Fd.df = 1 / sqrt(Fs.df); }}); 12242101SN/A } 12255222Sksewell@umich.edu format CP1Unimpl { 12266384Sgblack@eecs.umich.edu default: unknown(); 12275222Sksewell@umich.edu } 12285222Sksewell@umich.edu 12292101SN/A } 12302572SN/A 0x4: decode FUNCTION_LO { 12312686Sksewell@umich.edu format FloatConvertOp { 12322686Sksewell@umich.edu 0x0: cvt_s_d({{ val = Fs.df; }}, ToSingle); 12332686Sksewell@umich.edu 0x4: cvt_w_d({{ val = Fs.df; }}, ToWord); 12342686Sksewell@umich.edu 0x5: cvt_l_d({{ val = Fs.df; }}, ToLong); 12352101SN/A } 12366384Sgblack@eecs.umich.edu default: CP1Unimpl::unknown(); 12372101SN/A } 12382602SN/A 12392602SN/A 0x6: decode FUNCTION_LO { 12402604SN/A format FloatCompareOp { 12416384Sgblack@eecs.umich.edu 0x0: c_f_d({{ cond = 0; }}, 12426384Sgblack@eecs.umich.edu DoublePrecision, UnorderedFalse); 12436384Sgblack@eecs.umich.edu 0x1: c_un_d({{ cond = 0; }}, 12446384Sgblack@eecs.umich.edu DoublePrecision, UnorderedTrue); 12452686Sksewell@umich.edu 0x2: c_eq_d({{ cond = (Fs.df == Ft.df); }}, 12462686Sksewell@umich.edu UnorderedFalse); 12472686Sksewell@umich.edu 0x3: c_ueq_d({{ cond = (Fs.df == Ft.df); }}, 12482686Sksewell@umich.edu UnorderedTrue); 12492686Sksewell@umich.edu 0x4: c_olt_d({{ cond = (Fs.df < Ft.df); }}, 12502686Sksewell@umich.edu UnorderedFalse); 12512686Sksewell@umich.edu 0x5: c_ult_d({{ cond = (Fs.df < Ft.df); }}, 12522686Sksewell@umich.edu UnorderedTrue); 12532686Sksewell@umich.edu 0x6: c_ole_d({{ cond = (Fs.df <= Ft.df); }}, 12542686Sksewell@umich.edu UnorderedFalse); 12552686Sksewell@umich.edu 0x7: c_ule_d({{ cond = (Fs.df <= Ft.df); }}, 12562686Sksewell@umich.edu UnorderedTrue); 12572602SN/A } 12582602SN/A } 12592602SN/A 12602602SN/A 0x7: decode FUNCTION_LO { 12612686Sksewell@umich.edu format FloatCompareOp { 12622686Sksewell@umich.edu 0x0: c_sf_d({{ cond = 0; }}, DoublePrecision, 12632686Sksewell@umich.edu UnorderedFalse, QnanException); 12642686Sksewell@umich.edu 0x1: c_ngle_d({{ cond = 0; }}, DoublePrecision, 12652686Sksewell@umich.edu UnorderedTrue, QnanException); 12662686Sksewell@umich.edu 0x2: c_seq_d({{ cond = (Fs.df == Ft.df); }}, 12672686Sksewell@umich.edu UnorderedFalse, QnanException); 12682686Sksewell@umich.edu 0x3: c_ngl_d({{ cond = (Fs.df == Ft.df); }}, 12692686Sksewell@umich.edu UnorderedTrue, QnanException); 12702686Sksewell@umich.edu 0x4: c_lt_d({{ cond = (Fs.df < Ft.df); }}, 12712686Sksewell@umich.edu UnorderedFalse, QnanException); 12722686Sksewell@umich.edu 0x5: c_nge_d({{ cond = (Fs.df < Ft.df); }}, 12732686Sksewell@umich.edu UnorderedTrue, QnanException); 12742686Sksewell@umich.edu 0x6: c_le_d({{ cond = (Fs.df <= Ft.df); }}, 12752686Sksewell@umich.edu UnorderedFalse, QnanException); 12762686Sksewell@umich.edu 0x7: c_ngt_d({{ cond = (Fs.df <= Ft.df); }}, 12772686Sksewell@umich.edu UnorderedTrue, QnanException); 12782602SN/A } 12792602SN/A } 12806384Sgblack@eecs.umich.edu default: CP1Unimpl::unknown(); 12812101SN/A } 12825222Sksewell@umich.edu 0x2: CP1Unimpl::unknown(); 12835222Sksewell@umich.edu 0x3: CP1Unimpl::unknown(); 12845222Sksewell@umich.edu 0x7: CP1Unimpl::unknown(); 12852027SN/A 12866384Sgblack@eecs.umich.edu //Table A-16 MIPS32 COP1 Encoding of Function 12876384Sgblack@eecs.umich.edu //Field When rs=W 12882101SN/A 0x4: decode FUNCTION { 12892605SN/A format FloatConvertOp { 12902686Sksewell@umich.edu 0x20: cvt_s_w({{ val = Fs.uw; }}, ToSingle); 12912686Sksewell@umich.edu 0x21: cvt_d_w({{ val = Fs.uw; }}, ToDouble); 12925222Sksewell@umich.edu 0x26: CP1Unimpl::cvt_ps_w(); 12932101SN/A } 12946384Sgblack@eecs.umich.edu default: CP1Unimpl::unknown(); 12952101SN/A } 12962027SN/A 12976384Sgblack@eecs.umich.edu //Table A-16 MIPS32 COP1 Encoding of Function Field 12986384Sgblack@eecs.umich.edu //When rs=L1 12996384Sgblack@eecs.umich.edu //Note: "1. Format type L is legal only if 64-bit 13006384Sgblack@eecs.umich.edu //floating point operations are enabled." 13012101SN/A 0x5: decode FUNCTION_HI { 13022686Sksewell@umich.edu format FloatConvertOp { 13032686Sksewell@umich.edu 0x20: cvt_s_l({{ val = Fs.ud; }}, ToSingle); 13042686Sksewell@umich.edu 0x21: cvt_d_l({{ val = Fs.ud; }}, ToDouble); 13055222Sksewell@umich.edu 0x26: CP1Unimpl::cvt_ps_l(); 13062101SN/A } 13076384Sgblack@eecs.umich.edu default: CP1Unimpl::unknown(); 13082101SN/A } 13092101SN/A 13106384Sgblack@eecs.umich.edu //Table A-17 MIPS64 COP1 Encoding of Function Field 13116384Sgblack@eecs.umich.edu //When rs=PS1 13126384Sgblack@eecs.umich.edu //Note: "1. Format type PS is legal only if 64-bit 13136384Sgblack@eecs.umich.edu //floating point operations are enabled. " 13142572SN/A 0x6: decode FUNCTION_HI { 13152572SN/A 0x0: decode FUNCTION_LO { 13162101SN/A format Float64Op { 13172605SN/A 0x0: add_ps({{ 13182607SN/A Fd1.sf = Fs1.sf + Ft2.sf; 13192607SN/A Fd2.sf = Fs2.sf + Ft2.sf; 13202101SN/A }}); 13212605SN/A 0x1: sub_ps({{ 13222607SN/A Fd1.sf = Fs1.sf - Ft2.sf; 13232607SN/A Fd2.sf = Fs2.sf - Ft2.sf; 13242101SN/A }}); 13252605SN/A 0x2: mul_ps({{ 13262607SN/A Fd1.sf = Fs1.sf * Ft2.sf; 13272607SN/A Fd2.sf = Fs2.sf * Ft2.sf; 13282101SN/A }}); 13292605SN/A 0x5: abs_ps({{ 13302607SN/A Fd1.sf = fabs(Fs1.sf); 13312607SN/A Fd2.sf = fabs(Fs2.sf); 13322101SN/A }}); 13332605SN/A 0x6: mov_ps({{ 13342607SN/A Fd1.sf = Fs1.sf; 13352607SN/A Fd2.sf = Fs2.sf; 13362101SN/A }}); 13372605SN/A 0x7: neg_ps({{ 13382686Sksewell@umich.edu Fd1.sf = -(Fs1.sf); 13392686Sksewell@umich.edu Fd2.sf = -(Fs2.sf); 13402101SN/A }}); 13416384Sgblack@eecs.umich.edu default: CP1Unimpl::unknown(); 13422101SN/A } 13432101SN/A } 13445222Sksewell@umich.edu 0x1: CP1Unimpl::unknown(); 13452572SN/A 0x2: decode FUNCTION_LO { 13462101SN/A 0x1: decode MOVCF { 13472101SN/A format Float64Op { 13482607SN/A 0x0: movf_ps({{ 13492686Sksewell@umich.edu Fd1 = (getCondCode(FCSR, CC) == 0) ? 13502686Sksewell@umich.edu Fs1 : Fd1; 13512686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC+1) == 0) ? 13522686Sksewell@umich.edu Fs2 : Fd2; 13532607SN/A }}); 13542607SN/A 0x1: movt_ps({{ 13552686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC) == 1) ? 13562686Sksewell@umich.edu Fs1 : Fd1; 13572686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC+1) == 1) ? 13582686Sksewell@umich.edu Fs2 : Fd2; 13592607SN/A }}); 13602101SN/A } 13612101SN/A } 13622101SN/A 13632605SN/A format Float64Op { 13642607SN/A 0x2: movz_ps({{ 13652686Sksewell@umich.edu Fd1 = (getCondCode(FCSR, CC) == 0) ? 13662686Sksewell@umich.edu Fs1 : Fd1; 13672686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC) == 0) ? 13682686Sksewell@umich.edu Fs2 : Fd2; 13692607SN/A }}); 13702607SN/A 0x3: movn_ps({{ 13712686Sksewell@umich.edu Fd1 = (getCondCode(FCSR, CC) == 1) ? 13722686Sksewell@umich.edu Fs1 : Fd1; 13732686Sksewell@umich.edu Fd2 = (getCondCode(FCSR, CC) == 1) ? 13742686Sksewell@umich.edu Fs2 : Fd2; 13752607SN/A }}); 13762135SN/A } 13776384Sgblack@eecs.umich.edu default: CP1Unimpl::unknown(); 13782101SN/A } 13795222Sksewell@umich.edu 0x3: CP1Unimpl::unknown(); 13802572SN/A 0x4: decode FUNCTION_LO { 13812686Sksewell@umich.edu 0x0: FloatOp::cvt_s_pu({{ Fd.sf = Fs2.sf; }}); 13825222Sksewell@umich.edu default: CP1Unimpl::unknown(); 13832101SN/A } 13842101SN/A 13852572SN/A 0x5: decode FUNCTION_LO { 13862686Sksewell@umich.edu 0x0: FloatOp::cvt_s_pl({{ Fd.sf = Fs1.sf; }}); 13872101SN/A format Float64Op { 13886384Sgblack@eecs.umich.edu 0x4: pll({{ 13896384Sgblack@eecs.umich.edu Fd.ud = (uint64_t)Fs1.uw << 32 | Ft1.uw; 13906384Sgblack@eecs.umich.edu }}); 13916384Sgblack@eecs.umich.edu 0x5: plu({{ 13926384Sgblack@eecs.umich.edu Fd.ud = (uint64_t)Fs1.uw << 32 | Ft2.uw; 13936384Sgblack@eecs.umich.edu }}); 13946384Sgblack@eecs.umich.edu 0x6: pul({{ 13956384Sgblack@eecs.umich.edu Fd.ud = (uint64_t)Fs2.uw << 32 | Ft1.uw; 13966384Sgblack@eecs.umich.edu }}); 13976384Sgblack@eecs.umich.edu 0x7: puu({{ 13986384Sgblack@eecs.umich.edu Fd.ud = (uint64_t)Fs2.uw << 32 | Ft2.uw; 13996384Sgblack@eecs.umich.edu }}); 14002101SN/A } 14015222Sksewell@umich.edu default: CP1Unimpl::unknown(); 14022101SN/A } 14032602SN/A 14042602SN/A 0x6: decode FUNCTION_LO { 14052608SN/A format FloatPSCompareOp { 14062686Sksewell@umich.edu 0x0: c_f_ps({{ cond1 = 0; }}, {{ cond2 = 0; }}, 14072686Sksewell@umich.edu UnorderedFalse); 14082686Sksewell@umich.edu 0x1: c_un_ps({{ cond1 = 0; }}, {{ cond2 = 0; }}, 14092686Sksewell@umich.edu UnorderedTrue); 14102686Sksewell@umich.edu 0x2: c_eq_ps({{ cond1 = (Fs1.sf == Ft1.sf); }}, 14112686Sksewell@umich.edu {{ cond2 = (Fs2.sf == Ft2.sf); }}, 14122686Sksewell@umich.edu UnorderedFalse); 14132686Sksewell@umich.edu 0x3: c_ueq_ps({{ cond1 = (Fs1.sf == Ft1.sf); }}, 14142686Sksewell@umich.edu {{ cond2 = (Fs2.sf == Ft2.sf); }}, 14152686Sksewell@umich.edu UnorderedTrue); 14162686Sksewell@umich.edu 0x4: c_olt_ps({{ cond1 = (Fs1.sf < Ft1.sf); }}, 14172686Sksewell@umich.edu {{ cond2 = (Fs2.sf < Ft2.sf); }}, 14182686Sksewell@umich.edu UnorderedFalse); 14192686Sksewell@umich.edu 0x5: c_ult_ps({{ cond1 = (Fs.sf < Ft.sf); }}, 14202686Sksewell@umich.edu {{ cond2 = (Fs2.sf < Ft2.sf); }}, 14212686Sksewell@umich.edu UnorderedTrue); 14222686Sksewell@umich.edu 0x6: c_ole_ps({{ cond1 = (Fs.sf <= Ft.sf); }}, 14232686Sksewell@umich.edu {{ cond2 = (Fs2.sf <= Ft2.sf); }}, 14242686Sksewell@umich.edu UnorderedFalse); 14252686Sksewell@umich.edu 0x7: c_ule_ps({{ cond1 = (Fs1.sf <= Ft1.sf); }}, 14262686Sksewell@umich.edu {{ cond2 = (Fs2.sf <= Ft2.sf); }}, 14272686Sksewell@umich.edu UnorderedTrue); 14282602SN/A } 14292602SN/A } 14302602SN/A 14312602SN/A 0x7: decode FUNCTION_LO { 14322686Sksewell@umich.edu format FloatPSCompareOp { 14332686Sksewell@umich.edu 0x0: c_sf_ps({{ cond1 = 0; }}, {{ cond2 = 0; }}, 14342686Sksewell@umich.edu UnorderedFalse, QnanException); 14352686Sksewell@umich.edu 0x1: c_ngle_ps({{ cond1 = 0; }}, 14362686Sksewell@umich.edu {{ cond2 = 0; }}, 14372686Sksewell@umich.edu UnorderedTrue, QnanException); 14382686Sksewell@umich.edu 0x2: c_seq_ps({{ cond1 = (Fs1.sf == Ft1.sf); }}, 14392686Sksewell@umich.edu {{ cond2 = (Fs2.sf == Ft2.sf); }}, 14402686Sksewell@umich.edu UnorderedFalse, QnanException); 14412686Sksewell@umich.edu 0x3: c_ngl_ps({{ cond1 = (Fs1.sf == Ft1.sf); }}, 14422686Sksewell@umich.edu {{ cond2 = (Fs2.sf == Ft2.sf); }}, 14432686Sksewell@umich.edu UnorderedTrue, QnanException); 14442686Sksewell@umich.edu 0x4: c_lt_ps({{ cond1 = (Fs1.sf < Ft1.sf); }}, 14452686Sksewell@umich.edu {{ cond2 = (Fs2.sf < Ft2.sf); }}, 14462686Sksewell@umich.edu UnorderedFalse, QnanException); 14472686Sksewell@umich.edu 0x5: c_nge_ps({{ cond1 = (Fs1.sf < Ft1.sf); }}, 14482686Sksewell@umich.edu {{ cond2 = (Fs2.sf < Ft2.sf); }}, 14492686Sksewell@umich.edu UnorderedTrue, QnanException); 14502686Sksewell@umich.edu 0x6: c_le_ps({{ cond1 = (Fs1.sf <= Ft1.sf); }}, 14512686Sksewell@umich.edu {{ cond2 = (Fs2.sf <= Ft2.sf); }}, 14522686Sksewell@umich.edu UnorderedFalse, QnanException); 14532686Sksewell@umich.edu 0x7: c_ngt_ps({{ cond1 = (Fs1.sf <= Ft1.sf); }}, 14542686Sksewell@umich.edu {{ cond2 = (Fs2.sf <= Ft2.sf); }}, 14552686Sksewell@umich.edu UnorderedTrue, QnanException); 14562602SN/A } 14572602SN/A } 14582101SN/A } 14592101SN/A } 14606384Sgblack@eecs.umich.edu default: CP1Unimpl::unknown(); 14612101SN/A } 14622101SN/A } 14632101SN/A 14642101SN/A //Table A-19 MIPS32 COP2 Encoding of rs Field 14652101SN/A 0x2: decode RS_MSB { 14665222Sksewell@umich.edu format CP2Unimpl { 14672686Sksewell@umich.edu 0x0: decode RS_HI { 14682686Sksewell@umich.edu 0x0: decode RS_LO { 14692101SN/A 0x0: mfc2(); 14702101SN/A 0x2: cfc2(); 14712101SN/A 0x3: mfhc2(); 14722101SN/A 0x4: mtc2(); 14732101SN/A 0x6: ctc2(); 14742101SN/A 0x7: mftc2(); 14756384Sgblack@eecs.umich.edu default: unknown(); 14762101SN/A } 14772101SN/A 14782686Sksewell@umich.edu 0x1: decode ND { 14792686Sksewell@umich.edu 0x0: decode TF { 14802101SN/A 0x0: bc2f(); 14812101SN/A 0x1: bc2t(); 14826384Sgblack@eecs.umich.edu default: unknown(); 14832101SN/A } 14842101SN/A 14852686Sksewell@umich.edu 0x1: decode TF { 14862101SN/A 0x0: bc2fl(); 14872101SN/A 0x1: bc2tl(); 14886384Sgblack@eecs.umich.edu default: unknown(); 14892101SN/A } 14906384Sgblack@eecs.umich.edu default: unknown(); 14915222Sksewell@umich.edu 14926384Sgblack@eecs.umich.edu } 14936384Sgblack@eecs.umich.edu default: unknown(); 14946384Sgblack@eecs.umich.edu } 14956384Sgblack@eecs.umich.edu default: unknown(); 14962101SN/A } 14972101SN/A } 14982101SN/A 14992101SN/A //Table A-20 MIPS64 COP1X Encoding of Function Field 1 15002101SN/A //Note: "COP1X instructions are legal only if 64-bit floating point 15012101SN/A //operations are enabled." 15022101SN/A 0x3: decode FUNCTION_HI { 15032101SN/A 0x0: decode FUNCTION_LO { 15042686Sksewell@umich.edu format LoadIndexedMemory { 15056384Sgblack@eecs.umich.edu 0x0: lwxc1({{ Fd.uw = Mem.uw; }}); 15066384Sgblack@eecs.umich.edu 0x1: ldxc1({{ Fd.ud = Mem.ud; }}); 15076384Sgblack@eecs.umich.edu 0x5: luxc1({{ Fd.ud = Mem.ud; }}, 15082742Sksewell@umich.edu {{ EA = (Rs + Rt) & ~7; }}); 15092101SN/A } 15102043SN/A } 15112027SN/A 15122101SN/A 0x1: decode FUNCTION_LO { 15132686Sksewell@umich.edu format StoreIndexedMemory { 15146384Sgblack@eecs.umich.edu 0x0: swxc1({{ Mem.uw = Fs.uw; }}); 15156384Sgblack@eecs.umich.edu 0x1: sdxc1({{ Mem.ud = Fs.ud; }}); 15166384Sgblack@eecs.umich.edu 0x5: suxc1({{ Mem.ud = Fs.ud; }}, 15172742Sksewell@umich.edu {{ EA = (Rs + Rt) & ~7; }}); 15182046SN/A } 15192686Sksewell@umich.edu 0x7: Prefetch::prefx({{ EA = Rs + Rt; }}); 15202101SN/A } 15212027SN/A 15222686Sksewell@umich.edu 0x3: decode FUNCTION_LO { 15236384Sgblack@eecs.umich.edu 0x6: Float64Op::alnv_ps({{ 15246384Sgblack@eecs.umich.edu if (Rs<2:0> == 0) { 15256384Sgblack@eecs.umich.edu Fd.ud = Fs.ud; 15266384Sgblack@eecs.umich.edu } else if (Rs<2:0> == 4) { 15276384Sgblack@eecs.umich.edu#if BYTE_ORDER == BIG_ENDIAN 15286384Sgblack@eecs.umich.edu Fd.ud = Fs.ud<31:0> << 32 | Ft.ud<63:32>; 15296384Sgblack@eecs.umich.edu#elif BYTE_ORDER == LITTLE_ENDIAN 15306384Sgblack@eecs.umich.edu Fd.ud = Ft.ud<31:0> << 32 | Fs.ud<63:32>; 15316384Sgblack@eecs.umich.edu#endif 15326384Sgblack@eecs.umich.edu } else { 15336384Sgblack@eecs.umich.edu Fd.ud = Fd.ud; 15346384Sgblack@eecs.umich.edu } 15356384Sgblack@eecs.umich.edu }}); 15362686Sksewell@umich.edu } 15372027SN/A 15382686Sksewell@umich.edu format FloatAccOp { 15392686Sksewell@umich.edu 0x4: decode FUNCTION_LO { 15402686Sksewell@umich.edu 0x0: madd_s({{ Fd.sf = (Fs.sf * Ft.sf) + Fr.sf; }}); 15412686Sksewell@umich.edu 0x1: madd_d({{ Fd.df = (Fs.df * Ft.df) + Fr.df; }}); 15422686Sksewell@umich.edu 0x6: madd_ps({{ 15432686Sksewell@umich.edu Fd1.sf = (Fs1.df * Ft1.df) + Fr1.df; 15442686Sksewell@umich.edu Fd2.sf = (Fs2.df * Ft2.df) + Fr2.df; 15452686Sksewell@umich.edu }}); 15462686Sksewell@umich.edu } 15472027SN/A 15482686Sksewell@umich.edu 0x5: decode FUNCTION_LO { 15492686Sksewell@umich.edu 0x0: msub_s({{ Fd.sf = (Fs.sf * Ft.sf) - Fr.sf; }}); 15502686Sksewell@umich.edu 0x1: msub_d({{ Fd.df = (Fs.df * Ft.df) - Fr.df; }}); 15512686Sksewell@umich.edu 0x6: msub_ps({{ 15522686Sksewell@umich.edu Fd1.sf = (Fs1.df * Ft1.df) - Fr1.df; 15532686Sksewell@umich.edu Fd2.sf = (Fs2.df * Ft2.df) - Fr2.df; 15542686Sksewell@umich.edu }}); 15552686Sksewell@umich.edu } 15562027SN/A 15572686Sksewell@umich.edu 0x6: decode FUNCTION_LO { 15582686Sksewell@umich.edu 0x0: nmadd_s({{ Fd.sf = (-1 * Fs.sf * Ft.sf) - Fr.sf; }}); 15592686Sksewell@umich.edu 0x1: nmadd_d({{ Fd.df = (-1 * Fs.df * Ft.df) + Fr.df; }}); 15602686Sksewell@umich.edu 0x6: nmadd_ps({{ 15612686Sksewell@umich.edu Fd1.sf = -((Fs1.df * Ft1.df) + Fr1.df); 15622686Sksewell@umich.edu Fd2.sf = -((Fs2.df * Ft2.df) + Fr2.df); 15632686Sksewell@umich.edu }}); 15642686Sksewell@umich.edu } 15652027SN/A 15662686Sksewell@umich.edu 0x7: decode FUNCTION_LO { 15672686Sksewell@umich.edu 0x0: nmsub_s({{ Fd.sf = (-1 * Fs.sf * Ft.sf) - Fr.sf; }}); 15682686Sksewell@umich.edu 0x1: nmsub_d({{ Fd.df = (-1 * Fs.df * Ft.df) - Fr.df; }}); 15692686Sksewell@umich.edu 0x6: nmsub_ps({{ 15702686Sksewell@umich.edu Fd1.sf = -((Fs1.df * Ft1.df) - Fr1.df); 15712686Sksewell@umich.edu Fd2.sf = -((Fs2.df * Ft2.df) - Fr2.df); 15722686Sksewell@umich.edu }}); 15732046SN/A } 15742101SN/A } 15752043SN/A } 15762025SN/A 15772686Sksewell@umich.edu format Branch { 15782686Sksewell@umich.edu 0x4: beql({{ cond = (Rs.sw == Rt.sw); }}, Likely); 15792686Sksewell@umich.edu 0x5: bnel({{ cond = (Rs.sw != Rt.sw); }}, Likely); 15802686Sksewell@umich.edu 0x6: blezl({{ cond = (Rs.sw <= 0); }}, Likely); 15812686Sksewell@umich.edu 0x7: bgtzl({{ cond = (Rs.sw > 0); }}, Likely); 15822046SN/A } 15832084SN/A } 15842024SN/A 15852686Sksewell@umich.edu 0x3: decode OPCODE_LO { 15862043SN/A //Table A-5 MIPS32 SPECIAL2 Encoding of Function Field 15872043SN/A 0x4: decode FUNCTION_HI { 15882686Sksewell@umich.edu 0x0: decode FUNCTION_LO { 15896384Sgblack@eecs.umich.edu 0x2: IntOp::mul({{ 15906384Sgblack@eecs.umich.edu int64_t temp1 = Rs.sd * Rt.sd; 15916384Sgblack@eecs.umich.edu Rd.sw = temp1<31:0>; 15926384Sgblack@eecs.umich.edu }}, IntMultOp); 15932027SN/A 15944661Sksewell@umich.edu format HiLoRdSelValOp { 15956384Sgblack@eecs.umich.edu 0x0: madd({{ 15966384Sgblack@eecs.umich.edu val = ((int64_t)HI_RD_SEL << 32 | LO_RD_SEL) + 15976384Sgblack@eecs.umich.edu (Rs.sd * Rt.sd); 15986384Sgblack@eecs.umich.edu }}, IntMultOp); 15996384Sgblack@eecs.umich.edu 0x1: maddu({{ 16006384Sgblack@eecs.umich.edu val = ((uint64_t)HI_RD_SEL << 32 | LO_RD_SEL) + 16016384Sgblack@eecs.umich.edu (Rs.ud * Rt.ud); 16026384Sgblack@eecs.umich.edu }}, IntMultOp); 16036384Sgblack@eecs.umich.edu 0x4: msub({{ 16046384Sgblack@eecs.umich.edu val = ((int64_t)HI_RD_SEL << 32 | LO_RD_SEL) - 16056384Sgblack@eecs.umich.edu (Rs.sd * Rt.sd); 16066384Sgblack@eecs.umich.edu }}, IntMultOp); 16076384Sgblack@eecs.umich.edu 0x5: msubu({{ 16086384Sgblack@eecs.umich.edu val = ((uint64_t)HI_RD_SEL << 32 | LO_RD_SEL) - 16096384Sgblack@eecs.umich.edu (Rs.ud * Rt.ud); 16106384Sgblack@eecs.umich.edu }}, IntMultOp); 16112043SN/A } 16122043SN/A } 16132027SN/A 16142043SN/A 0x4: decode FUNCTION_LO { 16152101SN/A format BasicOp { 16166384Sgblack@eecs.umich.edu 0x0: clz({{ 16176384Sgblack@eecs.umich.edu int cnt = 32; 16186384Sgblack@eecs.umich.edu for (int idx = 31; idx >= 0; idx--) { 16196384Sgblack@eecs.umich.edu if (Rs<idx:idx> == 1) { 16206384Sgblack@eecs.umich.edu cnt = 31 - idx; 16216384Sgblack@eecs.umich.edu break; 16226384Sgblack@eecs.umich.edu } 16236384Sgblack@eecs.umich.edu } 16246384Sgblack@eecs.umich.edu Rd.uw = cnt; 16256384Sgblack@eecs.umich.edu }}); 16266384Sgblack@eecs.umich.edu 0x1: clo({{ 16276384Sgblack@eecs.umich.edu int cnt = 32; 16286384Sgblack@eecs.umich.edu for (int idx = 31; idx >= 0; idx--) { 16296384Sgblack@eecs.umich.edu if (Rs<idx:idx> == 0) { 16306384Sgblack@eecs.umich.edu cnt = 31 - idx; 16316384Sgblack@eecs.umich.edu break; 16326384Sgblack@eecs.umich.edu } 16336384Sgblack@eecs.umich.edu } 16346384Sgblack@eecs.umich.edu Rd.uw = cnt; 16356384Sgblack@eecs.umich.edu }}); 16362101SN/A } 16372043SN/A } 16382027SN/A 16392043SN/A 0x7: decode FUNCTION_LO { 16402686Sksewell@umich.edu 0x7: FailUnimpl::sdbbp(); 16412043SN/A } 16422043SN/A } 16432024SN/A 16442686Sksewell@umich.edu //Table A-6 MIPS32 SPECIAL3 Encoding of Function Field for Release 2 16452686Sksewell@umich.edu //of the Architecture 16462043SN/A 0x7: decode FUNCTION_HI { 16472101SN/A 0x0: decode FUNCTION_LO { 16482686Sksewell@umich.edu format BasicOp { 16492742Sksewell@umich.edu 0x0: ext({{ Rt.uw = bits(Rs.uw, MSB+LSB, LSB); }}); 16506384Sgblack@eecs.umich.edu 0x4: ins({{ 16516384Sgblack@eecs.umich.edu Rt.uw = bits(Rt.uw, 31, MSB+1) << (MSB+1) | 16526384Sgblack@eecs.umich.edu bits(Rs.uw, MSB-LSB, 0) << LSB | 16536384Sgblack@eecs.umich.edu bits(Rt.uw, LSB-1, 0); 16546384Sgblack@eecs.umich.edu }}); 16552046SN/A } 16562101SN/A } 16572026SN/A 16582101SN/A 0x1: decode FUNCTION_LO { 16594661Sksewell@umich.edu format MT_Control { 16606384Sgblack@eecs.umich.edu 0x0: fork({{ 16616384Sgblack@eecs.umich.edu forkThread(xc->tcBase(), fault, RD, Rs, Rt); 16626384Sgblack@eecs.umich.edu }}, UserMode); 16636384Sgblack@eecs.umich.edu 0x1: yield({{ 16646384Sgblack@eecs.umich.edu Rd.sw = yieldThread(xc->tcBase(), fault, Rs.sw, 16656384Sgblack@eecs.umich.edu YQMask); 16666384Sgblack@eecs.umich.edu }}, UserMode); 16674661Sksewell@umich.edu } 16684661Sksewell@umich.edu 16694661Sksewell@umich.edu //Table 5-9 MIPS32 LX Encoding of the op Field (DSP ASE MANUAL) 16704661Sksewell@umich.edu 0x2: decode OP_HI { 16714661Sksewell@umich.edu 0x0: decode OP_LO { 16724661Sksewell@umich.edu format LoadIndexedMemory { 16734661Sksewell@umich.edu 0x0: lwx({{ Rd.sw = Mem.sw; }}); 16744661Sksewell@umich.edu 0x4: lhx({{ Rd.sw = Mem.sh; }}); 16754661Sksewell@umich.edu 0x6: lbux({{ Rd.uw = Mem.ub; }}); 16764661Sksewell@umich.edu } 16774661Sksewell@umich.edu } 16784661Sksewell@umich.edu } 16796384Sgblack@eecs.umich.edu 0x4: DspIntOp::insv({{ 16806384Sgblack@eecs.umich.edu int pos = dspctl<5:0>; 16816384Sgblack@eecs.umich.edu int size = dspctl<12:7> - 1; 16826384Sgblack@eecs.umich.edu Rt.uw = insertBits(Rt.uw, pos+size, 16836384Sgblack@eecs.umich.edu pos, Rs.uw<size:0>); 16846384Sgblack@eecs.umich.edu }}); 16854661Sksewell@umich.edu } 16864661Sksewell@umich.edu 16874661Sksewell@umich.edu 0x2: decode FUNCTION_LO { 16884661Sksewell@umich.edu 16896384Sgblack@eecs.umich.edu //Table 5-5 MIPS32 ADDU.QB Encoding of the op Field 16906384Sgblack@eecs.umich.edu //(DSP ASE MANUAL) 16914661Sksewell@umich.edu 0x0: decode OP_HI { 16924661Sksewell@umich.edu 0x0: decode OP_LO { 16934661Sksewell@umich.edu format DspIntOp { 16946384Sgblack@eecs.umich.edu 0x0: addu_qb({{ 16956384Sgblack@eecs.umich.edu Rd.uw = dspAdd(Rs.uw, Rt.uw, SIMD_FMT_QB, 16966384Sgblack@eecs.umich.edu NOSATURATE, UNSIGNED, &dspctl); 16976384Sgblack@eecs.umich.edu }}); 16986384Sgblack@eecs.umich.edu 0x1: subu_qb({{ 16996384Sgblack@eecs.umich.edu Rd.uw = dspSub(Rs.uw, Rt.uw, SIMD_FMT_QB, 17006384Sgblack@eecs.umich.edu NOSATURATE, UNSIGNED, &dspctl); 17016384Sgblack@eecs.umich.edu }}); 17026384Sgblack@eecs.umich.edu 0x4: addu_s_qb({{ 17036384Sgblack@eecs.umich.edu Rd.uw = dspAdd(Rs.uw, Rt.uw, SIMD_FMT_QB, 17046384Sgblack@eecs.umich.edu SATURATE, UNSIGNED, &dspctl); 17056384Sgblack@eecs.umich.edu }}); 17066384Sgblack@eecs.umich.edu 0x5: subu_s_qb({{ 17076384Sgblack@eecs.umich.edu Rd.uw = dspSub(Rs.uw, Rt.uw, SIMD_FMT_QB, 17086384Sgblack@eecs.umich.edu SATURATE, UNSIGNED, &dspctl); 17096384Sgblack@eecs.umich.edu }}); 17106384Sgblack@eecs.umich.edu 0x6: muleu_s_ph_qbl({{ 17116384Sgblack@eecs.umich.edu Rd.uw = dspMuleu(Rs.uw, Rt.uw, 17126384Sgblack@eecs.umich.edu MODE_L, &dspctl); 17136384Sgblack@eecs.umich.edu }}, IntMultOp); 17146384Sgblack@eecs.umich.edu 0x7: muleu_s_ph_qbr({{ 17156384Sgblack@eecs.umich.edu Rd.uw = dspMuleu(Rs.uw, Rt.uw, 17166384Sgblack@eecs.umich.edu MODE_R, &dspctl); 17176384Sgblack@eecs.umich.edu }}, IntMultOp); 17184661Sksewell@umich.edu } 17194661Sksewell@umich.edu } 17204661Sksewell@umich.edu 0x1: decode OP_LO { 17214661Sksewell@umich.edu format DspIntOp { 17226384Sgblack@eecs.umich.edu 0x0: addu_ph({{ 17236384Sgblack@eecs.umich.edu Rd.uw = dspAdd(Rs.uw, Rt.uw, SIMD_FMT_PH, 17246384Sgblack@eecs.umich.edu NOSATURATE, UNSIGNED, &dspctl); 17256384Sgblack@eecs.umich.edu }}); 17266384Sgblack@eecs.umich.edu 0x1: subu_ph({{ 17276384Sgblack@eecs.umich.edu Rd.uw = dspSub(Rs.uw, Rt.uw, SIMD_FMT_PH, 17286384Sgblack@eecs.umich.edu NOSATURATE, UNSIGNED, &dspctl); 17296384Sgblack@eecs.umich.edu }}); 17306384Sgblack@eecs.umich.edu 0x2: addq_ph({{ 17316384Sgblack@eecs.umich.edu Rd.uw = dspAdd(Rs.uw, Rt.uw, SIMD_FMT_PH, 17326384Sgblack@eecs.umich.edu NOSATURATE, SIGNED, &dspctl); 17336384Sgblack@eecs.umich.edu }}); 17346384Sgblack@eecs.umich.edu 0x3: subq_ph({{ 17356384Sgblack@eecs.umich.edu Rd.uw = dspSub(Rs.uw, Rt.uw, SIMD_FMT_PH, 17366384Sgblack@eecs.umich.edu NOSATURATE, SIGNED, &dspctl); 17376384Sgblack@eecs.umich.edu }}); 17386384Sgblack@eecs.umich.edu 0x4: addu_s_ph({{ 17396384Sgblack@eecs.umich.edu Rd.uw = dspAdd(Rs.uw, Rt.uw, SIMD_FMT_PH, 17406384Sgblack@eecs.umich.edu SATURATE, UNSIGNED, &dspctl); 17416384Sgblack@eecs.umich.edu }}); 17426384Sgblack@eecs.umich.edu 0x5: subu_s_ph({{ 17436384Sgblack@eecs.umich.edu Rd.uw = dspSub(Rs.uw, Rt.uw, SIMD_FMT_PH, 17446384Sgblack@eecs.umich.edu SATURATE, UNSIGNED, &dspctl); 17456384Sgblack@eecs.umich.edu }}); 17466384Sgblack@eecs.umich.edu 0x6: addq_s_ph({{ 17476384Sgblack@eecs.umich.edu Rd.uw = dspAdd(Rs.uw, Rt.uw, SIMD_FMT_PH, 17486384Sgblack@eecs.umich.edu SATURATE, SIGNED, &dspctl); 17496384Sgblack@eecs.umich.edu }}); 17506384Sgblack@eecs.umich.edu 0x7: subq_s_ph({{ 17516384Sgblack@eecs.umich.edu Rd.uw = dspSub(Rs.uw, Rt.uw, SIMD_FMT_PH, 17526384Sgblack@eecs.umich.edu SATURATE, SIGNED, &dspctl); 17536384Sgblack@eecs.umich.edu }}); 17544661Sksewell@umich.edu } 17554661Sksewell@umich.edu } 17564661Sksewell@umich.edu 0x2: decode OP_LO { 17574661Sksewell@umich.edu format DspIntOp { 17586384Sgblack@eecs.umich.edu 0x0: addsc({{ 17596384Sgblack@eecs.umich.edu int64_t dresult; 17606384Sgblack@eecs.umich.edu dresult = Rs.ud + Rt.ud; 17616384Sgblack@eecs.umich.edu Rd.sw = dresult<31:0>; 17626384Sgblack@eecs.umich.edu dspctl = insertBits(dspctl, 13, 13, 17636384Sgblack@eecs.umich.edu dresult<32:32>); 17646384Sgblack@eecs.umich.edu }}); 17656384Sgblack@eecs.umich.edu 0x1: addwc({{ 17666384Sgblack@eecs.umich.edu int64_t dresult; 17676384Sgblack@eecs.umich.edu dresult = Rs.sd + Rt.sd + dspctl<13:13>; 17686384Sgblack@eecs.umich.edu Rd.sw = dresult<31:0>; 17696384Sgblack@eecs.umich.edu if (dresult<32:32> != dresult<31:31>) 17706384Sgblack@eecs.umich.edu dspctl = insertBits(dspctl, 20, 20, 1); 17716384Sgblack@eecs.umich.edu }}); 17726384Sgblack@eecs.umich.edu 0x2: modsub({{ 17736384Sgblack@eecs.umich.edu Rd.sw = (Rs.sw == 0) ? Rt.sw<23:8> : 17746384Sgblack@eecs.umich.edu Rs.sw - Rt.sw<7:0>; 17756384Sgblack@eecs.umich.edu }}); 17766384Sgblack@eecs.umich.edu 0x4: raddu_w_qb({{ 17776384Sgblack@eecs.umich.edu Rd.uw = Rs.uw<31:24> + Rs.uw<23:16> + 17786384Sgblack@eecs.umich.edu Rs.uw<15:8> + Rs.uw<7:0>; 17796384Sgblack@eecs.umich.edu }}); 17806384Sgblack@eecs.umich.edu 0x6: addq_s_w({{ 17816384Sgblack@eecs.umich.edu Rd.sw = dspAdd(Rs.sw, Rt.sw, SIMD_FMT_W, 17826384Sgblack@eecs.umich.edu SATURATE, SIGNED, &dspctl); 17836384Sgblack@eecs.umich.edu }}); 17846384Sgblack@eecs.umich.edu 0x7: subq_s_w({{ 17856384Sgblack@eecs.umich.edu Rd.sw = dspSub(Rs.sw, Rt.sw, SIMD_FMT_W, 17866384Sgblack@eecs.umich.edu SATURATE, SIGNED, &dspctl); 17876384Sgblack@eecs.umich.edu }}); 17884661Sksewell@umich.edu } 17894661Sksewell@umich.edu } 17904661Sksewell@umich.edu 0x3: decode OP_LO { 17914661Sksewell@umich.edu format DspIntOp { 17926384Sgblack@eecs.umich.edu 0x4: muleq_s_w_phl({{ 17936384Sgblack@eecs.umich.edu Rd.sw = dspMuleq(Rs.sw, Rt.sw, 17946384Sgblack@eecs.umich.edu MODE_L, &dspctl); 17956384Sgblack@eecs.umich.edu }}, IntMultOp); 17966384Sgblack@eecs.umich.edu 0x5: muleq_s_w_phr({{ 17976384Sgblack@eecs.umich.edu Rd.sw = dspMuleq(Rs.sw, Rt.sw, 17986384Sgblack@eecs.umich.edu MODE_R, &dspctl); 17996384Sgblack@eecs.umich.edu }}, IntMultOp); 18006384Sgblack@eecs.umich.edu 0x6: mulq_s_ph({{ 18016384Sgblack@eecs.umich.edu Rd.sw = dspMulq(Rs.sw, Rt.sw, SIMD_FMT_PH, 18026384Sgblack@eecs.umich.edu SATURATE, NOROUND, &dspctl); 18036384Sgblack@eecs.umich.edu }}, IntMultOp); 18046384Sgblack@eecs.umich.edu 0x7: mulq_rs_ph({{ 18056384Sgblack@eecs.umich.edu Rd.sw = dspMulq(Rs.sw, Rt.sw, SIMD_FMT_PH, 18066384Sgblack@eecs.umich.edu SATURATE, ROUND, &dspctl); 18076384Sgblack@eecs.umich.edu }}, IntMultOp); 18084661Sksewell@umich.edu } 18094661Sksewell@umich.edu } 18104661Sksewell@umich.edu } 18114661Sksewell@umich.edu 18126384Sgblack@eecs.umich.edu //Table 5-6 MIPS32 CMPU_EQ_QB Encoding of the op Field 18136384Sgblack@eecs.umich.edu //(DSP ASE MANUAL) 18144661Sksewell@umich.edu 0x1: decode OP_HI { 18154661Sksewell@umich.edu 0x0: decode OP_LO { 18164661Sksewell@umich.edu format DspIntOp { 18176384Sgblack@eecs.umich.edu 0x0: cmpu_eq_qb({{ 18186384Sgblack@eecs.umich.edu dspCmp(Rs.uw, Rt.uw, SIMD_FMT_QB, 18196384Sgblack@eecs.umich.edu UNSIGNED, CMP_EQ, &dspctl); 18206384Sgblack@eecs.umich.edu }}); 18216384Sgblack@eecs.umich.edu 0x1: cmpu_lt_qb({{ 18226384Sgblack@eecs.umich.edu dspCmp(Rs.uw, Rt.uw, SIMD_FMT_QB, 18236384Sgblack@eecs.umich.edu UNSIGNED, CMP_LT, &dspctl); 18246384Sgblack@eecs.umich.edu }}); 18256384Sgblack@eecs.umich.edu 0x2: cmpu_le_qb({{ 18266384Sgblack@eecs.umich.edu dspCmp(Rs.uw, Rt.uw, SIMD_FMT_QB, 18276384Sgblack@eecs.umich.edu UNSIGNED, CMP_LE, &dspctl); 18286384Sgblack@eecs.umich.edu }}); 18296384Sgblack@eecs.umich.edu 0x3: pick_qb({{ 18306384Sgblack@eecs.umich.edu Rd.uw = dspPick(Rs.uw, Rt.uw, 18316384Sgblack@eecs.umich.edu SIMD_FMT_QB, &dspctl); 18326384Sgblack@eecs.umich.edu }}); 18336384Sgblack@eecs.umich.edu 0x4: cmpgu_eq_qb({{ 18346384Sgblack@eecs.umich.edu Rd.uw = dspCmpg(Rs.uw, Rt.uw, SIMD_FMT_QB, 18356384Sgblack@eecs.umich.edu UNSIGNED, CMP_EQ ); 18366384Sgblack@eecs.umich.edu }}); 18376384Sgblack@eecs.umich.edu 0x5: cmpgu_lt_qb({{ 18386384Sgblack@eecs.umich.edu Rd.uw = dspCmpg(Rs.uw, Rt.uw, SIMD_FMT_QB, 18396384Sgblack@eecs.umich.edu UNSIGNED, CMP_LT); 18406384Sgblack@eecs.umich.edu }}); 18416384Sgblack@eecs.umich.edu 0x6: cmpgu_le_qb({{ 18426384Sgblack@eecs.umich.edu Rd.uw = dspCmpg(Rs.uw, Rt.uw, SIMD_FMT_QB, 18436384Sgblack@eecs.umich.edu UNSIGNED, CMP_LE); 18446384Sgblack@eecs.umich.edu }}); 18454661Sksewell@umich.edu } 18464661Sksewell@umich.edu } 18474661Sksewell@umich.edu 0x1: decode OP_LO { 18484661Sksewell@umich.edu format DspIntOp { 18496384Sgblack@eecs.umich.edu 0x0: cmp_eq_ph({{ 18506384Sgblack@eecs.umich.edu dspCmp(Rs.uw, Rt.uw, SIMD_FMT_PH, 18516384Sgblack@eecs.umich.edu SIGNED, CMP_EQ, &dspctl); 18526384Sgblack@eecs.umich.edu }}); 18536384Sgblack@eecs.umich.edu 0x1: cmp_lt_ph({{ 18546384Sgblack@eecs.umich.edu dspCmp(Rs.uw, Rt.uw, SIMD_FMT_PH, 18556384Sgblack@eecs.umich.edu SIGNED, CMP_LT, &dspctl); 18566384Sgblack@eecs.umich.edu }}); 18576384Sgblack@eecs.umich.edu 0x2: cmp_le_ph({{ 18586384Sgblack@eecs.umich.edu dspCmp(Rs.uw, Rt.uw, SIMD_FMT_PH, 18596384Sgblack@eecs.umich.edu SIGNED, CMP_LE, &dspctl); 18606384Sgblack@eecs.umich.edu }}); 18616384Sgblack@eecs.umich.edu 0x3: pick_ph({{ 18626384Sgblack@eecs.umich.edu Rd.uw = dspPick(Rs.uw, Rt.uw, 18636384Sgblack@eecs.umich.edu SIMD_FMT_PH, &dspctl); 18646384Sgblack@eecs.umich.edu }}); 18656384Sgblack@eecs.umich.edu 0x4: precrq_qb_ph({{ 18666384Sgblack@eecs.umich.edu Rd.uw = Rs.uw<31:24> << 24 | 18676384Sgblack@eecs.umich.edu Rs.uw<15:8> << 16 | 18686384Sgblack@eecs.umich.edu Rt.uw<31:24> << 8 | 18696384Sgblack@eecs.umich.edu Rt.uw<15:8>; 18706384Sgblack@eecs.umich.edu }}); 18716384Sgblack@eecs.umich.edu 0x5: precr_qb_ph({{ 18726384Sgblack@eecs.umich.edu Rd.uw = Rs.uw<23:16> << 24 | 18736384Sgblack@eecs.umich.edu Rs.uw<7:0> << 16 | 18746384Sgblack@eecs.umich.edu Rt.uw<23:16> << 8 | 18756384Sgblack@eecs.umich.edu Rt.uw<7:0>; 18766384Sgblack@eecs.umich.edu }}); 18776384Sgblack@eecs.umich.edu 0x6: packrl_ph({{ 18786384Sgblack@eecs.umich.edu Rd.uw = dspPack(Rs.uw, Rt.uw, SIMD_FMT_PH); 18796384Sgblack@eecs.umich.edu }}); 18806384Sgblack@eecs.umich.edu 0x7: precrqu_s_qb_ph({{ 18816384Sgblack@eecs.umich.edu Rd.uw = dspPrecrqu(Rs.uw, Rt.uw, &dspctl); 18826384Sgblack@eecs.umich.edu }}); 18834661Sksewell@umich.edu } 18844661Sksewell@umich.edu } 18854661Sksewell@umich.edu 0x2: decode OP_LO { 18864661Sksewell@umich.edu format DspIntOp { 18876384Sgblack@eecs.umich.edu 0x4: precrq_ph_w({{ 18886384Sgblack@eecs.umich.edu Rd.uw = Rs.uw<31:16> << 16 | Rt.uw<31:16>; 18896384Sgblack@eecs.umich.edu }}); 18906384Sgblack@eecs.umich.edu 0x5: precrq_rs_ph_w({{ 18916384Sgblack@eecs.umich.edu Rd.uw = dspPrecrq(Rs.uw, Rt.uw, 18926384Sgblack@eecs.umich.edu SIMD_FMT_W, &dspctl); 18936384Sgblack@eecs.umich.edu }}); 18944661Sksewell@umich.edu } 18954661Sksewell@umich.edu } 18964661Sksewell@umich.edu 0x3: decode OP_LO { 18974661Sksewell@umich.edu format DspIntOp { 18986384Sgblack@eecs.umich.edu 0x0: cmpgdu_eq_qb({{ 18996384Sgblack@eecs.umich.edu Rd.uw = dspCmpgd(Rs.uw, Rt.uw, SIMD_FMT_QB, 19006384Sgblack@eecs.umich.edu UNSIGNED, CMP_EQ, &dspctl); 19016384Sgblack@eecs.umich.edu }}); 19026384Sgblack@eecs.umich.edu 0x1: cmpgdu_lt_qb({{ 19036384Sgblack@eecs.umich.edu Rd.uw = dspCmpgd(Rs.uw, Rt.uw, SIMD_FMT_QB, 19046384Sgblack@eecs.umich.edu UNSIGNED, CMP_LT, &dspctl); 19056384Sgblack@eecs.umich.edu }}); 19066384Sgblack@eecs.umich.edu 0x2: cmpgdu_le_qb({{ 19076384Sgblack@eecs.umich.edu Rd.uw = dspCmpgd(Rs.uw, Rt.uw, SIMD_FMT_QB, 19086384Sgblack@eecs.umich.edu UNSIGNED, CMP_LE, &dspctl); 19096384Sgblack@eecs.umich.edu }}); 19106384Sgblack@eecs.umich.edu 0x6: precr_sra_ph_w({{ 19116384Sgblack@eecs.umich.edu Rt.uw = dspPrecrSra(Rt.uw, Rs.uw, RD, 19126384Sgblack@eecs.umich.edu SIMD_FMT_W, NOROUND); 19136384Sgblack@eecs.umich.edu }}); 19146384Sgblack@eecs.umich.edu 0x7: precr_sra_r_ph_w({{ 19156384Sgblack@eecs.umich.edu Rt.uw = dspPrecrSra(Rt.uw, Rs.uw, RD, 19166384Sgblack@eecs.umich.edu SIMD_FMT_W, ROUND); 19176384Sgblack@eecs.umich.edu }}); 19184661Sksewell@umich.edu } 19194661Sksewell@umich.edu } 19204661Sksewell@umich.edu } 19214661Sksewell@umich.edu 19226384Sgblack@eecs.umich.edu //Table 5-7 MIPS32 ABSQ_S.PH Encoding of the op Field 19236384Sgblack@eecs.umich.edu //(DSP ASE MANUAL) 19244661Sksewell@umich.edu 0x2: decode OP_HI { 19254661Sksewell@umich.edu 0x0: decode OP_LO { 19264661Sksewell@umich.edu format DspIntOp { 19276384Sgblack@eecs.umich.edu 0x1: absq_s_qb({{ 19286384Sgblack@eecs.umich.edu Rd.sw = dspAbs(Rt.sw, SIMD_FMT_QB, &dspctl); 19296384Sgblack@eecs.umich.edu }}); 19306384Sgblack@eecs.umich.edu 0x2: repl_qb({{ 19316384Sgblack@eecs.umich.edu Rd.uw = RS_RT<7:0> << 24 | 19326384Sgblack@eecs.umich.edu RS_RT<7:0> << 16 | 19336384Sgblack@eecs.umich.edu RS_RT<7:0> << 8 | 19346384Sgblack@eecs.umich.edu RS_RT<7:0>; 19356384Sgblack@eecs.umich.edu }}); 19366384Sgblack@eecs.umich.edu 0x3: replv_qb({{ 19376384Sgblack@eecs.umich.edu Rd.sw = Rt.uw<7:0> << 24 | 19386384Sgblack@eecs.umich.edu Rt.uw<7:0> << 16 | 19396384Sgblack@eecs.umich.edu Rt.uw<7:0> << 8 | 19406384Sgblack@eecs.umich.edu Rt.uw<7:0>; 19416384Sgblack@eecs.umich.edu }}); 19426384Sgblack@eecs.umich.edu 0x4: precequ_ph_qbl({{ 19436384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_QB, UNSIGNED, 19446384Sgblack@eecs.umich.edu SIMD_FMT_PH, SIGNED, MODE_L); 19456384Sgblack@eecs.umich.edu }}); 19466384Sgblack@eecs.umich.edu 0x5: precequ_ph_qbr({{ 19476384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_QB, UNSIGNED, 19486384Sgblack@eecs.umich.edu SIMD_FMT_PH, SIGNED, MODE_R); 19496384Sgblack@eecs.umich.edu }}); 19506384Sgblack@eecs.umich.edu 0x6: precequ_ph_qbla({{ 19516384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_QB, UNSIGNED, 19526384Sgblack@eecs.umich.edu SIMD_FMT_PH, SIGNED, MODE_LA); 19536384Sgblack@eecs.umich.edu }}); 19546384Sgblack@eecs.umich.edu 0x7: precequ_ph_qbra({{ 19556384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_QB, UNSIGNED, 19566384Sgblack@eecs.umich.edu SIMD_FMT_PH, SIGNED, MODE_RA); 19576384Sgblack@eecs.umich.edu }}); 19584661Sksewell@umich.edu } 19594661Sksewell@umich.edu } 19604661Sksewell@umich.edu 0x1: decode OP_LO { 19614661Sksewell@umich.edu format DspIntOp { 19626384Sgblack@eecs.umich.edu 0x1: absq_s_ph({{ 19636384Sgblack@eecs.umich.edu Rd.sw = dspAbs(Rt.sw, SIMD_FMT_PH, &dspctl); 19646384Sgblack@eecs.umich.edu }}); 19656384Sgblack@eecs.umich.edu 0x2: repl_ph({{ 19666384Sgblack@eecs.umich.edu Rd.uw = (sext<10>(RS_RT))<15:0> << 16 | 19676384Sgblack@eecs.umich.edu (sext<10>(RS_RT))<15:0>; 19686384Sgblack@eecs.umich.edu }}); 19696384Sgblack@eecs.umich.edu 0x3: replv_ph({{ 19706384Sgblack@eecs.umich.edu Rd.uw = Rt.uw<15:0> << 16 | 19716384Sgblack@eecs.umich.edu Rt.uw<15:0>; 19726384Sgblack@eecs.umich.edu }}); 19736384Sgblack@eecs.umich.edu 0x4: preceq_w_phl({{ 19746384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_PH, SIGNED, 19756384Sgblack@eecs.umich.edu SIMD_FMT_W, SIGNED, MODE_L); 19766384Sgblack@eecs.umich.edu }}); 19776384Sgblack@eecs.umich.edu 0x5: preceq_w_phr({{ 19786384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_PH, SIGNED, 19796384Sgblack@eecs.umich.edu SIMD_FMT_W, SIGNED, MODE_R); 19806384Sgblack@eecs.umich.edu }}); 19814661Sksewell@umich.edu } 19824661Sksewell@umich.edu } 19834661Sksewell@umich.edu 0x2: decode OP_LO { 19844661Sksewell@umich.edu format DspIntOp { 19856384Sgblack@eecs.umich.edu 0x1: absq_s_w({{ 19866384Sgblack@eecs.umich.edu Rd.sw = dspAbs(Rt.sw, SIMD_FMT_W, &dspctl); 19876384Sgblack@eecs.umich.edu }}); 19884661Sksewell@umich.edu } 19894661Sksewell@umich.edu } 19904661Sksewell@umich.edu 0x3: decode OP_LO { 19916384Sgblack@eecs.umich.edu 0x3: IntOp::bitrev({{ 19926384Sgblack@eecs.umich.edu Rd.uw = bitrev( Rt.uw<15:0> ); 19936384Sgblack@eecs.umich.edu }}); 19944661Sksewell@umich.edu format DspIntOp { 19956384Sgblack@eecs.umich.edu 0x4: preceu_ph_qbl({{ 19966384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_QB, 19976384Sgblack@eecs.umich.edu UNSIGNED, SIMD_FMT_PH, 19986384Sgblack@eecs.umich.edu UNSIGNED, MODE_L); 19996384Sgblack@eecs.umich.edu }}); 20006384Sgblack@eecs.umich.edu 0x5: preceu_ph_qbr({{ 20016384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_QB, 20026384Sgblack@eecs.umich.edu UNSIGNED, SIMD_FMT_PH, 20036384Sgblack@eecs.umich.edu UNSIGNED, MODE_R ); 20046384Sgblack@eecs.umich.edu }}); 20056384Sgblack@eecs.umich.edu 0x6: preceu_ph_qbla({{ 20066384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_QB, 20076384Sgblack@eecs.umich.edu UNSIGNED, SIMD_FMT_PH, 20086384Sgblack@eecs.umich.edu UNSIGNED, MODE_LA ); 20096384Sgblack@eecs.umich.edu }}); 20106384Sgblack@eecs.umich.edu 0x7: preceu_ph_qbra({{ 20116384Sgblack@eecs.umich.edu Rd.uw = dspPrece(Rt.uw, SIMD_FMT_QB, 20126384Sgblack@eecs.umich.edu UNSIGNED, SIMD_FMT_PH, 20136384Sgblack@eecs.umich.edu UNSIGNED, MODE_RA); 20146384Sgblack@eecs.umich.edu }}); 20154661Sksewell@umich.edu } 20164661Sksewell@umich.edu } 20174661Sksewell@umich.edu } 20184661Sksewell@umich.edu 20196384Sgblack@eecs.umich.edu //Table 5-8 MIPS32 SHLL.QB Encoding of the op Field 20206384Sgblack@eecs.umich.edu //(DSP ASE MANUAL) 20214661Sksewell@umich.edu 0x3: decode OP_HI { 20224661Sksewell@umich.edu 0x0: decode OP_LO { 20234661Sksewell@umich.edu format DspIntOp { 20246384Sgblack@eecs.umich.edu 0x0: shll_qb({{ 20256384Sgblack@eecs.umich.edu Rd.sw = dspShll(Rt.sw, RS, SIMD_FMT_QB, 20266384Sgblack@eecs.umich.edu NOSATURATE, UNSIGNED, &dspctl); 20276384Sgblack@eecs.umich.edu }}); 20286384Sgblack@eecs.umich.edu 0x1: shrl_qb({{ 20296384Sgblack@eecs.umich.edu Rd.sw = dspShrl(Rt.sw, RS, SIMD_FMT_QB, 20306384Sgblack@eecs.umich.edu UNSIGNED); 20316384Sgblack@eecs.umich.edu }}); 20326384Sgblack@eecs.umich.edu 0x2: shllv_qb({{ 20336384Sgblack@eecs.umich.edu Rd.sw = dspShll(Rt.sw, Rs.sw, SIMD_FMT_QB, 20346384Sgblack@eecs.umich.edu NOSATURATE, UNSIGNED, &dspctl); 20356384Sgblack@eecs.umich.edu }}); 20366384Sgblack@eecs.umich.edu 0x3: shrlv_qb({{ 20376384Sgblack@eecs.umich.edu Rd.sw = dspShrl(Rt.sw, Rs.sw, SIMD_FMT_QB, 20386384Sgblack@eecs.umich.edu UNSIGNED); 20396384Sgblack@eecs.umich.edu }}); 20406384Sgblack@eecs.umich.edu 0x4: shra_qb({{ 20416384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, RS, SIMD_FMT_QB, 20426384Sgblack@eecs.umich.edu NOROUND, SIGNED, &dspctl); 20436384Sgblack@eecs.umich.edu }}); 20446384Sgblack@eecs.umich.edu 0x5: shra_r_qb({{ 20456384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, RS, SIMD_FMT_QB, 20466384Sgblack@eecs.umich.edu ROUND, SIGNED, &dspctl); 20476384Sgblack@eecs.umich.edu }}); 20486384Sgblack@eecs.umich.edu 0x6: shrav_qb({{ 20496384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, Rs.sw, SIMD_FMT_QB, 20506384Sgblack@eecs.umich.edu NOROUND, SIGNED, &dspctl); 20516384Sgblack@eecs.umich.edu }}); 20526384Sgblack@eecs.umich.edu 0x7: shrav_r_qb({{ 20536384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, Rs.sw, SIMD_FMT_QB, 20546384Sgblack@eecs.umich.edu ROUND, SIGNED, &dspctl); 20556384Sgblack@eecs.umich.edu }}); 20564661Sksewell@umich.edu } 20574661Sksewell@umich.edu } 20584661Sksewell@umich.edu 0x1: decode OP_LO { 20594661Sksewell@umich.edu format DspIntOp { 20606384Sgblack@eecs.umich.edu 0x0: shll_ph({{ 20616384Sgblack@eecs.umich.edu Rd.uw = dspShll(Rt.uw, RS, SIMD_FMT_PH, 20626384Sgblack@eecs.umich.edu NOSATURATE, SIGNED, &dspctl); 20636384Sgblack@eecs.umich.edu }}); 20646384Sgblack@eecs.umich.edu 0x1: shra_ph({{ 20656384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, RS, SIMD_FMT_PH, 20666384Sgblack@eecs.umich.edu NOROUND, SIGNED, &dspctl); 20676384Sgblack@eecs.umich.edu }}); 20686384Sgblack@eecs.umich.edu 0x2: shllv_ph({{ 20696384Sgblack@eecs.umich.edu Rd.sw = dspShll(Rt.sw, Rs.sw, SIMD_FMT_PH, 20706384Sgblack@eecs.umich.edu NOSATURATE, SIGNED, &dspctl); 20716384Sgblack@eecs.umich.edu }}); 20726384Sgblack@eecs.umich.edu 0x3: shrav_ph({{ 20736384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, Rs.sw, SIMD_FMT_PH, 20746384Sgblack@eecs.umich.edu NOROUND, SIGNED, &dspctl); 20756384Sgblack@eecs.umich.edu }}); 20766384Sgblack@eecs.umich.edu 0x4: shll_s_ph({{ 20776384Sgblack@eecs.umich.edu Rd.sw = dspShll(Rt.sw, RS, SIMD_FMT_PH, 20786384Sgblack@eecs.umich.edu SATURATE, SIGNED, &dspctl); 20796384Sgblack@eecs.umich.edu }}); 20806384Sgblack@eecs.umich.edu 0x5: shra_r_ph({{ 20816384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, RS, SIMD_FMT_PH, 20826384Sgblack@eecs.umich.edu ROUND, SIGNED, &dspctl); 20836384Sgblack@eecs.umich.edu }}); 20846384Sgblack@eecs.umich.edu 0x6: shllv_s_ph({{ 20856384Sgblack@eecs.umich.edu Rd.sw = dspShll(Rt.sw, Rs.sw, SIMD_FMT_PH, 20866384Sgblack@eecs.umich.edu SATURATE, SIGNED, &dspctl); 20876384Sgblack@eecs.umich.edu }}); 20886384Sgblack@eecs.umich.edu 0x7: shrav_r_ph({{ 20896384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, Rs.sw, SIMD_FMT_PH, 20906384Sgblack@eecs.umich.edu ROUND, SIGNED, &dspctl); 20916384Sgblack@eecs.umich.edu }}); 20924661Sksewell@umich.edu } 20934661Sksewell@umich.edu } 20944661Sksewell@umich.edu 0x2: decode OP_LO { 20954661Sksewell@umich.edu format DspIntOp { 20966384Sgblack@eecs.umich.edu 0x4: shll_s_w({{ 20976384Sgblack@eecs.umich.edu Rd.sw = dspShll(Rt.sw, RS, SIMD_FMT_W, 20986384Sgblack@eecs.umich.edu SATURATE, SIGNED, &dspctl); 20996384Sgblack@eecs.umich.edu }}); 21006384Sgblack@eecs.umich.edu 0x5: shra_r_w({{ 21016384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, RS, SIMD_FMT_W, 21026384Sgblack@eecs.umich.edu ROUND, SIGNED, &dspctl); 21036384Sgblack@eecs.umich.edu }}); 21046384Sgblack@eecs.umich.edu 0x6: shllv_s_w({{ 21056384Sgblack@eecs.umich.edu Rd.sw = dspShll(Rt.sw, Rs.sw, SIMD_FMT_W, 21066384Sgblack@eecs.umich.edu SATURATE, SIGNED, &dspctl); 21076384Sgblack@eecs.umich.edu }}); 21086384Sgblack@eecs.umich.edu 0x7: shrav_r_w({{ 21096384Sgblack@eecs.umich.edu Rd.sw = dspShra(Rt.sw, Rs.sw, SIMD_FMT_W, 21106384Sgblack@eecs.umich.edu ROUND, SIGNED, &dspctl); 21116384Sgblack@eecs.umich.edu }}); 21124661Sksewell@umich.edu } 21134661Sksewell@umich.edu } 21144661Sksewell@umich.edu 0x3: decode OP_LO { 21154661Sksewell@umich.edu format DspIntOp { 21166384Sgblack@eecs.umich.edu 0x1: shrl_ph({{ 21176384Sgblack@eecs.umich.edu Rd.sw = dspShrl(Rt.sw, RS, SIMD_FMT_PH, 21186384Sgblack@eecs.umich.edu UNSIGNED); 21196384Sgblack@eecs.umich.edu }}); 21206384Sgblack@eecs.umich.edu 0x3: shrlv_ph({{ 21216384Sgblack@eecs.umich.edu Rd.sw = dspShrl(Rt.sw, Rs.sw, SIMD_FMT_PH, 21226384Sgblack@eecs.umich.edu UNSIGNED); 21236384Sgblack@eecs.umich.edu }}); 21244661Sksewell@umich.edu } 21254661Sksewell@umich.edu } 21264661Sksewell@umich.edu } 21274661Sksewell@umich.edu } 21284661Sksewell@umich.edu 21294661Sksewell@umich.edu 0x3: decode FUNCTION_LO { 21304661Sksewell@umich.edu 21316384Sgblack@eecs.umich.edu //Table 3.12 MIPS32 ADDUH.QB Encoding of the op Field 21326384Sgblack@eecs.umich.edu //(DSP ASE Rev2 Manual) 21334661Sksewell@umich.edu 0x0: decode OP_HI { 21344661Sksewell@umich.edu 0x0: decode OP_LO { 21354661Sksewell@umich.edu format DspIntOp { 21366384Sgblack@eecs.umich.edu 0x0: adduh_qb({{ 21376384Sgblack@eecs.umich.edu Rd.uw = dspAddh(Rs.sw, Rt.sw, SIMD_FMT_QB, 21386384Sgblack@eecs.umich.edu NOROUND, UNSIGNED); 21396384Sgblack@eecs.umich.edu }}); 21406384Sgblack@eecs.umich.edu 0x1: subuh_qb({{ 21416384Sgblack@eecs.umich.edu Rd.uw = dspSubh(Rs.sw, Rt.sw, SIMD_FMT_QB, 21426384Sgblack@eecs.umich.edu NOROUND, UNSIGNED); 21436384Sgblack@eecs.umich.edu }}); 21446384Sgblack@eecs.umich.edu 0x2: adduh_r_qb({{ 21456384Sgblack@eecs.umich.edu Rd.uw = dspAddh(Rs.sw, Rt.sw, SIMD_FMT_QB, 21466384Sgblack@eecs.umich.edu ROUND, UNSIGNED); 21476384Sgblack@eecs.umich.edu }}); 21486384Sgblack@eecs.umich.edu 0x3: subuh_r_qb({{ 21496384Sgblack@eecs.umich.edu Rd.uw = dspSubh(Rs.sw, Rt.sw, SIMD_FMT_QB, 21506384Sgblack@eecs.umich.edu ROUND, UNSIGNED); 21516384Sgblack@eecs.umich.edu }}); 21524661Sksewell@umich.edu } 21534661Sksewell@umich.edu } 21544661Sksewell@umich.edu 0x1: decode OP_LO { 21554661Sksewell@umich.edu format DspIntOp { 21566384Sgblack@eecs.umich.edu 0x0: addqh_ph({{ 21576384Sgblack@eecs.umich.edu Rd.uw = dspAddh(Rs.sw, Rt.sw, SIMD_FMT_PH, 21586384Sgblack@eecs.umich.edu NOROUND, SIGNED); 21596384Sgblack@eecs.umich.edu }}); 21606384Sgblack@eecs.umich.edu 0x1: subqh_ph({{ 21616384Sgblack@eecs.umich.edu Rd.uw = dspSubh(Rs.sw, Rt.sw, SIMD_FMT_PH, 21626384Sgblack@eecs.umich.edu NOROUND, SIGNED); 21636384Sgblack@eecs.umich.edu }}); 21646384Sgblack@eecs.umich.edu 0x2: addqh_r_ph({{ 21656384Sgblack@eecs.umich.edu Rd.uw = dspAddh(Rs.sw, Rt.sw, SIMD_FMT_PH, 21666384Sgblack@eecs.umich.edu ROUND, SIGNED); 21676384Sgblack@eecs.umich.edu }}); 21686384Sgblack@eecs.umich.edu 0x3: subqh_r_ph({{ 21696384Sgblack@eecs.umich.edu Rd.uw = dspSubh(Rs.sw, Rt.sw, SIMD_FMT_PH, 21706384Sgblack@eecs.umich.edu ROUND, SIGNED); 21716384Sgblack@eecs.umich.edu }}); 21726384Sgblack@eecs.umich.edu 0x4: mul_ph({{ 21736384Sgblack@eecs.umich.edu Rd.sw = dspMul(Rs.sw, Rt.sw, SIMD_FMT_PH, 21746384Sgblack@eecs.umich.edu NOSATURATE, &dspctl); 21756384Sgblack@eecs.umich.edu }}, IntMultOp); 21766384Sgblack@eecs.umich.edu 0x6: mul_s_ph({{ 21776384Sgblack@eecs.umich.edu Rd.sw = dspMul(Rs.sw, Rt.sw, SIMD_FMT_PH, 21786384Sgblack@eecs.umich.edu SATURATE, &dspctl); 21796384Sgblack@eecs.umich.edu }}, IntMultOp); 21804661Sksewell@umich.edu } 21814661Sksewell@umich.edu } 21824661Sksewell@umich.edu 0x2: decode OP_LO { 21834661Sksewell@umich.edu format DspIntOp { 21846384Sgblack@eecs.umich.edu 0x0: addqh_w({{ 21856384Sgblack@eecs.umich.edu Rd.uw = dspAddh(Rs.sw, Rt.sw, SIMD_FMT_W, 21866384Sgblack@eecs.umich.edu NOROUND, SIGNED); 21876384Sgblack@eecs.umich.edu }}); 21886384Sgblack@eecs.umich.edu 0x1: subqh_w({{ 21896384Sgblack@eecs.umich.edu Rd.uw = dspSubh(Rs.sw, Rt.sw, SIMD_FMT_W, 21906384Sgblack@eecs.umich.edu NOROUND, SIGNED); 21916384Sgblack@eecs.umich.edu }}); 21926384Sgblack@eecs.umich.edu 0x2: addqh_r_w({{ 21936384Sgblack@eecs.umich.edu Rd.uw = dspAddh(Rs.sw, Rt.sw, SIMD_FMT_W, 21946384Sgblack@eecs.umich.edu ROUND, SIGNED); 21956384Sgblack@eecs.umich.edu }}); 21966384Sgblack@eecs.umich.edu 0x3: subqh_r_w({{ 21976384Sgblack@eecs.umich.edu Rd.uw = dspSubh(Rs.sw, Rt.sw, SIMD_FMT_W, 21986384Sgblack@eecs.umich.edu ROUND, SIGNED); 21996384Sgblack@eecs.umich.edu }}); 22006384Sgblack@eecs.umich.edu 0x6: mulq_s_w({{ 22016384Sgblack@eecs.umich.edu Rd.sw = dspMulq(Rs.sw, Rt.sw, SIMD_FMT_W, 22026384Sgblack@eecs.umich.edu SATURATE, NOROUND, &dspctl); 22036384Sgblack@eecs.umich.edu }}, IntMultOp); 22046384Sgblack@eecs.umich.edu 0x7: mulq_rs_w({{ 22056384Sgblack@eecs.umich.edu Rd.sw = dspMulq(Rs.sw, Rt.sw, SIMD_FMT_W, 22066384Sgblack@eecs.umich.edu SATURATE, ROUND, &dspctl); 22076384Sgblack@eecs.umich.edu }}, IntMultOp); 22084661Sksewell@umich.edu } 22094661Sksewell@umich.edu } 22102061SN/A } 22112101SN/A } 22122061SN/A 22132101SN/A //Table A-10 MIPS32 BSHFL Encoding of sa Field 22142101SN/A 0x4: decode SA { 22152046SN/A format BasicOp { 22166384Sgblack@eecs.umich.edu 0x02: wsbh({{ 22176384Sgblack@eecs.umich.edu Rd.uw = Rt.uw<23:16> << 24 | 22186384Sgblack@eecs.umich.edu Rt.uw<31:24> << 16 | 22196384Sgblack@eecs.umich.edu Rt.uw<7:0> << 8 | 22206384Sgblack@eecs.umich.edu Rt.uw<15:8>; 22212686Sksewell@umich.edu }}); 22222742Sksewell@umich.edu 0x10: seb({{ Rd.sw = Rt.sb; }}); 22232742Sksewell@umich.edu 0x18: seh({{ Rd.sw = Rt.sh; }}); 22242046SN/A } 22252101SN/A } 22262043SN/A 22272101SN/A 0x6: decode FUNCTION_LO { 22284661Sksewell@umich.edu 22296384Sgblack@eecs.umich.edu //Table 5-10 MIPS32 DPAQ.W.PH Encoding of the op Field 22306384Sgblack@eecs.umich.edu //(DSP ASE MANUAL) 22314661Sksewell@umich.edu 0x0: decode OP_HI { 22324661Sksewell@umich.edu 0x0: decode OP_LO { 22334661Sksewell@umich.edu format DspHiLoOp { 22346384Sgblack@eecs.umich.edu 0x0: dpa_w_ph({{ 22356384Sgblack@eecs.umich.edu dspac = dspDpa(dspac, Rs.sw, Rt.sw, ACDST, 22366384Sgblack@eecs.umich.edu SIMD_FMT_PH, SIGNED, MODE_L); 22376384Sgblack@eecs.umich.edu }}, IntMultOp); 22386384Sgblack@eecs.umich.edu 0x1: dps_w_ph({{ 22396384Sgblack@eecs.umich.edu dspac = dspDps(dspac, Rs.sw, Rt.sw, ACDST, 22406384Sgblack@eecs.umich.edu SIMD_FMT_PH, SIGNED, MODE_L); 22416384Sgblack@eecs.umich.edu }}, IntMultOp); 22426384Sgblack@eecs.umich.edu 0x2: mulsa_w_ph({{ 22436384Sgblack@eecs.umich.edu dspac = dspMulsa(dspac, Rs.sw, Rt.sw, 22446384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH ); 22456384Sgblack@eecs.umich.edu }}, IntMultOp); 22466384Sgblack@eecs.umich.edu 0x3: dpau_h_qbl({{ 22476384Sgblack@eecs.umich.edu dspac = dspDpa(dspac, Rs.sw, Rt.sw, ACDST, 22486384Sgblack@eecs.umich.edu SIMD_FMT_QB, UNSIGNED, MODE_L); 22496384Sgblack@eecs.umich.edu }}, IntMultOp); 22506384Sgblack@eecs.umich.edu 0x4: dpaq_s_w_ph({{ 22516384Sgblack@eecs.umich.edu dspac = dspDpaq(dspac, Rs.sw, Rt.sw, 22526384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 22536384Sgblack@eecs.umich.edu SIMD_FMT_W, NOSATURATE, 22546384Sgblack@eecs.umich.edu MODE_L, &dspctl); 22556384Sgblack@eecs.umich.edu }}, IntMultOp); 22566384Sgblack@eecs.umich.edu 0x5: dpsq_s_w_ph({{ 22576384Sgblack@eecs.umich.edu dspac = dspDpsq(dspac, Rs.sw, Rt.sw, 22586384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 22596384Sgblack@eecs.umich.edu SIMD_FMT_W, NOSATURATE, 22606384Sgblack@eecs.umich.edu MODE_L, &dspctl); 22616384Sgblack@eecs.umich.edu }}, IntMultOp); 22626384Sgblack@eecs.umich.edu 0x6: mulsaq_s_w_ph({{ 22636384Sgblack@eecs.umich.edu dspac = dspMulsaq(dspac, Rs.sw, Rt.sw, 22646384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 22656384Sgblack@eecs.umich.edu &dspctl); 22666384Sgblack@eecs.umich.edu }}, IntMultOp); 22676384Sgblack@eecs.umich.edu 0x7: dpau_h_qbr({{ 22686384Sgblack@eecs.umich.edu dspac = dspDpa(dspac, Rs.sw, Rt.sw, ACDST, 22696384Sgblack@eecs.umich.edu SIMD_FMT_QB, UNSIGNED, MODE_R); 22706384Sgblack@eecs.umich.edu }}, IntMultOp); 22714661Sksewell@umich.edu } 22724661Sksewell@umich.edu } 22734661Sksewell@umich.edu 0x1: decode OP_LO { 22744661Sksewell@umich.edu format DspHiLoOp { 22756384Sgblack@eecs.umich.edu 0x0: dpax_w_ph({{ 22766384Sgblack@eecs.umich.edu dspac = dspDpa(dspac, Rs.sw, Rt.sw, ACDST, 22776384Sgblack@eecs.umich.edu SIMD_FMT_PH, SIGNED, MODE_X); 22786384Sgblack@eecs.umich.edu }}, IntMultOp); 22796384Sgblack@eecs.umich.edu 0x1: dpsx_w_ph({{ 22806384Sgblack@eecs.umich.edu dspac = dspDps(dspac, Rs.sw, Rt.sw, ACDST, 22816384Sgblack@eecs.umich.edu SIMD_FMT_PH, SIGNED, MODE_X); 22826384Sgblack@eecs.umich.edu }}, IntMultOp); 22836384Sgblack@eecs.umich.edu 0x3: dpsu_h_qbl({{ 22846384Sgblack@eecs.umich.edu dspac = dspDps(dspac, Rs.sw, Rt.sw, ACDST, 22856384Sgblack@eecs.umich.edu SIMD_FMT_QB, UNSIGNED, MODE_L); 22866384Sgblack@eecs.umich.edu }}, IntMultOp); 22876384Sgblack@eecs.umich.edu 0x4: dpaq_sa_l_w({{ 22886384Sgblack@eecs.umich.edu dspac = dspDpaq(dspac, Rs.sw, Rt.sw, 22896384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_W, 22906384Sgblack@eecs.umich.edu SIMD_FMT_L, SATURATE, 22916384Sgblack@eecs.umich.edu MODE_L, &dspctl); 22926384Sgblack@eecs.umich.edu }}, IntMultOp); 22936384Sgblack@eecs.umich.edu 0x5: dpsq_sa_l_w({{ 22946384Sgblack@eecs.umich.edu dspac = dspDpsq(dspac, Rs.sw, Rt.sw, 22956384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_W, 22966384Sgblack@eecs.umich.edu SIMD_FMT_L, SATURATE, 22976384Sgblack@eecs.umich.edu MODE_L, &dspctl); 22986384Sgblack@eecs.umich.edu }}, IntMultOp); 22996384Sgblack@eecs.umich.edu 0x7: dpsu_h_qbr({{ 23006384Sgblack@eecs.umich.edu dspac = dspDps(dspac, Rs.sw, Rt.sw, ACDST, 23016384Sgblack@eecs.umich.edu SIMD_FMT_QB, UNSIGNED, MODE_R); 23026384Sgblack@eecs.umich.edu }}, IntMultOp); 23034661Sksewell@umich.edu } 23044661Sksewell@umich.edu } 23054661Sksewell@umich.edu 0x2: decode OP_LO { 23064661Sksewell@umich.edu format DspHiLoOp { 23076384Sgblack@eecs.umich.edu 0x0: maq_sa_w_phl({{ 23086384Sgblack@eecs.umich.edu dspac = dspMaq(dspac, Rs.uw, Rt.uw, 23096384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 23106384Sgblack@eecs.umich.edu MODE_L, SATURATE, &dspctl); 23116384Sgblack@eecs.umich.edu }}, IntMultOp); 23126384Sgblack@eecs.umich.edu 0x2: maq_sa_w_phr({{ 23136384Sgblack@eecs.umich.edu dspac = dspMaq(dspac, Rs.uw, Rt.uw, 23146384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 23156384Sgblack@eecs.umich.edu MODE_R, SATURATE, &dspctl); 23166384Sgblack@eecs.umich.edu }}, IntMultOp); 23176384Sgblack@eecs.umich.edu 0x4: maq_s_w_phl({{ 23186384Sgblack@eecs.umich.edu dspac = dspMaq(dspac, Rs.uw, Rt.uw, 23196384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 23206384Sgblack@eecs.umich.edu MODE_L, NOSATURATE, &dspctl); 23216384Sgblack@eecs.umich.edu }}, IntMultOp); 23226384Sgblack@eecs.umich.edu 0x6: maq_s_w_phr({{ 23236384Sgblack@eecs.umich.edu dspac = dspMaq(dspac, Rs.uw, Rt.uw, 23246384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 23256384Sgblack@eecs.umich.edu MODE_R, NOSATURATE, &dspctl); 23266384Sgblack@eecs.umich.edu }}, IntMultOp); 23274661Sksewell@umich.edu } 23284661Sksewell@umich.edu } 23294661Sksewell@umich.edu 0x3: decode OP_LO { 23304661Sksewell@umich.edu format DspHiLoOp { 23316384Sgblack@eecs.umich.edu 0x0: dpaqx_s_w_ph({{ 23326384Sgblack@eecs.umich.edu dspac = dspDpaq(dspac, Rs.sw, Rt.sw, 23336384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 23346384Sgblack@eecs.umich.edu SIMD_FMT_W, NOSATURATE, 23356384Sgblack@eecs.umich.edu MODE_X, &dspctl); 23366384Sgblack@eecs.umich.edu }}, IntMultOp); 23376384Sgblack@eecs.umich.edu 0x1: dpsqx_s_w_ph({{ 23386384Sgblack@eecs.umich.edu dspac = dspDpsq(dspac, Rs.sw, Rt.sw, 23396384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 23406384Sgblack@eecs.umich.edu SIMD_FMT_W, NOSATURATE, 23416384Sgblack@eecs.umich.edu MODE_X, &dspctl); 23426384Sgblack@eecs.umich.edu }}, IntMultOp); 23436384Sgblack@eecs.umich.edu 0x2: dpaqx_sa_w_ph({{ 23446384Sgblack@eecs.umich.edu dspac = dspDpaq(dspac, Rs.sw, Rt.sw, 23456384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 23466384Sgblack@eecs.umich.edu SIMD_FMT_W, SATURATE, 23476384Sgblack@eecs.umich.edu MODE_X, &dspctl); 23486384Sgblack@eecs.umich.edu }}, IntMultOp); 23496384Sgblack@eecs.umich.edu 0x3: dpsqx_sa_w_ph({{ 23506384Sgblack@eecs.umich.edu dspac = dspDpsq(dspac, Rs.sw, Rt.sw, 23516384Sgblack@eecs.umich.edu ACDST, SIMD_FMT_PH, 23526384Sgblack@eecs.umich.edu SIMD_FMT_W, SATURATE, 23536384Sgblack@eecs.umich.edu MODE_X, &dspctl); 23546384Sgblack@eecs.umich.edu }}, IntMultOp); 23554661Sksewell@umich.edu } 23564661Sksewell@umich.edu } 23574661Sksewell@umich.edu } 23584661Sksewell@umich.edu 23594661Sksewell@umich.edu //Table 3.3 MIPS32 APPEND Encoding of the op Field 23604661Sksewell@umich.edu 0x1: decode OP_HI { 23614661Sksewell@umich.edu 0x0: decode OP_LO { 23624661Sksewell@umich.edu format IntOp { 23636384Sgblack@eecs.umich.edu 0x0: append({{ 23646384Sgblack@eecs.umich.edu Rt.uw = (Rt.uw << RD) | bits(Rs.uw, RD - 1, 0); 23656384Sgblack@eecs.umich.edu }}); 23666384Sgblack@eecs.umich.edu 0x1: prepend({{ 23676384Sgblack@eecs.umich.edu Rt.uw = (Rt.uw >> RD) | 23686384Sgblack@eecs.umich.edu (bits(Rs.uw, RD - 1, 0) << (32 - RD)); 23696384Sgblack@eecs.umich.edu }}); 23704661Sksewell@umich.edu } 23714661Sksewell@umich.edu } 23724661Sksewell@umich.edu 0x2: decode OP_LO { 23734661Sksewell@umich.edu format IntOp { 23746384Sgblack@eecs.umich.edu 0x0: balign({{ 23756384Sgblack@eecs.umich.edu Rt.uw = (Rt.uw << (8 * BP)) | 23766384Sgblack@eecs.umich.edu (Rs.uw >> (8 * (4 - BP))); 23776384Sgblack@eecs.umich.edu }}); 23784661Sksewell@umich.edu } 23794661Sksewell@umich.edu } 23804661Sksewell@umich.edu } 23814661Sksewell@umich.edu 23822101SN/A } 23834661Sksewell@umich.edu 0x7: decode FUNCTION_LO { 23844661Sksewell@umich.edu 23856384Sgblack@eecs.umich.edu //Table 5-11 MIPS32 EXTR.W Encoding of the op Field 23866384Sgblack@eecs.umich.edu //(DSP ASE MANUAL) 23874661Sksewell@umich.edu 0x0: decode OP_HI { 23884661Sksewell@umich.edu 0x0: decode OP_LO { 23894661Sksewell@umich.edu format DspHiLoOp { 23906384Sgblack@eecs.umich.edu 0x0: extr_w({{ 23916384Sgblack@eecs.umich.edu Rt.uw = dspExtr(dspac, SIMD_FMT_W, RS, 23926384Sgblack@eecs.umich.edu NOROUND, NOSATURATE, &dspctl); 23936384Sgblack@eecs.umich.edu }}); 23946384Sgblack@eecs.umich.edu 0x1: extrv_w({{ 23956384Sgblack@eecs.umich.edu Rt.uw = dspExtr(dspac, SIMD_FMT_W, Rs.uw, 23966384Sgblack@eecs.umich.edu NOROUND, NOSATURATE, &dspctl); 23976384Sgblack@eecs.umich.edu }}); 23986384Sgblack@eecs.umich.edu 0x2: extp({{ 23996384Sgblack@eecs.umich.edu Rt.uw = dspExtp(dspac, RS, &dspctl); 24006384Sgblack@eecs.umich.edu }}); 24016384Sgblack@eecs.umich.edu 0x3: extpv({{ 24026384Sgblack@eecs.umich.edu Rt.uw = dspExtp(dspac, Rs.uw, &dspctl); 24036384Sgblack@eecs.umich.edu }}); 24046384Sgblack@eecs.umich.edu 0x4: extr_r_w({{ 24056384Sgblack@eecs.umich.edu Rt.uw = dspExtr(dspac, SIMD_FMT_W, RS, 24066384Sgblack@eecs.umich.edu ROUND, NOSATURATE, &dspctl); 24076384Sgblack@eecs.umich.edu }}); 24086384Sgblack@eecs.umich.edu 0x5: extrv_r_w({{ 24096384Sgblack@eecs.umich.edu Rt.uw = dspExtr(dspac, SIMD_FMT_W, Rs.uw, 24106384Sgblack@eecs.umich.edu ROUND, NOSATURATE, &dspctl); 24116384Sgblack@eecs.umich.edu }}); 24126384Sgblack@eecs.umich.edu 0x6: extr_rs_w({{ 24136384Sgblack@eecs.umich.edu Rt.uw = dspExtr(dspac, SIMD_FMT_W, RS, 24146384Sgblack@eecs.umich.edu ROUND, SATURATE, &dspctl); 24156384Sgblack@eecs.umich.edu }}); 24166384Sgblack@eecs.umich.edu 0x7: extrv_rs_w({{ 24176384Sgblack@eecs.umich.edu Rt.uw = dspExtr(dspac, SIMD_FMT_W, Rs.uw, 24186384Sgblack@eecs.umich.edu ROUND, SATURATE, &dspctl); 24196384Sgblack@eecs.umich.edu }}); 24204661Sksewell@umich.edu } 24214661Sksewell@umich.edu } 24224661Sksewell@umich.edu 0x1: decode OP_LO { 24234661Sksewell@umich.edu format DspHiLoOp { 24246384Sgblack@eecs.umich.edu 0x2: extpdp({{ 24256384Sgblack@eecs.umich.edu Rt.uw = dspExtpd(dspac, RS, &dspctl); 24266384Sgblack@eecs.umich.edu }}); 24276384Sgblack@eecs.umich.edu 0x3: extpdpv({{ 24286384Sgblack@eecs.umich.edu Rt.uw = dspExtpd(dspac, Rs.uw, &dspctl); 24296384Sgblack@eecs.umich.edu }}); 24306384Sgblack@eecs.umich.edu 0x6: extr_s_h({{ 24316384Sgblack@eecs.umich.edu Rt.uw = dspExtr(dspac, SIMD_FMT_PH, RS, 24326384Sgblack@eecs.umich.edu NOROUND, SATURATE, &dspctl); 24336384Sgblack@eecs.umich.edu }}); 24346384Sgblack@eecs.umich.edu 0x7: extrv_s_h({{ 24356384Sgblack@eecs.umich.edu Rt.uw = dspExtr(dspac, SIMD_FMT_PH, Rs.uw, 24366384Sgblack@eecs.umich.edu NOROUND, SATURATE, &dspctl); 24376384Sgblack@eecs.umich.edu }}); 24384661Sksewell@umich.edu } 24394661Sksewell@umich.edu } 24404661Sksewell@umich.edu 0x2: decode OP_LO { 24414661Sksewell@umich.edu format DspIntOp { 24426384Sgblack@eecs.umich.edu 0x2: rddsp({{ 24436384Sgblack@eecs.umich.edu Rd.uw = readDSPControl(&dspctl, RDDSPMASK); 24446384Sgblack@eecs.umich.edu }}); 24456384Sgblack@eecs.umich.edu 0x3: wrdsp({{ 24466384Sgblack@eecs.umich.edu writeDSPControl(&dspctl, Rs.uw, WRDSPMASK); 24476384Sgblack@eecs.umich.edu }}); 24484661Sksewell@umich.edu } 24494661Sksewell@umich.edu } 24504661Sksewell@umich.edu 0x3: decode OP_LO { 24514661Sksewell@umich.edu format DspHiLoOp { 24526384Sgblack@eecs.umich.edu 0x2: shilo({{ 24536384Sgblack@eecs.umich.edu if (sext<6>(HILOSA) < 0) { 24546384Sgblack@eecs.umich.edu dspac = (uint64_t)dspac << 24556384Sgblack@eecs.umich.edu -sext<6>(HILOSA); 24566384Sgblack@eecs.umich.edu } else { 24576384Sgblack@eecs.umich.edu dspac = (uint64_t)dspac >> 24586384Sgblack@eecs.umich.edu sext<6>(HILOSA); 24596384Sgblack@eecs.umich.edu } 24606384Sgblack@eecs.umich.edu }}); 24616384Sgblack@eecs.umich.edu 0x3: shilov({{ 24626384Sgblack@eecs.umich.edu if (sext<6>(Rs.sw<5:0>) < 0) { 24636384Sgblack@eecs.umich.edu dspac = (uint64_t)dspac << 24646384Sgblack@eecs.umich.edu -sext<6>(Rs.sw<5:0>); 24656384Sgblack@eecs.umich.edu } else { 24666384Sgblack@eecs.umich.edu dspac = (uint64_t)dspac >> 24676384Sgblack@eecs.umich.edu sext<6>(Rs.sw<5:0>); 24686384Sgblack@eecs.umich.edu } 24696384Sgblack@eecs.umich.edu }}); 24706384Sgblack@eecs.umich.edu 0x7: mthlip({{ 24716384Sgblack@eecs.umich.edu dspac = dspac << 32; 24726384Sgblack@eecs.umich.edu dspac |= Rs.uw; 24736384Sgblack@eecs.umich.edu dspctl = insertBits(dspctl, 5, 0, 24746384Sgblack@eecs.umich.edu dspctl<5:0> + 32); 24756384Sgblack@eecs.umich.edu }}); 24764661Sksewell@umich.edu } 24774661Sksewell@umich.edu } 24784661Sksewell@umich.edu } 24796809Sgblack@eecs.umich.edu 0x3: decode OP { 24806810Sgblack@eecs.umich.edu#if FULL_SYSTEM 24816809Sgblack@eecs.umich.edu 0x0: FailUnimpl::rdhwr(); 24826810Sgblack@eecs.umich.edu#else 24836810Sgblack@eecs.umich.edu 0x0: decode RD { 24846810Sgblack@eecs.umich.edu 29: BasicOp::rdhwr({{ Rt = TpValue; }}); 24856810Sgblack@eecs.umich.edu } 24866810Sgblack@eecs.umich.edu#endif 24875222Sksewell@umich.edu } 24884661Sksewell@umich.edu } 24892043SN/A } 24902084SN/A } 24912024SN/A 24922686Sksewell@umich.edu 0x4: decode OPCODE_LO { 24932124SN/A format LoadMemory { 24947708Sgblack@eecs.umich.edu 0x0: lb({{ Rt.sw = Mem.sb; }}); 24957708Sgblack@eecs.umich.edu 0x1: lh({{ Rt.sw = Mem.sh; }}); 24962479SN/A 0x3: lw({{ Rt.sw = Mem.sw; }}); 24977708Sgblack@eecs.umich.edu 0x4: lbu({{ Rt.uw = Mem.ub;}}); 24987708Sgblack@eecs.umich.edu 0x5: lhu({{ Rt.uw = Mem.uh; }}); 24992686Sksewell@umich.edu } 25002495SN/A 25012686Sksewell@umich.edu format LoadUnalignedMemory { 25026384Sgblack@eecs.umich.edu 0x2: lwl({{ 25036384Sgblack@eecs.umich.edu uint32_t mem_shift = 24 - (8 * byte_offset); 25046384Sgblack@eecs.umich.edu Rt.uw = mem_word << mem_shift | (Rt.uw & mask(mem_shift)); 25056384Sgblack@eecs.umich.edu }}); 25066384Sgblack@eecs.umich.edu 0x6: lwr({{ 25076384Sgblack@eecs.umich.edu uint32_t mem_shift = 8 * byte_offset; 25086384Sgblack@eecs.umich.edu Rt.uw = (Rt.uw & (mask(mem_shift) << (32 - mem_shift))) | 25096384Sgblack@eecs.umich.edu (mem_word >> mem_shift); 25106384Sgblack@eecs.umich.edu }}); 25116384Sgblack@eecs.umich.edu } 25122084SN/A } 25132024SN/A 25142686Sksewell@umich.edu 0x5: decode OPCODE_LO { 25152124SN/A format StoreMemory { 25167708Sgblack@eecs.umich.edu 0x0: sb({{ Mem.ub = Rt<7:0>; }}); 25177708Sgblack@eecs.umich.edu 0x1: sh({{ Mem.uh = Rt<15:0>; }}); 25182479SN/A 0x3: sw({{ Mem.uw = Rt<31:0>; }}); 25192084SN/A } 25202024SN/A 25212686Sksewell@umich.edu format StoreUnalignedMemory { 25226384Sgblack@eecs.umich.edu 0x2: swl({{ 25236384Sgblack@eecs.umich.edu uint32_t reg_shift = 24 - (8 * byte_offset); 25246384Sgblack@eecs.umich.edu uint32_t mem_shift = 32 - reg_shift; 25256384Sgblack@eecs.umich.edu mem_word = (mem_word & (mask(reg_shift) << mem_shift)) | 25266384Sgblack@eecs.umich.edu (Rt.uw >> reg_shift); 25276384Sgblack@eecs.umich.edu }}); 25286384Sgblack@eecs.umich.edu 0x6: swr({{ 25296384Sgblack@eecs.umich.edu uint32_t reg_shift = 8 * byte_offset; 25306384Sgblack@eecs.umich.edu mem_word = Rt.uw << reg_shift | 25316384Sgblack@eecs.umich.edu (mem_word & (mask(reg_shift))); 25326384Sgblack@eecs.umich.edu }}); 25332084SN/A } 25345222Sksewell@umich.edu format CP0Control { 25355222Sksewell@umich.edu 0x7: cache({{ 25365254Sksewell@umich.edu //Addr CacheEA = Rs.uw + OFFSET; 25376384Sgblack@eecs.umich.edu //fault = xc->CacheOp((uint8_t)CACHE_OP,(Addr) CacheEA); 25386384Sgblack@eecs.umich.edu }}); 25395222Sksewell@umich.edu } 25402084SN/A } 25412024SN/A 25422686Sksewell@umich.edu 0x6: decode OPCODE_LO { 25432686Sksewell@umich.edu format LoadMemory { 25446076Sgblack@eecs.umich.edu 0x0: ll({{ Rt.uw = Mem.uw; }}, mem_flags=LLSC); 25452686Sksewell@umich.edu 0x1: lwc1({{ Ft.uw = Mem.uw; }}); 25462573SN/A 0x5: ldc1({{ Ft.ud = Mem.ud; }}); 25472084SN/A } 25485222Sksewell@umich.edu 0x2: CP2Unimpl::lwc2(); 25495222Sksewell@umich.edu 0x6: CP2Unimpl::ldc2(); 25502686Sksewell@umich.edu 0x3: Prefetch::pref(); 25512084SN/A } 25522024SN/A 25532239SN/A 25542686Sksewell@umich.edu 0x7: decode OPCODE_LO { 25556384Sgblack@eecs.umich.edu 0x0: StoreCond::sc({{ Mem.uw = Rt.uw; }}, 25562686Sksewell@umich.edu {{ uint64_t tmp = write_result; 25572686Sksewell@umich.edu Rt.uw = (tmp == 0 || tmp == 1) ? tmp : Rt.uw; 25586384Sgblack@eecs.umich.edu }}, mem_flags=LLSC, 25596384Sgblack@eecs.umich.edu inst_flags = IsStoreConditional); 25602686Sksewell@umich.edu format StoreMemory { 25616384Sgblack@eecs.umich.edu 0x1: swc1({{ Mem.uw = Ft.uw; }}); 25626384Sgblack@eecs.umich.edu 0x5: sdc1({{ Mem.ud = Ft.ud; }}); 25632084SN/A } 25645222Sksewell@umich.edu 0x2: CP2Unimpl::swc2(); 25655222Sksewell@umich.edu 0x6: CP2Unimpl::sdc2(); 25662027SN/A } 25672024SN/A} 25682022SN/A 25692027SN/A 2570