Tuesday, May 11, 2010

initial release

Created a home for this code at github




This is a thumb (16 bit ARM) instruction set simulator. Written primarily for my experiments and for anyone wanting to learn the instruction set but not having to read schematics or get many registers set right to blink your first led or turn a pixel on on a display. I started cleaning up the armulator from ARM (wanted to remove the if-then-elses and target specific stuff and make it a clean, simple, core) but got frustrated with it, I probably broke it so I wrote my own.

The single file thumbulator.c is the instruction set simulator (ISS), the other directories are test programs and/or examples depending on how you want to look at it.

It boots similar, well the same as a cortex-m3 where the exception vector table is addresses to code instead of code like you have with an ARM based core. The thumbulator does not support thumb2 instructions at this time.

There are virtually no peripherals, one uart part for TX only (prints the character to the console). A port that prints the 32 bit value written to the console, and a port to halt the processor. Adding your own peripherals is easy.

Not necessarily cycle accurate to any real ARM core, is designed around a 16 bit data bus model similar to running on a GBA, and instruction fetches and reads and writes to memory are counted and displayed when you finish. One main reason for this program was to use it to compare the output of various compilers.

No guarantees to be bug free, the tests I have thrown at it so far are both special purpose and real world applications. And so far I have cleaned up the instructions, I have not checked code coverage to see if every instruction has been hit. If you happen to try it, and happen to find something please let me know. Beware though the compilers and the code out there can be evil, I found an llvm bug already, one or two of the examples I used mismanaged their integer lengths and I used to like to use zlib, but its integer lengths are chaotic and it has become useless without a lot of rework.