public override StaticInstruction DecodeMachineInstruction(MachineInstruction machineInstruction) { switch (machineInstruction[BitField.OPCODE_HI]) { case 0x0: switch (machineInstruction[BitField.OPCODE_LO]) { case 0x0: switch (machineInstruction[BitField.FUNC_HI]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x1: switch (machineInstruction[BitField.MOVCI]) { case 0x0: return new FailUnimplemented ("Movf", machineInstruction); case 0x1: return new FailUnimplemented ("Movt", machineInstruction); default: return new Unknown (machineInstruction); } case 0x0: switch (machineInstruction[BitField.RS]) { case 0x0: switch (machineInstruction[BitField.RT_RD]) { case 0x0: switch (machineInstruction[BitField.SA]) { case 0x1: return new FailUnimplemented ("Ssnop", machineInstruction); case 0x3: return new FailUnimplemented ("Ehb", machineInstruction); default: return new Nop (machineInstruction); } default: return new Sll (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.RS_SRL]) { case 0x0: switch (machineInstruction[BitField.SRL]) { case 0x0: return new Srl (machineInstruction); case 0x1: return new FailUnimplemented ("Rotr", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.RS]) { case 0x0: return new Sra (machineInstruction); default: return new Unknown (machineInstruction); } case 0x4: return new Sllv (machineInstruction); case 0x6: switch (machineInstruction[BitField.SRLV]) { case 0x0: return new Srlv (machineInstruction); case 0x1: return new FailUnimplemented ("Rotrv", machineInstruction); default: return new Unknown (machineInstruction); } case 0x7: return new Srav (machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: switch (machineInstruction[BitField.HINT]) { case 0x1: return new FailUnimplemented ("Jr_hb", machineInstruction); default: return new Jr (machineInstruction); } case 0x1: switch (machineInstruction[BitField.HINT]) { case 0x1: return new FailUnimplemented ("Jalr_hb", machineInstruction); default: return new Jalr (machineInstruction); } case 0x2: return new FailUnimplemented ("Movz", machineInstruction); case 0x3: return new FailUnimplemented ("Movn", machineInstruction); case 0x4: return new Syscall (machineInstruction); case 0x7: return new FailUnimplemented ("Sync", machineInstruction); case 0x5: return new FailUnimplemented ("Break", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new Mfhi (machineInstruction); case 0x1: return new Mthi (machineInstruction); case 0x2: return new Mflo (machineInstruction); case 0x3: return new Mtlo (machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new Mult (machineInstruction); case 0x1: return new Multu (machineInstruction); case 0x2: return new Div (machineInstruction); case 0x3: return new Divu (machineInstruction); default: return new Unknown (machineInstruction); } case 0x4: switch (machineInstruction[BitField.HINT]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new Add (machineInstruction); case 0x1: return new Addu (machineInstruction); case 0x2: return new Sub (machineInstruction); case 0x3: return new Subu (machineInstruction); case 0x4: return new And (machineInstruction); case 0x5: return new Or (machineInstruction); case 0x6: return new Xor (machineInstruction); case 0x7: return new Nor (machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x5: switch (machineInstruction[BitField.HINT]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x2: return new Slt (machineInstruction); case 0x3: return new Sltu (machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x6: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Tge", machineInstruction); case 0x1: return new FailUnimplemented ("Tgeu", machineInstruction); case 0x2: return new FailUnimplemented ("Tlt", machineInstruction); case 0x3: return new FailUnimplemented ("Tltu", machineInstruction); case 0x4: return new FailUnimplemented ("Teq", machineInstruction); case 0x6: return new FailUnimplemented ("Tne", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.REGIMM_HI]) { case 0x0: switch (machineInstruction[BitField.REGIMM_LO]) { case 0x0: return new Bltz (machineInstruction); case 0x1: return new Bgez (machineInstruction); case 0x2: return new FailUnimplemented ("Bltzl", machineInstruction); case 0x3: return new FailUnimplemented ("Bgezl", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.REGIMM_LO]) { case 0x0: return new FailUnimplemented ("Tgei", machineInstruction); case 0x1: return new FailUnimplemented ("Tgeiu", machineInstruction); case 0x2: return new FailUnimplemented ("Tlti", machineInstruction); case 0x3: return new FailUnimplemented ("Tltiu", machineInstruction); case 0x4: return new FailUnimplemented ("Teqi", machineInstruction); case 0x6: return new FailUnimplemented ("Tnei", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.REGIMM_LO]) { case 0x0: return new Bltzal (machineInstruction); case 0x1: switch (machineInstruction[BitField.RS]) { case 0x0: return new Bal (machineInstruction); default: return new Bgezal (machineInstruction); } case 0x2: return new FailUnimplemented ("Bltzall", machineInstruction); case 0x3: return new FailUnimplemented ("Bgezall", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.REGIMM_LO]) { case 0x4: return new FailUnimplemented ("Bposge32", machineInstruction); case 0x7: return new FailUnimplemented ("WarnUnimplemented.synci", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x2: return new J (machineInstruction); case 0x3: return new Jal (machineInstruction); case 0x4: switch (machineInstruction[BitField.RS_RT]) { case 0x0: return new B (machineInstruction); default: return new Beq (machineInstruction); } case 0x5: return new Bne (machineInstruction); case 0x6: return new Blez (machineInstruction); case 0x7: return new Bgtz (machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OPCODE_LO]) { case 0x0: return new Addi (machineInstruction); case 0x1: return new Addiu (machineInstruction); case 0x2: return new Slti (machineInstruction); case 0x3: switch (machineInstruction[BitField.RS_RT_INTIMM]) { case 0xabc1: return new FailUnimplemented ("Fail", machineInstruction); case 0xabc2: return new FailUnimplemented ("Pass", machineInstruction); default: return new Sltiu (machineInstruction); } case 0x4: return new Andi (machineInstruction); case 0x5: return new Ori (machineInstruction); case 0x6: return new Xori (machineInstruction); case 0x7: switch (machineInstruction[BitField.RS]) { case 0x0: return new Lui (machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OPCODE_LO]) { case 0x0: switch (machineInstruction[BitField.RS_MSB]) { case 0x0: switch (machineInstruction[BitField.RS]) { case 0x0: return new FailUnimplemented ("Mfc0", machineInstruction); case 0x4: return new FailUnimplemented ("Mtc0", machineInstruction); case 0x1: return new CP0Unimplemented ("dmfc0", machineInstruction); case 0x5: return new CP0Unimplemented ("dmtc0", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); case 0x8: switch (machineInstruction[BitField.MT_U]) { case 0x0: return new FailUnimplemented ("Mftc0", machineInstruction); case 0x1: switch (machineInstruction[BitField.SEL]) { case 0x0: return new FailUnimplemented ("Mftgpr", machineInstruction); case 0x1: switch (machineInstruction[BitField.RT]) { case 0x0: return new FailUnimplemented ("Mftlo_dsp0", machineInstruction); case 0x1: return new FailUnimplemented ("Mfthi_dsp0", machineInstruction); case 0x2: return new FailUnimplemented ("Mftacx_dsp0", machineInstruction); case 0x4: return new FailUnimplemented ("Mftlo_dsp1", machineInstruction); case 0x5: return new FailUnimplemented ("Mfthi_dsp1", machineInstruction); case 0x6: return new FailUnimplemented ("Mftacx_dsp1", machineInstruction); case 0x8: return new FailUnimplemented ("Mftlo_dsp2", machineInstruction); case 0x9: return new FailUnimplemented ("Mfthi_dsp2", machineInstruction); case 0x10: return new FailUnimplemented ("Mftacx_dsp2", machineInstruction); case 0x12: return new FailUnimplemented ("Mftlo_dsp3", machineInstruction); case 0x13: return new FailUnimplemented ("Mfthi_dsp3", machineInstruction); case 0x14: return new FailUnimplemented ("Mftacx_dsp3", machineInstruction); case 0x16: return new FailUnimplemented ("Mftdsp", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); } case 0x2: switch (machineInstruction[BitField.MT_H]) { case 0x0: return new FailUnimplemented ("Mftc1", machineInstruction); case 0x1: return new FailUnimplemented ("Mfthc1", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: return new FailUnimplemented ("Cftc1", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); } default: return new Unknown (machineInstruction); } case 0xc: switch (machineInstruction[BitField.MT_U]) { case 0x0: return new FailUnimplemented ("Mttc0", machineInstruction); case 0x1: switch (machineInstruction[BitField.SEL]) { case 0x0: return new FailUnimplemented ("Mttgpr", machineInstruction); case 0x1: switch (machineInstruction[BitField.RT]) { case 0x0: return new FailUnimplemented ("Mttlo_dsp0", machineInstruction); case 0x1: return new FailUnimplemented ("Mtthi_dsp0", machineInstruction); case 0x2: return new FailUnimplemented ("Mttacx_dsp0", machineInstruction); case 0x4: return new FailUnimplemented ("Mttlo_dsp1", machineInstruction); case 0x5: return new FailUnimplemented ("Mtthi_dsp1", machineInstruction); case 0x6: return new FailUnimplemented ("Mttacx_dsp1", machineInstruction); case 0x8: return new FailUnimplemented ("Mttlo_dsp2", machineInstruction); case 0x9: return new FailUnimplemented ("Mtthi_dsp2", machineInstruction); case 0x10: return new FailUnimplemented ("Mttacx_dsp2", machineInstruction); case 0x12: return new FailUnimplemented ("Mttlo_dsp3", machineInstruction); case 0x13: return new FailUnimplemented ("Mtthi_dsp3", machineInstruction); case 0x14: return new FailUnimplemented ("Mttacx_dsp3", machineInstruction); case 0x16: return new FailUnimplemented ("Mttdsp", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); } case 0x2: return new FailUnimplemented ("Mttc1", machineInstruction); case 0x3: return new FailUnimplemented ("Cttc1", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); } default: return new Unknown (machineInstruction); } case 0xb: switch (machineInstruction[BitField.RD]) { case 0x0: switch (machineInstruction[BitField.POS]) { case 0x0: switch (machineInstruction[BitField.SEL]) { case 0x1: switch (machineInstruction[BitField.SC]) { case 0x0: return new FailUnimplemented ("Dvpe", machineInstruction); case 0x1: return new FailUnimplemented ("Evpe", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); } default: return new CP0Unimplemented ("unknown", machineInstruction); } default: return new CP0Unimplemented ("unknown", machineInstruction); } case 0x1: switch (machineInstruction[BitField.POS]) { case 0xf: switch (machineInstruction[BitField.SEL]) { case 0x1: switch (machineInstruction[BitField.SC]) { case 0x0: return new FailUnimplemented ("Dmt", machineInstruction); case 0x1: return new FailUnimplemented ("Emt", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); } default: return new CP0Unimplemented ("unknown", machineInstruction); } default: return new CP0Unimplemented ("unknown", machineInstruction); } case 0xc: switch (machineInstruction[BitField.POS]) { case 0x0: switch (machineInstruction[BitField.SC]) { case 0x0: return new FailUnimplemented ("Di", machineInstruction); case 0x1: return new FailUnimplemented ("Ei", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); } default: return new Unknown (machineInstruction); } default: return new CP0Unimplemented ("unknown", machineInstruction); } case 0xa: return new FailUnimplemented ("Rdpgpr", machineInstruction); case 0xe: return new FailUnimplemented ("Wrpgpr", machineInstruction); } case 0x1: switch (machineInstruction[BitField.FUNC]) { case 0x18: return new FailUnimplemented ("Eret", machineInstruction); case 0x1f: return new FailUnimplemented ("Deret", machineInstruction); case 0x1: return new FailUnimplemented ("Tlbr", machineInstruction); case 0x2: return new FailUnimplemented ("Tlbwi", machineInstruction); case 0x6: return new FailUnimplemented ("Tlbwr", machineInstruction); case 0x8: return new FailUnimplemented ("Tlbp", machineInstruction); case 0x20: return new CP0Unimplemented ("wait", machineInstruction); default: return new CP0Unimplemented ("unknown", machineInstruction); } default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.RS_MSB]) { case 0x0: switch (machineInstruction[BitField.RS_HI]) { case 0x0: switch (machineInstruction[BitField.RS_LO]) { case 0x0: return new Mfc1 (machineInstruction); case 0x2: return new Cfc1 (machineInstruction); case 0x3: return new FailUnimplemented ("Mfhc1", machineInstruction); case 0x4: return new Mtc1 (machineInstruction); case 0x6: return new Ctc1 (machineInstruction); case 0x7: return new FailUnimplemented ("Mthc1", machineInstruction); case 0x1: return new CP1Unimplemented ("dmfc1", machineInstruction); case 0x5: return new CP1Unimplemented ("dmtc1", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.RS_LO]) { case 0x0: switch (machineInstruction[BitField.ND]) { case 0x0: switch (machineInstruction[BitField.TF]) { case 0x0: return new Bc1f (machineInstruction); case 0x1: return new Bc1t (machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.TF]) { case 0x0: return new Bc1fl (machineInstruction); case 0x1: return new Bc1tl (machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x1: return new CP1Unimplemented ("bc1any2", machineInstruction); case 0x2: return new CP1Unimplemented ("bc1any4", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.RS_HI]) { case 0x2: switch (machineInstruction[BitField.RS_LO]) { case 0x0: switch (machineInstruction[BitField.FUNC_HI]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new Add_s (machineInstruction); case 0x1: return new Sub_s (machineInstruction); case 0x2: return new Mul_s (machineInstruction); case 0x3: return new Div_s (machineInstruction); case 0x4: return new Sqrt_s (machineInstruction); case 0x5: return new Abs_s (machineInstruction); case 0x7: return new Neg_s (machineInstruction); case 0x6: return new Mov_s (machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Round_l_s", machineInstruction); case 0x1: return new FailUnimplemented ("Trunc_l_s", machineInstruction); case 0x2: return new FailUnimplemented ("Ceil_l_s", machineInstruction); case 0x3: return new FailUnimplemented ("Floor_l_s", machineInstruction); case 0x4: return new FailUnimplemented ("Round_w_s", machineInstruction); case 0x5: return new FailUnimplemented ("Trunc_w_s", machineInstruction); case 0x6: return new FailUnimplemented ("Ceil_w_s", machineInstruction); case 0x7: return new FailUnimplemented ("Floor_w_s", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.FUNC_LO]) { case 0x1: switch (machineInstruction[BitField.MOVCF]) { case 0x0: return new FailUnimplemented ("Movf_s", machineInstruction); case 0x1: return new FailUnimplemented ("Movt_s", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: return new FailUnimplemented ("Movz_s", machineInstruction); case 0x3: return new FailUnimplemented ("Movn_s", machineInstruction); case 0x5: return new FailUnimplemented ("Recip_s", machineInstruction); case 0x6: return new FailUnimplemented ("Rsqrt_s", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x3: return new CP1Unimplemented ("unknown", machineInstruction); case 0x4: switch (machineInstruction[BitField.FUNC_LO]) { case 0x1: return new Cvt_d_s (machineInstruction); case 0x4: return new Cvt_w_s (machineInstruction); case 0x5: return new Cvt_l_s (machineInstruction); case 0x6: return new FailUnimplemented ("Cvt_ps_s", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x5: return new CP1Unimplemented ("unknown", machineInstruction); case 0x6: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new C_f_s (machineInstruction); case 0x1: return new C_un_s (machineInstruction); case 0x2: return new C_eq_s (machineInstruction); case 0x3: return new C_ueq_s (machineInstruction); case 0x4: return new C_olt_s (machineInstruction); case 0x5: return new C_ult_s (machineInstruction); case 0x6: return new C_ole_s (machineInstruction); case 0x7: return new C_ule_s (machineInstruction); default: return new Unknown (machineInstruction); } case 0x7: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new C_sf_s (machineInstruction); case 0x1: return new C_ngle_s (machineInstruction); case 0x2: return new C_seq_s (machineInstruction); case 0x3: return new C_ngl_s (machineInstruction); case 0x4: return new C_lt_s (machineInstruction); case 0x5: return new C_nge_s (machineInstruction); case 0x6: return new C_le_s (machineInstruction); case 0x7: return new C_ngt_s (machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.FUNC_HI]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new Add_d (machineInstruction); case 0x1: return new Sub_d (machineInstruction); case 0x2: return new Mul_d (machineInstruction); case 0x3: return new Div_d (machineInstruction); case 0x4: return new Sqrt_d (machineInstruction); case 0x5: return new Abs_d (machineInstruction); case 0x7: return new Neg_d (machineInstruction); case 0x6: return new Mov_d (machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Round_l_d", machineInstruction); case 0x1: return new FailUnimplemented ("Trunc_l_d", machineInstruction); case 0x2: return new FailUnimplemented ("Ceil_l_d", machineInstruction); case 0x3: return new FailUnimplemented ("Floor_l_d", machineInstruction); case 0x4: return new FailUnimplemented ("Round_w_d", machineInstruction); case 0x5: return new FailUnimplemented ("Trunc_w_d", machineInstruction); case 0x6: return new FailUnimplemented ("Ceil_w_d", machineInstruction); case 0x7: return new FailUnimplemented ("Floor_w_d", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.FUNC_LO]) { case 0x1: switch (machineInstruction[BitField.MOVCF]) { case 0x0: return new FailUnimplemented ("Movf_d", machineInstruction); case 0x1: return new FailUnimplemented ("Movt_d", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: return new FailUnimplemented ("Movz_d", machineInstruction); case 0x3: return new FailUnimplemented ("Movn_d", machineInstruction); case 0x5: return new FailUnimplemented ("Recip_d", machineInstruction); case 0x6: return new FailUnimplemented ("Rsqrt_d", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x4: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new Cvt_s_d (machineInstruction); case 0x4: return new Cvt_w_d (machineInstruction); case 0x5: return new Cvt_l_d (machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x6: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new C_f_d (machineInstruction); case 0x1: return new C_un_d (machineInstruction); case 0x2: return new C_eq_d (machineInstruction); case 0x3: return new C_ueq_d (machineInstruction); case 0x4: return new C_olt_d (machineInstruction); case 0x5: return new C_ult_d (machineInstruction); case 0x6: return new C_ole_d (machineInstruction); case 0x7: return new C_ule_d (machineInstruction); default: return new Unknown (machineInstruction); } case 0x7: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new C_sf_d (machineInstruction); case 0x1: return new C_ngle_d (machineInstruction); case 0x2: return new C_seq_d (machineInstruction); case 0x3: return new C_ngl_d (machineInstruction); case 0x4: return new C_lt_d (machineInstruction); case 0x5: return new C_nge_d (machineInstruction); case 0x6: return new C_le_d (machineInstruction); case 0x7: return new C_ngt_d (machineInstruction); default: return new Unknown (machineInstruction); } default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x2: return new CP1Unimplemented ("unknown", machineInstruction); case 0x3: return new CP1Unimplemented ("unknown", machineInstruction); case 0x7: return new CP1Unimplemented ("unknown", machineInstruction); case 0x4: switch (machineInstruction[BitField.FUNC]) { case 0x20: return new Cvt_s_w (machineInstruction); case 0x21: return new Cvt_d_w (machineInstruction); case 0x26: return new CP1Unimplemented ("cvt_ps_w", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x5: switch (machineInstruction[BitField.FUNC_HI]) { case 0x20: return new Cvt_s_l (machineInstruction); case 0x21: return new Cvt_d_l (machineInstruction); case 0x26: return new CP1Unimplemented ("cvt_ps_l", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x6: switch (machineInstruction[BitField.FUNC_HI]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Add_ps", machineInstruction); case 0x1: return new FailUnimplemented ("Sub_ps", machineInstruction); case 0x2: return new FailUnimplemented ("Mul_ps", machineInstruction); case 0x5: return new FailUnimplemented ("Abs_ps", machineInstruction); case 0x6: return new FailUnimplemented ("Mov_ps", machineInstruction); case 0x7: return new FailUnimplemented ("Neg_ps", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x1: return new CP1Unimplemented ("unknown", machineInstruction); case 0x2: switch (machineInstruction[BitField.FUNC_LO]) { case 0x1: switch (machineInstruction[BitField.MOVCF]) { case 0x0: return new FailUnimplemented ("Movf_ps", machineInstruction); case 0x1: return new FailUnimplemented ("Movt_ps", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: return new FailUnimplemented ("Movz_ps", machineInstruction); case 0x3: return new FailUnimplemented ("Movn_ps", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x3: return new CP1Unimplemented ("unknown", machineInstruction); case 0x4: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Cvt_s_pu", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x5: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Cvt_s_pl", machineInstruction); case 0x4: return new FailUnimplemented ("Pll", machineInstruction); case 0x5: return new FailUnimplemented ("Plu", machineInstruction); case 0x6: return new FailUnimplemented ("Pul", machineInstruction); case 0x7: return new FailUnimplemented ("Puu", machineInstruction); default: return new CP1Unimplemented ("unknown", machineInstruction); } case 0x6: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("C_f_ps", machineInstruction); case 0x1: return new FailUnimplemented ("C_un_ps", machineInstruction); case 0x2: return new FailUnimplemented ("C_eq_ps", machineInstruction); case 0x3: return new FailUnimplemented ("C_ueq_ps", machineInstruction); case 0x4: return new FailUnimplemented ("C_olt_ps", machineInstruction); case 0x5: return new FailUnimplemented ("C_ult_ps", machineInstruction); case 0x6: return new FailUnimplemented ("C_ole_ps", machineInstruction); case 0x7: return new FailUnimplemented ("C_ule_ps", machineInstruction); default: return new Unknown (machineInstruction); } case 0x7: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("C_sf_ps", machineInstruction); case 0x1: return new FailUnimplemented ("C_ngle_ps", machineInstruction); case 0x2: return new FailUnimplemented ("C_seq_ps", machineInstruction); case 0x3: return new FailUnimplemented ("C_ngl_ps", machineInstruction); case 0x4: return new FailUnimplemented ("C_lt_ps", machineInstruction); case 0x5: return new FailUnimplemented ("C_nge_ps", machineInstruction); case 0x6: return new FailUnimplemented ("C_le_ps", machineInstruction); case 0x7: return new FailUnimplemented ("C_ngt_ps", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } default: return new CP1Unimplemented ("unknown", machineInstruction); } default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.RS_MSB]) { case 0x0: switch (machineInstruction[BitField.RS_HI]) { case 0x0: switch (machineInstruction[BitField.RS_LO]) { case 0x0: return new CP2Unimplemented ("mfc2", machineInstruction); case 0x2: return new CP2Unimplemented ("cfc2", machineInstruction); case 0x3: return new CP2Unimplemented ("mfhc2", machineInstruction); case 0x4: return new CP2Unimplemented ("mtc2", machineInstruction); case 0x6: return new CP2Unimplemented ("ctc2", machineInstruction); case 0x7: return new CP2Unimplemented ("mftc2", machineInstruction); default: return new CP2Unimplemented ("unknown", machineInstruction); } case 0x1: switch (machineInstruction[BitField.ND]) { case 0x0: switch (machineInstruction[BitField.TF]) { case 0x0: return new CP2Unimplemented ("bc2f", machineInstruction); case 0x1: return new CP2Unimplemented ("bc2t", machineInstruction); default: return new CP2Unimplemented ("unknown", machineInstruction); } case 0x1: switch (machineInstruction[BitField.TF]) { case 0x0: return new CP2Unimplemented ("bc2fl", machineInstruction); case 0x1: return new CP2Unimplemented ("bc2tl", machineInstruction); default: return new CP2Unimplemented ("unknown", machineInstruction); } default: return new CP2Unimplemented ("unknown", machineInstruction); } default: return new CP2Unimplemented ("unknown", machineInstruction); } default: return new CP2Unimplemented ("unknown", machineInstruction); } case 0x3: switch (machineInstruction[BitField.FUNC_HI]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Lwxc1", machineInstruction); case 0x1: return new FailUnimplemented ("Ldxc1", machineInstruction); case 0x5: return new FailUnimplemented ("Luxc1", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Swxc1", machineInstruction); case 0x1: return new FailUnimplemented ("Sdxc1", machineInstruction); case 0x5: return new FailUnimplemented ("Suxc1", machineInstruction); case 0x7: return new FailUnimplemented ("Prefx", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.FUNC_LO]) { case 0x6: return new FailUnimplemented ("Alnv_ps", machineInstruction); default: return new Unknown (machineInstruction); } case 0x4: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Madd_s", machineInstruction); case 0x1: return new FailUnimplemented ("Madd_d", machineInstruction); case 0x6: return new FailUnimplemented ("Madd_ps", machineInstruction); default: return new Unknown (machineInstruction); } case 0x5: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Msub_s", machineInstruction); case 0x1: return new FailUnimplemented ("Msub_d", machineInstruction); case 0x6: return new FailUnimplemented ("Msub_ps", machineInstruction); default: return new Unknown (machineInstruction); } case 0x6: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Nmadd_s", machineInstruction); case 0x1: return new FailUnimplemented ("Nmadd_d", machineInstruction); case 0x6: return new FailUnimplemented ("Nmadd_ps", machineInstruction); default: return new Unknown (machineInstruction); } case 0x7: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Nmsub_s", machineInstruction); case 0x1: return new FailUnimplemented ("Nmsub_d", machineInstruction); case 0x6: return new FailUnimplemented ("Nmsub_ps", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x4: return new FailUnimplemented ("Beql", machineInstruction); case 0x5: return new FailUnimplemented ("Bnel", machineInstruction); case 0x6: return new FailUnimplemented ("Blezl", machineInstruction); case 0x7: return new FailUnimplemented ("Bgtzl", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OPCODE_LO]) { case 0x4: switch (machineInstruction[BitField.FUNC_HI]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x2: return new FailUnimplemented ("Mul", machineInstruction); case 0x0: return new FailUnimplemented ("Madd", machineInstruction); case 0x1: return new FailUnimplemented ("Maddu", machineInstruction); case 0x4: return new FailUnimplemented ("Msub", machineInstruction); case 0x5: return new FailUnimplemented ("Msubu", machineInstruction); default: return new Unknown (machineInstruction); } case 0x4: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Clz", machineInstruction); case 0x1: return new FailUnimplemented ("Clo", machineInstruction); default: return new Unknown (machineInstruction); } case 0x7: switch (machineInstruction[BitField.FUNC_LO]) { case 0x7: return new FailUnimplemented ("sdbbp", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x7: switch (machineInstruction[BitField.FUNC_HI]) { case 0x0: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Ext", machineInstruction); case 0x4: return new FailUnimplemented ("Ins", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: return new FailUnimplemented ("Fork", machineInstruction); case 0x1: return new FailUnimplemented ("Yield", machineInstruction); case 0x2: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Lwx", machineInstruction); case 0x4: return new FailUnimplemented ("Lhx", machineInstruction); case 0x6: return new FailUnimplemented ("Lbux", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x4: return new FailUnimplemented ("Insv", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Addu_qb", machineInstruction); case 0x1: return new FailUnimplemented ("Subu_qb", machineInstruction); case 0x4: return new FailUnimplemented ("Addu_s_qb", machineInstruction); case 0x5: return new FailUnimplemented ("Subu_s_qb", machineInstruction); case 0x6: return new FailUnimplemented ("Muleu_s_ph_qbl", machineInstruction); case 0x7: return new FailUnimplemented ("Muleu_s_ph_qbr", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Addu_ph", machineInstruction); case 0x1: return new FailUnimplemented ("Subu_ph", machineInstruction); case 0x2: return new FailUnimplemented ("Addq_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Subq_ph", machineInstruction); case 0x4: return new FailUnimplemented ("Addu_s_ph", machineInstruction); case 0x5: return new FailUnimplemented ("Subu_s_ph", machineInstruction); case 0x6: return new FailUnimplemented ("Addq_s_ph", machineInstruction); case 0x7: return new FailUnimplemented ("Subq_s_ph", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Addsc", machineInstruction); case 0x1: return new FailUnimplemented ("Addwc", machineInstruction); case 0x2: return new FailUnimplemented ("Modsub", machineInstruction); case 0x4: return new FailUnimplemented ("Raddu_w_qb", machineInstruction); case 0x6: return new FailUnimplemented ("Addq_s_w", machineInstruction); case 0x7: return new FailUnimplemented ("Subq_s_w", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OP_LO]) { case 0x4: return new FailUnimplemented ("Muleq_s_w_phl", machineInstruction); case 0x5: return new FailUnimplemented ("Muleq_s_w_phr", machineInstruction); case 0x6: return new FailUnimplemented ("Mulq_s_ph", machineInstruction); case 0x7: return new FailUnimplemented ("Mulq_rs_ph", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Cmpu_eq_qb", machineInstruction); case 0x1: return new FailUnimplemented ("Cmpu_lt_qb", machineInstruction); case 0x2: return new FailUnimplemented ("Cmpu_le_qb", machineInstruction); case 0x3: return new FailUnimplemented ("Pick_qb", machineInstruction); case 0x4: return new FailUnimplemented ("Cmpgu_eq_qb", machineInstruction); case 0x5: return new FailUnimplemented ("Cmpgu_lt_qb", machineInstruction); case 0x6: return new FailUnimplemented ("Cmpgu_le_qb", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Cmp_eq_ph", machineInstruction); case 0x1: return new FailUnimplemented ("Cmp_lt_ph", machineInstruction); case 0x2: return new FailUnimplemented ("Cmp_le_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Pick_ph", machineInstruction); case 0x4: return new FailUnimplemented ("Precrq_qb_ph", machineInstruction); case 0x5: return new FailUnimplemented ("Precr_qb_ph", machineInstruction); case 0x6: return new FailUnimplemented ("Packrl_ph", machineInstruction); case 0x7: return new FailUnimplemented ("Precrqu_s_qb_ph", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_LO]) { case 0x4: return new FailUnimplemented ("Precrq_ph_w", machineInstruction); case 0x5: return new FailUnimplemented ("Precrq_rs_ph_w", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Cmpgdu_eq_qb", machineInstruction); case 0x1: return new FailUnimplemented ("Cmpgdu_lt_qb", machineInstruction); case 0x2: return new FailUnimplemented ("Cmpgdu_le_qb", machineInstruction); case 0x6: return new FailUnimplemented ("Precr_sra_ph_w", machineInstruction); case 0x7: return new FailUnimplemented ("Precr_sra_r_ph_w", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x1: return new FailUnimplemented ("Absq_s_qb", machineInstruction); case 0x2: return new FailUnimplemented ("Repl_qb", machineInstruction); case 0x3: return new FailUnimplemented ("Replv_qb", machineInstruction); case 0x4: return new FailUnimplemented ("Precequ_ph_qbl", machineInstruction); case 0x5: return new FailUnimplemented ("Precequ_ph_qbr", machineInstruction); case 0x6: return new FailUnimplemented ("Precequ_ph_qbla", machineInstruction); case 0x7: return new FailUnimplemented ("Precequ_ph_qbra", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_LO]) { case 0x1: return new FailUnimplemented ("Absq_s_ph", machineInstruction); case 0x2: return new FailUnimplemented ("Repl_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Replv_ph", machineInstruction); case 0x4: return new FailUnimplemented ("Preceq_w_phl", machineInstruction); case 0x5: return new FailUnimplemented ("Preceq_w_phr", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_LO]) { case 0x1: return new FailUnimplemented ("Absq_s_w", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OP_LO]) { case 0x3: return new FailUnimplemented ("Bitrev", machineInstruction); case 0x4: return new FailUnimplemented ("Preceu_ph_qbl", machineInstruction); case 0x5: return new FailUnimplemented ("Preceu_ph_qbr", machineInstruction); case 0x6: return new FailUnimplemented ("Preceu_ph_qbla", machineInstruction); case 0x7: return new FailUnimplemented ("Preceu_ph_qbra", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Shll_qb", machineInstruction); case 0x1: return new FailUnimplemented ("Shrl_qb", machineInstruction); case 0x2: return new FailUnimplemented ("Shllv_qb", machineInstruction); case 0x3: return new FailUnimplemented ("Shrlv_qb", machineInstruction); case 0x4: return new FailUnimplemented ("Shra_qb", machineInstruction); case 0x5: return new FailUnimplemented ("Shra_r_qb", machineInstruction); case 0x6: return new FailUnimplemented ("Shrav_qb", machineInstruction); case 0x7: return new FailUnimplemented ("Shrav_r_qb", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Shll_ph", machineInstruction); case 0x1: return new FailUnimplemented ("Shra_ph", machineInstruction); case 0x2: return new FailUnimplemented ("Shllv_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Shrav_ph", machineInstruction); case 0x4: return new FailUnimplemented ("Shll_s_ph", machineInstruction); case 0x5: return new FailUnimplemented ("Shra_r_ph", machineInstruction); case 0x6: return new FailUnimplemented ("Shllv_s_ph", machineInstruction); case 0x7: return new FailUnimplemented ("Shrav_r_ph", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_LO]) { case 0x4: return new FailUnimplemented ("Shll_s_w", machineInstruction); case 0x5: return new FailUnimplemented ("Shra_r_w", machineInstruction); case 0x6: return new FailUnimplemented ("Shllv_s_w", machineInstruction); case 0x7: return new FailUnimplemented ("Shrav_r_w", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OP_LO]) { case 0x1: return new FailUnimplemented ("Shrl_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Shrlv_ph", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Adduh_qb", machineInstruction); case 0x1: return new FailUnimplemented ("Subuh_qb", machineInstruction); case 0x2: return new FailUnimplemented ("Adduh_r_qb", machineInstruction); case 0x3: return new FailUnimplemented ("Subuh_r_qb", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Addqh_ph", machineInstruction); case 0x1: return new FailUnimplemented ("Subqh_ph", machineInstruction); case 0x2: return new FailUnimplemented ("Addqh_r_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Subqh_r_ph", machineInstruction); case 0x4: return new FailUnimplemented ("Mul_ph", machineInstruction); case 0x6: return new FailUnimplemented ("Mul_s_ph", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Addqh_w", machineInstruction); case 0x1: return new FailUnimplemented ("Subqh_w", machineInstruction); case 0x2: return new FailUnimplemented ("Addqh_r_w", machineInstruction); case 0x3: return new FailUnimplemented ("Subqh_r_w", machineInstruction); case 0x6: return new FailUnimplemented ("Mulq_s_w", machineInstruction); case 0x7: return new FailUnimplemented ("Mulq_rs_w", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x4: switch (machineInstruction[BitField.SA]) { case 0x2: return new FailUnimplemented ("Wsbh", machineInstruction); case 0x10: return new FailUnimplemented ("Seb", machineInstruction); case 0x18: return new FailUnimplemented ("Seh", machineInstruction); default: return new Unknown (machineInstruction); } case 0x6: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Dpa_w_ph", machineInstruction); case 0x1: return new FailUnimplemented ("Dps_w_ph", machineInstruction); case 0x2: return new FailUnimplemented ("Mulsa_w_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Dpau_h_qbl", machineInstruction); case 0x4: return new FailUnimplemented ("Dpaq_s_w_ph", machineInstruction); case 0x5: return new FailUnimplemented ("Dpsq_s_w_ph", machineInstruction); case 0x6: return new FailUnimplemented ("Mulsaq_s_w_ph", machineInstruction); case 0x7: return new FailUnimplemented ("Dpau_h_qbr", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Dpax_w_ph", machineInstruction); case 0x1: return new FailUnimplemented ("Dpsx_w_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Dpsu_h_qbl", machineInstruction); case 0x4: return new FailUnimplemented ("Dpaq_sa_l_w", machineInstruction); case 0x5: return new FailUnimplemented ("Dpsq_sa_l_w", machineInstruction); case 0x7: return new FailUnimplemented ("Dpsu_h_qbr", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Maq_sa_w_phl", machineInstruction); case 0x2: return new FailUnimplemented ("Maq_sa_w_phr", machineInstruction); case 0x4: return new FailUnimplemented ("Maq_s_w_phl", machineInstruction); case 0x6: return new FailUnimplemented ("Maq_s_w_phr", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Dpaqx_s_w_ph", machineInstruction); case 0x1: return new FailUnimplemented ("Dpsqx_s_w_ph", machineInstruction); case 0x2: return new FailUnimplemented ("Dpaqx_sa_w_ph", machineInstruction); case 0x3: return new FailUnimplemented ("Dpsqx_sa_w_ph", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Append", machineInstruction); case 0x1: return new FailUnimplemented ("Prepend", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Balign", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x7: switch (machineInstruction[BitField.FUNC_LO]) { case 0x0: switch (machineInstruction[BitField.OP_HI]) { case 0x0: switch (machineInstruction[BitField.OP_LO]) { case 0x0: return new FailUnimplemented ("Extr_w", machineInstruction); case 0x1: return new FailUnimplemented ("Extrv_w", machineInstruction); case 0x2: return new FailUnimplemented ("Extp", machineInstruction); case 0x3: return new FailUnimplemented ("Extpv", machineInstruction); case 0x4: return new FailUnimplemented ("Extr_r_w", machineInstruction); case 0x5: return new FailUnimplemented ("Extrv_r_w", machineInstruction); case 0x6: return new FailUnimplemented ("Extr_rs_w", machineInstruction); case 0x7: return new FailUnimplemented ("Extrv_rs_w", machineInstruction); default: return new Unknown (machineInstruction); } case 0x1: switch (machineInstruction[BitField.OP_LO]) { case 0x2: return new FailUnimplemented ("Extpdp", machineInstruction); case 0x3: return new FailUnimplemented ("Extpdpv", machineInstruction); case 0x6: return new FailUnimplemented ("Extr_s_h", machineInstruction); case 0x7: return new FailUnimplemented ("Extrv_s_h", machineInstruction); default: return new Unknown (machineInstruction); } case 0x2: switch (machineInstruction[BitField.OP_LO]) { case 0x2: return new FailUnimplemented ("Rddsp", machineInstruction); case 0x3: return new FailUnimplemented ("Wrdsp", machineInstruction); default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OP_LO]) { case 0x2: return new FailUnimplemented ("Shilo", machineInstruction); case 0x3: return new FailUnimplemented ("Shilov", machineInstruction); case 0x7: return new FailUnimplemented ("Mthlip", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x3: switch (machineInstruction[BitField.OP]) { case 0x0: switch (machineInstruction[BitField.RD]) { case 0x1d: return new FailUnimplemented ("Rdhwr", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } case 0x4: switch (machineInstruction[BitField.OPCODE_LO]) { case 0x0: return new Lb (machineInstruction); case 0x1: return new Lh (machineInstruction); case 0x3: return new Lw (machineInstruction); case 0x4: return new Lbu (machineInstruction); case 0x5: return new Lhu (machineInstruction); case 0x2: return new Lwl (machineInstruction); case 0x6: return new Lwr (machineInstruction); default: return new Unknown (machineInstruction); } case 0x5: switch (machineInstruction[BitField.OPCODE_LO]) { case 0x0: return new Sb (machineInstruction); case 0x1: return new Sh (machineInstruction); case 0x3: return new Sw (machineInstruction); case 0x2: return new Swl (machineInstruction); case 0x6: return new Swr (machineInstruction); case 0x7: return new FailUnimplemented ("Cache", machineInstruction); default: return new Unknown (machineInstruction); } case 0x6: switch (machineInstruction[BitField.OPCODE_LO]) { case 0x0: return new Ll (machineInstruction); case 0x1: return new Lwc1 (machineInstruction); case 0x5: return new Ldc1 (machineInstruction); case 0x2: return new CP2Unimplemented ("lwc2", machineInstruction); case 0x6: return new CP2Unimplemented ("ldc2", machineInstruction); case 0x3: return new FailUnimplemented ("Pref", machineInstruction); default: return new Unknown (machineInstruction); } case 0x7: switch (machineInstruction[BitField.OPCODE_LO]) { case 0x0: return new Sc (machineInstruction); case 0x1: return new Swc1 (machineInstruction); case 0x5: return new Sdc1 (machineInstruction); case 0x2: return new CP2Unimplemented ("swc2", machineInstruction); case 0x6: return new CP2Unimplemented ("sdc2", machineInstruction); default: return new Unknown (machineInstruction); } default: return new Unknown (machineInstruction); } }
public StaticInstruction(string mnemonic, MachineInstruction machineInstruction, Flag flags, FunctionalUnit.Types fuType) { this.Mnemonic = mnemonic; this.MachineInstruction = machineInstruction; this.Flags = flags; this.FunctionalUnitType = fuType; this.IDeps = new List<RegisterDependency> (); this.ODeps = new List<RegisterDependency> (); this.SetupDeps (); }
public StaticInstruction Decode(uint pc, Memory mem) { if (this.DecodedStaticInstructions.ContainsKey (pc)) { return this.DecodedStaticInstructions[pc]; } else { uint data = mem.ReadWord (pc); MachineInstruction machineInstruction = new MachineInstruction (data); StaticInstruction staticInstruction = this.DecodeMachineInstruction (machineInstruction); this.DecodedStaticInstructions[pc] = staticInstruction; return staticInstruction; } }
public abstract StaticInstruction DecodeMachineInstruction(MachineInstruction machineInstruction);
public static string Disassemble(MachineInstruction machineInstruction, uint pc, IThread thread) { StringBuilder buf = new StringBuilder (); buf.AppendFormat ("0x{0:x8} : 0x{1:x8} {2} ", pc, machineInstruction.Data, thread.Core.Isa.DecodeMachineInstruction (machineInstruction).Mnemonic); if (machineInstruction.Data == 0x00000000) { return buf.ToString (); } switch (machineInstruction.MachineInstructionType) { case MachineInstruction.Types.J: buf.AppendFormat ("0x{0:x8}", machineInstruction[BitField.JMPTARG]); break; case MachineInstruction.Types.I: if (machineInstruction.IsOneOpBranch) { buf.AppendFormat ("${0}, {1:d}", MIPS_GPR_NAMES[machineInstruction[BitField.RS]], (short)machineInstruction[BitField.INTIMM]); } else if (machineInstruction.IsLoadStore) { buf.AppendFormat ("${0}, {1:d}(${2})", MIPS_GPR_NAMES[machineInstruction[BitField.RT]], (short)machineInstruction[BitField.INTIMM], MIPS_GPR_NAMES[machineInstruction[BitField.RS]]); } else if (machineInstruction.IsFloatLoadStore) { buf.AppendFormat ("$f{0}, {1:d}(${2})", machineInstruction[BitField.FT], (short)machineInstruction[BitField.INTIMM], MIPS_GPR_NAMES[machineInstruction[BitField.RS]]); } else { buf.AppendFormat ("${0}, ${1}, {2:d}", MIPS_GPR_NAMES[machineInstruction[BitField.RT]], MIPS_GPR_NAMES[machineInstruction[BitField.RS]], (short)machineInstruction[BitField.INTIMM]); } break; case MachineInstruction.Types.F: if (machineInstruction.IsConvert) { buf.AppendFormat ("$f{0:d}, $f{1:d}", machineInstruction[BitField.FD], machineInstruction[BitField.FS]); } else if (machineInstruction.IsCompare) { buf.AppendFormat ("{0:d}, $f{1:d}, $f{2:d}", machineInstruction[BitField.FD] >> 2, machineInstruction[BitField.FS], machineInstruction[BitField.FT]); } else if (machineInstruction.IsFloatBranch) { buf.AppendFormat ("{0:d}, {1:d}", machineInstruction[BitField.FD] >> 2, (short)machineInstruction[BitField.INTIMM]); } else if (machineInstruction.IsGPRFloatMove) { buf.AppendFormat ("${0}, $f{1:d}", MIPS_GPR_NAMES[machineInstruction[BitField.RT]], machineInstruction[BitField.FS]); } else if (machineInstruction.IsGPRFCRMove) { buf.AppendFormat ("${0}, ${1:d}", MIPS_GPR_NAMES[machineInstruction[BitField.RT]], machineInstruction[BitField.FS]); } else { buf.AppendFormat ("$f{0:d}, $f{1:d}, $f{2:d}", machineInstruction[BitField.FD], machineInstruction[BitField.FS], machineInstruction[BitField.FT]); } break; case MachineInstruction.Types.R: if (machineInstruction.IsSyscall) { } else if (machineInstruction.IsShift) { buf.AppendFormat ("${0}, ${1}, {2:d}", MIPS_GPR_NAMES[machineInstruction[BitField.RD]], MIPS_GPR_NAMES[machineInstruction[BitField.RT]], machineInstruction[BitField.SA]); } else if (machineInstruction.IsROneOp) { buf.AppendFormat ("${0}", MIPS_GPR_NAMES[machineInstruction[BitField.RS]]); } else if (machineInstruction.IsRTwoOp) { buf.AppendFormat ("${0}, ${1}", MIPS_GPR_NAMES[machineInstruction[BitField.RS]], MIPS_GPR_NAMES[machineInstruction[BitField.RT]]); } else if (machineInstruction.IsRMt) { buf.AppendFormat ("${0}", MIPS_GPR_NAMES[machineInstruction[BitField.RS]]); } else if (machineInstruction.IsRMf) { buf.AppendFormat ("${0}", MIPS_GPR_NAMES[machineInstruction[BitField.RD]]); } else { buf.AppendFormat ("${0}, ${1}, ${2}", MIPS_GPR_NAMES[machineInstruction[BitField.RD]], MIPS_GPR_NAMES[machineInstruction[BitField.RS]], MIPS_GPR_NAMES[machineInstruction[BitField.RT]]); } break; default: Logger.Fatal (Logger.Categories.Instruction, "you can not reach here"); break; } return buf.ToString (); }