Name Mode Size
g1-3 040000
tests 040000
.gitignore 100644 0 kb
Makefile 100644 1 kb
README 100644 2 kb
alist.c 100644 0 kb
alist.h 100644 0 kb
darray.c 100644 0 kb
darray.h 100644 0 kb
format.c 100644 1 kb
format.h 100644 0 kb
general.c 100644 4 kb
general.h 100644 3 kb
machine.c 100644 1 kb
machine.h 100644 1 kb
main.c 100644 0 kb
memory.c 100644 5 kb
memory.h 100644 1 kb
operations.gperf 100644 1 kb
parser.c 100644 6 kb
parser.h 100644 0 kb
registers.gperf 100644 0 kb
simulator.c 100644 1 kb
simulator.h 100644 0 kb
test.sh 100755 0 kb
README
______________________ < MIPS-lite simoolator > ---------------------- \ |\__/| \ (xo)\__._.__ (__)\ MIPS32)\/\ ||---ww | || || ,,,,,,,,,,,,,,,,,,,,,,,,,,, ///the mips cow//////////// ''''''''''''''''''''''''''' Supported MIPS32 operations: r = a register c = a constant b = a label (can also be a constant) add r, r, r sub r, r, r and r, r, r or r, r, r slt r, r, c addi r, r, c subi r, r, c andi r, r, c ori r, r, c lw r, c(r) sw r, c(r) beq r, r, b move r, r j b jr r jal b syscall move r, r la r, b * Current bugs/features + Absolutely no error checking + Liberal view of syntax corectness + Accepts `add', `sub', `and', and `or' as synonyms for `addi', `subi', `andi', and `ori' + Fairly fast + Unable to function in certain special cases * How to run Run `make' to compile the program and output a binary "mipsimoo". Run `mipsimoo FILE' to interpret a MIPS32 assembly file. ** Dependencies mipsimoo depends on the program gperf to generate efficient links from strings to abstract data. It can be downloaded from https://www.gnu.org/software/gperf/ or from most package managers. ** Examples This will interpret a file "test.asm": mipsimoo test.asm * Code overiew The code is split into several files: + general.(h|c) + parser.(h|c) + memory.(h|c) + machine.(h|c) + simulator.(h|c) + alist.(h|c) + darray.(h|c) + format.(h|c) + gperf input files See the respective files for descriptions. When `mipsimoo file.asm' is run, the following happens: 1. The file is parsed into an array of parsed lines. 2. The array of parsed lines is read into an array of a MIPS32 machine's memory bytes. 3. A machine is inited with the memory bytes, empty registers, a program counter, a stack pointer, and so forth. 4. The machine simulation is run. 5. Non-freed memory areas are freed. 6. Exit.