Will it be possible to run C code emulated on GA144?
This company have an interesting 开发者_StackOverflow中文版CPU that run at an amazing speed. Will it be possible to emulate C or is the memory too small?
There is C translator for SEAforth40 chip (previous version of GA144 chip)
Presentation: http://www.asu.ru/files/documents/00002990.pdf
A first cursory glance at the instruction set suggests that "colorForth" can be thought of as a simple machine language. Given that, it may be possible to write a C compiler that compiles to colorForth as its target instruction set.
Of course, it may be easier to write code in colorForth in the first place.
From the looks of it, if someone writes a compiler which can output the machine code (33 instructions, not too complex), you won't need to emulate C, you could just directly compile it.
Of course, it would be extremely limited, since it looks like each chip gets a tiny amount of internal RAM (64 words isn't a lot to work with). There's an 18-bit memory address port attached to one of the cores, so you can have 256MB of external RAM, but it can only be directly accessed by a single one of the cores, and then it would need to be passed to the other.
It's possible that different cores could be used for different functions, but that would complicate the compiler quite a bit.
It could be done, but their interpreter should handle parallel tasks, load distribution, etc. It will probability be best to just go with their Forth interpreter.
Chlorophyll has some ideas of general interest. I also happens to look similar to C:
We developed Chlorophyll, a synthesis-aided programming model and compiler for the GreenArrays GA144, an extremely minimalist low-power spatial architecture that requires partitioning the program into fragments of no more than 256 instructions and 64 words of data. This processor is 100-times more energy efficient than its competitors, but currently can only be programmed using a low-level stack-based language. The Chlorophyll programming model allows programmers to provide human insight by specifying partial partitioning of data and computation. The Chlorophyll compiler relies on synthesis, sidestepping the need to develop classical optimizations, which may be challenging given the unusual architecture. To scale synthesis to real problems, we decompose the compilation into smaller synthesis subproblems—partitioning, layout, and code generation. We show that the synthesized programs are no more than 65% slower than highly optimized expert-written programs and are faster than programs produced by a heuristic, non-synthesizing version of our compiler.
http://www.eecs.berkeley.edu/~mangpo/www/talks/1311_forthday_handout.pdf
http://www.eecs.berkeley.edu/~nishant/papers/Chlorophyll.pdf
You would need to use external memory, but apart from that, it is certainly doable, according to this white paper by Greg Bailey:
It would not be difficult to build a virtual machine supporting C, and there are many people and companies in the US alone for whom building such a machine and completing a “port” of the C language compiler and library to the virtual machine would be simply a repetition of something they had done before. Once this has been done, the GreenArray chip can run any C program which fits in the external memory and will satisfy any C application requirement that is met by the resulting execution speed.
-- excerpt from page 4
He also discuss their implementation of a eForth virtual machine in that paper.
精彩评论