Просмотр исходного кода

docs(contract): freeze 6400 v1 design and audits

root 3 месяцев назад
Родитель
Сommit
0a6667a188

+ 36 - 0
docs/architecture/6400-v1-dataflow.md

@@ -0,0 +1,36 @@
+# 6400-front-rear-v1 dataflow
+
+```text
+CON77 BMC RX -> 115200 byte RX -> streaming hex parser -> inactive BMC bank --+
+                                                                            |
+CT7428 x3 -> shared open-drain I2C -> inactive CT bank ----------------------+--> epoch/freshness scheduler
+                                                                            |
+Host RS232 RX --+                                                           v
+Host TTL RX ----+-> start-bit selector -> shared 921600 RX -> frame/CRC -> target + GET + optional stimulus
+                                                                            |
+                                              +-----------------------------+
+                                              v
+                                      control-state sequencer
+                                              |
+                          +-------------------+------------------+
+                          v                                      v
+                 shared 24-channel PI                  shared lane supervisor
+                          |                                      |
+                          +-------------------+------------------+
+                                              v
+                                      requested duty banks
+                                              |
+                                  final safety/stimulus mux
+                                              |
+                                       applied duty bank
+                                              |
+                              one-comparator PWM bitmap builder
+                                              |
+                                 atomic active bitmap switch
+                                              |
+                                    24 PTC + 4 front + 4 rear
+
+snapshot bank locks BMC/CT/control/output bank IDs -> offset streamer -> shared frame/CRC/TX -> selected Host port
+```
+
+Deadlines are statically scheduled with safety and PWM work first. BMC and Host retain independent byte receivers so concurrent RX cannot lose bytes. All multiply/control work is sequential and completes before the next approximately 1 Hz BMC epoch.

+ 21 - 0
docs/architecture/6400-v1-decision-register.md

@@ -0,0 +1,21 @@
+# 6400-front-rear-v1 decision register
+
+| ID | Decision | Reason |
+| --- | --- | --- |
+| D001 | The task attachment overrides the old root door contract for this run. | Explicit user authority. |
+| D002 | Keep one 25 MHz domain and clock enables only. | Frozen V1 scope and simple timing. |
+| D003 | Use UART1/CON77 for BMC and UART2/CON78 for Host RS-232. | Board evidence plus active contract. |
+| D004 | Implement TTL Host logic but leave its ADC entries absent. | No complete pin evidence; guessing is forbidden. |
+| D005 | Preserve BMC raw pairs and isolate conversion. | Fractional semantics are not fully evidenced. |
+| D006 | Split HTH from Host-bearing Git history rather than copying files. | Preserves truthful history. |
+| D007 | Keep Legacy in the CPLD repository as a profile. | Required regression and historical product availability. |
+| D008 | No Host watchdog in any 6400 profile. | Autonomous control must continue without Host. |
+| D009 | Use shared incremental PI and two coefficient classes. | Minimum datapath and no hardware tuning data. |
+| D010 | Use a next/active bitmap for phase-atomic PWM. | Existing scan-in-place output is not atomic. |
+| D011 | Use bank-pointer commits for sensor and output snapshots. | Avoids wide FF copy and epoch mixing. |
+| D012 | Production compile-time removes stimulus. | Prevents a hidden raw-output command. |
+| D013 | Treat all physical validation as NOT RUN. | COM/JTAG/hardware access is outside authority. |
+| D014 | Compare required A/B variants only after behavior parity. | Correctness/formal/timing precede area selection. |
+| D015 | Use XML as the sole repository list; no duplicate YAML list. | Frozen manifest contract. |
+
+Any change to protocol bytes, topology, threshold values, physical pins, state order, or profile inclusion requires a new row and rerun of the affected audit.

+ 90 - 0
docs/architecture/6400-v1-design-lock.md

