Built for an NYU computer architecture course (Fall 2023); repo refreshed Jan 2026 with CLI + test harness + docs.
Cycle-accurate 5-stage pipelined MIPS simulator with basic hazard handling. It reads instruction/data memories from text files, simulates the pipeline, and writes register/memory/state traces to output files.
makeormake mipsbuilds the simulator binaryMIPS_pipelineusingg++-11if available, otherwiseg++.
./MIPS_pipeline- Expects:
./imem.txt,./dmem.txt - Produces:
./RFresult.txt,./dmemresult.txt,./stateresult.txt
./MIPS_pipeline --imem path/to/imem.txt --dmem path/to/dmem.txt --outdir path/to/output
- Defaults remain
imem.txt,dmem.txt, and current directory if flags are omitted. --helpprints usage.
make test(builds and runs the full testcase suite)- Or run directly:
bash scripts/run_all.sh - Outputs are written under
out/<case_name>/and diffed against each testcase’sexpected_results. - Lines with
\tXin golden files are treated as “don’t care” and ignored during comparison. - State trace diffs are skipped by default; set
STRICT_STATE=1to enforcestateresult.txtcomparisons.
MIPS_pipeline.cpp: simulator implementation.Makefile: build target (make mips) and test target (make test).lab2_testcase2/,lab2_testcase3/: sample inputs and golden outputs.test_cases/: additional instruction/memory inputs and nested testcases.
RFresult.txt: register file state after execution.dmemresult.txt: data memory contents after execution.stateresult.txt: pipeline state per cycle.