Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


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.

example gif

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.


  1. To test my skills and learn about processors and operating systems.
  2. To compile to javascript (asm.js) with emscripten to test it vs Fabrice Bellard's (I started this, but didnt finish writing a terminal emulator.)
  3. 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 The linux kernel itself is more comprehensive.

I used creduce and csmith as a way of fuzzing my emulator initially too.


The 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: Unfortunately it was a bit out of date, so I had to improvise.

Those who wish to try similar projects, I learnt alot by working with my friend on a predecessor javascript emulator and a gameboy emulator. I mainly used the mips 4kc manual I got from wikipedia, and I read parts of the qemu code if things were not totally clear.

The uart code is inspired from

The people on #linux-mips also helped me when I hit a bug in the mips linux kernel which prevented booting.









No releases published


No packages published