@@ -0,0 +1,90 @@
+# 6400-front-rear-v1 design lock
+
+Status: FROZEN for this task after the five audits in `docs/audits/`. Changes require an explicit decision-register entry and affected-audit rerun.
+
+## Product boundary
+
+- Device: EF2L45BG256B; one 25 MHz clock domain; no PLL, generated clock, gated clock, or CDC.
+- Four 6-DIMM execution lanes: L0 CPU0 slots 0-5, L1 CPU0 slots 6-11, L2 CPU1 slots 0-5, L3 CPU1 slots 6-11.
+- Three physical thermal zones: Z0=L0, Z1=L1+L2, Z2=L3.
+- 24 independent PTC duties, 4 front-fan duties, 4 rear-fan duties; every output is exact 500 Hz.
+- All 24 DIMMs are acquired, controlled, protected, simulated, and telemetered. L0-L2 are the 18-channel primary modelling cohort; L3 is a 6-channel holdout only for model fitting.
+- No motor, limit, door percentage, startup motor calibration, solenoid, fan FG, PLL, MCU/SoC, online learning, or Host watchdog.
+
+## Physical interfaces
+
+- BMC RS-232: UART1 / CON77, FPGA TX L10 and RX M9, 115200 8N1.
+- Host RS-232: UART2 / CON78, FPGA TX M10 and RX N11, 921600 8N1.
+- Host TTL: complete `host_ttl_rx`/`host_ttl_tx` 3.3 V interface in RTL. Its connector and balls are deliberately unbound until evidence proves them.
+- Host RS-232 and TTL RX each have a two-flop synchronizer. The first detected start bit selects one port for the complete request/response transaction. Only the selected TX toggles; the other remains high. Simultaneous use is out of contract.
+- CT7428: one open-drain I2C master on M8/N9; three devices 0x49, 0x48, 0x4B; nine registers each; all 27 values are retained with raw, converted, valid, age, source index, and epoch.
+- BMC poll command is exactly `ipmitool raw 0x36 0x6c 0xdf 0xdd 0x00 0x03\n`. The streaming parser accepts case-insensitive hex separated by whitespace/CR/LF, rejects malformed or non-48-byte replies, and never commits a partial snapshot. Each two-byte `FF FF` value is invalid, never 0 C.
+
+## Host wire protocol
+
+Frame: `A5 5A | TYPE | LENGTH | PAYLOAD | CRC_LOW | CRC_HIGH`. CRC-16/CCITT-FALSE covers TYPE, LENGTH, and payload. Invalid header, length, CRC, type, target, or timeout is silently discarded. There is no NACK, version, project ID, capability, sequence, transaction ID, timestamp, TLV, command queue, or parallel outstanding transaction.
+
+- `0x01 SET_TARGET`, payload length 1: `0` enters STOPPED; `20..70` atomically commits the global Celsius target; all other values are rejected. A legal commit returns `0x81 SET_TARGET_ACK`, zero payload. ACK means commit only.
+- `0x02 GET_SNAPSHOT`, zero payload: returns `0x82 SNAPSHOT_DATA`; DATA is the only reply.
+- `0x03 SET_STIMULUS`, identification and sim-debug profiles only: duration 1..255 seconds, 24 PTC duties, 4 front duties, 4 rear duties, all 0..100; legal atomic commit returns zero-payload `0x83`. Production removes the decoder path at compile time.
+- The Host may retry idempotent SET_TARGET after an ACK timeout. HTH permits one outstanding transaction only.
+
+The snapshot layout is generated from `contracts/6400-snapshot.yaml`, is fixed and under 200 bytes, and contains state/fault/target/source flags; BMC, CT, and control epochs and ages; 24 BMC raw pairs and valid bits; 27 CT raw values and valid bits; requested/applied PTC/front/rear duties; safety mask; lane faults; and global fault. TX locks bank IDs and streams offsets without copying the payload into flip-flops.
+
+## Control sequence
+
+Reset values: target 70 C, PTC 0, front/rear fan 10, epochs/valid/integrators clear.
+
+1. `RESET_SAFE`: enforce safe outputs, then enter `WAIT_CT_VALID`.
+2. `WAIT_CT_VALID`: wait for a complete valid CT scan required by the channel map.
+3. `PREHEAT_CT`: per-channel conservative CT feedback targets `target-5 C`; BMC polling continues.
+4. `WAIT_BMC_STABLE`: require three distinct complete valid BMC epochs.
+5. `AUTO_BMC`: one shared incremental-PI datapath updates channels 0..23 exactly once per new BMC epoch.
+6. `SENSOR_DEGRADED`: invalid channel disables that PTC and freezes its state; lane-level invalidity disables the lane and raises both fans; global BMC stale disables all PTC and sets all fans to 100.
+7. `STOPPED`: all PTC off, fan stop-safe value, acquisition and GET remain active. A later legal nonzero target restarts through the CT/BMC qualification sequence.
+
+Host connection state never changes the autonomous state machine. `host_target_seen` is telemetry only.
+
+## PI and supervision
+
+- Internal temperature unit: 0.01 C. Raw BMC bytes are always retained; until scaling evidence is complete, conversion is isolated behind the generated format contract.
+- One physical incremental PI datapath: `u[k]=u[k-1]+Kp*(e[k]-e[k-1])+Ki*e[k]`; Kd is zero in V1.
+- Coefficients have only EDGE (L0/L3) and CENTER (L1/L2) classes and are generated. Defaults are labelled `SIMULATION_DEFAULT_NOT_HARDWARE_TUNED`.
+- Required behavior: saturation, anti-windup, slew limiting, invalid/stale/safety freeze, epoch gating, CT-to-BMC and target-change bumpless transfer, and safe recovery.
+- One lane-statistics supervisor scans lanes sequentially and produces independent front/rear targets. It does not instantiate eight fan PIDs.
+
+## Safety
+
+Safety has final priority over autonomous and stimulus requests.
+
+- At 74 C: block positive integration, reduce the channel PTC, and increase lane airflow.
+- At 76 C: force the channel PTC off and raise both lane fans.
+- At or above 77 C: force all six lane PTCs off, set both lane fans to 100, and latch lane fault.
+- BMC stale: all 24 PTCs off and all 8 fan duties 100.
+- Invalid BMC channel: that PTC off and its controller frozen. Multiple invalid channels in a lane close the lane.
+- Recovery requires every relevant temperature at or below `target+2 C`, three distinct valid BMC epochs, and fresh sensors. Recovery starts from limited duty with reset/bumpless PI state.
+- Stimulus expires automatically and cannot bypass safety or maximum duty.
+
+This proves only deterministic electrical override after a sampled condition. Physical overshoot and the 77 C product objective remain NOT RUN.
+
+## PWM and storage
+
+- One global 0..99 phase, one 0..499 subcounter, one channel index, one synchronous duty read, one comparator, one 32-bit `next_bitmap`, and one 32-bit `active_bitmap`.
+- During each phase, scan all 32 requested/applied duties into `next_bitmap`. At the phase boundary atomically assign `active_bitmap <= next_bitmap`.
+- `duty=0` is always off; `100` always on; 1..99 are exact phase counts. Compile-time polarity masks drive physical pins.
+- BMC, CT, requested duties, snapshot view, and applicable parameters use inactive-bank writes plus a single bank-pointer flip. No large active-array copy is allowed.
+
+## Profiles
+
+- `6400-control`: production autonomous implementation; no stimulus/raw-manual path.
+- `6400-identification`: adds finite `SET_STIMULUS` under the same safety path.
+- `6400-sim-debug`: accelerated counters and observability; never a production source closure.
+- `legacy-door-percent`: retains the previous door product and its own nearest-scope contract; it cannot affect 6400 generation or closure.
+
+## Explicit unknowns
+
+- TTL Host physical balls/connector.
+- CT physical channel-to-DIMM mapping where current board evidence is insufficient.
+- BMC fractional byte scaling pending protocol evidence; raw bytes remain canonical.
+
+Unknowns are generated as explicit unbound/unknown fields and do not block logic simulation, Host software, lab replay, or the remaining known-pin production closure. A production TD run cannot claim a complete TTL physical interface until those pins are resolved.

