You can about the project on my website!
UWME is a MIPS computer emulator. Specifically, it emulates the the specification used in the University of Waterloo's Foundations of Sequential Programs course, affectionately known as "Baby compilers".
$ racket main.rkt --twoints examples/collatz.mips
Enter value for register 1: 0
Enter value for register 2: 121
Running MIPS program.
MIPS program completed normally.
$01 = 0x00000000 $02 = 0x00000001 $03 = 0x0000005f $04 = 0x00000000
$05 = 0x00000000 $06 = 0x00000000 $07 = 0x00000000 $08 = 0x00000000
$09 = 0x00000000 $10 = 0x00000000 $11 = 0x00000001 $12 = 0x00000002
$13 = 0x00000003 $14 = 0x00000000 $15 = 0x00000000 $16 = 0x00000000
$17 = 0x00000000 $18 = 0x00000000 $19 = 0x00000000 $20 = 0x00000000
$21 = 0x00000000 $22 = 0x00000000 $23 = 0x00000000 $24 = 0x00000000
$25 = 0x00000000 $26 = 0x00000000 $27 = 0x00000000 $28 = 0x00000000
$29 = 0x00000000 $30 = 0x01000000 $31 = 0x8123456c
To emulate mips.twoints:
racket main.rkt --twoints <binary>
To emulate mips.array:
racket main.rkt --array <binary>
I blogged about the project as I developed it.
- MIPS VM part 1: Planning
- MIPS VM part 2: Minimal Viable Product
- MIPS VM part 3: Cleanup
- MIPS VM part 4: Completing
-
initialize.rkt
takes in command-line input, and starts the program -
cycle.rkt
contains the fetch-decode-execute loopcpu.rkt
is a map of opcode names to functionsalu.rkt
is a map of funct names to functions
-
constants.rkt
contains constants common to the entire project -
word.rkt
is a wrapper for a word, which exposes the relevant fields as integers -
registerfile.rkt
is a wrapper for the register file -
memory.rkt
is a wrapper for the memory of the program
- Use closures instead of global variables
- Write unit tests for each opcode / function
- Remove TODOs from code