mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Implemented code review changes
This commit is contained in:
@@ -128,10 +128,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
local n:4 = opcode_08_11;
|
local n:4 = opcode_08_11;
|
||||||
|
|
||||||
# Check n != m
|
# Check n != m
|
||||||
if(m == n) goto <END>;
|
rm_04_07 = rm_04_07 + zext(1 *(m != n));
|
||||||
rm_04_07 = rm_04_07 + 1;
|
|
||||||
|
|
||||||
<END>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:mov.w @rm_04_07+,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b0101 & opcode_04_07 & opcode_08_11
|
:mov.w @rm_04_07+,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b0101 & opcode_04_07 & opcode_08_11
|
||||||
@@ -142,10 +139,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
local n:4 = opcode_08_11;
|
local n:4 = opcode_08_11;
|
||||||
|
|
||||||
# Check n != m
|
# Check n != m
|
||||||
if(m == n) goto <END>;
|
rm_04_07 = rm_04_07 + zext(2 *(m != n));
|
||||||
rm_04_07 = rm_04_07 + 2;
|
|
||||||
|
|
||||||
<END>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:mov.l @rm_04_07+,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b0110 & opcode_04_07 & opcode_08_11
|
:mov.l @rm_04_07+,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b0110 & opcode_04_07 & opcode_08_11
|
||||||
@@ -156,10 +150,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
local n:4 = opcode_08_11;
|
local n:4 = opcode_08_11;
|
||||||
|
|
||||||
# Check n != m
|
# Check n != m
|
||||||
if(m == n) goto <END>;
|
rm_04_07 = rm_04_07 + zext(4 *(m != n));
|
||||||
rm_04_07 = rm_04_07 + 4;
|
|
||||||
|
|
||||||
<END>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:mov.b rm_04_07,@-rn_08_11 is opcode_12_15=0b0010 & rn_08_11 & rm_04_07 & opcode_00_03=0b0100
|
:mov.b rm_04_07,@-rn_08_11 is opcode_12_15=0b0010 & rn_08_11 & rm_04_07 & opcode_00_03=0b0100
|
||||||
@@ -440,7 +431,8 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
rn_08_11 = rn_08_11 << 1;
|
rn_08_11 = rn_08_11 << 1;
|
||||||
rn_08_11 = rn_08_11 | zext($(T_FLAG));
|
rn_08_11 = rn_08_11 | zext($(T_FLAG));
|
||||||
|
|
||||||
# BUGBUG: cleaner way to do this??
|
# FIXME: cleaner way to do this??
|
||||||
|
tmp0 = rn_08_11;
|
||||||
|
|
||||||
if(old_q == 0 && $(M_FLAG) == 0 && $(Q_FLAG) == 0) goto <OQ0_M0_Q0>;
|
if(old_q == 0 && $(M_FLAG) == 0 && $(Q_FLAG) == 0) goto <OQ0_M0_Q0>;
|
||||||
if(old_q == 0 && $(M_FLAG) == 0 && $(Q_FLAG) == 1) goto <OQ0_M0_Q1>;
|
if(old_q == 0 && $(M_FLAG) == 0 && $(Q_FLAG) == 1) goto <OQ0_M0_Q1>;
|
||||||
@@ -452,56 +444,48 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
if(old_q == 1 && $(M_FLAG) == 1 && $(Q_FLAG) == 1) goto <OQ1_M1_Q1>;
|
if(old_q == 1 && $(M_FLAG) == 1 && $(Q_FLAG) == 1) goto <OQ1_M1_Q1>;
|
||||||
|
|
||||||
<OQ0_M0_Q0>
|
<OQ0_M0_Q0>
|
||||||
tmp0 = rn_08_11;
|
|
||||||
rn_08_11 = rn_08_11 - tmp2;
|
rn_08_11 = rn_08_11 - tmp2;
|
||||||
tmp1 = rn_08_11 > tmp0;
|
tmp1 = rn_08_11 > tmp0;
|
||||||
$(Q_FLAG) = tmp1;
|
$(Q_FLAG) = tmp1;
|
||||||
goto <SET_FLAG>;
|
goto <SET_FLAG>;
|
||||||
|
|
||||||
<OQ0_M0_Q1>
|
<OQ0_M0_Q1>
|
||||||
tmp0 = rn_08_11;
|
|
||||||
rn_08_11 = rn_08_11 - tmp2;
|
rn_08_11 = rn_08_11 - tmp2;
|
||||||
tmp1 = rn_08_11 > tmp0;
|
tmp1 = rn_08_11 > tmp0;
|
||||||
$(Q_FLAG) = tmp1 == 0;
|
$(Q_FLAG) = tmp1 == 0;
|
||||||
goto <SET_FLAG>;
|
goto <SET_FLAG>;
|
||||||
|
|
||||||
<OQ0_M1_Q0>
|
<OQ0_M1_Q0>
|
||||||
tmp0 = rn_08_11;
|
|
||||||
rn_08_11 = rn_08_11 + tmp2;
|
rn_08_11 = rn_08_11 + tmp2;
|
||||||
tmp1 = rn_08_11 < tmp0;
|
tmp1 = rn_08_11 < tmp0;
|
||||||
$(Q_FLAG) = tmp1 == 0;
|
$(Q_FLAG) = tmp1 == 0;
|
||||||
goto <SET_FLAG>;
|
goto <SET_FLAG>;
|
||||||
|
|
||||||
<OQ0_M1_Q1>
|
<OQ0_M1_Q1>
|
||||||
tmp0 = rn_08_11;
|
|
||||||
rn_08_11 = rn_08_11 + tmp2;
|
rn_08_11 = rn_08_11 + tmp2;
|
||||||
tmp1 = rn_08_11 < tmp0;
|
tmp1 = rn_08_11 < tmp0;
|
||||||
$(Q_FLAG) = tmp1;
|
$(Q_FLAG) = tmp1;
|
||||||
goto <SET_FLAG>;
|
goto <SET_FLAG>;
|
||||||
|
|
||||||
<OQ1_M0_Q0>
|
<OQ1_M0_Q0>
|
||||||
tmp0 = rn_08_11;
|
|
||||||
rn_08_11 = rn_08_11 + tmp2;
|
rn_08_11 = rn_08_11 + tmp2;
|
||||||
tmp1 = rn_08_11 < tmp0;
|
tmp1 = rn_08_11 < tmp0;
|
||||||
$(Q_FLAG) = tmp1;
|
$(Q_FLAG) = tmp1;
|
||||||
goto <SET_FLAG>;
|
goto <SET_FLAG>;
|
||||||
|
|
||||||
<OQ1_M0_Q1>
|
<OQ1_M0_Q1>
|
||||||
tmp0 = rn_08_11;
|
|
||||||
rn_08_11 = rn_08_11 + tmp2;
|
rn_08_11 = rn_08_11 + tmp2;
|
||||||
tmp1 = rn_08_11 < tmp0;
|
tmp1 = rn_08_11 < tmp0;
|
||||||
$(Q_FLAG) = tmp1;
|
$(Q_FLAG) = tmp1;
|
||||||
goto <SET_FLAG>;
|
goto <SET_FLAG>;
|
||||||
|
|
||||||
<OQ1_M1_Q0>
|
<OQ1_M1_Q0>
|
||||||
tmp0 = rn_08_11;
|
|
||||||
rn_08_11 = rn_08_11 - tmp2;
|
rn_08_11 = rn_08_11 - tmp2;
|
||||||
tmp1 = rn_08_11 > tmp0;
|
tmp1 = rn_08_11 > tmp0;
|
||||||
$(Q_FLAG) = tmp1 == 0;
|
$(Q_FLAG) = tmp1 == 0;
|
||||||
goto <SET_FLAG>;
|
goto <SET_FLAG>;
|
||||||
|
|
||||||
<OQ1_M1_Q1>
|
<OQ1_M1_Q1>
|
||||||
tmp0 = rn_08_11;
|
|
||||||
rn_08_11 = rn_08_11 - tmp2;
|
rn_08_11 = rn_08_11 - tmp2;
|
||||||
tmp1 = rn_08_11 > tmp0;
|
tmp1 = rn_08_11 > tmp0;
|
||||||
$(Q_FLAG) = tmp1;
|
$(Q_FLAG) = tmp1;
|
||||||
@@ -541,32 +525,14 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
:exts.b rm_04_07,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b1110
|
:exts.b rm_04_07,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b1110
|
||||||
{
|
{
|
||||||
rn_08_11 = rm_04_07;
|
local temp:1 = rm_04_07(1);
|
||||||
|
rn_08_11 = sext(temp);
|
||||||
if((rm_04_07 & 0x00000080) == 0) goto <UNSIGNED>;
|
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 | 0xFFFFFF00;
|
|
||||||
goto <END>;
|
|
||||||
|
|
||||||
<UNSIGNED>
|
|
||||||
rn_08_11 = rn_08_11 & 0x000000FF;
|
|
||||||
|
|
||||||
<END>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:exts.w rm_04_07,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b1111
|
:exts.w rm_04_07,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b1111
|
||||||
{
|
{
|
||||||
rn_08_11 = rm_04_07;
|
local temp:2 = rm_04_07(2);
|
||||||
|
rn_08_11 = sext(temp);
|
||||||
if((rm_04_07 & 0x00008000) == 0) goto <UNSIGNED>;
|
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 | 0xFFFF0000;
|
|
||||||
goto <END>;
|
|
||||||
|
|
||||||
<UNSIGNED>
|
|
||||||
rn_08_11 = rn_08_11 & 0x0000FFFF;
|
|
||||||
|
|
||||||
<END>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:extu.b rm_04_07,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b1100
|
:extu.b rm_04_07,rn_08_11 is opcode_12_15=0b0110 & rn_08_11 & rm_04_07 & opcode_00_03=0b1100
|
||||||
@@ -582,7 +548,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
@if SH_VERSION == "2"
|
@if SH_VERSION == "2"
|
||||||
:mac.l @rm_04_07+,@rn_08_11+ is opcode_12_15=0b0000 & rn_08_11 & rm_04_07 & opcode_00_03=0b1111
|
:mac.l @rm_04_07+,@rn_08_11+ is opcode_12_15=0b0000 & rn_08_11 & rm_04_07 & opcode_00_03=0b1111
|
||||||
{
|
{
|
||||||
# BUGBUG: review this instruction
|
# FIXME: review this instruction
|
||||||
|
|
||||||
local RnL;
|
local RnL;
|
||||||
local RnH;
|
local RnH;
|
||||||
@@ -606,11 +572,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
tempm = *:4 rm_04_07;
|
tempm = *:4 rm_04_07;
|
||||||
rm_04_07 = rm_04_07 + 4;
|
rm_04_07 = rm_04_07 + 4;
|
||||||
|
|
||||||
if((tempn ^ tempm) s<0) goto <NEG>;
|
fnLmL = -1 * zext((tempn ^ tempm) s<0);
|
||||||
fnLmL = 0;
|
|
||||||
goto <END>;
|
|
||||||
<NEG>
|
|
||||||
fnLmL = -1;
|
|
||||||
|
|
||||||
if( tempn s>= 0) goto <SKIP_TEMPN>;
|
if( tempn s>= 0) goto <SKIP_TEMPN>;
|
||||||
tempn = 0 - tempn;
|
tempn = 0 - tempn;
|
||||||
@@ -695,7 +657,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
:mac.w @rm_04_07+,@rn_08_11+ is opcode_12_15=0b0100 & rn_08_11 & rm_04_07 & opcode_00_03=0b1111
|
:mac.w @rm_04_07+,@rn_08_11+ is opcode_12_15=0b0100 & rn_08_11 & rm_04_07 & opcode_00_03=0b1111
|
||||||
{
|
{
|
||||||
# BUGBUG: review this instruction
|
# FIXME: review this instruction
|
||||||
|
|
||||||
local tempm:4;
|
local tempm:4;
|
||||||
local tempn:4;
|
local tempn:4;
|
||||||
@@ -714,16 +676,9 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
dest = (macl s< 0);
|
dest = (macl s< 0);
|
||||||
|
|
||||||
if(tempm s< 0) goto <ELSE>;
|
src = zext(1*(tempm s>= 0));
|
||||||
src = 0;
|
tempn = sext(-1*(tempm s>= 0));
|
||||||
tempn = 0;
|
|
||||||
goto <ENDIF>;
|
|
||||||
|
|
||||||
<ELSE>
|
|
||||||
src = 1;
|
|
||||||
tempn = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
<ENDIF>
|
|
||||||
src = src + zext(dest);
|
src = src + zext(dest);
|
||||||
macl = macl + tempm;
|
macl = macl + tempm;
|
||||||
|
|
||||||
@@ -759,9 +714,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
mach = mach + tempn;
|
mach = mach + tempn;
|
||||||
|
|
||||||
if(templ s<= macl) goto <SKIP_INC>;
|
macl = macl + zext(1*(templ s> macl));
|
||||||
macl = macl + 1;
|
|
||||||
<SKIP_INC>
|
|
||||||
|
|
||||||
@if SH_VERSION == "1"
|
@if SH_VERSION == "1"
|
||||||
if((mach & 0x00000200) == 0) goto <ZERO_EXTEND>;
|
if((mach & 0x00000200) == 0) goto <ZERO_EXTEND>;
|
||||||
@@ -803,7 +756,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
temp = 0 - rm_04_07;
|
temp = 0 - rm_04_07;
|
||||||
rn_08_11 = temp - zext($(T_FLAG));
|
rn_08_11 = temp - zext($(T_FLAG));
|
||||||
|
|
||||||
# BUGBUG: should temp be signed or unsigned??
|
# FIXME: should temp be signed or unsigned??
|
||||||
# Documentation says if(0 < temp) not 0 != temp
|
# Documentation says if(0 < temp) not 0 != temp
|
||||||
$(T_FLAG) = (0 != temp) || (temp < rn_08_11);
|
$(T_FLAG) = (0 != temp) || (temp < rn_08_11);
|
||||||
}
|
}
|
||||||
@@ -823,7 +776,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
rn_08_11 = temp1 - zext($(T_FLAG));
|
rn_08_11 = temp1 - zext($(T_FLAG));
|
||||||
|
|
||||||
$(T_FLAG) = (temp0 < temp1 || temp1 < rn_08_11);
|
$(T_FLAG) = (temp0 < temp1 || temp1 < rn_08_11);
|
||||||
}
|
}
|
||||||
|
|
||||||
:subv rm_04_07,rn_08_11 is opcode_12_15=0b0011 & rn_08_11 & rm_04_07 & opcode_00_03=0b1011
|
:subv rm_04_07,rn_08_11 is opcode_12_15=0b0011 & rn_08_11 & rm_04_07 & opcode_00_03=0b1011
|
||||||
@@ -832,16 +785,16 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
local src;
|
local src;
|
||||||
local ans;
|
local ans;
|
||||||
|
|
||||||
dest = !(rn_08_11 s>= 0);
|
dest = (rn_08_11 s< 0);
|
||||||
src = !(rm_04_07 s>= 0);
|
src = (rm_04_07 s< 0);
|
||||||
|
|
||||||
src = src + dest;
|
src = src + dest;
|
||||||
rn_08_11 = rn_08_11 - rm_04_07;
|
rn_08_11 = rn_08_11 - rm_04_07;
|
||||||
|
|
||||||
ans = (rn_08_11 s>= 0);
|
ans = (rn_08_11 s< 0);
|
||||||
ans = ans + dest;
|
ans = ans + dest;
|
||||||
|
|
||||||
$(T_FLAG) = (src == 1) && (ans == 1);
|
$(T_FLAG) = (src == 1) && (ans == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -854,13 +807,13 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
:and imm_00_07,r0 is r0 & opcode_08_15=0b11001001 & imm_00_07
|
:and imm_00_07,r0 is r0 & opcode_08_15=0b11001001 & imm_00_07
|
||||||
{
|
{
|
||||||
r0 = (r0 & imm_00_07) & 0x000000FF;
|
r0 = (r0 & zext(imm_00_07:4));
|
||||||
}
|
}
|
||||||
|
|
||||||
:and.b imm_00_07,@(r0,gbr) is r0 & gbr & opcode_08_15=0b11001101 & imm_00_07
|
:and.b imm_00_07,@(r0,gbr) is r0 & gbr & opcode_08_15=0b11001101 & imm_00_07
|
||||||
{
|
{
|
||||||
local temp = *:1 (gbr + r0);
|
local temp:1 = *:1 (gbr + r0);
|
||||||
temp = (temp & imm_00_07) & 0x000000FF;
|
temp = (temp & zext(imm_00_07:1));
|
||||||
|
|
||||||
*:1 (gbr + r0) = temp;
|
*:1 (gbr + r0) = temp;
|
||||||
}
|
}
|
||||||
@@ -882,8 +835,8 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
:or.b imm_00_07,@(r0,gbr) is r0 & gbr & opcode_08_15=0b11001111 & imm_00_07
|
:or.b imm_00_07,@(r0,gbr) is r0 & gbr & opcode_08_15=0b11001111 & imm_00_07
|
||||||
{
|
{
|
||||||
local temp = *:1 (gbr + r0);
|
local temp:1 = *:1 (gbr + r0);
|
||||||
temp = (temp & imm_00_07) | 0x000000FF;
|
temp = temp | zext(imm_00_07:1);
|
||||||
|
|
||||||
*:1 (gbr + r0) = temp;
|
*:1 (gbr + r0) = temp;
|
||||||
}
|
}
|
||||||
@@ -901,12 +854,12 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
:tst rm_04_07,rn_08_11 is opcode_12_15=0b0010 & rn_08_11 & rm_04_07 & opcode_00_03=0b1000
|
:tst rm_04_07,rn_08_11 is opcode_12_15=0b0010 & rn_08_11 & rm_04_07 & opcode_00_03=0b1000
|
||||||
{
|
{
|
||||||
$(T_FLAG) = ((rm_04_07 & rm_04_07) == 0);
|
$(T_FLAG) = ((rm_04_07 & rn_08_11) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
:tst imm_00_07,r0 is r0 & opcode_08_15=0b11001000 & imm_00_07
|
:tst imm_00_07,r0 is r0 & opcode_08_15=0b11001000 & imm_00_07
|
||||||
{
|
{
|
||||||
local temp = r0 & (imm_00_07 & 0x000000FF);
|
local temp = r0 & (imm_00_07 & 0x000000FF);
|
||||||
|
|
||||||
$(T_FLAG) = (temp == 0);
|
$(T_FLAG) = (temp == 0);
|
||||||
}
|
}
|
||||||
@@ -946,13 +899,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
temp = ((rn_08_11 & 0x80000000) != 0);
|
temp = ((rn_08_11 & 0x80000000) != 0);
|
||||||
|
|
||||||
rn_08_11 = (rn_08_11 << 1) & 0xFFFFFFFE;
|
rn_08_11 = rn_08_11 | zext($(T_FLAG));
|
||||||
|
|
||||||
if($(T_FLAG) == 0) goto <SKIP_BIT>;
|
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 | 0x1;
|
|
||||||
|
|
||||||
<SKIP_BIT>
|
|
||||||
|
|
||||||
$(T_FLAG) = temp;
|
$(T_FLAG) = temp;
|
||||||
}
|
}
|
||||||
@@ -963,13 +910,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
temp = !((rn_08_11 & 1) == 0);
|
temp = !((rn_08_11 & 1) == 0);
|
||||||
|
|
||||||
rn_08_11 = (rn_08_11 >> 1) & 0x7FFFFFFF;
|
rn_08_11= rn_08_11 | (0x80000000 * zext($(T_FLAG)));
|
||||||
|
|
||||||
if($(T_FLAG) == 0) goto <SKIP_BIT>;
|
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 | 0x80000000;
|
|
||||||
|
|
||||||
<SKIP_BIT>
|
|
||||||
|
|
||||||
$(T_FLAG) = temp;
|
$(T_FLAG) = temp;
|
||||||
}
|
}
|
||||||
@@ -978,32 +919,14 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
{
|
{
|
||||||
$(T_FLAG) = ((rn_08_11 & 0x80000000) != 0);
|
$(T_FLAG) = ((rn_08_11 & 0x80000000) != 0);
|
||||||
|
|
||||||
if($(T_FLAG) == 1) goto <SIGN_EXTEND>;
|
rn_08_11 = (rn_08_11 << 1) | zext($(T_FLAG));
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 & 0xFFFFFFFE;
|
|
||||||
goto <END>;
|
|
||||||
|
|
||||||
<SIGN_EXTEND>
|
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 | 0x00000001;
|
|
||||||
|
|
||||||
<END>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:rotr rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00000101
|
:rotr rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00000101
|
||||||
{
|
{
|
||||||
$(T_FLAG) = ((rn_08_11 & 0x1) != 0);
|
$(T_FLAG) = ((rn_08_11 & 0x1) != 0);
|
||||||
|
|
||||||
if($(T_FLAG) == 1) goto <SIGN_EXTEND>;
|
rn_08_11 = (rn_08_11 >> 1) | sext($(T_FLAG));
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 & 0x7FFFFFFF;
|
|
||||||
goto <END>;
|
|
||||||
|
|
||||||
<SIGN_EXTEND>
|
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 | 0x80000000;
|
|
||||||
|
|
||||||
<END>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:shal rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00100000
|
:shal rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00100000
|
||||||
@@ -1018,18 +941,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
{
|
{
|
||||||
$(T_FLAG) = ((rn_08_11 & 1) == 1);
|
$(T_FLAG) = ((rn_08_11 & 1) == 1);
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 >> 1;
|
rn_08_11 = rn_08_11 s>> 1;
|
||||||
|
|
||||||
if((rn_08_11 & 0x80000000) != 1) goto <SIGN_EXTEND>;
|
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 & 0x7FFFFFFF;
|
|
||||||
goto <END>;
|
|
||||||
|
|
||||||
<SIGN_EXTEND>
|
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 | 0x80000000;
|
|
||||||
|
|
||||||
<END>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:shll rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00000000
|
:shll rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00000000
|
||||||
@@ -1061,25 +973,21 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
$(T_FLAG) = (rn_08_11 & 1) == 1;
|
$(T_FLAG) = (rn_08_11 & 1) == 1;
|
||||||
|
|
||||||
rn_08_11 = rn_08_11 >> 1;
|
rn_08_11 = rn_08_11 >> 1;
|
||||||
rn_08_11 = rn_08_11 & 0x7FFFFFFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:shlr2 rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00001001
|
:shlr2 rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00001001
|
||||||
{
|
{
|
||||||
rn_08_11 = rn_08_11 >> 2;
|
rn_08_11 = rn_08_11 >> 2;
|
||||||
rn_08_11 = rn_08_11 & 0x3FFFFFFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:shlr8 rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00011001
|
:shlr8 rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00011001
|
||||||
{
|
{
|
||||||
rn_08_11 = rn_08_11 >> 8;
|
rn_08_11 = rn_08_11 >> 8;
|
||||||
rn_08_11 = rn_08_11 & 0x00FFFFFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:shlr16 rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00101001
|
:shlr16 rn_08_11 is opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00101001
|
||||||
{
|
{
|
||||||
rn_08_11 = rn_08_11 >> 16;
|
rn_08_11 = rn_08_11 >> 16;
|
||||||
rn_08_11 = rn_08_11 & 0x0000FFFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1151,8 +1059,10 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
:jsr @rm_08_11 is opcode_12_15=0b0100 & rm_08_11 & opcode_00_07=0b00001011
|
:jsr @rm_08_11 is opcode_12_15=0b0100 & rm_08_11 & opcode_00_07=0b00001011
|
||||||
{
|
{
|
||||||
pr = inst_start + 4;
|
pr = inst_start + 4;
|
||||||
|
local dest = rm_08_11 + inst_next;
|
||||||
|
|
||||||
delayslot(1);
|
delayslot(1);
|
||||||
call [rm_08_11];
|
call [dest];
|
||||||
}
|
}
|
||||||
|
|
||||||
:rts is opcode_00_15=0b0000000000001011
|
:rts is opcode_00_15=0b0000000000001011
|
||||||
@@ -1271,7 +1181,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
:nop is opcode_00_15=0b0000000000001001
|
:nop is opcode_00_15=0b0000000000001001
|
||||||
{
|
{
|
||||||
# BUGBUG: intentional nop
|
# FIXME: intentional nop
|
||||||
r0 = r0; # do this to suppress warning
|
r0 = r0; # do this to suppress warning
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1298,7 +1208,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
:sleep is opcode_00_15=0b0000000000011011
|
:sleep is opcode_00_15=0b0000000000011011
|
||||||
{
|
{
|
||||||
# BUGBUG: call sleep();
|
# FIXME: call sleep();
|
||||||
r0 = r0;
|
r0 = r0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1377,7 +1287,7 @@ target00_11: target is sdisp_00_11 [ target = (sdisp_00_11 << 1) + inst_start +
|
|||||||
|
|
||||||
:sts macl,rn_08_11 is macl & opcode_12_15=0b0000 & rn_08_11 & opcode_00_07=0b00011010
|
:sts macl,rn_08_11 is macl & opcode_12_15=0b0000 & rn_08_11 & opcode_00_07=0b00011010
|
||||||
{
|
{
|
||||||
rn_08_11 = macl;
|
rn_08_11 = macl;
|
||||||
}
|
}
|
||||||
|
|
||||||
:sts.l macl,@-rn_08_11 is macl & opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00010010
|
:sts.l macl,@-rn_08_11 is macl & opcode_12_15=0b0100 & rn_08_11 & opcode_00_07=0b00010010
|
||||||
|
|||||||
Reference in New Issue
Block a user