+ 21 - 0
docs/architecture/6400-v1-resource-strategy.md

@@ -0,0 +1,21 @@
+# 6400-front-rear-v1 resource strategy
+
+Order: function, deterministic safety, LUT, packed Slice, then use of DSP/eRAM/DFF/cycles.
+
+The design uses one physical unit for PWM comparison, PI arithmetic, safety temperature comparison, lane statistics, Host parser/command/CRC/TX, CT I2C, BMC hex parsing, snapshot streaming, and channel scheduling where deadlines permit. Host and BMC byte RX remain separate because they can receive concurrently.
+
+Arrays are written in synchronous single/dual-port inference style. Vendor RAM/DSP primitives, if required, are isolated in wrappers. No AXI, Wishbone, APB, crossbar, dynamic plug-in bus, per-channel controller instance, or per-channel PWM counter is permitted.
+
+The recorded A/B set is:
+
+- binary versus one-hot control FSM;
+- fixed 27-clock versus fractional 27/28 Host UART;
+- dedicated versus shared BMC TX serializer;
+- FF arrays versus inferred eRAM;
+- positional versus incremental PI;
+- parallel versus sequential safety comparison;
+- element copy versus bank pointer;
+- independent versus shared CRC;
+- payload copy versus snapshot streaming.
+
+Each candidate must pass the same functional and applicable formal tests and meet timing before LUT/Slice comparison. The rejected source and receipts remain under `receipts/resource-ab/`; the selected implementation is justified by measured TD data, not intuition.

