feat(harness): author I-cache-fill hardware timing ROM - #140
Conversation
Companion to the D-cache M(RDRAM) timing ROM (tools/mrdram-timing-rom/): a bare-metal N64 ROM that measures the VR4300 I-cache line-fill cost on real hardware. It runs a straight-line block of N=8192 addiu instructions (32 KiB, larger than the 16 KiB I-cache) so every 32-byte fetch line misses, times it with COP0 Count, and reports fill = (delta*2 - N)/(N/8) after subtracting the verified 1-PClock-per-instruction base. Results go to fixed RDRAM words (phys 0x10000, past the code block) and the ISViewer text channel for a flashcart to read -- the same output path as the D-cache ROM. This makes the eventual hardware measurement of M_ICACHE_FILL one console-run away, replacing the value currently FITTED from ares/cen64 (ledger C-1). - tools/mrdram-timing-rom/icache_timing.asm + .z64 (bass, ARM9 fork; blank IPL3, no Nintendo code; MIT OR Apache-2.0). - build.sh now assembles both ROMs; README documents the I-cache variant. - crates/rustyn64-test-harness/tests/icache_timing_rom.rs boots the ROM through load_direct and asserts it reads back the charged M_ICACHE_FILL (measures 46.09 in-emulator, the charged 46) -- proof the measurement path is correct end-to-end and a guard tying the ROM to the constant. - .gitignore re-includes icache_timing.z64 by exact filename; ledger C-1 and CHANGELOG note both authored hardware ROMs. Gates: cargo fmt --check, clippy -D warnings (test-harness), both ROM runners green, markdownlint on the touched docs, check_no_roms clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
Comment |
Adopt Antigravity review suggestion #2: on a hung ROM or wrong entry point the sentinel-poll loop exits on the step cap, after which assert_eq!(n, 8192) fails with an opaque mismatch. An explicit non-timeout assert makes that failure mode self-explanatory. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks — adjudicated each point: Suggestion 1 (build.sh Suggestion 2 (assert non-timeout in the runner) — Adopted in 86e5236. Added an explicit Nitpick ( |
Antigravity review (Gemini via Ultra)This pull request adds an authored bare-metal I-cache timing ROM (icache_timing.z64), its assembly source, documentation updates, and an integration test runner to measure and guard the charged I-cache fill constant. Blocking issuesNone found. Suggestions
Nitpicks
Automated first-pass review by |
Motivation
The VR4300 I-cache line-fill cost (
M_ICACHE_FILL, ledger C-1) iscurrently a value fitted from ares/cen64 — no hardware cached-miss timing
oracle exists in the emulation community's corpus (PeterLemon times only ALU
ops, n64-systemtest's
Timingset is two COP0Randomtests, N64brew/copettigive only a cold-access range). The D-cache companion ROM (
mrdram_timing.z64)already makes the D-cache measurement one console-run away; this adds the
I-cache counterpart so
M_ICACHE_FILLcan likewise be replaced with a realmeasurement when hardware is available.
Changes
tools/mrdram-timing-rom/icache_timing.asm+.z64— a bare-metal ROM(bass, ARM9 fork; blank IPL3, no Nintendo code) that runs a straight-line
block of
N=8192addius (32 KiB > the 16 KiB I-cache), so every 32-bytefetch line misses. Times it with COP0
Countand reportsfill = (delta*2 - N)/(N/8)after subtracting the verified 1-PClock base.Results go to fixed RDRAM words (phys
0x10000, past the code) and theISViewer channel — the same output path as the D-cache ROM.
build.shnow assembles both ROMs; README documents the I-cachevariant (formula, output, hardware steps).
crates/rustyn64-test-harness/tests/icache_timing_rom.rs— boots the ROMthrough
load_directand asserts it reads back the chargedM_ICACHE_FILL(measures 46.09 in-emulator, the charged 46): proof the measurement
path is correct end-to-end, and a regression guard tying the ROM to the
constant.
.gitignorere-includesicache_timing.z64by exact filename;ledger C-1 and CHANGELOG note both authored hardware ROMs.
No emulated behaviour changes — this is instrumentation.
Gates run locally
cargo fmt --all --check— cleancargo clippy -p rustyn64-test-harness --all-targets -- -D warnings— cleancargo test -p rustyn64-test-harness --release --test icache_timing_rom --test mrdram_timing_rom— greenpre-commit run markdownlinton the touched docs — passedscripts/check_no_roms.sh(with the ROM staged) — clean (allowlisted)🤖 Generated with Claude Code