diff options
Diffstat (limited to 'sim')
-rw-r--r-- | sim/ChangeLog | 4 | ||||
-rw-r--r-- | sim/ft32/interp.c | 22 |
2 files changed, 19 insertions, 7 deletions
diff --git a/sim/ChangeLog b/sim/ChangeLog index c39cf2d..3c1a351 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,7 @@ +2017-11-01 James Bowman <james.bowman@ftdichip.com> + + * ft32/interp.c (step_once): Add ft32 shortcode decoder. + 2017-10-12 James Bowman <james.bowman@ftdichip.com> * ft32/interp.c (step_once): Replace FT32_FLD_K8 with K15. diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c index 3bc08ee..d73d4d0 100644 --- a/sim/ft32/interp.c +++ b/sim/ft32/interp.c @@ -340,16 +340,24 @@ step_once (SIM_DESC sd) uint32_t bit_len; uint32_t upper; uint32_t insnpc; + unsigned int sc[2]; + int isize; - if (cpu->state.cycles >= cpu->state.next_tick_cycle) - { - cpu->state.next_tick_cycle += 100000; - ft32_push (sd, cpu->state.pc); - cpu->state.pc = 12; /* interrupt 1. */ - } inst = ft32_read_item (sd, 2, cpu->state.pc); cpu->state.cycles += 1; + if ((STATE_ARCHITECTURE (sd)->mach == bfd_mach_ft32b) + && ft32_decode_shortcode (cpu->state.pc, inst, sc)) + { + if ((cpu->state.pc & 3) == 0) + inst = sc[0]; + else + inst = sc[1]; + isize = 2; + } + else + isize = 4; + /* Handle "call 8" (which is FT32's "break" equivalent) here. */ if (inst == 0x00340002) { @@ -390,7 +398,7 @@ step_once (SIM_DESC sd) upper = (inst >> 27); insnpc = cpu->state.pc; - cpu->state.pc += 4; + cpu->state.pc += isize; switch (upper) { case FT32_PAT_TOC: |