Repository navigation
Student QoL: flags and hi/lo, source lines in step, MIPS32 widths, x86 syntax; fix stale examples - #7
Open
timsherwood wants to merge 2 commits into
Open
timsherwood wants to merge 2 commits into
timsherwood wants to merge 2 commits into
Conversation
regs now shows the registers students need to follow compares, branches, and multiplies: MIPS hi and lo, ARM64 nzcv, and x86-64 rflags (CF, ZF, SF, OF), with change markers like the general-purpose registers. The RISC-V fibonacci and matrix_multiply examples exited through the HTIF tohost mechanism left over from the Sail backend, unlike every other example; they now use the exit syscall and fibonacci prints its result. The ARM examples README described an old workflow (install a cross toolchain, load by path, wrong base address) and is removed. The Console Guide gets a register table for all four ISAs and loses its redundant Tips section; transcripts are regenerated from the rebuilt examples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
step prints each source line before the machine instructions it assembled to, so pseudo-instructions like la are visibly one line becoming several instructions. MIPS32 registers, the PC, and addresses in console messages are shown at their real width (8 hex digits, 32 binary digits, 11-character decimal) instead of padded to 64 bits. x86-64 instructions are disassembled in the syntax the source used. syntax_by_line() reuses the assembler's per-instruction AT&T/Intel decision (including .att_syntax/.intel_syntax); instructions that read the same either way, and ELF files without source, fall back to the program's usual syntax (Intel when there is no source). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
timsherwood
force-pushed
the
claude/mapachespim-docs-ux-review-8cewia
branch
from
September 27, 2026 22:25
d7d9e3b to
70ce81a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improvements from reviewing MapacheSPIM the way a second-year student would use it.
Console
regsshows MIPShi/loand the condition flags. ARM64 showsnzcv: N Z C Vand x86-64 showsrflags: CF ZF SF OF. Both get ★ when they change, so students can see whatcmp,multanddivdid. NewSimulator.get_special_regs()andget_flags().stepshows each source line before the machine instructions it assembled to. This makes pseudo-instructions visible (la→auipc+addi).regs binaryshows 32 bits, andregs decimalis sized for 32-bit values.step,disasmand the crash message.toolchain.x86.syntax_by_line()reuses the assembler's own per-instruction decision, including.att_syntaxand.intel_syntax. Instructions that read the same in both syntaxes follow whichever syntax the rest of the program mostly uses. ELF files with no source stay in Intel syntax, as before.regsandpcwithout a loaded program now say to load one. Before,regsshowed a meaninglessr0–r31dump, and my flags change would have made it crash.Examples and docs
fibonacciandmatrix_multiplynow exit with the exit syscall, like every other example, instead of HTIFtohost(left over from the Sail backend).fibonacciprints its result, and a stack-frame comment that listed the saved registers in the wrong slots is fixed. Their binaries are rebuilt withmake DEBUG=1; the other ISAs' binaries came out byte-identical.tohostexit now use a small dedicatedtohostprogram. The simulator still supportstohostfor outside ELFs.examples/arm/README.md. It said to install a cross-toolchain, used old load paths and gave the wrong base address.stepreganddisasmentries (disasmwasn't documented before).help regsnow lists MIPS,help steploses its filler tips, andhelp pcno longer says the PC always advances by 4, which is wrong on x86.Testing
pytest tests: 641 passed, 92 skipped. The skips are the GNU differential tests, since binutils isn't installed locally.tests/test_special_registers.pyandtests/test_step_display.py.ruff check,ruff format --checkandmypyonmapachespim/are clean.🤖 Generated with Claude Code