Ghidra is a software reverse engineering (SRE) framework
#####################################################
##### Multiply #####
#####################################################
# MUL reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01000100000
:mul R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x220 & R2731
{
local res:8 = sext(R1115) * sext(R0004);
R1115 = res:4;
R2731 = res[32,32];
}
# MUL imm9, reg2, reg3 - rrrrr111111iiiii|wwwww01001IIII00
:mul imm9, R1115, R2731 is op0510=0x3F & op0004 & R1115; op2226=0x9 & op1617=0x0 & s1821 & R2731
[ imm9 = (s1821 << 5) | op0004; ]
{
local res:8 = sext(R1115) * imm9;
R1115 = res:4;
R2731 = res[32,32];
}
# MULH reg1, reg2 - rrrrr000111RRRRR
:mulh R0004, R1115 is op0510=0x07 & R0004 & R1115 & op1115!=0
{
R1115 = sext(R1115:2) * sext(R0004:2);
}
# MULH imm5, reg2 - rrrrr010111iiiii
:mulh s0004, R1115 is op0510=0x17 & s0004 & R1115
{
R1115 = sext(R1115:2) * s0004;
}
# MULHI imm16, reg1, reg2 - rrrrr110111RRRRR|iiiiiiiiiiiiiiii
:mulhi s1631, R0004, R1115 is op0510=0x37 & R1115 & R0004; s1631
{
R1115 = R0004 * s1631;
}
# MULU reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01000100010
:mulu R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x222 & R2731
{
local res:8 = zext(R1115) * zext(R0004);
R1115 = res:4;
R2731 = res[32,32];
}
# MULU imm9, reg2, reg3 - rrrrr111111iiiii|wwwww01001IIII10
:mulu imm9, R1115, R2731 is op0510=0x3F & op0004 & R1115; op2226=0x9 & op1617=0x2 & op1821 & R2731
[ imm9 = (op1821 << 5) | op0004; ]
{
local res:8 = zext(R1115) * imm9;
R1115 = res:4;
R2731 = res[32,32];
}
#####################################################
##### MultiplyAccumulate #####
#####################################################
# MAC reg1, reg2, reg3, reg4 - rrrrr111111RRRRR wwww0011110mmmm0
:mac R0004, R1115, R2731x2, R1620x2 is op0510=0x3F & R0004 & R1115; op2126=0x1E & op1616=0 & R1620x2 & R2731x2
{
R1620x2 = sext(R1115) * sext(R0004) + R2731x2;
}
# MACU reg1, reg2, reg3, reg4 - rrrrr111111RRRRR|wwww0011111mmmm0
:macu R0004, R1115, R2731x2, R1620x2 is op0510=0x3F & R0004 & R1115; op2126=0x1F & op1616=0 & R1620x2 & R2731x2
{
R1620x2 = zext(R1115) * zext(R0004) + R2731x2;
}
#####################################################
##### Arithmetic #####
#####################################################
# ADD reg1, reg2 - rrrrr001110RRRRR
:add R0004, R1115 is op0510=0x0E & R0004 & R1115
{
set_general_flags_pos(R0004, R1115);
R1115 = R1115 + R0004;
}
# ADD imm5, reg2 - rrrrr010010iiiii
:add s0004, R1115 is op0510=0x12 & s0004 & R1115
{
set_general_flags_pos(s0004, R1115);
R1115 = R1115 + s0004;
}
# ADDI imm16, reg1, reg2 - rrrrr110000RRRRR|iiiiiiiiiiiiiiii
:addi s1631, R0004, R1115 is op0510=0x30 & R1115 & R0004; s1631
{
set_general_flags_pos(R0004, s1631);
R1115 = R0004 + s1631;
}
# CMP reg1, reg2 - rrrrr001111RRRRR
:cmp R0004, R1115 is op0510=0x0F & R0004 & R1115
{
set_general_flags_neg(R1115, R0004);
}
# CMP imm5, reg2 - rrrrr010011iiiii
:cmp s0004, R1115 is op0510=0x13 & s0004 & R1115
{
set_general_flags_neg(R1115, s0004);
}
# MOV reg1, reg2 - rrrrr000000RRRRR
:mov R0004, R1115 is op0510=0x00 & R0004 & R1115
{
R1115 = R0004;
}
# MOV imm5, reg2 - rrrrr010000iiiii
:mov s0004, R1115 is op0510=0x10 & s0004 & R1115 & op1115!=0
{
R1115 = s0004;
}
# MOV imm32, reg1 - 00000110001RRRRR|iiiiiiiiiiiiiiii|IIIIIIIIIIIIIIII
:mov imm32, R0004 is op0515=0x031 & R0004; op1631; op3247
[ imm32 = (op3247 << 16) | op1631; ]
{
R0004 = imm32;
}
# MOVEA imm16, reg1, reg2 - rrrrr110001RRRRR|iiiiiiiiiiiiiiii
:movea s1631, R0004, R1115 is op0510=0x31 & op1115!=0 & R0004 & R1115; s1631
{
R1115 = R0004 + s1631;
}
# MOVHI imm16, reg1, reg2 - rrrrr110010RRRRR|iiiiiiiiiiiiiiii
:movhi s1631, R0004, R1115 is op0510=0x32 & op1115!=0 & R0004 & R1115; s1631
{
R1115 = R0004 + (s1631 << 16);
}
# SUB reg1, reg2 - rrrrr001101RRRRR
:sub R0004, R1115 is op0510=0x0D & R0004 & R1115
{
set_general_flags_neg(R1115, R0004);
R1115 = R1115 - R0004;
}
# SUBR reg1, reg2 - rrrrr001100RRRRR
:subr R0004, R1115 is op0510=0x0C & R0004 & R1115
{
set_general_flags_neg(R0004, R1115);
R1115 = R0004 - R1115;
}
#####################################################
##### Saturated #####
#####################################################
define pcodeop __saturate;
# SATADD reg1, reg2 - rrrrr000110RRRRR
:satadd R0004, R1115 is op0510=0x06 & R0004 & R1115 & op1115!=0
{
set_CY_pos(R1115, R0004);
set_OV_pos(R1115, R0004);
$(SAT) = $(SAT) || $(OV);
R1115 = R1115 + R0004;
R1115 = __saturate(R1115);
set_S(R1115);
set_Z(R1115);
}
#SATADD imm5, reg2 - rrrrr010001iiiii
:satadd s0004, R1115 is op0510=0x11 & s0004 & R1115 & op1115!=0
{
set_CY_pos(R1115, s0004);
set_OV_pos(R1115, s0004);
$(SAT) = $(SAT) || $(OV);
R1115 = R1115 + s0004;
R1115 = __saturate(R1115);
set_S(R1115);
set_Z(R1115);
}
# SATADD reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01110111010
:satadd R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x3BA & R2731
{
set_CY_pos(R1115, R0004);
set_OV_pos(R1115, R0004);
$(SAT) = $(SAT) || $(OV);
R2731 = R1115 + R0004;
R2731 = __saturate(R2731);
set_S(R2731);
set_Z(R2731);
}
# SATSUB reg1, reg2 - rrrrr000101RRRRR
:satsub R0004, R1115 is op0510=0x05 & R0004 & R1115 & op1115!=0
{
$(CY) = R1115 < R0004;
$(OV) = sborrow(R1115, R0004);
$(SAT) = $(SAT) || $(OV);
R1115 = R1115 - R0004;
R1115 = __saturate(R1115);
$(S) = R1115 s< 0;
$(Z) = R1115 == 0;
}
# SATSUB reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01110011010
:satsub R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x39A & R2731
{
$(CY) = R1115 < R0004;
$(OV) = sborrow(R1115, R0004);
$(SAT) = $(SAT) || $(OV);
R2731 = R1115 - R0004;
R2731 = __saturate(R2731);
$(S) = R2731 s< 0;
$(Z) = R2731 == 0;
}
# SATSUBI imm16, reg1, reg2
:satsubi s1631, R0004, R1115 is op0510=0x33 & op1115!=0 & R0004 & R1115; s1631
{
$(CY) = R1115 < s1631;
$(OV) = sborrow(R1115, s1631);
$(SAT) = $(SAT) || $(OV);
R1115 = R1115 - s1631;
R1115 = __saturate(R1115);
$(S) = R1115 s< 0;
$(Z) = R1115 == 0;
}
# SATSUBR reg1, reg2
:satsubr R0004, R1115 is op0510=0x04 & R0004 & R1115 & op1115!=0
{
$(CY) = R0004 < R1115;
$(OV) = sborrow(R0004, R1115);
$(SAT) = $(SAT) || $(OV);
R1115 = R0004 - R1115;
R1115 = __saturate(R1115);
$(S) = R1115 s< 0;
$(Z) = R1115 == 0;
}
#####################################################
##### Divide #####
#####################################################
# DIV reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01011000000
:div R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x2C0 & R2731
{
local quot:4 = R1115 s/ R0004;
local mod:4 = R1115 s% R0004;
$(OV) = ((R1115 == 0x80000000 && R0004 == 0xFFFFFFFF) || R0004 == 0x0);
R1115 = quot;
R2731 = mod;
set_Z(R1115);
set_S(R1115);
}
# DIVH reg1, reg2 - rrrrr000010RRRRR
:divh R0004, R1115 is op0510=0x02 & R0004 & R1115
{
$(OV) = ((R1115 == 0x80000000 && R0004 == 0xFFFFFFFF) || R0004 == 0x0);
R1115 = R1115 / R0004;
set_Z(R1115);
set_S(R1115);
}
# DIVH reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01010000000
:divh R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x280 & R2731
{
local quot:4 = R1115 s/ sext(R0004:2);
local mod:4 = R1115 s% sext(R0004:2);
$(OV) = ((R1115 == 0x80000000 && R0004 == 0xFFFFFFFF) || R0004 == 0x0);
R1115 = quot;
R2731 = mod;
set_Z(R1115);
set_S(R1115);
}
# DIVHU reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01010000010
:divhu R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x282 & R2731
{
local quot:4 = R1115 / zext(R0004:2);
local mod:4 = R1115 % zext(R0004:2);
R1115 = quot;
R2731 = mod;
$(OV) = (R0004 == 0);
set_Z(R1115);
set_S(R1115);
}
# DIVU reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01011000010
:divu R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x2C2 & R2731
{
local quot:4 = R1115 / R0004;
local mod:4 = R1115 % R0004;
$(OV) = (R0004 == 0);
R1115 = quot;
R2731 = mod;
set_Z(R1115);
set_S(R1115);
}
#####################################################
##### HighSpeedDivide #####
#####################################################
# DIVQ reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01011111100
:divq R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x2FC & R2731
{
local quot:4 = R1115 s/ R0004;
local mod:4 = R1115 s% R0004;
$(OV) = ((R1115 == 0x80000000 && R0004 == 0xFFFFFFFF) || R0004 == 0x0);
R2731 = mod;
R1115 = quot;
set_Z(R1115);
set_S(R1115);
}
# DIVQU reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01011111110
:divqu R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x2FE & R2731
{
local quot:4 = R1115 / R0004;
local mod:4 = R1115 % R0004;
$(OV) = (R0004 == 0);
R2731 = mod;
R1115 = quot;
set_Z(R1115);
set_S(R1115);
}
#####################################################
##### Conditional #####
#####################################################
# ADF cccc, reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww011101cccc0
:adf^c1720 R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op2126=0x1D & op1616=0 & c1720 & R2731
{
local cond = zext(c1720);
set_OV_pos2(R1115, R0004, cond);
set_CY_pos2(R1115, R0004, cond);
R2731 = R1115 + R0004 + cond;
set_S(R2731);
set_Z(R2731);
}
# SBF cccc, reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww011100cccc0
:sbf^c1720 R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op2126=0x1C & op1616=0 & c1720 & R2731
{
local cond = zext(c1720);
set_OV_neg2(R1115, R0004, cond);
set_CY_neg2(R1115, R0004, cond);
R2731 = R1115 - R0004 - cond;
set_S(R2731);
set_Z(R2731);
}
#####################################################
##### Logic #####
#####################################################
# AND reg1, reg2 - rrrrr001010RRRRR
:and R0004, R1115 is op0510=0x0A & R0004 & R1115
{
R1115 = R1115 & R0004;
set_OV0_S_Z(R1115);
}
# ANDI imm16, reg1, reg2 - rrrrr110110RRRRR|iiiiiiiiiiiiiiii
:andi op1631, R0004, R1115 is op0510=0x36 & R1115 & R0004; op1631
{
R1115 = R0004 & op1631;
set_OV0_S_Z(R1115);
}
# NOT reg1, reg2 - rrrrr000001RRRRR
:not R0004, R1115 is op0510=0x01 & R0004 & R1115
{
R1115 = ~R0004;
set_OV0_S_Z(R1115);
}
# OR reg1, reg2 - rrrrr001000RRRRR
:or R0004, R1115 is op0510=0x08 & R0004 & R1115
{
R1115 = R1115 | R0004;
set_OV0_S_Z(R1115);
}
# ORI imm16, reg1, reg2 - rrrrr110100RRRRR|iiiiiiiiiiiiiiii
:ori op1631, R0004, R1115 is op0510=0x34 & R1115 & R0004; op1631
{
R1115 = R0004 | op1631;
set_OV0_S_Z(R1115);
}
# TST reg1, reg2 - rrrrr001011RRRRR
:tst R0004, R1115 is op0510=0x0B & R0004 & R1115
{
set_OV0_S_Z(R1115 & R0004);
}
# XOR reg1, reg2 - rrrrr001001RRRRR
:xor R0004, R1115 is op0510=0x09 & R0004 & R1115
{
R1115 = R1115 ^ R0004;
set_OV0_S_Z(R1115);
}
# XORI imm16, reg1, reg2 - rrrrr110101RRRRR|iiiiiiiiiiiiiiii
:xori op1631, R0004, R1115 is op0510=0x35 & R1115 & R0004; op1631
{
R1115 = R0004 ^ op1631;
set_OV0_S_Z(R1115);
}
#####################################################
##### BitManipulation #####
#####################################################
# CLR1 bit#3, disp16[reg1] - 10bbb111110RRRRR|dddddddddddddddd
:clr1 op1113, s1631[R0004] is op0510=0x3E & op1415=2 & op1113 & R0004; s1631
{
local adr:4 = R0004 + s1631;
local tkn = *:1 adr;
*:1 adr = tkn & ~(1 << op1113);
set_Z(tkn & (1 << op1113));
}
# CLR1 reg2, [reg1] - rrrrr111111RRRRR|0000000011100100
:clr1 R1115, [R0004] is op0510=0x3F & R0004 & R1115; op1631=0xE4
{
local tkn = *:1 R0004;
*:1 R0004 = tkn & ~(1 << R1115);
set_Z(tkn & (1 << R1115));
}
# NOT1 bit#3, disp16[reg1] - 01bbb111110RRRRR|dddddddddddddddd
:not1 op1113, s1631[R0004] is op0510=0x3E & op1415=1 & op1113 & R0004; s1631
{
local adr:4 = R0004 + s1631;
local tkn = *:1 adr;
*:1 adr = tkn ^ (1 << op1113);
set_Z(tkn & (1 << op1113));
}
# NOT1 reg2, [reg1] - rrrrr111111RRRRR|0000000011100010
:not1 R1115, [R0004] is op0510=0x3F & R0004 & R1115; op1631=0xE2
{
local tkn = *:1 R0004;
*:1 R0004 = tkn ^ (1 << R1115);
set_Z(tkn & (1 << R1115));
}
# SET1 bit#3, disp16[reg1] - 00bbb111110RRRRR|dddddddddddddddd
:set1 op1113, s1631[R0004] is op0510=0x3E & op1415=0 & op1113 & R0004; s1631
{
local adr:4 = R0004 + s1631;
local tkn = *:1 adr;
*:1 adr = tkn | (1 << op1113);
set_Z(tkn & (1 << op1113));
}
# SET1 reg2, [reg1] - rrrrr111111RRRRR|0000000011100000
:set1 R1115, [R0004] is op0510=0x3F & R0004 & R1115; op1631=0xE0
{
local tkn = *:1 R0004;
*:1 R0004 = tkn | (1 << R1115);
set_Z(tkn & (1 << R1115));
}
# TST1 bit#3, disp16[reg1] - 11bbb111110RRRRR|dddddddddddddddd
:tst1 op1113, s1631[R0004] is op0510=0x3E & op1415=3 & op1113 & R0004; s1631
{
local adr:4 = R0004 + s1631;
local tkn = *:1 adr;
set_Z(tkn & (1 << op1113));
}
# TST1 reg2, [reg1] - rrrrr111111RRRRR|0000000011100110
:tst1 R0004, [R1115] is op0510=0x3F & R0004 & R1115; op1631=0xE6
{
local tkn = *:1 R0004;
set_Z(tkn & (1 << R1115));
}
#####################################################
##### BitSearch #####
#####################################################
# SCH0L reg2, reg3 - rrrrr11111100000|wwwww01101100100
:sch0l R1115, R2731 is op0010=0x7E0 & R1115; op1626=0x364 & R2731
{
SearchLeft(R2731, R1115, 0);
$(CY) = (R1115 != 0xFFFFFFFF); # zero bit found
$(Z) = (R1115 == 0xFFFFFFFF); # zero bit not found
}
# SCH0R reg2, reg3 - rrrrr11111100000|wwwww01101100000
:sch0r R1115, R2731 is op0010=0x7E0 & R1115; op1626=0x360 & R2731
{
SearchRight(R2731, R1115, 0);
$(CY) = (R1115 != 0xFFFFFFFF); # zero bit found
$(Z) = (R1115 == 0xFFFFFFFF); # zero bit not found
}
# SCH1L reg2, reg3 - rrrrr11111100000|wwwww01101100110
:sch1l R1115, R2731 is op0010=0x7E0 & R1115; op1626=0x366 & R2731
{
SearchLeft(R2731, R1115, 1);
$(CY) = (R1115 != 0x0); # one bit found
$(Z) = (R1115 == 0x0); # one bit not found
}
# SCH1R reg2, reg3
:sch1r R1115, R2731 is op0010=0x7E0 & R1115; op1626=0x362 & R2731
{
SearchRight(R2731, R1115, 1);
$(CY) = (R1115 != 0x0); # one bit found
$(Z) = (R1115 == 0x0); # one bit not found
}
#####################################################
##### Branch #####
#####################################################
#Bcond adr9 - ddddd1011dddcccc
:b^c0003 adr9 is op0710=0xB & c0003 & adr9
{
if (c0003)
goto adr9;
}
:br adr9 is op0710=0xB & op0003=0x5 & adr9
{
goto adr9;
}
# JARL disp22, reg2 - rrrrr11110dddddd|ddddddddddddddd0
:jarl adr22, R1115 is (op0610=0x1E & R1115) ... & adr22
{
R1115 = inst_next;
call adr22;
}
# JARL disp32, reg1 - 00000010111RRRRR|ddddddddddddddd0|DDDDDDDDDDDDDDDD
:jarl adr32, R0004 is op0515=0x017 & R0004; adr32
{
R0004 = inst_next;
call adr32;
}
# JMP [reg1] - 00000000011RRRRR
:jmp [R0004] is op0515=0x03 & R0004 & op0004=0x1F
{
return [R0004];
}
:jmp [R0004] is op0515=0x03 & R0004
{
goto [R0004];
}
# JMP disp32[reg1] - 00000110111RRRRR|ddddddddddddddd0|DDDDDDDDDDDDDDDD
:jmp adr32i[R0004] is op0515=0x037 & R0004; adr32i
{
local adr = adr32i + R0004;
goto [adr];
}
# JR disp22 - 00000111110ddddd|ddddddddddddddd0
:jr adr22 is op0615=0x1E ... & adr22
{
goto adr22;
}
# JR disp32 - 0000001011100000|ddddddddddddddd0|DDDDDDDDDDDDDDDD
:jr adr32 is op0015=0x2E0; adr32
{
goto adr32;
}
#####################################################
##### Special #####
#####################################################
# CALLT imm6 - 0000001000iiiiii
:callt op0005 is op0615=0x8 & op0005
{
CTPC = inst_next;
CTPSW = PSW;
local adr:4 = CTBP + (op0005 << 1);
PC = CTBP + zext(*:2 adr);
call [PC];
}
# CAXI [reg1], reg2, reg3 - rrrrr111111RRRRR|wwwww00011101110
:caxi [R0004], R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0xEE & R2731
{
local tkn = *:4 (R0004 & ~(0x3));
local result = R1115 - tkn;
*:4 R0004 = tkn * zext(result != 0) + R2731 * zext(result == 0);
R2731 = tkn;
set_general_flags_neg(R1115, tkn);
}
# CTRET - 0000011111100000|0000000101000100
:ctret is op0515=0x3F; op1631=0x144
{
PC = CTPC;
PSW = CTPSW;
return [PC];
}
# DI - 0000011111100000|0000000101100000
define pcodeop __disable_irq;
:di is op0015=0x7E0; op1631=0x160
{
$(ID) = 1;
__disable_irq();
}
# DISPOSE imm5, list12 - 0000011001iiiiiL|LLLLLLLLLLL00000
:dispose prep0105, DispList is prep0615=0x19 & prep1620=0x0 & prep0105 & DispList
{
sp = sp + (prep0105 << 2);
build DispList;
}
# DISPOSE imm5, list12, [reg1] - 0000011001iiiiiL|LLLLLLLLLLLRRRRR
:dispose prep0105, DispList, [prep1620] is prep0615=0x19 & prep1620 & prep0105 & DispList
{
sp = sp + (prep0105 << 2);
build DispList;
PC = prep1620;
return [PC];
}
# EI - 1000011111100000|0000000101100000
define pcodeop __enable_irq;
:ei is op0015=0x87E0; op1631=0x160
{
$(ID) = 0;
__enable_irq();
}
# EIRET - 0000011111100000|0000000101001000
:eiret is op0515=0x3F; op1631=0x148
{
PC = EIPC;
PSW = EIPSW;
return [PC];
}
# FERET - 0000011111100000|0000000101001010
:feret is op0515=0x3F; op1631=0x14A
{
PC = FEPC;
PSW = FEPSW;
return [PC];
}
# FETRAP vector4 - 0vvvv00001000000
:fetrap op1114 is op0010=0x40 & op1515=0 & op1114 & op1115!=0
{
FEPC = inst_next;
FEPSW = PSW;
FEIC = op1114 + 0x30; # exception code 0x30..0x3F
@ifndef V850E3
$(FECC) = op1114 + 0x30; # exception code 0x30..0x3F
@else
$(UM) = 0;
@endif
$(EP) = 1;
$(ID) = 1;
$(NP) = 1;
PC = 0x30;
goto [PC];
}
# HALT - 0000011111100000|0000000100100000
define pcodeop __halt;
:halt is op0015=0x7E0; op1631=0x120
{
goto inst_start;
}
@ifndef V850E3
# LDSR reg2, regID - rrrrr111111RRRRR|0000000000100000
:ldsr R0004, SR1115 is op0510=0x3F & SR1115 & R0004; op1631=0x20
{
SR1115 = R0004;
}
@endif
# NOP - 0000000000000000
:nop is op0015=0x0
{ }
# PREPARE list12, imm5 - 0000011110iiiiiL|LLLLLLLLLLL00001
:prepare PrepList, prep0105 is prep0615=0x1E & prep0105 & prep1620=0x1 & PrepList
{
build PrepList;
sp = sp - (prep0105 << 2);
}
# PREPARE list12, imm5, sp - 0000011110iiiiiL|LLLLLLLLLLL00011
:prepare PrepList, prep0105, sp is prep0615=0x1E & prep0105 & prep1620=0x3 & PrepList & sp
{
build PrepList;
sp = sp - (prep0105 << 2);
ep = sp;
}
# PREPARE list12, imm5, imm16 (low) - 0000011110iiiiiL|LLLLLLLLLLL01011|iiiiiiiiiiiiiiii
:prepare PrepList, prep0105, s3247 is prep0615=0x1E & prep0105 & prep1620=0xB & PrepList; s3247
{
build PrepList;
sp = sp - (prep0105 << 2);
ep = s3247;
}
# PREPARE list12, imm5, imm16 (high) - 0000011110iiiiiL|LLLLLLLLLLL10011|iiiiiiiiiiiiiiii
:prepare PrepList, prep0105, s3247 is prep0615=0x1E & prep0105 & prep1620=0x13 & PrepList; s3247
{
build PrepList;
sp = sp - (prep0105 << 2);
ep = s3247 << 16;
}
# PREPARE list12, imm5, imm32 - 0000011110iiiiiL|LLLLLLLLLLL11011|iiiiiiiiiiiiiiii|iiiiiiiiiiiiiiii
:prepare PrepList, prep0105, imm32 is prep0615=0x1E & prep0105 & prep1620=0x1B & PrepList; op3247; op4863
[ imm32 = (op4863 << 16) | op3247; ]
{
build PrepList;
sp = sp - (prep0105 << 2);
ep = imm32;
}
# RETI - 0000011111100000|0000000101000000
:reti is op0515=0x3F; op1631=0x140
{
if($(EP)!=1)
goto <false>;
PC = EIPC;
PSW = EIPSW;
goto <end>;
<false>
if($(NP)!=1)
goto <false2>;
PC = FEPC;
PSW = FEPSW;
goto <end>;
<false2>
PC = EIPC;
PSW = EIPSW;
<end>
return[PC];
}
# RIE - 0000000001000000
:rie is op0015=0x40
{
FEPC = PC;
FEPSW = PSW;
$(NP) = 1;
$(EP) = 1;
$(ID) = 1;
PC = 0x30;
goto [PC];
}
# RIE imm5, imm4 - iiiii1111111IIII|0000000000000000
:rie op1115, op0003 is op0410=0x7F & op1115 & op0003; op1631=0x0
{
FEPC = PC;
FEPSW = PSW;
$(NP) = 1;
$(EP) = 1;
$(ID) = 1;
PC = 0x30;
goto [PC];
}
@ifndef V850E3
# STSR regID, reg2 - rrrrr111111RRRRR|0000000001000000
:stsr SR0004, R1115 is op0510=0x3F & R1115 & SR0004; op1631=0x40
{
R1115 = SR0004;
}
@endif
# SWITCH reg1 - 00000000010RRRRR
:switch R0004 is op0515=0x2 & R0004
{
local adr:4 = inst_next + (R0004 << 1);
PC = inst_next + (sext(*:2 adr) << 1);
goto [PC];
}
# SYNCE - 0000000000011101
define pcodeop __synchronize;
:synce is op0015=0x1D
{
__synchronize();
}
# SYNCM - 0000000000011110
:syncm is op0015=0x1E
{
__synchronize();
}
# SYNCP - 0000000000011111
:syncp is op0015=0x1F
{
__synchronize();
}
# SYSCALL vector8 - 11010111111vvvvv|00VVV00101100000
:syscall vector8 is op0515=0x6BF & op0004; op3031=0 & op2729 & op1626=0x160
[ vector8 = (op2729 << 5) | op0004; ]
{
EIPC = inst_next;
EIPSW = PSW;
EIIC = vector8 + 0x8000; # exception code 0x8000..0x80FF
@ifndef V850E3
$(EICC) = vector8 + 0x8000; # exception code 0x8000..0x80FF
@else
$(UM) = 0;
@endif
$(EP) = 1;
$(ID) = 1;
local adr:4;
either_or(adr, (vector8 <= SCCFG), SCBP + (vector8 << 2), SCBP);
PC = SCBP + (*:4 adr);
call [PC];
}
# TRAP imm5 - 00000111111vvvvv|0000000100000000
:trap op0004 is op0515=0x3F & op0004; op1631=0x100
{
local vector5:4 = op0004;
EIPC = inst_next;
EIPSW = PSW;
EIIC = vector5 + 0x40; # exception code 0x40..0x5F
@ifndef V850E3
$(EICC) = vector5:2 + 0x40; # exception code 0x40..0x5F
@else
$(UM) = 0;
@endif
$(EP) = 1;
$(ID) = 1;
either_or(PC, (vector5 <= 15), 0x40, 0x50);
call [PC];
}
#####################################################
##### Load #####
#####################################################
# LD.B disp16[reg1], reg2 - rrrrr111000RRRRR|dddddddddddddddd
:ld.b s1631[R0004], R1115 is op0510=0x38 & R0004 & R1115; s1631
{
local adr:4 = R0004 + s1631;
R1115 = sext(*:1 adr);
}
# LD.B disp23[reg1], reg3 - rrrrr111100RRRRR|wwwwwddddddd0101|DDDDDDDDDDDDDDDD
:ld.b disp23[R0004], R2731 is op0515=0x3C & R0004; R2731 & op2026 & op1619=0x5; s3247
[ disp23 = (s3247 << 7) | op2026; ]
{
local adr:4 = R0004 + disp23;
R2731 = sext(*:1 adr);
}
# LD.BU disp16[reg1], reg2 - rrrrr11110bRRRRR|ddddddddddddddd1
:ld.bu disp16[R0004], R1115 is op0610=0x1E & R0004 & R1115 & op0505; op1616=0x1 & s1731
[ disp16 = (s1731 << 1) | op0505; ]
{
local adr:4 = R0004 + disp16;
R1115 = zext(*:1 adr);
}
# LD.BU disp23[reg1], reg3 - 00000111101RRRRR|wwwwwddddddd0101|DDDDDDDDDDDDDDDD
:ld.bu disp23[R0004], R2731 is op0515=0x3D & R0004; R2731 & op2026 & op1619=0x5; s3247
[ disp23 = (s3247 << 7) | op2026; ]
{
local adr:4 = R0004 + disp23;
R2731 = zext(*:1 adr);
}
# LD.H disp16[reg1], reg2 - rrrrr111001RRRRR|ddddddddddddddd0
:ld.h s1631[R0004], R1115 is op0510=0x39 & R0004 & R1115; s1631 & op1616=0x0
{
local adr:4 = R0004 + s1631;
R1115 = sext(*:2 adr);
}
# LD.H disp23[reg1], reg3 - 00000111100RRRRR|wwwwwdddddd00111|DDDDDDDDDDDDDDDD
:ld.h disp23[R0004], R2731 is op0515=0x3C & R0004; R2731 & op2126 & op1620=0x7; s3247
[ disp23 = (s3247 << 7) | (op2126 << 1); ]
{
local adr:4 = R0004 + disp23;
R2731 = sext(*:2 adr);
}
# LD.HU disp16[reg1], reg2 - rrrrr111111RRRRR|ddddddddddddddd1
:ld.hu disp16[R0004], R1115 is op0510=0x3F & R0004 & R1115; op1616=0x1 & s1731
[ disp16 = s1731 << 1; ]
{
local adr:4 = R0004 + disp16;
R1115 = zext(*:2 adr);
}
# LD.HU disp23[reg1], reg3 - 00000111101RRRRR|wwwwwdddddd00111|DDDDDDDDDDDDDDDD
:ld.hu disp23[R0004], R2731 is op0515=0x3D & R0004; R2731 & op2026 & op1619=0x7; s3247
[ disp23 = (s3247 << 7) | op2026; ]
{
local adr:4 = R0004 + disp23;
R2731 = zext(*:2 adr);
}
# LD.W disp16[reg1], reg2 - rrrrr111001RRRRR|ddddddddddddddd1
:ld.w disp16[R0004], R1115 is op0510=0x39 & R0004 & R1115; s1731 & op1616=0x1
[ disp16 = s1731 * 2; ]
{
local adr:4 = R0004 + disp16;
R1115 = *:4 adr;
}
# LD.W disp23[reg1], reg3 - 00000111100RRRRR|wwwwwdddddd01001|DDDDDDDDDDDDDDDD
:ld.w disp23[R0004], R2731 is op0515=0x03C & R0004; R2731 & op2126 & op1620=0x9; s3247
[ disp23 = (s3247 << 7) | (op2126 << 1); ]
{
local adr:4 = R0004 + disp23;
R2731 = *:4 adr;
}
# SLD.B disp7[ep], reg2 - rrrrr0110ddddddd
:sld.b op0006[ep], R1115 is op0710=0x06 & op0006 & R1115 & ep
{
local adr:4 = ep + op0006;
R1115 = sext(*:1 adr);
}
# SLD.BU disp4[ep], reg2 - rrrrr0000110dddd
:sld.bu op0003[ep], R1115 is op0410=0x06 & R1115 & op0003 & ep
{
local adr:4 = ep + op0003;
R1115 = zext(*:1 adr);
}
# SLD.H disp8[ep], reg2 - rrrrr1000ddddddd
:sld.h disp8[ep], R1115 is op0710=0x08 & op0006 & R1115 & ep
[ disp8 = op0006 * 2; ]
{
local adr:4 = ep + disp8;
R1115 = sext(*:2 adr);
}
# SLD.HU disp5[ep], reg2 - rrrrr0000111dddd
:sld.hu disp5[ep], R1115 is op0410=0x07 & R1115 & op0003 & ep
[ disp5 = op0003 * 2; ]
{
local adr:4 = ep + disp5;
R1115 = zext(*:2 adr);
}
# SLD.W disp8[ep], reg2 - rrrrr1010dddddd0
:sld.w disp8[ep], R1115 is op0710=0x0A & op0000=0x0 & op0106 & R1115 & ep
[ disp8 = op0106 * 4; ]
{
local adr:4 = ep + disp8;
R1115 = *:4 adr;
}
#####################################################
##### Store #####
#####################################################
# SST.B reg2, disp7[ep] - rrrrr0111ddddddd
:sst.b R1115, op0006[ep] is op0710=0x07 & op0006 & R1115 & ep
{
local adr:4 = ep + op0006;
local tmp:4 = R1115;
*:1 adr = tmp:1;
}
# SST.H reg2, disp8[ep] - rrrrr1001ddddddd
:sst.h R1115, disp8[ep] is op0710=0x09 & op0006 & R1115 & ep
[ disp8 = op0006 * 2; ]
{
local adr:4 = ep + disp8;
local tmp:4 = R1115;
*:2 adr = tmp:2;
}
# SST.W reg2, disp8[ep] - rrrrr1010dddddd1
:sst.w R1115, disp8[ep] is op0710=0x0A & op0000=0x1 & op0106 & R1115 & ep
[ disp8 = op0106 * 4; ]
{
local adr:4 = ep + disp8;
local tmp:4 = R1115;
*:4 adr = tmp;
}
# ST.B reg2, disp16[reg1] - rrrrr111010RRRRR|dddddddddddddddd
:st.b R1115, s1631[R0004] is op0510=0x3A & R0004 & R1115; s1631
{
local adr:4 = R0004 + s1631;
local tmp:4 = R1115;
*:1 adr = tmp:1;
}
# ST.B reg3, disp23[reg1] - 00000111100RRRRR|dddddddddddddddd
:st.b R2731, disp23[R0004] is op0515=0x3C & R0004; R2731 & op2026 & op1619=0xD; s3247
[ disp23 = (s3247 << 7) | op2026; ]
{
local adr:4 = R0004 + disp23;
local tmp:4 = R2731;
*:1 adr = tmp:1;
}
# ST.H reg2, disp16[reg1] - rrrrr111011RRRRR|ddddddddddddddd0
:st.h R1115, s1631[R0004] is op0510=0x3B & R0004 & R1115; s1631 & op1616=0x0
{
local adr:4 = R0004 + s1631;
local tmp:4 = R1115;
*:2 adr = tmp:2;
}
# ST.H reg3, disp23[reg1] - 00000111101RRRRR|wwwwwdddddd01101|DDDDDDDDDDDDDDDD
:st.h R2731, disp23[R0004] is op0515=0x3D & R0004; R2731 & op2126 & op1620=0xD; s3247
[ disp23 = (s3247 << 7) | (op2126 << 1); ]
{
local adr:4 = R0004 + disp23;
local tmp:4 = R2731;
*:2 adr = tmp:2;
}
# ST.W reg2, disp16[reg1] - rrrrr111011RRRRR|ddddddddddddddd1
:st.w R1115, disp16[R0004] is op0510=0x3B & R0004 & R1115; s1731 & op1616=0x1
[ disp16 = s1731 * 2; ]
{
local adr:4 = R0004 + disp16;
local tmp:4 = R1115;
*:4 adr = tmp;
}
# ST.W reg3, disp23[reg1] - 00000111100RRRRR|wwwwwdddddd01111|DDDDDDDDDDDDDDDD
:st.w R2731, disp23[R0004] is op0515=0x3C & R0004; R2731 & op2126 & op1620=0xF; s3247
[ disp23 = (s3247 << 7) | (op2126 << 1); ]
{
local adr:4 = R0004 + disp23;
local tmp:4 = R2731;
*:2 adr = tmp:2;
}
#####################################################
##### DataManipulation #####
#####################################################
# BSH reg2, reg3 - rrrrr11111100000|wwwww01101000010
:bsh R1115, R2731 is op0010=0x7E0 & R1115; op1626=0x342 & R2731
{
local x1 = R1115[0,8];
local x2 = R1115[8,8];
local x3 = R1115[16,8];
local x4 = R1115[24,8];
R2731 = zext(x3 << 24) | zext(x4 << 16) | zext(x1 << 8) | zext(x2);
set_S(R2731);
$(OV) = 0;
$(Z) = (x1 == 0) && (x2 == 0);
$(CY) = (x1 == 0) || (x2 == 0);
}
# BSW reg2, reg3 - rrrrr11111100000|wwwww01101000000
:bsw R1115, R2731 is op0010=0x7E0 & R1115; op1626=0x340 & R2731
{
local x1 = R1115[0,8];
local x2 = R1115[8,8];
local x3 = R1115[16,8];
local x4 = R1115[24,8];
R2731 = zext(x1 << 24) | zext(x2 << 16) | zext(x3 << 8) | zext(x4);
set_OV0_S_Z(R2731);
$(CY) = (x1 == 0) || (x2 == 0) || (x3 == 0) || (x4 == 0);
}
# CMOV cccc, reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww011001cccc0
:cmov^c1720 R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op2126=0x19 & op1616=0 & c1720 & R2731
{
local result:4 = zext(c1720);
R2731 = R0004 * zext(result != 0) + R1115 * zext(result == 0);
}
# CMOV cccc, imm5, reg2, reg3 - rrrrr111111iiiii|wwwww011000cccc0
:cmov^c1720 s0004, R1115, R2731 is op0510=0x3F & s0004 & R1115; op2126=0x18 & op1616=0 & c1720 & R2731
{
local result:4 = zext(c1720);
R2731 = s0004 * zext(result != 0) + R1115 * zext(result == 0);
}
# HSH reg2, reg3 - rrrrr11111100000|wwwww01101000110
:hsh R1115, R2731 is op0010=0x7E0 & R1115; op1626=0x346 & R2731
{
R2731 = R1115;
set_S(R2731);
$(OV) = 0;
$(Z) = (R2731:2 == 0);
$(CY) = $(Z);
}
# HSW reg2, reg3 - rrrrr11111100000|wwwww01101000100
:hsw R1115, R2731 is op0010=0x7E0 & R1115; op1626=0x344 & R2731
{
local x1 = R1115:2;
local x2 = R1115[16,16];
R2731 = zext(x1 << 16) | zext(x2);
set_OV0_S_Z(R2731);
$(CY) = (x1 == 0) || (x2 == 0);
}
# SAR reg1, reg2 - rrrrr111111RRRRR|0000000010100000
:sar R0004, R1115 is op0510=0x3F & R0004 & R1115; op1631=0xA0
{
shift_right_arith(R1115, R1115, R0004);
}
# SAR imm5, reg2 - rrrrr010101iiiii
:sar op0004, R1115 is op0510=0x15 & op0004 & R1115
{
shift_right_arith(R1115, R1115, op0004:5);
}
# SAR reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww00010100010
:sar R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0xA2 & R2731
{
shift_right_arith(R2731, R1115, R0004);
}
# SASF cccc, reg2 - rrrrr1111110cccc|0000001000000000
:sasf^c0003 R1115 is op0410=0x7E & c0003 & R1115; op1631=0x0200
{
R1115 = (R1115 << 1) | zext(c0003);
}
# SETF cond, reg2 - rrrrr1111110cccc|0000000000000000
:setf^c0003 R1115 is op0410=0x7E & c0003 & R1115; op1631=0x0
{
R1115 = zext(c0003);
}
# SHL reg1, reg2 - rrrrr111111RRRRR|0000000011000000
:shl R0004, R1115 is op0510=0x3F & R0004 & R1115; op1631=0xC0
{
shift_left_logic(R1115, R1115, R0004);
}
# SHL imm5, reg2 - rrrrr010110iiiii
:shl op0004, R1115 is op0510=0x16 & op0004 & R1115
{
shift_left_logic(R1115, R1115, op0004:5);
}
# SHL reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww00011000010
:shl R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0xC2 & R2731
{
shift_left_logic(R2731, R1115, R0004);
}
# SHR reg1, reg2 - rrrrr111111RRRRR|0000000010000000
:shr R0004, R1115 is op0510=0x3F & R0004 & R1115; op1631=0x80
{
shift_right_logic(R1115, R1115, R0004);
}
# SHR imm5, reg2 - rrrrr010100iiiii
:shr op0004, R1115 is op0510=0x14 & op0004 & R1115
{
shift_right_logic(R1115, R1115, op0004:5);
}
# SHR reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww00010000010
:shr R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x82 & R2731
{
shift_right_logic(R2731, R1115, R0004);
}
# SXB reg1 - 00000000101RRRRR
:sxb R0004 is op0515=0x05 & R0004
{
R0004 = sext(R0004:1);
}
# SXH reg1 - 00000000111RRRRR
:sxh R0004 is op0515=0x07 & R0004
{
R0004 = sext(R0004:2);
}
# ZXB reg1 - 00000000100RRRRR
:zxb R0004 is op0515=0x004 & R0004
{
R0004 = zext(R0004:1);
}
# ZXH reg1 - 00000000110RRRRR
:zxh R0004 is op0515=0x006 & R0004
{
R0004 = zext(R0004:2);
}
#####################################################
##### Float #####
#####################################################
# ABSF.D reg2, reg3 - rrrr011111100000|wwww010001011000
:absf.d R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00000; R2731x2 & op2126=0b100010 & op1620=0b11000
{
R2731x2 = abs(R1115x2);
}
# ABSF.S reg2, reg3 - rrrrr11111100000|wwwww10001001000
:absf.s R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00000; R2731 & op2126=0b100010 & op1620=0b01000
{
R2731 = abs(R1115);
}
# ADDF.D reg1, reg2, reg3 - rrrr0111111RRRR0|wwww010001110000
:addf.d R0004x2, R1115x2, R2731x2 is R1115x2 & op0510=0x3F & R0004x2 ; R2731x2 & op2126=0b100011 & op1620=0b10000
{
R2731x2 = R1115x2 f+ R0004x2;
}
# ADDF.S reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww10001100000
:addf.s R0004, R1115, R2731 is R1115 & op0510=0x3F & R0004 ; R2731 & op2126=0b100011 & op1620=0b00000
{
R2731 = R1115 f+ R0004;
}
# CEILF.DL reg2, reg3 - rrrr011111100010|wwww010001010100
:ceilf.dl R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00010; R2731x2 & op2126=0b100010 & op1620=0b10100
{
local var:8 = ceil(float2float(R1115x2));
R2731x2 = trunc(var);
}
# CEILF.DUL reg2, reg3 - rrrr011111110010|wwww010001010100
:ceilf.dul R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b10010; R2731x2 & op2126=0b100010 & op1620=0b10100
{
local var:8 = ceil(float2float(R1115x2));
R2731x2 = trunc(var);
}
# CEILF.DUW reg2, reg3 - rrrrr11111110010|wwwww10001010000
:ceilf.duw R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b10010; R2731 & op2126=0b100010 & op1620=0b10000
{
R2731 = trunc(ceil(R1115x2));
}
# CEILF.DW reg2, reg3 - rrrrr11111100010|wwwww10001010000
:ceilf.dw R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b00010; R2731 & op2126=0b100010 & op1620=0b10000
{
R2731 = trunc(ceil(R1115x2));
}
# CEILF.SL reg2, reg3 - rrrrr11111100010|wwww010001000100
:ceilf.sl R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b00010; R2731x2 & op2126=0b100010 & op1620=0b00100
{
local var:8 = ceil(float2float(R1115));
R2731x2 = trunc(var);
}
# CEILF.SUL reg2, reg3 - rrrrr11111110010|wwwww10001000100
:ceilf.sul R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b10010; R2731x2 & op2126=0b100010 & op1620=0b00100
{
local var:8 = ceil(float2float(R1115));
R2731x2 = trunc(var);
}
# CEILF.SUW reg2, reg3 - rrrrr11111110010|wwwww10001000000
:ceilf.sul R1115, R2731 is R1115 & op0510=0x3F & op0004=0b10010; R2731 & op2126=0b100010 & op1620=0b00000
{
R2731 = trunc(ceil(R1115));
}
# CEILF.SW reg2, reg3 - rrrrr11111100010|wwwww10001000000
:ceilf.sw R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00010; R2731 & op2126=0b100010 & op1620=0b00000
{
R2731 = trunc(ceil(R1115));
}
# CMOVF.D fcbit, reg1, reg2, reg3 - rrrr0111111RRRR0|wwww01000001fff0
:cmovf.d fcbit1719, R1115x2, R0004x2, R2731x2 is R1115x2 & op0510=0x3F & R0004x2; R2731x2 & op2126=0b100000 & op2020=1 & fcbit1719 & op1616=0
{
#CC0 = Bit 24
local bit = (FPSR >> (fcbit1719 + 24:1)) & 0x1;
either_or1(R2731x2, bit, R0004x2, R1115x2);
}
# CMOVF.S fcbit, reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww1000000fff0
:cmovf.s fcbit1719, R1115, R0004, R2731 is R1115 & op0510=0x3F & R0004; R2731 & op2126=0b100000 & op2020=0 & fcbit1719 & op1616=0
{
local bit = (FPSR >> (fcbit1719 + 24:1)) & 0x1;
either_or1(R2731, bit, R0004, R1115);
}
# CMPF.D fcond, reg2, reg1, fcbit - rrrr0111111RRRRR|0FFFF1000011fff0
:cmpf.d fcond2730, R1115x2, R0004x2, fcbit1719 is R1115x2 & op0510=0x3F & R0004x2; op3131=0 & fcond2730 & op2126=0b100001 & op2020=1 & fcbit1719 & op1616=0
{
#0 = Unordered
#1 = Equal to
#2 = Less than
#3 = Exeption
#bits = ex le eq un
local bit:4 = 0;
compare_float(bit, fcond2730:1, R0004x2, R1115x2);
local pos:4 = bit << (fcbit1719 + 24); #find position of the calculated bit
local mask:4 = 1 << (fcbit1719 + 24); #create mask to clean old bit in FPSR register
FPSR = (FPSR & ~mask) | pos; #set the new bit at the right position
}
# CMPF.S fcond, reg2, reg1, fcbit - rrrrr111111RRRRR|0FFFF1000010fff0
:cmpf.s fcond2730, R1115, R0004, fcbit1719 is R1115 & op0510=0x3F & R0004; op3131=0 & fcond2730 & op2126=0b100001 & op2020=0 & fcbit1719 & op1616=0
{
local bit:4 = 0;
compare_float(bit, fcond2730:1, R0004, R1115);
local pos:4 = bit << (fcbit1719 + 24); #find position of the calculated bit
local mask:4 = 1 << (fcbit1719 + 24); #create mask to clean old bit in FPSR register
FPSR = (FPSR & ~mask) | pos; #set the new bit at the right position
}
# CVTF.DL reg2, reg3 - rrrr011111100100|wwww010001010100
:cvtf.dl R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00100; R2731x2 & op2126=0b100010 & op1620=0b10100
{
R2731x2 = int2float(R1115x2);
}
# CVTF.DS reg2, reg3 - rrrr011111100011|wwww010001010010
:cvtf.ds R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b00011; R2731 & op2126=0b100010 & op1620=0b10010
{
R2731 = float2float(R1115x2);
}
# CVTF.DUL reg2, reg3 - rrrr011111110100|wwww010001010100
:cvtf.dul R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b10100; R2731x2 & op2126=0b100010 & op1620=0b10100
{
R2731x2 = trunc(R1115x2);
}
# CVTF.DUW reg2, reg3 - rrrrr11111110100|wwwww10001010000
:cvtf.duw R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b10100; R2731 & op2126=0b100010 & op1620=0b10000
{
R2731 = trunc(R1115x2);
}
# CVTF.DW reg2, reg3 - rrrrr11111100100|wwwww10001010000
:cvtf.sw R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b00100; R2731 & op2126=0b100010 & op1620=0b10000
{
R2731 = trunc(R1115x2);
}
# CVTF.LD reg2, reg3 - rrrr011111100001|wwww010001010010
:cvtf.ls R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00001; R2731x2 & op2126=0b100010 & op1620=0b10010
{
R2731x2 = int2float(R1115x2);
}
# CVTF.LS reg2, reg3 - rrrr011111100001|wwwww10001000010
:cvtf.ls R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b00001; R2731 & op2126=0b100010 & op1620=0b00010
{
R2731 = int2float(R1115x2);
}
# CVTF.SD reg2, reg3 - rrrrr11111100010|wwww010001010010
:cvtf.sd R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b00010; R2731x2 & op2126=0b100010 & op1620=0b10010
{
R2731x2 = float2float(R1115);
}
# CVTF.SL reg2, reg3 - rrrrr11111100100|wwwww10001000100
:cvtf.sl R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b00100; R2731x2 & op2126=0b100010 & op1620=0b00100
{
R2731x2 = trunc(R1115);
}
# CVTF.SUL reg2, reg3 - rrrrr11111110100|wwwww10001000100
:cvtf.sul R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b10100; R2731x2 & op2126=0b100010 & op1620=0b00100
{
R2731x2 = trunc(R1115);
}
# CVTF.SUW reg2, reg3 - rrrrr11111110100|wwwww10001000000
:cvtf.suw R1115, R2731 is R1115 & op0510=0x3F & op0004=0b10100; R2731 & op2126=0b100010 & op1620=0b00000
{
R2731 = trunc(R1115);
}
# CVTF.SW reg2, reg3 - rrrrr11111100100|wwwww10001000000
:cvtf.sw R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00100; R2731 & op2126=0b100010 & op1620=0b00000
{
R2731 = trunc(R1115);
}
# CVTF.ULD reg2, reg3 - rrrr011111100001|wwww010001010010
:cvtf.uls R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b10001; R2731x2 & op2126=0b100010 & op1620=0b10010
{
R2731x2 = int2float(R1115x2);
}
# CVTF.ULS reg2, reg3 - rrrr011111110001|wwwww10001000010
:cvtf.uls R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b10001; R2731 & op2126=0b100010 & op1620=0b00010
{
R2731 = int2float(R1115x2);
}
# CVTF.UWD reg2, reg3 - rrrrr11111110000|wwwww10001010010
:cvtf.uwd R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b10000; R2731x2 & op2126=0b100010 & op1620=0b10010
{
R2731x2 = int2float(R1115);
}
# CVTF.UWS reg2, reg3 - rrrrr11111110000|wwwww10001000010
:cvtf.uws R1115, R2731 is R1115 & op0510=0x3F & op0004=0b10000; R2731 & op2126=0b100010 & op1620=0b00010
{
R2731 = int2float(R1115);
}
# CVTF.WD reg2, reg3 - rrrrr11111100000|wwwww10001010010
:cvtf.wd R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b00000; R2731x2 & op2126=0b100010 & op1620=0b10010
{
R2731x2 = int2float(R1115);
}
# CVTF.WS reg2, reg3 - rrrrr11111100000|wwwww10001000010
:cvtf.ws R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00000; R2731 & op2126=0b100010 & op1620=0b00010
{
R2731 = int2float(R1115);
}
# DIVF.D reg1, reg2, reg3 - rrrr0111111RRRR0|wwww010001111110
:divf.s R0004x2, R1115x2, R2731x2 is R0004x2 & op0510=0x3F & R1115x2; R2731x2 & op2126=0b100011 & op1620=0b11110
{
R2731x2 = R1115x2 f/ R0004x2;
}
# DIVF.S reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww10001101110
:divf.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100011 & op1620=0b01110
{
R2731 = R1115 f/ R0004;
}
# FLOORF.DL reg2, reg3 - rrrr011111100011|wwww010001010100
:floorf.dl R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00011; R2731x2 & op2126=0b100010 & op1620=0b10100
{
local var:8 = floor(float2float(R1115x2));
R2731x2 = trunc(var);
}
# FLOORF.DUL reg2, reg3 - rrrr011111110011|wwww010001010100
:floorf.dul R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b10011; R2731x2 & op2126=0b100010 & op1620=0b10100
{
local var:8 = floor(float2float(R1115x2));
R2731x2 = trunc(var);
}
# FLOORF.DUW reg2, reg3 - rrrrr11111110011|wwwww10001010000
:floorf.duw R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b10011; R2731 & op2126=0b100010 & op1620=0b10000
{
R2731 = trunc(floor(R1115x2));
}
# FLOORF.DW reg2, reg3 - rrrrr11111100011|wwwww10001010000
:floorf.dw R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b00011; R2731 & op2126=0b100010 & op1620=0b10000
{
R2731 = trunc(floor(R1115x2));
}
# FLOORF.SL reg2, reg3 - rrrrr11111100011|wwww010001000100
:floorf.sl R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b00011; R2731x2 & op2126=0b100010 & op1620=0b00100
{
local var:8 = floor(float2float(R1115));
R2731x2 = trunc(var);
}
# FLOORF.SUL reg2, reg3 - rrrrr11111110011|wwwww10001000100
:floorf.sul R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b10011; R2731x2 & op2126=0b100010 & op1620=0b00100
{
local var:8 = floor(float2float(R1115));
R2731x2 = trunc(var);
}
# FLOORF.SUW reg2, reg3 - rrrrr11111110011|wwwww10001000000
:floorf.suw R1115, R2731 is R1115 & op0510=0x3F & op0004=0b10011; R2731 & op2126=0b100010 & op1620=0b00000
{
R2731 = trunc(floor(R1115));
}
# FLOORF.SW reg2, reg3 - rrrrr11111100011|wwwww10001000000
:floorf.suw R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00011; R2731 & op2126=0b100010 & op1620=0b00000
{
R2731 = trunc(floor(R1115));
}
# FMAF.S reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww10011100000
:fmaf.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100111 & op1620=0b00000
{
R2731 = (R1115 f* R0004) f+ R2731;
}
# FMSF.S reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww10011100010
:fmsf.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100111 & op1620=0b00010
{
R2731 = (R1115 f* R0004) f- R2731;
}
# FNMAF.S reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww10011100100
:fnmaf.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100111 & op1620=0b00100
{
R2731 = f- ((R1115 f* R0004) f+ R2731);
}
# FNMSF.S reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww10011100110
:fnmfs.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100111 & op1620=0b00110
{
R2731 = f- ((R1115 f* R0004) f- R2731);
}
# MADDF.S reg1, reg2, reg3, reg4 - rrrrr111111RRRRR|wwwww101W00WWWW0
:maddf.s R0004, R1115, R2731, reg4 is R0004 & op0510=0x3F & R1115; R2731 & op2426=0b101 & op2122=0b00 & op1616=0 & reg4
{
reg4 = (R1115 f* R0004) f+ R2731;
}
# MAXF.D reg1, reg2, reg3 - rrrr0111111RRRR0|wwww010001111000
:maxf.d R0004x2, R1115x2, R2731x2 is R0004x2 & op0510=0x3F & R1115x2; R2731x2 & op2126=0b100011 & op1620=0b11000
{
local bigger:1 = R1115x2 f> R0004x2;
either_or(R2731x2, bigger, R1115x2, R0004x2);
}
# MAXF.S reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww10001101000
:maxf.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100011 & op1620=0b01000
{
local bigger:1 = R1115 f> R0004;
either_or(R2731, bigger, R1115, R0004);
}
# MINF.D reg1, reg2, reg3 - rrrr0111111RRRR0|wwww010001111010
:minf.d R0004x2, R1115x2, R2731x2 is R0004x2 & op0510=0x3F & R1115x2; R2731x2 & op2126=0b100011 & op1620=0b11010
{
local bigger:1 = R1115x2 f< R0004x2;
either_or(R2731x2, bigger, R1115x2, R0004x2);
}
# MINF.S reg1, reg2, reg3 - rrrr0111111RRRRR|wwwww10001101010
:minf.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100011 & op1620=0b01010
{
local bigger:1 = R1115 f< R0004;
either_or(R2731, bigger, R1115, R0004);
}
# MSUBF.S reg1, reg2, reg3, reg4 - rrrrr111111RRRRR|wwwww101W01WWWW0
:msubf.s R0004, R1115, R2731, reg4 is R0004 & op0510=0x3F & R1115; R2731 & op2426=0b101 & op2122=0b01 & op1616=0 & reg4
{
reg4 = (R1115 f* R0004) f- R2731;
}
# MULF.D reg1, reg2, reg3 - rrrr0111111RRRR0|wwww010001110100
:mulf.d R0004x2, R1115x2, R2731x2 is R0004x2 & op0510=0x3F & R1115x2; R2731x2 & op2126=0b100011 & op1620=0b10100
{
R2731x2 = R1115x2 f* R0004x2;
}
# MULF.S reg1, reg2, reg3 - rrrr0111111RRRRR|wwwww10001100100
:mulf.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100011 & op1620=0b00100
{
R2731 = R1115 f* R0004;
}
# NEGF.D reg2, reg3 - rrrr011111100001|wwww010001011000
:negf.d R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00001; R2731x2 & op2126=0b100010 & op1620=0b11000
{
R2731x2 = f- R1115x2;
}
# NEGF.S reg2, reg3 - rrrrr11111100001|wwwww10001001000
:negf.s R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00001; R2731 & op2126=0b100010 & op1620=0b01000
{
R2731 = f- R1115;
}
# NMADDF.S reg1, reg2, reg3, reg4 - rrrrr111111RRRRR|wwwww101W10WWWW0
:nmaddf.s R0004, R1115, R2731, reg4 is R0004 & op0510=0x3F & R1115; R2731 & op2426=0b101 & op2122=0b10 & op1616=0 & reg4
{
reg4 = f-((R1115 f* R0004) f+ R2731);
}
# NMSUBF.S reg1, reg2, reg3, reg4 - rrrrr111111RRRRR|wwwww101W11WWWW0
:nmsubf.s R0004, R1115, R2731, reg4 is R0004 & op0510=0x3F & R1115; R2731 & op2426=0b101 & op2122=0b11 & op1616=0 & reg4
{
reg4 = f-((R1115 f* R0004) f- R2731);
}
# RECIPF.D reg2, reg3 - rrrr011111100001|wwww010001011110
:recipf.d R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00001; R2731x2 & op2126=0b100010 & op1620=0b11110
{
R2731x2 = 1 f/ R1115x2;
}
# RECIPF.S reg2, reg3 - rrrrr11111100001|wwwww10001001110
:recipf.s R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00001; R2731 & op2126=0b100010 & op1620=0b01110
{
R2731 = 1 f/ R1115;
}
# RSQRTF.D reg2, reg3 - rrrr011111100010|wwwww10001011110
:rsqrtf.d R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00010; R2731x2 & op2126=0b100010 & op1620=0b11110
{
R2731x2 = 1 f/ sqrt(R1115x2);
}
# RSQRTF.S reg2, reg3 - rrrrr11111100010|wwwww10001001110
:rsqrtf.s R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00010; R2731 & op2126=0b100010 & op1620=0b01110
{
R2731 = 1 f/ sqrt(R1115);
}
# SQRTF.D reg2, reg3 - rrrr011111100000|wwww010001011110
:sqrtf.d R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00000; R2731x2 & op2126=0b100010 & op1620=0b11110
{
R2731x2 = sqrt(R1115x2);
}
# SQRTF.S reg2, reg3 - rrrrr11111100000|wwwww10001001110
:sqrtf.s R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00000; R2731 & op2126=0b100010 & op1620=0b01110
{
R2731 = sqrt(R1115);
}
# SUBF.D reg1, reg2, reg3 - rrrr0111111RRRR0|wwww010001110010
:subf.d R0004x2, R1115x2, R2731x2 is R0004x2 & op0510=0x3F & R1115x2; R2731x2 & op2126=0b100011 & op1620=0b10010
{
R2731x2 = R1115x2 f- R0004x2;
}
# SUBF.S reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww10001100010
:subf.s R0004, R1115, R2731 is R0004 & op0510=0x3F & R1115; R2731 & op2126=0b100011 & op1620=0b00010
{
R2731 = R1115 f- R0004;
}
# TRFSR fcbit - 0000011111100000|000001000000fff0
:trfsr fcbit1719 is op1115=0 & op0510=0x3F & op0004=0; op2731=0 & op2126=0b100000 & op2020=0 & fcbit1719 & op1616=0
{
local var:4 = FPSR & (1 << (fcbit1719 + 24));
$(Z) = (var != 0);
}
# TRNCF.DL reg2, reg3 - rrrr011111100001|wwww010001010100
:trncf.dl R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00001; R2731x2 & op2126=0b100010 & op1620=0b10100
{
R2731x2 = trunc(R1115x2);
}
# TRNCF.DUL reg2, reg3 - rrrr011111110001|wwww010001010100
:trncf.dul R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b10001; R2731x2 & op2126=0b100010 & op1620=0b10100
{
R2731x2 = trunc(R1115x2);
}
# TRNCF.DUW reg2, reg3 - rrrrr11111110001|wwwww10001010000
:trncf.duw R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b10001; R2731 & op2126=0b100010 & op1620=0b10000
{
R2731 = trunc(R1115x2);
}
# TRNCF.DW reg2, reg3 - rrrrr11111100001|wwwww10001010000
:trncf.dw R1115x2, R2731 is R1115x2 & op0510=0x3F & op0004=0b00001; R2731 & op2126=0b100010 & op1620=0b10000
{
R2731 = trunc(R1115x2);
}
# TRNCF.SL reg2, reg3 - rrrrr11111100001|wwww010001000100
:trncf.sl R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b00001; R2731x2 & op2126=0b100010 & op1620=0b00100
{
R2731x2 = trunc(R1115);
}
# TRNCF.SUL reg2, reg3 - rrrrr11111110001|wwww010001000100
:trncf.sul R1115, R2731x2 is R1115 & op0510=0x3F & op0004=0b10001; R2731x2 & op2126=0b100010 & op1620=0b00100
{
R2731x2 = trunc(R1115);
}
# TRNCF.SUW reg2, reg3 - rrrrr11111110001|wwwww10001000000
:trncf.suw R1115, R2731 is R1115 & op0510=0x3F & op0004=0b10001; R2731 & op2126=0b100010 & op1620=0b00000
{
R2731 = trunc(R1115);
}
# TRNCF.SW reg2, reg3 - rrrrr11111100001|wwwww10001000000
:trncf.sw R1115, R2731 is R1115 & op0510=0x3F & op0004=0b00001; R2731 & op2126=0b100010 & op1620=0b00000
{
R2731 = trunc(R1115);
}