+ 27 - 0
docs/architecture/6400-v1-safety.md

@@ -0,0 +1,27 @@
+# 6400-front-rear-v1 safety contract
+
+Priority, highest first:
+
+1. reset and global BMC stale;
+2. lane hard limit at 77 C;
+3. channel invalid/pretrip and lane invalid policy;
+4. soft-limit shaping at 74 C;
+5. finite identification stimulus;
+6. autonomous PI and fan supervision.
+
+At reset, PTC is 0 and every logical fan target is 10. No state may heat before the required CT scan is valid. AUTO requires three distinct complete BMC epochs. Re-reading one epoch is never qualification or integration.
+
+| Condition | PTC result | Fan result | Controller state |
+| --- | --- | --- | --- |
+| BMC stale | all 0 | all 100 | SENSOR_DEGRADED |
+| channel invalid | channel 0 | lane raised as configured | channel frozen |
+| lane invalid threshold | lane six 0 | lane front/rear raised | lane degraded |
+| >=74 C | positive integration blocked, duty reduced | lane raised | soft-limited |
+| >=76 C | channel 0 | lane protection duty | pretrip |
+| >=77 C | lane six 0 | lane front/rear 100 | lane fault latched |
+| STOPPED | all 0 | stop-safe target | STOPPED |
+| reset | all 0 | all 10 | RESET_SAFE |
+
+Recovery requires fresh sensors, three new valid epochs, and temperature <= target+2 C. It clears unsafe controller memory before ramping. Stimulus duration is bounded in hardware and safety always overrides it.
+
+Formal and simulation acceptance checks output action and state timing only. They are not thermal or hardware validation.

+ 64 - 0
docs/audit/current-state.md

@@ -0,0 +1,64 @@
+# 6400-front-rear-v1 current-state audit
+
+Status: SOURCE audit completed on 2026-08-22 (Pacific/Honolulu). Historical receipts are evidence inputs, not current-run passes.
+
+## Git and workspace
+
+- Editable authority: `/root/workspaces/thermal-system/cpld-temperature-control` on the Debian 13 Linux filesystem.
+- Task branch: `feature/6400-front-rear-v1`, commit `120504e482ab463e9aabeea966c93169f946208a`, clean at audit start.
+- The Windows 6400 worktree contains unknown staged, unstaged, and untracked changes and was not modified.
+- The task branch contains the committed 6400 TD packaging tip and current Legacy door/MSE history. The later HTH history is present on `origin/dev` and `origin/hth-r6-watchdog-actor`, not in the task branch tree. HTH must therefore be split from Git history, not copied from the current tree.
+- `origin/dev` is at `5e676e88c6653b54b6b86d67b93a6f8d18d2d3ca`; the merge base with the task branch is `8fa4dcfbaaa4b049bca675fa4567c0a1b315f339`.
+
+## Existing 6400 implementation
+
+The committed `prod2u-6400-front-back` target is a useful board-output and tool-flow baseline, but it is not the active V1 product:
+
+- 25 MHz, `EF2L45BG256B`, one Host RS-232 port at 115200.
+- Host `SET_ALL` directly commits 24 PTC plus 8 fan duties; successful SET has no ACK.
+- `GET_TEMPERATURE` triggers a 27-channel CT7428 read and returns `0x82`.
+- A 30-second Host-fed watchdog forces PTC 0 / fan 10.
+- There is no BMC data plane, autonomous state machine, PI controller, safety supervisor, fixed snapshot, Identification stimulus, dual Host selector, or TTL Host port.
+- The shared PWM concept is present, but the current module updates output bits during the scan window instead of building a next bitmap and switching all 32 bits atomically at a phase boundary.
+- The existing dual-bank duty store is suitable evidence for bank-flip semantics, but direct Host duty control is outside the new 6400 production contract.
+
+The new implementation must replace this behavior without importing door motors, limits, startup calibration, door-percent payloads, legacy watchdog semantics, or motor status into the 6400 profiles.
+
+## Board and electrical evidence
+
+Confirmed from `config/pin_inventory.fcb_fpga_mcu0611.json` plus the board-viewer annotations:
+
+- Clock: J1, 25 MHz.
+- UART1 / CON77: FPGA TX L10 -> U22 -> CON77.1 RS-232; CON77.2 -> U22 -> FPGA RX M9.
+- UART2 / CON78: FPGA TX M10 -> U23 -> CON78.1 RS-232; CON78.2 -> U23 -> FPGA RX N11.
+- The active contract assigns UART1/CON77 to BMC at 115200 and UART2/CON78 to Host RS-232 at 921600.
+- PTC outputs are 24 confirmed active-high channels on the existing HEAT mapping.
+- Fan outputs are four logical front plus four logical rear channels. Their existing eight FPGA assignments remain the board baseline; fan command-to-pin polarity is active-low at the FPGA output.
+- CT7428 I2C uses M8/N9 as open-drain signals and scans three devices at 0x49, 0x48, 0x4B, registers 0..8.
+
+Not frozen and therefore not guessed:
+
+- Host TTL RX/TX connector and FPGA balls.
+- Physical CT7428 channel-to-DIMM placement and any connector mechanical ordering not proven by current evidence.
+- Exact BMC two-byte fractional scaling beyond preserving raw bytes. Existing evidence establishes 24 two-byte values and `FF FF` invalid encoding.
+
+The exact historical BMC poll command is preserved as evidence: `ipmitool raw 0x36 0x6c 0xdf 0xdd 0x00 0x03` followed by LF. The response parser consumes exactly 48 decoded data bytes and treats six echoed command bytes separately.
+
+## Existing tool and evidence state
+
+- Debian 13 and Podman are available. The only useful pinned base already present is Debian trixie digest `sha256:fac46bff2e02f51425b6e33b0e1169f55dfb053d83511ca28aa50c09fd5ed7a4`.
+- The WSL host currently lacks Icarus, Verilator, Yosys, SymbiYosys, solvers, Go, pytest, and `td2026`; these must be supplied through the locked Debian container and persistent tool volumes.
+- Historical 6400 synthesis estimated 957 gate LUT / 464 REG, but it was synthesis-only, returned `-11`, omitted route/bitstream acceptance, and implemented the superseded direct-duty design. It is not a pass for this task.
+- Historical Host, Formal, TD, and packaging receipts remain non-authoritative until current Linux commands reproduce the applicable layer.
+
+## Required migration
+
+1. Freeze the new channel, wire, snapshot, fixed-point, and safety contracts.
+2. Preserve Legacy as a buildable profile while moving its local authority beneath `products/legacy-door-percent`.
+3. Build production, identification, and simulation/debug 6400 profiles from a shared implementation.
+4. Split HTH with real Git history from the latest Host-bearing commit lineage.
+5. Establish XML-only manifests and an independent lab repository.
+6. Replace direct-duty Host control with autonomous BMC-driven 24-channel control and deterministic safety overrides.
+7. Re-run every non-hardware gate and bind TD/bitstream/package receipts to exact commits and generated-contract hashes.
+
+Hardware, JTAG, COM, real BMC, real UART, and real thermal performance are NOT RUN.

+ 30 - 0
docs/audit/evidence-matrix.md

@@ -0,0 +1,30 @@
+# 6400-front-rear-v1 evidence matrix
+
+| Claim | Evidence | Confidence / action |
+| --- | --- | --- |
+| FPGA and clock are EF2L45BG256B / 25 MHz / J1 | Current project JSON, existing ADC, board inventory | Confirmed |
+| UART1 is CON77 RS-232 at L10 TX / M9 RX | Pin inventory rows 117-118 and board annotations | Confirmed; assign BMC by active contract |
+| UART2 is CON78 RS-232 at M10 TX / N11 RX | Pin inventory rows 119-120 and board annotations | Confirmed; assign Host RS-232 by active contract |
+| Host TTL is a full 3.3 V interface | Active task contract | RTL required; balls/connector unresolved and left unconstrained |
+| 24 PTC outputs and their FPGA balls | Existing 6400 project JSON/ADC and board inventory | Confirmed board baseline |
+| 4 front + 4 rear logical fan duties | Active contract plus existing 8-output board mapping | Confirmed logical topology; physical fan behavior still NOT RUN |
+| Fan FPGA outputs are active low | Active contract and existing board contract | Confirmed source contract; physical fan validation NOT RUN |
+| CT7428 bus is M8/N9 open drain | Existing 6400 project, inventory, and annotations | Confirmed electrical path |
+| CT physical channel-to-DIMM order | No complete current evidence | Unknown; raw index retained, no invented mapping |
+| BMC poll command | Historical production RTL before commit `ddd52a2` | Confirmed string: `ipmitool raw 0x36 0x6c 0xdf 0xdd 0x00 0x03\n` |
+| BMC payload is 24 x 2 bytes; `FF FF` invalid | Historical RTL/tests plus active contract | Confirmed raw layout; decimal scaling remains explicit unknown |
+| 4 lanes are 6 DIMMs each; zones are 6+12+6 | Active task contract | Frozen product topology |
+| Primary cohort is L0-L2 (18), holdout is L3 (6) | Active task contract | Frozen; all 24 remain controlled and protected |
+| Host frame is A5 5A, CRC16/CCITT-FALSE little-endian CRC | Active task contract and reusable common RTL | Frozen |
+| Existing Host code has real Git history | `git log --all -- host` through `origin/dev`/HTH branches | Confirmed; use history split |
+| Existing 6400 direct-duty RTL satisfies V1 | Source review | Rejected; superseded architecture |
+| Historical TD/bitstream proves the new V1 | Historical receipts | Rejected; wrong design and/or non-current run |
+| Physical 77 C containment | No hardware test | NOT RUN; RTL can only prove deterministic override after observation |
+
+## Evidence classes
+
+- SOURCE: baseline audit complete; implementation in progress.
+- SIMULATION: NOT RUN for the new V1.
+- FORMAL: NOT RUN for the new V1.
+- TD SYNTHESIS / PLACE & ROUTE / BITSTREAM: NOT RUN for the new V1.
+- HARDWARE / JTAG / COM / THERMAL PERFORMANCE: NOT RUN.

+ 21 - 0
docs/audits/01-requirements-product-boundary.md

@@ -0,0 +1,21 @@
+# Audit 1 - requirements and product boundary
+
+Result: PASS at design-lock level. Production implementation remains to be verified.
+
+## Independent checks
+
+- The old root authority mixes door-percent/MSE priorities into 6400. The new lock confines every motor, limit, calibration, motor-status, 20 Hz PWM, door payload, and legacy watchdog rule to `legacy-door-percent`.
+- The planned 6400 profile contains exactly 24 PTC, four front-fan, four rear-fan, 27 CT, and 24 BMC temperature channels. It does not model “three zones” as three fan channels.
+- The topology distinguishes L0/L1/L2/L3 execution from Z0/Z1/Z2 physical grouping.
+- The modelling split is 18 primary plus 6 holdout; it does not remove acquisition, control, safety, telemetry, or testing from the holdout lane.
+- No RDIMM/MRDIMM coprocessor, MCU/SoC, door hardware, fan FG, PLL, or online algorithm is in V1.
+- The Host wire contract contains no version, project ID, sequence, NACK, capability, or dynamic discovery.
+- `host_target_seen` is telemetry only; Host absence cannot disable autonomous operation.
+
+## Correction made before PASS
+
+The pre-existing 6400 direct-duty SET_ALL/watchdog architecture was rejected rather than treated as an incremental V1 implementation. The lock now defines target-only Host control and autonomous startup.
+
+## Follow-up gates
+
+Generator tests must prove exact counts/profile isolation, and source-closure tests must fail on any motor/limit/watchdog/stimulus leakage into production.

+ 22 - 0
docs/audits/02-board-electrical-evidence.md

@@ -0,0 +1,22 @@
+# Audit 2 - board and electrical evidence
+
+Result: PASS with explicit unresolved TTL and CT placement fields.
+
+## Independent evidence review
+
+- CON77/UART1 is a real RS-232 path through U22: L10 TX and M9 RX. It is suitable for the contract-assigned BMC port.
+- CON78/UART2 is a separate real RS-232 path through U23: M10 TX and N11 RX. It is suitable for Host RS-232.
+- The old `locked_debug_uart_assignments` using T4/R5/P7/P8 conflict with PTC HEAT pins and are explicitly historical/diagnostic; they are not selected.
+- TTL Host has no complete connector-to-ball chain in current evidence. RTL ports remain, while ADC bindings are absent and marked unknown.
+- PTC and eight logical fan output balls are carried from the committed 6400 board contract. Output polarity is compile-time and fans are active-low at FPGA pins.
+- CT7428 I2C M8/N9 is open-drain. No push-pull-high assignment is permitted.
+- The 27 CT register indices are known; physical DIMM placement is not. The map records unknown rather than inventing a permutation.
+- Exact BMC command text and 48 decoded response bytes are recovered from Git history. Fractional temperature semantics are not overclaimed.
+
+## Pin-conflict result
+
+Known 6400 production pins are unique after assigning BMC to UART1 and Host RS-232 to UART2. Unbound TTL pins are excluded from the production ADC until resolved, so the physical TTL portion cannot be called hardware-complete.
+
+## Follow-up gates
+
+The generator must detect duplicate balls, reject a guessed CT map, and make unresolved TTL status visible in the project summary and final report.

+ 22 - 0
docs/audits/03-rtl-reuse-resource-structure.md

@@ -0,0 +1,22 @@
+# Audit 3 - RTL reuse and resource structure
+
+Result: PASS at architecture level.
+
+## Independent structural review
+
+- The design has one shared incremental-PI arithmetic engine for 24 logical loops and only two coefficient classes. No generate loop may instantiate 24 controllers.
+- PWM has one carrier and comparator, but persistent 32-bit output registers are retained because outputs must remain continuously driven.
+- BMC and Host have independent RX byte frontends for true concurrency; downstream parsing and scheduling remain compact and deterministic.
+- One fixed-priority service scheduler is sufficient; no generic on-chip bus or dynamic interconnect is introduced.
+- BMC, CT, duty, and snapshot state uses inactive-bank writes plus pointer flips. Large FF array copies are rejected.
+- Snapshot transmission is address-streamed from locked banks. A 200-byte FF payload buffer is rejected.
+- RAM/DSP inference will use synchronous coding and isolated wrappers only. The old 32x8 target banks remaining in FFs are historical evidence, not proof that all new arrays should use FFs.
+- Safety is sequentially scanned by the shared comparator but commits final overrides before output application. Static budgets must prove no PWM/UART deadline miss or scheduler starvation.
+
+## Corrective action before PASS
+
+The existing phase scanner updates physical bits one by one. The lock replaces it with `next_bitmap` plus an atomic boundary transfer.
+
+## Follow-up gates
+
+Lint/Yosys hierarchy checks must count physical instances; formal must cover bank isolation, scan completion, scheduler progress, and atomic output switching; TD A/B receipts decide the final encodings.

