+Wed Jan 28 18:44:33 1998 Michael Meissner <meissner@cygnus.com>
+
+ * misc.c (tic80_trace_cmp_internal): New function to return
+ compare bits as a string.
+ (tic80_trace_{,fpu2}cmp): New functions for tracing cmp and fcmp.
+
+ * cpu.h (tic80_trace_{,fpu2}cmp): Add declaration.
+ (TRACE_{,FPU2}CMP): New macros for tracing compares.
+
+ * insns (do_{,f}cmp): Use compare specific tracing functions to
+ print out the flag bits.
+
Mon Jan 19 22:26:29 1998 Doug Evans <devans@seba>
* configure: Regenerated to track ../common/aclocal.m4 changes.
/* TIc80 Simulator.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
#if defined(WITH_TRACE)
extern char *tic80_trace_alu3 PARAMS ((int, unsigned32, unsigned32, unsigned32));
+extern char *tic80_trace_cmp PARAMS ((int, unsigned32, unsigned32, unsigned32));
extern char *tic80_trace_alu2 PARAMS ((int, unsigned32, unsigned32));
extern char *tic80_trace_shift PARAMS ((int, unsigned32, unsigned32, int, int, int, int, int));
extern void tic80_trace_fpu3 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu, sim_fpu, sim_fpu));
extern void tic80_trace_fpu2 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu, sim_fpu));
extern void tic80_trace_fpu1 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu));
extern void tic80_trace_fpu2i PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu, sim_fpu));
+extern void tic80_trace_fpu2cmp PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu, sim_fpu));
extern char *tic80_trace_nop PARAMS ((int));
extern char *tic80_trace_sink1 PARAMS ((int, unsigned32));
extern char *tic80_trace_sink2 PARAMS ((int, unsigned32, unsigned32));
} \
} while (0)
+#define TRACE_CMP(indx, result, input1, input2) \
+do { \
+ if (TRACE_ALU_P (CPU)) { \
+ trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
+ itable[indx].line_nr, "alu", \
+ tic80_trace_cmp (indx, result, input1, input2)); \
+ } \
+} while (0)
+
#define TRACE_ALU2(indx, result, input) \
do { \
if (TRACE_ALU_P (CPU)) { \
} \
} while (0)
+#define TRACE_FPU2CMP(result, input1, input2) \
+do { \
+ if (TRACE_FPU_P (CPU)) { \
+ tic80_trace_fpu2cmp (SD, CPU, cia, MY_INDEX, \
+ result, input1, input2); \
+ } \
+} while (0)
+
#define TRACE_NOP(indx) \
do { \
if (TRACE_ALU_P (CPU)) { \
(signed16)source2, (unsigned16)source2) << 10;
field |= cmp_vals (_SD, (signed8)source1, (unsigned8)source1,
(signed8)source2, (unsigned8)source2);
- TRACE_ALU3 (MY_INDEX, field, source1, source2);
+ TRACE_CMP (MY_INDEX, field, source1, source2);
*rDest = field;
31.Dest,26.Source2,21.0b1010000,14.SignedImmediate::::cmp i
"cmp <SignedImmediate>, r<Source2>, r<Dest>"
|| sim_fpu_is_ge (&s1, &s2)) result |= BIT32(29);
}
*rDest = result;
- TRACE_FPU2I (result, s1, s2);
+ TRACE_FPU2CMP (result, s1, s2);
31.Dest,26.Source2,21.0b111110101,12.0,11./,10.0,8.P2,6.P1,4.Source1::f::fcmp r
"fcmp.%s<PX#P1>%s<PX#P2> r<Source1>, r<Source2>, r<Dest>"
do_fcmp (_SD, rDest,
/* TIc80 Simulator.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
tic80_size_name = max_len + sizeof(":m") - 1 + sizeof (":s") - 1;
}
+/* Given an integer which is the result of a comparison, return a string
+ giving which bits are set. */
+
+static char *
+tic80_trace_cmp_internal (unsigned32 flag)
+{
+ struct cmp_bits { unsigned32 bit; char *string; };
+ static char buffer[32*8];
+ static struct cmp_bits bits[] =
+ {
+ { BIT32(29), "hs" },
+ { BIT32(28), "lo" },
+ { BIT32(27), "ls" },
+ { BIT32(26), "hi" },
+ { BIT32(25), "ge" },
+ { BIT32(24), "lt" },
+ { BIT32(23), "le" },
+ { BIT32(22), "gt" },
+ { BIT32(21), "ne" },
+ { BIT32(20), "eq" },
+
+ { BIT32(19), "hs.h" },
+ { BIT32(18), "lo.h" },
+ { BIT32(17), "ls.h" },
+ { BIT32(16), "hi.h" },
+ { BIT32(15), "ge.h" },
+ { BIT32(14), "lt.h" },
+ { BIT32(13), "le.h" },
+ { BIT32(12), "gt.h" },
+ { BIT32(11), "ne.h" },
+ { BIT32(10), "eq.h" },
+
+ { BIT32( 9), "hs.b" },
+ { BIT32( 8), "lo.b" },
+ { BIT32( 7), "ls.b" },
+ { BIT32( 6), "hi.b" },
+ { BIT32( 5), "ge.b" },
+ { BIT32( 4), "lt.b" },
+ { BIT32( 3), "le.b" },
+ { BIT32( 2), "gt.b" },
+ { BIT32( 1), "ne.b" },
+ { BIT32( 0), "eq.b" },
+ { 0, (char *)0 },
+ };
+
+ int i;
+ char *p = buffer;
+
+ for (i = 0; bits[i].bit != 0; i++)
+ {
+ if ((flag & bits[i].bit) != 0)
+ {
+ if (p != buffer)
+ *p++ = ' ';
+
+ strcpy (p, bits[i].string);
+ p += strlen (p);
+ }
+ }
+
+ *p = '\0';
+ return buffer;
+}
+
/* Trace the result of an ALU operation with 2 integer inputs and an integer output */
char *
tic80_trace_alu3 (int indx,
return tic80_trace_buffer;
}
+/* Trace the result of an ALU operation with 2 integer inputs and an integer output
+ that sets the bits from a compare instruction. */
+char *
+tic80_trace_cmp (int indx,
+ unsigned32 result,
+ unsigned32 input1,
+ unsigned32 input2)
+{
+ if (!tic80_size_name)
+ tic80_init_trace ();
+
+ sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx %s",
+ tic80_size_name, itable[indx].name,
+ SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
+ SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
+ SIZE_HEX, result, tic80_trace_cmp_internal (result));
+
+ return tic80_trace_buffer;
+}
+
/* Trace the result of an ALU operation with 1 integer input and an integer output */
char *
tic80_trace_alu2 (int indx,
SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
return tic80_trace_buffer;
-}
+}
/* Trace the result of an FPU operation with 2 floating point inputs and a floating point output */
void
SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (&result));
}
-/* Trace the result of an FPU operation with 1 integer input and an integer output */
+/* Trace the result of an FPU operation with 2 floating point inputs and an integer output */
void
tic80_trace_fpu2i (SIM_DESC sd,
sim_cpu *cpu,
SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
}
+/* Trace the result of an FPU operation with 2 floating point inputs and an integer output
+ that is the result of a comparison. */
+void
+tic80_trace_fpu2cmp (SIM_DESC sd,
+ sim_cpu *cpu,
+ sim_cia cia,
+ int indx,
+ unsigned32 result,
+ sim_fpu input1,
+ sim_fpu input2)
+{
+ if (!tic80_size_name)
+ tic80_init_trace ();
+
+ trace_one_insn (sd, cpu, cia.ip, 1,
+ itable[indx].file, itable[indx].line_nr, "fpu",
+ "%-*s %*f %*f => 0x%.*lx %s",
+ tic80_size_name, itable[indx].name,
+ SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (&input1),
+ SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (&input2),
+ SIZE_HEX, result, tic80_trace_cmp_internal (result));
+}
+
/* Trace the result of a NOP operation */
char *
tic80_trace_nop (int indx)
SIZE_HEX, target, SIZE_DECIMAL, "",
SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond);
- return tic80_trace_buffer;
+ return tic80_trace_buffer;
}
/* Trace the result of a unconditional branch operation */
SIZE_HEX, target, (SIZE_DECIMAL*2) + SIZE_HEX + 4, "",
SIZE_HEX, target);
- return tic80_trace_buffer;
+ return tic80_trace_buffer;
}
/* Trace the result of a load or store operation with 2 integer addresses