j6-bmc-replay-binary921-implementation-plan-v1.zh-CN.md 12 KB

J6 BMC-Replay Binary921 实施计划 v1

For agentic workers: REQUIRED SUB-SKILL: use an execution workflow and complete tasks in order. Do not mark board, TD, package, or hardware layers as pass unless that layer was actually run and its receipt is present.

Goal: 交付 debug-photo-bmc-replay-binary921 的可验证 SRAM-only 诊断链路,并把 formal-uart1-bmc-replay-binary921 保持为资源/可接性 blocked 的目标架构,直到 TD/resource 与 UART1/2 实测通过。

Architecture: 共享执行核心保留 BMC poll、DIMM cache、PWM、PID requested-but-inactive、timeout fallback;HostPort/DebugPort 改为 binary921 机器帧;PC harness 负责 capture/replay/decode/validate。PowerShell 只做启动包装,复杂解析都在 Python。

Tech Stack: Verilog RTL, TD 2026.1 project files, Python 3.12, PowerShell launch wrappers, pytest/unittest, JSON receipts, SRAM-only BitWriter.

Global Constraints

  • 当前权威 pin map 来自 reference/original/schematics/FCB_FPGA+MCU0611.pdf 和 config/pin_inventory.fcb_fpga_mcu0611.json。
  • Debug-photo 串口固定:BMC replay T4/R5 @115200,Host P7/P8 @115200,Debug P10/R10 @921600。
  • Formal-uart1 串口目标:BMC replay L10/M9,Host M10/N11,Debug 使用不冲突 spare GPIO。
  • BMC source 固定为 pc_replay_from_real_bmc_capture;CPLD 不直连 live BMC。
  • 不执行 flash;不安装驱动;不枚举未知 COM;不写 DebugPort。
  • 真实 PTC/FAN 未接入时必须写 real_fan_ptc_hardware_status=not_run。
  • 未运行 TD build、未刷 SRAM、未接板、未跑 validator 的层级不得写 pass。

Task 1: 冻结协议与文档合同

Files:

Interfaces:

  • Consumes: existing ASCII contract docs/host-cpld-uart-spec-v1.zh-CN.md
  • Produces: binary frame definitions for RTL, Python harness, validator, package docs.

  • [ ] Verify docs contain no placeholder markers or unfinished sections.

  • [ ] Verify every pass claim is scoped to a layer.

  • [ ] Verify formal-uart1 is blocked until UART1/2 access and TD/resource pass.

Run:

python -m pytest tests/test_project_structure.py -q

Expected: pass. If project structure tests do not check these docs yet, add a focused test before implementing code changes.

Task 2: Python binary921 protocol library

Files:

Interfaces:

  • Produces:

    • encode_frame(profile_id, frame_type, seq, timestamp_tick, payload) -> bytes
    • decode_frame(data: bytes) -> Binary921Frame
    • decode_stream(data: bytes) -> tuple[list[Binary921Frame], bytes]
    • build_host_command(profile_id, seq, cmd_id, channel, value) -> bytes
  • [ ] Add tests for encode/decode roundtrip, CRC mismatch, bad length, seq gap detection support, unknown frame type, profile mismatch.

  • [ ] Add tests for PTC00/PTC25/FAN00/FAN05/value>100 negative command fixtures.

  • [ ] Implement minimal library until tests pass.

Run:

python -m pytest tests/unit/test_binary921_protocol.py -q

Expected: pass.

Task 3: BMC capture/replay harness

Files:

Interfaces:

  • Produces:

    • capture-bmc CLI: raw text -> normalized 48-byte payload JSON.
    • replay-bmc CLI: wait for CPLD poll then reply payload.
    • validate-payload path used by collector.
  • [ ] Test loose real-BMC text with echo, spaces, commas, 0xNN, and exactly 48 payload bytes.

  • [ ] Test ff ff missing DIMM handling.

  • [ ] Test reply only after full poll text, not on partial or wrong command.

  • [ ] Test receipt fields bmc_source, live_bmc_link_status, replay_mode, payload_sha256.

Run:

python -m pytest tests/unit/test_bmc_replay_tool.py -q

Expected: pass.

Task 4: RTL binary debug/host core

Files:

Interfaces:

  • Consumes: protocol spec frame fields.
  • Produces: DebugPort binary frames and HostPort binary ACK/NACK.

  • [ ] Add RTL sim checks for READY, BMC poll-response, SENSOR_CACHE, 12 Host ACKs, PWM state, PID inactive, timeout fallback.

  • [ ] Add bad host frame checks: CRC, length, channel, command.

  • [ ] Implement binary frame TX and host RX with CRC.

  • [ ] Keep debug-photo and formal wrappers separate.

