Tiny mips 4kc emulator (smallest and easiest emulator to hack on that I know of - It boots linux in a few thousands lines of C code.) I wrote this emulator in the month or so after I graduated university and before I started work.
Let me know if it has helped you in any way, I appreciate any feedback.
Building and Running
How to compile and run the emulator.
I have not put my custom linux kernel board support code online yet, so I included a precompiled kernel in the images folder. I have tested on linux (main platform) and cygwin in windows.
- To test my skills and learn about processors and operating systems.
- To embed in other applications like games, simulators and sandboxes so people can have a realistic processor to play with. It doesn't really have any dependencies, so if you rewrite the serial port code, and embed the step function in your program loop somehow, it will work very easily.
Currently boots a custom built linux kernel. timers don't work quite right, so calculating bogomips takes a while during boot, and time readings are off. It currently supports a uart chip, and uses the cpu timer. It may eventually support pluggable framebuffer, mtd flash, 8250 uart, real time clock if there are reasons to extend it. It uses the linux emulation of floating point instructions.
There is no way to quit the emulator currently with the keyboard because I set the terminal to raw mode and was lazy.
(Pull requests and issues welcome.)
test suite I used for bootstrapping located at https://github.com/andrewchambers/met. The linux kernel itself is more comprehensive.
I used creduce and csmith as a way of fuzzing my emulator initially too.
The disgen.py program is just a python script which converts a json representation of the opcodes into a giant switch case for disassembling and executing.
I used buildroot to build the image, and wrote a custom linux kernel board support package for the mips kernel following: http://linux.junsun.net/porting-howto/ Unfortunately it was a bit out of date, so I had to improvise.
The uart code is inspired from http://s-macke.github.io/jor1k/.
The people on #linux-mips also helped me when I hit a bug in the mips linux kernel which prevented booting.