Repository navigation
Improvement: DSP register-contract report for Octatrack DSP package entries, from the assembled words - #1608
Merged
Merged
Conversation
…tes against its contract, read from the assembled words Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
dsp-sites.jsondeclares aclobberslist per DSP hook site, anddocs/OCTATRACK_PACKAGE_DSP_HOOKS.mdsaidbuild.py --dsp-hookrefuses "a register outside the site's contract (checked on the disassembly)". Neither held: no code readclobbers, andbuild.pyhas no--dsp-hook. The only register rule checked anywhere was r1 in an effect's init, by a regex over source (the trap-init-r1 class: an init that moved r1 hung every core at project load). A reviewer of a hook package (an engine for site 5, or the chain site in Octatrack base: DSP hook chains, so several packaged DSP machines share a hook site #1418) had to read its registers by hand.scripts/dsp-register-contract.pyreads every shipped Octatrack DSP package from its words: the.mwrmfilesoctatrack-module-packages.jsonlists (effectinit/proc, ABI 10 engine hook entries) and the base's own hooked engines indsp-packages.json. Each entry is placed with its relocations and walked from its offset over what it can reach: falls, both sides of a branch, localjsr/bsrcallees, with eachrtsgoing back to its own caller. Only reached instructions are decoded, so a P table or data beside the code is never read as code. Decoding uses the DSP56300 disassembler built besideELEKLOADER_DSP_ASM(dsp56kDisassemble -nops).clobbers, and a site with an exit also lets it drop the return it was called with. An effect init keeps r1, n1 and m1. No entry writes omr, mr, sr, sp, ssh, ssl, vba, ep, sz or sc.jsr (rN), a call outside the package or running past the end each makes the entry "incomplete", and that counts as a finding.dsp-source-gates.pydoes withREP_REFUSED_FROM.REFUSED_FROM = Nonemeans report only. You set the date. From that date, a module first listed on or after it gets a red doctor line and exit 1.module:doctorhas adsp registersline (✓, or · with the first finding). Without the disassembler it says "not checked", so CI, which has no toolchain, is unaffected.pr-ready.mjslists the script and its test as gate files, next todsp-source-gates.hook_engines.pyandabi9.engine()build and package an engine,dsp_sites.py --checkchecks addresses and guards,dsp-source-gates.pychecksrep, and this script checks registers. Stack depth is not checked. The doc gets 31 bytes shorter.jsr (r2)at +$2a1 (an indirect call through its table). It writes nothing outside the contract up to that point.[b, r4, x0]. The path out through the exit writes a, m0, m1, m4-m6, n1, n5, n7, r0, r1, r5, r6, x1, y0, y1. The site records no exit-path contract, and the stock source it skips may free those registers. n5 is a known false positive: the voice saves and restores it, which the check does not recognise yet.[a, b, r0, r1, n1, x0]. It reloads r6 from X:$208 before returning.clobbers: []but write a lot: site 1 a, b, n1, n6, r0, r1, r4, r5, x0, x1, y0, y1; site 2 a, b, n1, r0, r1, r3, x0, x1, y1; site 6 only x0, by replaying stock's displacedmove #>$20c5,x0.move ssh,x0) at sites that have no exit.clobbers: []lists were never filled in, plus the "reloaded from a stock word" and "replays the displaced instruction" patterns the checker does not model. They are not faults seen on a unit. Before setting the date: fill in the base sites'clobbers(a base pull request), or teach the checker save/restore.clobbersper site whether the site hasfeatureorfeatures, so it also covers a second chain member, but I did not run it against that branch.python3 -B -m unittestonsdk/tests/test_dsp_register_contract.py: 10 tests pass with the toolchain. Without it, 5 skip with the toolchain reason.dsp-packages.json: the same words, relocations and entries for every effect whose versions match. Every engine's exit word follows a long BRA.dsp_asm: an init that moves r1 is reported; a write of n1 twobsrlevels down counts; proc may move r1; data words afterrtsare never decoded; a branch into one gives "undecodable at P:$4004";jsr $292is incomplete;jmp $292leaves; and a hook is judged per path against a test site.npm run module:doctor -- analog-bassdrumand-- everbboth end "Every integration point is green". The new line shows · for Analog BD and ✓ for E-Verb.eslinton the changed.mjsfiles passes, and so doesvitest run scripts/pr-ready.test.mjs(12 tests).npm run pr:readyand the fullsdk:check, because the machine I share with other jobs cannot take the load. CI runs them.docs/OCTATRACK_PACKAGE_DSP_HOOKS.mddescribed abuild.py --dsp-hookregister refusal that does not exist. That paragraph, and the stale tools line under "What it costs", now say what exists. Changelog:changelog/2026-11-16-dsp-register-contract.md.🤖 Generated with Claude Code