X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fft32%2Finterp.c;h=d9ff14babb7c7dfdf7ecea306b12074ab72c736c;hb=a1d1fa3e417b4bd8e79e2a731f9c6089e2d5f747;hp=3bc08ee2e49f7f940199f939a794182246907449;hpb=3b4b0a629a972bf80fc0ac6202f89681fab1df37;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c index 3bc08ee2e4..d9ff14babb 100644 --- a/sim/ft32/interp.c +++ b/sim/ft32/interp.c @@ -1,6 +1,6 @@ /* Simulator for the FT32 processor - Copyright (C) 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2008-2020 Free Software Foundation, Inc. Contributed by FTDI This file is part of simulators. @@ -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: