|
| 1 | +## 2026-07-24 — Wave Loop 799 (module-scope `[417][2]^6 Pt` non-power-of-two outer-dimension AoS variable, issue #1527) |
| 2 | + |
| 3 | +### What worked |
| 4 | +- Variant A extended the module-scope packed AoS odd outer-dimension ladder to 417. |
| 5 | + The `[417][2]^6 Pt` witness is 854,016 bits (~0.814 MiBit), still well under the 4-MiBit |
| 6 | + cliff, and required no compiler changes. |
| 7 | +- A module-level `pub var dst : [417][2]^6 Pt` can be initialized from a function |
| 8 | + call and exercised with indexed signed field writes, with zero compiler changes. |
| 9 | +- The cocotb/Python reference model correctly mirrored the row-major flattening |
| 10 | + with outer stride 417, confirming the layout is preserved end-to-end. |
| 11 | +- Reused the corrected W632 element-index formula for mid-row expected values: |
| 12 | + `[r][a5][a4][a3][a2][a1][a0]` is element `r*64 + a5*32 + a4*16 + a3*8 + a2*4 + a1*2 + a0`. |
| 13 | +- For `OUTER = 417`, `MID_IDX = 208`; the frame-condition element is |
| 14 | + `[208][1][0][0][0][0][0]`, element number `208*64 + 32 = 13,344`. |
| 15 | +- The generator copy hazard struck again: both the destination path and the module |
| 16 | + header f-string in `scripts/gen_w799.py` carried stale `w798` / `415` references |
| 17 | + after copying from W798. Fixing both before regenerating resolved it. This is the same |
| 18 | + hazard documented in W782–W798 learnings and remains the only manual step in the |
| 19 | + otherwise mechanical flow. |
| 20 | +- Fresh weak-point audit (2026-07-24) found no new actionable items. The W783 fix |
| 21 | + for `bootstrap/tests/verilog_const_array.rs:166` remains green; the pre-existing |
| 22 | + `verilog_array_literal_expr` regression is still out of scope for the witness ladder. |
| 23 | +- 30-day subject-line traceability remained low; the closeout commit carries |
| 24 | + `Closes #1527` in the subject, but the overall rate needs improvement. |
| 25 | + Continue putting issue references in commit subjects. |
| 26 | + |
| 27 | +### What changed behavior |
| 28 | +- No changes to `bootstrap/src/compiler.rs`. |
| 29 | +- No changes to `bootstrap/stage0/FROZEN_HASH` (`68a0b933c00ba5efd7facb5997f00880c3eecae55e6ac5e8cea2aee399b92adc`). |
| 30 | +- No changes to `scripts/cocotb_ref_model.py`. |
| 31 | +- Added `specs/scratch/w799_bench_module_417x2p6_aos_var_call_write.t27` (~1,829 KB / |
| 32 | + ~79,291 lines) with seal and Icarus baseline. |
| 33 | +- Added integration test `accepts_w799_bench_module_417x2p6_aos_var_call_write` |
| 34 | + in `bootstrap/tests/icarus_lowerable.rs`. |
| 35 | +- Added generator script `scripts/gen_w799.py`. |
| 36 | +- Wrote `docs/reports/FPGA_LOOP_CLOSEOUT_W799_2026-07-24.md` and |
| 37 | + `.claude/plans/wave-loop-800.md` with three cooperation variants. |
| 38 | + |
| 39 | +### Validation |
| 40 | +- `cargo build --release -p t27c`: OK. |
| 41 | +- `cargo clippy -p t27c`: OK (780 warnings, 0 errors). |
| 42 | +- `cargo test -p t27c --bin t27c`: 1494 passed; 0 failed; 2 ignored. |
| 43 | +- `cargo test -p tri`: 78 passed; 0 failed. |
| 44 | +- `cargo test -p flash-spi`: 2 passed; 0 failed. |
| 45 | +- `cargo test -p t27c --test bitnet_pipeline`: 20 passed; 0 failed. |
| 46 | +- `cargo test -p t27c --test bitnet_top`: 17 passed; 0 failed. |
| 47 | +- `cargo test -p t27c --test icarus_lowerable`: 259 passed; 0 failed. |
| 48 | +- `cargo test -p t27c --test verilog_const_array`: 2 passed; 0 failed. |
| 49 | +- Direct `t27c parse` W799: PASS. |
| 50 | +- Direct `t27c icarus-lowerable` W799: PASS (`lowerable`). |
| 51 | +- Direct `t27c icarus-simulate` W799: PASS (17 cycles, PASSED). |
| 52 | +- Direct `t27c icarus-cocotb` W799: PASS (`reference-model OK`). |
| 53 | +- Direct `t27c seal --save` W799: PASS. |
| 54 | + |
| 55 | +### Scientific / engineering background |
| 56 | +- IEEE 1800-2017 §7.4.1/7.4.3 define packed-array width as the product of packed |
| 57 | + dimensions, with no power-of-two restriction. Variant A emits a single |
| 58 | + 854,016-bit packed vector, which is legal SystemVerilog. |
| 59 | +- Lutsig's verified array lowering and CIRCT's `HWLegalizeModules` show that |
| 60 | + flattening nested arrays to wide packed vectors is a well-founded compiler |
| 61 | + discipline, even when outer dimensions are non-power-of-two. |
| 62 | +- Icarus issue #1134 documents assertion failures for unpacked arrays of packed |
| 63 | + structs; t27's scalar flattening avoids that construct entirely. |
| 64 | +- Yosys issue #2677 / #4653 confirm that arrays of packed structs remain |
| 65 | + unsupported in the native frontend; t27's packed-vector lowering avoids the |
| 66 | + gap. |
| 67 | +- Recent 2025–2026 ternary/MVL literature reinforces that flattening ternary |
| 68 | + aggregate data to wide binary packed vectors is a pragmatic, toolchain-compatible |
| 69 | + path while native MVL fabrics mature: |
| 70 | + - IEEE Access 2025: An RTL-Based General Synthesis Methodology for |
| 71 | + Device-Independent Ternary Logic Circuits. |
| 72 | + - Chinese Journal of Electronics 2026: Tlsys, an RTL-to-CNFET ternary synthesis |
| 73 | + framework for 500k+ gate designs. |
| 74 | + - IEEE Access 2025: A Generalized Multiple-Valued FPGA Architecture Based on |
| 75 | + Improved T-Gate Circuit. |
| 76 | + - 2026 IEEE ISMVL: Ternary VHDL, a balanced ternary extension to IEEE 1076-2008. |
| 77 | + - arXiv 2025: TerEffic, highly efficient ternary LLM inference on FPGA. |
| 78 | + - Zenodo 2026: Trinity B002, zero-DSP FPGA architecture for ternary inference. |
| 79 | + - GitHub 2026: Vericert v2.0.0, a formally verified HLS tool based on CompCert, |
| 80 | + whose scheduler uses a validated three-valued logic checker. |
| 81 | + |
| 82 | +### Patterns to reuse |
| 83 | +- Use a non-power-of-two outer dimension under the 4-MiBit cliff to test layout |
| 84 | + correctness while keeping simulation fast. |
| 85 | +- Keep signed-i16 leaf values inside range with `(2*e + offset) % 32768` for |
| 86 | + any element count ≤ 163,840. |
| 87 | +- Reuse the W589 wholesale module-scope initializer path for any scalar-struct |
| 88 | + array shape; no new compiler work is needed until the wall-clock limit is hit. |
| 89 | +- Prefer `assert_eq` over `assert_ne` in Icarus-lowerable simulation blocks; |
| 90 | + `assert_ne` is accepted by the classifier but not lowered by the simulation |
| 91 | + emitter. |
| 92 | +- When computing expected values for deep packed-array indices, convert the full |
| 93 | + row-major LSB-first element index explicitly rather than guessing inner-dimension |
| 94 | + offsets. |
| 95 | +- Parameterizing the wave prefix and destination path inside the generator template |
| 96 | + would eliminate the recurring copy hazard; until then, grep for both the old wave |
| 97 | + number and the old outer dimension after copying a generator and before the first |
| 98 | + generation. |
| 99 | + |
| 100 | +### Anti-patterns to avoid |
| 101 | +- Do not use single-line literals for >1,000 element initializers; the scanner |
| 102 | + becomes the bottleneck. |
| 103 | +- Do not rely on `assert_ne` being emitted for Icarus simulation. |
| 104 | + |
1 | 105 | ## 2026-07-24 — Wave Loop 798 (module-scope `[415][2]^6 Pt` non-power-of-two outer-dimension AoS variable, issue #1525) |
2 | 106 |
|
3 | 107 | ### What worked |
|
0 commit comments