GCC 可以编译的最小、最简单的 CPU 是什么?
在指令集和仿真的简单性方面。我想实现一个虚拟 CPU,并想为什么不模拟现有的 CPU,以便能够将 C 代码编译到它。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Moxie 是一个很好的目标,因为它是专门为 GCC 的理想目标而设计的。我是作者,很乐意回答任何问题。 moxielogic dot com 呈绿色
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
GCC 支持 Moxie (最初是 ggx),安东尼·格林发明的一个用于实验的小架构。
您也可以按照他的步骤发明您自己的小型简单 CPU 并将 GCC 移植到其中。
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.
ZPU(面向 FPGA 的 32 位处理器)非常小。
ZPU (an FPGA targeted 32bit processor) is very small.
可能是 AVR ATTiny45 或类似的 AVR 芯片。
Possibly the AVR ATTiny45 or similar AVR chip.
这可能不是一个罕见的问题;我希望大多数 CPU/机器仿真工具包都包含一个简单的示例实现,但有些则不然。
我还没有使用过它,但是 Knuth 的 MMIX 架构(维基百科) 看起来很有趣。与 Moxie 一样,它的创建是为了“说明编程的机器级方面”,并且比真实机器更简单。它由 GCC 支持,并且似乎有多个现有模拟器可以用作您的工作参考。
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.
也许来自 Ti MSP430 系列。
Maybe something from the Ti MSP430 series.
MIPS I(GCC 的目标之一)是一个非常容易模拟的 32 位平台。这是一个简短的模拟器,可以加载并运行静态链接的 Linux MIPS I 可执行文件: https: //github.com/pts/pts-mips-emulator
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