whartung wrote:
BitWise wrote:
6502 is easy. Getting the 65C816s emulation/native mode and 8/16 size changes correct and working efficiently is more of a challenge.
The first cut of my emulator was far too slow so I'm rewriting it. It doesn't help that the default optimisation setting for the Arduino code framework is for 'space' (-Os) rather than 'speed' (-O3).
How was it far too slow? What kind of changes are you doing to make it faster?
I'm not concerned with raw performance right now, but I'm just curious.
I was getting around 2Mhz initially. I had to edit the code generation settings to enable more optimisation and increase the speed to 2.5Mhz but I think that is still poor. Xtensa assembly code is hard to read and I could not determine how efficiently it had implemented the main opcode switch.
The processor has a few peculiarities I'm not familiar with. The clock speed is 240MHz but the flash is only rated for 80Mhz so that explains some of slow down. My memory mapping scheme takes 8-10 instructions per byte access but handles RAM and ROM uniformly so I think I'll leave that alone in the next version. I have enough RAM that I can probably move some of the opcode functions into it which I believe will make them run at the full 240MHz
in the new version I'm implementing opcode execution using structure containing an array of pointers to functions. There are 5 such structures, one for each CPU state much like lib65c816.