decoder.isa revision 2239
12SN/A// -*- mode:c++ -*-
27338SAli.Saidi@ARM.com
37338SAli.Saidi@ARM.com////////////////////////////////////////////////////////////////////
47338SAli.Saidi@ARM.com//
57338SAli.Saidi@ARM.com// The actual MIPS32 ISA decoder
67338SAli.Saidi@ARM.com// -----------------------------
77338SAli.Saidi@ARM.com// The following instructions are specified in the MIPS32 ISA
87338SAli.Saidi@ARM.com// Specification. Decoding closely follows the style specified
97338SAli.Saidi@ARM.com// in the MIPS32 ISAthe specification document starting with Table
107338SAli.Saidi@ARM.com// A-2 (document available @ www.mips.com)
117338SAli.Saidi@ARM.com//
127338SAli.Saidi@ARM.com//@todo: Distinguish "unknown/future" use insts from "reserved"
137338SAli.Saidi@ARM.com// ones
141762SN/Adecode OPCODE_HI default Unknown::unknown() {
152SN/A
162SN/A    // Derived From ... Table A-2 MIPS32 ISA Manual
172SN/A    0x0: decode OPCODE_LO {
182SN/A
192SN/A        0x0: decode FUNCTION_HI {
202SN/A            0x0: decode FUNCTION_LO {
212SN/A                0x1: decode MOVCI {
222SN/A                    format BasicOp {
232SN/A                        0: movf({{ if (xc->readMiscReg(FPCR,0) != CC) Rd = Rs}});
242SN/A                        1: movt({{ if (xc->readMiscReg(FPCR,0) == CC) Rd = Rs}});
252SN/A                    }
262SN/A                }
272SN/A
282SN/A                format BasicOp {
292SN/A
302SN/A                    //Table A-3 Note: "1. Specific encodings of the rt, rd, and sa fields
312SN/A                    //are used to distinguish among the SLL, NOP, SSNOP and EHB functions."
322SN/A
332SN/A                    0x0: sll({{ Rd = Rt.uw << SA; }});
342SN/A
352SN/A                    0x2: decode SRL {
362SN/A                        0: srl({{ Rd = Rt.uw >> SA; }});
372SN/A
382SN/A                        //Hardcoded assuming 32-bit ISA, probably need parameter here
392665Ssaidi@eecs.umich.edu                        1: rotr({{ Rd = (Rt.uw << (32 - SA)) | (Rt.uw >> SA);}});
402665Ssaidi@eecs.umich.edu                    }
412SN/A
422SN/A                    0x3: sra({{ Rd = Rt.sw >> SA; }});
436216Snate@binkert.org
442439SN/A                    0x4: sllv({{ Rd = Rt.uw << Rs<4:0>; }});
456216Snate@binkert.org
46146SN/A                    0x6: decode SRLV {
47146SN/A                        0: srlv({{ Rd = Rt.uw >> Rs<4:0>; }});
48146SN/A
49146SN/A                        //Hardcoded assuming 32-bit ISA, probably need parameter here
50146SN/A                        1: rotrv({{ Rd = (Rt.uw << (32 - Rs<4:0>)) | (Rt.uw >> Rs<4:0>);}});
51146SN/A                    }
52146SN/A
536216Snate@binkert.org                    0x7: srav({{ Rd = Rt.sw >> Rs<4:0>; }});
546658Snate@binkert.org                }
551717SN/A            }
56146SN/A
571977SN/A            0x1: decode FUNCTION_LO {
582623SN/A
592683Sktlim@umich.edu                //Table A-3 Note: "Specific encodings of the hint field are used
601717SN/A                //to distinguish JR from JR.HB and JALR from JALR.HB"
61146SN/A                format Jump {
622683Sktlim@umich.edu                    0x0: decode HINT {
633348Sbinkertn@umich.edu                        0:jr({{ NNPC = Rs & ~1; }},IsReturn);
646105Ssteve.reinhardt@amd.com
656216Snate@binkert.org                        1:jr_hb({{ NNPC = Rs & ~1; clear_exe_inst_hazards(); }},IsReturn);
662036SN/A                    }
67146SN/A
6856SN/A                    0x1: decode HINT {
6956SN/A                        0: jalr({{ NNPC = Rs; }},IsCall,IsReturn);
70695SN/A
712901Ssaidi@eecs.umich.edu                        1: jalr_hb({{ NNPC = Rs; clear_exe_inst_hazards();}},IsCall,IsReturn);
722SN/A                    }
731858SN/A                }
743565Sgblack@eecs.umich.edu
753565Sgblack@eecs.umich.edu                format BasicOp {
762171SN/A                    0x2: movz({{ if (Rt == 0) Rd = Rs; }});
772170SN/A                    0x3: movn({{ if (Rt != 0) Rd = Rs; }});
78146SN/A                }
792462SN/A
80146SN/A                format WarnUnimpl {
812SN/A                    0x4: syscall();//{{ xc->syscall()}},IsNonSpeculative
822SN/A                    0x5: break();
832449SN/A                    0x7: sync();
841355SN/A                }
855529Snate@binkert.org            }
864495Sacolyte@umich.edu
87224SN/A            0x2: decode FUNCTION_LO {
881858SN/A                format BasicOp {
892683Sktlim@umich.edu                    0x0: mfhi({{ Rd = xc->readMiscReg(Hi,0); }});
902420SN/A                    0x1: mthi({{ xc->setMiscReg(Hi,0,Rs); }});
915529Snate@binkert.org                    0x2: mflo({{ Rd = xc->readMiscReg(Lo,0); }});
926331Sgblack@eecs.umich.edu                    0x3: mtlo({{ xc->setMiscReg(Lo,0,Rs); }});
932420SN/A                }
942SN/A            }
956029Ssteve.reinhardt@amd.com
962672Sktlim@umich.edu            0x3: decode FUNCTION_LO {
972683Sktlim@umich.edu                format IntOp {
982SN/A                    0x0: mult({{
992SN/A                        int64_t temp1 = Rs.sw * Rt.sw;
100334SN/A                        xc->setMiscReg(Hi,0,temp1<63:32>);
101140SN/A                        xc->setMiscReg(Lo,0,temp1<31:0>);
102334SN/A                    }});
1032SN/A
1042SN/A                    0x1: multu({{
1052SN/A                        int64_t temp1 = Rs.uw * Rt.uw;
1062680Sktlim@umich.edu                        xc->setMiscReg(Hi,0,temp1<63:32>);
1074377Sgblack@eecs.umich.edu                        xc->setMiscReg(Lo,0,temp1<31:0>);
1085169Ssaidi@eecs.umich.edu                    }});
1094377Sgblack@eecs.umich.edu
1104377Sgblack@eecs.umich.edu                    0x2: div({{
1112SN/A                        xc->setMiscReg(Hi,0,Rs.sw % Rt.sw);
1122SN/A                        xc->setMiscReg(Lo,0,Rs.sw / Rt.sw);
1132623SN/A                    }});
1142SN/A
1152SN/A                    0x3: divu({{
1162SN/A                        xc->setMiscReg(Hi,0,Rs.uw % Rt.uw);
117180SN/A                        xc->setMiscReg(Lo,0,Rs.uw / Rt.uw);
1182623SN/A                    }});
119393SN/A                }
120393SN/A            }
121393SN/A
122393SN/A            0x4: decode FUNCTION_LO {
123384SN/A                format IntOp {
124384SN/A                    0x0: add({{  Rd.sw = Rs.sw + Rt.sw;/*Trap on Overflow*/}});
125393SN/A                    0x1: addu({{ Rd.sw = Rs.sw + Rt.sw;}});
1262623SN/A                    0x2: sub({{ Rd.sw = Rs.sw - Rt.sw; /*Trap on Overflow*/}});
127393SN/A                    0x3: subu({{ Rd.sw = Rs.sw - Rt.uw;}});
128393SN/A                    0x4: and({{ Rd = Rs & Rt;}});
129393SN/A                    0x5: or({{ Rd = Rs | Rt;}});
130393SN/A                    0x6: xor({{ Rd = Rs ^ Rt;}});
131384SN/A                    0x7: nor({{ Rd = ~(Rs | Rt);}});
132189SN/A                }
133189SN/A            }
1342623SN/A
1352SN/A            0x5: decode FUNCTION_LO {
136729SN/A                format IntOp{
137334SN/A                    0x2: slt({{  Rd.sw = ( Rs.sw < Rt.sw ) ? 1 : 0}});
1382SN/A                    0x3: sltu({{ Rd.uw = ( Rs.uw < Rt.uw ) ? 1 : 0}});
1392SN/A                }
1402SN/A            }
1412SN/A
1422SN/A            0x6: decode FUNCTION_LO {
1432SN/A                format Trap {
1442SN/A                    0x0: tge({{  cond = (Rs.sw >= Rt.sw); }});
1452SN/A                    0x1: tgeu({{ cond = (Rs.uw >= Rt.uw); }});
1462SN/A                    0x2: tlt({{ cond = (Rs.sw < Rt.sw); }});
1472SN/A                    0x3: tltu({{ cond = (Rs.uw >= Rt.uw); }});
1482SN/A                    0x4: teq({{ cond = (Rs.sw == Rt.sw); }});
1492SN/A                    0x6: tne({{ cond = (Rs.sw != Rt.sw); }});
1501001SN/A                }
1511001SN/A            }
1521001SN/A        }
1531001SN/A
1541001SN/A        0x1: decode REGIMM_HI {
1552SN/A            0x0: decode REGIMM_LO {
1562SN/A                format Branch {
1572SN/A                    0x0: bltz({{ cond = (Rs.sw < 0); }});
1582SN/A                    0x1: bgez({{ cond = (Rs.sw >= 0); }});
1592SN/A                }
1602SN/A
1612SN/A                format BranchLikely {
1622SN/A                    //MIPS obsolete instructions
1632SN/A                    0x2: bltzl({{ cond = (Rs.sw < 0); }});
1642SN/A                    0x3: bgezl({{ cond = (Rs.sw >= 0); }});
1652SN/A                }
1662SN/A            }
1672SN/A
1682SN/A            0x1: decode REGIMM_LO {
1692SN/A                format Trap {
1702SN/A                    0x0: tgei( {{ cond = (Rs.sw >= INTIMM); }});
1712SN/A                    0x1: tgeiu({{ cond = (Rs.uw >= INTIMM); }});
1722390SN/A                    0x2: tlti( {{ cond = (Rs.sw < INTIMM); }});
1732390SN/A                    0x3: tltiu({{ cond = (Rs.uw < INTIMM); }});
1742390SN/A                    0x4: teqi( {{ cond = (Rs.sw == INTIMM);}});
1752390SN/A                    0x6: tnei( {{ cond = (Rs.sw != INTIMM);}});
1762390SN/A                }
1772390SN/A            }
1782390SN/A
1792390SN/A            0x2: decode REGIMM_LO {
1802390SN/A                format Branch {
1812390SN/A                    0x0: bltzal({{ cond = (Rs.sw < 0); }}, IsCall,IsReturn);
1822390SN/A                    0x1: bgezal({{ cond = (Rs.sw >= 0); }}, IsCall,IsReturn);
1832390SN/A                }
184385SN/A
1852SN/A                format BranchLikely {
1862SN/A                    //Will be removed in future MIPS releases
1872SN/A                    0x2: bltzall({{ cond = (Rs.sw < 0); }}, IsCall, IsReturn);
1882623SN/A                    0x3: bgezall({{ cond = (Rs.sw >= 0); }}, IsCall, IsReturn);
189334SN/A                }
1902361SN/A            }
1915496Ssaidi@eecs.umich.edu
192334SN/A            0x3: decode REGIMM_LO {
193334SN/A                format WarnUnimpl {
194334SN/A                    0x7: synci();
1952623SN/A                }
1962SN/A            }
1975496Ssaidi@eecs.umich.edu        }
198921SN/A
1992915Sktlim@umich.edu        format Jump {
2002915Sktlim@umich.edu            0x2: j({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2);}});
2012683Sktlim@umich.edu
2022SN/A            0x3: jal({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }},IsCall,IsReturn);
2032SN/A        }
2042SN/A
2052623SN/A        format Branch {
2062SN/A            0x4: beq({{ cond = (Rs.sw == Rt.sw); }});
2075496Ssaidi@eecs.umich.edu            0x5: bne({{ cond = (Rs.sw != Rt.sw); }});
208921SN/A            0x6: blez({{ cond = (Rs.sw <= 0); }});
2092915Sktlim@umich.edu            0x7: bgtz({{ cond = (Rs.sw > 0); }});
2102915Sktlim@umich.edu        }
2112SN/A    }
2122SN/A
2132SN/A    0x1: decode OPCODE_LO {
2146221Snate@binkert.org        format IntOp {
2152SN/A            0x0: addi({{ Rt.sw = Rs.sw + imm; /*Trap If Overflow*/}});
2162SN/A            0x1: addiu({{ Rt.sw = Rs.sw + imm;}});
2172SN/A            0x2: slti({{ Rt.sw = ( Rs.sw < imm) ? 1 : 0 }});
2187045Ssteve.reinhardt@amd.com            0x3: sltiu({{ Rt.sw = ( Rs.sw < imm ) ? 1 : 0 }});
2197045Ssteve.reinhardt@amd.com            0x4: andi({{ Rt.sw = Rs.sw & INTIMM;}});
2207045Ssteve.reinhardt@amd.com            0x5: ori({{ Rt.sw = Rs.sw | INTIMM;}});
2217045Ssteve.reinhardt@amd.com            0x6: xori({{ Rt.sw = Rs.sw ^ INTIMM;}});
2227045Ssteve.reinhardt@amd.com            0x7: lui({{ Rt = INTIMM << 16}});
2237045Ssteve.reinhardt@amd.com        }
2247045Ssteve.reinhardt@amd.com    }
2257045Ssteve.reinhardt@amd.com
2267045Ssteve.reinhardt@amd.com    0x2: decode OPCODE_LO {
2277045Ssteve.reinhardt@amd.com
2287045Ssteve.reinhardt@amd.com        //Table A-11 MIPS32 COP0 Encoding of rs Field
2297045Ssteve.reinhardt@amd.com        0x0: decode RS_MSB {
2307045Ssteve.reinhardt@amd.com            0x0: decode RS {
2317045Ssteve.reinhardt@amd.com                format System {
2327045Ssteve.reinhardt@amd.com                    0x0: mfc0({{
2337045Ssteve.reinhardt@amd.com                        //uint64_t reg_num = Rd.uw;
2347045Ssteve.reinhardt@amd.com
2357045Ssteve.reinhardt@amd.com                        Rt = xc->readMiscReg(RD,SEL);
2367045Ssteve.reinhardt@amd.com                    }});
2377045Ssteve.reinhardt@amd.com
2387045Ssteve.reinhardt@amd.com                    0x4: mtc0({{
239595SN/A                        //uint64_t reg_num = Rd.uw;
2402623SN/A
241595SN/A                        xc->setMiscReg(RD,SEL,Rt);
2422390SN/A                    }});
2431080SN/A
2446227Snate@binkert.org                    0x8: mftr({{
2456227Snate@binkert.org                        //The contents of the coprocessor 0 register specified by the
2461080SN/A                        //combination of rd and sel are loaded into general register
2471080SN/A                        //rt. Note that not all coprocessor 0 registers support the
2481080SN/A                        //sel field. In those instances, the sel field must be zero.
2491080SN/A
2501080SN/A                        //MT Code Needed Here
2511121SN/A                    }});
2522107SN/A
2531089SN/A                    0xC: mttr({{
2541089SN/A                        //The contents of the coprocessor 0 register specified by the
2551080SN/A                        //combination of rd and sel are loaded into general register
2561080SN/A                        //rt. Note that not all coprocessor 0 registers support the
2571080SN/A                        //sel field. In those instances, the sel field must be zero.
2581080SN/A
259595SN/A                        //MT Code Needed Here
2602623SN/A                    }});
2612683Sktlim@umich.edu
262595SN/A
2632090SN/A                    0xA: rdpgpr({{
2642683Sktlim@umich.edu                        //Accessing Previous Shadow Set Register Number
2652683Sktlim@umich.edu                        //uint64_t prev = xc->readMiscReg(SRSCtl)/*[PSS]*/;
266595SN/A                        //uint64_t reg_num = Rt.uw;
2672205SN/A
2682205SN/A                        //Rd = xc->regs.IntRegFile[prev];
2692683Sktlim@umich.edu                       //Rd = xc->shadowIntRegFile[prev][reg_num];
2702683Sktlim@umich.edu                    }});
271595SN/A
272595SN/A                    0xB: decode RD {
2732390SN/A
2742423SN/A                        0x0: decode SC {
2752390SN/A                            0x0: dvpe({{
276595SN/A                                int idx;
277595SN/A                                int sel;
278595SN/A                                getMiscRegIdx(MVPControl,idx,sel);
2792623SN/A                                Rt.sw = xc->readMiscReg(idx,sel);
280595SN/A                                xc->setMiscReg(idx,sel,0);
2812390SN/A                            }});
2821080SN/A
2836227Snate@binkert.org                            0x1: evpe({{
2846227Snate@binkert.org                                int idx;
2851080SN/A                                int sel;
2861080SN/A                                getMiscRegIdx(MVPControl,idx,sel);
287595SN/A                                Rt.sw = xc->readMiscReg(idx,sel);
2882683Sktlim@umich.edu                                xc->setMiscReg(idx,sel,1);
2891080SN/A                            }});
2901080SN/A                        }
2911080SN/A
2921121SN/A                        0x1: decode SC {
2932107SN/A                            0x0: dmt({{
2941089SN/A                                int idx;
2951080SN/A                                int sel;
2961089SN/A                                getMiscRegIdx(VPEControl,idx,sel);
2971080SN/A                                Rt.sw = xc->readMiscReg(idx,sel);
2981080SN/A                                xc->setMiscReg(idx,sel,0);
2991080SN/A                            }});
300595SN/A
3012683Sktlim@umich.edu                            0x1: emt({{
3021080SN/A                                int idx;
3032090SN/A                                int sel;
3041080SN/A                                getMiscRegIdx(VPEControl,idx,sel);
305595SN/A                                Rt.sw = xc->readMiscReg(idx,sel);
3062683Sktlim@umich.edu                                xc->setMiscReg(idx,sel,1);
3072683Sktlim@umich.edu                            }});
308595SN/A                        }
3092683Sktlim@umich.edu
3101098SN/A                        0xC: decode SC {
3111098SN/A                            0x0: di({{
3121098SN/A                                int idx;
3132683Sktlim@umich.edu                                int sel;
3141098SN/A                                getMiscRegIdx(Status,idx,sel);
3151098SN/A                                Rt.sw = xc->readMiscReg(idx,sel);
3161098SN/A                                xc->setMiscReg(idx,sel,0);
3171098SN/A                            }});
3181098SN/A
319595SN/A                            0x1: ei({{
3202205SN/A                                int idx;
3212205SN/A                                int sel;
3222205SN/A                                getMiscRegIdx(Status,idx,sel);
323595SN/A                                Rt.sw = xc->readMiscReg(idx,sel);
3242390SN/A                                xc->setMiscReg(idx,sel,1);
3252420SN/A                            }});
3262423SN/A                        }
3272390SN/A                    }
328595SN/A
329595SN/A                    0xE: wrpgpr({{
3301858SN/A                        //Accessing Previous Shadow Set Register Number
3312SN/A                        //uint64_t prev = xc->readMiscReg(SRSCtl/*[PSS]*/);
3322623SN/A                        //uint64_t reg_num = Rd.uw;
3332SN/A
3342680Sktlim@umich.edu                        //xc->regs.IntRegFile[prev];
3352SN/A                        //xc->shadowIntRegFile[prev][reg_num] = Rt;
3362SN/A                    }});
3372SN/A                }
3381858SN/A            }
3392SN/A
3405807Snate@binkert.org            //Table A-12 MIPS32 COP0 Encoding of Function Field When rs=CO
3412SN/A            0x1: decode FUNCTION {
3425807Snate@binkert.org                format System {
3435807Snate@binkert.org                    0x01: tlbr({{ }});
3442SN/A                    0x02: tlbwi({{ }});
3455807Snate@binkert.org                    0x06: tlbwr({{ }});
3465807Snate@binkert.org                    0x08: tlbp({{ }});
3472SN/A                }
3482SN/A
3492SN/A                format WarnUnimpl {
3502SN/A                    0x18: eret();
3512623SN/A                    0x1F: deret();
3522SN/A                    0x20: wait();
3531858SN/A                }
3545704Snate@binkert.org            }
3555647Sgblack@eecs.umich.edu        }
3562SN/A
3573520Sgblack@eecs.umich.edu        //Table A-13 MIPS32 COP1 Encoding of rs Field
3587338SAli.Saidi@ARM.com        0x1: decode RS_MSB {
3595647Sgblack@eecs.umich.edu
3603520Sgblack@eecs.umich.edu            0x0: decode RS_HI {
3617408Sgblack@eecs.umich.edu                0x0: decode RS_LO {
3622SN/A                    format FloatOp {
3632SN/A                        0x0: mfc1({{ /*Rt.uw = Fs.ud<31:0>;*/ }});
3642SN/A                        0x2: cfc1({{ /*Rt.uw = xc->readMiscReg(FPCR[Fs]);*/}});
3652623SN/A                        0x3: mfhc1({{ /*Rt.uw = Fs.ud<63:32>*/;}});
3662SN/A                        0x4: mtc1({{ /*Fs = Rt.uw*/}});
3672623SN/A                        0x6: ctc1({{ /*xc->setMiscReg(FPCR[Fs],Rt);*/}});
3685894Sgblack@eecs.umich.edu                        0x7: mthc1({{ /*Fs<63:32> = Rt.uw*/}});
3692662Sstever@eecs.umich.edu                    }
3702623SN/A                }
3714514Ssaidi@eecs.umich.edu
3724495Sacolyte@umich.edu                0x1: decode ND {
3732623SN/A                    0x0: decode TF {
3743093Sksewell@umich.edu                        format Branch {
3754495Sacolyte@umich.edu                            0x0: bc1f({{ cond = (xc->readMiscReg(FPCR,0) == 0); }});
3763093Sksewell@umich.edu                            0x1: bc1t({{ cond = (xc->readMiscReg(FPCR,0) == 1); }});
3773093Sksewell@umich.edu                        }
3784564Sgblack@eecs.umich.edu                    }
3792741Sksewell@umich.edu
3802741Sksewell@umich.edu                    0x1: decode TF {
3812623SN/A                        format BranchLikely {
3824564Sgblack@eecs.umich.edu                            0x0: bc1fl({{ cond = (xc->readMiscReg(FPCR,0) == 0); }});
3836105Ssteve.reinhardt@amd.com                            0x1: bc1tl({{ cond = (xc->readMiscReg(FPCR,0) == 1); }});
3842623SN/A                        }
3852623SN/A                    }
3862623SN/A                }
3872623SN/A            }
3882623SN/A
3892623SN/A            0x1: decode RS_HI {
3902SN/A                0x2: decode RS_LO {
3912683Sktlim@umich.edu
3922427SN/A                    //Table A-14 MIPS32 COP1 Encoding of Function Field When rs=S
3932683Sktlim@umich.edu                    //(( single-word ))
3942427SN/A                    0x0: decode RS_HI {
3952SN/A                        0x0: decode RS_LO {
3962623SN/A                            format FloatOp {
3972623SN/A                                0x0: adds({{ Fd.sf = Fs.sf + Ft.sf;}});
3982SN/A                                0x1: subs({{ Fd.sf = Fs.sf - Ft.sf;}});
3992623SN/A                                0x2: muls({{ Fd.sf = Fs.sf * Ft.sf;}});
4002623SN/A                                0x3: divs({{ Fd.sf = Fs.sf / Ft.sf;}});
4014377Sgblack@eecs.umich.edu                                0x4: sqrts({{ Fd.sf = sqrt(Fs.sf);}});
4025665Sgblack@eecs.umich.edu                                0x5: abss({{ Fd.sf = fabs(Fs.sf);}});
4034377Sgblack@eecs.umich.edu                                0x6: movs({{ Fd.sf = Fs.sf;}});
4045665Sgblack@eecs.umich.edu                                0x7: negs({{ Fd.sf = -1 * Fs.sf;}});
4055665Sgblack@eecs.umich.edu                            }
4065665Sgblack@eecs.umich.edu                        }
4075665Sgblack@eecs.umich.edu
4085665Sgblack@eecs.umich.edu                        0x1: decode RS_LO {
4094181Sgblack@eecs.umich.edu                            //only legal for 64 bit-FP
4104181Sgblack@eecs.umich.edu                            format Float64Op {
4114181Sgblack@eecs.umich.edu                                0x0: round_l_s({{ Fd = convert_and_round(Fs.sf,RND_NEAREST,FP_LONG,FP_SINGLE);}});
4124182Sgblack@eecs.umich.edu                                0x1: trunc_l_s({{ Fd = convert_and_round(Fs.sf,RND_ZERO,FP_LONG,FP_SINGLE);}});
4134182Sgblack@eecs.umich.edu                                0x2: ceil_l_s({{ Fd = convert_and_round(Fs.sf,RND_UP,FP_LONG,FP_SINGLE);}});
4144182Sgblack@eecs.umich.edu                                0x3: floor_l_s({{ Fd = convert_and_round(Fs.sf,RND_DOWN,FP_LONG,FP_SINGLE);}});
4154593Sgblack@eecs.umich.edu                            }
4164593Sgblack@eecs.umich.edu
4174593Sgblack@eecs.umich.edu                            format FloatOp {
4184593Sgblack@eecs.umich.edu                                0x4: round_w_s({{ Fd = convert_and_round(Fs.sf,RND_NEAREST,FP_WORD,FP_SINGLE);}});
4194593Sgblack@eecs.umich.edu                                0x5: trunc_w_s({{ Fd = convert_and_round(Fs.sf,RND_ZERO,FP_WORD,FP_SINGLE);}});
4204377Sgblack@eecs.umich.edu                                0x6: ceil_w_s({{  Fd = convert_and_round(Fs.sf,RND_UP,FP_WORD,FP_SINGLE);}});
4214377Sgblack@eecs.umich.edu                                0x7: floor_w_s({{ Fd = convert_and_round(Fs.sf,RND_DOWN,FP_WORD,FP_SINGLE);}});
4224377Sgblack@eecs.umich.edu                            }
4234377Sgblack@eecs.umich.edu                        }
4247100Sgblack@eecs.umich.edu
4254377Sgblack@eecs.umich.edu                        0x2: decode RS_LO {
4264377Sgblack@eecs.umich.edu                            0x1: decode MOVCF {
4274377Sgblack@eecs.umich.edu                                format FloatOp {
4284572Sacolyte@umich.edu                                    0x0: movfs({{if (xc->readMiscReg(FPCR,0) != CC) Fd = Fs; }});
4294572Sacolyte@umich.edu                                    0x1: movts({{if (xc->readMiscReg(FPCR,0) == CC) Fd = Fs;}});
4304377Sgblack@eecs.umich.edu                                }
4314377Sgblack@eecs.umich.edu                            }
4324377Sgblack@eecs.umich.edu
4334377Sgblack@eecs.umich.edu                            format BasicOp {
4344181Sgblack@eecs.umich.edu                                0x2: movzs({{ if (Rt == 0) Fd = Fs; }});
4354181Sgblack@eecs.umich.edu                                0x3: movns({{ if (Rt != 0) Fd = Fs; }});
4364181Sgblack@eecs.umich.edu                            }
4374539Sgblack@eecs.umich.edu
4383276Sgblack@eecs.umich.edu                            format Float64Op {
4395665Sgblack@eecs.umich.edu                                0x5: recips({{ Fd = 1 / Fs; }});
4403280Sgblack@eecs.umich.edu                                0x6: rsqrts({{ Fd = 1 / sqrt((double)Fs.ud);}});
4413280Sgblack@eecs.umich.edu                            }
4423276Sgblack@eecs.umich.edu                        }
4433276Sgblack@eecs.umich.edu
4443276Sgblack@eecs.umich.edu                        0x4: decode RS_LO {
4455665Sgblack@eecs.umich.edu
4463276Sgblack@eecs.umich.edu                            format FloatOp {
4473276Sgblack@eecs.umich.edu                                0x1: cvt_d_s({{ int rnd_mode = xc->readMiscReg(FCSR,0);
4484181Sgblack@eecs.umich.edu                                Fd = convert_and_round(Fs.sf,rnd_mode,FP_DOUBLE,FP_SINGLE);
4494181Sgblack@eecs.umich.edu                                }});
4504181Sgblack@eecs.umich.edu
4514522Ssaidi@eecs.umich.edu                                0x4: cvt_w_s({{ int rnd_mode = xc->readMiscReg(FCSR,0);
4525784Sgblack@eecs.umich.edu                                Fd = convert_and_round(Fs.sf,rnd_mode,FP_WORD,FP_SINGLE);
4535784Sgblack@eecs.umich.edu                                }});
4545784Sgblack@eecs.umich.edu                            }
4552470SN/A
4564181Sgblack@eecs.umich.edu                            //only legal for 64 bit
4574181Sgblack@eecs.umich.edu                            format Float64Op {
4584522Ssaidi@eecs.umich.edu                                0x5: cvt_l_s({{ int rnd_mode = xc->readMiscReg(FCSR,0);
4592623SN/A                                Fd = convert_and_round(Fs.sf,rnd_mode,FP_LONG,FP_SINGLE);
4602623SN/A                                }});
4614181Sgblack@eecs.umich.edu
4622623SN/A                                0x6: cvt_ps_s({{ /*Fd.df = Fs.df<31:0> | Ft.df<31:0>;*/ }});
4634181Sgblack@eecs.umich.edu                            }
4642623SN/A                        }
4652623SN/A                    }
4662623SN/A
4672623SN/A                    //Table A-15 MIPS32 COP1 Encoding of Function Field When rs=D
4682623SN/A                    0x1: decode RS_HI {
4692623SN/A                        0x0: decode RS_LO {
4705086Sgblack@eecs.umich.edu                            format FloatOp {
4713577Sgblack@eecs.umich.edu                                0x0: addd({{ Fd.df = Fs.df + Ft.df;}});
4722683Sktlim@umich.edu                                0x1: subd({{ Fd.df = Fs.df - Ft.df;}});
4735086Sgblack@eecs.umich.edu                                0x2: muld({{ Fd.df = Fs.df * Ft.df;}});
4742623SN/A                                0x3: divd({{ Fd.df = Fs.df / Ft.df;}});
4752683Sktlim@umich.edu                                0x4: sqrtd({{ Fd.df = sqrt(Fs.df);}});
4762623SN/A                                0x5: absd({{ Fd.df = fabs(Fs.df);}});
4772420SN/A                                0x6: movd({{ Fd.df = Fs.df;}});
4782SN/A                                0x7: negd({{ Fd.df = -1 * Fs.df;}});
4792623SN/A                            }
4802623SN/A                        }
4812SN/A
4822SN/A                        0x1: decode RS_LO {
4832623SN/A                            //only legal for 64 bit
4842623SN/A                            format Float64Op {
4852623SN/A                                0x0: round_l_d({{ Fd = convert_and_round(Fs.df,RND_NEAREST,FP_LONG,FP_DOUBLE); }});
4862623SN/A                                0x1: trunc_l_d({{ Fd = convert_and_round(Fs.df,RND_ZERO,FP_LONG,FP_DOUBLE);}});
4872SN/A                                0x2: ceil_l_d({{ Fd = convert_and_round(Fs.df,RND_UP,FP_LONG,FP_DOUBLE);}});
4885953Ssaidi@eecs.umich.edu                                0x3: floor_l_d({{ Fd = convert_and_round(Fs.df,RND_DOWN,FP_LONG,FP_DOUBLE);}});
4895953Ssaidi@eecs.umich.edu                            }
4905953Ssaidi@eecs.umich.edu
4915953Ssaidi@eecs.umich.edu                            format FloatOp {
4922683Sktlim@umich.edu                                0x4: round_w_d({{ Fd = convert_and_round(Fs.df,RND_NEAREST,FP_LONG,FP_DOUBLE); }});
4932644Sstever@eecs.umich.edu                                0x5: trunc_w_d({{ Fd = convert_and_round(Fs.df,RND_ZERO,FP_LONG,FP_DOUBLE); }});
4942644Sstever@eecs.umich.edu                                0x6: ceil_w_d({{  Fd = convert_and_round(Fs.df,RND_UP,FP_LONG,FP_DOUBLE); }});
4954046Sbinkertn@umich.edu                                0x7: floor_w_d({{ Fd = convert_and_round(Fs.df,RND_DOWN,FP_LONG,FP_DOUBLE); }});
4964046Sbinkertn@umich.edu                            }
4974046Sbinkertn@umich.edu                        }
4982644Sstever@eecs.umich.edu
4992623SN/A                        0x2: decode RS_LO {
5002SN/A                            0x1: decode MOVCF {
5012SN/A                                format FloatOp {
5022623SN/A                                    0x0: movfd({{if (xc->readMiscReg(FPCR,0) != CC) Fd.df = Fs.df; }});
5032623SN/A                                    0x1: movtd({{if (xc->readMiscReg(FPCR,0) == CC) Fd.df = Fs.df; }});
5042623SN/A                                }
5054377Sgblack@eecs.umich.edu                            }
5064377Sgblack@eecs.umich.edu
5072090SN/A                            format BasicOp {
5083905Ssaidi@eecs.umich.edu                                0x2: movzd({{ if (Rt == 0) Fd.df = Fs.df; }});
5097678Sgblack@eecs.umich.edu                                0x3: movnd({{ if (Rt != 0) Fd.df = Fs.df; }});
5105120Sgblack@eecs.umich.edu                            }
5114377Sgblack@eecs.umich.edu
5123276Sgblack@eecs.umich.edu                            format Float64Op {
5134539Sgblack@eecs.umich.edu                                0x5: recipd({{ Fd.df = 1 / Fs.df}});
5145665Sgblack@eecs.umich.edu                                0x6: rsqrtd({{ Fd.df = 1 / sqrt(Fs.df) }});
5155665Sgblack@eecs.umich.edu                            }
5165665Sgblack@eecs.umich.edu                        }
5173276Sgblack@eecs.umich.edu
5183276Sgblack@eecs.umich.edu                        0x4: decode RS_LO {
5193280Sgblack@eecs.umich.edu                            format FloatOp {
5205665Sgblack@eecs.umich.edu                                0x0: cvt_s_d({{
5215665Sgblack@eecs.umich.edu                                    int rnd_mode = xc->readMiscReg(FCSR,0);
5223276Sgblack@eecs.umich.edu                                    Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_DOUBLE);
5233276Sgblack@eecs.umich.edu                                }});
5245665Sgblack@eecs.umich.edu
5253276Sgblack@eecs.umich.edu                                0x4: cvt_w_d({{
5263280Sgblack@eecs.umich.edu                                    int rnd_mode = xc->readMiscReg(FCSR,0);
5273276Sgblack@eecs.umich.edu                                    Fd = convert_and_round(Fs.df,rnd_mode,FP_WORD,FP_DOUBLE);
5283276Sgblack@eecs.umich.edu                                }});
5293280Sgblack@eecs.umich.edu                            }
5303276Sgblack@eecs.umich.edu
5313276Sgblack@eecs.umich.edu                            //only legal for 64 bit
5323276Sgblack@eecs.umich.edu                            format Float64Op {
5333276Sgblack@eecs.umich.edu                                0x5: cvt_l_d({{
5343276Sgblack@eecs.umich.edu                                    int rnd_mode = xc->readMiscReg(FCSR,0);
5353276Sgblack@eecs.umich.edu                                    Fd = convert_and_round(Fs.df,rnd_mode,FP_LONG,FP_DOUBLE);
5363276Sgblack@eecs.umich.edu                                }});
5372SN/A                            }
5382SN/A                        }
5392SN/A                    }
5405250Sksewell@umich.edu
5415222Sksewell@umich.edu                    //Table A-16 MIPS32 COP1 Encoding of Function Field When rs=W
5425222Sksewell@umich.edu                    0x4: decode FUNCTION {
5435222Sksewell@umich.edu                        format FloatOp {
5445222Sksewell@umich.edu                            0x20: cvt_s({{
5455222Sksewell@umich.edu                                int rnd_mode = xc->readMiscReg(FCSR,0);
5465222Sksewell@umich.edu                                Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_WORD);
5475222Sksewell@umich.edu                            }});
5485222Sksewell@umich.edu
5495222Sksewell@umich.edu                            0x21: cvt_d({{
5505222Sksewell@umich.edu                                int rnd_mode = xc->readMiscReg(FCSR,0);
5515222Sksewell@umich.edu                                Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_WORD);
5525222Sksewell@umich.edu                            }});
5535222Sksewell@umich.edu                        }
5545222Sksewell@umich.edu                    }
5555222Sksewell@umich.edu
5565222Sksewell@umich.edu                    //Table A-16 MIPS32 COP1 Encoding of Function Field When rs=L1
5575222Sksewell@umich.edu                    //Note: "1. Format type L is legal only if 64-bit floating point operations
5585222Sksewell@umich.edu                    //are enabled."
5595222Sksewell@umich.edu                    0x5: decode FUNCTION_HI {
5605222Sksewell@umich.edu                        format FloatOp {
5615222Sksewell@umich.edu                            0x10: cvt_s_l({{
5625222Sksewell@umich.edu                                int rnd_mode = xc->readMiscReg(FCSR,0);
5635222Sksewell@umich.edu                                Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_LONG);
5645222Sksewell@umich.edu                            }});
5655222Sksewell@umich.edu
5665222Sksewell@umich.edu                            0x11: cvt_d_l({{
5675222Sksewell@umich.edu                                int rnd_mode = xc->readMiscReg(FCSR,0);
5685222Sksewell@umich.edu                                Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_LONG);
5695222Sksewell@umich.edu                            }});
5705222Sksewell@umich.edu                        }
5715222Sksewell@umich.edu                    }
5725222Sksewell@umich.edu
5735250Sksewell@umich.edu                    //Table A-17 MIPS64 COP1 Encoding of Function Field When rs=PS1
574                    //Note: "1. Format type PS is legal only if 64-bit floating point operations
575                    //are enabled. "
576                    0x6: decode RS_HI {
577                        0x0: decode RS_LO {
578                            format Float64Op {
579                                0x0: addps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
580                                    //Lower Halves Independently but we take simulator shortcut
581                                    Fd.df = Fs.df + Ft.df;
582                                }});
583
584                                0x1: subps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
585                                    //Lower Halves Independently but we take simulator shortcut
586                                    Fd.df = Fs.df - Ft.df;
587                                }});
588
589                                0x2: mulps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
590                                    //Lower Halves Independently but we take simulator shortcut
591                                    Fd.df = Fs.df * Ft.df;
592                                }});
593
594                                0x5: absps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
595                                    //Lower Halves Independently but we take simulator shortcut
596                                    Fd.df = fabs(Fs.df);
597                                }});
598
599                                0x6: movps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
600                                    //Lower Halves Independently but we take simulator shortcut
601                                    //Fd.df = Fs<31:0> |  Ft<31:0>;
602                                }});
603
604                                0x7: negps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
605                                    //Lower Halves Independently but we take simulator shortcut
606                                    Fd.df = -1 * Fs.df;
607                                }});
608                            }
609                        }
610
611                        0x2: decode RS_LO {
612                            0x1: decode MOVCF {
613                                format Float64Op {
614                                    0x0: movfps({{if (xc->readMiscReg(FPCR,0) != CC) Fd = Fs;}});
615                                    0x1: movtps({{if (xc->readMiscReg(FPCR,0) == CC) Fd = Fs;}});
616                                }
617                            }
618
619                            format BasicOp {
620                                0x2: movzps({{if (xc->readMiscReg(FPCR,0) != CC) Fd = Fs; }});
621                                0x3: movnps({{if (xc->readMiscReg(FPCR,0) == CC) Fd = Fs; }});
622                            }
623
624                        }
625
626                        0x4: decode RS_LO {
627                            0x0: Float64Op::cvt_s_pu({{
628                                int rnd_mode = xc->readMiscReg(FCSR,0);
629                                Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_PS_HI);
630                            }});
631                        }
632
633                        0x5: decode RS_LO {
634                            format Float64Op {
635                                0x0: cvt_s_pl({{
636                                    int rnd_mode = xc->readMiscReg(FCSR,0);
637                                    Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_PS_LO);
638                                }});
639                                0x4: pll({{ /*Fd.df = Fs<31:0> | Ft<31:0>*/}});
640                                0x5: plu({{ /*Fd.df = Fs<31:0> | Ft<63:32>*/}});
641                                0x6: pul({{ /*Fd.df = Fs<63:32> | Ft<31:0>*/}});
642                                0x7: puu({{ /*Fd.df = Fs<63:32 | Ft<63:32>*/}});
643                            }
644                        }
645                    }
646                }
647            }
648        }
649
650        //Table A-19 MIPS32 COP2 Encoding of rs Field
651        0x2: decode RS_MSB {
652            0x0: decode RS_HI {
653                0x0: decode RS_LO {
654                    format WarnUnimpl {
655                        0x0: mfc2();
656                        0x2: cfc2();
657                        0x3: mfhc2();
658                        0x4: mtc2();
659                        0x6: ctc2();
660                        0x7: mftc2();
661                    }
662                }
663
664                0x1: decode ND {
665                    0x0: decode TF {
666                        format WarnUnimpl {
667                            0x0: bc2f();
668                            0x1: bc2t();
669                        }
670                    }
671
672                    0x1: decode TF {
673                        format WarnUnimpl {
674                            0x0: bc2fl();
675                            0x1: bc2tl();
676                        }
677                    }
678                }
679            }
680        }
681
682        //Table A-20 MIPS64 COP1X Encoding of Function Field 1
683        //Note: "COP1X instructions are legal only if 64-bit floating point
684        //operations are enabled."
685        0x3: decode FUNCTION_HI {
686            0x0: decode FUNCTION_LO {
687                format LoadMemory2 {
688                    0x0: lwxc1({{ EA = Rs + Rt; }},{{ /*F_t<31:0> = Mem.sf; */}});
689                    0x1: ldxc1({{ EA = Rs + Rt; }},{{ /*F_t<63:0> = Mem.df;*/ }});
690                    0x5: luxc1({{ //Need to make EA<2:0> = 0
691                        EA = Rs + Rt;
692                    }},
693                {{ /*F_t<31:0> = Mem.df; */}});
694                }
695            }
696
697            0x1: decode FUNCTION_LO {
698                format StoreMemory2 {
699                    0x0: swxc1({{ EA = Rs + Rt; }},{{ /*Mem.sf = Ft<31:0>; */}});
700                    0x1: sdxc1({{ EA = Rs + Rt; }},{{ /*Mem.df = Ft<63:0> */}});
701                    0x5: suxc1({{ //Need to make EA<2:0> = 0
702                        EA = Rs + Rt;
703                    }},
704                {{ /*Mem.df = F_t<63:0>;*/}});
705                }
706
707                0x7: WarnUnimpl::prefx();
708            }
709
710            format FloatOp {
711                0x3: WarnUnimpl::alnv_ps();
712
713                format BasicOp {
714                    0x4: decode FUNCTION_LO {
715                        0x0: madd_s({{ Fd.sf = (Fs.sf * Fs.sf) + Fr.sf; }});
716                        0x1: madd_d({{ Fd.df = (Fs.df * Fs.df) + Fr.df; }});
717                        0x6: madd_ps({{
718                            //Must Check for Exception Here... Supposed to Operate on Upper and
719                            //Lower Halves Independently but we take simulator shortcut
720                            Fd.df = (Fs.df * Fs.df) + Fr.df;
721                        }});
722                    }
723
724                    0x5: decode FUNCTION_LO {
725                        0x0: msub_s({{ Fd.sf = (Fs.sf * Fs.sf) - Fr.sf; }});
726                        0x1: msub_d({{ Fd.df = (Fs.df * Fs.df) - Fr.df; }});
727                        0x6: msub_ps({{
728                            //Must Check for Exception Here... Supposed to Operate on Upper and
729                            //Lower Halves Independently but we take simulator shortcut
730                            Fd.df = (Fs.df * Fs.df) - Fr.df;
731                        }});
732                    }
733
734                    0x6: decode FUNCTION_LO {
735                        0x0: nmadd_s({{ Fd.sf = (-1 * Fs.sf * Fs.sf) - Fr.sf; }});
736                        0x1: nmadd_d({{ Fd.df = (-1 * Fs.df * Fs.df) + Fr.df; }});
737                        0x6: nmadd_ps({{
738                            //Must Check for Exception Here... Supposed to Operate on Upper and
739                            //Lower Halves Independently but we take simulator shortcut
740                            Fd.df = (-1 * Fs.df * Fs.df) + Fr.df;
741                        }});
742                    }
743
744                    0x7: decode FUNCTION_LO {
745                        0x0: nmsub_s({{ Fd.sf = (-1 * Fs.sf * Fs.sf) - Fr.sf; }});
746                        0x1: nmsub_d({{ Fd.df = (-1 * Fs.df * Fs.df) - Fr.df; }});
747                        0x6: nmsub_ps({{
748                            //Must Check for Exception Here... Supposed to Operate on Upper and
749                            //Lower Halves Independently but we take simulator shortcut
750                            Fd.df = (-1 * Fs.df * Fs.df) + Fr.df;
751                        }});
752                    }
753                }
754            }
755        }
756
757        //MIPS obsolete instructions
758        format BranchLikely {
759            0x4: beql({{ cond = (Rs.sw == 0); }});
760            0x5: bnel({{ cond = (Rs.sw != 0); }});
761            0x6: blezl({{ cond = (Rs.sw <= 0); }});
762            0x7: bgtzl({{ cond = (Rs.sw > 0); }});
763        }
764    }
765
766    0x3: decode OPCODE_LO default FailUnimpl::reserved() {
767
768        //Table A-5 MIPS32 SPECIAL2 Encoding of Function Field
769        0x4: decode FUNCTION_HI {
770
771            0x0: decode FUNCTION_LO {
772                format IntOp {
773                    0x0: madd({{
774                        int64_t temp1 = xc->readMiscReg(Hi,0) << 32 | xc->readMiscReg(Lo,0) >> 32;
775                        temp1 = temp1 + (Rs.sw * Rt.sw);
776                        xc->setMiscReg(Hi,0,temp1<63:32>);
777                        xc->setMiscReg(Lo,0,temp1<31:0>);
778                            }});
779
780                    0x1: maddu({{
781                        int64_t temp1 = xc->readMiscReg(Hi,0) << 32 | xc->readMiscReg(Lo,0) >> 32;
782                        temp1 = temp1 + (Rs.uw * Rt.uw);
783                        xc->setMiscReg(Hi,0,temp1<63:32>);
784                        xc->setMiscReg(Lo,0,temp1<31:0>);
785                            }});
786
787                    0x2: mul({{ Rd.sw = Rs.sw * Rt.sw; 	}});
788
789                    0x4: msub({{
790                        int64_t temp1 = xc->readMiscReg(Hi,0) << 32 | xc->readMiscReg(Lo,0) >> 32;
791                        temp1 = temp1 - (Rs.sw * Rt.sw);
792                        xc->setMiscReg(Hi,0,temp1<63:32>);
793                        xc->setMiscReg(Lo,0,temp1<31:0>);
794                            }});
795
796                    0x5: msubu({{
797                        int64_t temp1 = xc->readMiscReg(Hi,0) << 32 | xc->readMiscReg(Lo,0) >> 32;
798                        temp1 = temp1 - (Rs.uw * Rt.uw);
799                        xc->setMiscReg(Hi,0,temp1<63:32>);
800                        xc->setMiscReg(Lo,0,temp1<31:0>);
801                            }});
802                }
803            }
804
805            0x4: decode FUNCTION_LO {
806                format BasicOp {
807                    0x0: clz({{
808                        /*int cnt = 0;
809                        int idx = 0;
810                        while ( Rs.uw<idx> != 1) {
811                            cnt++;
812                            idx--;
813                        }
814
815                        Rd.uw = cnt;*/
816                    }});
817
818                    0x1: clo({{
819                        /*int cnt = 0;
820                        int idx = 0;
821                        while ( Rs.uw<idx> != 0) {
822                            cnt++;
823                            idx--;
824                        }
825
826                        Rd.uw = cnt;*/
827                    }});
828                }
829            }
830
831            0x7: decode FUNCTION_LO {
832                0x7: WarnUnimpl::sdbbp();
833            }
834        }
835
836        //Table A-6 MIPS32 SPECIAL3 Encoding of Function Field for Release 2 of the Architecture
837        0x7: decode FUNCTION_HI {
838
839            0x0: decode FUNCTION_LO {
840                format WarnUnimpl {
841                    0x1: ext();
842                    0x4: ins();
843                }
844            }
845
846            0x1: decode FUNCTION_LO {
847                format WarnUnimpl {
848                    0x0: fork();
849                    0x1: yield();
850                }
851            }
852
853
854            //Table A-10 MIPS32 BSHFL Encoding of sa Field
855            0x4: decode SA {
856
857                0x02: WarnUnimpl::wsbh();
858
859                format BasicOp {
860                    0x10: seb({{ Rd.sw = /* sext32(Rt<7>,24)  | */ Rt<7:0>}});
861                    0x18: seh({{ Rd.sw = /* sext32(Rt<15>,16) | */ Rt<15:0>}});
862                }
863            }
864
865            0x6: decode FUNCTION_LO {
866                0x7: BasicOp::rdhwr({{ /*Rt = xc->hwRegs[RD];*/ }});
867            }
868        }
869    }
870
871    0x4: decode OPCODE_LO default FailUnimpl::reserved() {
872        format LoadMemory {
873            0x0: lb({{ Rt.sw = Mem.sb; }});
874            0x1: lh({{ Rt.sw = Mem.sh; }});
875            0x2: lwl({{ Rt.sw = Mem.sw; }});//, WordAlign);
876            0x3: lw({{ Rt.sw = Mem.sb; }});
877            0x4: lbu({{ Rt.uw = Mem.ub; }});
878            0x5: lhu({{ Rt.uw = Mem.uh; }});
879            0x6: lwr({{ Rt.uw = Mem.uw; }});//, WordAlign);
880        }
881
882        0x7: FailUnimpl::reserved();
883    }
884
885    0x5: decode OPCODE_LO default FailUnimpl::reserved() {
886        format StoreMemory {
887            0x0: sb({{ Mem.ub = Rt<7:0>; }});
888            0x1: sh({{ Mem.uh = Rt<15:0>; }});
889            0x2: swl({{ Mem.ub = Rt<31:0>; }});//,WordAlign);
890            0x3: sw({{ Mem.ub = Rt<31:0>; }});
891            0x6: swr({{ Mem.ub = Rt<31:0>; }});//,WordAlign);
892        }
893
894        format WarnUnimpl {
895            0x7: cache();
896        }
897
898    }
899
900    0x6: decode OPCODE_LO default FailUnimpl::reserved() {
901        0x0: WarnUnimpl::ll();
902
903        format LoadMemory {
904            0x1: lwc1({{ /*F_t<31:0> = Mem.sf; */}});
905            0x5: ldc1({{ /*F_t<63:0> = Mem.df; */}});
906        }
907    }
908
909
910    0x7: decode OPCODE_LO default FailUnimpl::reserved() {
911        0x0: WarnUnimpl::sc();
912
913        format StoreMemory {
914            0x1: swc1({{ //Mem.sf = Ft<31:0>; }});
915            0x5: sdc1({{ //Mem.df = Ft<63:0>; }});
916        }
917    }
918}
919
920
921