Run:

python tools\pid_harness.py hdl-sim --run --backend icarus --json

Expected: binary921 sim pass. If Icarus is unavailable, report blocked toolchain, not pass.

Task 5: Pin profile wrappers and constraints

Files:

Interfaces:

  • Produces: generated pin inventory/receipt facts used by package manifests.

  • [ ] Assert debug-photo 6 PTC remaps do not collide with UART/CLK/RST/LED/FAN.

  • [ ] Assert formal-uart1 keeps all HEAT/FAN/FG/INSTALL real pins.

  • [ ] Assert formal-uart1 hardware access remains blocked until explicit continuity evidence is present.

Run:

python -m pytest tests/unit/test_pin_inventory.py -q

Expected: pass.

Task 6: Collector and validator

Files:

Interfaces:

  • Consumes: tools/binary921.py, BMC replay receipt JSON.
  • Produces: strict binary921 evidence receipt.

  • [ ] Collector opens only explicit Host/Debug COM.

  • [ ] Collector never writes DebugPort.

  • [ ] Collector waits for post-SRAM READY epoch.

  • [ ] Validator blocks missing BMC replay, ACK mismatch, seq gap, CRC error, sensor cache missing, PID active, timeout mismatch.

  • [ ] Validator preserves real_fan_ptc_hardware_status=not_run without turning it into hardware pass.

Run:

python -m pytest tests/unit/test_uart_receipts.py -q
python -m pytest tests/unit/test_remote_scripts.py -q

Expected: pass.

Task 7: TD build and resource gates

Files:

  • Modify/Create: td/*.prj, td/syn/*.tcl, td/phy/*.tcl for both binary921 profiles.
  • Receipt output location: agreed package/build receipt directory, not ephemeral td/build alone.

Interfaces:

  • Produces: TD bitstream, .qor/.area/timing, TD receipt, resource status.

  • [ ] Run debug-photo TD build.

  • [ ] Save QOR/area/timing/resource receipt.

  • [ ] If formal TD build fails or UART1/2 access is unverified, produce blocked formal package only.

Run:

python tools\pid_harness.py td-build --run --top uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921 --json
python tools\pid_harness.py td-build --run --top uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921 --json

Expected:

  • debug-photo must pass before可刷发布。
  • formal may be blocked; blocked must be explicit and cannot ship as pass bitstream.

Task 8: Package and runbook

Files:

  • Modify/Create: tools/package_j6_binary921.ps1
  • Package output: C:\Users\Administrator\Downloads\CPLD-deliverables\j6bin-debug-photo-<timestamp> and .zip

Interfaces:

  • Produces: short-path j6bin.bit, START-HERE.zh-CN.md, Python tools, PowerShell wrappers, manifest, SHA256 inventory.

  • [ ] Package root contains short j6bin.bit.

  • [ ] START-HERE says: start replay, start collector, then manual PROGRAM_SRAM.

  • [ ] Safety scan: no Set-ExecutionPolicy, no COM enumeration, no DebugPort write, no pip/driver install, no flash.

  • [ ] Run package directory selftest.

  • [ ] Unzip package to temp dir and run selftest again.

Run:

powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\tools\package_j6_binary921.ps1 -Profile debug-photo-bmc-replay-binary921 -Bitstream <debug-photo-bit> -TdReceipt <td-json> -ForceOverwrite

Expected: package directory and zip hash inventory pass.

Task 9: Board evidence

Files/Artifacts:

  • BMC capture payload JSON.
  • BMC replay receipt JSON.
  • binary921 collector receipt JSON.
  • Debug binary stream artifact.
  • Host transcript artifact.
  • manifest and SHA256 inventory.

Manual sequence:

  1. Start BMC replay.
  2. Start collector.
  3. Manually run PROGRAM_SRAM.
  4. Wait for collector result.
  5. Run validator strict.

Expected debug-photo result:

  • Host ACK 12/12 pass。
  • BMC replay poll-response pass。
  • SENSOR cache 24 DIMM pass。
  • PWM/PID/timeout pass。
  • real_fan_ptc_hardware_status=not_run unless真实负载已接并有独立 gate。

Task 10: Final gate and reporting

Files:

  • Final report in package or receipt output directory.

Required reporting:

  • package folder clickable path。
  • package zip clickable path。
  • START-HERE.zh-CN.md clickable path。
  • ZIP SHA256。
  • Changed files。
  • Commands run。
  • Passed/blocked/not_run layers。
  • Formal-uart1 blocked reason。

Run:

python -m pytest -q
python tools\pid_harness.py static

Expected: local tests pass; board-only actions listed as not_run until user evidence returns.