#ifdef WATCHFUNCTIONS
 
 #define MAXWL 80
-word WL[MAXWL];
+int32_t WL[MAXWL];
 char * WLstr[MAXWL];
 
 int ENDWL=0;
 int WLcnts[MAXWL];
 int WLmax[MAXWL];
 int WLmin[MAXWL];
-word WLendpc;
+int32_t WLendpc;
 int WLbcyc;
 int WLW;
 #endif
 {
   struct mcore_sim_cpu *mcore_cpu = MCORE_SIM_CPU (cpu);
   int needfetch;
-  word ibuf;
-  word pc;
+  int32_t ibuf;
+  int32_t pc;
   unsigned short inst;
   int memops;
   int bonus_cycles;
   int w;
   int cycs;
 #ifdef WATCHFUNCTIONS
-  word WLhash;
+  int32_t WLhash;
 #endif
 
   pc = CPU_PC_GET (cpu);
 
   /* TODO: Unindent this block.  */
     {
-      word oldpc;
+      int32_t oldpc;
 
       insts ++;
 
 #endif
 
       if (tracing)
-       fprintf (stderr, "%.4lx: inst = %.4x ", pc, inst);
+       fprintf (stderr, "%.4x: inst = %.4x ", pc, inst);
 
       oldpc = pc;
 
              break;
            case 0x4:                                   /* ldq */
              {
-               word addr = gr[RD];
+               int32_t addr = gr[RD];
                int regno = 4;                  /* always r4-r7 */
 
                bonus_cycles++;
              break;
            case 0x5:                                   /* stq */
              {
-               word addr = gr[RD];
+               int32_t addr = gr[RD];
                int regno = 4;                  /* always r4-r7 */
 
                memops += 4;
              break;
            case 0x6:                                   /* ldm */
              {
-               word addr = gr[0];
+               int32_t addr = gr[0];
                int regno = RD;
 
                /* bonus cycle is really only needed if
              break;
            case 0x7:                                   /* stm */
              {
-               word addr = gr[0];
+               int32_t addr = gr[0];
                int regno = RD;
 
                /* this should be removed! */
            case 0xC:                                   /* jmp */
              pc = gr[RD];
              if (tracing && RD == 15)
-               fprintf (stderr, "Func return, r2 = %lxx, r3 = %lx\n",
+               fprintf (stderr, "Func return, r2 = %xx, r3 = %x\n",
                         gr[2], gr[3]);
              bonus_cycles++;
              needfetch = 1;
              break;
            case 0xE:                                   /* ff1 */
              {
-               word tmp, i;
+               int32_t tmp, i;
                tmp = gr[RD];
                for (i = 0; !(tmp & 0x80000000) && i < 32; i++)
                  tmp <<= 1;
              break;
            case 0xF:                                   /* brev */
              {
-               word tmp;
+               int32_t tmp;
                tmp = gr[RD];
                tmp = ((tmp & 0xaaaaaaaa) >>  1) | ((tmp & 0x55555555) <<  1);
                tmp = ((tmp & 0xcccccccc) >>  2) | ((tmp & 0x33333333) <<  2);
              break;
            case 0x9:                                   /* tstnbz */
              {
-               word tmp = gr[RD];
+               int32_t tmp = gr[RD];
                NEW_C ((tmp & 0xFF000000) != 0 &&
                       (tmp & 0x00FF0000) != 0 && (tmp & 0x0000FF00) != 0 &&
                       (tmp & 0x000000FF) != 0);
          }
          bonus_cycles += 2;  /* min. is 3, so add 2, plus ticks above */
          if (tracing)
-           fprintf (stderr, "  mult %lx by %lx to give %lx",
+           fprintf (stderr, "  mult %x by %x to give %x",
                     gr[RD], gr[RS], gr[RD] * gr[RS]);
          gr[RD] = gr[RD] * gr[RS];
          break;
        case 0x12:                                      /* mov */
          gr[RD] = gr[RS];
          if (tracing)
-           fprintf (stderr, "MOV %lx into reg %d", gr[RD], RD);
+           fprintf (stderr, "MOV %x into reg %d", gr[RD], RD);
          break;
 
        case 0x13:                                      /* bgenr */
                exe = 0;
 
                /* unsigned divide */
-               gr[RD] = (word) ((unsigned int) gr[RD] / (unsigned int)gr[1] );
+               gr[RD] = (int32_t) ((unsigned int) gr[RD] / (unsigned int)gr[1] );
 
                /* compute bonus_cycles for divu */
                for (r1nlz = 0; ((r1 & 0x80000000) == 0) && (r1nlz < 32); r1nlz ++)
            unsigned long tmp = gr[RD];
            if (imm == 0)
              {
-               word cbit;
+               int32_t cbit;
                cbit = C_VALUE();
                NEW_C (tmp);
                gr[RD] = (cbit << 31) | (tmp >> 1);
        case 0x7C: case 0x7D: case 0x7E:                /* lrw */
          gr[RX] =  rlat ((pc + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
          if (tracing)
-           fprintf (stderr, "LRW of 0x%x from 0x%lx to reg %d",
+           fprintf (stderr, "LRW of 0x%x from 0x%x to reg %d",
                     rlat ((pc + ((inst & 0xFF) << 2)) & 0xFFFFFFFC),
                     (pc + ((inst & 0xFF) << 2)) & 0xFFFFFFFC, RX);
          memops++;
          gr[15] = pc;
          if (tracing)
            fprintf (stderr,
-                    "func call: r2 = %lx r3 = %lx r4 = %lx r5 = %lx r6 = %lx r7 = %lx\n",
+                    "func call: r2 = %x r3 = %x r4 = %x r5 = %x r6 = %x r7 = %x\n",
                     gr[2], gr[3], gr[4], gr[5], gr[6], gr[7]);
        case 0x70:                                      /* jmpi */
          pc = rlat ((pc + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
        case 0x8C: case 0x8D: case 0x8E: case 0x8F:     /* ld */
          gr[RX] = rlat (gr[RD] + ((inst >> 2) & 0x003C));
          if (tracing)
-           fprintf (stderr, "load reg %d from 0x%lx with 0x%lx",
+           fprintf (stderr, "load reg %d from 0x%x with 0x%x",
                     RX,
                     gr[RD] + ((inst >> 2) & 0x003C), gr[RX]);
          memops++;
        case 0x9C: case 0x9D: case 0x9E: case 0x9F:     /* st */
          wlat (gr[RD] + ((inst >> 2) & 0x003C), gr[RX]);
          if (tracing)
-           fprintf (stderr, "store reg %d (containing 0x%lx) to 0x%lx",
+           fprintf (stderr, "store reg %d (containing 0x%x) to 0x%x",
                     RX, gr[RX],
                     gr[RD] + ((inst >> 2) & 0x003C));
          memops++;
     }
 
   /* Claim some memory for the pointers and strings. */
-  pointers = hi_stack - sizeof(word) * (nenv+1+nargs+1);
+  pointers = hi_stack - sizeof(int32_t) * (nenv+1+nargs+1);
   pointers &= ~3;              /* must be 4-byte aligned */
   gr[0] = pointers;
 
 
 #define SIM_MAIN_H
 
 #include "sim-basics.h"
-
-typedef long int           word;
-
 #include "sim-base.h"
 #include "bfd.h"
 
    gdb/config/mcore/tm-mcore.h file in the REGISTER_NAMES macro.  */
 struct mcore_regset
 {
-  word gregs[16];      /* primary registers */
-  word alt_gregs[16];  /* alt register file */
-  word cregs[32];      /* control registers */
-  word pc;
+  int32_t gregs[16];           /* primary registers */
+  int32_t alt_gregs[16];       /* alt register file */
+  int32_t cregs[32];           /* control registers */
+  int32_t pc;
 };
 #define LAST_VALID_CREG        32              /* only 0..12 implemented */
 #define NUM_MCORE_REGS (16 + 16 + LAST_VALID_CREG + 1)
   {
     struct mcore_regset regs;
     /* Used by the fetch/store reg helpers to access registers linearly.  */
-    word asints[NUM_MCORE_REGS];
+    int32_t asints[NUM_MCORE_REGS];
   };
 
   /* Used to switch between gregs/alt_gregs based on the control state.  */
-  word *active_gregs;
+  int32_t *active_gregs;
 
   int ticks;
   int stalls;