Note Bugs, feature requests, etc have moved to the discussion page for the project.
It's not required, but please consider linking to this page or the main page from your site if you like this product.
Before downloading or using this product, make sure you understand and accept the terms of the license.
After downloading, you can find compilation instructions below.
Spimmy is a mini MIPS simulator, written in C. It emulates the datapath (indirectly emulating the instruction set) of a stripped down MIPS device. This is different from what is typically called an emulator, which directly emulates the instruction set.
By doing things in this fashion though, we sacrifice speed for simplicity (relatively speaking) and gain (theoretically) some implicit accuracy through creative code reuse.
Spimmy is partially built off of the SPIM mips simulator, albeit spimmy is much less complicated and simulates a lot less.
The following are the instructions currently supported:
| Type | Instruction Pneumonic | Meaning |
|---|---|---|
| R | add $rd, $rs, $rt | $rd = $rs + $rt; |
| R | and $rd, $rs, $rt | $rd = $rs & $rt; |
| R | or $rd, $rs, $rt | $rd = $rs | $rt; |
| R | slt $rd, $rs, $rt | $rd = ($rs < $rt) ? 1 : 0; |
| R | sltu $rd, $rs, $rt | $rd = ((unsigned)$rs < (unsigned)$rt) ? 1 : 0; |
| R | sub $rd, $rs, $rt | $rd = $rs - $rt; |
| J | jump imm | goto imm << 2; |
| I | beq $rt, $rs, imm | if ($rt == $rs) goto (PC + 4) + (imm << 2); |
| I | addi $rt, $rs, imm | $rt = $rs + imm; |
| I | slti $rt, $rs, imm | $rt = ($rs < imm) ? 1 : 0; |
| I | sltiu $rt, $rs, imm | $rt = ((unsigned)$rs < (unsigned)imm) ? 1 : 0; |
| I | lui $rt, imm | $rt = imm << 16; |
| I | lw $rt, imm($rs) | $rt = ((int*)*$rs)[imm]; |
| I | sw $rt, imm($rs) | ((int*)*$rs)[imm] = $rt; |
To be continued…
The file format for input is as follows:
00000000 #comment
Where 00000000 is an instruction in 8-byte hex character format. Comments are not parsed nor interpreted by the simulator.
Here is small example of an input file:
012a602b #sltu $12, $9, $10 ; 29: sltu $t4, $t1, $t2; 200d0002 #addi $13, $0, 2 ; 30: addi $t5, $zero, 2; 012d4822 #sub $9, $9, $13 ; 31: sub $t1, $t1, $t5;
To be continued…
Spimmy compiles correctly using Microsoft Visual Studio 2005 under Windows, as well as gcc under Solaris, and compiles correctly on both big and little endian systems with no changes necessary. It should compile and run on any system that supports gcc.
To be continued…
These are issues that will eventually be fixed in some fashion: