Skip to content

Commit 47bf4e2

Browse files
Dmitrii Vasilevclaude
andcommitted
feat(fpga): Wave Loop 419 — VCD/CSV hardening, PVT monotonicity, standalone lake workflow (Closes #1357)
- VCD $comment exact $end token terminator + embedded-end regression test - CSV multi-channel header detection + --csv-channel explicit selector - Rust/Lean PVT envelope monotonicity in temp + antitonicity in vccint - Fix --standalone generated Lean import (remove invalid Trinity.BitstreamConfig) - Document standalone lake-package workflow in fpga/HARDWARE_SSOT.md §3.6.16 Verification: cargo test -p tri vcd/csv/pvt/fpga::tests PASS; lake build PASS; ./scripts/tri test PASS except 16 pre-existing gen-verilog #1245 yosys failures. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ab92e05 commit 47bf4e2

10 files changed

Lines changed: 915 additions & 50 deletions

File tree

.trinity/current-issue.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,23 @@ See `docs/reports/FPGA_LOOP_COOPERATION_W419_2026-07-04.md` and
6666
- [ ] AC-B3: `fpga/HARDWARE_SSOT.md` documents relay wiring and port syntax.
6767

6868
### Bundle C
69-
- [ ] AC-C1: At least one additional instrument-import unit test lands (VCD/CSV parity).
70-
- [ ] AC-C2: Rust and Lean tests verify PVT envelope monotonicity/antitonicity.
71-
- [ ] AC-C3: The standalone lake-package workflow is documented end-to-end.
69+
- [x] AC-C1: At least one additional instrument-import unit test lands (VCD `$comment` hardening + CSV `--csv-channel` explicit select).
70+
- [x] AC-C2: Rust and Lean tests verify PVT envelope monotonicity/antitonicity.
71+
- [x] AC-C3: The standalone lake-package workflow is documented end-to-end.
7272

7373
### Invariant checks
74-
- [ ] `./scripts/tri test` parse/typecheck/gen/seal-verify phases pass.
75-
- [ ] `lake build Trinity.TernaryFPGABoot` passes.
76-
- [ ] `cargo test -p tri fpga::tests` passes.
74+
- [x] `./scripts/tri test` parse/typecheck/gen/seal-verify phases pass.
75+
- [x] `lake build Trinity.TernaryFPGABoot` passes.
76+
- [x] `cargo test -p tri fpga::tests` passes.
77+
78+
---
79+
80+
## PR
81+
- Target: `master`
82+
- Body: `Closes #1357`
83+
- Report: `docs/reports/WAVE_LOOP_419_REPORT.md`
84+
- Evidence: `docs/reports/FPGA_LOOP_EVIDENCE_W419_2026-07-05.md`
85+
- Cooperation W420: `docs/reports/FPGA_LOOP_COOPERATION_W420_2026-07-05.md`
7786

7887
---
7988

.trinity/current_task/activity.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,3 +1472,7 @@
14721472
- **Commit:** docs(plan): decomposed W419 plan and current-issue link
14731473
- **Files:** .claude/plans/wave-loop-419.md,.trinity/current-issue.md,.trinity/current_task/activity.md
14741474

1475+
## 2026-07-04T17:59:50Z — wave-loop-419
1476+
- **Commit:** docs(plan): decomposed W419 plan and current-issue link
1477+
- **Files:** .trinity/current-issue.md,.trinity/experience.md,cli/tri/src/fpga.rs,docs/NOW.md,docs/reports/FPGA_LOOP_COOPERATION_W420_2026-07-05.md,docs/reports/FPGA_LOOP_EVIDENCE_W419_2026-07-05.md,docs/reports/WAVE_LOOP_419_REPORT.md,fpga/HARDWARE_SSOT.md,proofs/lean4/Trinity/TernaryFPGABoot.lean
1478+

.trinity/experience.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,67 @@
11
# t27 / Trinity Agent Experience Log
22

3+
## 2026-07-05 — Wave Loop 419 (Variant C fallback: VCD/CSV hardening, PVT monotonicity, standalone lake workflow)
4+
5+
### What worked
6+
- Hardening the VCD `$comment` parser with an **exact-token terminator** closed a
7+
real regression vector: vendor comments that contain the substring `$end` no
8+
longer confuse the signal dictionary. A single regression test with an embedded
9+
`$end`-like token prevents future heuristic drift.
10+
- Adding `--csv-channel <name>` and extending header-name auto-detection to
11+
`cclk`, `vccint`, `vccaux`, `ain`, `a0`, `channel0` makes multi-channel
12+
instrument exports first-class. The explicit selector is simpler than trying to
13+
guess every vendor dialect.
14+
- Proving PVT envelope **monotonicity in temperature** and **antitonicity in
15+
VCCINT** in both Lean 4 and Rust guards the shape of the placeholder envelope
16+
independently of the exact coefficients. The symbolic Lean proofs and the
17+
numeric Rust tests reinforce each other.
18+
- Documenting the full `measured-to-lean --standalone` lake-package workflow in
19+
`fpga/HARDWARE_SSOT.md` turned a "works in tests" feature into a reproducible
20+
user protocol.
21+
- Catching the invalid `import Trinity.BitstreamConfig` in the `--standalone`
22+
output showed that **string assertions are not enough** for generated-code
23+
tests: the integration test that runs `lake build` on the generated file is
24+
what found the bug.
25+
26+
### What changed behavior
27+
- `cli/tri/src/fpga.rs`: VCD `$comment` exact-terminator parsing;
28+
`--csv-channel` option and multi-channel header detection;
29+
`test_pvt_half_ns_monotone_in_temp` / `test_pvt_half_ns_antitone_in_vccint`;
30+
`test_parse_cclk_csv_explicit_channel_select`;
31+
`--standalone` template now imports only `Trinity.TernaryFPGABoot`.
32+
- `proofs/lean4/Trinity/TernaryFPGABoot.lean`: added
33+
`pvt_half_ns_monotone_in_temp` and `pvt_half_ns_antitone_in_vccint`.
34+
- `fpga/HARDWARE_SSOT.md`: added §3.6.16 standalone lake-package workflow.
35+
- `docs/NOW.md`: W419 close-out and W420 setup.
36+
- Close-out artifacts: `docs/reports/WAVE_LOOP_419_REPORT.md`,
37+
`docs/reports/FPGA_LOOP_EVIDENCE_W419_2026-07-05.md`, and
38+
`docs/reports/FPGA_LOOP_COOPERATION_W420_2026-07-05.md`.
39+
40+
### Patterns to reuse
41+
- For section-skipping parsers, match the **exact delimiter token** and clear
42+
state immediately when the delimiter appears on the same line; do not use
43+
substring heuristics.
44+
- When adding user-facing selectors to instrument parsers, also add a
45+
regression test that would fail if the selector is ignored or the fallback
46+
overrides it.
47+
- For placeholder model coefficients, prove the **shape** (monotonicity,
48+
bounds) symbolically and add a numeric operating-rectangle regression. This
49+
combination survives coefficient updates as long as the shape constraints
50+
remain.
51+
- For generated-code deliverables, the canonical integration test is to
52+
**type-check the generated artifact in a fresh package** that depends on the
53+
real library via a local path. String snapshots catch regressions; package
54+
builds catch invalid imports and namespaces.
55+
56+
### Anti-patterns to avoid
57+
- Do not assert only string contents for generated source files; always exercise
58+
the downstream compiler/package build.
59+
- Do not import a Lean 4 **namespace** as if it were a module. Names inside a
60+
file are reached through the file's module name, then opened with `open` if
61+
needed.
62+
- Do not let a parser heuristic silently override an explicit user option;
63+
resolve precedence clearly (explicit option > named header > numeric fallback).
64+
365
## 2026-07-04 — Wave Loop 418 (Variant C fallback: PVT regression, instrument import, standalone Lean integration)
466

567
### What worked

0 commit comments

Comments
 (0)