Skip to content

Ghidra is a software reverse engineering (SRE) framework

Removed Whitespaces, Fixed some Floatissues, Fixed Divideproblems

Aleckaj946ef86935a2
diff --git a/Ghidra/Processors/V850E2M/data/languages/Helpers/Conditions.sinc b/Ghidra/Processors/V850E2M/data/languages/Helpers/Conditions.sinc
index 36d658d1e9..d2c7500347 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Helpers/Conditions.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Helpers/Conditions.sinc
@@ -1,38 +1,38 @@
-##################################################
-##### Conditions #####
-##################################################
+#####################################################
+##### Conditions #####
+#####################################################
-c0003: "V" is op0003=0x0 { tmp:1 = ($(OV)) == 1; export tmp; }
-c0003: "NV" is op0003=0x8 { tmp:1 = ($(OV)) == 0; export tmp; }
-c0003: "C_L" is op0003=0x1 { tmp:1 = ($(CY)) == 1; export tmp; }
-c0003: "NC_L" is op0003=0x9 { tmp:1 = ($(CY)) == 0; export tmp; }
-c0003: "Z" is op0003=0x2 { tmp:1 = ($(Z)) == 1; export tmp; }
-c0003: "NZ" is op0003=0xA { tmp:1 = ($(Z)) == 0; export tmp; }
-c0003: "NH" is op0003=0x3 { tmp:1 = ($(CY) || $(Z)) == 1; export tmp; }
-c0003: "H" is op0003=0xB { tmp:1 = ($(CY) || $(Z)) == 0; export tmp; }
-c0003: "S_N" is op0003=0x4 { tmp:1 = ($(S)) == 1; export tmp; }
-c0003: "NS_P" is op0003=0xC { tmp:1 = ($(S)) == 0; export tmp; }
-c0003: "T" is op0003=0x5 { tmp:1 = 1; export tmp; }
-c0003: "SA" is op0003=0xD { tmp:1 = ($(SAT)) == 1; export tmp; }
-c0003: "LT" is op0003=0x6 { tmp:1 = ($(S) ^^ $(OV)) == 1; export tmp; }
-c0003: "GE" is op0003=0xE { tmp:1 = ($(S) ^^ $(OV)) == 0; export tmp; }
-c0003: "LE" is op0003=0x7 { tmp:1 = ($(S) ^^ $(OV) || $(Z)) == 1; export tmp; }
-c0003: "GT" is op0003=0xF { tmp:1 = ($(S) ^^ $(OV) || $(Z)) == 0; export tmp; }
+c0003: "V" is op0003=0x0 { tmp:1 = ($(OV)) == 1; export tmp; }
+c0003: "NV" is op0003=0x8 { tmp:1 = ($(OV)) == 0; export tmp; }
+c0003: "C_L" is op0003=0x1 { tmp:1 = ($(CY)) == 1; export tmp; }
+c0003: "NC_L" is op0003=0x9 { tmp:1 = ($(CY)) == 0; export tmp; }
+c0003: "Z" is op0003=0x2 { tmp:1 = ($(Z)) == 1; export tmp; }
+c0003: "NZ" is op0003=0xA { tmp:1 = ($(Z)) == 0; export tmp; }
+c0003: "NH" is op0003=0x3 { tmp:1 = ($(CY) || $(Z)) == 1; export tmp; }
+c0003: "H" is op0003=0xB { tmp:1 = ($(CY) || $(Z)) == 0; export tmp; }
+c0003: "S_N" is op0003=0x4 { tmp:1 = ($(S)) == 1; export tmp; }
+c0003: "NS_P" is op0003=0xC { tmp:1 = ($(S)) == 0; export tmp; }
+c0003: "T" is op0003=0x5 { tmp:1 = 1; export tmp; }
+c0003: "SA" is op0003=0xD { tmp:1 = ($(SAT)) == 1; export tmp; }
+c0003: "LT" is op0003=0x6 { tmp:1 = ($(S) ^^ $(OV)) == 1; export tmp; }
+c0003: "GE" is op0003=0xE { tmp:1 = ($(S) ^^ $(OV)) == 0; export tmp; }
+c0003: "LE" is op0003=0x7 { tmp:1 = ($(S) ^^ $(OV) || $(Z)) == 1; export tmp; }
+c0003: "GT" is op0003=0xF { tmp:1 = ($(S) ^^ $(OV) || $(Z)) == 0; export tmp; }
-c1720: "V" is op1720=0x0 { tmp:1 = ($(OV)) == 1; export tmp; }
-c1720: "NV" is op1720=0x8 { tmp:1 = ($(OV)) == 0; export tmp; }
-c1720: "C_L" is op1720=0x1 { tmp:1 = ($(CY)) == 1; export tmp; }
-c1720: "NC_NL" is op1720=0x9 { tmp:1 = ($(CY)) == 0; export tmp; }
-c1720: "Z" is op1720=0x2 { tmp:1 = ($(Z)) == 1; export tmp; }
-c1720: "NZ" is op1720=0xA { tmp:1 = ($(Z)) == 0; export tmp; }
-c1720: "NH" is op1720=0x3 { tmp:1 = ($(CY) || $(Z)) == 1; export tmp; }
-c1720: "H" is op1720=0xB { tmp:1 = ($(CY) || $(Z)) == 0; export tmp; }
-c1720: "S_N" is op1720=0x4 { tmp:1 = ($(S)) == 1; export tmp; }
-c1720: "NS_P" is op1720=0xC { tmp:1 = ($(S)) == 0; export tmp; }
-c1720: "T" is op1720=0x5 { tmp:1 = 1; export tmp; }
-c1720: "SA" is op1720=0xD { tmp:1 = ($(SAT)) == 1; export tmp; }
-c1720: "LT" is op1720=0x6 { tmp:1 = ($(S) ^^ $(OV)) == 1; export tmp; }
-c1720: "GE" is op1720=0xE { tmp:1 = ($(S) ^^ $(OV)) == 0; export tmp; }
-c1720: "LE" is op1720=0x7 { tmp:1 = ($(S) ^^ $(OV) || $(Z)) == 1; export tmp; }
-c1720: "GT" is op1720=0xF { tmp:1 = ($(S) ^^ $(OV) || $(Z)) == 0; export tmp; }
\ No newline at end of file
+c1720: "V" is op1720=0x0 { tmp:1 = ($(OV)) == 1; export tmp; }
+c1720: "NV" is op1720=0x8 { tmp:1 = ($(OV)) == 0; export tmp; }
+c1720: "C_L" is op1720=0x1 { tmp:1 = ($(CY)) == 1; export tmp; }
+c1720: "NC_NL" is op1720=0x9 { tmp:1 = ($(CY)) == 0; export tmp; }
+c1720: "Z" is op1720=0x2 { tmp:1 = ($(Z)) == 1; export tmp; }
+c1720: "NZ" is op1720=0xA { tmp:1 = ($(Z)) == 0; export tmp; }
+c1720: "NH" is op1720=0x3 { tmp:1 = ($(CY) || $(Z)) == 1; export tmp; }
+c1720: "H" is op1720=0xB { tmp:1 = ($(CY) || $(Z)) == 0; export tmp; }
+c1720: "S_N" is op1720=0x4 { tmp:1 = ($(S)) == 1; export tmp; }
+c1720: "NS_P" is op1720=0xC { tmp:1 = ($(S)) == 0; export tmp; }
+c1720: "T" is op1720=0x5 { tmp:1 = 1; export tmp; }
+c1720: "SA" is op1720=0xD { tmp:1 = ($(SAT)) == 1; export tmp; }
+c1720: "LT" is op1720=0x6 { tmp:1 = ($(S) ^^ $(OV)) == 1; export tmp; }
+c1720: "GE" is op1720=0xE { tmp:1 = ($(S) ^^ $(OV)) == 0; export tmp; }
+c1720: "LE" is op1720=0x7 { tmp:1 = ($(S) ^^ $(OV) || $(Z)) == 1; export tmp; }
+c1720: "GT" is op1720=0xF { tmp:1 = ($(S) ^^ $(OV) || $(Z)) == 0; export tmp; }
\ No newline at end of file
diff --git a/Ghidra/Processors/V850E2M/data/languages/Helpers/Extras.sinc b/Ghidra/Processors/V850E2M/data/languages/Helpers/Extras.sinc
index f03ff427ca..88e17721b8 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Helpers/Extras.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Helpers/Extras.sinc
@@ -1,17 +1,17 @@
-##################################################
-##### Extras #####
-##################################################
+#####################################################
+##### Extras #####
+#####################################################
# read r0 always return zero
-R0004: _R0004 is _R0004 & _R0004=0 { local x:4=0; export x; }
-R0004: _R0004 is _R0004 { export _R0004; }
+R0004: _R0004 is _R0004 & _R0004=0 { local x:4=0; export x; }
+R0004: _R0004 is _R0004 { export _R0004; }
-R1115: _R1115 is _R1115 & _R1115=0 { local x:4=0; export x; }
-R1115: _R1115 is _R1115 { export _R1115; }
+R1115: _R1115 is _R1115 & _R1115=0 { local x:4=0; export x; }
+R1115: _R1115 is _R1115 { export _R1115; }
-R2731: _R2731 is _R2731 & _R2731=0 { local x:4=0; export x; }
-R2731: _R2731 is _R2731 { export _R2731; }
+R2731: _R2731 is _R2731 & _R2731=0 { local x:4=0; export x; }
+R2731: _R2731 is _R2731 { export _R2731; }
adr9: res is op0406 & s1115
@@ -26,102 +26,94 @@ adr32: res is op1631 & op1616=0; op3247
export *:4 res;
}
+reg4: op0_1720 is op2323=0 & op0_1720 { export op0_1720; }
+reg4: op1_1720 is op2323=1 & op1_1720 { export op1_1720; }
-##### Prep/Disp Loop #####
-
-PrepList20: r20 is prep27=1 & r20 { push(r20); }
-PrepList20: is prep27=0 { }
-
-PrepList21: r21 is prep26=1 & prep27=0 & r21 { push(r21); }
-PrepList21: PrepList20,r21 is prep26=1 & PrepList20 & r21 { push(r21); }
-PrepList21: PrepList20 is prep26=0 & PrepList20 { }
-
-PrepList22: r22 is prep25=1 & prep2627=0 & r22 { push(r22); }
-PrepList22: PrepList21,r22 is prep25=1 & PrepList21 & r22 { push(r22); }
-PrepList22: PrepList21 is prep25=0 & PrepList21 { }
-
-PrepList23: r23 is prep24=1 & prep2527=0 & r23 { push(r23); }
-PrepList23: PrepList22,r23 is prep24=1 & PrepList22 & r23 { push(r23); }
-PrepList23: PrepList22 is prep24=0 & PrepList22 { }
-PrepList24: r24 is prep31=1 & prep2427=0 & r24 { push(r24); }
-PrepList24: PrepList23,r24 is prep31=1 & PrepList23 & r24 { push(r24); }
-PrepList24: PrepList23 is prep31=0 & PrepList23 { }
+##### Prep/Disp Loop #####
-PrepList25: r25 is prep30=1 & prep2427=0 & prep31=0 & r25 { push(r25); }
-PrepList25: PrepList24,r25 is prep30=1 & PrepList24 & r25 { push(r25); }
-PrepList25: PrepList24 is prep30=0 & PrepList24 { }
+PrepList20: r20 is prep27=1 & r20 { push(r20); }
+PrepList20: is prep27=0 { }
-PrepList26: r26 is prep29=1 & prep2427=0 & prep3031=0 & r26 { push(r26); }
-PrepList26: PrepList25,r26 is prep29=1 & PrepList25 & r26 { push(r26); }
-PrepList26: PrepList25 is prep29=0 & PrepList25 { }
+PrepList21: r21 is prep26=1 & prep27=0 & r21 { push(r21); }
+PrepList21: PrepList20,r21 is prep26=1 & PrepList20 & r21 { push(r21); }
+PrepList21: PrepList20 is prep26=0 & PrepList20 { }
-PrepList27: r27 is prep28=1 & prep2427=0 & prep2931=0 & r27 { push(r27); }
-PrepList27: PrepList26,r27 is prep28=1 & PrepList26 & r27 { push(r27); }
-PrepList27: PrepList26 is prep28=0 & PrepList26 { }
+PrepList22: r22 is prep25=1 & prep2627=0 & r22 { push(r22); }
+PrepList22: PrepList21,r22 is prep25=1 & PrepList21 & r22 { push(r22); }
+PrepList22: PrepList21 is prep25=0 & PrepList21 { }
-PrepList28: r28 is prep23=1 & prep2431=0 & r28 { push(r28); }
-PrepList28: PrepList27,r28 is prep23=1 & PrepList27 & r28 { push(r28); }
-PrepList28: PrepList27 is prep23=0 & PrepList27 { }
+PrepList23: r23 is prep24=1 & prep2527=0 & r23 { push(r23); }
+PrepList23: PrepList22,r23 is prep24=1 & PrepList22 & r23 { push(r23); }
+PrepList23: PrepList22 is prep24=0 & PrepList22 { }
-PrepList29: r29 is prep22=1 & prep2431=0 & prep23=0 & r29 { push(r29); }
-PrepList29: PrepList28,r29 is prep22=1 & PrepList28 & r29 { push(r29); }
-PrepList29: PrepList28 is prep22=0 & PrepList28 { }
+PrepList24: r24 is prep31=1 & prep2427=0 & r24 { push(r24); }
+PrepList24: PrepList23,r24 is prep31=1 & PrepList23 & r24 { push(r24); }
+PrepList24: PrepList23 is prep31=0 & PrepList23 { }
-PrepList30: ep is prep00=1 & prep2431=0 & prep2223=0 & ep { push(ep); }
-PrepList30: PrepList29,ep is prep00=1 & PrepList29 & ep { push(ep); }
-PrepList30: PrepList29 is prep00=0 & PrepList29 { }
+PrepList25: r25 is prep30=1 & prep2427=0 & prep31=0 & r25 { push(r25); }
+PrepList25: PrepList24,r25 is prep30=1 & PrepList24 & r25 { push(r25); }
+PrepList25: PrepList24 is prep30=0 & PrepList24 { }
-PrepList: { lp } is prep21=1 & prep2431=0 & prep2223=0 & prep00=0 & lp
- { push(lp); }
-PrepList: { PrepList30,lp } is prep21=1 & PrepList30 & lp { push(lp); }
-PrepList: { PrepList30 } is prep21=0 & PrepList30 { push(lp); }
+PrepList26: r26 is prep29=1 & prep2427=0 & prep3031=0 & r26 { push(r26); }
+PrepList26: PrepList25,r26 is prep29=1 & PrepList25 & r26 { push(r26); }
+PrepList26: PrepList25 is prep29=0 & PrepList25 { }
+PrepList27: r27 is prep28=1 & prep2427=0 & prep2931=0 & r27 { push(r27); }
+PrepList27: PrepList26,r27 is prep28=1 & PrepList26 & r27 { push(r27); }
+PrepList27: PrepList26 is prep28=0 & PrepList26 { }
+PrepList28: r28 is prep23=1 & prep2431=0 & r28 { push(r28); }
+PrepList28: PrepList27,r28 is prep23=1 & PrepList27 & r28 { push(r28); }
+PrepList28: PrepList27 is prep23=0 & PrepList27 { }
-DispList31: lp is prep21=1 & lp { pop(lp); }
-DispList31: is prep21=0 { }
+PrepList29: r29 is prep22=1 & prep2431=0 & prep23=0 & r29 { push(r29); }
+PrepList29: PrepList28,r29 is prep22=1 & PrepList28 & r29 { push(r29); }
+PrepList29: PrepList28 is prep22=0 & PrepList28 { }
-DispList30: ep,DispList31 is DispList31 & prep00=1 & ep { pop(ep); }
-DispList30: DispList31 is DispList31 & prep00=0 { }
+PrepList30: ep is prep00=1 & prep2431=0 & prep2223=0 & ep { push(ep); }
+PrepList30: PrepList29,ep is prep00=1 & PrepList29 & ep { push(ep); }
+PrepList30: PrepList29 is prep00=0 & PrepList29 { }
-DispList29: r29,DispList30 is DispList30 & prep22=1 & r29 { pop(r29); }
-DispList29: DispList30 is DispList30 & prep22=0 { }
+PrepList: { lp } is prep21=1 & prep2431=0 & prep2223=0 & prep00=0 & lp { push(lp); }
+PrepList: { PrepList30,lp } is prep21=1 & PrepList30 & lp { push(lp); }
+PrepList: { PrepList30 } is prep21=0 & PrepList30 { push(lp); }
-DispList28: r28,DispList29 is DispList29 & prep23=1 & r28 { pop(r28); }
-DispList28: DispList29 is DispList29 & prep23=0 { }
-DispList27: r27,DispList28 is DispList28 & prep28=1 & r27 { pop(r27); }
-DispList27: DispList28 is DispList28 & prep28=0 { }
-DispList26: r26,DispList27 is DispList27 & prep29=1 & r26 { pop(r26); }
-DispList26: DispList27 is DispList27 & prep29=0 { }
+DispList31: lp is prep21=1 & lp { pop(lp); }
+DispList31: is prep21=0 { }
-DispList25: r25,DispList26 is DispList26 & prep30=1 & r25 { pop(r25); }
-DispList25: DispList26 is DispList26 & prep30=0 { }
+DispList30: ep,DispList31 is DispList31 & prep00=1 & ep { pop(ep); }
+DispList30: DispList31 is DispList31 & prep00=0 { }
-DispList24: r24,DispList25 is DispList25 & prep31=1 & r24 { pop(r24); }
-DispList24: DispList25 is DispList25 & prep31=0 { }
+DispList29: r29,DispList30 is DispList30 & prep22=1 & r29 { pop(r29); }
+DispList29: DispList30 is DispList30 & prep22=0 { }
-DispList23: r23,DispList24 is DispList24 & prep24=1 & r23 { pop(r23); }
-DispList23: DispList24 is DispList24 & prep24=0 { }
+DispList28: r28,DispList29 is DispList29 & prep23=1 & r28 { pop(r28); }
+DispList28: DispList29 is DispList29 & prep23=0 { }
-DispList22: r22,DispList23 is DispList23 & prep25=1 & r22 { pop(r22); }
-DispList22: DispList23 is DispList23 & prep25=0 { }
+DispList27: r27,DispList28 is DispList28 & prep28=1 & r27 { pop(r27); }
+DispList27: DispList28 is DispList28 & prep28=0 { }
-DispList21: r21,DispList22 is DispList22 & prep26=1 & r21 { pop(r21); }
-DispList21: DispList22 is DispList22 & prep26=0 { }
+DispList26: r26,DispList27 is DispList27 & prep29=1 & r26 { pop(r26); }
+DispList26: DispList27 is DispList27 & prep29=0 { }
-DispList: { r20,DispList21 } is DispList21 & prep27=1 & r20 { pop(r20); }
-DispList: { DispList21 } is DispList21 & prep27=0 { pop(r20); }
+DispList25: r25,DispList26 is DispList26 & prep30=1 & r25 { pop(r25); }
+DispList25: DispList26 is DispList26 & prep30=0 { }
+DispList24: r24,DispList25 is DispList25 & prep31=1 & r24 { pop(r24); }
+DispList24: DispList25 is DispList25 & prep31=0 { }
+DispList23: r23,DispList24 is DispList24 & prep24=1 & r23 { pop(r23); }
+DispList23: DispList24 is DispList24 & prep24=0 { }
-##### Float #####
+DispList22: r22,DispList23 is DispList23 & prep25=1 & r22 { pop(r22); }
+DispList22: DispList23 is DispList23 & prep25=0 { }
-attach names [fcond2730]
-["F" "UN" "EQ" "UEQ" "OLT" "ULT" "OLE" "ULE" "SF" "NGLE" "SEQ" "NGL" "LT" "NGE" "LE" "NGT"];
+DispList21: r21,DispList22 is DispList22 & prep26=1 & r21 { pop(r21); }
+DispList21: DispList22 is DispList22 & prep26=0 { }
-reg4: op0_1720 is op2323=0 & op0_1720 { export op0_1720; }
-reg4: op1_1720 is op2323=1 & op1_1720 { export op1_1720; }
\ No newline at end of file
+DispList: { r20,DispList21 } is DispList21 & prep27=1 & r20 { pop(r20); }
+DispList: { DispList21 } is DispList21 & prep27=0 { pop(r20); }
\ No newline at end of file
diff --git a/Ghidra/Processors/V850E2M/data/languages/Helpers/Macros.sinc b/Ghidra/Processors/V850E2M/data/languages/Helpers/Macros.sinc
index 9ba969676a..a8cd4f6c04 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Helpers/Macros.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Helpers/Macros.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Macros #####
-##################################################
+#####################################################
+##### Macros #####
+#####################################################
##### CARRY-Flag #####
@@ -130,6 +130,16 @@ macro either_or1(res, cond, true, false)
res = (true * zext(cond == 1)) + (false * zext(cond != 1));
}
+macro either_or_float(res, cond, true, false)
+{
+ res = (true f* zext(cond != 0)) f+ (false f* zext(cond == 0));
+}
+
+macro either_or1_float(res, cond, true, false)
+{
+ res = (true f* zext(cond == 1)) f+ (false f* zext(cond != 1));
+}
+
macro shift_right_logic(res, var, shift)
{
res = var >> shift;
@@ -217,22 +227,22 @@ macro SearchLeft(res, var, char)
macro saturate(var)
{
if (var s> 0x7FFFFFFF)
- goto <pos_sat>;
+ goto <pos_sat>;
if (var s< -0x80000000)
- goto <neg_sat>;
+ goto <neg_sat>;
goto <end>;
<pos_sat>
- var = 0x7FFFFFFF;
- goto <end>;
+ var = 0x7FFFFFFF;
+ goto <end>;
<neg_sat>
- var = -0x80000000;
- goto <end>;
+ var = -0x80000000;
+ goto <end>;
- <end>
+ <end>
}
@@ -243,7 +253,7 @@ macro compare_float(res, fcond, reg1, reg2)
local un = ((fcond & 1) == 1) & (nan(reg2) || nan(reg1));
local eq = ((fcond & 2) == 2) & (!(nan(reg2) || nan(reg1))) & (reg2 f== reg1);
local le = ((fcond & 4) == 4) & (!(nan(reg2) || nan(reg1))) & (reg2 f< reg1);
- #local ex = (fcond & 8) & ((nan(reg2) || nan(reg1)));
+ #local ex = (fcond & 8) & ((nan(reg2) || nan(reg1)));
res = zext(un|eq|le);
}
\ No newline at end of file
diff --git a/Ghidra/Processors/V850E2M/data/languages/Helpers/Register.sinc b/Ghidra/Processors/V850E2M/data/languages/Helpers/Register.sinc
index 035489c04d..131931b441 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Helpers/Register.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Helpers/Register.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Register #####
-##################################################
+#####################################################
+##### Register #####
+#####################################################
##### General-purpose registers (r0 to r31) #####
diff --git a/Ghidra/Processors/V850E2M/data/languages/Helpers/Tokens.sinc b/Ghidra/Processors/V850E2M/data/languages/Helpers/Tokens.sinc
index 3ac4717b56..5552dce722 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Helpers/Tokens.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Helpers/Tokens.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Tokens #####
-##################################################
+#####################################################
+##### Tokens #####
+#####################################################
define token instr(16)
@@ -20,8 +20,8 @@ define token instr(16)
op0106 = (1,6)
op0406 = (4,6)
op0410 = (4,10)
- op0505 = (5,5)
- op0510 = (5,10)
+ op0505 = (5,5)
+ op0510 = (5,10)
op0515 = (5,15)
op0610 = (6,10)
op0615 = (6,15)
diff --git a/Ghidra/Processors/V850E2M/data/languages/Helpers/Variables.sinc b/Ghidra/Processors/V850E2M/data/languages/Helpers/Variables.sinc
index 34b103f017..0d44e9a847 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Helpers/Variables.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Helpers/Variables.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Variables #####
-##################################################
+#####################################################
+##### Variables #####
+#####################################################
attach variables [ _R0004 _R1115 _R2731 ]
@@ -32,6 +32,10 @@ attach variables [op0_1720] [r0 r2 gp r6 r8 r10 r12 r14 r16 r18 r20 r22 r24 r26
attach variables [op1_1720] [r1 sp tp r7 r9 r11 r13 r15 r17 r19 r21 r23 r25 r27 r29 lp];
+attach names [fcond2730]
+["F" "UN" "EQ" "UEQ" "OLT" "ULT" "OLE" "ULE" "SF" "NGLE" "SEQ" "NGL" "LT" "NGE" "LE" "NGT"];
+
+
@define NP "PSW[7,1]"
@define EP "PSW[6,1]"
@define ID "PSW[5,1]"
@@ -41,5 +45,8 @@ attach variables [op1_1720] [r1 sp tp r7 r9 r11 r13 r15 r17 r19 r21 r23 r25 r27
@define S "PSW[1,1]"
@define Z "PSW[0,1]"
-@define EICC "ECR[0,16]"
-@define FECC "ECR[16,16]"
\ No newline at end of file
+@define EICC "ECR[0,16]"
+@define FECC "ECR[16,16]"
+
+
+define pcodeop synce;
\ No newline at end of file
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Arithmetic.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Arithmetic.sinc
index e19ccf20c1..0eca37e962 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Arithmetic.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Arithmetic.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Arithmetic #####
-##################################################
+#####################################################
+##### Arithmetic #####
+#####################################################
# ADD reg1, reg2 - rrrrr001110RRRRR
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/BitManipulation.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/BitManipulation.sinc
index 3d769c5da9..f43ee3b5c5 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/BitManipulation.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/BitManipulation.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### BitManipulation #####
-##################################################
+#####################################################
+##### BitManipulation #####
+#####################################################
# CLR1 bit#3, disp16[reg1] - 10bbb111110RRRRR|dddddddddddddddd
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/BitSearch.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/BitSearch.sinc
index 75bcc209fd..4a83963a37 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/BitSearch.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/BitSearch.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### BitSearch #####
-##################################################
+#####################################################
+##### BitSearch #####
+#####################################################
# SCH0L reg2, reg3 - rrrrr11111100000|wwwww01101100100
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Branch.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Branch.sinc
index 34a1914acd..a9618c068d 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Branch.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Branch.sinc
@@ -1,13 +1,13 @@
-##################################################
-##### Branch #####
-##################################################
+#####################################################
+##### Branch #####
+#####################################################
#Bcond addr9 - ddddd1011dddcccc
:b^c0003 adr9 is op0710=0xB & c0003 & adr9
{
- if (c0003)
- goto adr9;
+ if (c0003)
+ goto adr9;
}
:br adr9 is op0710=0xB & op0003=0x5 & adr9
{
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Conditional.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Conditional.sinc
index c1ef21f29b..f210b23e37 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Conditional.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Conditional.sinc
@@ -1,26 +1,26 @@
-##################################################
-##### Conditional #####
-##################################################
+#####################################################
+##### 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);
+ 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);
+ 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);
+ 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);
+ set_S(R2731);
+ set_Z(R2731);
}
\ No newline at end of file
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/DataManipulation.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/DataManipulation.sinc
index bee2e9d7c2..b1d85d06df 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/DataManipulation.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/DataManipulation.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### DataManipulation #####
-##################################################
+#####################################################
+##### DataManipulation #####
+#####################################################
# BSH reg2, reg3 - rrrrr11111100000|wwwww01101000010
@@ -30,15 +30,15 @@
# 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);
+ 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);
+ local result:4 = zext(c1720);
+ R2731 = s0004 * zext(result != 0) + R1115 * zext(result == 0);
}
# HSH reg2, reg3 - rrrrr11111100000|wwwww01101000110
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Divide.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Divide.sinc
index 4d414207ee..da469f07ae 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Divide.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Divide.sinc
@@ -1,53 +1,61 @@
-##################################################
-##### Divide #####
-##################################################
+#####################################################
+##### 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);
- R2731 = R1115 s% R0004;
- R1115 = R1115 s/ R0004;
- set_Z(R1115);
+ set_Z(R1115);
set_S(R1115);
+ R2731 = mod;
+ R1115 = quot;
}
# DIVH reg1, reg2 - rrrrr000010RRRRR
:divh r0004, r1115 is op0510=0x02 & r0004 & r1115
{
- $(OV) = ((r1115 == 0x80000000 && r0004 == 0xFFFFFFFF) || r0004 == 0x0);
+ $(OV) = ((r1115 == 0x80000000 && r0004 == 0xFFFFFFFF) || r0004 == 0x0);
r1115 = r1115 / r0004;
set_Z(r1115);
- set_S(r1115);
+ set_S(r1115);
}
# DIVH reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01010000000
:divh R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x280 & R2731
{
- $(OV) = ((R1115 == 0x80000000 && R0004 == 0xFFFFFFFF) || R0004 == 0x0);
- R2731 = R1115 s% R0004;
- R1115 = R1115 s/ R0004;
- set_Z(R1115);
+ local quot:4 = R1115 s/ R0004;
+ local mod:4 = R1115 s% R0004;
+ $(OV) = ((R1115 == 0x80000000 && R0004 == 0xFFFFFFFF) || R0004 == 0x0);
+ set_Z(R1115);
set_S(R1115);
+ R2731 = mod;
+ R1115 = quot;
}
# DIVHU reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01010000010
:divhu R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x282 & R2731
{
- $(OV) = (R0004 == 0);
- R2731 = R1115 s% R0004;
- R1115 = R1115 s/ R0004;
- set_Z(R1115);
+ local quot:4 = R1115 s/ R0004;
+ local mod:4 = R1115 s% R0004;
+ $(OV) = (R0004 == 0);
+ set_Z(R1115);
set_S(R1115);
+ R2731 = mod;
+ R1115 = quot;
}
# DIVU reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01011000010
:divu R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x2C2 & R2731
{
- $(OV) = (R0004 == 0);
- R2731 = R1115 s% R0004;
- R1115 = R1115 s/ R0004;
- set_Z(R1115);
+ local quot:4 = R1115 s/ R0004;
+ local mod:4 = R1115 s% R0004;
+ $(OV) = (R0004 == 0);
+ set_Z(R1115);
set_S(R1115);
+ R2731 = mod;
+ R1115 = quot;
}
\ No newline at end of file
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Float.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Float.sinc
index 3528395092..d6398b0ad4 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Float.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Float.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Float #####
-##################################################
+#####################################################
+##### Float #####
+#####################################################
# ABSF.D reg2, reg3 - rrrr011111100000|wwww010001011000
@@ -56,8 +56,7 @@
# 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);
+ R2731x2 = ceil(sext(R1115));
}
# CEILF.SUL reg2, reg3 - rrrrr11111110010|wwwww10001000100
@@ -82,16 +81,16 @@
# 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
+ #CC0 = Bit 24
local bit = (FPSR >> (fcbit1719 + 24:1)) & 0x1;
- either_or1(R2731x2, bit, R0004x2, R1115x2);
+ either_or1_float(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);
+ either_or1_float(R2731, bit, R0004, R1115);
}
# CMPF.D fcond, reg2, reg1, fcbit - rrrr0111111RRRRR|0FFFF1000011fff0
@@ -125,350 +124,349 @@
# CVTF.DL reg2, reg3 - rrrr011111100100|wwww010001010100
:cvtf.dl R1115x2, R2731x2 is R1115x2 & op0510=0x3F & op0004=0b00100; R2731x2 & op2126=0b100010 & op1620=0b10100
{
- R2731x2 = int2float(R1115x2);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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;
+ 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;
+ 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);
+ 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);
+ 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));
+ 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));
+ 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);
+ R2731x2 = floor(sext(R1115));
}
# 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);
+ 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));
+ 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));
+ R2731 = trunc(floor(R1115));
}
# 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;
+ 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);
+ local bigger:1 = R1115x2 f> R0004x2;
+ either_or_float(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);
+ local bigger:1 = R1115 f> R0004;
+ either_or_float(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);
+ local bigger:1 = R1115x2 f< R0004x2;
+ either_or_float(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);
+ local bigger:1 = R1115 f< R0004;
+ either_or_float(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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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);
+ 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);
+ 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;
+ 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;
+ 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);
+ 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);
+ 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);
+ 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);
+ 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;
+ 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;
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ R2731 = trunc(R1115);
}
\ No newline at end of file
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/HighSpeedDivide.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/HighSpeedDivide.sinc
index 230893f7a4..649ab2a2db 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/HighSpeedDivide.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/HighSpeedDivide.sinc
@@ -1,24 +1,28 @@
-##################################################
-##### HighSpeedDivide #####
-##################################################
+#####################################################
+##### HighSpeedDivide #####
+#####################################################
# DIVQ reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01011111100
:div R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x2FC & R2731
{
- $(OV) = ((R1115 == 0x80000000 && R0004 == 0xFFFFFFFF) || R0004 == 0x0);
- R2731 = R1115 s% R0004;
- R1115 = R1115 s/ R0004;
- set_Z(R1115);
+ local quot:4 = R1115 s/ R0004;
+ local mod:4 = R1115 s% R0004;
+ $(OV) = ((R1115 == 0x80000000 && R0004 == 0xFFFFFFFF) || R0004 == 0x0);
+ set_Z(R1115);
set_S(R1115);
+ R2731 = mod;
+ R1115 = quot;
}
# DIVQU reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01011111110
:divqu R0004, R1115, R2731 is op0510=0x3F & R0004 & R1115; op1626=0x2FE & R2731
{
- $(OV) = (R0004 == 0);
- R2731 = R1115 s% R0004;
- R1115 = R1115 s/ R0004;
- set_Z(R1115);
+ local quot:4 = R1115 s/ R0004;
+ local mod:4 = R1115 s% R0004;
+ $(OV) = (R0004 == 0);
+ set_Z(R1115);
set_S(R1115);
+ R2731 = mod;
+ R1115 = quot;
}
\ No newline at end of file
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Load.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Load.sinc
index 70613967a1..5e065b7cc8 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Load.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Load.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Load #####
-##################################################
+#####################################################
+##### Load #####
+#####################################################
# LD.B disp16[reg1], reg2 - rrrrr111000RRRRR|dddddddddddddddd
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Logic.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Logic.sinc
index 6067968d44..05e22a00f6 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Logic.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Logic.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Logic #####
-##################################################
+#####################################################
+##### Logic #####
+#####################################################
# AND reg1, reg2 - rrrrr001010RRRRR
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Multiply.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Multiply.sinc
index 52b5f4f13e..b7b36cf750 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Multiply.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Multiply.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Multiply #####
-##################################################
+#####################################################
+##### Multiply #####
+#####################################################
# MUL reg1, reg2, reg3 - rrrrr111111RRRRR|wwwww01000100000
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/MultiplyAccumulate.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/MultiplyAccumulate.sinc
index 7cc4b52b84..fd36b83b71 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/MultiplyAccumulate.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/MultiplyAccumulate.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### MultiplyAccumulate #####
-##################################################
+#####################################################
+##### MultiplyAccumulate #####
+#####################################################
# MAC reg1, reg2, reg3, reg4 - rrrrr111111RRRRR wwww0011110mmmm0
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Saturated.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Saturated.sinc
index b22e996fcb..8971eaae44 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Saturated.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Saturated.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Saturated #####
-##################################################
+#####################################################
+##### Saturated #####
+#####################################################
# SATADD reg1, reg2 - rrrrr000110RRRRR
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Special.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Special.sinc
index 7ab3c72f65..1923a6efc8 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Special.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Special.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Special #####
-##################################################
+#####################################################
+##### Special #####
+#####################################################
# CALLT imm6 - 0000001000iiiiii
@@ -80,8 +80,8 @@
{
FEPC = inst_next;
FEPSW = PSW;
- $(FECC) = op1114 + 0x31; # exception code 0x31..0x3F
- FEIC = op1114 + 0x31; # exception code 0x31..0x3F
+ $(FECC) = op1114 + 0x31; # exception code 0x31..0x3F
+ FEIC = op1114 + 0x31; # exception code 0x31..0x3F
$(EP) = 1;
$(ID) = 1;
$(NP) = 1;
@@ -92,7 +92,7 @@
# HALT - 0000011111100000|0000000100100000
:halt is op0015=0x7E0; op1631=0x120
{
- #I have no clue
+
}
# LDSR reg2, regID - rrrrr111111RRRRR|0000000000100000
@@ -150,36 +150,36 @@
# RETI - 0000011111100000|0000000101000000
:reti is op0515=0x3F; op1631=0x140
{
- if($(EP)!=1)
- goto <false>;
+ if($(EP)!=1)
+ goto <false>;
- PC = EIPC;
- PSW = EIPSW;
- goto <end>;
+ PC = EIPC;
+ PSW = EIPSW;
+ goto <end>;
- <false>
- if($(NP)!=1)
- goto <false2>;
+ <false>
+ if($(NP)!=1)
+ goto <false2>;
- PC = FEPC;
- PSW = FEPSW;
- goto <end>;
+ PC = FEPC;
+ PSW = FEPSW;
+ goto <end>;
- <false2>
- PC = EIPC;
- PSW = EIPSW;
+ <false2>
+ PC = EIPC;
+ PSW = EIPSW;
- <end>
- return[PC];
+ <end>
+ return[PC];
}
# RIE - 0000000001000000
:rie is op0015=0x40
{
- FEPC = PC;
+ FEPC = PC;
FEPSW = PSW;
$(NP) = 1;
- $(EP) = 1;
+ $(EP) = 1;
$(ID) = 1;
PC = 0x30;
goto [PC];
@@ -188,10 +188,10 @@
# RIE imm5, imm4 - iiiii1111111IIII|0000000000000000
:rie op1115, op0003 is op0410=0x7F & op1115 & op0003; op1631=0x0
{
- FEPC = PC;
+ FEPC = PC;
FEPSW = PSW;
$(NP) = 1;
- $(EP) = 1;
+ $(EP) = 1;
$(ID) = 1;
PC = 0x30;
goto [PC];
@@ -214,29 +214,29 @@
# SYNCE - 0000000000011101
:synce is op0015=0x1D
{
- #I don't know that either
+ synce();
}
# SYNCM - 0000000000011110
:syncm is op0015=0x1E
{
- #same here
+
}
# SYNCP - 0000000000011111
:syncp is op0015=0x1F
{
- #and here
+
}
# SYSCALL vector8 - 11010111111vvvvv|00VVV00101100000
:syscall vector8 is op0515=0x6BF & op0004; op3031=0 & op2729 & op1626=0x160
[ vector8 = (op2729 << 5) | op0004; ]
{
- EIPC = inst_next;
+ EIPC = inst_next;
EIPSW = PSW;
- EIIC = vector8 + 0x8000; # exception code 0x8000..0x80FF
- $(EICC) = vector8 + 0x8000; # exception code 0x8000..0x80FF
+ EIIC = vector8 + 0x8000; # exception code 0x8000..0x80FF
+ $(EICC) = vector8 + 0x8000; # exception code 0x8000..0x80FF
$(EP) = 1;
$(ID) = 1;
local adr:4;
@@ -251,8 +251,8 @@
local vector5:4 = op0004;
EIPC = inst_next;
EIPSW = PSW;
- EIIC = vector5 + 0x40; # exception code 0x40..0x5F
- $(EICC) = vector5:2 + 0x40; # exception code 0x40..0x5F
+ EIIC = vector5 + 0x40; # exception code 0x40..0x5F
+ $(EICC) = vector5:2 + 0x40; # exception code 0x40..0x5F
$(EP) = 1;
$(ID) = 1;
either_or(PC, (vector5 <= 15), 0x40, 0x50);
diff --git a/Ghidra/Processors/V850E2M/data/languages/Instructions/Store.sinc b/Ghidra/Processors/V850E2M/data/languages/Instructions/Store.sinc
index f13d29e3d9..3b4e011049 100644
--- a/Ghidra/Processors/V850E2M/data/languages/Instructions/Store.sinc
+++ b/Ghidra/Processors/V850E2M/data/languages/Instructions/Store.sinc
@@ -1,6 +1,6 @@
-##################################################
-##### Store #####
-##################################################
+#####################################################
+##### Store #####
+#####################################################
# SST.B reg2, disp7[ep] - rrrrr0111ddddddd
diff --git a/Ghidra/Processors/V850E2M/data/languages/V850E2M.slaspec b/Ghidra/Processors/V850E2M/data/languages/V850E2M.slaspec
index 6333a78323..b2b9526898 100644
--- a/Ghidra/Processors/V850E2M/data/languages/V850E2M.slaspec
+++ b/Ghidra/Processors/V850E2M/data/languages/V850E2M.slaspec
@@ -1,8 +1,8 @@
-##################################################
-##### #####
-##### V850E2M SLEIGH specification #####
-##### #####
-##################################################
+#####################################################
+##### #####
+##### V850E2M SLEIGH specification #####
+##### #####
+#####################################################
define endian = little;
@@ -12,9 +12,9 @@ define space register type=register_space size=4;
-##################################################
-##### Helpers #####
-##################################################
+#####################################################
+##### Helpers #####
+#####################################################
@include "Helpers/Register.sinc"
@include "Helpers/Tokens.sinc"
@@ -25,9 +25,9 @@ define space register type=register_space size=4;
-##################################################
-##### Instructions #####
-##################################################
+#####################################################
+##### Instructions #####
+#####################################################
@include "Instructions/Load.sinc"
@include "Instructions/Store.sinc"