+ 23 - 0
docs/audits/04-protocol-state-safety.md

@@ -0,0 +1,23 @@
+# Audit 4 - protocol, state machine, and safety
+
+Result: PASS at frozen-contract level.
+
+## Independent behavior review
+
+- SET_TARGET accepts only one byte: 0 or 20..70. Legal commit precedes a zero-length `0x81` ACK. All invalid requests are silent drops.
+- GET_SNAPSHOT is zero-length and returns only `0x82` data. There is one outstanding Host transaction and no queue or sequence matching.
+- Port selection locks at the first start bit and survives through response completion; only the selected TX is active.
+- The BMC parser is streaming, case-insensitive, separator-tolerant, and commits exactly 48 bytes. Partial, short, long, invalid, timed-out, echo-only, or UART-error input cannot advance the epoch.
+- PREHEAT depends on valid CT, AUTO depends on three distinct BMC epochs, and repeated GET cannot cause repeated PI integration.
+- Global BMC stale forces all PTC off/all fans 100. Invalid and 74/76/77 C actions are more immediate than normal PI requests.
+- STOPPED keeps acquisition/GET active and requires safe requalification before returning to heat.
+- Identification stimulus has a hardware expiry and is absent from production source closure.
+- Snapshot locks bank and epoch identity for the whole frame.
+
+## Correction made before PASS
+
+The pre-existing Host watchdog and direct 32-duty SET_ALL were removed from the frozen 6400 behavior. Host disconnection now has no autonomous-state effect.
+
+## Follow-up gates
+
+Simulation/fuzz/formal must test bad CRC no target change, ACK-after-commit only, stale/invalid/hard-limit priority, epoch gating, recovery, port lock, stimulus expiry, and reset-safe outputs.

+ 23 - 0
docs/audits/05-multirepo-environment-replay.md

@@ -0,0 +1,23 @@
+# Audit 5 - repositories, environment, and replay
+
+Result: PASS for the migration plan; repository creation and current-run gates remain execution work.
+
+## Independent reproducibility review
+
+- Four and only four current-scope repositories are planned: engineering-manifests, cpld-temperature-control, hth-platform, thermal-control-lab.
+- HTH has a substantial Host-bearing history on `origin/dev` and HTH branches. A history split is required; copying the directory and claiming history would fail.
+- Legacy remains a CPLD profile and build target. Its nearest `AGENTS.md` owns door behavior; 6400 authority moves away from the root.
+- Android Repo XML is the single repository inventory. No workspace YAML duplicates repository rows.
+- The authoritative editable workspace is Linux-native under `/root/workspaces/thermal-system`; Windows copies and unknown worktrees remain untouched.
+- The base runtime is Debian, not Ubuntu. Container digest and every tool version must be recorded; TD environment variables are scoped to the TD subprocess.
+- Lab uses only the HTH API and never opens a serial device directly.
+- Snapshot and release manifests bind exact full commits, generated-contract hashes, container digest, TD version, source manifest, commands, statuses, and bitstream hash.
+- Historical receipts are never promoted to current PASS. Clean replay must rebuild from the manifest without cache dependence.
+
+## Corrective action before PASS
+
+The original task branch did not contain the latest Host tree. The migration basis was changed to a Git-history split from the Host-bearing lineage while leaving the dirty Windows worktree untouched.
+
+## Follow-up gates
+
+Each new repository must end on clean `dev`, the snapshot verifier must resolve exact commits, HTH and Lab must pass standalone tests, and L14 must replay generation/test/TD/package from clean detached worktrees.