How to reproduce
Every command runs from the repository root unless it says otherwise. The repository’s README has the same steps with more detail.
| Tool | For |
|---|---|
| Python 3.10+ (no extra packages) | The assembler and the tools in src/tools/ |
ModelSim – Intel FPGA Starter Edition 20.1 (vsim on the PATH) |
The testbenches in verif/ |
| Quartus Prime Lite 20.1 with MAX 10 support + USB-Blaster driver | Building and programming the board |
| MARS 4.5 | Only to compare with MARS (drill.py) |
WSL (Ubuntu) with gcc-mips-linux-gnu, make, verilator |
Only for C programs, Doom and Verilator |
Repository layout
Section titled “Repository layout”| Folder | What it holds |
|---|---|
rtl/ |
All the Verilog: the CPU, memories, MMIO, video and the board top levels (top_*.v) |
verif/ |
Testbenches and their ModelSim scripts (*.do), the traces (verif/traces/) and results |
docs/ |
Plan, workflow, technical contracts, test coverage, lab checklists and evidence |
src/ |
Everything that isn’t Verilog: the assembler, the assembly programs, C programs, tools, Doom |
quartus/ |
The Quartus project mips.qpf, one revision per board image |
mem/ |
Memory images written by the assembler, read by ModelSim and Quartus |
web/ |
This website |
An assembly program on the board
Section titled “An assembly program on the board”- Write it in
src/programs/<name>.asm, like in MARS with delayed branching off. - Assemble it:
python src/assembler/assembler.py src/programs/<name>.asm. It writesmem/<name>*.hexand prints twoset_parameterlines. - (Optional) check it against MARS:
python src/tools/drill.py src/programs/<name>.asmmust end withPASS. - Build: paste the two lines into
quartus/program.qsf, openquartus/mips.qpf, pick the revisionprogramand compile (~3 minutes). - Program: Tools → Programmer, USB-Blaster, add
quartus/output_files/program.sof, Start. The program runs at once (PC = 0). - Read the result: LEDs and HEX show what the program writes. SW9 up shows a register on the HEX (SW4–0 = its number). A halt shows
Eon HEX5.
The graded algorithm, step by step: Algorithm → On the board.
The Game of Life
Section titled “The Game of Life”python src/assembler/assembler.py src/programs/life_board.asm- Quartus: revision
top_life, compile, programtop_life.sof. - It starts paused with a glider: KEY1 to run (controls).
The tests
Section titled “The tests”Tests → How to reproduce everything: assemble the test programs, then run the ModelSim scripts from verif/. Each prints PASS or FAIL.
In WSL:
make -C src/doom # builds build/doom/doom.bin and mem/doom_boot*.hexmake -C verif/verilator doom-check # optional: Doom in Verilator, compared with the PCThe WAD is the shareware DOOM1.WAD v1.9 (never committed): keep it at build/wad/doom1.wad and check its SHA-1 (src/doom/README.md).
On the board:
- Quartus: revision
top_doom, compile, programtop_doom.sof. - System Console (Quartus → Tools → System Debugging Tools), from the repo root:
source src/tools/wad_load.tclwad_load build/doom/doom.bin 0wad_load build/wad/doom1.wad
- Press KEY0.
The lab checklist with every step and the fallback is docs/doom-lab-checklist.md.
This website
Section titled “This website”cd webnpm installnpm run dev # http://localhost:4321npm run build # must pass before a PR