问题
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.
回答1:
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
回答2:
GCC supports Moxie (originally ggx), a little architecture invented by Anthony Green for experimentation.
You, too, can follow the steps he took to invent your own small simple CPU and port GCC to it.
回答3:
ZPU (an FPGA targeted 32bit processor) is very small.
回答4:
Possibly the AVR ATTiny45 or similar AVR chip.
回答5:
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.
回答6:
Maybe something from the Ti MSP430 series.
回答7:
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
来源:https://stackoverflow.com/questions/4817950/what-is-the-smallest-simplest-cpu-that-gcc-can-compile-for