+#define sim_core_write_misaligned_N XCONCAT2(sim_core_write_misaligned_,N)
+#define sim_core_trace_M XCONCAT2(sim_core_trace_,M)
+#define sim_core_dummy_M XCONCAT2(sim_core_dummy_,M)
+
+
+#if (M == N && N > 1)
+/* dummy variable used as a return value when nothing else is
+ available and the compiler is complaining */
+static unsigned_M sim_core_dummy_M;
+#endif
+
+
+/* TAGS: sim_core_trace_1 sim_core_trace_2 */
+/* TAGS: sim_core_trace_4 sim_core_trace_8 */
+/* TAGS: sim_core_trace_16 */
+
+#if (M == N)
+STATIC_SIM_CORE(void)
+sim_core_trace_M (sim_cpu *cpu,
+ sim_cia cia,
+ int line_nr,
+ transfer_type type,
+ unsigned map,
+ address_word addr,
+ unsigned_M val,
+ int nr_bytes)
+{
+ const char *transfer = (type == read_transfer ? "read" : "write");
+ const char *direction = (type == read_transfer ? "->" : "<-");
+
+ if (TRACE_DEBUG_P (cpu))
+ trace_printf (CPU_STATE (cpu), cpu, "sim-n-core.h:%d: ", line_nr);
+
+#if (M == 16)
+ trace_printf (CPU_STATE (cpu), cpu,
+ "%s-%d %s:0x%08lx %s 0x%08lx%08lx%08lx%08lx\n",
+ transfer, nr_bytes,
+ map_to_str (map),
+ (unsigned long) addr,
+ direction,
+ (unsigned long) V4_16 (val, 0),
+ (unsigned long) V4_16 (val, 1),
+ (unsigned long) V4_16 (val, 2),
+ (unsigned long) V4_16 (val, 3));
+#endif
+#if (M == 8)
+ trace_printf (CPU_STATE (cpu), cpu,
+ "%s-%d %s:0x%08lx %s 0x%08lx%08lx\n",
+ transfer, nr_bytes,
+ map_to_str (map),
+ (unsigned long) addr,
+ direction,
+ (unsigned long) V4_8 (val, 0),
+ (unsigned long) V4_8 (val, 1));
+#endif
+#if (M == 4)
+ trace_printf (CPU_STATE (cpu), cpu,
+ "%s-%d %s:0x%08lx %s 0x%08lx\n",
+ transfer,
+ nr_bytes,
+ map_to_str (map),
+ (unsigned long) addr,
+ direction,
+ (unsigned long) val);
+#endif
+#if (M == 2)
+ trace_printf (CPU_STATE (cpu), cpu,
+ "%s-%d %s:0x%08lx %s 0x%04lx\n",
+ transfer,
+ nr_bytes,
+ map_to_str (map),
+ (unsigned long) addr,
+ direction,
+ (unsigned long) val);
+#endif
+#if (M == 1)
+ trace_printf (CPU_STATE (cpu), cpu,
+ "%s-%d %s:0x%08lx %s 0x%02lx\n",
+ transfer,
+ nr_bytes,
+ map_to_str (map),
+ (unsigned long) addr,
+ direction,
+ (unsigned long) val);
+#endif
+}
+#endif
+