|
| 1 | +# Wave Loop 799 Plan — Variant A (recommended) |
| 2 | + |
| 3 | +**Date:** 2026-07-24 |
| 4 | +**Anchor:** φ² + φ⁻² = 3 | TRINITY |
| 5 | +**Branch:** `wave-loop-799` (to be created from `wave-loop-798` HEAD because earlier wave PRs remain open) |
| 6 | +**Issue:** TBD (next available GitHub issue after W798 PR is opened) |
| 7 | +**Cooperation variant:** A |
| 8 | + |
| 9 | +## Goal |
| 10 | + |
| 11 | +Continue the module-scope packed array-of-struct ladder with the recommended Variant A shape: module-scope `[417][2]^6 Pt` initialized from a function call and exercised with indexed signed field writes, then read back with `assert_eq` in a `bench` block. |
| 12 | + |
| 13 | +## Acceptance criteria |
| 14 | + |
| 15 | +1. `specs/scratch/w799_bench_module_417x2p6_aos_var_call_write.t27` is generated and parses. |
| 16 | +2. The witness is Icarus-lowerable and simulates correctly (17 cycles, PASSED). |
| 17 | +3. The cocotb reference model matches the t27 semantics. |
| 18 | +4. `t27c seal --save` succeeds and `FROZEN_HASH` stays unchanged. |
| 19 | +5. All cargo suites remain green. |
| 20 | +6. Integration test `accepts_w799_bench_module_417x2p6_aos_var_call_write` is added to `bootstrap/tests/icarus_lowerable.rs`. |
| 21 | +7. Closeout report `docs/reports/FPGA_LOOP_CLOSEOUT_W799_2026-07-24.md` is written with weak-point audit, literature scan, and validation matrix. |
| 22 | +8. Next-wave plan `.claude/plans/wave-loop-800.md` with three cooperation variants is created. |
| 23 | +9. Learning is saved to `.trinity/experience.md`, `.claude/skills/t27-wave-loop.md`, persistent memory, and `.trinity/current-issue.md`. |
| 24 | + |
| 25 | +## Technical notes |
| 26 | + |
| 27 | +- Shape: `[417][2]^6 Pt` where `Pt = pub struct Pt { x : i16, y : i16 }`. |
| 28 | +- Total elements: `417 x 64 = 26,688`. |
| 29 | +- Packed vector width: `26,688 x 32 = 854,016` bits (~0.814 MiBit). |
| 30 | +- `MID_IDX = 208`; frame-condition element `[208][1][0][0][0][0][0]` is element number `208*64 + 32 = 13,344`. |
| 31 | +- Generator script `scripts/gen_w799.py` should be copied from `scripts/gen_w798.py`, update `OUTER = 417` and `MID_IDX = 208`, and fix the destination path and hardcoded module prefix in the f-string header. |
| 32 | +- Use `assert_eq` on changed elements (`assert_ne` is not emitted by the Icarus simulation path). |
| 33 | +- Include `make_grid(32768)` period-identity check because `32768 == 0 (mod 32768)`. |
| 34 | +- Zero compiler / reference-model / FROZEN_HASH changes expected for the witness. |
| 35 | + |
| 36 | +## Decomposition |
| 37 | + |
| 38 | +### Phase A — Branch setup (5 min) |
| 39 | +1. Create `wave-loop-799` from `wave-loop-798` HEAD because earlier wave PRs remain open. |
| 40 | +2. Open next GitHub issue when ready. |
| 41 | + |
| 42 | +### Phase B — Spec + generator (15 min) |
| 43 | +3. Copy `scripts/gen_w798.py` to `scripts/gen_w799.py`. |
| 44 | +4. Update `OUTER = 417`, `MID_IDX = 208`, fix destination path and module prefix. |
| 45 | +5. Run generator to produce `specs/scratch/w799_bench_module_417x2p6_aos_var_call_write.t27`. |
| 46 | +6. Verify module name and destination path have no stale `w798` / `415` references. |
| 47 | + |
| 48 | +### Phase C — Test + validation (45 min) |
| 49 | +7. Add integration test `accepts_w799_bench_module_417x2p6_aos_var_call_write` to `bootstrap/tests/icarus_lowerable.rs`. |
| 50 | +8. `cargo build --release -p t27c`. |
| 51 | +9. `t27c parse`, `icarus-lowerable`, `icarus-simulate` (expected 17 cycles), `icarus-cocotb` on the W799 witness. |
| 52 | +10. `t27c seal --save` the witness; confirm `FROZEN_HASH` unchanged. |
| 53 | +11. `cargo test -p t27c --bin t27c`, `cargo test -p tri`, `cargo test -p t27c --test icarus_lowerable`, `cargo test -p t27c --test verilog_const_array`. |
| 54 | +12. `cargo clippy -p t27c`. |
| 55 | + |
| 56 | +### Phase D — Closeout + cooperation variants (30 min) |
| 57 | +13. Write `docs/reports/FPGA_LOOP_CLOSEOUT_W799_2026-07-24.md` with audit, literature, validation, and three W800 cooperation variants. |
| 58 | +14. Update `docs/NOW.md` and `.trinity/current-issue.md`. |
| 59 | + |
| 60 | +### Phase E — Save skills + memory (15 min) |
| 61 | +15. Append W799 worked example to `.claude/skills/t27-wave-loop.md`. |
| 62 | +16. Update `.trinity/experience.md`. |
| 63 | +17. Save memory file `wave-loop-799.md` and pointer in `MEMORY.md`. |
| 64 | + |
| 65 | +## Cooperation variants for Wave Loop 800 |
| 66 | + |
| 67 | +- **Variant A (recommended):** continue odd outer-dimension ladder with `[419][2]^6 Pt` (~0.818 MiBit, 26,816 elements, 858,112-bit packed vector). Zero compiler changes expected. |
| 68 | +- **Variant B:** keep `[417][2]^6 Pt` width but move the packed var to bench/function scope to exercise function-local non-power-of-two packed arrays. |
| 69 | +- **Variant C:** keep `[417][2]^6 Pt` width and add `if`-guarded indexed signed field writes to exercise control-flow + packed-vector writes. |
| 70 | + |
| 71 | +## Exit criteria |
| 72 | + |
| 73 | +- W799 witness parses, lowers, simulates, cocotb-matches, and seals. |
| 74 | +- All cargo suites green. |
| 75 | +- Closeout report written. |
| 76 | +- `.trinity/experience.md` updated. |
| 77 | +- Skills and memory saved. |
| 78 | +- Commit with `Closes #N`, push `wave-loop-799`, open PR. |
| 79 | + |
| 80 | +*φ² + φ⁻² = 3 | TRINITY* |
0 commit comments