In terms of instruction set and simplicity of emulation. I would like to implement a virtual CPU and figured why not emulate an existing one, so to be able to compile C code to it.
7 Answers
Moxie is a great target because it was designed specifically to be an ideal target for GCC. I am the author and would be happy to answer any questions. green at moxielogic dot com
-
Is there reference documentation about the architecture and instructions set? Feb 2, 2011 at 14:48
-
What there is exists at moxielogic.org/wiki ... although it will take me a bit to undo damage from the wiki vandals. Check back soon. Feb 2, 2011 at 17:11
-
Can Moxie architecture be used in a closed source commercial project (think inclusion of it's emulator in a video game)? On your site I didn't find a license that clearly specifies that.– ezolotkoJan 4, 2016 at 22:31
-
1Hi @ezolotko. Thanks for asking. The answer is, in general, yes. I'll try to update the docs/website soon, but please contact me directly at green AT moxielogic.com. Thanks again. Jan 6, 2016 at 3:10
This probably isn't an uncommon question; I'd hope that most CPU/machine simulation toolkits would include a simple example implementation, but some don't.
I haven't worked with it, but Knuth's MMIX architecture (wikipedia) looks interesting. Like Moxie, it was created to "illustrate machine-level aspects of programming" and is simpler than real machines. It's supported by GCC and there appear to be multiple existing simulators that could be used as a reference in your efforts.
MIPS I (one of the targets of GCC) is a surprisingly easy-to-emulate 32-bit platform. Here is an short and simple emulator which can load and run a statically linked Linux MIPS I executable: https://github.com/pts/pts-mips-emulator