[FT32] sim: correct simulation of MEMCPY and MEMSET
Commit Message
The MEMCPY and MEMSET instructions should only examine the low 15 bits of
their length arguments.
OK to apply?
[sim/ft32]
2015-09-28 James Bowman <james.bowman@ftdichip.com>
* interp.c (step_once): correct length for MEMSET and MEMCPY
instructions.
Comments
On 29 Sep 2015 23:47, James Bowman wrote:
> The MEMCPY and MEMSET instructions should only examine the low 15 bits of
> their length arguments.
pushed, thanks !
btw you should really be adding test cases for these fixes ...
-mike
@@ -598,7 +598,7 @@ step_once (SIM_DESC sd)
uint32_t src = r_1v;
uint32_t dst = cpu->state.regs[r_d];
uint32_t i;
- for (i = 0; i < rimmv; i++)
+ for (i = 0; i < (rimmv & 0x7fff); i++)
PUT_BYTE (dst + i, GET_BYTE (src + i));
}
break;
@@ -617,7 +617,7 @@ step_once (SIM_DESC sd)
/* memset instruction. */
uint32_t dst = cpu->state.regs[r_d];
uint32_t i;
- for (i = 0; i < rimmv; i++)
+ for (i = 0; i < (rimmv & 0x7fff); i++)
PUT_BYTE (dst + i, r_1v);
}
break;