Commit ce6b6c04 authored by Benedikt Geßele's avatar Benedikt Geßele

mips revision 6: until BGEZALL

parent c81deb1b
......@@ -23,7 +23,7 @@ GDSL_OPT_HL=specifications/rreil/rreil-liveness.ml specifications/rreil/rreil-fo
GDSL_MIPS_HL_R5=specifications/mips/mips_r5.ml specifications/mips/mips-pretty_r5.ml specifications/mips/mips-rreil-translator_r5.ml specifications/mips/mips-asm_r5.ml specifications/mips/mips-traverse_r5.ml
GDSL_MIPS_HL_R6=specifications/mips/mips_r6.ml specifications/mips/mips-pretty_r6.ml specifications/mips/mips-rreil-translator_r6.ml specifications/mips/mips-asm_r6.ml specifications/mips/mips-traverse_r6.ml
GDSL_MIPS_HL=specifications/mips/mips.ml specifications/mips/mips-pretty.ml specifications/mips/mips-rreil-pretty.ml specifications/mips/mips-rreil-registermapping.ml specifications/mips/mips-rreil-translator.ml specifications/mips/mips-liveness.ml specifications/mips/mips-asm.ml specifications/mips/mips-traverse.ml $(GDSL_MIPS_HL_R5)
GDSL_MIPS_HL=specifications/mips/mips.ml specifications/mips/mips-pretty.ml specifications/mips/mips-rreil-pretty.ml specifications/mips/mips-rreil-registermapping.ml specifications/mips/mips-rreil-translator.ml specifications/mips/mips-liveness.ml specifications/mips/mips-asm.ml specifications/mips/mips-traverse.ml $(GDSL_MIPS_HL_R6)
GDSL_MIPS_TRANS_HL=
GDSL_SOURCES=$(GDSL_BASIS_HL) $(GDSL_RREIL_HL) $(GDSL_MIPS_HL) $(GDSL_MIPS_TRANS_HL) $(GDSL_OPT_HL) $(GDSL_ASM_HL)
......
......@@ -2,6 +2,9 @@ val revision/generalize-immediate i = let
val inner i sz = asm-bounded (asm-boundary-sz sz) (asm-imm (zx i))
in case i of
IMM21 i: inner i 21
| IMM32 i: inner i 32
| BP i: inner i 2
| OFFSET28 i: inner i 28
| C2CONDITION i: inner i 5
end end
val revision/show/immediate imm =
case imm of
IMM21 x: show-int (zx x)
| IMM32 x: show-int (zx x)
| BP x: show-int (zx x)
| OFFSET28 x: show-int (zx x)
| C2CONDITION x: show-int (zx x)
end
val revision/show/format format = "ERROR"
......@@ -518,21 +518,11 @@ val sem-bz-link cmp_op x = do
end
val sem-beq x = sem-b /eq x
val sem-beql x = sem-b /eq x
val sem-bgez x = sem-bz /ges x
val sem-bgezal x = sem-bz-link /ges x
val sem-bgezall x = sem-bz-link /ges x
val sem-bgezl x = sem-bz /ges x
val sem-bgtz x = sem-bz /gts x
val sem-bgtzl x = sem-bz /gts x
val sem-blez x = sem-bz /les x
val sem-blezl x = sem-bz /les x
val sem-bltz x = sem-bz /lts x
val sem-bltzal x = sem-bz-link /lts x
val sem-bltzall x = sem-bz-link /lts x
val sem-bltzl x = sem-bz /lts x
val sem-bne x = sem-b /neq x
val sem-bnel x = sem-b /neq x
val sem-break x = throw-exception SEM_EXC_BREAKPOINT
......@@ -1512,30 +1502,12 @@ val semantics i =
| ADDU x: sem-addu x
| AND x: sem-and x
| ANDI x: sem-andi x
| BC1F x: sem-default-binop-rr-generic i x
| BC1FL x: sem-default-binop-rr-generic i x
| BC1T x: sem-default-binop-rr-generic i x
| BC1TL x: sem-default-binop-rr-generic i x
| BC2F x: sem-default-binop-rr-generic i x
| BC2FL x: sem-default-binop-rr-generic i x
| BC2T x: sem-default-binop-rr-generic i x
| BC2TL x: sem-default-binop-rr-generic i x
| BEQ x: sem-beq x
| BEQL x: sem-beql x
| BGEZ x: sem-bgez x
| BGEZAL x: sem-bgezal x
| BGEZALL x: sem-bgezall x
| BGEZL x: sem-bgezl x
| BGTZ x: sem-bgtz x
| BGTZL x: sem-bgtzl x
| BLEZ x: sem-blez x
| BLEZL x: sem-blezl x
| BLTZ x: sem-bltz x
| BLTZAL x: sem-bltzal x
| BLTZALL x: sem-bltzall x
| BLTZL x: sem-bltzl x
| BNE x: sem-bne x
| BNEL x: sem-bnel x
| BREAK x: sem-break x
| C-cond-fmt x: sem-default-ternop-cflrr-generic i x
| CACHE x: sem-default-binop-rr-tuple-generic i x
......@@ -1591,7 +1563,6 @@ val semantics i =
| LUXC1 x: sem-default-binop-lr-tuple-generic i x
| LW x: sem-lw x
| LWC1 x: sem-default-binop-lr-tuple-generic i x
| LWC2 x: sem-default-binop-rr-tuple-generic i x
| LWE x: sem-lw x
| MADD x: sem-madd x
| MADD-fmt x: sem-default-ternop-flrr-generic i x
......@@ -1677,7 +1648,6 @@ val semantics i =
| SUXC1 x: sem-default-binop-rr-tuple-generic i x
| SW x: sem-sw x
| SWC1 x: sem-default-binop-rr-tuple-generic i x
| SWC2 x: sem-default-binop-rr-tuple-generic i x
| SWE x: sem-sw x
| SWL x: sem-swl x
| SWLE x: sem-swl x
......
......@@ -15,6 +15,17 @@ val sem-addi x = do
write x.op1 (var res)
end
val sem-beql x = sem-b /eq x
val sem-bgezal x = sem-bz-link /ges x
val sem-bgezall x = sem-bz-link /ges x
val sem-bgezl x = sem-bz /ges x
val sem-bgtzl x = sem-bz /gts x
val sem-blezl x = sem-bz /les x
val sem-bltzal x = sem-bz-link /lts x
val sem-bltzall x = sem-bz-link /lts x
val sem-bltzl x = sem-bz /lts x
val sem-bnel x = sem-b /neq x
val sem-lwl x = do
off/base <- rval Signed x.op2;
base <- return (extract-tuple off/base).opnd1;
......@@ -96,9 +107,29 @@ val revision/semantics i =
case i of
ADDI x: sem-addi x
| ALNV-PS x: sem-default-quadop-lrrr-generic i x
| BC1F x: sem-default-binop-rr-generic i x
| BC1FL x: sem-default-binop-rr-generic i x
| BC1T x: sem-default-binop-rr-generic i x
| BC1TL x: sem-default-binop-rr-generic i x
| BC2F x: sem-default-binop-rr-generic i x
| BC2FL x: sem-default-binop-rr-generic i x
| BC2T x: sem-default-binop-rr-generic i x
| BC2TL x: sem-default-binop-rr-generic i x
| BEQL x: sem-beql x
| BGEZAL x: sem-bgezal x
| BGEZALL x: sem-bgezall x
| BGEZL x: sem-bgezl x
| BGTZL x: sem-bgtzl x
| BLEZL x: sem-blezl x
| BLTZAL x: sem-bltzal x
| BLTZALL x: sem-bltzall x
| BLTZL x: sem-bltzl x
| BNEL x: sem-bnel x
| LWC2 x: sem-default-binop-rr-tuple-generic i x
| LWL x: sem-lwl x
| LWLE x: sem-lwl x
| LWR x: sem-lwr x
| LWRE x: sem-lwr x
| LWXC1 x: sem-default-binop-lr-tuple-generic i x
| SWC2 x: sem-default-binop-rr-tuple-generic i x
end
val revision/sizeof-imm imm =
case imm of
IMM21 i: 21
| IMM32 i: 32
| BP i: 2
| OFFSET28 i: 28
| C2CONDITION i: 5
end
val revision/rval-imm sn x = let
......@@ -13,17 +16,21 @@ val revision/rval-imm sn x = let
in
case x of
IMM21 i: from-vec sn i
| IMM32 i: from-vec sn i
| BP i: from-vec sn i
| OFFSET28 i: from-vec sn i
| C2CONDITION i: from-vec sn i
end
end
val sem-addiupc x = do
imm <- rval Signed x.op2;
im <- rval Signed x.op2;
size <- return (sizeof-lval x.op1);
pc <- return (semantic-reg-of Sem_PC);
# im already shifted at decoding
res <- mktemp;
add size res (var pc) imm;
add size res (var pc) im;
write x.op1 (var res)
end
......@@ -48,8 +55,111 @@ val sem-align x = do
write x.op1 (var res)
end
val sem-aluipc x = do
im <- rval Signed x.op2;
size <- return (sizeof-lval x.op1);
pc <- return (semantic-reg-of Sem_PC);
# im already shifted at decoding
temp <- mktemp;
add size temp (var pc) im;
res <- mktemp;
mov size res (imm 0);
mov (size - 16) res (var (at-offset temp 16));
write x.op1 (var res)
end
val sem-aui x = do
rs <- rval Signed x.op2;
im <- rval Signed x.op3;
size <- return (sizeof-rval x.op2);
# im already bitshifted at decoding
res <- mktemp;
add size res rs im;
write x.op1 (var res)
end
val sem-auipc x = do
im <- rval Signed x.op2;
size <- return (sizeof-lval x.op1);
pc <- return (semantic-reg-of Sem_PC);
# im already bitshifted at decoding
res <- mktemp;
add size res (var pc) im;
write x.op1 (var res)
end
val sem-balc x = do
pc <- return (semantic-reg-of Sem_PC);
ra <- return (semantic-gpr-of RA);
# pc got incremented already => add 0 instead of 4
add ra.size ra (var pc) (imm 0);
sem-bc x
end
val sem-bc x = do
# offset already shifted at decoding
off <- rval Signed x.op;
size <- return (sizeof-rval x.op);
cbranch-rel (imm 1) off
end
val sem-bc1 cmp_op x = do
ft <- rval Signed x.op1;
size <- return (sizeof-rval x.op1);
off <- rval Signed x.op2;
cond <- cmp_op 1 ft (imm 0);
cbranch-rel cond off
end
val sem-bc1eqz x = sem-bc1 /eq x
val sem-bc1nez x = sem-bc1 /neq x
val sem-bzalc cmp_op x = do
pc <- return (semantic-reg-of Sem_PC);
ra <- return (semantic-gpr-of RA);
# pc got incremented already => add 0 instead of 4
add ra.size ra (var pc) (imm 0);
sem-bz cmp_op x
end
val sem-blezalc x = sem-bzalc /les x
val sem-bgezalc x = sem-bzalc /ges x
val sem-bgtzalc x = sem-bzalc /gts x
val sem-bltzalc x = sem-bzalc /lts x
val sem-beqzalc x = sem-bzalc /eq x
val sem-bnezalc x = sem-bzalc /neq x
val revision/semantics i =
case i of
ADDIUPC x: sem-addiupc x
| ALIGN x: sem-align x
| ALUIPC x: sem-aluipc x
| AUI x: sem-aui x
| AUIPC x: sem-auipc x
| BALC x: sem-balc x
| BC x: sem-bc x
| BC1EQZ x: sem-bc1eqz x
| BC1NEZ x: sem-bc1nez x
| BC2EQZ x: sem-default-binop-rr-generic i x
| BC2NEZ x: sem-default-binop-rr-generic i x
| BLEZALC x: sem-blezalc x
| BGEZALC x: sem-bgezalc x
| BGTZALC x: sem-bgtzalc x
| BLTZALC x: sem-bltzalc x
| BEQZALC x: sem-beqzalc x
| BNEZALC x: sem-bnezalc x
end
......@@ -37,30 +37,12 @@ val traverse f insn =
| ADDU x: f "ADDU" (TERNOP_LRR x)
| AND x: f "AND" (TERNOP_LRR x)
| ANDI x: f "ANDI" (TERNOP_LRR x)
| BC1F x: f "BC1F" (BINOP_RR x)
| BC1FL x: f "BC1FL" (BINOP_RR x)
| BC1T x: f "BC1T" (BINOP_RR x)
| BC1TL x: f "BC1TL" (BINOP_RR x)
| BC2F x: f "BC2F" (BINOP_RR x)
| BC2FL x: f "BC2FL" (BINOP_RR x)
| BC2T x: f "BC2T" (BINOP_RR x)
| BC2TL x: f "BC2TL" (BINOP_RR x)
| BEQ x: f "BEQ" (TERNOP_RRR x)
| BEQL x: f "BEQL" (TERNOP_RRR x)
| BGEZ x: f "BGEZ" (BINOP_RR x)
| BGEZAL x: f "BGEZAL" (BINOP_RR x)
| BGEZALL x: f "BGEZALL" (BINOP_RR x)
| BGEZL x: f "BGEZL" (BINOP_RR x)
| BGTZ x: f "BGTZ" (BINOP_RR x)
| BGTZL x: f "BGTZL" (BINOP_RR x)
| BLEZ x: f "BLEZ" (BINOP_RR x)
| BLEZL x: f "BLEZL" (BINOP_RR x)
| BLTZ x: f "BLTZ" (BINOP_RR x)
| BLTZAL x: f "BLTZAL" (BINOP_RR x)
| BLTZALL x: f "BLTZALL" (BINOP_RR x)
| BLTZL x: f "BLTZL" (BINOP_RR x)
| BNE x: f "BNE" (TERNOP_RRR x)
| BNEL x: f "BNEL" (TERNOP_RRR x)
| BREAK x: f "BREAK" (UNOP_R x)
| C-cond-fmt x: f "C" (TERNOP_CFLRR x)
| CACHE x: f "CACHE" (BINOP_RR x)
......@@ -116,7 +98,6 @@ val traverse f insn =
| LUXC1 x: f "LUXC1" (BINOP_LR x)
| LW x: f "LW" (BINOP_LR x)
| LWC1 x: f "LWC1" (BINOP_LR x)
| LWC2 x: f "LWC2" (BINOP_RR x)
| LWE x: f "LWE" (BINOP_LR x)
| MADD x: f "MADD" (BINOP_RR x)
| MADD-fmt x: f "MADD" (QUADOP_FLRRR x)
......@@ -202,7 +183,6 @@ val traverse f insn =
| SUXC1 x: f "SUXC1" (BINOP_RR x)
| SW x: f "SW" (BINOP_RR x)
| SWC1 x: f "SWC1" (BINOP_RR x)
| SWC2 x: f "SWC2" (BINOP_RR x)
| SWE x: f "SWE" (BINOP_RR x)
| SWL x: f "SWL" (BINOP_RR x)
| SWLE x: f "SWLE" (BINOP_RR x)
......
......@@ -2,9 +2,29 @@ val revision/traverse f insn =
case insn of
ADDI x: f "ADDI" (TERNOP_LRR x)
| ALNV-PS x: f "ALNV.PS" (QUADOP_LRRR x)
| BC1F x: f "BC1F" (BINOP_RR x)
| BC1FL x: f "BC1FL" (BINOP_RR x)
| BC1T x: f "BC1T" (BINOP_RR x)
| BC1TL x: f "BC1TL" (BINOP_RR x)
| BC2F x: f "BC2F" (BINOP_RR x)
| BC2FL x: f "BC2FL" (BINOP_RR x)
| BC2T x: f "BC2T" (BINOP_RR x)
| BC2TL x: f "BC2TL" (BINOP_RR x)
| BEQL x: f "BEQL" (TERNOP_RRR x)
| BGEZAL x: f "BGEZAL" (BINOP_RR x)
| BGEZALL x: f "BGEZALL" (BINOP_RR x)
| BGEZL x: f "BGEZL" (BINOP_RR x)
| BGTZL x: f "BGTZL" (BINOP_RR x)
| BLEZL x: f "BLEZL" (BINOP_RR x)
| BLTZAL x: f "BLTZAL" (BINOP_RR x)
| BLTZALL x: f "BLTZALL" (BINOP_RR x)
| BLTZL x: f "BLTZL" (BINOP_RR x)
| BNEL x: f "BNEL" (TERNOP_RRR x)
| LWC2 x: f "LWC2" (BINOP_RR x)
| LWL x: f "LWL" (BINOP_LR x)
| LWLE x: f "LWLE" (BINOP_LR x)
| LWR x: f "LWR" (BINOP_LR x)
| LWRE x: f "LWRE" (BINOP_LR x)
| LWXC1 x: f "LWXC1" (BINOP_LR x)
| SWC2 x: f "SWC2" (BINOP_RR x)
end
......@@ -2,4 +2,19 @@ val revision/traverse f insn =
case insn of
ADDIUPC x: f "ADDIUPC" (BINOP_LR x)
| ALIGN x: f "ALIGN" (QUADOP_LRRR x)
| ALUIPC x: f "ALUIPC" (BINOP_LR x)
| AUI x: f "AUI" (TERNOP_LRR x)
| AUIPC x: f "AUIPC" (BINOP_LR x)
| BALC x: f "BALC" (UNOP_R x)
| BC x: f "BC" (UNOP_R x)
| BC1EQZ x: f "BC1EQZ" (BINOP_RR x)
| BC1NEZ x: f "BC1NEZ" (BINOP_RR x)
| BC2EQZ x: f "BC2EQZ" (BINOP_RR x)
| BC2NEZ x: f "BC2NEZ" (BINOP_RR x)
| BLEZALC x: f "BLEZALC" (BINOP_RR x)
| BGEZALC x: f "BGEZALC" (BINOP_RR x)
| BGTZALC x: f "BGTZALC" (BINOP_RR x)
| BLTZALC x: f "BLTZALC" (BINOP_RR x)
| BEQZALC x: f "BEQZALC" (BINOP_RR x)
| BNEZALC x: f "BNEZALC" (BINOP_RR x)
end
......@@ -148,7 +148,7 @@ end
########################
# guards conditions
# guard conditions
####
val pause? s = (s.rt == '00000') and (s.rd == '00000') and (s.sa == '00101') and (not (assembler-mode))
......@@ -194,102 +194,22 @@ val / ['001100 /rs /rt /immediate16'] = ternop ANDI rt (right rs) immediate16
### - Branch and Link
### => see BGEZAL r0, offset
### BC1F
### - Branch on FP False
val / ['010001 01000 /cc 0 0 /offset16'] = binop BC1F (right fcc) offset18
### BC1FL
### - Branch on FP False Likely
val / ['010001 01000 /cc 1 0 /offset16'] = binop BC1FL (right fcc) offset18
### BC1T
### - Branch on FP True
val / ['010001 01000 /cc 0 1 /offset16'] = binop BC1T (right fcc) offset18
### BC1TL
### - Branch on FP True Likely
val / ['010001 01000 /cc 1 1 /offset16'] = binop BC1TL (right fcc) offset18
### BC2F
### - Branch on COP2 False
val / ['010010 01000 /cc 0 0 /offset16'] = binop BC2F (right c2cc) offset18
### BC2FL
### - Branch on COP2 False Likely
val / ['010010 01000 /cc 1 0 /offset16'] = binop BC2FL (right c2cc) offset18
### BC2T
### - Branch on COP2 True
val / ['010010 01000 /cc 0 1 /offset16'] = binop BC2T (right c2cc) offset18
### BC2TL
### - Branch on COP2 True Likely
val / ['010010 01000 /cc 1 1 /offset16'] = binop BC2TL (right c2cc) offset18
### BEQ
### - Branch on Equal
val / ['000100 /rs /rt /offset16'] = ternop BEQ (right rs) (right rt) offset18
### BEQL
### - Branch on Equal Likely
val / ['010100 /rs /rt /offset16'] = ternop BEQL (right rs) (right rt) offset18
### BGEZ
### - Branch on Greater Than or Equal to Zero
val / ['000001 /rs 00001 /offset16'] = binop BGEZ (right rs) offset18
### BGEZAL
### - Branch on Greater Than or Equal to Zero and Link
val / ['000001 /rs 10001 /offset16'] = binop BGEZAL (right rs) offset18
### BGEZALL
### - Branch on Greater Than or Equal to Zero and Link Likely
val / ['000001 /rs 10011 /offset16'] = binop BGEZALL (right rs) offset18
### BGEZL
### - Branch on Greater Than or Equal to Zero Likely
val / ['000001 /rs 00011 /offset16'] = binop BGEZL (right rs) offset18
### BGTZ
### - Branch on Greater Than Zero
val / ['000111 /rs 00000 /offset16'] = binop BGTZ (right rs) offset18
### BGTZL
### - Branch on Greater Than Zero Likely
val / ['010111 /rs 00000 /offset16'] = binop BGTZL (right rs) offset18
### BLEZ
### - Branch on Less Than or Equal to Zero
val / ['000110 /rs 00000 /offset16'] = binop BLEZ (right rs) offset18
### BLEZL
### - Branch on Less Than or Equal to Zero Likely
val / ['010110 /rs 00000 /offset16'] = binop BLEZL (right rs) offset18
### BLTZ
### - Branch on Less Than Zero
val / ['000001 /rs 00000 /offset16'] = binop BLTZ (right rs) offset18
### BLTZAL
### - Branch on Less Than Zero And Link
val / ['000001 /rs 10000 /offset16'] = binop BLTZAL (right rs) offset18
### BLTZALL
### - Branch on Less Than Zero And Link Likely
val / ['000001 /rs 10010 /offset16'] = binop BLTZALL (right rs) offset18
### BLTZL
### - Branch on Less Than Zero Likely
val / ['000001 /rs 00010 /offset16'] = binop BLTZL (right rs) offset18
### BNE
### - Branch on Not Equal
val / ['000101 /rs /rt /offset16'] = ternop BNE (right rs) (right rt) offset18
### BNEL
### - Branch on Not Equal Likely
val / ['010101 /rs /rt /offset16'] = ternop BNEL (right rs) (right rt) offset18
### BREAK
### - Breakpoint
val / ['000000 /code10 /code10to20 001101']
......@@ -529,10 +449,6 @@ val / ['011111 /base /rt /offset9 0 101110']
| asmode? = nullop UNDEFINED
| otherwise = binop LLE rt offset9/base
### LUI
### - Load Upper Immediate
val / ['001111 00000 /rt /immediate16'] = binop LUI rt immediate16
### LUXC1
### - Load Doubleword Indexed Unaligned to Floating Point
val / ['010011 /base /index 00000 /fd 000101'] = binop LUXC1 fd index/base
......@@ -545,10 +461,6 @@ val / ['100011 /base /rt /offset16'] = binop LW rt offset16/base
### - Load Word To Floating Point
val / ['110001 /base /ft /offset16'] = binop LWC1 ft offset16/base
### LWC2
### - Load Word to Coprocessor 2
val / ['110010 /base /rt /offset16'] = binop LWC2 rt/imm offset16/base
### LWE
### - Load Word EVA
val / ['011111 /base /rt /offset9 0 101111']
......@@ -917,10 +829,6 @@ val / ['101011 /base /rt /offset16'] = binop SW (right rt) offset16/base
### - Store Word from Floating Point
val / ['111001 /base /ft /offset16'] = binop SWC1 (right ft) offset16/base
### SWC2
### - Store Word from Coprocessor 2
val / ['111010 /base /rt /offset16'] = binop SWC2 rt/imm offset16/base
### SWE
### - Store Word EVA
val / ['011111 /base /rt /offset9 0 011111']
......@@ -1408,30 +1316,12 @@ type instruction =
| ADDU of ternop-lrr
| AND of ternop-lrr
| ANDI of ternop-lrr
| BC1F of binop-rr
| BC1FL of binop-rr
| BC1T of binop-rr
| BC1TL of binop-rr
| BC2F of binop-rr
| BC2FL of binop-rr
| BC2T of binop-rr
| BC2TL of binop-rr
| BEQ of ternop-rrr
| BEQL of ternop-rrr
| BGEZ of binop-rr
| BGEZAL of binop-rr
| BGEZALL of binop-rr
| BGEZL of binop-rr
| BGTZ of binop-rr
| BGTZL of binop-rr
| BLEZ of binop-rr
| BLEZL of binop-rr
| BLTZ of binop-rr
| BLTZAL of binop-rr
| BLTZALL of binop-rr
| BLTZL of binop-rr
| BNE of ternop-rrr
| BNEL of ternop-rrr
| BREAK of unop-r
| C-cond-fmt of ternop-cflrr
| CACHE of binop-rr
......@@ -1487,7 +1377,6 @@ type instruction =
| LUXC1 of binop-lr
| LW of binop-lr
| LWC1 of binop-lr
| LWC2 of binop-rr
| LWE of binop-lr
| MADD of binop-rr
| MADD-fmt of quadop-flrrr
......
......@@ -23,6 +23,94 @@ val / ['001000 /rs /rt /immediate16'] = ternop ADDI rt (right rs) immediate16
### - Floating Point Align Variable
val / ['010011 /rs /ft /fs /fd 011110'] = quadop ALNV-PS fd (right fs) (right ft) (right rs)
### BC1F
### - Branch on FP False
val / ['010001 01000 /cc 0 0 /offset16'] = binop BC1F (right fcc) offset18
### BC1FL
### - Branch on FP False Likely
val / ['010001 01000 /cc 1 0 /offset16'] = binop BC1FL (right fcc) offset18
### BC1T
### - Branch on FP True
val / ['010001 01000 /cc 0 1 /offset16'] = binop BC1T (right fcc) offset18
### BC1TL
### - Branch on FP True Likely
val / ['010001 01000 /cc 1 1 /offset16'] = binop BC1TL (right fcc) offset18
### BC2F
### - Branch on COP2 False
val / ['010010 01000 /cc 0 0 /offset16'] = binop BC2F (right c2cc) offset18
### BC2FL
### - Branch on COP2 False Likely
val / ['010010 01000 /cc 1 0 /offset16'] = binop BC2FL (right c2cc) offset18
### BC2T
### - Branch on COP2 True
val / ['010010 01000 /cc 0 1 /offset16'] = binop BC2T (right c2cc) offset18
### BC2TL
### - Branch on COP2 True Likely
val / ['010010 01000 /cc 1 1 /offset16'] = binop BC2TL (right c2cc) offset18
### BEQL
### - Branch on Equal Likely
val / ['010100 /rs /rt /offset16'] = ternop BEQL (right rs) (right rt) offset18
### BGEZAL
### - Branch on Greater Than or Equal to Zero and Link
val / ['000001 /rs 10001 /offset16'] = binop BGEZAL (right rs) offset18
### BGEZALL
### - Branch on Greater Than or Equal to Zero and Link Likely
val / ['000001 /rs 10011 /offset16'] = binop BGEZALL (right rs) offset18
### BGEZL
### - Branch on Greater Than or Equal to Zero Likely
val / ['000001 /rs 00011 /offset16'] = binop BGEZL (right rs) offset18
### BGTZ
### - Branch on Greater Than Zero
val / ['000111 /rs 00000 /offset16'] = binop BGTZ (right rs) offset18
### BGTZL
### - Branch on Greater Than Zero Likely
val / ['010111 /rs 00000 /offset16'] = binop BGTZL (right rs) offset18
### BLEZ
### - Branch on Less Than or Equal to Zero
val / ['000110 /rs 00000 /offset16'] = binop BLEZ (right rs) offset18
### BLEZL
### - Branch on Less Than or Equal to Zero Likely
val / ['010110 /rs 00000 /offset16'] = binop BLEZL (right rs) offset18
### BLTZAL
### - Branch on Less Than Zero And Link
val / ['000001 /rs 10000 /offset16'] = binop BLTZAL (right rs) offset18
### BLTZALL
### - Branch on Less Than Zero And Link Likely
val / ['000001 /rs 10010 /offset16'] = binop BLTZALL (right rs) offset18
### BLTZL
### - Branch on Less Than Zero Likely
val / ['000001 /rs 00010 /offset16'] = binop BLTZL (right rs) offset18
### BNEL
### - Branch on Not Equal Likely
val / ['010101 /rs /rt /offset16'] = ternop BNEL (right rs) (right rt) offset18
### LUI
### - Load Upper Immediate
val / ['001111 00000 /rt /immediate16'] = binop LUI rt immediate16
### LWC2
### - Load Word to Coprocessor 2
val / ['110010 /base /rt /offset16'] = binop LWC2 rt/imm offset16/base
### LWL
### - Load Word Left
val / ['100010 /base /rt /offset16'] = binop LWL rt offset16/base
......@@ -47,11 +135,34 @@ val / ['011111 /base /rt /offset9 0 011010']
### - Load Word Indexed to Floating Point
val / ['010011 /base /index 00000 /fd 000000'] = binop LWXC1 fd index/base
### SWC2
### - Store Word from Coprocessor 2
val / ['111010 /base /rt /offset16'] = binop SWC2 rt/imm offset16/base
type instruction =
ADDI of ternop-lrr
| ALNV-PS of quadop-lrrr
| BC1F of binop-rr
| BC1FL of binop-rr
| BC1T of binop-rr
| BC1TL of binop-rr