Skip to content

Latest commit

 

History

History
53 lines (48 loc) · 2.08 KB

README.md

File metadata and controls

53 lines (48 loc) · 2.08 KB

MIPS assembler, linker, simulator, and debugger

Build

This project is written in Rust, so first install Rust: https://www.rust-lang.org/tools/install

Now that Rust is installed, use cargo to build the project (with optimizations):

cargo build --release

The compiled binaries are located in target/release/, namely mips-assembler, mips-linker, mips-simulator, and mips-debugger.

Goals

  • Assembler
    • Parse assembly code
    • Assemble code into object files
    • Support all directives and instructions
    • Handle global (extern) references
    • Support data sections like sdata
  • Linker
    • Support transforming one independent object module (only exports main) into an executable file (R2K format).
    • Support linking (at least) two object modules together such that a global exported by one and used by another is wired up correctly.
    • Link in the r2k_startup module if __r2k__entry__ is not defined. This handles calling main and closing the program at the end. This should also be set as the entry point of the program.
    • All sections (including rdata/data/sdata) are relocated correctly.
  • Simulator
    • Create a simulated MIPS CPU
    • Parse R instructions
    • Execute all R instructions
    • Parse I instructions
    • Execute all I instructions
    • Parse J instructions
    • Execute all J instructions
  • Debugger
    • Drive the simulator
    • Inspect the registers
    • Inspect the surrounding code/instructions
    • Breakpoints

Test Programs

The programs directory contains some test programs which have been assembled and linked with a MIPS toolchain I refer to as "R2K" (the assembler is "rasm", the linker is "rlink", the simulator is "rsim", and the debugger is "rbug"). This was the tool I used in college when learning MIPS, but access to it was very restricted (only available on university servers, execute permissions only), and I have not found it anywhere online. I used it to provide assembled binaries while my own assembler and linker were still in development.