This project is a Java-based MIPS simulator that interprets and executes MIPS machine code using a single-cycle datapath. It simulates the internal workings of a MIPS processor and accurately executes a reduced instruction set, closely mimicking the behavior of the MARS simulator.
- Executes a subset of MIPS instructions (
add,sub,lw,sw,syscall, etc.). - Reads MIPS machine code from a
.textfile and simulates execution. - Manages CPU state, registers, and memory to provide an accurate simulation.
- Supports user interaction via standard syscalls, including:
- Printing strings and integers.
- Reading integers from user input.
- Properly handling program exits.
The program takes two input files:
- Text file (
.text) – Contains MIPS instructions in ASCII hex format, one instruction per line. - Data file (
.data) – Contains raw data values in ASCII hex format, one word per line.
- The program reads the
.textfile and parses each instruction. - It updates register values and simulates memory interactions.
- Executes syscalls for input/output operations.
- Maintains a log of execution state (registers, memory, program counter, etc.).
- Prints the final output, simulating a MIPS environment.
- Java 8+
- A terminal or command prompt
java -jar MIPSsimulator.jar path/to/textfile.text path/to/datafile.dataExample:
java -jar MIPSsimulator.jar EvenOrOdd.text EvenOrOdd.data- Designed to deepen understanding of CPU architecture & instruction execution.
- Useful for learning low-level programming and computer organization.
- Demonstrates ability to build a processor simulator from scratch using Java.
- Expand instruction set support.
- Implement multi-cycle and pipeline execution.
- Add GUI for interactive debugging.
Logan Lapierre
GitHub | LinkedIn
MIT License - Free to use and modify.