sim: ft32: correctly simulate PM write port
authorJames Bowman <james.bowman@ftdichip.com>
Mon, 28 Sep 2015 23:49:36 +0000 (23:49 +0000)
committerMike Frysinger <vapier@gentoo.org>
Wed, 30 Sep 2015 03:36:56 +0000 (23:36 -0400)
The FT32 simulator was not correctly simulating the behavior of the
program memory (PM) write port.  When it is locked, writes to the
data register do nothing.

sim/ft32/ChangeLog
sim/ft32/interp.c

index 29f661fca23bed7b972b7720d25e07cfbff06edf..47218b4e65203ba78353be2b1eab4af488f7fa8a 100644 (file)
@@ -1,3 +1,7 @@
+2015-09-29  James Bowman  <james.bowman@ftdichip.com>
+
+       * interp.c (cpu_mem_write): Do no write PM when locked.
+
 2015-09-22  James Bowman  <james.bowman@ftdichip.com>
 
        * ft32/interp.c (cpu_mem_read): Call getchar when ea is 0x10000.
index a20907c5c86aee28df4601854bd46fdce44166c4..c769ff7a3be8651f315a30a1e8b09422f8f0d557 100644 (file)
@@ -205,8 +205,12 @@ static void cpu_mem_write (SIM_DESC sd, uint32_t dw, uint32_t ea, uint32_t d)
          cpu->state.pm_addr = d;
          break;
        case 0x1fc88:
-         /* Write to PM */
-         ft32_write_item (sd, dw, cpu->state.pm_addr, d);
+         if (cpu->state.pm_unlock)
+           {
+             /* Write to PM.  */
+             ft32_write_item (sd, dw, cpu->state.pm_addr, d);
+             cpu->state.pm_addr += 4;
+           }
          break;
        case 0x1fffc:
          /* Normal exit.  */