#137828 - simonjhall - Thu Aug 16, 2007 12:01 pm
To cut the story short, the idea of N64 emulation on the DS has been gnawing away at me for many months now and I’d just like to sound out some ideas with you guys, basically so you can talk me out of it! I really would like to write a dynamically-recompiling emulator though, since the last emulator I wrote was for work and the focus was not on speed but on ease-of-development (eg it allowed you to run emulated code backwards etc).
Anyway, my concerns re: N64 emulation on the DS and some thoughts
1) There’s a fat MHz deficit. Emulating a cheap 93MHz processor with a cheap 66MHz part from a different architecture is never going to yield full-speed emulation even if there was no overheard incurred by the emulation (ie a 1:1 mapping from MIPS to ARM instructions and no cost associated with the translation). I do realise that there’s a second processor in the DS but you can’t just push them together and treat them as a single 99MHz processor!
2) There’s a floating-point unit in the N64, and there’s no such thing in the DS. Floating-point emulation with integers isn’t going to give good speed.
3) The N64 has 250MHz DDR memory, accessed over an 8-bit bus. That sounds like 500 MB/s to me and I’ve never got bandwidth like that out of the DS! However I doubt there are memory accesses every clock cycle and I’m sure a good chunk of that would be taken by rendering (eg framebuffer, texture reads etc) and that wouldn’t be so necessary on the DS due to the 3D hardware. Also if the PSP can emulate an N64 then I’m not so worried about the memory bandwidth being such an issue.
4) I seem to remember that the MIPS architecture sports 32 registers (or is it 16?), if so there’s definitely no chance of doing a simple translation of MIPS to ARM since there are only 16 (really 15 + $pc) registers available in ARM mode. This would mean that some kind of register allocation system would be needed (more overhead) and since the N64’s main CPU is a 64-bit processor I’d guess that its registers are 64-bits wide too. Since ARM registers are 32-bits wide two registers would be needed to represent a since N64 register in a recompiling system. Plus additional instructions (and temporary registers too?) would be needed to perform these 64-bit calculations and stitch the results together. More overhead.
5) I don’t see the amount of memory available being a problem, assuming the use of a slot-2 card. It’s a shame that the 4MB of main memory can’t fit wholly within the DS internal memory (well you technically could…) but I suppose parts of the memory could be switched in an out.
6) The RCP is an interesting one, since I’ve read that it’s a vector processor and emulating this would be a right pain on the DS. However if it’s used just for graphics then hopefully it could just be handle by the 2D/3D hardware.
7) There’s the legal angle – I’m scared by what happened with UltraHLE and if that were to happen again there would be no chance I’d even consider writing/releasing it.
But…it does sound like a fun project.
Thoughts?
PS: non-techy people could we refrain from “OMG N64 would be sooooo cool! Please write it! I’ll love you!”
_________________
Big thanks to everyone who donated for Quake2
Anyway, my concerns re: N64 emulation on the DS and some thoughts
1) There’s a fat MHz deficit. Emulating a cheap 93MHz processor with a cheap 66MHz part from a different architecture is never going to yield full-speed emulation even if there was no overheard incurred by the emulation (ie a 1:1 mapping from MIPS to ARM instructions and no cost associated with the translation). I do realise that there’s a second processor in the DS but you can’t just push them together and treat them as a single 99MHz processor!
2) There’s a floating-point unit in the N64, and there’s no such thing in the DS. Floating-point emulation with integers isn’t going to give good speed.
3) The N64 has 250MHz DDR memory, accessed over an 8-bit bus. That sounds like 500 MB/s to me and I’ve never got bandwidth like that out of the DS! However I doubt there are memory accesses every clock cycle and I’m sure a good chunk of that would be taken by rendering (eg framebuffer, texture reads etc) and that wouldn’t be so necessary on the DS due to the 3D hardware. Also if the PSP can emulate an N64 then I’m not so worried about the memory bandwidth being such an issue.
4) I seem to remember that the MIPS architecture sports 32 registers (or is it 16?), if so there’s definitely no chance of doing a simple translation of MIPS to ARM since there are only 16 (really 15 + $pc) registers available in ARM mode. This would mean that some kind of register allocation system would be needed (more overhead) and since the N64’s main CPU is a 64-bit processor I’d guess that its registers are 64-bits wide too. Since ARM registers are 32-bits wide two registers would be needed to represent a since N64 register in a recompiling system. Plus additional instructions (and temporary registers too?) would be needed to perform these 64-bit calculations and stitch the results together. More overhead.
5) I don’t see the amount of memory available being a problem, assuming the use of a slot-2 card. It’s a shame that the 4MB of main memory can’t fit wholly within the DS internal memory (well you technically could…) but I suppose parts of the memory could be switched in an out.
6) The RCP is an interesting one, since I’ve read that it’s a vector processor and emulating this would be a right pain on the DS. However if it’s used just for graphics then hopefully it could just be handle by the 2D/3D hardware.
7) There’s the legal angle – I’m scared by what happened with UltraHLE and if that were to happen again there would be no chance I’d even consider writing/releasing it.
But…it does sound like a fun project.
Thoughts?
PS: non-techy people could we refrain from “OMG N64 would be sooooo cool! Please write it! I’ll love you!”
_________________
Big thanks to everyone who donated for Quake2