What is the smallest, simplest CPU that GCC can compile for?

Deadly 提交于 2019-12-12 07:44:35

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!