|
@@ -6,6 +6,7 @@
|
|
|
------------------------------------------------------------------------------
|
|
|
|
|
|
local mips64 = mips64
|
|
|
+local mipsr6 = _map_def.MIPSR6
|
|
|
|
|
|
-- Module information:
|
|
|
local _info = {
|
|
@@ -238,7 +239,6 @@ local map_op = {
|
|
|
bne_3 = "14000000STB",
|
|
|
blez_2 = "18000000SB",
|
|
|
bgtz_2 = "1c000000SB",
|
|
|
- addi_3 = "20000000TSI",
|
|
|
li_2 = "24000000TI",
|
|
|
addiu_3 = "24000000TSI",
|
|
|
slti_3 = "28000000TSI",
|
|
@@ -248,40 +248,22 @@ local map_op = {
|
|
|
ori_3 = "34000000TSU",
|
|
|
xori_3 = "38000000TSU",
|
|
|
lui_2 = "3c000000TU",
|
|
|
- beqzl_2 = "50000000SB",
|
|
|
- beql_3 = "50000000STB",
|
|
|
- bnezl_2 = "54000000SB",
|
|
|
- bnel_3 = "54000000STB",
|
|
|
- blezl_2 = "58000000SB",
|
|
|
- bgtzl_2 = "5c000000SB",
|
|
|
- daddi_3 = mips64 and "60000000TSI",
|
|
|
daddiu_3 = mips64 and "64000000TSI",
|
|
|
ldl_2 = mips64 and "68000000TO",
|
|
|
ldr_2 = mips64 and "6c000000TO",
|
|
|
lb_2 = "80000000TO",
|
|
|
lh_2 = "84000000TO",
|
|
|
- lwl_2 = "88000000TO",
|
|
|
lw_2 = "8c000000TO",
|
|
|
lbu_2 = "90000000TO",
|
|
|
lhu_2 = "94000000TO",
|
|
|
- lwr_2 = "98000000TO",
|
|
|
lwu_2 = mips64 and "9c000000TO",
|
|
|
sb_2 = "a0000000TO",
|
|
|
sh_2 = "a4000000TO",
|
|
|
- swl_2 = "a8000000TO",
|
|
|
sw_2 = "ac000000TO",
|
|
|
- sdl_2 = mips64 and "b0000000TO",
|
|
|
- sdr_2 = mips64 and "b1000000TO",
|
|
|
- swr_2 = "b8000000TO",
|
|
|
- cache_2 = "bc000000NO",
|
|
|
- ll_2 = "c0000000TO",
|
|
|
lwc1_2 = "c4000000HO",
|
|
|
- pref_2 = "cc000000NO",
|
|
|
ldc1_2 = "d4000000HO",
|
|
|
ld_2 = mips64 and "dc000000TO",
|
|
|
- sc_2 = "e0000000TO",
|
|
|
swc1_2 = "e4000000HO",
|
|
|
- scd_2 = mips64 and "f0000000TO",
|
|
|
sdc1_2 = "f4000000HO",
|
|
|
sd_2 = mips64 and "fc000000TO",
|
|
|
|
|
@@ -289,10 +271,6 @@ local map_op = {
|
|
|
nop_0 = "00000000",
|
|
|
sll_3 = "00000000DTA",
|
|
|
sextw_2 = "00000000DT",
|
|
|
- movf_2 = "00000001DS",
|
|
|
- movf_3 = "00000001DSC",
|
|
|
- movt_2 = "00010001DS",
|
|
|
- movt_3 = "00010001DSC",
|
|
|
srl_3 = "00000002DTA",
|
|
|
rotr_3 = "00200002DTA",
|
|
|
sra_3 = "00000003DTA",
|
|
@@ -301,31 +279,16 @@ local map_op = {
|
|
|
rotrv_3 = "00000046DTS",
|
|
|
drotrv_3 = mips64 and "00000056DTS",
|
|
|
srav_3 = "00000007DTS",
|
|
|
- jr_1 = "00000008S",
|
|
|
jalr_1 = "0000f809S",
|
|
|
jalr_2 = "00000009DS",
|
|
|
- movz_3 = "0000000aDST",
|
|
|
- movn_3 = "0000000bDST",
|
|
|
syscall_0 = "0000000c",
|
|
|
syscall_1 = "0000000cY",
|
|
|
break_0 = "0000000d",
|
|
|
break_1 = "0000000dY",
|
|
|
sync_0 = "0000000f",
|
|
|
- mfhi_1 = "00000010D",
|
|
|
- mthi_1 = "00000011S",
|
|
|
- mflo_1 = "00000012D",
|
|
|
- mtlo_1 = "00000013S",
|
|
|
dsllv_3 = mips64 and "00000014DTS",
|
|
|
dsrlv_3 = mips64 and "00000016DTS",
|
|
|
dsrav_3 = mips64 and "00000017DTS",
|
|
|
- mult_2 = "00000018ST",
|
|
|
- multu_2 = "00000019ST",
|
|
|
- div_2 = "0000001aST",
|
|
|
- divu_2 = "0000001bST",
|
|
|
- dmult_2 = mips64 and "0000001cST",
|
|
|
- dmultu_2 = mips64 and "0000001dST",
|
|
|
- ddiv_2 = mips64 and "0000001eST",
|
|
|
- ddivu_2 = mips64 and "0000001fST",
|
|
|
add_3 = "00000020DST",
|
|
|
move_2 = mips64 and "00000025DS" or "00000021DS",
|
|
|
addu_3 = "00000021DST",
|
|
@@ -369,32 +332,9 @@ local map_op = {
|
|
|
bgez_2 = "04010000SB",
|
|
|
bltzl_2 = "04020000SB",
|
|
|
bgezl_2 = "04030000SB",
|
|
|
- tgei_2 = "04080000SI",
|
|
|
- tgeiu_2 = "04090000SI",
|
|
|
- tlti_2 = "040a0000SI",
|
|
|
- tltiu_2 = "040b0000SI",
|
|
|
- teqi_2 = "040c0000SI",
|
|
|
- tnei_2 = "040e0000SI",
|
|
|
- bltzal_2 = "04100000SB",
|
|
|
bal_1 = "04110000B",
|
|
|
- bgezal_2 = "04110000SB",
|
|
|
- bltzall_2 = "04120000SB",
|
|
|
- bgezall_2 = "04130000SB",
|
|
|
synci_1 = "041f0000O",
|
|
|
|
|
|
- -- Opcode SPECIAL2.
|
|
|
- madd_2 = "70000000ST",
|
|
|
- maddu_2 = "70000001ST",
|
|
|
- mul_3 = "70000002DST",
|
|
|
- msub_2 = "70000004ST",
|
|
|
- msubu_2 = "70000005ST",
|
|
|
- clz_2 = "70000020DS=",
|
|
|
- clo_2 = "70000021DS=",
|
|
|
- dclz_2 = mips64 and "70000024DS=",
|
|
|
- dclo_2 = mips64 and "70000025DS=",
|
|
|
- sdbbp_0 = "7000003f",
|
|
|
- sdbbp_1 = "7000003fY",
|
|
|
-
|
|
|
-- Opcode SPECIAL3.
|
|
|
ext_4 = "7c000000TSAM", -- Note: last arg is msbd = size-1
|
|
|
dextm_4 = mips64 and "7c000001TSAM", -- Args: pos | size-1-32
|
|
@@ -445,15 +385,6 @@ local map_op = {
|
|
|
ctc1_2 = "44c00000TG",
|
|
|
mthc1_2 = "44e00000TG",
|
|
|
|
|
|
- bc1f_1 = "45000000B",
|
|
|
- bc1f_2 = "45000000CB",
|
|
|
- bc1t_1 = "45010000B",
|
|
|
- bc1t_2 = "45010000CB",
|
|
|
- bc1fl_1 = "45020000B",
|
|
|
- bc1fl_2 = "45020000CB",
|
|
|
- bc1tl_1 = "45030000B",
|
|
|
- bc1tl_2 = "45030000CB",
|
|
|
-
|
|
|
["add.s_3"] = "46000000FGH",
|
|
|
["sub.s_3"] = "46000001FGH",
|
|
|
["mul.s_3"] = "46000002FGH",
|
|
@@ -470,51 +401,11 @@ local map_op = {
|
|
|
["trunc.w.s_2"] = "4600000dFG",
|
|
|
["ceil.w.s_2"] = "4600000eFG",
|
|
|
["floor.w.s_2"] = "4600000fFG",
|
|
|
- ["movf.s_2"] = "46000011FG",
|
|
|
- ["movf.s_3"] = "46000011FGC",
|
|
|
- ["movt.s_2"] = "46010011FG",
|
|
|
- ["movt.s_3"] = "46010011FGC",
|
|
|
- ["movz.s_3"] = "46000012FGT",
|
|
|
- ["movn.s_3"] = "46000013FGT",
|
|
|
["recip.s_2"] = "46000015FG",
|
|
|
["rsqrt.s_2"] = "46000016FG",
|
|
|
["cvt.d.s_2"] = "46000021FG",
|
|
|
["cvt.w.s_2"] = "46000024FG",
|
|
|
["cvt.l.s_2"] = "46000025FG",
|
|
|
- ["cvt.ps.s_3"] = "46000026FGH",
|
|
|
- ["c.f.s_2"] = "46000030GH",
|
|
|
- ["c.f.s_3"] = "46000030VGH",
|
|
|
- ["c.un.s_2"] = "46000031GH",
|
|
|
- ["c.un.s_3"] = "46000031VGH",
|
|
|
- ["c.eq.s_2"] = "46000032GH",
|
|
|
- ["c.eq.s_3"] = "46000032VGH",
|
|
|
- ["c.ueq.s_2"] = "46000033GH",
|
|
|
- ["c.ueq.s_3"] = "46000033VGH",
|
|
|
- ["c.olt.s_2"] = "46000034GH",
|
|
|
- ["c.olt.s_3"] = "46000034VGH",
|
|
|
- ["c.ult.s_2"] = "46000035GH",
|
|
|
- ["c.ult.s_3"] = "46000035VGH",
|
|
|
- ["c.ole.s_2"] = "46000036GH",
|
|
|
- ["c.ole.s_3"] = "46000036VGH",
|
|
|
- ["c.ule.s_2"] = "46000037GH",
|
|
|
- ["c.ule.s_3"] = "46000037VGH",
|
|
|
- ["c.sf.s_2"] = "46000038GH",
|
|
|
- ["c.sf.s_3"] = "46000038VGH",
|
|
|
- ["c.ngle.s_2"] = "46000039GH",
|
|
|
- ["c.ngle.s_3"] = "46000039VGH",
|
|
|
- ["c.seq.s_2"] = "4600003aGH",
|
|
|
- ["c.seq.s_3"] = "4600003aVGH",
|
|
|
- ["c.ngl.s_2"] = "4600003bGH",
|
|
|
- ["c.ngl.s_3"] = "4600003bVGH",
|
|
|
- ["c.lt.s_2"] = "4600003cGH",
|
|
|
- ["c.lt.s_3"] = "4600003cVGH",
|
|
|
- ["c.nge.s_2"] = "4600003dGH",
|
|
|
- ["c.nge.s_3"] = "4600003dVGH",
|
|
|
- ["c.le.s_2"] = "4600003eGH",
|
|
|
- ["c.le.s_3"] = "4600003eVGH",
|
|
|
- ["c.ngt.s_2"] = "4600003fGH",
|
|
|
- ["c.ngt.s_3"] = "4600003fVGH",
|
|
|
-
|
|
|
["add.d_3"] = "46200000FGH",
|
|
|
["sub.d_3"] = "46200001FGH",
|
|
|
["mul.d_3"] = "46200002FGH",
|
|
@@ -531,130 +422,410 @@ local map_op = {
|
|
|
["trunc.w.d_2"] = "4620000dFG",
|
|
|
["ceil.w.d_2"] = "4620000eFG",
|
|
|
["floor.w.d_2"] = "4620000fFG",
|
|
|
- ["movf.d_2"] = "46200011FG",
|
|
|
- ["movf.d_3"] = "46200011FGC",
|
|
|
- ["movt.d_2"] = "46210011FG",
|
|
|
- ["movt.d_3"] = "46210011FGC",
|
|
|
- ["movz.d_3"] = "46200012FGT",
|
|
|
- ["movn.d_3"] = "46200013FGT",
|
|
|
["recip.d_2"] = "46200015FG",
|
|
|
["rsqrt.d_2"] = "46200016FG",
|
|
|
["cvt.s.d_2"] = "46200020FG",
|
|
|
["cvt.w.d_2"] = "46200024FG",
|
|
|
["cvt.l.d_2"] = "46200025FG",
|
|
|
- ["c.f.d_2"] = "46200030GH",
|
|
|
- ["c.f.d_3"] = "46200030VGH",
|
|
|
- ["c.un.d_2"] = "46200031GH",
|
|
|
- ["c.un.d_3"] = "46200031VGH",
|
|
|
- ["c.eq.d_2"] = "46200032GH",
|
|
|
- ["c.eq.d_3"] = "46200032VGH",
|
|
|
- ["c.ueq.d_2"] = "46200033GH",
|
|
|
- ["c.ueq.d_3"] = "46200033VGH",
|
|
|
- ["c.olt.d_2"] = "46200034GH",
|
|
|
- ["c.olt.d_3"] = "46200034VGH",
|
|
|
- ["c.ult.d_2"] = "46200035GH",
|
|
|
- ["c.ult.d_3"] = "46200035VGH",
|
|
|
- ["c.ole.d_2"] = "46200036GH",
|
|
|
- ["c.ole.d_3"] = "46200036VGH",
|
|
|
- ["c.ule.d_2"] = "46200037GH",
|
|
|
- ["c.ule.d_3"] = "46200037VGH",
|
|
|
- ["c.sf.d_2"] = "46200038GH",
|
|
|
- ["c.sf.d_3"] = "46200038VGH",
|
|
|
- ["c.ngle.d_2"] = "46200039GH",
|
|
|
- ["c.ngle.d_3"] = "46200039VGH",
|
|
|
- ["c.seq.d_2"] = "4620003aGH",
|
|
|
- ["c.seq.d_3"] = "4620003aVGH",
|
|
|
- ["c.ngl.d_2"] = "4620003bGH",
|
|
|
- ["c.ngl.d_3"] = "4620003bVGH",
|
|
|
- ["c.lt.d_2"] = "4620003cGH",
|
|
|
- ["c.lt.d_3"] = "4620003cVGH",
|
|
|
- ["c.nge.d_2"] = "4620003dGH",
|
|
|
- ["c.nge.d_3"] = "4620003dVGH",
|
|
|
- ["c.le.d_2"] = "4620003eGH",
|
|
|
- ["c.le.d_3"] = "4620003eVGH",
|
|
|
- ["c.ngt.d_2"] = "4620003fGH",
|
|
|
- ["c.ngt.d_3"] = "4620003fVGH",
|
|
|
-
|
|
|
- ["add.ps_3"] = "46c00000FGH",
|
|
|
- ["sub.ps_3"] = "46c00001FGH",
|
|
|
- ["mul.ps_3"] = "46c00002FGH",
|
|
|
- ["abs.ps_2"] = "46c00005FG",
|
|
|
- ["mov.ps_2"] = "46c00006FG",
|
|
|
- ["neg.ps_2"] = "46c00007FG",
|
|
|
- ["movf.ps_2"] = "46c00011FG",
|
|
|
- ["movf.ps_3"] = "46c00011FGC",
|
|
|
- ["movt.ps_2"] = "46c10011FG",
|
|
|
- ["movt.ps_3"] = "46c10011FGC",
|
|
|
- ["movz.ps_3"] = "46c00012FGT",
|
|
|
- ["movn.ps_3"] = "46c00013FGT",
|
|
|
- ["cvt.s.pu_2"] = "46c00020FG",
|
|
|
- ["cvt.s.pl_2"] = "46c00028FG",
|
|
|
- ["pll.ps_3"] = "46c0002cFGH",
|
|
|
- ["plu.ps_3"] = "46c0002dFGH",
|
|
|
- ["pul.ps_3"] = "46c0002eFGH",
|
|
|
- ["puu.ps_3"] = "46c0002fFGH",
|
|
|
- ["c.f.ps_2"] = "46c00030GH",
|
|
|
- ["c.f.ps_3"] = "46c00030VGH",
|
|
|
- ["c.un.ps_2"] = "46c00031GH",
|
|
|
- ["c.un.ps_3"] = "46c00031VGH",
|
|
|
- ["c.eq.ps_2"] = "46c00032GH",
|
|
|
- ["c.eq.ps_3"] = "46c00032VGH",
|
|
|
- ["c.ueq.ps_2"] = "46c00033GH",
|
|
|
- ["c.ueq.ps_3"] = "46c00033VGH",
|
|
|
- ["c.olt.ps_2"] = "46c00034GH",
|
|
|
- ["c.olt.ps_3"] = "46c00034VGH",
|
|
|
- ["c.ult.ps_2"] = "46c00035GH",
|
|
|
- ["c.ult.ps_3"] = "46c00035VGH",
|
|
|
- ["c.ole.ps_2"] = "46c00036GH",
|
|
|
- ["c.ole.ps_3"] = "46c00036VGH",
|
|
|
- ["c.ule.ps_2"] = "46c00037GH",
|
|
|
- ["c.ule.ps_3"] = "46c00037VGH",
|
|
|
- ["c.sf.ps_2"] = "46c00038GH",
|
|
|
- ["c.sf.ps_3"] = "46c00038VGH",
|
|
|
- ["c.ngle.ps_2"] = "46c00039GH",
|
|
|
- ["c.ngle.ps_3"] = "46c00039VGH",
|
|
|
- ["c.seq.ps_2"] = "46c0003aGH",
|
|
|
- ["c.seq.ps_3"] = "46c0003aVGH",
|
|
|
- ["c.ngl.ps_2"] = "46c0003bGH",
|
|
|
- ["c.ngl.ps_3"] = "46c0003bVGH",
|
|
|
- ["c.lt.ps_2"] = "46c0003cGH",
|
|
|
- ["c.lt.ps_3"] = "46c0003cVGH",
|
|
|
- ["c.nge.ps_2"] = "46c0003dGH",
|
|
|
- ["c.nge.ps_3"] = "46c0003dVGH",
|
|
|
- ["c.le.ps_2"] = "46c0003eGH",
|
|
|
- ["c.le.ps_3"] = "46c0003eVGH",
|
|
|
- ["c.ngt.ps_2"] = "46c0003fGH",
|
|
|
- ["c.ngt.ps_3"] = "46c0003fVGH",
|
|
|
-
|
|
|
["cvt.s.w_2"] = "46800020FG",
|
|
|
["cvt.d.w_2"] = "46800021FG",
|
|
|
-
|
|
|
["cvt.s.l_2"] = "46a00020FG",
|
|
|
["cvt.d.l_2"] = "46a00021FG",
|
|
|
-
|
|
|
- -- Opcode COP1X.
|
|
|
- lwxc1_2 = "4c000000FX",
|
|
|
- ldxc1_2 = "4c000001FX",
|
|
|
- luxc1_2 = "4c000005FX",
|
|
|
- swxc1_2 = "4c000008FX",
|
|
|
- sdxc1_2 = "4c000009FX",
|
|
|
- suxc1_2 = "4c00000dFX",
|
|
|
- prefx_2 = "4c00000fMX",
|
|
|
- ["alnv.ps_4"] = "4c00001eFGHS",
|
|
|
- ["madd.s_4"] = "4c000020FRGH",
|
|
|
- ["madd.d_4"] = "4c000021FRGH",
|
|
|
- ["madd.ps_4"] = "4c000026FRGH",
|
|
|
- ["msub.s_4"] = "4c000028FRGH",
|
|
|
- ["msub.d_4"] = "4c000029FRGH",
|
|
|
- ["msub.ps_4"] = "4c00002eFRGH",
|
|
|
- ["nmadd.s_4"] = "4c000030FRGH",
|
|
|
- ["nmadd.d_4"] = "4c000031FRGH",
|
|
|
- ["nmadd.ps_4"] = "4c000036FRGH",
|
|
|
- ["nmsub.s_4"] = "4c000038FRGH",
|
|
|
- ["nmsub.d_4"] = "4c000039FRGH",
|
|
|
- ["nmsub.ps_4"] = "4c00003eFRGH",
|
|
|
}
|
|
|
|
|
|
+if mipsr6 then -- Instructions added with MIPSR6.
|
|
|
+
|
|
|
+ for k,v in pairs({
|
|
|
+
|
|
|
+ -- Add immediate to upper bits.
|
|
|
+ aui_3 = "3c000000TSI",
|
|
|
+ daui_3 = mips64 and "74000000TSI",
|
|
|
+ dahi_2 = mips64 and "04060000SI",
|
|
|
+ dati_2 = mips64 and "041e0000SI",
|
|
|
+
|
|
|
+ -- TODO: addiupc, auipc, aluipc, lwpc, lwupc, ldpc.
|
|
|
+
|
|
|
+ -- Compact branches.
|
|
|
+ blezalc_2 = "18000000TB", -- rt != 0.
|
|
|
+ bgezalc_2 = "18000000T=SB", -- rt != 0.
|
|
|
+ bgtzalc_2 = "1c000000TB", -- rt != 0.
|
|
|
+ bltzalc_2 = "1c000000T=SB", -- rt != 0.
|
|
|
+
|
|
|
+ blezc_2 = "58000000TB", -- rt != 0.
|
|
|
+ bgezc_2 = "58000000T=SB", -- rt != 0.
|
|
|
+ bgec_3 = "58000000STB", -- rs != rt.
|
|
|
+ blec_3 = "58000000TSB", -- rt != rs.
|
|
|
+
|
|
|
+ bgtzc_2 = "5c000000TB", -- rt != 0.
|
|
|
+ bltzc_2 = "5c000000T=SB", -- rt != 0.
|
|
|
+ bltc_3 = "5c000000STB", -- rs != rt.
|
|
|
+ bgtc_3 = "5c000000TSB", -- rt != rs.
|
|
|
+
|
|
|
+ bgeuc_3 = "18000000STB", -- rs != rt.
|
|
|
+ bleuc_3 = "18000000TSB", -- rt != rs.
|
|
|
+ bltuc_3 = "1c000000STB", -- rs != rt.
|
|
|
+ bgtuc_3 = "1c000000TSB", -- rt != rs.
|
|
|
+
|
|
|
+ beqzalc_2 = "20000000TB", -- rt != 0.
|
|
|
+ bnezalc_2 = "60000000TB", -- rt != 0.
|
|
|
+ beqc_3 = "20000000STB", -- rs < rt.
|
|
|
+ bnec_3 = "60000000STB", -- rs < rt.
|
|
|
+ bovc_3 = "20000000STB", -- rs >= rt.
|
|
|
+ bnvc_3 = "60000000STB", -- rs >= rt.
|
|
|
+
|
|
|
+ beqzc_2 = "d8000000SK", -- rs != 0.
|
|
|
+ bnezc_2 = "f8000000SK", -- rs != 0.
|
|
|
+ jic_2 = "d8000000TI",
|
|
|
+ jialc_2 = "f8000000TI",
|
|
|
+ bc_1 = "c8000000L",
|
|
|
+ balc_1 = "e8000000L",
|
|
|
+
|
|
|
+ -- Opcode SPECIAL.
|
|
|
+ jr_1 = "00000009S",
|
|
|
+ sdbbp_0 = "0000000e",
|
|
|
+ sdbbp_1 = "0000000eY",
|
|
|
+ lsa_4 = "00000005DSTA",
|
|
|
+ dlsa_4 = mips64 and "00000015DSTA",
|
|
|
+ seleqz_3 = "00000035DST",
|
|
|
+ selnez_3 = "00000037DST",
|
|
|
+ clz_2 = "00000050DS",
|
|
|
+ clo_2 = "00000051DS",
|
|
|
+ dclz_2 = mips64 and "00000052DS",
|
|
|
+ dclo_2 = mips64 and "00000053DS",
|
|
|
+ mul_3 = "00000098DST",
|
|
|
+ muh_3 = "000000d8DST",
|
|
|
+ mulu_3 = "00000099DST",
|
|
|
+ muhu_3 = "000000d9DST",
|
|
|
+ div_3 = "0000009aDST",
|
|
|
+ mod_3 = "000000daDST",
|
|
|
+ divu_3 = "0000009bDST",
|
|
|
+ modu_3 = "000000dbDST",
|
|
|
+ dmul_3 = mips64 and "0000009cDST",
|
|
|
+ dmuh_3 = mips64 and "000000dcDST",
|
|
|
+ dmulu_3 = mips64 and "0000009dDST",
|
|
|
+ dmuhu_3 = mips64 and "000000ddDST",
|
|
|
+ ddiv_3 = mips64 and "0000009eDST",
|
|
|
+ dmod_3 = mips64 and "000000deDST",
|
|
|
+ ddivu_3 = mips64 and "0000009fDST",
|
|
|
+ dmodu_3 = mips64 and "000000dfDST",
|
|
|
+
|
|
|
+ -- Opcode SPECIAL3.
|
|
|
+ align_4 = "7c000220DSTA",
|
|
|
+ dalign_4 = mips64 and "7c000224DSTA",
|
|
|
+ bitswap_2 = "7c000020DT",
|
|
|
+ dbitswap_2 = mips64 and "7c000024DT",
|
|
|
+
|
|
|
+ -- Opcode COP1.
|
|
|
+ bc1eqz_2 = "45200000HB",
|
|
|
+ bc1nez_2 = "45a00000HB",
|
|
|
+
|
|
|
+ ["sel.s_3"] = "46000010FGH",
|
|
|
+ ["seleqz.s_3"] = "46000014FGH",
|
|
|
+ ["selnez.s_3"] = "46000017FGH",
|
|
|
+ ["maddf.s_3"] = "46000018FGH",
|
|
|
+ ["msubf.s_3"] = "46000019FGH",
|
|
|
+ ["rint.s_2"] = "4600001aFG",
|
|
|
+ ["class.s_2"] = "4600001bFG",
|
|
|
+ ["min.s_3"] = "4600001cFGH",
|
|
|
+ ["mina.s_3"] = "4600001dFGH",
|
|
|
+ ["max.s_3"] = "4600001eFGH",
|
|
|
+ ["maxa.s_3"] = "4600001fFGH",
|
|
|
+ ["cmp.af.s_3"] = "46800000FGH",
|
|
|
+ ["cmp.un.s_3"] = "46800001FGH",
|
|
|
+ ["cmp.or.s_3"] = "46800011FGH",
|
|
|
+ ["cmp.eq.s_3"] = "46800002FGH",
|
|
|
+ ["cmp.une.s_3"] = "46800012FGH",
|
|
|
+ ["cmp.ueq.s_3"] = "46800003FGH",
|
|
|
+ ["cmp.ne.s_3"] = "46800013FGH",
|
|
|
+ ["cmp.lt.s_3"] = "46800004FGH",
|
|
|
+ ["cmp.ult.s_3"] = "46800005FGH",
|
|
|
+ ["cmp.le.s_3"] = "46800006FGH",
|
|
|
+ ["cmp.ule.s_3"] = "46800007FGH",
|
|
|
+ ["cmp.saf.s_3"] = "46800008FGH",
|
|
|
+ ["cmp.sun.s_3"] = "46800009FGH",
|
|
|
+ ["cmp.sor.s_3"] = "46800019FGH",
|
|
|
+ ["cmp.seq.s_3"] = "4680000aFGH",
|
|
|
+ ["cmp.sune.s_3"] = "4680001aFGH",
|
|
|
+ ["cmp.sueq.s_3"] = "4680000bFGH",
|
|
|
+ ["cmp.sne.s_3"] = "4680001bFGH",
|
|
|
+ ["cmp.slt.s_3"] = "4680000cFGH",
|
|
|
+ ["cmp.sult.s_3"] = "4680000dFGH",
|
|
|
+ ["cmp.sle.s_3"] = "4680000eFGH",
|
|
|
+ ["cmp.sule.s_3"] = "4680000fFGH",
|
|
|
+
|
|
|
+ ["sel.d_3"] = "46200010FGH",
|
|
|
+ ["seleqz.d_3"] = "46200014FGH",
|
|
|
+ ["selnez.d_3"] = "46200017FGH",
|
|
|
+ ["maddf.d_3"] = "46200018FGH",
|
|
|
+ ["msubf.d_3"] = "46200019FGH",
|
|
|
+ ["rint.d_2"] = "4620001aFG",
|
|
|
+ ["class.d_2"] = "4620001bFG",
|
|
|
+ ["min.d_3"] = "4620001cFGH",
|
|
|
+ ["mina.d_3"] = "4620001dFGH",
|
|
|
+ ["max.d_3"] = "4620001eFGH",
|
|
|
+ ["maxa.d_3"] = "4620001fFGH",
|
|
|
+ ["cmp.af.d_3"] = "46a00000FGH",
|
|
|
+ ["cmp.un.d_3"] = "46a00001FGH",
|
|
|
+ ["cmp.or.d_3"] = "46a00011FGH",
|
|
|
+ ["cmp.eq.d_3"] = "46a00002FGH",
|
|
|
+ ["cmp.une.d_3"] = "46a00012FGH",
|
|
|
+ ["cmp.ueq.d_3"] = "46a00003FGH",
|
|
|
+ ["cmp.ne.d_3"] = "46a00013FGH",
|
|
|
+ ["cmp.lt.d_3"] = "46a00004FGH",
|
|
|
+ ["cmp.ult.d_3"] = "46a00005FGH",
|
|
|
+ ["cmp.le.d_3"] = "46a00006FGH",
|
|
|
+ ["cmp.ule.d_3"] = "46a00007FGH",
|
|
|
+ ["cmp.saf.d_3"] = "46a00008FGH",
|
|
|
+ ["cmp.sun.d_3"] = "46a00009FGH",
|
|
|
+ ["cmp.sor.d_3"] = "46a00019FGH",
|
|
|
+ ["cmp.seq.d_3"] = "46a0000aFGH",
|
|
|
+ ["cmp.sune.d_3"] = "46a0001aFGH",
|
|
|
+ ["cmp.sueq.d_3"] = "46a0000bFGH",
|
|
|
+ ["cmp.sne.d_3"] = "46a0001bFGH",
|
|
|
+ ["cmp.slt.d_3"] = "46a0000cFGH",
|
|
|
+ ["cmp.sult.d_3"] = "46a0000dFGH",
|
|
|
+ ["cmp.sle.d_3"] = "46a0000eFGH",
|
|
|
+ ["cmp.sule.d_3"] = "46a0000fFGH",
|
|
|
+
|
|
|
+ }) do map_op[k] = v end
|
|
|
+
|
|
|
+else -- Instructions removed by MIPSR6.
|
|
|
+
|
|
|
+ for k,v in pairs({
|
|
|
+ -- Traps, don't use.
|
|
|
+ addi_3 = "20000000TSI",
|
|
|
+ daddi_3 = mips64 and "60000000TSI",
|
|
|
+
|
|
|
+ -- Branch on likely, don't use.
|
|
|
+ beqzl_2 = "50000000SB",
|
|
|
+ beql_3 = "50000000STB",
|
|
|
+ bnezl_2 = "54000000SB",
|
|
|
+ bnel_3 = "54000000STB",
|
|
|
+ blezl_2 = "58000000SB",
|
|
|
+ bgtzl_2 = "5c000000SB",
|
|
|
+
|
|
|
+ lwl_2 = "88000000TO",
|
|
|
+ lwr_2 = "98000000TO",
|
|
|
+ swl_2 = "a8000000TO",
|
|
|
+ sdl_2 = mips64 and "b0000000TO",
|
|
|
+ sdr_2 = mips64 and "b1000000TO",
|
|
|
+ swr_2 = "b8000000TO",
|
|
|
+ cache_2 = "bc000000NO",
|
|
|
+ ll_2 = "c0000000TO",
|
|
|
+ pref_2 = "cc000000NO",
|
|
|
+ sc_2 = "e0000000TO",
|
|
|
+ scd_2 = mips64 and "f0000000TO",
|
|
|
+
|
|
|
+ -- Opcode SPECIAL.
|
|
|
+ movf_2 = "00000001DS",
|
|
|
+ movf_3 = "00000001DSC",
|
|
|
+ movt_2 = "00010001DS",
|
|
|
+ movt_3 = "00010001DSC",
|
|
|
+ jr_1 = "00000008S",
|
|
|
+ movz_3 = "0000000aDST",
|
|
|
+ movn_3 = "0000000bDST",
|
|
|
+ mfhi_1 = "00000010D",
|
|
|
+ mthi_1 = "00000011S",
|
|
|
+ mflo_1 = "00000012D",
|
|
|
+ mtlo_1 = "00000013S",
|
|
|
+ mult_2 = "00000018ST",
|
|
|
+ multu_2 = "00000019ST",
|
|
|
+ div_3 = "0000001aST",
|
|
|
+ divu_3 = "0000001bST",
|
|
|
+ ddiv_3 = mips64 and "0000001eST",
|
|
|
+ ddivu_3 = mips64 and "0000001fST",
|
|
|
+ dmult_2 = mips64 and "0000001cST",
|
|
|
+ dmultu_2 = mips64 and "0000001dST",
|
|
|
+
|
|
|
+ -- Opcode REGIMM.
|
|
|
+ tgei_2 = "04080000SI",
|
|
|
+ tgeiu_2 = "04090000SI",
|
|
|
+ tlti_2 = "040a0000SI",
|
|
|
+ tltiu_2 = "040b0000SI",
|
|
|
+ teqi_2 = "040c0000SI",
|
|
|
+ tnei_2 = "040e0000SI",
|
|
|
+ bltzal_2 = "04100000SB",
|
|
|
+ bgezal_2 = "04110000SB",
|
|
|
+ bltzall_2 = "04120000SB",
|
|
|
+ bgezall_2 = "04130000SB",
|
|
|
+
|
|
|
+ -- Opcode SPECIAL2.
|
|
|
+ madd_2 = "70000000ST",
|
|
|
+ maddu_2 = "70000001ST",
|
|
|
+ mul_3 = "70000002DST",
|
|
|
+ msub_2 = "70000004ST",
|
|
|
+ msubu_2 = "70000005ST",
|
|
|
+ clz_2 = "70000020D=TS",
|
|
|
+ clo_2 = "70000021D=TS",
|
|
|
+ dclz_2 = mips64 and "70000024D=TS",
|
|
|
+ dclo_2 = mips64 and "70000025D=TS",
|
|
|
+ sdbbp_0 = "7000003f",
|
|
|
+ sdbbp_1 = "7000003fY",
|
|
|
+
|
|
|
+ -- Opcode COP1.
|
|
|
+ bc1f_1 = "45000000B",
|
|
|
+ bc1f_2 = "45000000CB",
|
|
|
+ bc1t_1 = "45010000B",
|
|
|
+ bc1t_2 = "45010000CB",
|
|
|
+ bc1fl_1 = "45020000B",
|
|
|
+ bc1fl_2 = "45020000CB",
|
|
|
+ bc1tl_1 = "45030000B",
|
|
|
+ bc1tl_2 = "45030000CB",
|
|
|
+
|
|
|
+ ["movf.s_2"] = "46000011FG",
|
|
|
+ ["movf.s_3"] = "46000011FGC",
|
|
|
+ ["movt.s_2"] = "46010011FG",
|
|
|
+ ["movt.s_3"] = "46010011FGC",
|
|
|
+ ["movz.s_3"] = "46000012FGT",
|
|
|
+ ["movn.s_3"] = "46000013FGT",
|
|
|
+ ["cvt.ps.s_3"] = "46000026FGH",
|
|
|
+ ["c.f.s_2"] = "46000030GH",
|
|
|
+ ["c.f.s_3"] = "46000030VGH",
|
|
|
+ ["c.un.s_2"] = "46000031GH",
|
|
|
+ ["c.un.s_3"] = "46000031VGH",
|
|
|
+ ["c.eq.s_2"] = "46000032GH",
|
|
|
+ ["c.eq.s_3"] = "46000032VGH",
|
|
|
+ ["c.ueq.s_2"] = "46000033GH",
|
|
|
+ ["c.ueq.s_3"] = "46000033VGH",
|
|
|
+ ["c.olt.s_2"] = "46000034GH",
|
|
|
+ ["c.olt.s_3"] = "46000034VGH",
|
|
|
+ ["c.ult.s_2"] = "46000035GH",
|
|
|
+ ["c.ult.s_3"] = "46000035VGH",
|
|
|
+ ["c.ole.s_2"] = "46000036GH",
|
|
|
+ ["c.ole.s_3"] = "46000036VGH",
|
|
|
+ ["c.ule.s_2"] = "46000037GH",
|
|
|
+ ["c.ule.s_3"] = "46000037VGH",
|
|
|
+ ["c.sf.s_2"] = "46000038GH",
|
|
|
+ ["c.sf.s_3"] = "46000038VGH",
|
|
|
+ ["c.ngle.s_2"] = "46000039GH",
|
|
|
+ ["c.ngle.s_3"] = "46000039VGH",
|
|
|
+ ["c.seq.s_2"] = "4600003aGH",
|
|
|
+ ["c.seq.s_3"] = "4600003aVGH",
|
|
|
+ ["c.ngl.s_2"] = "4600003bGH",
|
|
|
+ ["c.ngl.s_3"] = "4600003bVGH",
|
|
|
+ ["c.lt.s_2"] = "4600003cGH",
|
|
|
+ ["c.lt.s_3"] = "4600003cVGH",
|
|
|
+ ["c.nge.s_2"] = "4600003dGH",
|
|
|
+ ["c.nge.s_3"] = "4600003dVGH",
|
|
|
+ ["c.le.s_2"] = "4600003eGH",
|
|
|
+ ["c.le.s_3"] = "4600003eVGH",
|
|
|
+ ["c.ngt.s_2"] = "4600003fGH",
|
|
|
+ ["c.ngt.s_3"] = "4600003fVGH",
|
|
|
+ ["movf.d_2"] = "46200011FG",
|
|
|
+ ["movf.d_3"] = "46200011FGC",
|
|
|
+ ["movt.d_2"] = "46210011FG",
|
|
|
+ ["movt.d_3"] = "46210011FGC",
|
|
|
+ ["movz.d_3"] = "46200012FGT",
|
|
|
+ ["movn.d_3"] = "46200013FGT",
|
|
|
+ ["c.f.d_2"] = "46200030GH",
|
|
|
+ ["c.f.d_3"] = "46200030VGH",
|
|
|
+ ["c.un.d_2"] = "46200031GH",
|
|
|
+ ["c.un.d_3"] = "46200031VGH",
|
|
|
+ ["c.eq.d_2"] = "46200032GH",
|
|
|
+ ["c.eq.d_3"] = "46200032VGH",
|
|
|
+ ["c.ueq.d_2"] = "46200033GH",
|
|
|
+ ["c.ueq.d_3"] = "46200033VGH",
|
|
|
+ ["c.olt.d_2"] = "46200034GH",
|
|
|
+ ["c.olt.d_3"] = "46200034VGH",
|
|
|
+ ["c.ult.d_2"] = "46200035GH",
|
|
|
+ ["c.ult.d_3"] = "46200035VGH",
|
|
|
+ ["c.ole.d_2"] = "46200036GH",
|
|
|
+ ["c.ole.d_3"] = "46200036VGH",
|
|
|
+ ["c.ule.d_2"] = "46200037GH",
|
|
|
+ ["c.ule.d_3"] = "46200037VGH",
|
|
|
+ ["c.sf.d_2"] = "46200038GH",
|
|
|
+ ["c.sf.d_3"] = "46200038VGH",
|
|
|
+ ["c.ngle.d_2"] = "46200039GH",
|
|
|
+ ["c.ngle.d_3"] = "46200039VGH",
|
|
|
+ ["c.seq.d_2"] = "4620003aGH",
|
|
|
+ ["c.seq.d_3"] = "4620003aVGH",
|
|
|
+ ["c.ngl.d_2"] = "4620003bGH",
|
|
|
+ ["c.ngl.d_3"] = "4620003bVGH",
|
|
|
+ ["c.lt.d_2"] = "4620003cGH",
|
|
|
+ ["c.lt.d_3"] = "4620003cVGH",
|
|
|
+ ["c.nge.d_2"] = "4620003dGH",
|
|
|
+ ["c.nge.d_3"] = "4620003dVGH",
|
|
|
+ ["c.le.d_2"] = "4620003eGH",
|
|
|
+ ["c.le.d_3"] = "4620003eVGH",
|
|
|
+ ["c.ngt.d_2"] = "4620003fGH",
|
|
|
+ ["c.ngt.d_3"] = "4620003fVGH",
|
|
|
+ ["add.ps_3"] = "46c00000FGH",
|
|
|
+ ["sub.ps_3"] = "46c00001FGH",
|
|
|
+ ["mul.ps_3"] = "46c00002FGH",
|
|
|
+ ["abs.ps_2"] = "46c00005FG",
|
|
|
+ ["mov.ps_2"] = "46c00006FG",
|
|
|
+ ["neg.ps_2"] = "46c00007FG",
|
|
|
+ ["movf.ps_2"] = "46c00011FG",
|
|
|
+ ["movf.ps_3"] = "46c00011FGC",
|
|
|
+ ["movt.ps_2"] = "46c10011FG",
|
|
|
+ ["movt.ps_3"] = "46c10011FGC",
|
|
|
+ ["movz.ps_3"] = "46c00012FGT",
|
|
|
+ ["movn.ps_3"] = "46c00013FGT",
|
|
|
+ ["cvt.s.pu_2"] = "46c00020FG",
|
|
|
+ ["cvt.s.pl_2"] = "46c00028FG",
|
|
|
+ ["pll.ps_3"] = "46c0002cFGH",
|
|
|
+ ["plu.ps_3"] = "46c0002dFGH",
|
|
|
+ ["pul.ps_3"] = "46c0002eFGH",
|
|
|
+ ["puu.ps_3"] = "46c0002fFGH",
|
|
|
+ ["c.f.ps_2"] = "46c00030GH",
|
|
|
+ ["c.f.ps_3"] = "46c00030VGH",
|
|
|
+ ["c.un.ps_2"] = "46c00031GH",
|
|
|
+ ["c.un.ps_3"] = "46c00031VGH",
|
|
|
+ ["c.eq.ps_2"] = "46c00032GH",
|
|
|
+ ["c.eq.ps_3"] = "46c00032VGH",
|
|
|
+ ["c.ueq.ps_2"] = "46c00033GH",
|
|
|
+ ["c.ueq.ps_3"] = "46c00033VGH",
|
|
|
+ ["c.olt.ps_2"] = "46c00034GH",
|
|
|
+ ["c.olt.ps_3"] = "46c00034VGH",
|
|
|
+ ["c.ult.ps_2"] = "46c00035GH",
|
|
|
+ ["c.ult.ps_3"] = "46c00035VGH",
|
|
|
+ ["c.ole.ps_2"] = "46c00036GH",
|
|
|
+ ["c.ole.ps_3"] = "46c00036VGH",
|
|
|
+ ["c.ule.ps_2"] = "46c00037GH",
|
|
|
+ ["c.ule.ps_3"] = "46c00037VGH",
|
|
|
+ ["c.sf.ps_2"] = "46c00038GH",
|
|
|
+ ["c.sf.ps_3"] = "46c00038VGH",
|
|
|
+ ["c.ngle.ps_2"] = "46c00039GH",
|
|
|
+ ["c.ngle.ps_3"] = "46c00039VGH",
|
|
|
+ ["c.seq.ps_2"] = "46c0003aGH",
|
|
|
+ ["c.seq.ps_3"] = "46c0003aVGH",
|
|
|
+ ["c.ngl.ps_2"] = "46c0003bGH",
|
|
|
+ ["c.ngl.ps_3"] = "46c0003bVGH",
|
|
|
+ ["c.lt.ps_2"] = "46c0003cGH",
|
|
|
+ ["c.lt.ps_3"] = "46c0003cVGH",
|
|
|
+ ["c.nge.ps_2"] = "46c0003dGH",
|
|
|
+ ["c.nge.ps_3"] = "46c0003dVGH",
|
|
|
+ ["c.le.ps_2"] = "46c0003eGH",
|
|
|
+ ["c.le.ps_3"] = "46c0003eVGH",
|
|
|
+ ["c.ngt.ps_2"] = "46c0003fGH",
|
|
|
+ ["c.ngt.ps_3"] = "46c0003fVGH",
|
|
|
+
|
|
|
+ -- Opcode COP1X.
|
|
|
+ lwxc1_2 = "4c000000FX",
|
|
|
+ ldxc1_2 = "4c000001FX",
|
|
|
+ luxc1_2 = "4c000005FX",
|
|
|
+ swxc1_2 = "4c000008FX",
|
|
|
+ sdxc1_2 = "4c000009FX",
|
|
|
+ suxc1_2 = "4c00000dFX",
|
|
|
+ prefx_2 = "4c00000fMX",
|
|
|
+ ["alnv.ps_4"] = "4c00001eFGHS",
|
|
|
+ ["madd.s_4"] = "4c000020FRGH",
|
|
|
+ ["madd.d_4"] = "4c000021FRGH",
|
|
|
+ ["madd.ps_4"] = "4c000026FRGH",
|
|
|
+ ["msub.s_4"] = "4c000028FRGH",
|
|
|
+ ["msub.d_4"] = "4c000029FRGH",
|
|
|
+ ["msub.ps_4"] = "4c00002eFRGH",
|
|
|
+ ["nmadd.s_4"] = "4c000030FRGH",
|
|
|
+ ["nmadd.d_4"] = "4c000031FRGH",
|
|
|
+ ["nmadd.ps_4"] = "4c000036FRGH",
|
|
|
+ ["nmsub.s_4"] = "4c000038FRGH",
|
|
|
+ ["nmsub.d_4"] = "4c000039FRGH",
|
|
|
+ ["nmsub.ps_4"] = "4c00003eFRGH",
|
|
|
+
|
|
|
+ }) do map_op[k] = v end
|
|
|
+
|
|
|
+end
|
|
|
+
|
|
|
------------------------------------------------------------------------------
|
|
|
|
|
|
local function parse_gpr(expr)
|
|
@@ -808,9 +979,11 @@ map_op[".template__"] = function(params, template, nparams)
|
|
|
op = op + parse_disp(params[n]); n = n + 1
|
|
|
elseif p == "X" then
|
|
|
op = op + parse_index(params[n]); n = n + 1
|
|
|
- elseif p == "B" or p == "J" then
|
|
|
+ elseif p == "B" or p == "J" or p == "K" or p == "L" then
|
|
|
local mode, m, s = parse_label(params[n], false)
|
|
|
- if p == "B" then m = m + 2048 end
|
|
|
+ if p == "J" then m = m + 0xa800
|
|
|
+ elseif p == "K" then m = m + 0x5000
|
|
|
+ elseif p == "L" then m = m + 0xa000 end
|
|
|
waction("REL_"..mode, m, s, 1)
|
|
|
n = n + 1
|
|
|
elseif p == "A" then
|
|
@@ -833,7 +1006,7 @@ map_op[".template__"] = function(params, template, nparams)
|
|
|
elseif p == "Z" then
|
|
|
op = op + parse_imm(params[n], 10, 6, 0, false); n = n + 1
|
|
|
elseif p == "=" then
|
|
|
- op = op + shl(band(op, 0xf800), 5) -- Copy D to T for clz, clo.
|
|
|
+ n = n - 1 -- Re-use previous parameter for next template char.
|
|
|
else
|
|
|
assert(false)
|
|
|
end
|