2006-02-16 08:51:04 +01:00
|
|
|
// -*- mode:c++ -*-
|
|
|
|
|
2006-02-08 00:36:08 +01:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// The actual MIPS32 ISA decoder
|
|
|
|
// -----------------------------
|
|
|
|
// The following instructions are specified in the MIPS32 ISA
|
|
|
|
// Specification. Decoding closely follows the style specified
|
|
|
|
// in the MIPS32 ISAthe specification document starting with Table
|
|
|
|
// A-2 (document available @ www.mips.com)
|
|
|
|
//
|
|
|
|
//@todo: Distinguish "unknown/future" use insts from "reserved"
|
|
|
|
// ones
|
2006-02-15 03:26:01 +01:00
|
|
|
decode OPCODE_HI default Unknown::unknown() {
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
// Derived From ... Table A-2 MIPS32 ISA Manual
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: decode OPCODE_LO {
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x0: decode FUNCTION_HI {
|
|
|
|
0x0: decode FUNCTION_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode MOVCI {
|
|
|
|
format BasicOp {
|
2006-03-08 08:05:38 +01:00
|
|
|
0: movf({{ if (xc->readMiscReg(FPCR,0) != CC) Rd = Rs}});
|
|
|
|
1: movt({{ if (xc->readMiscReg(FPCR,0) == CC) Rd = Rs}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
format BasicOp {
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Table A-3 Note: "1. Specific encodings of the rt, rd, and sa fields
|
|
|
|
//are used to distinguish among the SLL, NOP, SSNOP and EHB functions."
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: sll({{ Rd = Rt.uw << SA; }});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x2: decode SRL {
|
|
|
|
0: srl({{ Rd = Rt.uw >> SA; }});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Hardcoded assuming 32-bit ISA, probably need parameter here
|
|
|
|
1: rotr({{ Rd = (Rt.uw << (32 - SA)) | (Rt.uw >> SA);}});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x3: sra({{ Rd = Rt.sw >> SA; }});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x4: sllv({{ Rd = Rt.uw << Rs<4:0>; }});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x6: decode SRLV {
|
|
|
|
0: srlv({{ Rd = Rt.uw >> Rs<4:0>; }});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Hardcoded assuming 32-bit ISA, probably need parameter here
|
|
|
|
1: rotrv({{ Rd = (Rt.uw << (32 - Rs<4:0>)) | (Rt.uw >> Rs<4:0>);}});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x7: srav({{ Rd = Rt.sw >> Rs<4:0>; }});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x1: decode FUNCTION_LO {
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Table A-3 Note: "Specific encodings of the hint field are used
|
|
|
|
//to distinguish JR from JR.HB and JALR from JALR.HB"
|
2006-02-20 07:49:16 +01:00
|
|
|
format Jump {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: decode HINT {
|
2006-03-08 08:05:38 +01:00
|
|
|
0:jr({{ NNPC = Rs & ~1; }},IsReturn);
|
2006-02-20 07:49:16 +01:00
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
1:jr_hb({{ NNPC = Rs & ~1; clear_exe_inst_hazards(); }},IsReturn);
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x1: decode HINT {
|
2006-02-20 07:49:16 +01:00
|
|
|
0: jalr({{ NNPC = Rs; }},IsCall,IsReturn);
|
|
|
|
|
|
|
|
1: jalr_hb({{ NNPC = Rs; clear_exe_inst_hazards();}},IsCall,IsReturn);
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
format BasicOp {
|
|
|
|
0x2: movz({{ if (Rt == 0) Rd = Rs; }});
|
|
|
|
0x3: movn({{ if (Rt != 0) Rd = Rs; }});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
format WarnUnimpl {
|
|
|
|
0x4: syscall();//{{ xc->syscall()}},IsNonSpeculative
|
|
|
|
0x5: break();
|
|
|
|
0x7: sync();
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x2: decode FUNCTION_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
format BasicOp {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x0: mfhi({{ Rd = xc->readMiscReg(Hi); }});
|
|
|
|
0x1: mthi({{ xc->setMiscReg(Hi,Rs); }});
|
|
|
|
0x2: mflo({{ Rd = xc->readMiscReg(Lo); }});
|
|
|
|
0x3: mtlo({{ xc->setMiscReg(Lo,Rs); }});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-15 03:26:01 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x3: decode FUNCTION_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
format IntOp {
|
|
|
|
0x0: mult({{
|
2006-02-22 09:33:35 +01:00
|
|
|
int64_t temp1 = Rs.sw * Rt.sw;
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(Hi,temp1<63:32>);
|
|
|
|
xc->setMiscReg(Lo,temp1<31:0>);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: multu({{
|
2006-02-22 09:33:35 +01:00
|
|
|
int64_t temp1 = Rs.uw * Rt.uw;
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(Hi,temp1<63:32>);
|
|
|
|
xc->setMiscReg(Lo,temp1<31:0>);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x2: div({{
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(Hi,Rs.sw % Rt.sw);
|
|
|
|
xc->setMiscReg(Lo,Rs.sw / Rt.sw);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x3: divu({{
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(Hi,Rs.uw % Rt.uw);
|
|
|
|
xc->setMiscReg(Lo,Rs.uw / Rt.uw);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
|
|
|
}
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x4: decode FUNCTION_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
format IntOp {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x0: add({{ Rd.sw = Rs.sw + Rt.sw;/*Trap on Overflow*/}});
|
|
|
|
0x1: addu({{ Rd.sw = Rs.sw + Rt.sw;}});
|
|
|
|
0x2: sub({{ Rd.sw = Rs.sw - Rt.sw; /*Trap on Overflow*/}});
|
|
|
|
0x3: subu({{ Rd.sw = Rs.sw - Rt.uw;}});
|
|
|
|
0x4: and({{ Rd = Rs & Rt;}});
|
|
|
|
0x5: or({{ Rd = Rs | Rt;}});
|
|
|
|
0x6: xor({{ Rd = Rs ^ Rt;}});
|
|
|
|
0x7: nor({{ Rd = ~(Rs | Rt);}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x5: decode FUNCTION_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
format IntOp{
|
|
|
|
0x2: slt({{ Rd.sw = ( Rs.sw < Rt.sw ) ? 1 : 0}});
|
|
|
|
0x3: sltu({{ Rd.uw = ( Rs.uw < Rt.uw ) ? 1 : 0}});
|
|
|
|
}
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x6: decode FUNCTION_LO {
|
2006-03-08 08:05:38 +01:00
|
|
|
format Trap {
|
|
|
|
0x0: tge({{ cond = (Rs.sw >= Rt.sw); }});
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: tgeu({{ cond = (Rs.uw >= Rt.uw); }});
|
|
|
|
0x2: tlt({{ cond = (Rs.sw < Rt.sw); }});
|
|
|
|
0x3: tltu({{ cond = (Rs.uw >= Rt.uw); }});
|
|
|
|
0x4: teq({{ cond = (Rs.sw == Rt.sw); }});
|
|
|
|
0x6: tne({{ cond = (Rs.sw != Rt.sw); }});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
0x1: decode REGIMM_HI {
|
|
|
|
0x0: decode REGIMM_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
format Branch {
|
|
|
|
0x0: bltz({{ cond = (Rs.sw < 0); }});
|
|
|
|
0x1: bgez({{ cond = (Rs.sw >= 0); }});
|
|
|
|
}
|
2006-02-16 08:51:04 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
format BranchLikely {
|
|
|
|
//MIPS obsolete instructions
|
|
|
|
0x2: bltzl({{ cond = (Rs.sw < 0); }});
|
|
|
|
0x3: bgezl({{ cond = (Rs.sw >= 0); }});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x1: decode REGIMM_LO {
|
2006-03-08 08:05:38 +01:00
|
|
|
format Trap {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: tgei( {{ cond = (Rs.sw >= INTIMM); }});
|
2006-02-19 05:17:45 +01:00
|
|
|
0x1: tgeiu({{ cond = (Rs.uw >= INTIMM); }});
|
2006-02-18 09:12:04 +01:00
|
|
|
0x2: tlti( {{ cond = (Rs.sw < INTIMM); }});
|
|
|
|
0x3: tltiu({{ cond = (Rs.uw < INTIMM); }});
|
|
|
|
0x4: teqi( {{ cond = (Rs.sw == INTIMM);}});
|
|
|
|
0x6: tnei( {{ cond = (Rs.sw != INTIMM);}});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x2: decode REGIMM_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
format Branch {
|
2006-02-22 09:33:35 +01:00
|
|
|
0x0: bltzal({{ cond = (Rs.sw < 0); }}, IsCall,IsReturn);
|
|
|
|
0x1: bgezal({{ cond = (Rs.sw >= 0); }}, IsCall,IsReturn);
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
format BranchLikely {
|
|
|
|
//Will be removed in future MIPS releases
|
2006-02-22 09:33:35 +01:00
|
|
|
0x2: bltzall({{ cond = (Rs.sw < 0); }}, IsCall, IsReturn);
|
|
|
|
0x3: bgezall({{ cond = (Rs.sw >= 0); }}, IsCall, IsReturn);
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x3: decode REGIMM_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
format WarnUnimpl {
|
|
|
|
0x7: synci();
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-20 07:49:16 +01:00
|
|
|
format Jump {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x2: j({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2);}});
|
2006-02-20 07:49:16 +01:00
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
0x3: jal({{ NNPC = (NPC & 0xF0000000) | (JMPTARG << 2); }},IsCall,IsReturn);
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
2006-02-16 08:51:04 +01:00
|
|
|
format Branch {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x4: beq({{ cond = (Rs.sw == Rt.sw); }});
|
|
|
|
0x5: bne({{ cond = (Rs.sw != Rt.sw); }});
|
2006-02-15 04:43:14 +01:00
|
|
|
0x6: blez({{ cond = (Rs.sw <= 0); }});
|
|
|
|
0x7: bgtz({{ cond = (Rs.sw > 0); }});
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode OPCODE_LO {
|
2006-02-08 00:36:08 +01:00
|
|
|
format IntOp {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x0: addi({{ Rt.sw = Rs.sw + imm; /*Trap If Overflow*/}});
|
|
|
|
0x1: addiu({{ Rt.sw = Rs.sw + imm;}});
|
|
|
|
0x2: slti({{ Rt.sw = ( Rs.sw < imm) ? 1 : 0 }});
|
|
|
|
0x3: sltiu({{ Rt.sw = ( Rs.sw < imm ) ? 1 : 0 }});
|
2006-02-08 00:36:08 +01:00
|
|
|
0x4: andi({{ Rt.sw = Rs.sw & INTIMM;}});
|
|
|
|
0x5: ori({{ Rt.sw = Rs.sw | INTIMM;}});
|
|
|
|
0x6: xori({{ Rt.sw = Rs.sw ^ INTIMM;}});
|
|
|
|
0x7: lui({{ Rt = INTIMM << 16}});
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x2: decode OPCODE_LO {
|
2006-02-08 20:50:07 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Table A-11 MIPS32 COP0 Encoding of rs Field
|
|
|
|
0x0: decode RS_MSB {
|
|
|
|
0x0: decode RS {
|
2006-03-08 08:05:38 +01:00
|
|
|
format System {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: mfc0({{
|
2006-03-08 08:05:38 +01:00
|
|
|
//uint64_t reg_num = Rd.uw;
|
2006-02-09 10:26:04 +01:00
|
|
|
|
2006-03-08 10:36:55 +01:00
|
|
|
Rt = xc->readMiscReg(RD << 5 | SEL);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-09 10:26:04 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x4: mtc0({{
|
2006-03-08 08:05:38 +01:00
|
|
|
//uint64_t reg_num = Rd.uw;
|
2006-02-09 10:26:04 +01:00
|
|
|
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(RD << 5 | SEL,Rt);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-09 10:26:04 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x8: mftr({{
|
2006-02-14 08:03:14 +01:00
|
|
|
//The contents of the coprocessor 0 register specified by the
|
|
|
|
//combination of rd and sel are loaded into general register
|
|
|
|
//rt. Note that not all coprocessor 0 registers support the
|
|
|
|
//sel field. In those instances, the sel field must be zero.
|
|
|
|
|
|
|
|
//MT Code Needed Here
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-14 08:03:14 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0xC: mttr({{
|
2006-02-14 08:03:14 +01:00
|
|
|
//The contents of the coprocessor 0 register specified by the
|
|
|
|
//combination of rd and sel are loaded into general register
|
|
|
|
//rt. Note that not all coprocessor 0 registers support the
|
|
|
|
//sel field. In those instances, the sel field must be zero.
|
|
|
|
|
|
|
|
//MT Code Needed Here
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-14 08:03:14 +01:00
|
|
|
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0xA: rdpgpr({{
|
2006-02-09 10:26:04 +01:00
|
|
|
//Accessing Previous Shadow Set Register Number
|
2006-03-08 08:05:38 +01:00
|
|
|
//uint64_t prev = xc->readMiscReg(SRSCtl)/*[PSS]*/;
|
|
|
|
//uint64_t reg_num = Rt.uw;
|
2006-02-09 10:26:04 +01:00
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
//Rd = xc->regs.IntRegFile[prev];
|
|
|
|
//Rd = xc->shadowIntRegFile[prev][reg_num];
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0xB: decode RD {
|
2006-02-14 08:03:14 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: decode SC {
|
|
|
|
0x0: dvpe({{
|
2006-03-08 08:05:38 +01:00
|
|
|
int idx;
|
|
|
|
int sel;
|
|
|
|
getMiscRegIdx(MVPControl,idx,sel);
|
|
|
|
Rt.sw = xc->readMiscReg(idx,sel);
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(idx,sel);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-09 10:26:04 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: evpe({{
|
2006-03-08 08:05:38 +01:00
|
|
|
int idx;
|
|
|
|
int sel;
|
|
|
|
getMiscRegIdx(MVPControl,idx,sel);
|
|
|
|
Rt.sw = xc->readMiscReg(idx,sel);
|
|
|
|
xc->setMiscReg(idx,sel,1);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
|
|
|
}
|
2006-02-14 08:03:14 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode SC {
|
|
|
|
0x0: dmt({{
|
2006-03-08 08:05:38 +01:00
|
|
|
int idx;
|
|
|
|
int sel;
|
|
|
|
getMiscRegIdx(VPEControl,idx,sel);
|
|
|
|
Rt.sw = xc->readMiscReg(idx,sel);
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(idx,sel);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-14 08:03:14 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: emt({{
|
2006-03-08 08:05:38 +01:00
|
|
|
int idx;
|
|
|
|
int sel;
|
|
|
|
getMiscRegIdx(VPEControl,idx,sel);
|
|
|
|
Rt.sw = xc->readMiscReg(idx,sel);
|
|
|
|
xc->setMiscReg(idx,sel,1);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
|
|
|
}
|
2006-02-14 08:03:14 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0xC: decode SC {
|
|
|
|
0x0: di({{
|
2006-03-08 08:05:38 +01:00
|
|
|
int idx;
|
|
|
|
int sel;
|
|
|
|
getMiscRegIdx(Status,idx,sel);
|
|
|
|
Rt.sw = xc->readMiscReg(idx,sel);
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(idx,sel);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-14 08:03:14 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: ei({{
|
2006-03-08 08:05:38 +01:00
|
|
|
int idx;
|
|
|
|
int sel;
|
|
|
|
getMiscRegIdx(Status,idx,sel);
|
|
|
|
Rt.sw = xc->readMiscReg(idx,sel);
|
|
|
|
xc->setMiscReg(idx,sel,1);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0xE: wrpgpr({{
|
2006-02-09 10:26:04 +01:00
|
|
|
//Accessing Previous Shadow Set Register Number
|
2006-03-08 08:05:38 +01:00
|
|
|
//uint64_t prev = xc->readMiscReg(SRSCtl/*[PSS]*/);
|
|
|
|
//uint64_t reg_num = Rd.uw;
|
2006-02-09 10:26:04 +01:00
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
//xc->regs.IntRegFile[prev];
|
|
|
|
//xc->shadowIntRegFile[prev][reg_num] = Rt;
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Table A-12 MIPS32 COP0 Encoding of Function Field When rs=CO
|
|
|
|
0x1: decode FUNCTION {
|
2006-03-08 08:05:38 +01:00
|
|
|
format System {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x01: tlbr({{ }});
|
|
|
|
0x02: tlbwi({{ }});
|
|
|
|
0x06: tlbwr({{ }});
|
|
|
|
0x08: tlbp({{ }});
|
|
|
|
}
|
|
|
|
|
|
|
|
format WarnUnimpl {
|
|
|
|
0x18: eret();
|
|
|
|
0x1F: deret();
|
|
|
|
0x20: wait();
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Table A-13 MIPS32 COP1 Encoding of rs Field
|
|
|
|
0x1: decode RS_MSB {
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x0: decode RS_HI {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: decode RS_LO {
|
|
|
|
format FloatOp {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x0: mfc1({{ /*Rt.uw = Fs.ud<31:0>;*/ }});
|
|
|
|
0x2: cfc1({{ /*Rt.uw = xc->readMiscReg(FPCR[Fs]);*/}});
|
|
|
|
0x3: mfhc1({{ /*Rt.uw = Fs.ud<63:32>*/;}});
|
|
|
|
0x4: mtc1({{ /*Fs = Rt.uw*/}});
|
|
|
|
0x6: ctc1({{ /*xc->setMiscReg(FPCR[Fs],Rt);*/}});
|
|
|
|
0x7: mthc1({{ /*Fs<63:32> = Rt.uw*/}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode ND {
|
|
|
|
0x0: decode TF {
|
|
|
|
format Branch {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x0: bc1f({{ cond = (xc->readMiscReg(FPCR) == 0); }});
|
|
|
|
0x1: bc1t({{ cond = (xc->readMiscReg(FPCR) == 1); }});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode TF {
|
|
|
|
format BranchLikely {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x0: bc1fl({{ cond = (xc->readMiscReg(FPCR) == 0); }});
|
|
|
|
0x1: bc1tl({{ cond = (xc->readMiscReg(FPCR) == 1); }});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x1: decode RS_HI {
|
|
|
|
0x2: decode RS_LO {
|
|
|
|
|
|
|
|
//Table A-14 MIPS32 COP1 Encoding of Function Field When rs=S
|
|
|
|
//(( single-word ))
|
|
|
|
0x0: decode RS_HI {
|
|
|
|
0x0: decode RS_LO {
|
|
|
|
format FloatOp {
|
|
|
|
0x0: adds({{ Fd.sf = Fs.sf + Ft.sf;}});
|
|
|
|
0x1: subs({{ Fd.sf = Fs.sf - Ft.sf;}});
|
|
|
|
0x2: muls({{ Fd.sf = Fs.sf * Ft.sf;}});
|
|
|
|
0x3: divs({{ Fd.sf = Fs.sf / Ft.sf;}});
|
|
|
|
0x4: sqrts({{ Fd.sf = sqrt(Fs.sf);}});
|
2006-03-08 08:05:38 +01:00
|
|
|
0x5: abss({{ Fd.sf = fabs(Fs.sf);}});
|
2006-02-18 09:12:04 +01:00
|
|
|
0x6: movs({{ Fd.sf = Fs.sf;}});
|
|
|
|
0x7: negs({{ Fd.sf = -1 * Fs.sf;}});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
0x1: decode RS_LO {
|
|
|
|
//only legal for 64 bit-FP
|
|
|
|
format Float64Op {
|
|
|
|
0x0: round_l_s({{ Fd = convert_and_round(Fs.sf,RND_NEAREST,FP_LONG,FP_SINGLE);}});
|
|
|
|
0x1: trunc_l_s({{ Fd = convert_and_round(Fs.sf,RND_ZERO,FP_LONG,FP_SINGLE);}});
|
|
|
|
0x2: ceil_l_s({{ Fd = convert_and_round(Fs.sf,RND_UP,FP_LONG,FP_SINGLE);}});
|
|
|
|
0x3: floor_l_s({{ Fd = convert_and_round(Fs.sf,RND_DOWN,FP_LONG,FP_SINGLE);}});
|
|
|
|
}
|
|
|
|
|
|
|
|
format FloatOp {
|
|
|
|
0x4: round_w_s({{ Fd = convert_and_round(Fs.sf,RND_NEAREST,FP_WORD,FP_SINGLE);}});
|
|
|
|
0x5: trunc_w_s({{ Fd = convert_and_round(Fs.sf,RND_ZERO,FP_WORD,FP_SINGLE);}});
|
|
|
|
0x6: ceil_w_s({{ Fd = convert_and_round(Fs.sf,RND_UP,FP_WORD,FP_SINGLE);}});
|
|
|
|
0x7: floor_w_s({{ Fd = convert_and_round(Fs.sf,RND_DOWN,FP_WORD,FP_SINGLE);}});
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x2: decode RS_LO {
|
|
|
|
0x1: decode MOVCF {
|
|
|
|
format FloatOp {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x0: movfs({{if (xc->readMiscReg(FPCR) != CC) Fd = Fs; }});
|
|
|
|
0x1: movts({{if (xc->readMiscReg(FPCR) == CC) Fd = Fs;}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
format BasicOp {
|
|
|
|
0x2: movzs({{ if (Rt == 0) Fd = Fs; }});
|
|
|
|
0x3: movns({{ if (Rt != 0) Fd = Fs; }});
|
|
|
|
}
|
|
|
|
|
|
|
|
format Float64Op {
|
2006-02-22 09:33:35 +01:00
|
|
|
0x5: recips({{ Fd = 1 / Fs; }});
|
2006-03-08 08:05:38 +01:00
|
|
|
0x6: rsqrts({{ Fd = 1 / sqrt((double)Fs.ud);}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
0x4: decode RS_LO {
|
2006-02-15 04:43:14 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
format FloatOp {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x1: cvt_d_s({{ int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-10 09:27:19 +01:00
|
|
|
Fd = convert_and_round(Fs.sf,rnd_mode,FP_DOUBLE,FP_SINGLE);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-03-08 10:36:55 +01:00
|
|
|
0x4: cvt_w_s({{ int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-10 09:27:19 +01:00
|
|
|
Fd = convert_and_round(Fs.sf,rnd_mode,FP_WORD,FP_SINGLE);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//only legal for 64 bit
|
|
|
|
format Float64Op {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x5: cvt_l_s({{ int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-10 09:27:19 +01:00
|
|
|
Fd = convert_and_round(Fs.sf,rnd_mode,FP_LONG,FP_SINGLE);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
0x6: cvt_ps_s({{ /*Fd.df = Fs.df<31:0> | Ft.df<31:0>;*/ }});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Table A-15 MIPS32 COP1 Encoding of Function Field When rs=D
|
|
|
|
0x1: decode RS_HI {
|
|
|
|
0x0: decode RS_LO {
|
|
|
|
format FloatOp {
|
|
|
|
0x0: addd({{ Fd.df = Fs.df + Ft.df;}});
|
|
|
|
0x1: subd({{ Fd.df = Fs.df - Ft.df;}});
|
|
|
|
0x2: muld({{ Fd.df = Fs.df * Ft.df;}});
|
|
|
|
0x3: divd({{ Fd.df = Fs.df / Ft.df;}});
|
|
|
|
0x4: sqrtd({{ Fd.df = sqrt(Fs.df);}});
|
2006-03-08 08:05:38 +01:00
|
|
|
0x5: absd({{ Fd.df = fabs(Fs.df);}});
|
2006-02-18 09:12:04 +01:00
|
|
|
0x6: movd({{ Fd.df = Fs.df;}});
|
|
|
|
0x7: negd({{ Fd.df = -1 * Fs.df;}});
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode RS_LO {
|
|
|
|
//only legal for 64 bit
|
|
|
|
format Float64Op {
|
|
|
|
0x0: round_l_d({{ Fd = convert_and_round(Fs.df,RND_NEAREST,FP_LONG,FP_DOUBLE); }});
|
|
|
|
0x1: trunc_l_d({{ Fd = convert_and_round(Fs.df,RND_ZERO,FP_LONG,FP_DOUBLE);}});
|
|
|
|
0x2: ceil_l_d({{ Fd = convert_and_round(Fs.df,RND_UP,FP_LONG,FP_DOUBLE);}});
|
|
|
|
0x3: floor_l_d({{ Fd = convert_and_round(Fs.df,RND_DOWN,FP_LONG,FP_DOUBLE);}});
|
|
|
|
}
|
|
|
|
|
|
|
|
format FloatOp {
|
|
|
|
0x4: round_w_d({{ Fd = convert_and_round(Fs.df,RND_NEAREST,FP_LONG,FP_DOUBLE); }});
|
|
|
|
0x5: trunc_w_d({{ Fd = convert_and_round(Fs.df,RND_ZERO,FP_LONG,FP_DOUBLE); }});
|
|
|
|
0x6: ceil_w_d({{ Fd = convert_and_round(Fs.df,RND_UP,FP_LONG,FP_DOUBLE); }});
|
|
|
|
0x7: floor_w_d({{ Fd = convert_and_round(Fs.df,RND_DOWN,FP_LONG,FP_DOUBLE); }});
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x2: decode RS_LO {
|
|
|
|
0x1: decode MOVCF {
|
|
|
|
format FloatOp {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x0: movfd({{if (xc->readMiscReg(FPCR) != CC) Fd.df = Fs.df; }});
|
|
|
|
0x1: movtd({{if (xc->readMiscReg(FPCR) == CC) Fd.df = Fs.df; }});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
format BasicOp {
|
2006-02-22 09:33:35 +01:00
|
|
|
0x2: movzd({{ if (Rt == 0) Fd.df = Fs.df; }});
|
|
|
|
0x3: movnd({{ if (Rt != 0) Fd.df = Fs.df; }});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
format Float64Op {
|
|
|
|
0x5: recipd({{ Fd.df = 1 / Fs.df}});
|
|
|
|
0x6: rsqrtd({{ Fd.df = 1 / sqrt(Fs.df) }});
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x4: decode RS_LO {
|
|
|
|
format FloatOp {
|
|
|
|
0x0: cvt_s_d({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-18 09:12:04 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_DOUBLE);
|
|
|
|
}});
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x4: cvt_w_d({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-18 09:12:04 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_WORD,FP_DOUBLE);
|
|
|
|
}});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//only legal for 64 bit
|
|
|
|
format Float64Op {
|
|
|
|
0x5: cvt_l_d({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-18 09:12:04 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_LONG,FP_DOUBLE);
|
|
|
|
}});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Table A-16 MIPS32 COP1 Encoding of Function Field When rs=W
|
|
|
|
0x4: decode FUNCTION {
|
|
|
|
format FloatOp {
|
2006-02-22 09:33:35 +01:00
|
|
|
0x20: cvt_s({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-10 09:27:19 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_WORD);
|
|
|
|
}});
|
|
|
|
|
2006-02-22 09:33:35 +01:00
|
|
|
0x21: cvt_d({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-10 09:27:19 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_WORD);
|
|
|
|
}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Table A-16 MIPS32 COP1 Encoding of Function Field When rs=L1
|
|
|
|
//Note: "1. Format type L is legal only if 64-bit floating point operations
|
|
|
|
//are enabled."
|
|
|
|
0x5: decode FUNCTION_HI {
|
|
|
|
format FloatOp {
|
|
|
|
0x10: cvt_s_l({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-10 09:27:19 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_LONG);
|
|
|
|
}});
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x11: cvt_d_l({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-10 09:27:19 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_LONG);
|
|
|
|
}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Table A-17 MIPS64 COP1 Encoding of Function Field When rs=PS1
|
|
|
|
//Note: "1. Format type PS is legal only if 64-bit floating point operations
|
|
|
|
//are enabled. "
|
|
|
|
0x6: decode RS_HI {
|
|
|
|
0x0: decode RS_LO {
|
|
|
|
format Float64Op {
|
|
|
|
0x0: addps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
|
|
|
Fd.df = Fs.df + Ft.df;
|
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: subps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
|
|
|
Fd.df = Fs.df - Ft.df;
|
|
|
|
}});
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x2: mulps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
|
|
|
Fd.df = Fs.df * Ft.df;
|
|
|
|
}});
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x5: absps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
2006-03-08 08:05:38 +01:00
|
|
|
Fd.df = fabs(Fs.df);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x6: movps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
2006-03-08 08:05:38 +01:00
|
|
|
//Fd.df = Fs<31:0> | Ft<31:0>;
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x7: negps({{ //Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
|
|
|
Fd.df = -1 * Fs.df;
|
|
|
|
}});
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x2: decode RS_LO {
|
|
|
|
0x1: decode MOVCF {
|
|
|
|
format Float64Op {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x0: movfps({{if (xc->readMiscReg(FPCR) != CC) Fd = Fs;}});
|
|
|
|
0x1: movtps({{if (xc->readMiscReg(FPCR) == CC) Fd = Fs;}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-22 09:33:35 +01:00
|
|
|
format BasicOp {
|
2006-03-08 10:36:55 +01:00
|
|
|
0x2: movzps({{if (xc->readMiscReg(FPCR) != CC) Fd = Fs; }});
|
|
|
|
0x3: movnps({{if (xc->readMiscReg(FPCR) == CC) Fd = Fs; }});
|
2006-02-22 09:33:35 +01:00
|
|
|
}
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x4: decode RS_LO {
|
|
|
|
0x0: Float64Op::cvt_s_pu({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-10 09:27:19 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_DOUBLE,FP_PS_HI);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x5: decode RS_LO {
|
|
|
|
format Float64Op {
|
|
|
|
0x0: cvt_s_pl({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int rnd_mode = xc->readMiscReg(FCSR);
|
2006-02-18 09:12:04 +01:00
|
|
|
Fd = convert_and_round(Fs.df,rnd_mode,FP_SINGLE,FP_PS_LO);
|
|
|
|
}});
|
2006-03-08 08:05:38 +01:00
|
|
|
0x4: pll({{ /*Fd.df = Fs<31:0> | Ft<31:0>*/}});
|
|
|
|
0x5: plu({{ /*Fd.df = Fs<31:0> | Ft<63:32>*/}});
|
|
|
|
0x6: pul({{ /*Fd.df = Fs<63:32> | Ft<31:0>*/}});
|
|
|
|
0x7: puu({{ /*Fd.df = Fs<63:32 | Ft<63:32>*/}});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Table A-19 MIPS32 COP2 Encoding of rs Field
|
|
|
|
0x2: decode RS_MSB {
|
|
|
|
0x0: decode RS_HI {
|
|
|
|
0x0: decode RS_LO {
|
|
|
|
format WarnUnimpl {
|
|
|
|
0x0: mfc2();
|
|
|
|
0x2: cfc2();
|
|
|
|
0x3: mfhc2();
|
|
|
|
0x4: mtc2();
|
|
|
|
0x6: ctc2();
|
|
|
|
0x7: mftc2();
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode ND {
|
|
|
|
0x0: decode TF {
|
|
|
|
format WarnUnimpl {
|
|
|
|
0x0: bc2f();
|
|
|
|
0x1: bc2t();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
0x1: decode TF {
|
|
|
|
format WarnUnimpl {
|
|
|
|
0x0: bc2fl();
|
|
|
|
0x1: bc2tl();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Table A-20 MIPS64 COP1X Encoding of Function Field 1
|
|
|
|
//Note: "COP1X instructions are legal only if 64-bit floating point
|
|
|
|
//operations are enabled."
|
|
|
|
0x3: decode FUNCTION_HI {
|
|
|
|
0x0: decode FUNCTION_LO {
|
2006-02-20 20:30:23 +01:00
|
|
|
format LoadMemory2 {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x0: lwxc1({{ EA = Rs + Rt; }},{{ /*F_t<31:0> = Mem.sf; */}});
|
|
|
|
0x1: ldxc1({{ EA = Rs + Rt; }},{{ /*F_t<63:0> = Mem.df;*/ }});
|
2006-02-18 09:12:04 +01:00
|
|
|
0x5: luxc1({{ //Need to make EA<2:0> = 0
|
|
|
|
EA = Rs + Rt;
|
|
|
|
}},
|
2006-03-08 08:05:38 +01:00
|
|
|
{{ /*F_t<31:0> = Mem.df; */}});
|
2006-02-08 20:50:07 +01:00
|
|
|
}
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode FUNCTION_LO {
|
2006-02-20 20:30:23 +01:00
|
|
|
format StoreMemory2 {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x0: swxc1({{ EA = Rs + Rt; }},{{ /*Mem.sf = Ft<31:0>; */}});
|
|
|
|
0x1: sdxc1({{ EA = Rs + Rt; }},{{ /*Mem.df = Ft<63:0> */}});
|
2006-02-18 09:12:04 +01:00
|
|
|
0x5: suxc1({{ //Need to make EA<2:0> = 0
|
|
|
|
EA = Rs + Rt;
|
|
|
|
}},
|
2006-03-08 08:05:38 +01:00
|
|
|
{{ /*Mem.df = F_t<63:0>;*/}});
|
2006-02-08 20:50:07 +01:00
|
|
|
}
|
2006-02-15 04:43:14 +01:00
|
|
|
|
|
|
|
0x7: WarnUnimpl::prefx();
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
format FloatOp {
|
2006-02-15 04:43:14 +01:00
|
|
|
0x3: WarnUnimpl::alnv_ps();
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-10 09:27:19 +01:00
|
|
|
format BasicOp {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x4: decode FUNCTION_LO {
|
|
|
|
0x0: madd_s({{ Fd.sf = (Fs.sf * Fs.sf) + Fr.sf; }});
|
|
|
|
0x1: madd_d({{ Fd.df = (Fs.df * Fs.df) + Fr.df; }});
|
|
|
|
0x6: madd_ps({{
|
|
|
|
//Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
|
|
|
Fd.df = (Fs.df * Fs.df) + Fr.df;
|
|
|
|
}});
|
|
|
|
}
|
|
|
|
|
|
|
|
0x5: decode FUNCTION_LO {
|
|
|
|
0x0: msub_s({{ Fd.sf = (Fs.sf * Fs.sf) - Fr.sf; }});
|
|
|
|
0x1: msub_d({{ Fd.df = (Fs.df * Fs.df) - Fr.df; }});
|
|
|
|
0x6: msub_ps({{
|
|
|
|
//Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
|
|
|
Fd.df = (Fs.df * Fs.df) - Fr.df;
|
|
|
|
}});
|
|
|
|
}
|
|
|
|
|
|
|
|
0x6: decode FUNCTION_LO {
|
|
|
|
0x0: nmadd_s({{ Fd.sf = (-1 * Fs.sf * Fs.sf) - Fr.sf; }});
|
|
|
|
0x1: nmadd_d({{ Fd.df = (-1 * Fs.df * Fs.df) + Fr.df; }});
|
|
|
|
0x6: nmadd_ps({{
|
|
|
|
//Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
|
|
|
Fd.df = (-1 * Fs.df * Fs.df) + Fr.df;
|
|
|
|
}});
|
|
|
|
}
|
|
|
|
|
|
|
|
0x7: decode FUNCTION_LO {
|
|
|
|
0x0: nmsub_s({{ Fd.sf = (-1 * Fs.sf * Fs.sf) - Fr.sf; }});
|
|
|
|
0x1: nmsub_d({{ Fd.df = (-1 * Fs.df * Fs.df) - Fr.df; }});
|
|
|
|
0x6: nmsub_ps({{
|
|
|
|
//Must Check for Exception Here... Supposed to Operate on Upper and
|
|
|
|
//Lower Halves Independently but we take simulator shortcut
|
|
|
|
Fd.df = (-1 * Fs.df * Fs.df) + Fr.df;
|
|
|
|
}});
|
|
|
|
}
|
2006-02-08 20:50:07 +01:00
|
|
|
}
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//MIPS obsolete instructions
|
2006-02-16 08:51:04 +01:00
|
|
|
format BranchLikely {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x4: beql({{ cond = (Rs.sw == 0); }});
|
|
|
|
0x5: bnel({{ cond = (Rs.sw != 0); }});
|
|
|
|
0x6: blezl({{ cond = (Rs.sw <= 0); }});
|
|
|
|
0x7: bgtzl({{ cond = (Rs.sw > 0); }});
|
2006-02-08 20:50:07 +01:00
|
|
|
}
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x3: decode OPCODE_LO default FailUnimpl::reserved() {
|
|
|
|
|
|
|
|
//Table A-5 MIPS32 SPECIAL2 Encoding of Function Field
|
|
|
|
0x4: decode FUNCTION_HI {
|
|
|
|
|
|
|
|
0x0: decode FUNCTION_LO {
|
|
|
|
format IntOp {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: madd({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int64_t temp1 = xc->readMiscReg(Hi) << 32 | xc->readMiscReg(Lo) >> 32;
|
2006-02-08 00:36:08 +01:00
|
|
|
temp1 = temp1 + (Rs.sw * Rt.sw);
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(Hi,temp1<63:32>);
|
|
|
|
xc->setMiscReg(Lo,temp1<31:0>);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: maddu({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int64_t temp1 = xc->readMiscReg(Hi) << 32 | xc->readMiscReg(Lo) >> 32;
|
2006-02-08 00:36:08 +01:00
|
|
|
temp1 = temp1 + (Rs.uw * Rt.uw);
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(Hi,temp1<63:32>);
|
|
|
|
xc->setMiscReg(Lo,temp1<31:0>);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
0x2: mul({{ Rd.sw = Rs.sw * Rt.sw; }});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x4: msub({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int64_t temp1 = xc->readMiscReg(Hi) << 32 | xc->readMiscReg(Lo) >> 32;
|
2006-02-08 00:36:08 +01:00
|
|
|
temp1 = temp1 - (Rs.sw * Rt.sw);
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(Hi,temp1<63:32>);
|
|
|
|
xc->setMiscReg(Lo,temp1<31:0>);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x5: msubu({{
|
2006-03-08 10:36:55 +01:00
|
|
|
int64_t temp1 = xc->readMiscReg(Hi) << 32 | xc->readMiscReg(Lo) >> 32;
|
2006-02-08 00:36:08 +01:00
|
|
|
temp1 = temp1 - (Rs.uw * Rt.uw);
|
2006-03-08 10:36:55 +01:00
|
|
|
xc->setMiscReg(Hi,temp1<63:32>);
|
|
|
|
xc->setMiscReg(Lo,temp1<31:0>);
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
0x4: decode FUNCTION_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
format BasicOp {
|
|
|
|
0x0: clz({{
|
2006-03-08 08:05:38 +01:00
|
|
|
/*int cnt = 0;
|
2006-02-08 22:24:04 +01:00
|
|
|
int idx = 0;
|
2006-03-08 08:05:38 +01:00
|
|
|
while ( Rs.uw<idx> != 1) {
|
2006-02-18 09:12:04 +01:00
|
|
|
cnt++;
|
|
|
|
idx--;
|
2006-02-08 22:24:04 +01:00
|
|
|
}
|
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
Rd.uw = cnt;*/
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
2006-02-08 22:24:04 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: clo({{
|
2006-03-08 08:05:38 +01:00
|
|
|
/*int cnt = 0;
|
2006-02-08 22:24:04 +01:00
|
|
|
int idx = 0;
|
2006-03-08 08:05:38 +01:00
|
|
|
while ( Rs.uw<idx> != 0) {
|
2006-02-18 09:12:04 +01:00
|
|
|
cnt++;
|
|
|
|
idx--;
|
2006-02-08 22:24:04 +01:00
|
|
|
}
|
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
Rd.uw = cnt;*/
|
2006-02-18 09:12:04 +01:00
|
|
|
}});
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
0x7: decode FUNCTION_LO {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x7: WarnUnimpl::sdbbp();
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Table A-6 MIPS32 SPECIAL3 Encoding of Function Field for Release 2 of the Architecture
|
|
|
|
0x7: decode FUNCTION_HI {
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: decode FUNCTION_LO {
|
2006-02-08 22:24:04 +01:00
|
|
|
format WarnUnimpl {
|
2006-02-15 04:43:14 +01:00
|
|
|
0x1: ext();
|
|
|
|
0x4: ins();
|
2006-02-08 20:50:07 +01:00
|
|
|
}
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x1: decode FUNCTION_LO {
|
2006-02-14 08:03:14 +01:00
|
|
|
format WarnUnimpl {
|
2006-02-15 04:43:14 +01:00
|
|
|
0x0: fork();
|
|
|
|
0x1: yield();
|
2006-02-14 08:03:14 +01:00
|
|
|
}
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-14 08:03:14 +01:00
|
|
|
|
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
//Table A-10 MIPS32 BSHFL Encoding of sa Field
|
|
|
|
0x4: decode SA {
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-15 04:43:14 +01:00
|
|
|
0x02: WarnUnimpl::wsbh();
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-08 20:50:07 +01:00
|
|
|
format BasicOp {
|
2006-02-08 22:24:04 +01:00
|
|
|
0x10: seb({{ Rd.sw = /* sext32(Rt<7>,24) | */ Rt<7:0>}});
|
|
|
|
0x18: seh({{ Rd.sw = /* sext32(Rt<15>,16) | */ Rt<15:0>}});
|
2006-02-08 20:50:07 +01:00
|
|
|
}
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-18 09:12:04 +01:00
|
|
|
0x6: decode FUNCTION_LO {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x7: BasicOp::rdhwr({{ /*Rt = xc->hwRegs[RD];*/ }});
|
2006-02-18 09:12:04 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x4: decode OPCODE_LO default FailUnimpl::reserved() {
|
2006-02-20 20:30:23 +01:00
|
|
|
format LoadMemory {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x0: lb({{ Rt.sw = Mem.sb; }});
|
|
|
|
0x1: lh({{ Rt.sw = Mem.sh; }});
|
|
|
|
0x2: lwl({{ Rt.sw = Mem.sw; }});//, WordAlign);
|
|
|
|
0x3: lw({{ Rt.sw = Mem.sb; }});
|
|
|
|
0x4: lbu({{ Rt.uw = Mem.ub; }});
|
|
|
|
0x5: lhu({{ Rt.uw = Mem.uh; }});
|
|
|
|
0x6: lwr({{ Rt.uw = Mem.uw; }});//, WordAlign);
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-15 04:43:14 +01:00
|
|
|
0x7: FailUnimpl::reserved();
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x5: decode OPCODE_LO default FailUnimpl::reserved() {
|
2006-02-20 20:30:23 +01:00
|
|
|
format StoreMemory {
|
|
|
|
0x0: sb({{ Mem.ub = Rt<7:0>; }});
|
|
|
|
0x1: sh({{ Mem.uh = Rt<15:0>; }});
|
|
|
|
0x2: swl({{ Mem.ub = Rt<31:0>; }});//,WordAlign);
|
|
|
|
0x3: sw({{ Mem.ub = Rt<31:0>; }});
|
|
|
|
0x6: swr({{ Mem.ub = Rt<31:0>; }});//,WordAlign);
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-08 20:50:07 +01:00
|
|
|
format WarnUnimpl {
|
2006-02-15 04:43:14 +01:00
|
|
|
0x7: cache();
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
|
|
|
0x6: decode OPCODE_LO default FailUnimpl::reserved() {
|
2006-02-18 09:12:04 +01:00
|
|
|
0x0: WarnUnimpl::ll();
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-20 20:30:23 +01:00
|
|
|
format LoadMemory {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x1: lwc1({{ /*F_t<31:0> = Mem.sf; */}});
|
|
|
|
0x5: ldc1({{ /*F_t<63:0> = Mem.df; */}});
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
|
2006-02-08 00:36:08 +01:00
|
|
|
0x7: decode OPCODE_LO default FailUnimpl::reserved() {
|
2006-02-15 04:43:14 +01:00
|
|
|
0x0: WarnUnimpl::sc();
|
2006-02-10 09:27:19 +01:00
|
|
|
|
2006-02-20 20:30:23 +01:00
|
|
|
format StoreMemory {
|
2006-03-08 08:05:38 +01:00
|
|
|
0x1: swc1({{ //Mem.sf = Ft<31:0>; }});
|
|
|
|
0x5: sdc1({{ //Mem.df = Ft<63:0>; }});
|
2006-02-15 04:43:14 +01:00
|
|
|
}
|
2006-02-08 00:36:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|