aboutsummaryrefslogtreecommitdiff
path: root/sim/d10v/simops.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-09-13 21:40:00 +0000
committerJason Molenda <jmolenda@apple.com>1999-09-13 21:40:00 +0000
commitcff3e48be70e018476521d0f62705c29f4112771 (patch)
tree09899684e1ac06491418cb186525498ba0a60544 /sim/d10v/simops.c
parent59f2c4e703f7c5f894322210c24e0ffc4c1c56eb (diff)
downloadgdb-cff3e48be70e018476521d0f62705c29f4112771.zip
gdb-cff3e48be70e018476521d0f62705c29f4112771.tar.gz
gdb-cff3e48be70e018476521d0f62705c29f4112771.tar.bz2
import gdb-1999-09-13 snapshot
Diffstat (limited to 'sim/d10v/simops.c')
-rw-r--r--sim/d10v/simops.c175
1 files changed, 175 insertions, 0 deletions
diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c
index 54cc6fe..22bdd91 100644
--- a/sim/d10v/simops.c
+++ b/sim/d10v/simops.c
@@ -34,6 +34,7 @@ enum op_types {
OP_CONSTANT4,
OP_MEMREF,
OP_MEMREF2,
+ OP_MEMREF3,
OP_POSTDEC,
OP_POSTINC,
OP_PREDEC,
@@ -307,6 +308,12 @@ trace_input_func (name, in1, in2, in3)
comma = ",";
break;
+ case OP_MEMREF3:
+ sprintf (p, "%s@%d", comma, OP[i]);
+ p += strlen (p);
+ comma = ",";
+ break;
+
case OP_POSTINC:
sprintf (p, "%s@r%d+", comma, OP[i]);
p += strlen (p);
@@ -380,6 +387,10 @@ trace_input_func (name, in1, in2, in3)
(uint16) GPR (OP[i]));
break;
+ case OP_MEMREF3:
+ (*d10v_callback->printf_filtered) (d10v_callback, "%*s0x%.4x", SIZE_VALUES-6, "", (uint16) OP[i]);
+ break;
+
case OP_DREG:
tmp = (long)((((uint32) GPR (OP[i])) << 16) | ((uint32) GPR (OP[i] + 1)));
(*d10v_callback->printf_filtered) (d10v_callback, "%*s0x%.8lx", SIZE_VALUES-10, "", tmp);
@@ -1312,6 +1323,18 @@ OP_6000 ()
trace_output_16 (tmp);
}
+/* ld */
+void
+OP_32010000 ()
+{
+ uint16 tmp;
+
+ trace_input ("ld", OP_REG_OUTPUT, OP_MEMREF3, OP_VOID);
+ tmp = RW (OP[1]);
+ SET_GPR (OP[0], tmp);
+ trace_output_16 (tmp);
+}
+
/* ld2w */
void
OP_31000000 ()
@@ -1364,6 +1387,18 @@ OP_6200 ()
trace_output_32 (tmp);
}
+/* ld2w */
+void
+OP_33010000 ()
+{
+ int32 tmp;
+
+ trace_input ("ld2w", OP_REG_OUTPUT, OP_MEMREF3, OP_VOID);
+ tmp = RLW (OP[1]);
+ SET_GPR32 (OP[0], tmp);
+ trace_output_32 (tmp);
+}
+
/* ldb */
void
OP_38000000 ()
@@ -2207,6 +2242,74 @@ OP_5F40 ()
trace_output_void ();
}
+
+/* sac */
+void OP_5209 ()
+{
+ int64 tmp;
+
+ trace_input ("sac", OP_REG_OUTPUT, OP_ACCUM, OP_VOID);
+
+ tmp = SEXT40(ACC (OP[1]));
+
+ SET_PSW_F1 (PSW_F0);
+
+ if (tmp > SEXT40(MAX32))
+ {
+ tmp = (MAX32);
+ SET_PSW_F0 (1);
+ }
+ else if (tmp < SEXT40(MIN32))
+ {
+ tmp = 0x80000000;
+ SET_PSW_F0 (1);
+ }
+ else
+ {
+ tmp = (tmp & MASK32);
+ SET_PSW_F0 (0);
+ }
+
+ SET_GPR32 (OP[0], tmp);
+
+ trace_output_40 (tmp);
+}
+
+
+/* sachi */
+void
+OP_4209 ()
+{
+ int64 tmp;
+
+ trace_input ("sachi", OP_REG_OUTPUT, OP_ACCUM, OP_VOID);
+
+ tmp = SEXT40(ACC (OP[1]));
+
+ SET_PSW_F1 (PSW_F0);
+
+ if (tmp > SEXT40(MAX32))
+ {
+ tmp = 0x7fff;
+ SET_PSW_F0 (1);
+ }
+ else if (tmp < SEXT40(MIN32))
+ {
+ tmp = 0x8000;
+ SET_PSW_F0 (1);
+ }
+ else
+ {
+ tmp >>= 16;
+ SET_PSW_F0 (0);
+ }
+
+ SET_GPR (OP[0], tmp);
+
+ trace_output_16 (OP[0]);
+}
+
+
/* sadd */
void
OP_1223 ()
@@ -2252,6 +2355,59 @@ OP_4613 ()
trace_output_16 (tmp);
}
+/* slae */
+void
+OP_3220 ()
+{
+ int64 tmp;
+ int16 reg;
+
+ trace_input ("slae", OP_ACCUM, OP_REG, OP_VOID);
+
+ reg = SEXT16( GPR (OP[1]));
+
+ if (reg >= 17 || reg <= -17)
+ {
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: shift value %d too large.\n", reg);
+ State.exception = SIGILL;
+ return;
+ }
+
+ tmp = SEXT40 (ACC (OP[0]));
+
+ if (PSW_ST && (tmp < SEXT40 (MIN32) || tmp > SEXT40 (MAX32)))
+ {
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: value to shift 0x%x out of range.\n", tmp);
+ State.exception = SIGILL;
+ return;
+ }
+
+ if (reg >= 0 && reg <= 16)
+ {
+ tmp = SEXT56 ((SEXT56 (tmp)) << (GPR (OP[1])));
+ if (PSW_ST)
+ {
+ if (tmp > SEXT40(MAX32))
+ tmp = (MAX32);
+ else if (tmp < SEXT40(MIN32))
+ tmp = (MIN32);
+ else
+ tmp = (tmp & MASK40);
+ }
+ else
+ tmp = (tmp & MASK40);
+ }
+ else
+ {
+ tmp = (SEXT40 (ACC (OP[0]))) >> (-GPR (OP[1]));
+ }
+
+ SET_ACC(OP[0], tmp);
+
+ trace_output_40(tmp);
+}
+
+
/* sleep */
void
OP_5FC0 ()
@@ -2535,6 +2691,15 @@ OP_6C01 ()
trace_output_void ();
}
+/* st */
+void
+OP_36010000 ()
+{
+ trace_input ("st", OP_REG, OP_MEMREF3, OP_VOID);
+ SW (OP[1], GPR (OP[0]));
+ trace_output_void ();
+}
+
/* st2w */
void
OP_35000000 ()
@@ -2601,6 +2766,16 @@ OP_6E01 ()
trace_output_void ();
}
+/* st2w */
+void
+OP_37010000 ()
+{
+ trace_input ("st2w", OP_DREG, OP_MEMREF3, OP_VOID);
+ SW (OP [1] + 0, GPR (OP[0] + 0));
+ SW (OP [1] + 2, GPR (OP[0] + 1));
+ trace_output_void ();
+}
+
/* stb */
void
OP_3C000000 ()