Add support for two new moxie sign-extension instructions
authorAnthony Green <green@moxielogic.com>
Thu, 3 Apr 2014 03:55:57 +0000 (23:55 -0400)
committerAnthony Green <green@moxielogic.com>
Thu, 3 Apr 2014 03:58:01 +0000 (23:58 -0400)
sim/moxie/ChangeLog
sim/moxie/interp.c

index 691d41ad7df733cf128307d804662c28eb1aaf4a..2831c9401970c644f3e3537e303c47949274b37c 100644 (file)
@@ -1,3 +1,7 @@
+2014-04-02  Anthony Green  <green@moxielogic.com>
+
+       * interp.c (sim_resume): Add new sign-extend instructions.
+
 2014-03-10  Mike Frysinger  <vapier@gentoo.org>
 
        * interp.c (sim_do_command): Add const to cmd.
index a3f238a00669b2e93ce071a6da976a04459d694a..4362c66bb5492d0eacf7f16d246198c623f36f8c 100644 (file)
@@ -586,8 +586,24 @@ sim_resume (sd, step, siggnal)
              break;
            case 0x0f: /* nop */
              break;
-           case 0x10: /* bad */
-           case 0x11: /* bad */
+           case 0x10: /* sex.b */
+             {
+               int a = (inst >> 4) & 0xf;
+               int b = inst & 0xf;
+               signed char bv = cpu.asregs.regs[b];
+               TRACE("sex.b");
+               cpu.asregs.regs[a] = (int) bv;
+             }
+             break;
+           case 0x11: /* sex.s */
+             {
+               int a = (inst >> 4) & 0xf;
+               int b = inst & 0xf;
+               signed short bv = cpu.asregs.regs[b];
+               TRACE("sex.s");
+               cpu.asregs.regs[a] = (int) bv;
+             }
+             break;
            case 0x12: /* bad */
            case 0x13: /* bad */
            case 0x14: /* bad */