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

Add production two-UART binary921 BMC replay package

Codex 4 месяцев назад
Родитель
Сommit
97c897fe4f
39 измененных файлов с 7265 добавлено и 42 удалено
  1. 61 0
      constraints/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.adc
  2. 61 0
      constraints/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.adc
  3. 59 0
      constraints/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.adc
  4. 92 0
      docs/adr/0001-j6-bmc-replay-binary921-boundaries.zh-CN.md
  5. 15 0
      docs/adr/README.zh-CN.md
  6. 202 0
      docs/j6-bmc-replay-binary921-architecture.zh-CN.md
  7. 270 0
      docs/j6-bmc-replay-binary921-implementation-plan-v1.zh-CN.md
  8. 179 0
      docs/j6-bmc-replay-binary921-protocol-v1.zh-CN.md
  9. 411 0
      receipts/bmc_replay_payload_production_two_uart_20260710T0805Z.json
  10. 420 0
      receipts/td_production_two_uart_bmc_replay_binary921_20260710T0843Z.json
  11. 22 0
      src/rtl/binary921_crc16.v
  12. 741 0
      src/rtl/binary921_diag_core.v
  13. 147 0
      src/rtl/binary921_frame_tx.v
  14. 200 0
      src/rtl/binary921_host_rx.v
  15. 56 0
      src/top/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top.v
  16. 56 0
      src/top/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top.v
  17. 57 0
      src/top/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top.v
  18. 15 0
      td/phy/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.tcl
  19. 15 0
      td/phy/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.tcl
  20. 15 0
      td/phy/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.tcl
  21. 20 0
      td/syn/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.tcl
  22. 20 0
      td/syn/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.tcl
  23. 20 0
      td/syn/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.tcl
  24. 34 0
      td/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.prj
  25. 34 0
      td/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.prj
  26. 34 0
      td/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.prj
  27. 490 0
      tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_binary921_top_tb.v
  28. 230 0
      tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top_tb.v
  29. 236 0
      tests/unit/test_binary921_protocol.py
  30. 177 0
      tests/unit/test_bmc_replay_tool.py
  31. 66 0
      tests/unit/test_pin_inventory.py
  32. 831 25
      tests/unit/test_remote_scripts.py
  33. 359 0
      tools/binary921.py
  34. 89 0
      tools/bmc_replay_uart.py
  35. 561 0
      tools/package_j6_binary921.ps1
  36. 111 0
      tools/pid_harness.py
  37. 76 17
      tools/pin_inventory.py
  38. 729 0
      tools/remote/collect_j6_binary921.py
  39. 54 0
      tools/uart_receipts.py

+ 61 - 0
constraints/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.adc

@@ -0,0 +1,61 @@
+# uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921 constraints.
+# Pin profile: debug-photo-bmc-replay-binary921. Derived from config/pin_inventory.fcb_fpga_mcu0611.json.
+# SRAM-only diagnostic constraints; no flash or cable programming command is present.
+# BMC input is a PC replay from a real BMC capture; no live BMC link is claimed.
+# Board: fcb_fpga_mcu0611
+set_pin_assignment { sys_clk } { LOCATION = J1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { sys_rst_n } { LOCATION = N6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[0] } { LOCATION = H16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[1] } { LOCATION = H15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[2] } { LOCATION = J16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[3] } { LOCATION = J15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[4] } { LOCATION = K16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[5] } { LOCATION = K15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[6] } { LOCATION = L16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[7] } { LOCATION = L15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { bmc_uart_rx } { LOCATION = R5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { bmc_uart_tx } { LOCATION = T4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { debug_uart_rx } { LOCATION = P10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { debug_uart_tx } { LOCATION = R10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[0] } { LOCATION = D2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[1] } { LOCATION = D3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[2] } { LOCATION = E6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[3] } { LOCATION = D6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[4] } { LOCATION = C1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[5] } { LOCATION = C2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[6] } { LOCATION = B3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[7] } { LOCATION = B13; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[0] } { LOCATION = N10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[1] } { LOCATION = M11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[2] } { LOCATION = P12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[3] } { LOCATION = R11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[0] } { LOCATION = C4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[1] } { LOCATION = B5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[2] } { LOCATION = B1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[3] } { LOCATION = A14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { host_uart_rx } { LOCATION = P8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { host_uart_tx } { LOCATION = P7; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[0] } { LOCATION = F16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[1] } { LOCATION = G16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[2] } { LOCATION = P5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[3] } { LOCATION = T8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[4] } { LOCATION = T6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[5] } { LOCATION = R7; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[6] } { LOCATION = M1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[7] } { LOCATION = N1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[8] } { LOCATION = P1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[9] } { LOCATION = R1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[10] } { LOCATION = T2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[11] } { LOCATION = R3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[12] } { LOCATION = P16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[13] } { LOCATION = R16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[14] } { LOCATION = M16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[15] } { LOCATION = N16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[16] } { LOCATION = M14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[17] } { LOCATION = M15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[18] } { LOCATION = T9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[19] } { LOCATION = P9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[20] } { LOCATION = P15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[21] } { LOCATION = N14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[22] } { LOCATION = T13; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[23] } { LOCATION = T12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }

+ 61 - 0
constraints/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.adc

@@ -0,0 +1,61 @@
+# uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921 constraints.
+# Pin profile: formal-uart1-bmc-replay-binary921. Derived from config/pin_inventory.fcb_fpga_mcu0611.json.
+# SRAM-only diagnostic constraints; no flash or cable programming command is present.
+# BMC input is a PC replay from a real BMC capture through UART1; no live BMC link is claimed.
+# Board: fcb_fpga_mcu0611
+set_pin_assignment { sys_clk } { LOCATION = J1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { sys_rst_n } { LOCATION = N6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[0] } { LOCATION = H16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[1] } { LOCATION = H15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[2] } { LOCATION = J16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[3] } { LOCATION = J15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[4] } { LOCATION = K16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[5] } { LOCATION = K15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[6] } { LOCATION = L16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[7] } { LOCATION = L15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { bmc_uart_rx } { LOCATION = M9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { bmc_uart_tx } { LOCATION = L10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { debug_uart_rx } { LOCATION = M14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { debug_uart_tx } { LOCATION = M15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[0] } { LOCATION = D2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[1] } { LOCATION = D3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[2] } { LOCATION = E6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[3] } { LOCATION = D6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[4] } { LOCATION = C1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[5] } { LOCATION = C2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[6] } { LOCATION = B3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[7] } { LOCATION = B13; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[0] } { LOCATION = N10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[1] } { LOCATION = M11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[2] } { LOCATION = P12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[3] } { LOCATION = R11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[0] } { LOCATION = C4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[1] } { LOCATION = B5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[2] } { LOCATION = B1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[3] } { LOCATION = A14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { host_uart_rx } { LOCATION = N11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { host_uart_tx } { LOCATION = M10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[0] } { LOCATION = F16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[1] } { LOCATION = G16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[2] } { LOCATION = T4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[3] } { LOCATION = R5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[4] } { LOCATION = T6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[5] } { LOCATION = R7; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[6] } { LOCATION = M1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[7] } { LOCATION = N1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[8] } { LOCATION = P1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[9] } { LOCATION = R1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[10] } { LOCATION = T2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[11] } { LOCATION = R3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[12] } { LOCATION = P16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[13] } { LOCATION = R16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[14] } { LOCATION = M16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[15] } { LOCATION = N16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[16] } { LOCATION = P8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[17] } { LOCATION = P7; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[18] } { LOCATION = T9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[19] } { LOCATION = P9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[20] } { LOCATION = P10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[21] } { LOCATION = R10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[22] } { LOCATION = T13; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[23] } { LOCATION = T12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }

+ 59 - 0
constraints/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.adc

@@ -0,0 +1,59 @@
+# uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921 constraints.
+# Pin profile: production-two-uart-bmc-replay-binary921.
+# BMC replay UART1: L10/M9 @115200. Combined Host+Debug UART2: M10/N11 @921600.
+# SRAM-only diagnostic constraints; no flash or cable programming command is present.
+# Board: fcb_fpga_mcu0611
+set_pin_assignment { sys_clk } { LOCATION = J1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { sys_rst_n } { LOCATION = N6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[0] } { LOCATION = H16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[1] } { LOCATION = H15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[2] } { LOCATION = J16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[3] } { LOCATION = J15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[4] } { LOCATION = K16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[5] } { LOCATION = K15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[6] } { LOCATION = L16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { led[7] } { LOCATION = L15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { bmc_uart_rx } { LOCATION = M9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { bmc_uart_tx } { LOCATION = L10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { host_uart_rx } { LOCATION = N11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { host_uart_tx } { LOCATION = M10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[0] } { LOCATION = D2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[1] } { LOCATION = D3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[2] } { LOCATION = E6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[3] } { LOCATION = D6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[4] } { LOCATION = C1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[5] } { LOCATION = C2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[6] } { LOCATION = B3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_fg_in[7] } { LOCATION = B13; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[0] } { LOCATION = N10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[1] } { LOCATION = M11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[2] } { LOCATION = P12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_install_in[3] } { LOCATION = R11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[0] } { LOCATION = C4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[1] } { LOCATION = B5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[2] } { LOCATION = B1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { fan_pwm_out[3] } { LOCATION = A14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[0] } { LOCATION = F16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[1] } { LOCATION = G16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[2] } { LOCATION = T4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[3] } { LOCATION = R5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[4] } { LOCATION = T6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[5] } { LOCATION = R7; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[6] } { LOCATION = M1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[7] } { LOCATION = N1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[8] } { LOCATION = P1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[9] } { LOCATION = R1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[10] } { LOCATION = T2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[11] } { LOCATION = R3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[12] } { LOCATION = P16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[13] } { LOCATION = R16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[14] } { LOCATION = M16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[15] } { LOCATION = N16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[16] } { LOCATION = P8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[17] } { LOCATION = P7; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[18] } { LOCATION = T9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[19] } { LOCATION = P9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[20] } { LOCATION = P10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[21] } { LOCATION = R10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[22] } { LOCATION = T13; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { ptc_pwm_out[23] } { LOCATION = T12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }

+ 92 - 0
docs/adr/0001-j6-bmc-replay-binary921-boundaries.zh-CN.md

@@ -0,0 +1,92 @@
+# ADR-0001: J6 BMC-Replay Binary921 边界
+
+## Status
+
+Accepted
+
+## Date
+
+2026-07-09
+
+## Context
+
+J6 debug921 旧方案依赖 CPLD 内部拼接大量 ASCII `J6RAW/J6EVT/J6STAT/J6MAP/J6TEMP` 文本。历史资源审计显示资源压力主要来自 top 内 debug/report/text-generation 逻辑,而 PWM 执行本身相对小。用户现在要求重新规划多串口连接,CPLD 暂不直连 live BMC,改为 PC 抓取真实 BMC raw payload 后通过串口 replay。
+
+同时存在两个硬件目标:
+
+- 照片/现有可接点优先的 debug 版本,可以最快调试,但会占用 6 个真实 HEAT/PTC ball。
+- PDF/inventory 正式 pinout 版本,使用 UART1/2 释放真实 HEAT/PTC/FAN,但 UART1/2 可接性和 TD resource 仍需复核。
+
+## Decision Drivers
+
+- 需要减少 CPLD 内部 ASCII 拼接 LUT 压力。
+- 需要把人读日志生成放到 PC 端,CPLD 输出可校验机器证据。
+- 需要区分 live BMC、PC replay、盲发循环三种不同证据强度。
+- 需要严格避免把未运行的 TD/板级/真实负载/热闭环动作写成 pass。
+- 需要保留用户当前可接线调试路径。
+
+## Considered Options
+
+### Option 1: 继续 ASCII debug921
+
+- Pros: 人类可直接用串口助手阅读;与旧 collector/runbook 接近。
+- Cons: CPLD LUT 压力高;长文本字段容易引入解析/尾帧/十六进制/PowerShell 类型错误;formal 资源收敛困难。
+
+### Option 2: 二进制 DebugPort,HostPort 仍用 ASCII
+
+- Pros: 降低 DebugPort 文本拼接压力;Host 手工调试较简单。
+- Cons: 仍保留 Host ASCII parser 和 ACK 错位风险;Host/Debug 证据模型不统一。
+
+### Option 3: HostPort 和 DebugPort 都采用 binary921
+
+- Pros: 机器帧可 CRC、可 seq、可 profile 校验;CPLD 不再负责长文本;PC decoder 统一生成人读证据;最有机会降低 formal 资源压力。
+- Cons: 手工串口助手不能直接敲 ASCII 命令;需要 Python harness;初期实现和测试成本更高。
+
+## Decision
+
+采用 Option 3:HostPort 和 DebugPort 都采用 `binary921` 机器帧。BMC source 改为 `pc_replay_from_real_bmc_capture`,CPLD 不再直接连接 live BMC。
+
+交付分两轨:
+
+- `debug-photo-bmc-replay-binary921`:使用 `T4/R5`、`P7/P8`、`P10/R10`,6 路 PTC remap 到 `P5/T8/M14/M15/P15/N14`。只有在 TD build、package selftest、板级 SRAM evidence、validator strict 全部通过后,才允许发布可刷 pass 包。
+- `formal-uart1-bmc-replay-binary921`:使用 `UART1_TX=L10`、`UART1_RX=M9`、`UART2_TX=M10`、`UART2_RX=N11`,保留全部真实 HEAT/FAN/FG/INSTALL。UART1/2 可接性和 TD/resource 未通过前,只能发布 blocked 说明,不发布可刷 pass bitstream。
+
+## Consequences
+
+### Positive
+
+- CPLD 侧不再承担长 ASCII 日志格式化。
+- ACK、event、snapshot 均可用 `seq/profile/CRC` 严格验证。
+- 旧程序输出、启动噪声、ACK 错位可以通过 epoch 和 seq 归因。
+- PC 端 decoder 可以输出 JSON/Markdown,既给机器验收,也给人读报告。
+- debug-photo 与 formal-uart1 的声明边界明确。
+
+### Negative
+
+- 手工串口助手无法直接发送可读命令,必须使用 Python CLI 或专用工具。
+- 需要维护 binary protocol、decoder、validator、package selftest。
+- 旧 ASCII collector/runbook 不能直接作为新 strict pass 证据。
+
+### Risks and Mitigations
+
+- Risk: binary921 RTL 仍可能资源超限。
+  - Mitigation: 每次 TD build 必须保存 QOR/area/timing receipt;formal 未通过时保持 blocked。
+- Risk: UART1/2 在 PDF 中存在但现场不可接。
+  - Mitigation: formal-uart1 必须保留 `blocked_waiting_for_uart1_uart2_access`,直到连通性实测。
+- Risk: PC replay 被误认为 live BMC pass。
+  - Mitigation: receipt 固定 `bmc_source=pc_replay_from_real_bmc_capture` 和 `live_bmc_link_status=not_used`。
+- Risk: 真实 PTC/FAN 未接时软件链路 pass 被误解为硬件 pass。
+  - Mitigation: `real_fan_ptc_hardware_status=not_run` 不参与硬件 pass;真实负载另建 gate。
+
+## Implementation Notes
+
+- 协议规范见 [docs/j6-bmc-replay-binary921-protocol-v1.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/j6-bmc-replay-binary921-protocol-v1.zh-CN.md)。
+- 实施计划见 [docs/j6-bmc-replay-binary921-implementation-plan-v1.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/j6-bmc-replay-binary921-implementation-plan-v1.zh-CN.md)。
+- `PROGRAM_FLASH`、`ERASE_FLASH`、`PROGRAM_SPIBIN`、`DIRECT_FLASH_WRITE` 仍属于 fail-closed 禁区。
+
+## Related Documents
+
+- [docs/j6-bmc-replay-binary921-architecture.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/j6-bmc-replay-binary921-architecture.zh-CN.md)
+- [docs/host-cpld-uart-spec-v1.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/host-cpld-uart-spec-v1.zh-CN.md)
+- [docs/verification-gates-v2.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/verification-gates-v2.zh-CN.md)
+- [docs/fact-source-boundary.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/fact-source-boundary.zh-CN.md)

+ 15 - 0
docs/adr/README.zh-CN.md

@@ -0,0 +1,15 @@
+# Architecture Decision Records
+
+本目录保存 CPLD 工程中影响 pin profile、串口协议、真实硬件动作、receipt/gate 口径的架构决策。
+
+## Index
+
+| ADR | Title | Status | Date |
+| --- | --- | --- | --- |
+| [0001](0001-j6-bmc-replay-binary921-boundaries.zh-CN.md) | J6 BMC-Replay Binary921 边界 | Accepted | 2026-07-09 |
+
+## 使用规则
+
+- 新增 live BMC、真实热闭环、flash、驱动安装、外部仪器或生产硬件动作前,必须新增或更新 ADR。
+- ADR 只记录决策、原因和后果;实现细节放到 `docs/*implementation-plan*.zh-CN.md` 或对应 runbook。
+- 已接受 ADR 不直接改历史结论;如果结论变更,新增 ADR supersede。

Разница между файлами не показана из-за своего большого размера
+ 202 - 0
docs/j6-bmc-replay-binary921-architecture.zh-CN.md


+ 270 - 0
docs/j6-bmc-replay-binary921-implementation-plan-v1.zh-CN.md

@@ -0,0 +1,270 @@
+# 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:**
+- Modify: [docs/j6-bmc-replay-binary921-architecture.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/j6-bmc-replay-binary921-architecture.zh-CN.md)
+- Create: [docs/j6-bmc-replay-binary921-protocol-v1.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/j6-bmc-replay-binary921-protocol-v1.zh-CN.md)
+- Create: [docs/adr/0001-j6-bmc-replay-binary921-boundaries.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/adr/0001-j6-bmc-replay-binary921-boundaries.zh-CN.md)
+
+**Interfaces:**
+- Consumes: existing ASCII contract [docs/host-cpld-uart-spec-v1.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/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:
+
+```powershell
+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:**
+- Modify/Create: [tools/binary921.py](/C:/Users/Administrator/Agentworkspace/CPLD/tools/binary921.py)
+- Modify/Create: [tests/unit/test_binary921_protocol.py](/C:/Users/Administrator/Agentworkspace/CPLD/tests/unit/test_binary921_protocol.py)
+
+**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:
+
+```powershell
+python -m pytest tests/unit/test_binary921_protocol.py -q
+```
+
+Expected: pass.
+
+## Task 3: BMC capture/replay harness
+
+**Files:**
+- Modify/Create: [tools/bmc_replay_uart.py](/C:/Users/Administrator/Agentworkspace/CPLD/tools/bmc_replay_uart.py)
+- Modify/Create: [tests/unit/test_bmc_replay_tool.py](/C:/Users/Administrator/Agentworkspace/CPLD/tests/unit/test_bmc_replay_tool.py)
+
+**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:
+
+```powershell
+python -m pytest tests/unit/test_bmc_replay_tool.py -q
+```
+
+Expected: pass.
+
+## Task 4: RTL binary debug/host core
+
+**Files:**
+- Modify/Create: [src/rtl/binary921_crc16.v](/C:/Users/Administrator/Agentworkspace/CPLD/src/rtl/binary921_crc16.v)
+- Modify/Create: [src/rtl/binary921_frame_tx.v](/C:/Users/Administrator/Agentworkspace/CPLD/src/rtl/binary921_frame_tx.v)
+- Modify/Create: [src/rtl/binary921_host_rx.v](/C:/Users/Administrator/Agentworkspace/CPLD/src/rtl/binary921_host_rx.v)
+- Modify/Create: [src/rtl/binary921_diag_core.v](/C:/Users/Administrator/Agentworkspace/CPLD/src/rtl/binary921_diag_core.v)
+- Modify/Create: [tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_binary921_top_tb.v](/C:/Users/Administrator/Agentworkspace/CPLD/tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_binary921_top_tb.v)
+
+**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:
+
+```powershell
+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:**
+- Modify/Create: [src/top/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top.v](/C:/Users/Administrator/Agentworkspace/CPLD/src/top/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top.v)
+- Modify/Create: [src/top/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top.v](/C:/Users/Administrator/Agentworkspace/CPLD/src/top/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top.v)
+- Modify/Create: [constraints/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.adc](/C:/Users/Administrator/Agentworkspace/CPLD/constraints/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.adc)
+- Modify/Create: [constraints/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.adc](/C:/Users/Administrator/Agentworkspace/CPLD/constraints/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.adc)
+- Modify: [tools/pin_inventory.py](/C:/Users/Administrator/Agentworkspace/CPLD/tools/pin_inventory.py)
+- Modify: [tests/unit/test_pin_inventory.py](/C:/Users/Administrator/Agentworkspace/CPLD/tests/unit/test_pin_inventory.py)
+
+**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:
+
+```powershell
+python -m pytest tests/unit/test_pin_inventory.py -q
+```
+
+Expected: pass.
+
+## Task 6: Collector and validator
+
+**Files:**
+- Modify/Create: [tools/remote/collect_j6_binary921.py](/C:/Users/Administrator/Agentworkspace/CPLD/tools/remote/collect_j6_binary921.py)
+- Modify: [tools/uart_receipts.py](/C:/Users/Administrator/Agentworkspace/CPLD/tools/uart_receipts.py)
+- Modify: [tests/unit/test_uart_receipts.py](/C:/Users/Administrator/Agentworkspace/CPLD/tests/unit/test_uart_receipts.py)
+
+**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:
+
+```powershell
+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:
+
+```powershell
+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](/C:/Users/Administrator/Agentworkspace/CPLD/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
+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:
+
+```powershell
+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.

+ 179 - 0
docs/j6-bmc-replay-binary921-protocol-v1.zh-CN.md

@@ -0,0 +1,179 @@
+# J6 BMC-Replay Binary921 协议规范 v1
+
+本文定义 `binary921` HostPort 与 DebugPort 的机器帧格式。它是 [docs/j6-bmc-replay-binary921-architecture.zh-CN.md](/C:/Users/Administrator/Agentworkspace/CPLD/docs/j6-bmc-replay-binary921-architecture.zh-CN.md) 的 wire-level 合同。
+
+## 1. 字节序和帧边界
+
+所有多字节整数使用 little-endian。CRC 使用 CRC16-CCITT,初值 `0xffff`,多项式 `0x1021`,覆盖 `version` 到 `payload`,不覆盖 `magic` 和 `crc16` 本身。
+
+| 字段 | 字节数 | 说明 |
+| --- | ---: | --- |
+| `magic` | 2 | 固定 `a5 5a` |
+| `version` | 1 | 当前 `01` |
+| `profile_id` | 1 | `01=debug-photo-bmc-replay-binary921`,`02=formal-uart1-bmc-replay-binary921` |
+| `frame_type` | 1 | 见第 2 节 |
+| `seq` | 4 | little-endian 递增序号 |
+| `timestamp_tick` | 4 | little-endian CPLD tick |
+| `payload_len` | 1 | `0..255` |
+| `payload` | N | 固定结构或 TLV |
+| `crc16` | 2 | little-endian CRC16-CCITT |
+
+decoder 必须支持流式重同步:遇到错误 magic、长度越界、CRC 错、version 不支持、unknown frame type 时丢弃当前候选帧并继续搜索下一处 `a5 5a`。validator 必须把这些错误计入 receipt,不能静默忽略。
+
+## 2. Frame Type
+
+| 值 | 名称 | 方向 | 用途 |
+| ---: | --- | --- | --- |
+| `0x01` | `READY` | CPLD -> Host/Debug | epoch 起点 |
+| `0x02` | `BMC_POLL` | CPLD -> Debug | CPLD 已向 BMC replay UART 发 poll |
+| `0x03` | `BMC_PAYLOAD` | CPLD -> Debug | CPLD 收到并解析 replay payload |
+| `0x04` | `SENSOR_CACHE` | CPLD -> Debug/Host response | 24 DIMM cache 摘要或分片 |
+| `0x05` | `HOST_CMD` | Host -> CPLD 或 Debug echo | Host 控制命令 |
+| `0x06` | `HOST_ACK` | CPLD -> Host/Debug | Host 命令 ACK/NACK |
+| `0x07` | `PWM_STATE` | CPLD -> Debug | PTC/FAN PWM state |
+| `0x08` | `PID_STATE` | CPLD -> Debug | PID requested/active boundary |
+| `0x09` | `TIMEOUT_STATE` | CPLD -> Debug | 5 秒 Host timeout fallback |
+| `0x0a` | `PIN_PROFILE` | CPLD -> Debug | 当前 pin profile 和 remap 摘要 |
+| `0x0b` | `MODULE_SNAPSHOT` | CPLD -> Debug | 内部模块快照 |
+| `0x0c` | `ERROR_COUNTERS` | CPLD -> Debug | drop/error/bad-frame counters |
+
+## 3. Host Command
+
+`HOST_CMD` payload 固定 4 字节:
+
+| offset | 字段 | 说明 |
+| ---: | --- | --- |
+| 0 | `cmd_id` | 见下表 |
+| 1 | `channel` | 1-based;无通道命令为 0 |
+| 2 | `value` | 百分比或 enable;无值命令为 0 |
+| 3 | `flags` | v1 固定 0 |
+
+| `cmd_id` | 名称 | 合法范围 |
+| ---: | --- | --- |
+| `0x20` | `SET_PTC` | `channel=1..24`,`value=0..100` |
+| `0x21` | `SET_FAN` | `channel=1..4`,`value=0..100` |
+| `0x22` | `GET_SENSOR` | `channel=0`,`value=0` |
+| `0x23` | `GET_MAP` | `channel=0`,`value=0` |
+| `0x24` | `GET_STATUS` | `channel=0`,`value=0` |
+| `0x25` | `SET_PID_REQUESTED` | `channel=0`,`value=0/1` |
+| `0x26` | `DISABLE` | `channel=0`,`value=0` |
+
+负向命令必须 NACK:
+
+- `SET_PTC` 的 `channel=0` 或 `channel>24`。
+- `SET_FAN` 的 `channel=0` 或 `channel>4`。
+- 任意百分比 `value>100`。
+- unknown `cmd_id`。
+- profile mismatch。
+- CRC/length/version/frame type 错误。
+
+## 4. HOST_ACK
+
+`HOST_ACK` payload 固定 8 字节:
+
+| offset | 字段 | 说明 |
+| ---: | --- | --- |
+| 0 | `ok` | `1=accepted`,`0=rejected` |
+| 1 | `cmd_id` | 被响应的命令 |
+| 2 | `status_code` | 见第 5 节 |
+| 3 | `channel` | 被响应通道;无通道为 0 |
+| 4 | `value` | 被应用值;无值为 0 |
+| 5 | `state_flags` | bit0=timeout_active, bit1=pid_requested, bit2=pid_active, bit3=disabled |
+| 6..7 | `applied_state_hash` | little-endian 16-bit 摘要 |
+
+ACK 的帧级 `seq` 必须等于 Host command `seq`。collector 必须逐条匹配 `seq/cmd_id/status_code/profile_id`,不能把错后一条 ACK 归给下一条命令。
+
+## 5. Status Code
+
+| 值 | 名称 | 含义 |
+| ---: | --- | --- |
+| `0x00` | `OK` | 命令被接受 |
+| `0x01` | `BAD_CHANNEL` | 1-based 通道越界 |
+| `0x02` | `BAD_VALUE` | 百分比或 enable 值非法 |
+| `0x03` | `BAD_LENGTH` | payload 长度错误 |
+| `0x04` | `BAD_CRC` | CRC 错误 |
+| `0x05` | `BAD_PROFILE` | profile_id 不匹配 |
+| `0x06` | `BAD_COMMAND` | unknown command |
+| `0x07` | `BUSY` | CPLD 当前不能接收命令 |
+| `0x08` | `INTERNAL_ERROR` | 内部错误,需要 DebugPort 进一步归因 |
+
+## 6. BMC Payload 和 Sensor Cache
+
+`BMC_PAYLOAD` payload:
+
+| offset | 字段 | 说明 |
+| ---: | --- | --- |
+| 0 | `payload_seq_lsb` | replay payload seq 低 8 位 |
+| 1 | `byte_count` | v1 必须为 48 |
+| 2 | `valid_count` | `0..24` |
+| 3 | `missing_count` | `0..24` |
+| 4..7 | `payload_hash32` | payload SHA256 前 32 bit,小端保存 |
+| 8..N | `payload_bytes` | 可选,verbose 固件可包含 48 字节;验收固件可只发 hash 摘要 |
+
+`SENSOR_CACHE` payload 可采用摘要或分片:
+
+- 摘要帧:`mode=0x00`,含 valid/missing/error/hash。
+- 分片帧:`mode=0x01`,含 `snapshot_seq/chunk_index/chunk_count` 和最多 48 字节 DIMM cache。
+
+validator 对 strict pass 至少要求能证明 24 个 DIMM 槽位都被覆盖;可以来自单帧完整 cache,也可以来自完整分片重组。
+
+## 7. PWM/PID/Timeout
+
+`PWM_STATE` 必须能证明:
+
+- `PTC01=10%`。
+- `PTC24=20%`。
+- `FAN01=40%`。
+- `FAN04=30%`。
+- `DISABLE` 或 timeout 后 PTC 全 0。
+- timeout fallback 后 FAN 默认为 30%。
+
+`PID_STATE` 必须证明:
+
+- `SET_PID_REQUESTED(enabled=1)` 后 `pid_requested=1`。
+- 本阶段 `pid_active=0`,不接管 PWM。
+- `SET_PID_REQUESTED(enabled=0)` 后 requested 清零。
+
+`TIMEOUT_STATE` 必须证明:
+
+- Host 命令停止超过配置 timeout 后 `timeout_active=1`。
+- fallback state 与 PWM state 一致。
+
+## 8. PIN_PROFILE
+
+`PIN_PROFILE` 必须至少编码:
+
+- `profile_id`。
+- `hardware_access_status`。
+- `bmc_source`。
+- debug-photo 的 6 路 PTC substitute 标记。
+- formal-uart1 的 `blocked_waiting_for_uart1_uart2_access` 标记,直到可接性复核通过。
+
+PC decoder 负责把该帧展开成人读 pin map;CPLD 不拼接长文本。
+
+## 9. MODULE_SNAPSHOT 分片
+
+`MODULE_SNAPSHOT` payload 头固定:
+
+| offset | 字段 | 说明 |
+| ---: | --- | --- |
+| 0 | `snapshot_group` | 例如 UART/BMC/PWM/PID/TIMEOUT/CACHE |
+| 1 | `snapshot_seq` | 8-bit,可回绕 |
+| 2 | `chunk_index` | 从 0 开始 |
+| 3 | `chunk_count` | 总分片数 |
+| 4..N | `chunk_payload` | 固定结构字段 |
+
+同一个 `snapshot_seq` 的 chunk 必须全部到齐且 CRC 正确。缺 chunk、重复 chunk、chunk_count 改变、跨 profile 混流都必须 blocked。
+
+## 10. Validator 规则
+
+strict pass 必须同时满足:
+
+1. 所有帧 CRC 正确。
+2. READY epoch 之后的正式 Host sequence 没有 seq gap。
+3. 12 条 Host 命令的 ACK 精确匹配。
+4. BMC replay receipt 为 `status=pass` 且 payload hash 匹配。
+5. SENSOR cache 覆盖 24 DIMM。
+6. PWM/PID/timeout 证据闭环。
+7. safety flags 未触发 flash、driver install、unknown COM、DebugPort write。
+8. 真实 PTC/FAN 未接时只写 `not_run`,不得写 pass。

+ 411 - 0
receipts/bmc_replay_payload_production_two_uart_20260710T0805Z.json

@@ -0,0 +1,411 @@
+{
+  "schema": "j6-bmc-replay-payload-v1",
+  "status": "pass",
+  "generated_at": "2026-07-10T08:09:08Z",
+  "source": "real_bmc_capture",
+  "bmc_source": "pc_replay_from_real_bmc_capture",
+  "live_bmc_link_status": "not_used",
+  "replay_mode": "poll_response",
+  "seq": 1,
+  "poll_text": "ipmitool raw 0x36 0x6c 0xdf 0xdd 0x00 0x03",
+  "poll_command_text": "ipmitool raw 0x36 0x6c 0xdf 0xdd 0x00 0x03\n",
+  "reply_text": "1e 4b ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 20 19 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff\r\n",
+  "reply_sha256": "06c173f91f8b6b0e56f9c381b49d5b127d2dbf3a09402843838a0ff2b812f1af",
+  "capture_text_sha256": "bf21f4273de344dec0dd209e4f8c72c0249fc4c19c2fdaf268fccc7460ee8931",
+  "byte_count": 48,
+  "valid_count": 2,
+  "missing_count": 22,
+  "rejected_echo_windows": 0,
+  "payload_hex": [
+    "1e",
+    "4b",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "20",
+    "19",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff",
+    "ff"
+  ],
+  "temperatures": [
+    {
+      "id": 0,
+      "dimm": 1,
+      "temperature_c": 30,
+      "integer_c": 30,
+      "fraction": 75,
+      "valid": true,
+      "status": "valid",
+      "raw_pair": [
+        30,
+        75
+      ]
+    },
+    {
+      "id": 1,
+      "dimm": 2,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 2,
+      "dimm": 3,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 3,
+      "dimm": 4,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 4,
+      "dimm": 5,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 5,
+      "dimm": 6,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 6,
+      "dimm": 7,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 7,
+      "dimm": 8,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 8,
+      "dimm": 9,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 9,
+      "dimm": 10,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 10,
+      "dimm": 11,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 11,
+      "dimm": 12,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 12,
+      "dimm": 13,
+      "temperature_c": 32,
+      "integer_c": 32,
+      "fraction": 25,
+      "valid": true,
+      "status": "valid",
+      "raw_pair": [
+        32,
+        25
+      ]
+    },
+    {
+      "id": 13,
+      "dimm": 14,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 14,
+      "dimm": 15,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 15,
+      "dimm": 16,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 16,
+      "dimm": 17,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 17,
+      "dimm": 18,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 18,
+      "dimm": 19,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 19,
+      "dimm": 20,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 20,
+      "dimm": 21,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 21,
+      "dimm": 22,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 22,
+      "dimm": 23,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    },
+    {
+      "id": 23,
+      "dimm": 24,
+      "temperature_c": null,
+      "integer_c": null,
+      "fraction": null,
+      "valid": false,
+      "status": "missing",
+      "raw_pair": [
+        255,
+        255
+      ],
+      "reason": "missing"
+    }
+  ],
+  "safety": {
+    "unsolicited_reply_attempted": false,
+    "driver_install_attempted": false,
+    "programs_nonvolatile": false
+  },
+  "authority_boundary": "PC replay replies only after observing the CPLD BMC poll text. The payload comes from a prior real BMC capture and is not live BMC evidence."
+}

Разница между файлами не показана из-за своего большого размера
+ 420 - 0
receipts/td_production_two_uart_bmc_replay_binary921_20260710T0843Z.json


+ 22 - 0
src/rtl/binary921_crc16.v

@@ -0,0 +1,22 @@
+`timescale 1ns/1ps
+
+module binary921_crc16 (
+    input  wire [15:0] crc_in,
+    input  wire [7:0]  data,
+    output reg  [15:0] crc_out
+);
+    reg [15:0] crc;
+    integer i;
+
+    always @* begin
+        crc = crc_in ^ {data, 8'h00};
+        for (i = 0; i < 8; i = i + 1) begin
+            if (crc[15]) begin
+                crc = (crc << 1) ^ 16'h1021;
+            end else begin
+                crc = (crc << 1);
+            end
+        end
+        crc_out = crc;
+    end
+endmodule

+ 741 - 0
src/rtl/binary921_diag_core.v

@@ -0,0 +1,741 @@
+`timescale 1ns/1ps
+
+module binary921_diag_core #(
+    parameter integer BMC_UART_CLKS_PER_BIT = 217,
+    parameter integer HOST_UART_CLKS_PER_BIT = 217,
+    parameter integer DEBUG_UART_CLKS_PER_BIT = 27,
+    parameter integer STARTUP_DELAY_TICKS = 250000,
+    parameter integer COMMAND_GAP_TICKS = 25000000,
+    parameter integer STATUS_PERIOD_TICKS = 25000000,
+    parameter integer HOST_TIMEOUT_TICKS = 125000000,
+    parameter integer PTC_PWM_PERIOD_TICKS = 2500000,
+    parameter integer FAN_PWM_PERIOD_TICKS = 1000,
+    parameter integer SNAPSHOT_PERIOD_TICKS = 25000000,
+    parameter integer PIN_PROFILE = 0,
+    parameter integer COMBINED_HOST_DEBUG_UART = 0
+) (
+    input  wire        sys_clk,
+    input  wire        sys_rst_n,
+    input  wire        bmc_uart_rx,
+    output wire        bmc_uart_tx,
+    input  wire        debug_uart_rx,
+    output wire        debug_uart_tx,
+    input  wire        host_uart_rx,
+    output wire        host_uart_tx,
+    output reg  [23:0] ptc_pwm_out,
+    output reg  [3:0]  fan_pwm_out,
+    input  wire [7:0]  fan_fg_in,
+    input  wire [3:0]  fan_install_in,
+    output wire [7:0]  led
+);
+    localparam [7:0] PROFILE_DEBUG = 8'd1;
+    localparam [7:0] PROFILE_FORMAL = 8'd2;
+    localparam [7:0] PROFILE_PRODUCTION = 8'd3;
+    localparam [7:0] PROFILE_ID = (PIN_PROFILE == 2) ? PROFILE_PRODUCTION : ((PIN_PROFILE == 0) ? PROFILE_DEBUG : PROFILE_FORMAL);
+    localparam [7:0] FT_READY = 8'h01;
+    localparam [7:0] FT_BMC_PAYLOAD = 8'h03;
+    localparam [7:0] FT_SENSOR_CACHE = 8'h04;
+    localparam [7:0] FT_HOST_ACK = 8'h06;
+    localparam [7:0] FT_PWM_STATE = 8'h07;
+    localparam [7:0] FT_PID_STATE = 8'h08;
+    localparam [7:0] FT_TIMEOUT_STATE = 8'h09;
+    localparam [7:0] FT_PIN_PROFILE = 8'h0a;
+    localparam [7:0] FT_MODULE_SNAPSHOT = 8'h0b;
+    localparam [7:0] FT_ERROR_COUNTERS = 8'h0c;
+    localparam [7:0] CMD_SET_PTC = 8'h20;
+    localparam [7:0] CMD_SET_FAN = 8'h21;
+    localparam [7:0] CMD_GET_SENSOR = 8'h22;
+    localparam [7:0] CMD_GET_MAP = 8'h23;
+    localparam [7:0] CMD_GET_STATUS = 8'h24;
+    localparam [7:0] CMD_SET_PID_REQUESTED = 8'h25;
+    localparam [7:0] CMD_DISABLE = 8'h26;
+    localparam [31:0] PTC_PWM_STEP_TICKS = (PTC_PWM_PERIOD_TICKS < 100) ? 32'd1 : (PTC_PWM_PERIOD_TICKS / 100);
+    localparam [31:0] FAN_PWM_STEP_TICKS = (FAN_PWM_PERIOD_TICKS < 100) ? 32'd1 : (FAN_PWM_PERIOD_TICKS / 100);
+
+    wire host_rx_valid;
+    wire [7:0] host_rx_data;
+    wire host_rx_ready;
+    wire host_rx_framing_error;
+    wire host_rx_break;
+    wire host_rx_overflow;
+    reg host_tx_valid;
+    reg [7:0] host_tx_data;
+    wire host_tx_ready;
+    wire host_tx_busy;
+
+    wire debug_phy_tx_ready;
+    wire debug_tx_busy;
+    wire debug_frame_tx_ready;
+    wire ack_frame_tx_ready;
+    wire debug_phy_tx_valid;
+    wire diag_tx_valid;
+    wire [7:0] diag_tx_data;
+    reg diag_start;
+    reg [7:0] diag_type;
+    reg [31:0] diag_seq;
+    reg [7:0] diag_payload_len;
+    reg [511:0] diag_payload;
+    wire diag_busy;
+    wire diag_done;
+
+    wire bmc_rx_valid;
+    wire [7:0] bmc_rx_data;
+    wire bmc_rx_ready;
+    wire bmc_rx_framing_error;
+    wire bmc_rx_break;
+    wire bmc_rx_overflow;
+    wire bmc_tx_ready;
+    wire bmc_tx_busy;
+    wire bmc_poll_tx_valid;
+    wire [7:0] bmc_poll_tx_data;
+    wire bmc_poll_ready;
+    wire bmc_poll_accept;
+    wire bmc_frame_valid;
+    wire [7:0] bmc_frame_byte;
+    wire [5:0] bmc_frame_index;
+    wire [15:0] bmc_frame_seq;
+    wire bmc_frame_done;
+    wire bmc_parser_error;
+    wire [2:0] bmc_parser_state;
+    wire [15:0] bmc_token_count;
+    wire [15:0] bmc_rejected_echo_windows;
+    wire [15:0] bmc_startup_wake_sent_count;
+    wire [15:0] bmc_poll_command_count;
+    wire [15:0] bmc_tx_byte_count;
+    wire [15:0] bmc_rx_byte_count;
+
+    wire cmd_valid;
+    wire [31:0] cmd_seq;
+    wire [7:0] cmd_id;
+    wire [7:0] cmd_ch;
+    wire [7:0] cmd_pct;
+    wire bad_host_frame;
+    wire [15:0] bad_host_frame_count;
+
+    reg [31:0] tick;
+    reg [31:0] debug_frame_seq;
+    reg [31:0] host_ack_seq;
+    reg [6:0] ptc_level [0:23];
+    reg [6:0] fan_level [0:3];
+    reg [6:0] sensor_temp [0:23];
+    reg [23:0] sensor_missing;
+    reg [7:0] valid_count;
+    reg [7:0] missing_count;
+    reg [7:0] last_status_code;
+    reg [7:0] last_cmd_id;
+    reg [7:0] last_cmd_ch;
+    reg [7:0] last_cmd_pct;
+    reg pid_requested;
+    reg timeout_active;
+    reg [31:0] host_timeout_counter;
+    reg [31:0] status_counter;
+    reg [31:0] snapshot_counter;
+    reg [31:0] startup_counter;
+    reg ready_sent;
+    reg [4:0] sensor_index;
+    reg [4:0] bmc_pair_index;
+    reg [7:0] bmc_prev_byte;
+    reg [15:0] bmc_payload_checksum;
+    reg [7:0] bmc_payload_first;
+    reg [7:0] bmc_payload_last;
+    reg [7:0] bmc_payload_count;
+    reg [15:0] command_count_seen;
+    reg [7:0] host_err_count;
+    reg [7:0] cmd_status_value;
+    reg [15:0] cmd_hash_value;
+    reg [6:0] dimm_temp_clamped;
+    reg [15:0] bmc_next_checksum;
+    reg [7:0] bmc_next_count;
+    reg [7:0] bmc_next_first;
+    reg [7:0] bmc_next_last;
+    reg [7:0] next_valid_count;
+    reg [7:0] next_missing_count;
+    reg [23:0] next_sensor_missing;
+    reg bmc_payload_pending;
+    reg sensor_cache_pending;
+    reg [31:0] ptc_pwm_counter;
+    reg [31:0] fan_pwm_counter;
+    reg bmc_tx_valid;
+    reg [7:0] bmc_tx_data;
+    reg bmc_tx_inflight;
+    reg bmc_poll_hold_valid;
+    reg [7:0] bmc_poll_hold_data;
+    reg [1:0] combined_tx_owner;
+    integer i;
+
+    localparam [1:0] COMBINED_OWNER_NONE = 2'd0;
+    localparam [1:0] COMBINED_OWNER_ACK = 2'd1;
+    localparam [1:0] COMBINED_OWNER_DIAG = 2'd2;
+
+    uart_rx_8n1 #(.CLKS_PER_BIT(HOST_UART_CLKS_PER_BIT)) u_host_rx (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .rx_i(host_uart_rx),
+        .rx_valid(host_rx_valid),
+        .rx_data(host_rx_data),
+        .rx_ready(host_rx_ready),
+        .framing_error(host_rx_framing_error),
+        .break_detected(host_rx_break),
+        .overflow(host_rx_overflow)
+    );
+
+    uart_tx_8n1 #(.CLKS_PER_BIT(HOST_UART_CLKS_PER_BIT)) u_host_tx (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .tx_valid(host_tx_valid),
+        .tx_data(host_tx_data),
+        .tx_ready(host_tx_ready),
+        .tx_o(host_uart_tx),
+        .busy(host_tx_busy)
+    );
+
+    uart_rx_8n1 #(.CLKS_PER_BIT(BMC_UART_CLKS_PER_BIT)) u_bmc_rx (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .rx_i(bmc_uart_rx),
+        .rx_valid(bmc_rx_valid),
+        .rx_data(bmc_rx_data),
+        .rx_ready(bmc_rx_ready),
+        .framing_error(bmc_rx_framing_error),
+        .break_detected(bmc_rx_break),
+        .overflow(bmc_rx_overflow)
+    );
+
+    uart_tx_8n1 #(.CLKS_PER_BIT(BMC_UART_CLKS_PER_BIT)) u_bmc_tx (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .tx_valid(bmc_tx_valid),
+        .tx_data(bmc_tx_data),
+        .tx_ready(bmc_tx_ready),
+        .tx_o(bmc_uart_tx),
+        .busy(bmc_tx_busy)
+    );
+
+    assign bmc_poll_ready = bmc_tx_ready && !bmc_tx_inflight && !bmc_poll_hold_valid && !bmc_poll_tx_valid;
+    assign bmc_poll_accept = bmc_poll_tx_valid && bmc_tx_ready && !bmc_tx_inflight && !bmc_poll_hold_valid;
+
+    assign debug_phy_tx_valid = (COMBINED_HOST_DEBUG_UART != 0) ? 1'b0 : diag_tx_valid;
+
+    uart_tx_8n1 #(.CLKS_PER_BIT(DEBUG_UART_CLKS_PER_BIT)) u_debug_tx (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .tx_valid(debug_phy_tx_valid),
+        .tx_data(diag_tx_data),
+        .tx_ready(debug_phy_tx_ready),
+        .tx_o(debug_uart_tx),
+        .busy(debug_tx_busy)
+    );
+
+    binary921_host_rx u_host_binary_rx (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .expected_profile_id(PROFILE_ID),
+        .rx_valid(host_rx_valid),
+        .rx_data(host_rx_data),
+        .rx_ready(host_rx_ready),
+        .cmd_valid(cmd_valid),
+        .cmd_seq(cmd_seq),
+        .cmd_id(cmd_id),
+        .cmd_ch(cmd_ch),
+        .cmd_pct(cmd_pct),
+        .bad_frame(bad_host_frame),
+        .bad_frame_count(bad_host_frame_count)
+    );
+
+    bmc_uart_raw48_poll_lite #(
+        .POLL_PERIOD_TICKS(COMMAND_GAP_TICKS),
+        .STARTUP_WAKE_COUNT(3),
+        .STARTUP_WAKE_GAP_TICKS(STARTUP_DELAY_TICKS),
+        .STARTUP_POST_WAKE_DELAY_TICKS(STARTUP_DELAY_TICKS),
+        .WAIT_FOR_FRAME_BEFORE_NEXT_POLL(1)
+    ) u_bmc_poll (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .tx_ready(bmc_poll_ready),
+        .tx_valid(bmc_poll_tx_valid),
+        .tx_data(bmc_poll_tx_data),
+        .rx_valid(bmc_rx_valid),
+        .rx_data(bmc_rx_data),
+        .frame_valid(bmc_frame_valid),
+        .frame_byte(bmc_frame_byte),
+        .frame_index(bmc_frame_index),
+        .frame_seq(bmc_frame_seq),
+        .frame_done(bmc_frame_done),
+        .parser_error(bmc_parser_error),
+        .stale(),
+        .parser_state(bmc_parser_state),
+        .token_count(bmc_token_count),
+        .rejected_echo_windows(bmc_rejected_echo_windows),
+        .startup_wake_sent_count(bmc_startup_wake_sent_count),
+        .poll_command_count(bmc_poll_command_count),
+        .tx_byte_count(bmc_tx_byte_count),
+        .rx_byte_count(bmc_rx_byte_count)
+    );
+    assign bmc_rx_ready = 1'b1;
+
+    binary921_frame_tx #(.MAX_PAYLOAD_BYTES(64)) u_diag_frame_tx (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .start(diag_start),
+        .profile_id(PROFILE_ID),
+        .frame_type(diag_type),
+        .frame_seq(diag_seq),
+        .timestamp_tick(tick),
+        .payload_len(diag_payload_len),
+        .payload(diag_payload),
+        .busy(diag_busy),
+        .done(diag_done),
+        .tx_valid(diag_tx_valid),
+        .tx_data(diag_tx_data),
+        .tx_ready(debug_frame_tx_ready)
+    );
+
+    wire ack_tx_valid;
+    wire [7:0] ack_tx_data;
+    reg ack_start;
+    reg [7:0] ack_payload_len;
+    reg [511:0] ack_payload;
+    wire ack_busy;
+    wire ack_done;
+
+    binary921_frame_tx #(.MAX_PAYLOAD_BYTES(64)) u_host_ack_tx (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .start(ack_start),
+        .profile_id(PROFILE_ID),
+        .frame_type(FT_HOST_ACK),
+        .frame_seq(host_ack_seq),
+        .timestamp_tick(tick),
+        .payload_len(ack_payload_len),
+        .payload(ack_payload),
+        .busy(ack_busy),
+        .done(ack_done),
+        .tx_valid(ack_tx_valid),
+        .tx_data(ack_tx_data),
+        .tx_ready(ack_frame_tx_ready)
+    );
+
+    assign ack_frame_tx_ready = (COMBINED_HOST_DEBUG_UART != 0) ? ((combined_tx_owner == COMBINED_OWNER_ACK) && host_tx_ready) : host_tx_ready;
+    assign debug_frame_tx_ready = (COMBINED_HOST_DEBUG_UART != 0) ? ((combined_tx_owner == COMBINED_OWNER_DIAG) && host_tx_ready) : debug_phy_tx_ready;
+
+    always @* begin
+        if (COMBINED_HOST_DEBUG_UART != 0) begin
+            if (combined_tx_owner == COMBINED_OWNER_ACK) begin
+                host_tx_valid = ack_tx_valid;
+                host_tx_data = ack_tx_data;
+            end else if (combined_tx_owner == COMBINED_OWNER_DIAG) begin
+                host_tx_valid = diag_tx_valid;
+                host_tx_data = diag_tx_data;
+            end else begin
+                host_tx_valid = 1'b0;
+                host_tx_data = 8'd0;
+            end
+        end else begin
+            host_tx_valid = ack_tx_valid;
+            host_tx_data = ack_tx_data;
+        end
+    end
+
+    function [7:0] dimm_temp_value;
+        input [7:0] integer_part;
+        input [7:0] fraction_part;
+        begin
+            if (integer_part > 8'd100) begin
+                dimm_temp_value = 8'd100;
+            end else begin
+                dimm_temp_value = integer_part;
+            end
+        end
+    endfunction
+
+    function [15:0] state_hash16;
+        input [7:0] status_code;
+        begin
+            state_hash16 = {8'd0, status_code} ^
+                           {9'd0, ptc_level[0]} ^
+                           {9'd0, ptc_level[23]} ^
+                           {9'd0, fan_level[0]} ^
+                           {9'd0, fan_level[3]} ^
+                           {15'd0, pid_requested} ^
+                           {15'd0, timeout_active};
+        end
+    endfunction
+
+    function [15:0] command_hash16;
+        input [7:0] status_code;
+        input [7:0] command_value;
+        input [7:0] channel_value;
+        input [7:0] percent_value;
+        begin
+            command_hash16 = state_hash16(status_code) ^
+                             {command_value, channel_value} ^
+                             {8'd0, percent_value};
+        end
+    endfunction
+
+    function [31:0] duty_threshold;
+        input [31:0] step_ticks;
+        input [6:0] percent_value;
+        begin
+            duty_threshold = step_ticks * {25'd0, percent_value};
+        end
+    endfunction
+
+    task queue_diag_frame;
+        input [7:0] frame_type;
+        input [7:0] length;
+        input [511:0] payload_value;
+        begin
+            if (!diag_busy && !diag_start) begin
+                debug_frame_seq <= debug_frame_seq + 32'd1;
+                diag_seq <= debug_frame_seq + 32'd1;
+                diag_type <= frame_type;
+                diag_payload_len <= length;
+                diag_payload <= payload_value;
+                diag_start <= 1'b1;
+            end
+        end
+    endtask
+
+    task queue_ack;
+        input [31:0] seq_value;
+        input [7:0] command_value;
+        input [7:0] status_value;
+        input [15:0] hash_value;
+        begin
+            if (!ack_busy && !ack_start) begin
+                host_ack_seq <= seq_value;
+                ack_payload_len <= 8'd6;
+                ack_payload <= {464'd0, hash_value[15:8], hash_value[7:0], 8'd0, status_value, command_value, 8'd1};
+                ack_start <= 1'b1;
+            end
+        end
+    endtask
+
+    always @(posedge sys_clk or negedge sys_rst_n) begin
+        if (!sys_rst_n) begin
+            tick <= 32'd0;
+            debug_frame_seq <= 32'd0;
+            host_ack_seq <= 32'd0;
+            diag_start <= 1'b0;
+            diag_type <= 8'd0;
+            diag_seq <= 32'd0;
+            diag_payload_len <= 8'd0;
+            diag_payload <= 512'd0;
+            bmc_tx_valid <= 1'b0;
+            bmc_tx_data <= 8'd0;
+            bmc_tx_inflight <= 1'b0;
+            bmc_poll_hold_valid <= 1'b0;
+            bmc_poll_hold_data <= 8'd0;
+            combined_tx_owner <= COMBINED_OWNER_NONE;
+            ack_start <= 1'b0;
+            ack_payload_len <= 8'd0;
+            ack_payload <= 512'd0;
+            ready_sent <= 1'b0;
+            startup_counter <= 32'd0;
+            status_counter <= 32'd0;
+            snapshot_counter <= 32'd0;
+            host_timeout_counter <= 32'd0;
+            timeout_active <= 1'b0;
+            pid_requested <= 1'b0;
+            sensor_missing <= 24'hffffff;
+            valid_count <= 8'd0;
+            missing_count <= 8'd24;
+            last_status_code <= 8'd0;
+            last_cmd_id <= 8'd0;
+            last_cmd_ch <= 8'd0;
+            last_cmd_pct <= 8'd0;
+            sensor_index <= 5'd0;
+            bmc_pair_index <= 5'd0;
+            bmc_prev_byte <= 8'd0;
+            bmc_payload_checksum <= 16'd0;
+            bmc_payload_first <= 8'd0;
+            bmc_payload_last <= 8'd0;
+            bmc_payload_count <= 8'd0;
+            command_count_seen <= 16'd0;
+            host_err_count <= 8'd0;
+            cmd_status_value <= 8'd0;
+            cmd_hash_value <= 16'd0;
+            dimm_temp_clamped <= 7'd0;
+            bmc_next_checksum <= 16'd0;
+            bmc_next_count <= 8'd0;
+            bmc_next_first <= 8'd0;
+            bmc_next_last <= 8'd0;
+            next_valid_count <= 8'd0;
+            next_missing_count <= 8'd24;
+            next_sensor_missing <= 24'hffffff;
+            bmc_payload_pending <= 1'b0;
+            sensor_cache_pending <= 1'b0;
+            ptc_pwm_counter <= 32'd0;
+            fan_pwm_counter <= 32'd0;
+            ptc_pwm_out <= 24'd0;
+            fan_pwm_out <= 4'd0;
+            for (i = 0; i < 24; i = i + 1) begin
+                ptc_level[i] <= 7'd0;
+                sensor_temp[i] <= 7'd0;
+            end
+            for (i = 0; i < 4; i = i + 1) begin
+                fan_level[i] <= 7'd30;
+            end
+        end else begin
+            tick <= tick + 32'd1;
+            diag_start <= 1'b0;
+            ack_start <= 1'b0;
+            bmc_tx_valid <= 1'b0;
+            if (bmc_tx_inflight && bmc_tx_busy) begin
+                bmc_tx_inflight <= 1'b0;
+            end
+
+            if (COMBINED_HOST_DEBUG_UART != 0) begin
+                if (combined_tx_owner == COMBINED_OWNER_ACK) begin
+                    if (ack_done) begin
+                        combined_tx_owner <= COMBINED_OWNER_NONE;
+                    end
+                end else if (combined_tx_owner == COMBINED_OWNER_DIAG) begin
+                    if (diag_done) begin
+                        combined_tx_owner <= COMBINED_OWNER_NONE;
+                    end
+                end else if (ack_busy || ack_start || ack_tx_valid) begin
+                    combined_tx_owner <= COMBINED_OWNER_ACK;
+                end else if (diag_busy || diag_start || diag_tx_valid) begin
+                    combined_tx_owner <= COMBINED_OWNER_DIAG;
+                end
+            end else begin
+                combined_tx_owner <= COMBINED_OWNER_NONE;
+            end
+
+            if (startup_counter < STARTUP_DELAY_TICKS[31:0]) begin
+                startup_counter <= startup_counter + 32'd1;
+            end else if (!ready_sent) begin
+                queue_diag_frame(FT_READY, 8'd4, {480'd0, 8'd0, 8'd0, 8'd0, PROFILE_ID});
+                ready_sent <= 1'b1;
+            end
+
+            if (status_counter >= STATUS_PERIOD_TICKS[31:0]) begin
+                status_counter <= 32'd0;
+                queue_diag_frame(
+                    FT_ERROR_COUNTERS,
+                    8'd12,
+                    {416'd0,
+                     host_err_count,
+                     {7'd0, host_rx_framing_error | host_rx_overflow | host_rx_break},
+                     bad_host_frame_count[15:8], bad_host_frame_count[7:0],
+                     bmc_rx_byte_count[15:8], bmc_rx_byte_count[7:0],
+                     bmc_tx_byte_count[15:8], bmc_tx_byte_count[7:0],
+                     bmc_poll_command_count[15:8], bmc_poll_command_count[7:0],
+                     bmc_frame_seq[15:8], bmc_frame_seq[7:0]}
+                );
+            end else begin
+                status_counter <= status_counter + 32'd1;
+            end
+
+            if (snapshot_counter >= SNAPSHOT_PERIOD_TICKS[31:0]) begin
+                snapshot_counter <= 32'd0;
+                queue_diag_frame(
+                    FT_MODULE_SNAPSHOT,
+                    8'd24,
+                    {320'd0,
+                     fan_install_in,
+                     fan_fg_in,
+                     {1'b0, fan_level[3]}, {1'b0, fan_level[0]},
+                     {1'b0, ptc_level[23]}, {1'b0, ptc_level[0]},
+                     missing_count, valid_count,
+                     {7'd0, timeout_active}, {7'd0, pid_requested},
+                     last_status_code, last_cmd_pct, last_cmd_ch, last_cmd_id,
+                     bmc_payload_checksum[15:8], bmc_payload_checksum[7:0],
+                     bmc_payload_last, bmc_payload_first,
+                     command_count_seen[15:8], command_count_seen[7:0],
+                     host_err_count, PROFILE_ID}
+                );
+            end else begin
+                snapshot_counter <= snapshot_counter + 32'd1;
+            end
+
+            if (bad_host_frame) begin
+                host_err_count <= host_err_count + 8'd1;
+            end
+
+            if (bmc_poll_accept) begin
+                bmc_poll_hold_valid <= 1'b1;
+                bmc_poll_hold_data <= bmc_poll_tx_data;
+            end
+            if (bmc_poll_hold_valid && bmc_tx_ready && !bmc_tx_inflight) begin
+                bmc_tx_data <= bmc_poll_hold_data;
+                bmc_tx_valid <= 1'b1;
+                bmc_tx_inflight <= 1'b1;
+                bmc_poll_hold_valid <= 1'b0;
+            end
+
+            if (cmd_valid) begin
+                last_cmd_id <= cmd_id;
+                last_cmd_ch <= cmd_ch;
+                last_cmd_pct <= cmd_pct;
+                host_timeout_counter <= 32'd0;
+                timeout_active <= 1'b0;
+                command_count_seen <= command_count_seen + 16'd1;
+                cmd_status_value = 8'd0;
+                if (cmd_id == CMD_SET_PTC) begin
+                    if (cmd_ch >= 8'd1 && cmd_ch <= 8'd24 && cmd_pct <= 8'd100) begin
+                        ptc_level[cmd_ch - 8'd1] <= cmd_pct[6:0];
+                    end else begin
+                        cmd_status_value = 8'd1;
+                    end
+                end else if (cmd_id == CMD_SET_FAN) begin
+                    if (cmd_ch >= 8'd1 && cmd_ch <= 8'd4 && cmd_pct <= 8'd100) begin
+                        fan_level[cmd_ch - 8'd1] <= cmd_pct[6:0];
+                    end else begin
+                        cmd_status_value = 8'd1;
+                    end
+                end else if (cmd_id == CMD_SET_PID_REQUESTED) begin
+                    pid_requested <= cmd_ch[0];
+                end else if (cmd_id == CMD_DISABLE) begin
+                    for (i = 0; i < 24; i = i + 1) begin
+                        ptc_level[i] <= 7'd0;
+                    end
+                    for (i = 0; i < 4; i = i + 1) begin
+                        fan_level[i] <= 7'd30;
+                    end
+                end else if (cmd_id == CMD_GET_SENSOR || cmd_id == CMD_GET_MAP || cmd_id == CMD_GET_STATUS) begin
+                    cmd_status_value = 8'd0;
+                end else begin
+                    cmd_status_value = 8'd2;
+                end
+                cmd_hash_value = command_hash16(cmd_status_value, cmd_id, cmd_ch, cmd_pct);
+                last_status_code <= cmd_status_value;
+                queue_ack(cmd_seq, cmd_id, cmd_status_value, cmd_hash_value);
+                queue_diag_frame(
+                    FT_HOST_ACK,
+                    8'd8,
+                    {448'd0,
+                     cmd_hash_value[15:8], cmd_hash_value[7:0],
+                     8'd0, cmd_status_value, cmd_pct, cmd_ch, cmd_id, cmd_seq[7:0]}
+                );
+            end else if (host_timeout_counter >= HOST_TIMEOUT_TICKS[31:0]) begin
+                timeout_active <= 1'b1;
+                for (i = 0; i < 24; i = i + 1) begin
+                    ptc_level[i] <= 7'd0;
+                end
+                for (i = 0; i < 4; i = i + 1) begin
+                    fan_level[i] <= 7'd30;
+                end
+            end else begin
+                host_timeout_counter <= host_timeout_counter + 32'd1;
+            end
+
+            if (bmc_frame_valid) begin
+                if (bmc_frame_index == 6'd0) begin
+                    bmc_payload_checksum <= 16'd0;
+                    bmc_payload_first <= bmc_frame_byte;
+                    bmc_payload_count <= 8'd0;
+                end
+                bmc_next_checksum = (bmc_frame_index == 6'd0) ? {8'd0, bmc_frame_byte} : (bmc_payload_checksum + {8'd0, bmc_frame_byte});
+                bmc_next_count = (bmc_frame_index == 6'd0) ? 8'd1 : (bmc_payload_count + 8'd1);
+                bmc_next_first = (bmc_frame_index == 6'd0) ? bmc_frame_byte : bmc_payload_first;
+                bmc_next_last = bmc_frame_byte;
+                bmc_payload_count <= bmc_next_count;
+                bmc_payload_checksum <= bmc_next_checksum;
+                bmc_payload_first <= bmc_next_first;
+                bmc_payload_last <= bmc_next_last;
+                next_sensor_missing = sensor_missing;
+                if (bmc_frame_index[0]) begin
+                    if (bmc_prev_byte == 8'hff && bmc_frame_byte == 8'hff) begin
+                        sensor_missing[bmc_pair_index] <= 1'b1;
+                        next_sensor_missing[bmc_pair_index] = 1'b1;
+                        sensor_temp[bmc_pair_index] <= 7'd0;
+                    end else begin
+                        sensor_missing[bmc_pair_index] <= 1'b0;
+                        next_sensor_missing[bmc_pair_index] = 1'b0;
+                        dimm_temp_clamped = dimm_temp_value(bmc_prev_byte, bmc_frame_byte);
+                        sensor_temp[bmc_pair_index] <= dimm_temp_clamped;
+                    end
+                    bmc_pair_index <= bmc_pair_index + 5'd1;
+                end
+                if (bmc_frame_index == 6'd0) begin
+                    bmc_pair_index <= 5'd0;
+                    next_sensor_missing = 24'hffffff;
+                end
+                bmc_prev_byte <= bmc_frame_byte;
+                if (bmc_frame_done) begin
+                    next_valid_count = 8'd0;
+                    next_missing_count = 8'd0;
+                    for (i = 0; i < 24; i = i + 1) begin
+                        if (next_sensor_missing[i]) begin
+                            next_missing_count = next_missing_count + 8'd1;
+                        end else begin
+                            next_valid_count = next_valid_count + 8'd1;
+                        end
+                    end
+                    valid_count <= next_valid_count;
+                    missing_count <= next_missing_count;
+                    bmc_payload_checksum <= bmc_next_checksum;
+                    bmc_payload_count <= bmc_next_count;
+                    bmc_payload_first <= bmc_next_first;
+                    bmc_payload_last <= bmc_next_last;
+                    bmc_payload_pending <= 1'b1;
+                    sensor_cache_pending <= 1'b1;
+                end
+            end
+
+            if (bmc_payload_pending) begin
+                queue_diag_frame(
+                    FT_BMC_PAYLOAD,
+                    8'd8,
+                    {448'd0,
+                     bmc_payload_checksum[15:8], bmc_payload_checksum[7:0],
+                     bmc_payload_last, bmc_payload_first,
+                     bmc_frame_seq[15:8], bmc_frame_seq[7:0],
+                     bmc_payload_count,
+                     8'd48}
+                );
+                if (!diag_busy && !diag_start) begin
+                    bmc_payload_pending <= 1'b0;
+                end
+            end else if (sensor_cache_pending) begin
+                queue_diag_frame(
+                    FT_SENSOR_CACHE,
+                    8'd8,
+                    {448'd0,
+                     missing_count,
+                     valid_count,
+                     sensor_missing[23:16],
+                     sensor_missing[15:8],
+                     sensor_missing[7:0],
+                     bmc_frame_seq[15:8], bmc_frame_seq[7:0],
+                     PROFILE_ID}
+                );
+                if (!diag_busy && !diag_start) begin
+                    sensor_cache_pending <= 1'b0;
+                end
+            end
+
+            if (ptc_pwm_counter >= PTC_PWM_PERIOD_TICKS[31:0] - 32'd1) begin
+                ptc_pwm_counter <= 32'd0;
+            end else begin
+                ptc_pwm_counter <= ptc_pwm_counter + 32'd1;
+            end
+            if (fan_pwm_counter >= FAN_PWM_PERIOD_TICKS[31:0] - 32'd1) begin
+                fan_pwm_counter <= 32'd0;
+            end else begin
+                fan_pwm_counter <= fan_pwm_counter + 32'd1;
+            end
+
+            for (i = 0; i < 24; i = i + 1) begin
+                ptc_pwm_out[i] <= (ptc_level[i] != 7'd0) &&
+                                  (ptc_pwm_counter < duty_threshold(PTC_PWM_STEP_TICKS, ptc_level[i]));
+            end
+            for (i = 0; i < 4; i = i + 1) begin
+                fan_pwm_out[i] <= (fan_level[i] != 7'd0) &&
+                                  (fan_pwm_counter < duty_threshold(FAN_PWM_STEP_TICKS, fan_level[i]));
+            end
+        end
+    end
+
+    assign led[0] = ~ready_sent;
+    assign led[1] = ~timeout_active;
+    assign led[2] = ~pid_requested;
+    assign led[3] = ~(bmc_frame_seq != 16'd0);
+    assign led[4] = ~(command_count_seen != 16'd0);
+    assign led[5] = ~(bad_host_frame_count != 16'd0);
+    assign led[6] = (COMBINED_HOST_DEBUG_UART != 0) ? ~host_tx_busy : ~debug_tx_busy;
+    assign led[7] = (COMBINED_HOST_DEBUG_UART != 0) ? ~(combined_tx_owner != COMBINED_OWNER_NONE) : ~debug_uart_rx;
+endmodule

+ 147 - 0
src/rtl/binary921_frame_tx.v

@@ -0,0 +1,147 @@
+`timescale 1ns/1ps
+
+module binary921_frame_tx #(
+    parameter integer MAX_PAYLOAD_BYTES = 64
+) (
+    input  wire                         clk,
+    input  wire                         rst_n,
+    input  wire                         start,
+    input  wire [7:0]                   profile_id,
+    input  wire [7:0]                   frame_type,
+    input  wire [31:0]                  frame_seq,
+    input  wire [31:0]                  timestamp_tick,
+    input  wire [7:0]                   payload_len,
+    input  wire [(MAX_PAYLOAD_BYTES*8)-1:0] payload,
+    output reg                          busy,
+    output reg                          done,
+    output reg                          tx_valid,
+    output reg  [7:0]                   tx_data,
+    input  wire                         tx_ready
+);
+    localparam [7:0] MAGIC0 = 8'ha5;
+    localparam [7:0] MAGIC1 = 8'h5a;
+    localparam [7:0] VERSION = 8'h01;
+
+    reg [7:0] byte_index;
+    reg [7:0] total_bytes;
+    reg [15:0] crc;
+    wire [15:0] crc_next;
+    reg [7:0] send_byte;
+    reg [15:0] crc_after_accept;
+    reg [7:0] next_byte_index;
+    reg [7:0] next_send_byte;
+
+    binary921_crc16 u_crc (
+        .crc_in(crc),
+        .data(send_byte),
+        .crc_out(crc_next)
+    );
+
+    function [7:0] payload_byte;
+        input [7:0] index;
+        begin
+            payload_byte = payload[(index * 8) +: 8];
+        end
+    endfunction
+
+    always @* begin
+        case (byte_index)
+            8'd0: send_byte = MAGIC0;
+            8'd1: send_byte = MAGIC1;
+            8'd2: send_byte = VERSION;
+            8'd3: send_byte = profile_id;
+            8'd4: send_byte = frame_type;
+            8'd5: send_byte = frame_seq[7:0];
+            8'd6: send_byte = frame_seq[15:8];
+            8'd7: send_byte = frame_seq[23:16];
+            8'd8: send_byte = frame_seq[31:24];
+            8'd9: send_byte = timestamp_tick[7:0];
+            8'd10: send_byte = timestamp_tick[15:8];
+            8'd11: send_byte = timestamp_tick[23:16];
+            8'd12: send_byte = timestamp_tick[31:24];
+            8'd13: send_byte = payload_len;
+            default: begin
+                if (byte_index < (8'd14 + payload_len)) begin
+                    send_byte = payload_byte(byte_index - 8'd14);
+                end else if (byte_index == (8'd14 + payload_len)) begin
+                    send_byte = crc[7:0];
+                end else begin
+                    send_byte = crc[15:8];
+                end
+            end
+        endcase
+    end
+
+    always @* begin
+        crc_after_accept = crc;
+        if (byte_index >= 8'd2 && byte_index < (8'd14 + payload_len)) begin
+            crc_after_accept = crc_next;
+        end
+        next_byte_index = byte_index + 8'd1;
+        case (next_byte_index)
+            8'd0: next_send_byte = MAGIC0;
+            8'd1: next_send_byte = MAGIC1;
+            8'd2: next_send_byte = VERSION;
+            8'd3: next_send_byte = profile_id;
+            8'd4: next_send_byte = frame_type;
+            8'd5: next_send_byte = frame_seq[7:0];
+            8'd6: next_send_byte = frame_seq[15:8];
+            8'd7: next_send_byte = frame_seq[23:16];
+            8'd8: next_send_byte = frame_seq[31:24];
+            8'd9: next_send_byte = timestamp_tick[7:0];
+            8'd10: next_send_byte = timestamp_tick[15:8];
+            8'd11: next_send_byte = timestamp_tick[23:16];
+            8'd12: next_send_byte = timestamp_tick[31:24];
+            8'd13: next_send_byte = payload_len;
+            default: begin
+                if (next_byte_index < (8'd14 + payload_len)) begin
+                    next_send_byte = payload_byte(next_byte_index - 8'd14);
+                end else if (next_byte_index == (8'd14 + payload_len)) begin
+                    next_send_byte = crc_after_accept[7:0];
+                end else begin
+                    next_send_byte = crc_after_accept[15:8];
+                end
+            end
+        endcase
+    end
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            busy <= 1'b0;
+            done <= 1'b0;
+            tx_valid <= 1'b0;
+            tx_data <= 8'd0;
+            byte_index <= 8'd0;
+            total_bytes <= 8'd0;
+            crc <= 16'hffff;
+        end else begin
+            done <= 1'b0;
+            if (start && !busy) begin
+                busy <= 1'b1;
+                byte_index <= 8'd0;
+                total_bytes <= 8'd16 + payload_len;
+                crc <= 16'hffff;
+                tx_valid <= 1'b1;
+                tx_data <= MAGIC0;
+            end else if (busy && tx_valid && tx_ready) begin
+                if (byte_index >= 8'd2 && byte_index < (8'd14 + payload_len)) begin
+                    crc <= crc_next;
+                end
+                if (byte_index == total_bytes - 8'd1) begin
+                    busy <= 1'b0;
+                    done <= 1'b1;
+                    tx_valid <= 1'b0;
+                    byte_index <= 8'd0;
+                end else begin
+                    byte_index <= byte_index + 8'd1;
+                    tx_valid <= 1'b1;
+                    tx_data <= next_send_byte;
+                end
+            end else if (busy) begin
+                tx_valid <= 1'b1;
+            end else begin
+                tx_valid <= 1'b0;
+            end
+        end
+    end
+endmodule

+ 200 - 0
src/rtl/binary921_host_rx.v

@@ -0,0 +1,200 @@
+`timescale 1ns/1ps
+
+module binary921_host_rx (
+    input  wire        clk,
+    input  wire        rst_n,
+    input  wire [7:0]  expected_profile_id,
+    input  wire        rx_valid,
+    input  wire [7:0]  rx_data,
+    output wire        rx_ready,
+    output reg         cmd_valid,
+    output reg  [31:0] cmd_seq,
+    output reg  [7:0]  cmd_id,
+    output reg  [7:0]  cmd_ch,
+    output reg  [7:0]  cmd_pct,
+    output reg         bad_frame,
+    output reg  [15:0] bad_frame_count
+);
+    localparam [3:0] S_MAGIC0 = 4'd0;
+    localparam [3:0] S_MAGIC1 = 4'd1;
+    localparam [3:0] S_VERSION = 4'd2;
+    localparam [3:0] S_PROFILE = 4'd3;
+    localparam [3:0] S_TYPE = 4'd4;
+    localparam [3:0] S_SEQ0 = 4'd5;
+    localparam [3:0] S_SEQ1 = 4'd6;
+    localparam [3:0] S_SEQ2 = 4'd7;
+    localparam [3:0] S_SEQ3 = 4'd8;
+    localparam [3:0] S_TICK = 4'd9;
+    localparam [3:0] S_LEN = 4'd10;
+    localparam [3:0] S_PAYLOAD = 4'd11;
+    localparam [3:0] S_CRC0 = 4'd12;
+    localparam [3:0] S_CRC1 = 4'd13;
+
+    reg [3:0] state;
+    reg [1:0] tick_index;
+    reg [7:0] payload_len;
+    reg [7:0] payload_index;
+    reg [7:0] payload0;
+    reg [7:0] payload1;
+    reg [7:0] payload2;
+    reg [15:0] crc;
+    wire [15:0] crc_next;
+    reg [7:0] crc0;
+    reg [7:0] frame_type;
+
+    assign rx_ready = 1'b1;
+
+    binary921_crc16 u_crc (
+        .crc_in(crc),
+        .data(rx_data),
+        .crc_out(crc_next)
+    );
+
+    task fail_frame;
+        begin
+            state <= S_MAGIC0;
+            bad_frame <= 1'b1;
+            bad_frame_count <= bad_frame_count + 16'd1;
+            payload_index <= 8'd0;
+            payload_len <= 8'd0;
+            crc <= 16'hffff;
+        end
+    endtask
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            state <= S_MAGIC0;
+            tick_index <= 2'd0;
+            payload_len <= 8'd0;
+            payload_index <= 8'd0;
+            payload0 <= 8'd0;
+            payload1 <= 8'd0;
+            payload2 <= 8'd0;
+            frame_type <= 8'd0;
+            crc <= 16'hffff;
+            crc0 <= 8'd0;
+            cmd_valid <= 1'b0;
+            cmd_seq <= 32'd0;
+            cmd_id <= 8'd0;
+            cmd_ch <= 8'd0;
+            cmd_pct <= 8'd0;
+            bad_frame <= 1'b0;
+            bad_frame_count <= 16'd0;
+        end else begin
+            cmd_valid <= 1'b0;
+            bad_frame <= 1'b0;
+            if (rx_valid) begin
+                case (state)
+                    S_MAGIC0: begin
+                        if (rx_data == 8'ha5) begin
+                            state <= S_MAGIC1;
+                        end
+                    end
+                    S_MAGIC1: begin
+                        if (rx_data == 8'h5a) begin
+                            state <= S_VERSION;
+                            crc <= 16'hffff;
+                        end else if (rx_data == 8'ha5) begin
+                            state <= S_MAGIC1;
+                        end else begin
+                            state <= S_MAGIC0;
+                        end
+                    end
+                    S_VERSION: begin
+                        if (rx_data == 8'h01) begin
+                            crc <= crc_next;
+                            state <= S_PROFILE;
+                        end else begin
+                            fail_frame();
+                        end
+                    end
+                    S_PROFILE: begin
+                        if (rx_data == expected_profile_id) begin
+                            crc <= crc_next;
+                            state <= S_TYPE;
+                        end else begin
+                            fail_frame();
+                        end
+                    end
+                    S_TYPE: begin
+                        frame_type <= rx_data;
+                        crc <= crc_next;
+                        if (rx_data == 8'h05) begin
+                            state <= S_SEQ0;
+                        end else begin
+                            fail_frame();
+                        end
+                    end
+                    S_SEQ0: begin
+                        cmd_seq[7:0] <= rx_data;
+                        crc <= crc_next;
+                        state <= S_SEQ1;
+                    end
+                    S_SEQ1: begin
+                        cmd_seq[15:8] <= rx_data;
+                        crc <= crc_next;
+                        state <= S_SEQ2;
+                    end
+                    S_SEQ2: begin
+                        cmd_seq[23:16] <= rx_data;
+                        crc <= crc_next;
+                        state <= S_SEQ3;
+                    end
+                    S_SEQ3: begin
+                        cmd_seq[31:24] <= rx_data;
+                        crc <= crc_next;
+                        tick_index <= 2'd0;
+                        state <= S_TICK;
+                    end
+                    S_TICK: begin
+                        crc <= crc_next;
+                        if (tick_index == 2'd3) begin
+                            state <= S_LEN;
+                        end else begin
+                            tick_index <= tick_index + 2'd1;
+                        end
+                    end
+                    S_LEN: begin
+                        payload_len <= rx_data;
+                        payload_index <= 8'd0;
+                        payload0 <= 8'd0;
+                        payload1 <= 8'd0;
+                        payload2 <= 8'd0;
+                        crc <= crc_next;
+                        if (rx_data == 8'd0 || rx_data > 8'd3) begin
+                            fail_frame();
+                        end else begin
+                            state <= S_PAYLOAD;
+                        end
+                    end
+                    S_PAYLOAD: begin
+                        crc <= crc_next;
+                        if (payload_index == 8'd0) payload0 <= rx_data;
+                        if (payload_index == 8'd1) payload1 <= rx_data;
+                        if (payload_index == 8'd2) payload2 <= rx_data;
+                        if (payload_index + 8'd1 == payload_len) begin
+                            state <= S_CRC0;
+                        end
+                        payload_index <= payload_index + 8'd1;
+                    end
+                    S_CRC0: begin
+                        crc0 <= rx_data;
+                        state <= S_CRC1;
+                    end
+                    S_CRC1: begin
+                        if ({rx_data, crc0} == crc) begin
+                            cmd_id <= payload0;
+                            cmd_ch <= payload1;
+                            cmd_pct <= payload2;
+                            cmd_valid <= 1'b1;
+                            state <= S_MAGIC0;
+                        end else begin
+                            fail_frame();
+                        end
+                    end
+                    default: state <= S_MAGIC0;
+                endcase
+            end
+        end
+    end
+endmodule

+ 56 - 0
src/top/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top.v

@@ -0,0 +1,56 @@
+`timescale 1ns/1ps
+
+module uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top #(
+    parameter integer BMC_UART_CLKS_PER_BIT = 217,
+    parameter integer HOST_UART_CLKS_PER_BIT = 217,
+    parameter integer DEBUG_UART_CLKS_PER_BIT = 27,
+    parameter integer STARTUP_DELAY_TICKS = 250000,
+    parameter integer COMMAND_GAP_TICKS = 25000000,
+    parameter integer STATUS_PERIOD_TICKS = 25000000,
+    parameter integer HOST_TIMEOUT_TICKS = 125000000,
+    parameter integer PTC_PWM_PERIOD_TICKS = 2500000,
+    parameter integer FAN_PWM_PERIOD_TICKS = 1000,
+    parameter integer SNAPSHOT_PERIOD_TICKS = 25000000
+) (
+    input  wire        sys_clk,
+    input  wire        sys_rst_n,
+    input  wire        bmc_uart_rx,
+    output wire        bmc_uart_tx,
+    input  wire        debug_uart_rx,
+    output wire        debug_uart_tx,
+    input  wire        host_uart_rx,
+    output wire        host_uart_tx,
+    output wire [23:0] ptc_pwm_out,
+    output wire [3:0]  fan_pwm_out,
+    input  wire [7:0]  fan_fg_in,
+    input  wire [3:0]  fan_install_in,
+    output wire [7:0]  led
+);
+    binary921_diag_core #(
+        .BMC_UART_CLKS_PER_BIT(BMC_UART_CLKS_PER_BIT),
+        .HOST_UART_CLKS_PER_BIT(HOST_UART_CLKS_PER_BIT),
+        .DEBUG_UART_CLKS_PER_BIT(DEBUG_UART_CLKS_PER_BIT),
+        .STARTUP_DELAY_TICKS(STARTUP_DELAY_TICKS),
+        .COMMAND_GAP_TICKS(COMMAND_GAP_TICKS),
+        .STATUS_PERIOD_TICKS(STATUS_PERIOD_TICKS),
+        .HOST_TIMEOUT_TICKS(HOST_TIMEOUT_TICKS),
+        .PTC_PWM_PERIOD_TICKS(PTC_PWM_PERIOD_TICKS),
+        .FAN_PWM_PERIOD_TICKS(FAN_PWM_PERIOD_TICKS),
+        .SNAPSHOT_PERIOD_TICKS(SNAPSHOT_PERIOD_TICKS),
+        .PIN_PROFILE(0)
+    ) u_core (
+        .sys_clk(sys_clk),
+        .sys_rst_n(sys_rst_n),
+        .bmc_uart_rx(bmc_uart_rx),
+        .bmc_uart_tx(bmc_uart_tx),
+        .debug_uart_rx(debug_uart_rx),
+        .debug_uart_tx(debug_uart_tx),
+        .host_uart_rx(host_uart_rx),
+        .host_uart_tx(host_uart_tx),
+        .ptc_pwm_out(ptc_pwm_out),
+        .fan_pwm_out(fan_pwm_out),
+        .fan_fg_in(fan_fg_in),
+        .fan_install_in(fan_install_in),
+        .led(led)
+    );
+endmodule

+ 56 - 0
src/top/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top.v

@@ -0,0 +1,56 @@
+`timescale 1ns/1ps
+
+module uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top #(
+    parameter integer BMC_UART_CLKS_PER_BIT = 217,
+    parameter integer HOST_UART_CLKS_PER_BIT = 217,
+    parameter integer DEBUG_UART_CLKS_PER_BIT = 27,
+    parameter integer STARTUP_DELAY_TICKS = 250000,
+    parameter integer COMMAND_GAP_TICKS = 25000000,
+    parameter integer STATUS_PERIOD_TICKS = 25000000,
+    parameter integer HOST_TIMEOUT_TICKS = 125000000,
+    parameter integer PTC_PWM_PERIOD_TICKS = 2500000,
+    parameter integer FAN_PWM_PERIOD_TICKS = 1000,
+    parameter integer SNAPSHOT_PERIOD_TICKS = 25000000
+) (
+    input  wire        sys_clk,
+    input  wire        sys_rst_n,
+    input  wire        bmc_uart_rx,
+    output wire        bmc_uart_tx,
+    input  wire        debug_uart_rx,
+    output wire        debug_uart_tx,
+    input  wire        host_uart_rx,
+    output wire        host_uart_tx,
+    output wire [23:0] ptc_pwm_out,
+    output wire [3:0]  fan_pwm_out,
+    input  wire [7:0]  fan_fg_in,
+    input  wire [3:0]  fan_install_in,
+    output wire [7:0]  led
+);
+    binary921_diag_core #(
+        .BMC_UART_CLKS_PER_BIT(BMC_UART_CLKS_PER_BIT),
+        .HOST_UART_CLKS_PER_BIT(HOST_UART_CLKS_PER_BIT),
+        .DEBUG_UART_CLKS_PER_BIT(DEBUG_UART_CLKS_PER_BIT),
+        .STARTUP_DELAY_TICKS(STARTUP_DELAY_TICKS),
+        .COMMAND_GAP_TICKS(COMMAND_GAP_TICKS),
+        .STATUS_PERIOD_TICKS(STATUS_PERIOD_TICKS),
+        .HOST_TIMEOUT_TICKS(HOST_TIMEOUT_TICKS),
+        .PTC_PWM_PERIOD_TICKS(PTC_PWM_PERIOD_TICKS),
+        .FAN_PWM_PERIOD_TICKS(FAN_PWM_PERIOD_TICKS),
+        .SNAPSHOT_PERIOD_TICKS(SNAPSHOT_PERIOD_TICKS),
+        .PIN_PROFILE(1)
+    ) u_core (
+        .sys_clk(sys_clk),
+        .sys_rst_n(sys_rst_n),
+        .bmc_uart_rx(bmc_uart_rx),
+        .bmc_uart_tx(bmc_uart_tx),
+        .debug_uart_rx(debug_uart_rx),
+        .debug_uart_tx(debug_uart_tx),
+        .host_uart_rx(host_uart_rx),
+        .host_uart_tx(host_uart_tx),
+        .ptc_pwm_out(ptc_pwm_out),
+        .fan_pwm_out(fan_pwm_out),
+        .fan_fg_in(fan_fg_in),
+        .fan_install_in(fan_install_in),
+        .led(led)
+    );
+endmodule

+ 57 - 0
src/top/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top.v

@@ -0,0 +1,57 @@
+`timescale 1ns/1ps
+
+module uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top #(
+    parameter integer BMC_UART_CLKS_PER_BIT = 217,
+    parameter integer HOST_UART_CLKS_PER_BIT = 27,
+    parameter integer DEBUG_UART_CLKS_PER_BIT = 27,
+    parameter integer STARTUP_DELAY_TICKS = 250000,
+    parameter integer COMMAND_GAP_TICKS = 25000000,
+    parameter integer STATUS_PERIOD_TICKS = 25000000,
+    parameter integer HOST_TIMEOUT_TICKS = 125000000,
+    parameter integer PTC_PWM_PERIOD_TICKS = 2500000,
+    parameter integer FAN_PWM_PERIOD_TICKS = 1000,
+    parameter integer SNAPSHOT_PERIOD_TICKS = 25000000
+) (
+    input  wire        sys_clk,
+    input  wire        sys_rst_n,
+    input  wire        bmc_uart_rx,
+    output wire        bmc_uart_tx,
+    input  wire        host_uart_rx,
+    output wire        host_uart_tx,
+    output wire [23:0] ptc_pwm_out,
+    output wire [3:0]  fan_pwm_out,
+    input  wire [7:0]  fan_fg_in,
+    input  wire [3:0]  fan_install_in,
+    output wire [7:0]  led
+);
+    wire unused_debug_uart_tx;
+
+    binary921_diag_core #(
+        .BMC_UART_CLKS_PER_BIT(BMC_UART_CLKS_PER_BIT),
+        .HOST_UART_CLKS_PER_BIT(HOST_UART_CLKS_PER_BIT),
+        .DEBUG_UART_CLKS_PER_BIT(DEBUG_UART_CLKS_PER_BIT),
+        .STARTUP_DELAY_TICKS(STARTUP_DELAY_TICKS),
+        .COMMAND_GAP_TICKS(COMMAND_GAP_TICKS),
+        .STATUS_PERIOD_TICKS(STATUS_PERIOD_TICKS),
+        .HOST_TIMEOUT_TICKS(HOST_TIMEOUT_TICKS),
+        .PTC_PWM_PERIOD_TICKS(PTC_PWM_PERIOD_TICKS),
+        .FAN_PWM_PERIOD_TICKS(FAN_PWM_PERIOD_TICKS),
+        .SNAPSHOT_PERIOD_TICKS(SNAPSHOT_PERIOD_TICKS),
+        .PIN_PROFILE(2),
+        .COMBINED_HOST_DEBUG_UART(1)
+    ) u_core (
+        .sys_clk(sys_clk),
+        .sys_rst_n(sys_rst_n),
+        .bmc_uart_rx(bmc_uart_rx),
+        .bmc_uart_tx(bmc_uart_tx),
+        .debug_uart_rx(1'b1),
+        .debug_uart_tx(unused_debug_uart_tx),
+        .host_uart_rx(host_uart_rx),
+        .host_uart_tx(host_uart_tx),
+        .ptc_pwm_out(ptc_pwm_out),
+        .fan_pwm_out(fan_pwm_out),
+        .fan_fg_in(fan_fg_in),
+        .fan_install_in(fan_install_in),
+        .led(led)
+    );
+endmodule

+ 15 - 0
td/phy/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.tcl

@@ -0,0 +1,15 @@
+import_device ef2_4.db -package EF2L45BG256B
+import_db ../syn/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_gate.db
+read_adc {constraints/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.adc}
+read_sdc {constraints/pid_study_01.sdc}
+place
+update_timing -mode manhattan
+report_area -io_info -file uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_phy.area
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_place.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_place.db
+route
+update_timing
+report_area -io_info -file uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_phy.area
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_pr.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_pr.db
+bitgen -bit uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.bit

+ 15 - 0
td/phy/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.tcl

@@ -0,0 +1,15 @@
+import_device ef2_4.db -package EF2L45BG256B
+import_db ../syn/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_gate.db
+read_adc {constraints/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.adc}
+read_sdc {constraints/pid_study_01.sdc}
+place
+update_timing -mode manhattan
+report_area -io_info -file uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_phy.area
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_place.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_place.db
+route
+update_timing
+report_area -io_info -file uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_phy.area
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_pr.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_pr.db
+bitgen -bit uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.bit

+ 15 - 0
td/phy/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.tcl

@@ -0,0 +1,15 @@
+import_device ef2_4.db -package EF2L45BG256B
+import_db ../syn/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_gate.db
+read_adc {constraints/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.adc}
+read_sdc {constraints/pid_study_01.sdc}
+place
+update_timing -mode manhattan
+report_area -io_info -file uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_phy.area
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_place.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_place.db
+route
+update_timing
+report_area -io_info -file uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_phy.area
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_pr.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_pr.db
+bitgen -bit uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.bit

+ 20 - 0
td/syn/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.tcl

@@ -0,0 +1,20 @@
+import_device ef2_4.db -package EF2L45BG256B
+analyze -file {src/rtl/uart_rx_8n1.v}
+analyze -file {src/rtl/uart_tx_8n1.v}
+analyze -file {src/rtl/bmc_uart_raw48_poll_lite.v}
+analyze -file {src/rtl/binary921_crc16.v}
+analyze -file {src/rtl/binary921_frame_tx.v}
+analyze -file {src/rtl/binary921_host_rx.v}
+analyze -file {src/rtl/binary921_diag_core.v}
+analyze -file {src/top/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top.v}
+elaborate -top {uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top}
+read_adc {constraints/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.adc}
+read_sdc {constraints/pid_study_01.sdc}
+optimize_rtl
+report_area -file uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_rtl.area
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_rtl.db
+optimize_gate uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_gate.area
+legalize_phy_inst
+update_timing
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_gate.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_gate.db

+ 20 - 0
td/syn/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.tcl

@@ -0,0 +1,20 @@
+import_device ef2_4.db -package EF2L45BG256B
+analyze -file {src/rtl/uart_rx_8n1.v}
+analyze -file {src/rtl/uart_tx_8n1.v}
+analyze -file {src/rtl/bmc_uart_raw48_poll_lite.v}
+analyze -file {src/rtl/binary921_crc16.v}
+analyze -file {src/rtl/binary921_frame_tx.v}
+analyze -file {src/rtl/binary921_host_rx.v}
+analyze -file {src/rtl/binary921_diag_core.v}
+analyze -file {src/top/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top.v}
+elaborate -top {uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top}
+read_adc {constraints/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.adc}
+read_sdc {constraints/pid_study_01.sdc}
+optimize_rtl
+report_area -file uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_rtl.area
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_rtl.db
+optimize_gate uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_gate.area
+legalize_phy_inst
+update_timing
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_gate.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_gate.db

+ 20 - 0
td/syn/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.tcl

@@ -0,0 +1,20 @@
+import_device ef2_4.db -package EF2L45BG256B
+analyze -file {src/rtl/uart_rx_8n1.v}
+analyze -file {src/rtl/uart_tx_8n1.v}
+analyze -file {src/rtl/bmc_uart_raw48_poll_lite.v}
+analyze -file {src/rtl/binary921_crc16.v}
+analyze -file {src/rtl/binary921_frame_tx.v}
+analyze -file {src/rtl/binary921_host_rx.v}
+analyze -file {src/rtl/binary921_diag_core.v}
+analyze -file {src/top/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top.v}
+elaborate -top {uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top}
+read_adc {constraints/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.adc}
+read_sdc {constraints/pid_study_01.sdc}
+optimize_rtl
+report_area -file uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_rtl.area
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_rtl.db
+optimize_gate uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_gate.area
+legalize_phy_inst
+update_timing
+report_timing_summary -file uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_gate.timing
+export_db uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_gate.db

+ 34 - 0
td/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.prj

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Project Version="3" Minor="2" RunTime="2026-07-09T00:00:00">
+    <Project_Created_Time></Project_Created_Time>
+    <TD_Version>6.2.2.198412</TD_Version>
+    <Name>uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921</Name>
+    <HardWare>
+        <Family>EF2</Family>
+        <Device>EF2L45BG256B</Device>
+        <Speed></Speed>
+    </HardWare>
+    <Source_Files>
+        <Verilog>
+            <File Path="../src/rtl/uart_rx_8n1.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="1"/></FileInfo></File>
+            <File Path="../src/rtl/uart_tx_8n1.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="2"/></FileInfo></File>
+            <File Path="../src/rtl/bmc_uart_raw48_poll_lite.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="3"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_crc16.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="4"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_frame_tx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="5"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_host_rx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="6"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_diag_core.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="7"/></FileInfo></File>
+            <File Path="../src/top/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="8"/></FileInfo></File>
+        </Verilog>
+        <ADC_FILE>
+            <File Path="../constraints/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.adc"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="constraint_1"/><Attr Name="CompileOrder" Val="1"/></FileInfo></File>
+        </ADC_FILE>
+        <SDC_FILE>
+            <File Path="../constraints/pid_study_01.sdc"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="constraint_1"/><Attr Name="CompileOrder" Val="2"/></FileInfo></File>
+        </SDC_FILE>
+    </Source_Files>
+    <TOP_MODULE>
+        <LABEL></LABEL>
+        <MODULE>uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top</MODULE>
+        <CREATEINDEX>user</CREATEINDEX>
+    </TOP_MODULE>
+</Project>

+ 34 - 0
td/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.prj

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Project Version="3" Minor="2" RunTime="2026-07-09T00:00:00">
+    <Project_Created_Time></Project_Created_Time>
+    <TD_Version>6.2.2.198412</TD_Version>
+    <Name>uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921</Name>
+    <HardWare>
+        <Family>EF2</Family>
+        <Device>EF2L45BG256B</Device>
+        <Speed></Speed>
+    </HardWare>
+    <Source_Files>
+        <Verilog>
+            <File Path="../src/rtl/uart_rx_8n1.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="1"/></FileInfo></File>
+            <File Path="../src/rtl/uart_tx_8n1.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="2"/></FileInfo></File>
+            <File Path="../src/rtl/bmc_uart_raw48_poll_lite.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="3"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_crc16.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="4"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_frame_tx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="5"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_host_rx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="6"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_diag_core.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="7"/></FileInfo></File>
+            <File Path="../src/top/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="8"/></FileInfo></File>
+        </Verilog>
+        <ADC_FILE>
+            <File Path="../constraints/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.adc"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="constraint_1"/><Attr Name="CompileOrder" Val="1"/></FileInfo></File>
+        </ADC_FILE>
+        <SDC_FILE>
+            <File Path="../constraints/pid_study_01.sdc"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="constraint_1"/><Attr Name="CompileOrder" Val="2"/></FileInfo></File>
+        </SDC_FILE>
+    </Source_Files>
+    <TOP_MODULE>
+        <LABEL></LABEL>
+        <MODULE>uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top</MODULE>
+        <CREATEINDEX>user</CREATEINDEX>
+    </TOP_MODULE>
+</Project>

+ 34 - 0
td/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.prj

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Project Version="3" Minor="2" RunTime="2026-07-10T00:00:00">
+    <Project_Created_Time></Project_Created_Time>
+    <TD_Version>6.2.2.198412</TD_Version>
+    <Name>uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921</Name>
+    <HardWare>
+        <Family>EF2</Family>
+        <Device>EF2L45BG256B</Device>
+        <Speed></Speed>
+    </HardWare>
+    <Source_Files>
+        <Verilog>
+            <File Path="../src/rtl/uart_rx_8n1.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="1"/></FileInfo></File>
+            <File Path="../src/rtl/uart_tx_8n1.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="2"/></FileInfo></File>
+            <File Path="../src/rtl/bmc_uart_raw48_poll_lite.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="3"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_crc16.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="4"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_frame_tx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="5"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_host_rx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="6"/></FileInfo></File>
+            <File Path="../src/rtl/binary921_diag_core.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="7"/></FileInfo></File>
+            <File Path="../src/top/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="8"/></FileInfo></File>
+        </Verilog>
+        <ADC_FILE>
+            <File Path="../constraints/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.adc"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="constraint_1"/><Attr Name="CompileOrder" Val="1"/></FileInfo></File>
+        </ADC_FILE>
+        <SDC_FILE>
+            <File Path="../constraints/pid_study_01.sdc"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="constraint_1"/><Attr Name="CompileOrder" Val="2"/></FileInfo></File>
+        </SDC_FILE>
+    </Source_Files>
+    <TOP_MODULE>
+        <LABEL></LABEL>
+        <MODULE>uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top</MODULE>
+        <CREATEINDEX>user</CREATEINDEX>
+    </TOP_MODULE>
+</Project>

+ 490 - 0
tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_binary921_top_tb.v

@@ -0,0 +1,490 @@
+`timescale 1ns/1ps
+
+module uart_rs232_j6_host_sensor_real_fan_ptc_binary921_top_tb;
+    localparam integer BMC_SIM_CLKS_PER_BIT = 8;
+    reg clk;
+    reg rst_n;
+    reg bmc_uart_rx;
+    wire bmc_uart_tx;
+    reg debug_uart_rx;
+    wire debug_uart_tx;
+    reg host_uart_rx;
+    wire host_uart_tx;
+    wire [23:0] ptc_pwm_out;
+    wire [3:0] fan_pwm_out;
+    reg [7:0] fan_fg_in;
+    reg [3:0] fan_install_in;
+    wire [7:0] led;
+
+    reg [7:0] debug_bytes [0:63];
+    reg [7:0] host_bytes [0:63];
+    integer debug_count;
+    integer host_count;
+    integer timeout;
+    integer pwm_high_count;
+    integer pwm_low_count;
+    integer bmc_count;
+    integer bmc_index;
+    integer bmc_poll_start;
+    integer bmc_poll_wait_count;
+    integer bmc_payload_seen;
+    integer sensor_cache_seen;
+    reg [15:0] bmc_expected_checksum;
+    reg [7:0] bmc_tx_bytes [0:127];
+    integer bmc_tx_count;
+
+    uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top #(
+        .BMC_UART_CLKS_PER_BIT(BMC_SIM_CLKS_PER_BIT),
+        .HOST_UART_CLKS_PER_BIT(4),
+        .DEBUG_UART_CLKS_PER_BIT(4),
+        .STARTUP_DELAY_TICKS(4),
+        .COMMAND_GAP_TICKS(64),
+        .STATUS_PERIOD_TICKS(64),
+        .HOST_TIMEOUT_TICKS(5000),
+        .PTC_PWM_PERIOD_TICKS(100),
+        .FAN_PWM_PERIOD_TICKS(100),
+        .SNAPSHOT_PERIOD_TICKS(32)
+    ) dut (
+        .sys_clk(clk),
+        .sys_rst_n(rst_n),
+        .bmc_uart_rx(bmc_uart_rx),
+        .bmc_uart_tx(bmc_uart_tx),
+        .debug_uart_rx(debug_uart_rx),
+        .debug_uart_tx(debug_uart_tx),
+        .host_uart_rx(host_uart_rx),
+        .host_uart_tx(host_uart_tx),
+        .ptc_pwm_out(ptc_pwm_out),
+        .fan_pwm_out(fan_pwm_out),
+        .fan_fg_in(fan_fg_in),
+        .fan_install_in(fan_install_in),
+        .led(led)
+    );
+
+    initial begin
+        clk = 1'b0;
+        forever #5 clk = ~clk;
+    end
+
+    task capture_uart_byte_bmc_monitor;
+        output [7:0] value;
+        integer bit_index;
+        begin
+            @(negedge bmc_uart_tx);
+            repeat (BMC_SIM_CLKS_PER_BIT + (BMC_SIM_CLKS_PER_BIT >> 1)) @(posedge clk);
+            value = 8'd0;
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                value[bit_index] = bmc_uart_tx;
+                repeat (BMC_SIM_CLKS_PER_BIT) @(posedge clk);
+            end
+            if (bmc_uart_tx !== 1'b1) begin
+                $display("bmc monitor stop bit mismatch count=%0d value=%02x", bmc_tx_count, value);
+                $fatal;
+            end
+            repeat (1) @(posedge clk);
+        end
+    endtask
+
+    initial begin
+        bmc_tx_count = 0;
+        wait (rst_n === 1'b1);
+        forever begin
+            if (bmc_tx_count < 128) begin
+                capture_uart_byte_bmc_monitor(bmc_tx_bytes[bmc_tx_count]);
+                bmc_tx_count = bmc_tx_count + 1;
+            end else begin
+                @(posedge clk);
+            end
+        end
+    end
+
+    function [15:0] crc16_update;
+        input [15:0] crc_in;
+        input [7:0] data;
+        reg [15:0] crc;
+        integer i;
+        begin
+            crc = crc_in ^ {data, 8'h00};
+            for (i = 0; i < 8; i = i + 1) begin
+                if (crc[15]) begin
+                    crc = (crc << 1) ^ 16'h1021;
+                end else begin
+                    crc = (crc << 1);
+                end
+            end
+            crc16_update = crc;
+        end
+    endfunction
+
+    task drive_uart_byte_host;
+        input [7:0] value;
+        integer bit_index;
+        begin
+            host_uart_rx = 1'b0;
+            repeat (4) @(posedge clk);
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                host_uart_rx = value[bit_index];
+                repeat (4) @(posedge clk);
+            end
+            host_uart_rx = 1'b1;
+            repeat (4) @(posedge clk);
+        end
+    endtask
+
+    task drive_uart_byte_bmc;
+        input [7:0] value;
+        integer bit_index;
+        begin
+            bmc_uart_rx = 1'b0;
+            repeat (BMC_SIM_CLKS_PER_BIT) @(posedge clk);
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                bmc_uart_rx = value[bit_index];
+                repeat (BMC_SIM_CLKS_PER_BIT) @(posedge clk);
+            end
+            bmc_uart_rx = 1'b1;
+            repeat (BMC_SIM_CLKS_PER_BIT) @(posedge clk);
+        end
+    endtask
+
+    task capture_uart_byte_bmc_tx;
+        output [7:0] value;
+        integer bit_index;
+        integer start_seen;
+        begin
+            timeout = 0;
+            while (bmc_uart_tx !== 1'b1 && timeout < 5000) begin
+                @(posedge clk);
+                timeout = timeout + 1;
+            end
+            start_seen = 0;
+            fork
+                begin
+                    @(negedge bmc_uart_tx);
+                    start_seen = 1;
+                end
+                begin
+                    repeat (5000) @(posedge clk);
+                end
+            join_any
+            disable fork;
+            if (timeout >= 5000) begin
+                $display("bmc poll byte timeout");
+                $fatal;
+            end
+            if (!start_seen) begin
+                $display("bmc poll byte timeout");
+                $fatal;
+            end
+            repeat (BMC_SIM_CLKS_PER_BIT + (BMC_SIM_CLKS_PER_BIT >> 1)) @(posedge clk);
+            value = 8'd0;
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                value[bit_index] = bmc_uart_tx;
+                repeat (BMC_SIM_CLKS_PER_BIT) @(posedge clk);
+            end
+            if (bmc_uart_tx !== 1'b1) begin
+                $display("bmc poll stop bit mismatch");
+                $fatal;
+            end
+            repeat (2) @(posedge clk);
+        end
+    endtask
+
+    task capture_uart_byte_debug;
+        output [7:0] value;
+        integer bit_index;
+        integer start_seen;
+        begin
+            timeout = 0;
+            while (debug_uart_tx !== 1'b1 && timeout < 2000) begin
+                @(posedge clk);
+                timeout = timeout + 1;
+            end
+            start_seen = 0;
+            fork
+                begin
+                    @(negedge debug_uart_tx);
+                    start_seen = 1;
+                end
+                begin
+                    repeat (2000) @(posedge clk);
+                end
+            join_any
+            disable fork;
+            if (timeout >= 2000) begin
+                $display("debug byte timeout");
+                $fatal;
+            end
+            if (!start_seen) begin
+                $display("debug byte timeout");
+                $fatal;
+            end
+            repeat (6) @(posedge clk);
+            value = 8'd0;
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                value[bit_index] = debug_uart_tx;
+                repeat (4) @(posedge clk);
+            end
+            if (debug_uart_tx !== 1'b1) begin
+                $display("debug stop bit mismatch");
+                $fatal;
+            end
+            repeat (2) @(posedge clk);
+        end
+    endtask
+
+    task capture_uart_byte_host;
+        output [7:0] value;
+        integer bit_index;
+        integer start_seen;
+        begin
+            timeout = 0;
+            while (host_uart_tx !== 1'b1 && timeout < 2000) begin
+                @(posedge clk);
+                timeout = timeout + 1;
+            end
+            start_seen = 0;
+            fork
+                begin
+                    @(negedge host_uart_tx);
+                    start_seen = 1;
+                end
+                begin
+                    repeat (2000) @(posedge clk);
+                end
+            join_any
+            disable fork;
+            if (timeout >= 2000) begin
+                $display("host byte timeout");
+                $fatal;
+            end
+            if (!start_seen) begin
+                $display("host byte timeout");
+                $fatal;
+            end
+            repeat (6) @(posedge clk);
+            value = 8'd0;
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                value[bit_index] = host_uart_tx;
+                repeat (4) @(posedge clk);
+            end
+            if (host_uart_tx !== 1'b1) begin
+                $display("host stop bit mismatch");
+                $fatal;
+            end
+            repeat (2) @(posedge clk);
+        end
+    endtask
+
+    task capture_debug_binary_frame;
+        output [7:0] frame_type;
+        output [7:0] payload_len;
+        integer byte_index;
+        integer payload_limit;
+        begin
+            debug_bytes[0] = 8'd0;
+            debug_bytes[1] = 8'd0;
+            while (!(debug_bytes[0] == 8'ha5 && debug_bytes[1] == 8'h5a)) begin
+                debug_bytes[0] = debug_bytes[1];
+                capture_uart_byte_debug(debug_bytes[1]);
+            end
+            debug_bytes[0] = 8'ha5;
+            for (byte_index = 2; byte_index < 14; byte_index = byte_index + 1) begin
+                capture_uart_byte_debug(debug_bytes[byte_index]);
+            end
+            frame_type = debug_bytes[4];
+            payload_len = debug_bytes[13];
+            payload_limit = payload_len;
+            if (payload_limit > 48) begin
+                payload_limit = 48;
+            end
+            for (byte_index = 0; byte_index < payload_limit; byte_index = byte_index + 1) begin
+                capture_uart_byte_debug(debug_bytes[14 + byte_index]);
+            end
+            for (byte_index = payload_limit; byte_index < payload_len; byte_index = byte_index + 1) begin
+                capture_uart_byte_debug(debug_bytes[62]);
+            end
+            capture_uart_byte_debug(debug_bytes[62]);
+            capture_uart_byte_debug(debug_bytes[63]);
+        end
+    endtask
+
+    task send_set_ptc01_10;
+        reg [15:0] crc;
+        begin
+            // magic, version=1, profile=1, type=HOST_CMD, seq=1, tick=0, len=3, payload SET_PTC/1/10
+            crc = 16'hffff;
+            drive_uart_byte_host(8'ha5);
+            drive_uart_byte_host(8'h5a);
+            drive_uart_byte_host(8'h01); crc = crc16_update(crc, 8'h01);
+            drive_uart_byte_host(8'h01); crc = crc16_update(crc, 8'h01);
+            drive_uart_byte_host(8'h05); crc = crc16_update(crc, 8'h05);
+            drive_uart_byte_host(8'h01); crc = crc16_update(crc, 8'h01);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h03); crc = crc16_update(crc, 8'h03);
+            drive_uart_byte_host(8'h20); crc = crc16_update(crc, 8'h20);
+            drive_uart_byte_host(8'h01); crc = crc16_update(crc, 8'h01);
+            drive_uart_byte_host(8'h0a); crc = crc16_update(crc, 8'h0a);
+            drive_uart_byte_host(crc[7:0]);
+            drive_uart_byte_host(crc[15:8]);
+        end
+    endtask
+
+    task send_bmc_replay_payload;
+        begin
+            bmc_expected_checksum = 16'd0;
+            for (bmc_index = 0; bmc_index < 24; bmc_index = bmc_index + 1) begin
+                drive_uart_byte_bmc(hex_char((8'h28 + bmc_index[7:0]) >> 4));
+                drive_uart_byte_bmc(hex_char(8'h28 + bmc_index[7:0]));
+                drive_uart_byte_bmc(" ");
+                drive_uart_byte_bmc("0");
+                drive_uart_byte_bmc("0");
+                drive_uart_byte_bmc(" ");
+                bmc_expected_checksum = bmc_expected_checksum + {8'd0, (8'h28 + bmc_index[7:0])};
+            end
+            drive_uart_byte_bmc(8'h0d);
+            drive_uart_byte_bmc(8'h0a);
+        end
+    endtask
+
+    function [7:0] hex_char;
+        input [7:0] value;
+        reg [3:0] nibble;
+        begin
+            nibble = value[3:0];
+            if (nibble < 4'd10) begin
+                hex_char = "0" + {4'd0, nibble};
+            end else begin
+                hex_char = "a" + {4'd0, nibble - 4'd10};
+            end
+        end
+    endfunction
+
+    initial begin
+        rst_n = 1'b0;
+        bmc_uart_rx = 1'b1;
+        debug_uart_rx = 1'b1;
+        host_uart_rx = 1'b1;
+        fan_fg_in = 8'h00;
+        fan_install_in = 4'hf;
+        repeat (5) @(posedge clk);
+        rst_n = 1'b1;
+
+        debug_count = 0;
+        repeat (16) begin
+            capture_uart_byte_debug(debug_bytes[debug_count]);
+            debug_count = debug_count + 1;
+        end
+        if (debug_bytes[0] !== 8'ha5 || debug_bytes[1] !== 8'h5a ||
+            debug_bytes[2] !== 8'h01 || debug_bytes[4] !== 8'h01) begin
+            $display("READY binary frame missing");
+            for (timeout = 0; timeout < 16; timeout = timeout + 1) begin
+                $display("debug_bytes[%0d]=%02x", timeout, debug_bytes[timeout]);
+            end
+            $fatal;
+        end
+
+        bmc_poll_start = -1;
+        bmc_poll_wait_count = 0;
+        while (bmc_poll_start < 0 && bmc_poll_wait_count < 20000) begin
+            @(posedge clk);
+            for (bmc_index = 0; bmc_index < bmc_tx_count; bmc_index = bmc_index + 1) begin
+                if (bmc_tx_bytes[bmc_index] == "i" && bmc_poll_start < 0) begin
+                    bmc_poll_start = bmc_index;
+                end
+            end
+            bmc_poll_wait_count = bmc_poll_wait_count + 1;
+        end
+        if (bmc_poll_start < 0) begin
+            $display("BMC poll command was not emitted after startup wake bytes");
+            for (bmc_index = 0; bmc_index < bmc_tx_count; bmc_index = bmc_index + 1) begin
+                $display("bmc_tx_bytes[%0d]=%02x", bmc_index, bmc_tx_bytes[bmc_index]);
+            end
+            $fatal;
+        end
+        timeout = 0;
+        while (bmc_tx_count < bmc_poll_start + 43 && timeout < 20000) begin
+            @(posedge clk);
+            timeout = timeout + 1;
+        end
+        if (bmc_tx_count < bmc_poll_start + 43 || bmc_tx_bytes[bmc_poll_start + 42] !== 8'h0a) begin
+            $display("BMC poll command did not complete");
+            $display("bmc_poll_start=%0d", bmc_poll_start);
+            $display("bmc_tx_count=%0d", bmc_tx_count);
+            $display("bmc_needed_count=%0d", bmc_poll_start + 43);
+            for (bmc_index = 0; bmc_index < bmc_tx_count; bmc_index = bmc_index + 1) begin
+                $display("bmc_tx_bytes[%0d]=%02x", bmc_index, bmc_tx_bytes[bmc_index]);
+            end
+            $fatal;
+        end
+        send_bmc_replay_payload();
+
+        bmc_payload_seen = 0;
+        sensor_cache_seen = 0;
+        repeat (24) begin
+            capture_debug_binary_frame(debug_bytes[60], debug_bytes[61]);
+            if (debug_bytes[60] == 8'h03) begin
+                bmc_payload_seen = 1;
+                if (debug_bytes[61] !== 8'd8 || debug_bytes[14] !== 8'd48 ||
+                    debug_bytes[15] !== 8'd48 || debug_bytes[18] !== 8'h28 ||
+                    debug_bytes[19] !== 8'h00 || {debug_bytes[21], debug_bytes[20]} !== bmc_expected_checksum) begin
+                    $display("BMC_PAYLOAD summary mismatch len=%02x count=%02x first=%02x last=%02x sum=%02x%02x expected=%04x",
+                             debug_bytes[14], debug_bytes[15], debug_bytes[18], debug_bytes[19],
+                             debug_bytes[20], debug_bytes[21], bmc_expected_checksum);
+                    $fatal;
+                end
+            end
+            if (debug_bytes[60] == 8'h04) begin
+                sensor_cache_seen = 1;
+            end
+        end
+        if (!bmc_payload_seen || !sensor_cache_seen) begin
+            $display("BMC payload/cache binary frames missing");
+            $display("bmc_rx_byte_count=%0d token_count=%0d frame_seq=%0d parser_state=%0d payload_pending=%0d cache_pending=%0d",
+                     dut.u_core.bmc_rx_byte_count,
+                     dut.u_core.bmc_token_count,
+                     dut.u_core.bmc_frame_seq,
+                     dut.u_core.bmc_parser_state,
+                     dut.u_core.bmc_payload_pending,
+                     dut.u_core.sensor_cache_pending);
+            $fatal;
+        end
+
+        send_set_ptc01_10();
+
+        host_count = 0;
+        repeat (22) begin
+            capture_uart_byte_host(host_bytes[host_count]);
+            host_count = host_count + 1;
+        end
+        if (host_bytes[0] !== 8'ha5 || host_bytes[1] !== 8'h5a ||
+            host_bytes[2] !== 8'h01 || host_bytes[4] !== 8'h06 ||
+            host_bytes[14] !== 8'h01 || host_bytes[15] !== 8'h20 ||
+            host_bytes[16] !== 8'h00) begin
+            $display("HOST_ACK binary frame mismatch");
+            $fatal;
+        end
+
+        pwm_high_count = 0;
+        pwm_low_count = 0;
+        repeat (180) begin
+            @(posedge clk);
+            if (ptc_pwm_out[0]) begin
+                pwm_high_count = pwm_high_count + 1;
+            end else begin
+                pwm_low_count = pwm_low_count + 1;
+            end
+        end
+        if (pwm_high_count == 0 || pwm_low_count == 0) begin
+            $display("PTC01 PWM did not produce both high and low phases after binary SET_PTC");
+            $fatal;
+        end
+
+        $display("PASS: uart_rs232_j6_host_sensor_real_fan_ptc_binary921_top_tb");
+        $finish;
+    end
+endmodule

+ 230 - 0
tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top_tb.v

@@ -0,0 +1,230 @@
+`timescale 1ns/1ps
+
+module uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top_tb;
+    reg clk;
+    reg rst_n;
+    reg bmc_uart_rx;
+    wire bmc_uart_tx;
+    reg host_uart_rx;
+    wire host_uart_tx;
+    wire [23:0] ptc_pwm_out;
+    wire [3:0] fan_pwm_out;
+    reg [7:0] fan_fg_in;
+    reg [3:0] fan_install_in;
+    wire [7:0] led;
+
+    reg [7:0] frame_bytes [0:63];
+    integer timeout;
+    integer high_count;
+    integer low_count;
+
+    uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top #(
+        .BMC_UART_CLKS_PER_BIT(8),
+        .HOST_UART_CLKS_PER_BIT(4),
+        .DEBUG_UART_CLKS_PER_BIT(4),
+        .STARTUP_DELAY_TICKS(4),
+        .COMMAND_GAP_TICKS(1000),
+        .STATUS_PERIOD_TICKS(100000),
+        .HOST_TIMEOUT_TICKS(5000),
+        .PTC_PWM_PERIOD_TICKS(100),
+        .FAN_PWM_PERIOD_TICKS(100),
+        .SNAPSHOT_PERIOD_TICKS(100000)
+    ) dut (
+        .sys_clk(clk),
+        .sys_rst_n(rst_n),
+        .bmc_uart_rx(bmc_uart_rx),
+        .bmc_uart_tx(bmc_uart_tx),
+        .host_uart_rx(host_uart_rx),
+        .host_uart_tx(host_uart_tx),
+        .ptc_pwm_out(ptc_pwm_out),
+        .fan_pwm_out(fan_pwm_out),
+        .fan_fg_in(fan_fg_in),
+        .fan_install_in(fan_install_in),
+        .led(led)
+    );
+
+    initial begin
+        clk = 1'b0;
+        forever #5 clk = ~clk;
+    end
+
+    function [15:0] crc16_update;
+        input [15:0] crc_in;
+        input [7:0] data;
+        reg [15:0] crc;
+        integer i;
+        begin
+            crc = crc_in ^ {data, 8'h00};
+            for (i = 0; i < 8; i = i + 1) begin
+                if (crc[15]) begin
+                    crc = (crc << 1) ^ 16'h1021;
+                end else begin
+                    crc = crc << 1;
+                end
+            end
+            crc16_update = crc;
+        end
+    endfunction
+
+    task drive_uart_byte_host;
+        input [7:0] value;
+        integer bit_index;
+        begin
+            host_uart_rx = 1'b0;
+            repeat (4) @(posedge clk);
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                host_uart_rx = value[bit_index];
+                repeat (4) @(posedge clk);
+            end
+            host_uart_rx = 1'b1;
+            repeat (4) @(posedge clk);
+        end
+    endtask
+
+    task capture_uart_byte_host;
+        output [7:0] value;
+        integer bit_index;
+        integer start_seen;
+        begin
+            timeout = 0;
+            while (host_uart_tx !== 1'b1 && timeout < 2000) begin
+                @(posedge clk);
+                timeout = timeout + 1;
+            end
+            start_seen = 0;
+            fork
+                begin
+                    @(negedge host_uart_tx);
+                    start_seen = 1;
+                end
+                begin
+                    repeat (2000) @(posedge clk);
+                end
+            join_any
+            disable fork;
+            if (!start_seen) begin
+                $display("combined host/debug byte timeout");
+                $fatal;
+            end
+            repeat (6) @(posedge clk);
+            value = 8'd0;
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                value[bit_index] = host_uart_tx;
+                repeat (4) @(posedge clk);
+            end
+            if (host_uart_tx !== 1'b1) begin
+                $display("combined host/debug stop bit mismatch");
+                $fatal;
+            end
+            repeat (2) @(posedge clk);
+        end
+    endtask
+
+    task capture_combined_binary_frame;
+        output [7:0] profile_id;
+        output [7:0] frame_type;
+        output [7:0] payload_len;
+        integer byte_index;
+        integer payload_limit;
+        begin
+            frame_bytes[0] = 8'd0;
+            frame_bytes[1] = 8'd0;
+            while (!(frame_bytes[0] == 8'ha5 && frame_bytes[1] == 8'h5a)) begin
+                frame_bytes[0] = frame_bytes[1];
+                capture_uart_byte_host(frame_bytes[1]);
+            end
+            frame_bytes[0] = 8'ha5;
+            for (byte_index = 2; byte_index < 14; byte_index = byte_index + 1) begin
+                capture_uart_byte_host(frame_bytes[byte_index]);
+            end
+            profile_id = frame_bytes[3];
+            frame_type = frame_bytes[4];
+            payload_len = frame_bytes[13];
+            payload_limit = payload_len;
+            if (payload_limit > 48) begin
+                payload_limit = 48;
+            end
+            for (byte_index = 0; byte_index < payload_limit; byte_index = byte_index + 1) begin
+                capture_uart_byte_host(frame_bytes[14 + byte_index]);
+            end
+            for (byte_index = payload_limit; byte_index < payload_len; byte_index = byte_index + 1) begin
+                capture_uart_byte_host(frame_bytes[62]);
+            end
+            capture_uart_byte_host(frame_bytes[62]);
+            capture_uart_byte_host(frame_bytes[63]);
+        end
+    endtask
+
+    task send_set_ptc01_10_profile3;
+        reg [15:0] crc;
+        begin
+            crc = 16'hffff;
+            drive_uart_byte_host(8'ha5);
+            drive_uart_byte_host(8'h5a);
+            drive_uart_byte_host(8'h01); crc = crc16_update(crc, 8'h01);
+            drive_uart_byte_host(8'h03); crc = crc16_update(crc, 8'h03);
+            drive_uart_byte_host(8'h05); crc = crc16_update(crc, 8'h05);
+            drive_uart_byte_host(8'h01); crc = crc16_update(crc, 8'h01);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h00); crc = crc16_update(crc, 8'h00);
+            drive_uart_byte_host(8'h03); crc = crc16_update(crc, 8'h03);
+            drive_uart_byte_host(8'h20); crc = crc16_update(crc, 8'h20);
+            drive_uart_byte_host(8'h01); crc = crc16_update(crc, 8'h01);
+            drive_uart_byte_host(8'h0a); crc = crc16_update(crc, 8'h0a);
+            drive_uart_byte_host(crc[7:0]);
+            drive_uart_byte_host(crc[15:8]);
+        end
+    endtask
+
+    initial begin
+        rst_n = 1'b0;
+        bmc_uart_rx = 1'b1;
+        host_uart_rx = 1'b1;
+        fan_fg_in = 8'h00;
+        fan_install_in = 4'hf;
+        repeat (5) @(posedge clk);
+        rst_n = 1'b1;
+
+        capture_combined_binary_frame(frame_bytes[60], frame_bytes[61], frame_bytes[62]);
+        if (frame_bytes[60] !== 8'd3 || frame_bytes[61] !== 8'h01 ||
+            frame_bytes[62] !== 8'd4 || frame_bytes[14] !== 8'd3) begin
+            $display("production READY frame mismatch profile=%02x type=%02x len=%02x payload0=%02x",
+                     frame_bytes[60], frame_bytes[61], frame_bytes[62], frame_bytes[14]);
+            $fatal;
+        end
+
+        send_set_ptc01_10_profile3();
+
+        capture_combined_binary_frame(frame_bytes[60], frame_bytes[61], frame_bytes[62]);
+        if (frame_bytes[60] !== 8'd3 || frame_bytes[61] !== 8'h06 ||
+            frame_bytes[14] !== 8'h01 || frame_bytes[15] !== 8'h20 ||
+            frame_bytes[16] !== 8'h00) begin
+            $display("production combined HOST_ACK mismatch profile=%02x type=%02x ok=%02x cmd=%02x status=%02x",
+                     frame_bytes[60], frame_bytes[61], frame_bytes[14], frame_bytes[15], frame_bytes[16]);
+            $fatal;
+        end
+
+        high_count = 0;
+        low_count = 0;
+        repeat (180) begin
+            @(posedge clk);
+            if (ptc_pwm_out[0]) begin
+                high_count = high_count + 1;
+            end else begin
+                low_count = low_count + 1;
+            end
+        end
+        if (high_count == 0 || low_count == 0) begin
+            $display("production PTC01 PWM did not toggle after combined SET_PTC");
+            $fatal;
+        end
+
+        $display("PASS: uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top_tb");
+        $finish;
+    end
+endmodule

+ 236 - 0
tests/unit/test_binary921_protocol.py

@@ -0,0 +1,236 @@
+#!/usr/bin/env python3
+"""Tests for the J6 binary921 host/debug protocol helpers."""
+
+from __future__ import annotations
+
+import sys
+import unittest
+from pathlib import Path
+
+
+sys.dont_write_bytecode = True
+ROOT = Path(__file__).resolve().parents[2]
+sys.path.insert(0, str(ROOT / "tools"))
+
+from binary921 import (  # noqa: E402
+    Binary921FrameError,
+    CommandId,
+    FrameType,
+    build_host_command,
+    decode_frame,
+    decode_stream,
+    encode_frame,
+    frame_to_dict,
+    profile_id_for_name,
+    profile_name_for_id,
+)
+
+
+class Binary921ProtocolTests(unittest.TestCase):
+    def test_encode_decode_roundtrip_uses_magic_version_type_len_and_crc16(self) -> None:
+        payload = bytes([CommandId.SET_PTC, 0x01, 0x0A])
+        frame = encode_frame(
+            profile_id=1,
+            frame_type=FrameType.HOST_CMD,
+            seq=0x01020304,
+            timestamp_tick=0x11223344,
+            payload=payload,
+        )
+
+        self.assertEqual(frame[:2], b"\xA5\x5A")
+        self.assertEqual(frame[2], 1)
+        self.assertEqual(frame[3], 1)
+        self.assertEqual(frame[4], FrameType.HOST_CMD)
+        self.assertEqual(frame[5:9], b"\x04\x03\x02\x01")
+        self.assertEqual(frame[9:13], b"\x44\x33\x22\x11")
+        self.assertEqual(frame[13], len(payload))
+
+        decoded = decode_frame(frame)
+        self.assertEqual(decoded.profile_id, 1)
+        self.assertEqual(decoded.frame_type, FrameType.HOST_CMD)
+        self.assertEqual(decoded.seq, 0x01020304)
+        self.assertEqual(decoded.timestamp_tick, 0x11223344)
+        self.assertEqual(decoded.payload, payload)
+
+    def test_decode_rejects_bad_crc_and_short_frames(self) -> None:
+        good = encode_frame(
+            profile_id=1,
+            frame_type=FrameType.READY,
+            seq=1,
+            timestamp_tick=2,
+            payload=b"",
+        )
+        bad = bytearray(good)
+        bad[-1] ^= 0x01
+
+        with self.assertRaisesRegex(Binary921FrameError, "crc"):
+            decode_frame(bytes(bad))
+        with self.assertRaisesRegex(Binary921FrameError, "short"):
+            decode_frame(good[:7])
+
+    def test_decode_stream_resynchronizes_after_noise(self) -> None:
+        first = encode_frame(profile_id=1, frame_type=FrameType.READY, seq=1, timestamp_tick=0, payload=b"")
+        second = encode_frame(
+            profile_id=1,
+            frame_type=FrameType.PWM_STATE,
+            seq=2,
+            timestamp_tick=20,
+            payload=bytes([10, 20, 40, 30]),
+        )
+
+        frames, remainder = decode_stream(b"\x00noise" + first + b"\xFF" + second + b"\xA5")
+
+        self.assertEqual([frame.frame_type for frame in frames], [FrameType.READY, FrameType.PWM_STATE])
+        self.assertEqual(remainder, b"\xA5")
+
+    def test_decode_stream_accepts_mixed_combined_uart_frames(self) -> None:
+        profile_id = 3
+        stream = b"".join(
+            [
+                encode_frame(profile_id=profile_id, frame_type=FrameType.READY, seq=0, timestamp_tick=0, payload=bytes([profile_id, 0, 0, 0])),
+                encode_frame(profile_id=profile_id, frame_type=FrameType.HOST_ACK, seq=1, timestamp_tick=1, payload=bytes([1, CommandId.SET_PTC, 0, 0, 0x34, 0x12])),
+                encode_frame(profile_id=profile_id, frame_type=FrameType.BMC_PAYLOAD, seq=2, timestamp_tick=2, payload=bytes([48, 48, 0, 1, 0x1E, 0xFF, 0, 0])),
+                encode_frame(profile_id=profile_id, frame_type=FrameType.SENSOR_CACHE, seq=3, timestamp_tick=3, payload=bytes([profile_id, 0, 1, 0xFE, 0xEF, 0xFF, 2, 22])),
+            ]
+        )
+
+        frames, remainder = decode_stream(stream)
+
+        self.assertEqual(remainder, b"")
+        self.assertEqual([frame.profile_id for frame in frames], [profile_id] * 4)
+        self.assertEqual(
+            [frame.frame_type for frame in frames],
+            [FrameType.READY, FrameType.HOST_ACK, FrameType.BMC_PAYLOAD, FrameType.SENSOR_CACHE],
+        )
+
+    def test_host_command_builder_validates_channels_and_percentages(self) -> None:
+        set_ptc = build_host_command(seq=1, command=CommandId.SET_PTC, channel=24, percent=20)
+        decoded_ptc = decode_frame(set_ptc)
+        self.assertEqual(decoded_ptc.frame_type, FrameType.HOST_CMD)
+        self.assertEqual(decoded_ptc.payload, bytes([CommandId.SET_PTC, 24, 20]))
+
+        set_fan = build_host_command(seq=2, command=CommandId.SET_FAN, channel=4, percent=30)
+        self.assertEqual(decode_frame(set_fan).payload, bytes([CommandId.SET_FAN, 4, 30]))
+
+        for channel in (0, 25):
+            with self.subTest(channel=channel):
+                with self.assertRaisesRegex(ValueError, "PTC"):
+                    build_host_command(seq=3, command=CommandId.SET_PTC, channel=channel, percent=10)
+        for channel in (0, 5):
+            with self.subTest(channel=channel):
+                with self.assertRaisesRegex(ValueError, "FAN"):
+                    build_host_command(seq=4, command=CommandId.SET_FAN, channel=channel, percent=10)
+        with self.assertRaisesRegex(ValueError, "percent"):
+            build_host_command(seq=5, command=CommandId.SET_PTC, channel=1, percent=101)
+
+    def test_zero_payload_commands_have_stable_binary_payloads(self) -> None:
+        for command in [
+            CommandId.GET_SENSOR,
+            CommandId.GET_MAP,
+            CommandId.GET_STATUS,
+            CommandId.DISABLE,
+        ]:
+            with self.subTest(command=command):
+                frame = decode_frame(build_host_command(seq=7, command=command))
+                self.assertEqual(frame.payload, bytes([command]))
+
+    def test_frame_to_dict_decodes_ready_host_command_and_ack_payloads(self) -> None:
+        ready = decode_frame(
+            encode_frame(profile_id=1, frame_type=FrameType.READY, seq=1, timestamp_tick=2, payload=bytes([1, 0, 0, 0]))
+        )
+        command = decode_frame(build_host_command(seq=9, command=CommandId.SET_PTC, channel=1, percent=10))
+        ack = decode_frame(
+            encode_frame(
+                profile_id=1,
+                frame_type=FrameType.HOST_ACK,
+                seq=9,
+                timestamp_tick=12,
+                payload=bytes([1, CommandId.SET_PTC, 0, 0, 0x34, 0x12]),
+            )
+        )
+
+        self.assertEqual(frame_to_dict(ready)["decoded"], {"kind": "ready", "profile_id_payload": 1})
+        self.assertEqual(
+            frame_to_dict(command)["decoded"],
+            {"kind": "host_cmd", "cmd": "SET_PTC", "cmd_id": 32, "channel": 1, "percent": 10},
+        )
+        self.assertEqual(
+            frame_to_dict(ack)["decoded"],
+            {
+                "kind": "host_ack",
+                "ok": True,
+                "cmd": "SET_PTC",
+                "cmd_id": 32,
+                "status_code": 0,
+                "applied_state_hash": 0x1234,
+            },
+        )
+
+    def test_production_two_uart_profile_has_stable_id_three(self) -> None:
+        profile = "production-two-uart-bmc-replay-binary921"
+
+        self.assertEqual(profile_id_for_name(profile), 3)
+        self.assertEqual(profile_name_for_id(3), profile)
+
+        frame = decode_frame(
+            build_host_command(
+                seq=1,
+                command=CommandId.SET_PTC,
+                channel=1,
+                percent=10,
+                profile_id=profile_id_for_name(profile),
+            )
+        )
+
+        self.assertEqual(frame.profile_id, 3)
+        self.assertEqual(frame.payload, bytes([CommandId.SET_PTC, 1, 10]))
+
+    def test_module_snapshot_decodes_pwm_pid_and_timeout_summary(self) -> None:
+        payload = bytes(
+            [
+                3,  # profile
+                0,  # host_err_count
+                12,
+                0,  # command_count_seen
+                0x1E,
+                0xFF,
+                0x08,
+                0x14,
+                CommandId.DISABLE,
+                0,
+                0,
+                0,
+                0,  # pid requested false
+                1,  # timeout active
+                2,
+                22,
+                0,
+                0,
+                30,
+                30,
+                0,
+                0x0F,
+                0,
+                0,
+            ]
+        )
+        frame = decode_frame(
+            encode_frame(profile_id=3, frame_type=FrameType.MODULE_SNAPSHOT, seq=9, timestamp_tick=10, payload=payload)
+        )
+
+        decoded = frame_to_dict(frame)["decoded"]
+
+        self.assertEqual(decoded["kind"], "module_snapshot")
+        self.assertEqual(decoded["profile_id_payload"], 3)
+        self.assertEqual(decoded["command_count_seen"], 12)
+        self.assertEqual(decoded["last_cmd"], "DISABLE")
+        self.assertFalse(decoded["pid_requested"])
+        self.assertTrue(decoded["timeout_active"])
+        self.assertEqual(decoded["ptc01_percent"], 0)
+        self.assertEqual(decoded["ptc24_percent"], 0)
+        self.assertEqual(decoded["fan01_percent"], 30)
+        self.assertEqual(decoded["fan04_percent"], 30)
+
+
+if __name__ == "__main__":
+    unittest.main()

+ 177 - 0
tests/unit/test_bmc_replay_tool.py

@@ -8,6 +8,7 @@ import sys
 import tempfile
 import unittest
 from pathlib import Path
+from unittest import mock
 
 
 sys.dont_write_bytecode = True
@@ -46,6 +47,22 @@ class BmcReplayToolTests(unittest.TestCase):
         self.assertEqual(len(payload["reply_sha256"]), 64)
         self.assertEqual(payload["temperatures"][0]["temperature_c"], 40)
 
+    def test_historical_mobiletransfer_payload_matches_production_v1_sample(self) -> None:
+        historical = Path(r"C:\Users\Administrator\Downloads\Mobiletransfer\evidence-com8-host-com7-debug\bmc-raw-replay.bin")
+        if not historical.is_file():
+            self.skipTest("historical Mobiletransfer BMC replay artifact is not available on this machine")
+
+        payload = normalize_bmc_capture_text(historical.read_text(encoding="utf-8", errors="replace"), seq=1)
+
+        self.assertEqual(payload["reply_sha256"], "06c173f91f8b6b0e56f9c381b49d5b127d2dbf3a09402843838a0ff2b812f1af")
+        self.assertEqual(payload["byte_count"], 48)
+        self.assertEqual(payload["valid_count"], 2)
+        self.assertEqual(payload["missing_count"], 22)
+        present = {item["dimm"]: item["temperature_c"] for item in payload["temperatures"] if item["valid"]}
+        self.assertEqual(present, {1: 30, 13: 32})
+        fractions = {item["dimm"]: item["fraction"] for item in payload["temperatures"] if item["valid"]}
+        self.assertEqual(fractions, {1: 75, 13: 25})
+
     def test_normalize_capture_rejects_bad_fraction(self) -> None:
         bad_text = VALID_BMC_TEXT.replace("28 00", "28 7f", 1)
 
@@ -66,6 +83,22 @@ class BmcReplayToolTests(unittest.TestCase):
         self.assertEqual(endpoint.written.decode("ascii"), payload["reply_text"])
         self.assertFalse(receipt["unsolicited_reply_attempted"])
 
+    def test_poll_response_session_preserves_real_bmc_payload_provenance(self) -> None:
+        payload = build_replay_payload(VALID_BMC_TEXT, seq=9)
+        endpoint = FakeSerialEndpoint(initial_rx=POLL_COMMAND_TEXT.encode("ascii"))
+
+        receipt = run_poll_response_session(endpoint, payload, iterations=1, timeout_sec=0.1)
+
+        self.assertEqual(receipt["status"], "pass")
+        self.assertEqual(receipt["source"], "real_bmc_capture")
+        self.assertEqual(receipt["bmc_source"], "pc_replay_from_real_bmc_capture")
+        self.assertEqual(receipt["payload_reply_sha256"], payload["reply_sha256"])
+        self.assertEqual(receipt["capture_text_sha256"], payload["capture_text_sha256"])
+        self.assertEqual(receipt["byte_count"], 48)
+        self.assertEqual(receipt["valid_count"], 24)
+        self.assertEqual(receipt["missing_count"], 0)
+        self.assertEqual(receipt["rejected_echo_windows"], payload["rejected_echo_windows"])
+
     def test_poll_response_session_does_not_reply_to_wrong_command(self) -> None:
         payload = build_replay_payload(VALID_BMC_TEXT, seq=1)
         endpoint = FakeSerialEndpoint(initial_rx=b"ipmitool raw 0x00 0x01\n")
@@ -99,6 +132,150 @@ class BmcReplayToolTests(unittest.TestCase):
             self.assertEqual(payload["status"], "pass")
             self.assertEqual(payload["byte_count"], 48)
 
+    def test_cli_replay_dry_run_uses_explicit_port_and_payload_without_opening_unknown_com(self) -> None:
+        with tempfile.TemporaryDirectory() as tmp:
+            payload_path = Path(tmp) / "payload.json"
+            payload_path.write_text(json.dumps(build_replay_payload(VALID_BMC_TEXT, seq=1)), encoding="utf-8")
+            from bmc_replay_uart import main
+
+            exit_code = main(
+                [
+                    "replay",
+                    "--port",
+                    "COM9",
+                    "--payload",
+                    str(payload_path),
+                    "--iterations",
+                    "1",
+                    "--timeout-sec",
+                    "0.01",
+                    "--dry-run",
+                    "--json",
+                ]
+            )
+
+            self.assertEqual(exit_code, 0)
+
+    def test_replay_opens_pyserial_with_dtr_rts_low_before_open(self) -> None:
+        import bmc_replay_uart
+        import types
+
+        calls: list[tuple[str, object]] = []
+
+        class FakeSerial:
+            def __init__(self, *args: object, **kwargs: object) -> None:
+                calls.append(("init", {"args": args, "kwargs": kwargs}))
+                if args or kwargs:
+                    raise AssertionError("Serial must be constructed closed before setting DTR/RTS")
+                self.port = None
+                self.baudrate = None
+                self.bytesize = None
+                self.parity = None
+                self.stopbits = None
+                self.timeout = None
+                self.write_timeout = None
+                self.rtscts = None
+                self.dsrdtr = None
+                self.dtr = None
+                self.rts = None
+                self.is_open = False
+
+            def open(self) -> None:
+                calls.append(
+                    (
+                        "open",
+                        {
+                            "port": self.port,
+                            "baudrate": self.baudrate,
+                            "dtr": self.dtr,
+                            "rts": self.rts,
+                            "rtscts": self.rtscts,
+                            "dsrdtr": self.dsrdtr,
+                        },
+                    )
+                )
+                self.is_open = True
+
+        with mock.patch.dict(sys.modules, {"serial": types.SimpleNamespace(Serial=FakeSerial)}):
+            endpoint = bmc_replay_uart._open_serial_endpoint("COM9")
+
+        self.assertIs(endpoint.is_open, True)
+        self.assertEqual(
+            calls,
+            [
+                ("init", {"args": (), "kwargs": {}}),
+                (
+                    "open",
+                    {
+                        "port": "COM9",
+                        "baudrate": 115200,
+                        "dtr": False,
+                        "rts": False,
+                        "rtscts": False,
+                        "dsrdtr": False,
+                    },
+                ),
+            ],
+        )
+
+    def test_cli_replay_returns_nonzero_when_cpld_poll_never_arrives(self) -> None:
+        with tempfile.TemporaryDirectory() as tmp:
+            payload_path = Path(tmp) / "payload.json"
+            payload_path.write_text(json.dumps(build_replay_payload(VALID_BMC_TEXT, seq=1)), encoding="utf-8")
+            import bmc_replay_uart
+
+            with mock.patch.object(
+                bmc_replay_uart,
+                "_open_serial_endpoint",
+                return_value=FakeSerialEndpoint(initial_rx=b"not a CPLD poll\n"),
+            ):
+                exit_code = bmc_replay_uart.main(
+                    [
+                        "replay",
+                        "--port",
+                        "COM9",
+                        "--payload",
+                        str(payload_path),
+                        "--iterations",
+                        "1",
+                        "--timeout-sec",
+                        "0.01",
+                        "--json",
+                    ]
+                )
+
+            self.assertNotEqual(exit_code, 0)
+
+    def test_replay_loader_rejects_reply_hash_mismatch(self) -> None:
+        with tempfile.TemporaryDirectory() as tmp:
+            payload = build_replay_payload(VALID_BMC_TEXT, seq=1)
+            payload["reply_sha256"] = "0" * 64
+            payload_path = Path(tmp) / "payload.json"
+            payload_path.write_text(json.dumps(payload), encoding="utf-8")
+            import bmc_replay_uart
+
+            with mock.patch.object(
+                bmc_replay_uart,
+                "_open_serial_endpoint",
+                return_value=FakeSerialEndpoint(initial_rx=POLL_COMMAND_TEXT.encode("ascii")),
+            ):
+                exit_code = bmc_replay_uart.main(
+                    [
+                        "replay",
+                        "--port",
+                        "COM9",
+                        "--payload",
+                        str(payload_path),
+                        "--iterations",
+                        "1",
+                        "--timeout-sec",
+                        "0.01",
+                        "--json",
+                    ]
+                )
+
+            self.assertNotEqual(exit_code, 0)
+
 
 if __name__ == "__main__":
     unittest.main()

+ 66 - 0
tests/unit/test_pin_inventory.py

@@ -214,6 +214,72 @@ class PinInventoryTests(unittest.TestCase):
         self.assertEqual(payload["ptc_substitutions"], {})
         self.assertEqual(payload["conflict_check"]["status"], "pass")
 
+    def test_binary921_profiles_capture_debug_photo_and_formal_uart1_boundaries(self) -> None:
+        inventory = load_pin_inventory(PRODUCT_INVENTORY)
+        debug_payload = diagnostic_profile_assignments(inventory, "debug-photo-bmc-replay-binary921")
+        formal_payload = diagnostic_profile_assignments(inventory, "formal-uart1-bmc-replay-binary921")
+
+        self.assertEqual(debug_payload["status"], "pass")
+        self.assertEqual(debug_payload["profile"], "debug-photo-bmc-replay-binary921")
+        self.assertEqual(debug_payload["uart_assignments"]["bmc_replay_uart_tx"]["fpga_ball"], "T4")
+        self.assertEqual(debug_payload["uart_assignments"]["bmc_replay_uart_rx"]["fpga_ball"], "R5")
+        self.assertEqual(debug_payload["uart_assignments"]["host_uart_tx"]["fpga_ball"], "P7")
+        self.assertEqual(debug_payload["uart_assignments"]["host_uart_rx"]["fpga_ball"], "P8")
+        self.assertEqual(debug_payload["uart_assignments"]["debug_uart_rx"]["fpga_ball"], "P10")
+        self.assertEqual(debug_payload["uart_assignments"]["debug_uart_tx"]["fpga_ball"], "R10")
+        self.assertEqual(debug_payload["assignments"]["ptc_pwm_out[2]"], "P5")
+        self.assertEqual(debug_payload["assignments"]["ptc_pwm_out[3]"], "T8")
+        self.assertEqual(debug_payload["assignments"]["ptc_pwm_out[16]"], "M14")
+        self.assertEqual(debug_payload["assignments"]["ptc_pwm_out[17]"], "M15")
+        self.assertEqual(debug_payload["assignments"]["ptc_pwm_out[20]"], "P15")
+        self.assertEqual(debug_payload["assignments"]["ptc_pwm_out[21]"], "N14")
+        self.assertIn("binary921", debug_payload["authority_boundary"])
+
+        self.assertEqual(formal_payload["status"], "pass")
+        self.assertEqual(formal_payload["profile"], "formal-uart1-bmc-replay-binary921")
+        self.assertEqual(formal_payload["assignments"]["ptc_pwm_out[2]"], "T4")
+        self.assertEqual(formal_payload["assignments"]["ptc_pwm_out[3]"], "R5")
+        self.assertEqual(formal_payload["assignments"]["ptc_pwm_out[16]"], "P8")
+        self.assertEqual(formal_payload["assignments"]["ptc_pwm_out[17]"], "P7")
+        self.assertEqual(formal_payload["assignments"]["ptc_pwm_out[20]"], "P10")
+        self.assertEqual(formal_payload["assignments"]["ptc_pwm_out[21]"], "R10")
+        self.assertEqual(formal_payload["uart_assignments"]["bmc_replay_uart_tx"]["fpga_ball"], "L10")
+        self.assertEqual(formal_payload["uart_assignments"]["bmc_replay_uart_rx"]["fpga_ball"], "M9")
+        self.assertEqual(formal_payload["uart_assignments"]["host_uart_tx"]["fpga_ball"], "M10")
+        self.assertEqual(formal_payload["uart_assignments"]["host_uart_rx"]["fpga_ball"], "N11")
+        self.assertEqual(formal_payload["uart_assignments"]["debug_uart_rx"]["fpga_ball"], "M14")
+        self.assertEqual(formal_payload["uart_assignments"]["debug_uart_tx"]["fpga_ball"], "M15")
+        self.assertTrue(formal_payload["uses_reserved_future_uart"])
+        self.assertEqual(formal_payload["ptc_substitutions"], {})
+        self.assertIn("binary921", formal_payload["authority_boundary"])
+
+    def test_production_two_uart_binary921_profile_uses_uart1_uart2_combined_port_and_real_load_pins(self) -> None:
+        inventory = load_pin_inventory(PRODUCT_INVENTORY)
+        payload = diagnostic_profile_assignments(inventory, "production-two-uart-bmc-replay-binary921")
+
+        self.assertEqual(payload["status"], "pass")
+        self.assertEqual(payload["profile"], "production-two-uart-bmc-replay-binary921")
+        self.assertEqual(payload["bmc_source"], "pc_replay_from_real_bmc_capture")
+        self.assertEqual(payload["live_bmc_link_status"], "not_used")
+        self.assertEqual(payload["transport"], "combined_host_debug_uart")
+        self.assertEqual(payload["hardware_access_status"], "production_uart1_uart2_access_confirmed_by_user")
+        self.assertEqual(payload["assignments"]["ptc_pwm_out[2]"], "T4")
+        self.assertEqual(payload["assignments"]["ptc_pwm_out[3]"], "R5")
+        self.assertEqual(payload["assignments"]["ptc_pwm_out[16]"], "P8")
+        self.assertEqual(payload["assignments"]["ptc_pwm_out[17]"], "P7")
+        self.assertEqual(payload["assignments"]["ptc_pwm_out[20]"], "P10")
+        self.assertEqual(payload["assignments"]["ptc_pwm_out[21]"], "R10")
+        self.assertEqual(payload["uart_assignments"]["bmc_replay_uart_tx"]["fpga_ball"], "L10")
+        self.assertEqual(payload["uart_assignments"]["bmc_replay_uart_rx"]["fpga_ball"], "M9")
+        self.assertEqual(payload["uart_assignments"]["combined_debug_host_uart_tx"]["fpga_ball"], "M10")
+        self.assertEqual(payload["uart_assignments"]["combined_debug_host_uart_rx"]["fpga_ball"], "N11")
+        self.assertNotIn("debug_uart_rx", payload["uart_assignments"])
+        self.assertTrue(payload["uses_reserved_future_uart"])
+        self.assertEqual(payload["ptc_substitutions"], {})
+        self.assertEqual(payload["conflict_check"]["status"], "pass")
+        self.assertIn("J3", payload["authority_boundary"])
+        self.assertIn("combined", payload["authority_boundary"])
+
 
 if __name__ == "__main__":
     unittest.main()

+ 831 - 25
tests/unit/test_remote_scripts.py

@@ -3,11 +3,12 @@
 
 from __future__ import annotations
 
-import json
-import shutil
-import subprocess
-import tempfile
-import unittest
+import json
+import hashlib
+import shutil
+import subprocess
+import tempfile
+import unittest
 from pathlib import Path
 
 
@@ -76,12 +77,16 @@ class RemoteScriptTests(unittest.TestCase):
             "debug_port_writes_to_serial",
             "driver_install_attempted = $false",
             "enumerates_com_ports = $false",
-            "opens_unknown_com_ports = $false",
-            "AssumeManualSramProgrammed",
-            "PROGRAM_SRAM",
-            "SelfTest",
-            "startup-preflight.json",
-            "READY",
+            "opens_unknown_com_ports = $false",
+            "AssumeManualSramProgrammed",
+            "PROGRAM_SRAM",
+            "JtagSpeedHz",
+            "BoardPowerPresentBeforeProgram",
+            "jtag_speed_hz",
+            "board_power_present_before_program",
+            "SelfTest",
+            "startup-preflight.json",
+            "READY",
             "J6READY",
             "preflight",
             "blocked_waiting_for_ready_epoch",
@@ -148,6 +153,8 @@ class RemoteScriptTests(unittest.TestCase):
             "formal_ack=OK seq=00000001 cmd=PTCCH",
             "stale_ack_isolated=pass",
             "tail_drain=pass",
+            "jtag_speed_hz=200000",
+            "board_power_present_before_program=true",
             "post_j6stat_tail_bytes=04",
             "complete_unterminated_j6raw=pass",
             "incomplete_final_line=J6RAW s=0004",
@@ -592,10 +599,10 @@ if ($events[2].fields.cmd -ne "FANCH") { throw "ack cmd was $($events[2].fields.
 
             self.assertEqual(result.returncode, 0, result.stderr + result.stdout)
 
-    def test_j6_host_sensor_real_fan_ptc_package_script_creates_temp_profile_package(self) -> None:
-        script = (ROOT / "tools" / "package_j6_host_sensor_real_fan_ptc_debug921.ps1").read_text(
-            encoding="utf-8"
-        )
+    def test_j6_host_sensor_real_fan_ptc_package_script_creates_temp_profile_package(self) -> None:
+        script = (ROOT / "tools" / "package_j6_host_sensor_real_fan_ptc_debug921.ps1").read_text(
+            encoding="utf-8"
+        )
 
         for marker in [
             "START-HERE.zh-CN.md",
@@ -651,10 +658,796 @@ if ($events[2].fields.cmd -ne "FANCH") { throw "ack cmd was $($events[2].fields.
         ]:
             self.assertNotIn(marker.lower(), script.lower())
 
+    def test_binary921_collector_selftest_and_static_safety_contract(self) -> None:
+        script = ROOT / "tools" / "remote" / "collect_j6_binary921.py"
+        self.assertTrue(script.is_file())
+        text = script.read_text(encoding="utf-8")
+
+        for marker in [
+            "binary921",
+            "explicit COM ports only",
+            "serial.Serial",
+            "HostPort",
+            "DebugPort",
+            "build_host_command",
+            "decode_stream",
+            "startup-preflight.json",
+            "host-command-transcript.json",
+            "debug-binary921-frames.json",
+            "binary921-evidence-manifest.json",
+            "real_fan_ptc_hardware_status",
+            "pc_replay_from_real_bmc_capture",
+            "SET_PTC",
+            "SET_FAN",
+            "SET_PID_REQUESTED",
+            "DISABLE",
+        ]:
+            self.assertIn(marker, text)
+        for forbidden in [
+            "PROGRAM_FLASH",
+            "ERASE_FLASH",
+            "PROGRAM_SPIBIN",
+            "DIRECT_FLASH_WRITE",
+            "GetPortNames",
+            "Win32_SerialPort",
+            "Set-ExecutionPolicy",
+            "pip install",
+            "driver install",
+            "debug_serial.write",
+        ]:
+            self.assertNotIn(forbidden.lower(), text.lower())
+
+        result = subprocess.run(
+            [str(ROOT / ".codex" / "venv" / "Scripts" / "python.exe"), str(script), "--selftest"],
+            cwd=ROOT,
+            text=True,
+            capture_output=True,
+            check=False,
+        )
+        self.assertEqual(result.returncode, 0, result.stderr + result.stdout)
+        self.assertIn("selftest=pass", result.stdout)
+
+    def test_binary921_collector_sets_dtr_rts_low_before_opening_pyserial(self) -> None:
+        import sys
+        import types
+        from unittest import mock
+
+        sys.path.insert(0, str(ROOT / "tools" / "remote"))
+        import collect_j6_binary921
+
+        calls: list[tuple[str, object]] = []
+
+        class FakeSerial:
+            def __init__(self, *args: object, **kwargs: object) -> None:
+                calls.append(("init", {"args": args, "kwargs": kwargs}))
+                if args or kwargs:
+                    raise AssertionError("Serial must be constructed closed before setting DTR/RTS")
+                self.port = None
+                self.baudrate = None
+                self.bytesize = None
+                self.parity = None
+                self.stopbits = None
+                self.timeout = None
+                self.write_timeout = None
+                self.rtscts = None
+                self.dsrdtr = None
+                self.dtr = None
+                self.rts = None
+                self.is_open = False
+
+            def open(self) -> None:
+                calls.append(
+                    (
+                        "open",
+                        {
+                            "port": self.port,
+                            "baudrate": self.baudrate,
+                            "dtr": self.dtr,
+                            "rts": self.rts,
+                            "rtscts": self.rtscts,
+                            "dsrdtr": self.dsrdtr,
+                        },
+                    )
+                )
+                self.is_open = True
+
+        with mock.patch.dict(sys.modules, {"serial": types.SimpleNamespace(Serial=FakeSerial)}):
+            endpoint = collect_j6_binary921._open_serial("COM7", 921600)
+
+        self.assertIs(endpoint.is_open, True)
+        self.assertEqual(
+            calls,
+            [
+                ("init", {"args": (), "kwargs": {}}),
+                (
+                    "open",
+                    {
+                        "port": "COM7",
+                        "baudrate": 921600,
+                        "dtr": False,
+                        "rts": False,
+                        "rtscts": False,
+                        "dsrdtr": False,
+                    },
+                ),
+            ],
+        )
+
+    def test_binary921_collector_supports_production_combined_uart_profile(self) -> None:
+        import sys
+        from unittest import mock
+
+        sys.path.insert(0, str(ROOT / "tools"))
+        sys.path.insert(0, str(ROOT / "tools" / "remote"))
+        from binary921 import CommandId, FrameType, decode_frame, encode_frame, frame_to_dict, profile_id_for_name
+        from collect_j6_binary921 import (
+            COMMAND_SEQUENCE,
+            build_manifest_from_frames,
+            collect_live,
+            is_combined_uart_profile,
+        )
+
+        profile = "production-two-uart-bmc-replay-binary921"
+        profile_id = profile_id_for_name(profile)
+        self.assertTrue(is_combined_uart_profile(profile))
+        commands = [
+            {
+                "seq": index,
+                "name": name,
+                "command_id": int(command),
+                "channel": channel,
+                "percent": percent,
+            }
+            for index, (name, command, channel, percent) in enumerate(COMMAND_SEQUENCE, start=1)
+        ]
+        combined_frames = [
+            frame_to_dict(
+                decode_frame(
+                    encode_frame(
+                        profile_id=profile_id,
+                        frame_type=FrameType.READY,
+                        seq=0,
+                        timestamp_tick=0,
+                        payload=bytes([profile_id, 0, 0, 0]),
+                    )
+                )
+            )
+        ]
+        for row in commands:
+            combined_frames.append(
+                frame_to_dict(
+                    decode_frame(
+                        encode_frame(
+                            profile_id=profile_id,
+                            frame_type=FrameType.HOST_ACK,
+                            seq=row["seq"],
+                            timestamp_tick=0,
+                            payload=bytes([1, row["command_id"], 0, 0, 0x34, 0x12]),
+                        )
+                    )
+                )
+            )
+        combined_frames.extend(
+            [
+                frame_to_dict(
+                    decode_frame(
+                        encode_frame(
+                            profile_id=profile_id,
+                            frame_type=FrameType.BMC_PAYLOAD,
+                            seq=50,
+                            timestamp_tick=0,
+                            payload=bytes([48, 48, 0, 1, 0x1E, 0xFF, 0x08, 0x14]),
+                        )
+                    )
+                ),
+                frame_to_dict(
+                    decode_frame(
+                        encode_frame(
+                            profile_id=profile_id,
+                            frame_type=FrameType.SENSOR_CACHE,
+                            seq=51,
+                            timestamp_tick=0,
+                            payload=bytes([profile_id, 0, 1, 0xFE, 0xEF, 0xFF, 2, 22]),
+                        )
+                    )
+                ),
+                frame_to_dict(
+                    decode_frame(
+                        encode_frame(
+                            profile_id=profile_id,
+                            frame_type=FrameType.MODULE_SNAPSHOT,
+                            seq=52,
+                            timestamp_tick=0,
+                            payload=bytes(
+                                [
+                                    profile_id,
+                                    0,
+                                    len(COMMAND_SEQUENCE),
+                                    0,
+                                    0x1E,
+                                    0xFF,
+                                    0x08,
+                                    0x14,
+                                    CommandId.DISABLE,
+                                    0,
+                                    0,
+                                    0,
+                                    0,
+                                    1,
+                                    2,
+                                    22,
+                                    0,
+                                    0,
+                                    30,
+                                    30,
+                                    0,
+                                    0x0F,
+                                    0,
+                                    0,
+                                ]
+                            ),
+                        )
+                    )
+                ),
+            ]
+        )
+
+        manifest = build_manifest_from_frames(
+            profile=profile,
+            startup_ready=combined_frames[0],
+            host_commands=commands,
+            host_frames=combined_frames,
+            debug_frames=combined_frames,
+            debug_raw=b"same-com-raw",
+            host_raw=b"same-com-raw",
+            combined_raw=b"same-com-raw",
+            bmc_replay={
+                "status": "pass",
+                "bmc_source": "pc_replay_from_real_bmc_capture",
+                "byte_count": 48,
+                "valid_count": 2,
+                "missing_count": 22,
+                "reply_sha256": "06c173f91f8b6b0e56f9c381b49d5b127d2dbf3a09402843838a0ff2b812f1af",
+            },
+        )
+
+        self.assertEqual(manifest["status"], "pass")
+        self.assertEqual(manifest["profile"], profile)
+        self.assertEqual(manifest["transport"], "combined_host_debug_uart")
+        self.assertEqual(manifest["combined_uart_baud"], 921600)
+        self.assertEqual(manifest["host_ack_matched_count"], len(COMMAND_SEQUENCE))
+        self.assertIn("combined-uart-binary921.raw", manifest["artifact_hashes"])
+        self.assertEqual(manifest["module_snapshot_count"], 1)
+        self.assertEqual(manifest["pwm_logic_evidence"]["status"], "pass")
+        self.assertEqual(manifest["pid_evidence"]["status"], "pass")
+        self.assertEqual(manifest["timeout_fallback_evidence"]["status"], "pass")
+
+        class ShouldNotOpenSerial:
+            def __call__(self, port: str, baud: int) -> object:
+                raise AssertionError(f"unexpected open {port} {baud}")
+
+        with mock.patch("collect_j6_binary921._open_serial", ShouldNotOpenSerial()):
+            with self.assertRaisesRegex(ValueError, "CombinedPort must be an explicit COM"):
+                collect_live(
+                    type(
+                        "Args",
+                        (),
+                        {
+                            "profile": profile,
+                            "transport": "combined-single-com",
+                            "combined_port": "AUTO",
+                            "host_port": "",
+                            "debug_port": "",
+                            "output_dir": "unused",
+                            "duration_sec": 0,
+                            "ready_timeout_sec": 0,
+                            "ack_window_sec": 0,
+                            "bitstream": "",
+                            "td_receipt": "",
+                            "bmc_replay_receipt": "",
+                        },
+                    )()
+                )
+
+    def test_binary921_production_manifest_blocks_without_timeout_snapshot(self) -> None:
+        import sys
+
+        sys.path.insert(0, str(ROOT / "tools"))
+        sys.path.insert(0, str(ROOT / "tools" / "remote"))
+        from binary921 import CommandId, FrameType, decode_frame, encode_frame, frame_to_dict, profile_id_for_name
+        from collect_j6_binary921 import COMMAND_SEQUENCE, build_manifest_from_frames
+
+        profile = "production-two-uart-bmc-replay-binary921"
+        profile_id = profile_id_for_name(profile)
+        commands = [
+            {
+                "seq": index,
+                "name": name,
+                "command_id": int(command),
+                "channel": channel,
+                "percent": percent,
+            }
+            for index, (name, command, channel, percent) in enumerate(COMMAND_SEQUENCE, start=1)
+        ]
+        frames = [
+            frame_to_dict(
+                decode_frame(
+                    encode_frame(
+                        profile_id=profile_id,
+                        frame_type=FrameType.READY,
+                        seq=0,
+                        timestamp_tick=0,
+                        payload=bytes([profile_id, 0, 0, 0]),
+                    )
+                )
+            )
+        ]
+        for row in commands:
+            frames.append(
+                frame_to_dict(
+                    decode_frame(
+                        encode_frame(
+                            profile_id=profile_id,
+                            frame_type=FrameType.HOST_ACK,
+                            seq=row["seq"],
+                            timestamp_tick=0,
+                            payload=bytes([1, row["command_id"], 0, 0, 0x34, 0x12]),
+                        )
+                    )
+                )
+            )
+        frames.append(
+            frame_to_dict(
+                decode_frame(
+                    encode_frame(
+                        profile_id=profile_id,
+                        frame_type=FrameType.BMC_PAYLOAD,
+                        seq=50,
+                        timestamp_tick=0,
+                        payload=bytes([48, 48, 0, 1, 0x1E, 0xFF, 0x08, 0x14]),
+                    )
+                )
+            )
+        )
+        frames.append(
+            frame_to_dict(
+                decode_frame(
+                    encode_frame(
+                        profile_id=profile_id,
+                        frame_type=FrameType.SENSOR_CACHE,
+                        seq=51,
+                        timestamp_tick=0,
+                        payload=bytes([profile_id, 0, 1, 0xFE, 0xEF, 0xFF, 2, 22]),
+                    )
+                )
+            )
+        )
+
+        manifest = build_manifest_from_frames(
+            profile=profile,
+            startup_ready=frames[0],
+            host_commands=commands,
+            host_frames=frames,
+            debug_frames=frames,
+            debug_raw=b"raw",
+            host_raw=b"raw",
+            combined_raw=b"raw",
+            bmc_replay={
+                "status": "pass",
+                "source": "real_bmc_capture",
+                "bmc_source": "pc_replay_from_real_bmc_capture",
+                "byte_count": 48,
+                "valid_count": 2,
+                "missing_count": 22,
+                "reply_sha256": "06c173f91f8b6b0e56f9c381b49d5b127d2dbf3a09402843838a0ff2b812f1af",
+                "capture_text_sha256": "1" * 64,
+            },
+        )
+
+        self.assertNotEqual(manifest["status"], "pass")
+        self.assertIn("missing_module_snapshot", manifest["blockers"])
+        self.assertIn("timeout_fallback_evidence_incomplete", manifest["blockers"])
+
+    def test_binary921_collector_requires_exact_ack_and_bmc_payload_for_pass(self) -> None:
+        import sys
+
+        sys.path.insert(0, str(ROOT / "tools"))
+        sys.path.insert(0, str(ROOT / "tools" / "remote"))
+        from binary921 import CommandId, FrameType, decode_frame, encode_frame, frame_to_dict
+        from collect_j6_binary921 import COMMAND_SEQUENCE, build_manifest_from_frames
+
+        commands = [
+            {
+                "seq": index,
+                "name": name,
+                "command_id": int(command),
+                "channel": channel,
+                "percent": percent,
+            }
+            for index, (name, command, channel, percent) in enumerate(COMMAND_SEQUENCE, start=1)
+        ]
+        wrong_acks = [
+            frame_to_dict(
+                decode_frame(
+                    encode_frame(
+                        profile_id=1,
+                        frame_type=FrameType.HOST_ACK,
+                        seq=index + 1,
+                        timestamp_tick=0,
+                        payload=bytes([1, int(CommandId.GET_STATUS), 0, 0, 0, 0]),
+                    )
+                )
+            )
+            for index in range(1, 13)
+        ]
+        ready = frame_to_dict(
+            decode_frame(
+                encode_frame(profile_id=1, frame_type=FrameType.READY, seq=1, timestamp_tick=0, payload=b"\x01\x00\x00\x00")
+            )
+        )
+
+        manifest = build_manifest_from_frames(
+            profile="debug-photo-bmc-replay-binary921",
+            startup_ready=ready,
+            host_commands=commands,
+            host_frames=wrong_acks,
+            debug_frames=[ready],
+            debug_raw=b"",
+            host_raw=b"",
+        )
+
+        self.assertEqual(manifest["status"], "blocked_host_ack")
+        self.assertEqual(manifest["host_ack_count"], 12)
+        self.assertEqual(manifest["host_ack_matched_count"], 0)
+        self.assertIn("missing_bmc_payload", manifest["blockers"])
+
+    def test_binary921_collector_writes_blocked_manifest_when_ready_is_missing(self) -> None:
+        import sys
+
+        sys.path.insert(0, str(ROOT / "tools" / "remote"))
+        from collect_j6_binary921 import write_blocked_manifest
+
+        with tempfile.TemporaryDirectory() as tmp:
+            manifest = write_blocked_manifest(
+                Path(tmp),
+                profile="debug-photo-bmc-replay-binary921",
+                status="blocked_waiting_for_binary921_ready",
+                startup_raw=b"old-noise",
+                startup_frames=[],
+                error="timeout",
+            )
+
+            manifest_path = Path(tmp) / "binary921-evidence-manifest.json"
+            self.assertTrue(manifest_path.is_file())
+            self.assertEqual(manifest["status"], "blocked_waiting_for_binary921_ready")
+            self.assertEqual(manifest["host_command_count"], 0)
+            self.assertEqual(manifest["startup_pre_sram_noise_sha256"], "2720ea258623d86efdb0d4c7767f6806839c402b231d2dacde75d9d2256a0d45")
+
+    def test_binary921_package_script_creates_debug_and_formal_packages(self) -> None:
+        powershell = shutil.which("powershell")
+        if powershell is None:
+            self.skipTest("PowerShell is not available")
+
+        script = ROOT / "tools" / "package_j6_binary921.ps1"
+        self.assertTrue(script.is_file())
+        static_text = script.read_text(encoding="utf-8")
+        for marker in [
+            "debug-photo-bmc-replay-binary921",
+            "formal-uart1-bmc-replay-binary921",
+            "collect_j6_binary921.py",
+            "binary921.py",
+            "bmc_replay_uart.py",
+            "j6bin.bit",
+            "collect-binary921.ps1",
+            "START-HERE.zh-CN.md",
+            "sha256-inventory.json",
+            "binary921-evidence-manifest.json",
+            "pc_replay_from_real_bmc_capture",
+            "PYTHONDONTWRITEBYTECODE",
+            "Remove-PythonCache",
+            "__pycache__",
+        ]:
+            self.assertIn(marker, static_text)
+        self.assertNotIn("Set-ExecutionPolicy", static_text)
+        self.assertNotIn("pip install", static_text.lower())
+        self.assertNotIn("PROGRAM_FLASH", static_text)
+
+        with tempfile.TemporaryDirectory() as tmp:
+            bitstream = Path(tmp) / "fake-binary921.bit"
+            td_receipt = Path(tmp) / "td-binary921.json"
+            bitstream.write_bytes(b"fake-binary921-sram-bitstream")
+            td_receipt.write_text(json.dumps({"schema": "td-build-receipt-v1", "status": "pass"}), encoding="utf-8")
+
+            for profile, package_name, expected_debug_rx, expected_debug_tx in [
+                ("debug-photo-bmc-replay-binary921", "j6bin-debug-test", "P10", "R10"),
+                ("formal-uart1-bmc-replay-binary921", "j6bin-formal-test", "M14", "M15"),
+            ]:
+                with self.subTest(profile=profile):
+                    result = subprocess.run(
+                        [
+                            powershell,
+                            "-NoProfile",
+                            "-ExecutionPolicy",
+                            "Bypass",
+                            "-File",
+                            str(script),
+                            "-OutputDir",
+                            tmp,
+                            "-PackageName",
+                            package_name,
+                            "-Profile",
+                            profile,
+                            "-Bitstream",
+                            str(bitstream),
+                            "-TdReceipt",
+                            str(td_receipt),
+                        ],
+                        cwd=ROOT,
+                        text=True,
+                        capture_output=True,
+                        check=False,
+                    )
+                    self.assertEqual(result.returncode, 0, result.stderr + result.stdout)
+                    stage = Path(tmp) / package_name
+                    self.assertTrue((stage / "j6bin.bit").is_file())
+                    self.assertTrue((stage / "td.json").is_file())
+                    self.assertTrue((stage / "collect-binary921.ps1").is_file())
+                    self.assertTrue((stage / "tools" / "collect_j6_binary921.py").is_file())
+                    self.assertTrue((stage / "tools" / "binary921.py").is_file())
+                    self.assertTrue((stage / "tools" / "bmc_replay_uart.py").is_file())
+                    self.assertTrue((stage / "START-HERE.zh-CN.md").is_file())
+                    self.assertTrue((stage / "sha256-inventory.json").is_file())
+                    self.assertTrue((Path(tmp) / f"{package_name}.zip").is_file())
+                    self.assertTrue((Path(tmp) / f"{package_name}.zip.sha256.txt").is_file())
+                    self.assertEqual((stage / "j6bin.bit").read_bytes(), bitstream.read_bytes())
+
+                    start_here = (stage / "START-HERE.zh-CN.md").read_text(encoding="utf-8-sig")
+                    self.assertIn("collector first, then PROGRAM_SRAM", start_here)
+                    self.assertIn("JTAG speed 200k", start_here)
+                    self.assertIn("board power", start_here)
+                    self.assertIn(".\\j6bin.bit", start_here)
+                    self.assertIn("-File .\\collect-binary921.ps1", start_here)
+                    self.assertIn("-BmcReplayReceipt .\\bmc-replay-session.json", start_here)
+                    self.assertIn(profile, start_here)
+                    self.assertIn("binary921", start_here)
+                    self.assertIn("COM8", start_here)
+                    self.assertIn("COM7", start_here)
+                    self.assertIn("COM9", start_here)
+                    self.assertNotIn("Set-ExecutionPolicy", start_here)
+                    self.assertNotIn("pip install", start_here.lower())
+
+                    manifest = json.loads((stage / "manifest.json").read_text(encoding="utf-8-sig"))
+                    expected_status = (
+                        "pass"
+                        if profile == "debug-photo-bmc-replay-binary921"
+                        else "blocked_waiting_for_uart1_uart2_access"
+                    )
+                    self.assertEqual(manifest["status"], expected_status)
+                    self.assertEqual(manifest["protocol"], "binary921")
+                    self.assertEqual(manifest["pin_profile"], profile)
+                    self.assertEqual(manifest["jtag_programming"]["jtag_speed_hz"], 200000)
+                    self.assertEqual(manifest["jtag_programming"]["board_power_present_before_program"], True)
+                    self.assertEqual(manifest["jtag_programming"]["program_mode"], "PROGRAM_SRAM")
+                    self.assertEqual(manifest["bitstream"]["path"], "j6bin.bit")
+                    self.assertEqual(manifest["bmc_source"], "pc_replay_from_real_bmc_capture")
+                    self.assertEqual(manifest["collector"]["bmc_replay_receipt"], "bmc-replay-session.json")
+                    self.assertEqual(manifest["real_fan_ptc_hardware_status"], "not_run")
+                    self.assertEqual(manifest["pin_map"]["uart_assignments"]["debug_uart_rx"]["fpga_ball"], expected_debug_rx)
+                    self.assertEqual(manifest["pin_map"]["uart_assignments"]["debug_uart_tx"]["fpga_ball"], expected_debug_tx)
+
+                    inv = json.loads((stage / "sha256-inventory.json").read_text(encoding="utf-8-sig"))
+                    paths = {item["path"] for item in inv["inventory"]}
+                    self.assertIn("j6bin.bit", paths)
+                    self.assertIn("collect-binary921.ps1", paths)
+                    self.assertIn("tools/collect_j6_binary921.py", paths)
+                    self.assertIn("tools/binary921.py", paths)
+                    self.assertIn("tools/bmc_replay_uart.py", paths)
+                    self.assertNotIn("sha256-inventory.json", paths)
+                    self.assertFalse(any(part == "__pycache__" for path in stage.rglob("*") for part in path.parts))
+                    self.assertFalse(any(path.suffix in {".pyc", ".pyo"} for path in stage.rglob("*")))
+
+    def test_binary921_package_script_creates_production_two_uart_package(self) -> None:
+        powershell = shutil.which("powershell")
+        if powershell is None:
+            self.skipTest("PowerShell is not available")
+
+        script = ROOT / "tools" / "package_j6_binary921.ps1"
+        with tempfile.TemporaryDirectory() as tmp:
+            bitstream = Path(tmp) / "fake-production-binary921.bit"
+            td_receipt = Path(tmp) / "td-production-binary921.json"
+            payload_path = Path(tmp) / "historical-bmc-payload.json"
+            bitstream_bytes = b"fake-production-two-uart-sram-bitstream"
+            bitstream.write_bytes(bitstream_bytes)
+            bit_sha = hashlib.sha256(bitstream_bytes).hexdigest()
+            td_receipt.write_text(
+                json.dumps(
+                    {
+                        "schema": "td-build-receipt-v1",
+                        "status": "pass",
+                        "top": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921",
+                        "top_module": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top",
+                        "mode": "implementation",
+                        "pin_profile": "production-two-uart-bmc-replay-binary921",
+                        "timing_gate": {"status": "pass"},
+                        "bitstream": {"sha256": bit_sha},
+                    }
+                ),
+                encoding="utf-8",
+            )
+            historical_reply = (
+                "1e 4b ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff "
+                "20 19 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff\r\n"
+            )
+            payload_path.write_text(
+                json.dumps(
+                    {
+                        "schema": "j6-bmc-replay-payload-v1",
+                        "status": "pass",
+                        "source": "real_bmc_capture",
+                        "bmc_source": "pc_replay_from_real_bmc_capture",
+                        "live_bmc_link_status": "not_used",
+                        "reply_text": historical_reply,
+                        "reply_sha256": "06c173f91f8b6b0e56f9c381b49d5b127d2dbf3a09402843838a0ff2b812f1af",
+                        "capture_text_sha256": "1" * 64,
+                        "byte_count": 48,
+                        "valid_count": 2,
+                        "missing_count": 22,
+                    }
+                ),
+                encoding="utf-8",
+            )
+
+            result = subprocess.run(
+                [
+                    powershell,
+                    "-NoProfile",
+                    "-ExecutionPolicy",
+                    "Bypass",
+                    "-File",
+                    str(script),
+                    "-OutputDir",
+                    tmp,
+                    "-PackageName",
+                    "j6prod-2uart-bmc-replay-test",
+                    "-Profile",
+                    "production-two-uart-bmc-replay-binary921",
+                    "-Bitstream",
+                    str(bitstream),
+                    "-TdReceipt",
+                    str(td_receipt),
+                    "-BmcReplayPayload",
+                    str(payload_path),
+                ],
+                cwd=ROOT,
+                text=True,
+                capture_output=True,
+                check=False,
+            )
+
+            self.assertEqual(result.returncode, 0, result.stderr + result.stdout)
+            stage = Path(tmp) / "j6prod-2uart-bmc-replay-test"
+            self.assertTrue((stage / "j6bin.bit").is_file())
+            self.assertTrue((stage / "td.json").is_file())
+            self.assertTrue((stage / "bmc-replay-payload.json").is_file())
+            self.assertTrue((stage / "collect-binary921.ps1").is_file())
+            self.assertTrue((Path(tmp) / "j6prod-2uart-bmc-replay-test.zip").is_file())
+
+            start_here = (stage / "START-HERE.zh-CN.md").read_text(encoding="utf-8-sig")
+            for marker in [
+                "production-two-uart-bmc-replay-binary921",
+                "J3",
+                "1=TCK",
+                "2=GND",
+                "3=TDO",
+                "4=VREF",
+                "5=TMS",
+                "9=TDI",
+                "10=GND",
+                "UART1",
+                "L10",
+                "M9",
+                "UART2",
+                "M10",
+                "N11",
+                "-CombinedPort",
+                "不要求重新上电",
+                "-Iterations 3",
+                "-TimeoutSeconds 600",
+                "921600",
+                "115200",
+                ".\\bmc-replay-payload.json",
+            ]:
+                self.assertIn(marker, start_here)
+            self.assertNotIn("-HostPort COM8 -DebugPort COM7", start_here)
+            self.assertNotIn("Set-ExecutionPolicy", start_here)
+            self.assertNotIn("pip install", start_here.lower())
+
+            manifest = json.loads((stage / "manifest.json").read_text(encoding="utf-8-sig"))
+            self.assertEqual(manifest["status"], "pass")
+            self.assertEqual(manifest["pin_profile"], "production-two-uart-bmc-replay-binary921")
+            self.assertEqual(manifest["transport"], "combined_host_debug_uart")
+            self.assertEqual(manifest["combined_uart_baud"], 921600)
+            self.assertEqual(manifest["bmc_replay_uart_baud"], 115200)
+            self.assertEqual(manifest["pin_map"]["uart_assignments"]["bmc_replay_uart_tx"]["fpga_ball"], "L10")
+            self.assertEqual(manifest["pin_map"]["uart_assignments"]["bmc_replay_uart_rx"]["fpga_ball"], "M9")
+            self.assertEqual(manifest["pin_map"]["uart_assignments"]["combined_debug_host_uart_tx"]["fpga_ball"], "M10")
+            self.assertEqual(manifest["pin_map"]["uart_assignments"]["combined_debug_host_uart_rx"]["fpga_ball"], "N11")
+            self.assertEqual(manifest["bmc_replay_payload"]["reply_sha256"], "06c173f91f8b6b0e56f9c381b49d5b127d2dbf3a09402843838a0ff2b812f1af")
+            self.assertEqual(manifest["bitstream"]["sha256"], bit_sha)
+            self.assertFalse(manifest["jtag_programming"]["power_cycle_required"])
+            self.assertEqual(manifest["bmc_replay_payload"]["valid_count"], 2)
+            self.assertEqual(manifest["bmc_replay_payload"]["missing_count"], 22)
+            self.assertEqual(manifest["real_fan_ptc_hardware_status"], "not_run")
+
+            paths = {item["path"] for item in json.loads((stage / "sha256-inventory.json").read_text(encoding="utf-8-sig"))["inventory"]}
+            self.assertIn("bmc-replay-payload.json", paths)
+            self.assertIn("collect-binary921.ps1", paths)
+            self.assertIn("tools/collect_j6_binary921.py", paths)
+
+    def test_binary921_production_package_rejects_unbound_td_receipt_and_payload_hash(self) -> None:
+        powershell = shutil.which("powershell")
+        if powershell is None:
+            self.skipTest("PowerShell is not available")
+
+        script = ROOT / "tools" / "package_j6_binary921.ps1"
+        with tempfile.TemporaryDirectory() as tmp:
+            bitstream = Path(tmp) / "fake-production-binary921.bit"
+            td_receipt = Path(tmp) / "td-production-binary921.json"
+            payload_path = Path(tmp) / "historical-bmc-payload.json"
+            bitstream.write_bytes(b"fake-production-two-uart-sram-bitstream")
+            td_receipt.write_text(json.dumps({"schema": "td-build-receipt-v1", "status": "pass"}), encoding="utf-8")
+            payload_path.write_text(
+                json.dumps(
+                    {
+                        "schema": "j6-bmc-replay-payload-v1",
+                        "status": "pass",
+                        "source": "real_bmc_capture",
+                        "bmc_source": "pc_replay_from_real_bmc_capture",
+                        "reply_text": "1e 4b\r\n",
+                        "reply_sha256": "0" * 64,
+                        "capture_text_sha256": "1" * 64,
+                        "byte_count": 48,
+                        "valid_count": 2,
+                        "missing_count": 22,
+                    }
+                ),
+                encoding="utf-8",
+            )
+
+            result = subprocess.run(
+                [
+                    powershell,
+                    "-NoProfile",
+                    "-ExecutionPolicy",
+                    "Bypass",
+                    "-File",
+                    str(script),
+                    "-OutputDir",
+                    tmp,
+                    "-PackageName",
+                    "j6prod-2uart-bmc-replay-test",
+                    "-Profile",
+                    "production-two-uart-bmc-replay-binary921",
+                    "-Bitstream",
+                    str(bitstream),
+                    "-TdReceipt",
+                    str(td_receipt),
+                    "-BmcReplayPayload",
+                    str(payload_path),
+                ],
+                cwd=ROOT,
+                text=True,
+                capture_output=True,
+                check=False,
+            )
+
+        self.assertNotEqual(result.returncode, 0)
+        self.assertIn("TD receipt", result.stderr + result.stdout)
+
     def test_j6_host_sensor_real_fan_ptc_package_output_contains_bmc_replay_profile_artifacts(self) -> None:
-        powershell = shutil.which("powershell")
-        if powershell is None:
-            self.skipTest("PowerShell is not available")
+        powershell = shutil.which("powershell")
+        if powershell is None:
+            self.skipTest("PowerShell is not available")
 
         with tempfile.TemporaryDirectory() as tmp:
             bitstream = Path(tmp) / "fake.bit"
@@ -757,6 +1550,8 @@ if ($events[2].fields.cmd -ne "FANCH") { throw "ack cmd was $($events[2].fields.
                     self.assertIn(expected["host_ports"], start_here)
                     self.assertIn("pc_replay_from_real_bmc_capture", start_here)
                     self.assertIn("collector_protocol_profile=temp-uart-ptc-remap", start_here)
+                    self.assertIn("JTAG speed 200k", start_here)
+                    self.assertIn("board power", start_here)
                     self.assertIn(expected["bmc_tx"], start_here)
                     self.assertIn(expected["bmc_rx"], start_here)
                     self.assertIn("capture-bmc.ps1", start_here)
@@ -824,6 +1619,9 @@ if ($events[2].fields.cmd -ne "FANCH") { throw "ack cmd was $($events[2].fields.
                     self.assertEqual(manifest["pin_map"]["uart_assignments"]["bmc_replay_uart_tx"]["fpga_ball"], expected["bmc_tx"])
                     self.assertEqual(manifest["pin_map"]["uart_assignments"]["bmc_replay_uart_rx"]["fpga_ball"], expected["bmc_rx"])
                     self.assertEqual(manifest["programming_mode"], "PROGRAM_SRAM")
+                    self.assertEqual(manifest["jtag_programming"]["jtag_speed_hz"], 200000)
+                    self.assertEqual(manifest["jtag_programming"]["board_power_present_before_program"], True)
+                    self.assertEqual(manifest["jtag_programming"]["program_mode"], "PROGRAM_SRAM")
                     self.assertEqual(manifest["bitstream"]["path"], "j6tmp.bit")
                     self.assertEqual(manifest["td_receipt"]["path"], "td.json")
                     self.assertEqual(manifest["short_path_aliases"]["bitstream"]["source"], f"bitstreams/{bitstream.name}")
@@ -941,9 +1739,11 @@ if ($events[2].fields.cmd -ne "FANCH") { throw "ack cmd was $($events[2].fields.
         for marker in [
             "J6 Host Sensor Real FAN/PTC Debug921",
             "START-HERE.zh-CN.md",
-            "temp-uart-ptc-remap",
-            "PROGRAM_SRAM",
-            "collector first, then PROGRAM_SRAM",
+            "temp-uart-ptc-remap",
+            "PROGRAM_SRAM",
+            "JTAG speed 200k",
+            "board_power_present_before_program",
+            "collector first, then PROGRAM_SRAM",
             "COM8",
             "COM7",
             "PTC03",
@@ -1002,10 +1802,16 @@ if ($events[2].fields.cmd -ne "FANCH") { throw "ack cmd was $($events[2].fields.
                 encoding="utf-8"
             )
         )
-        layers = schema["properties"]["layers"]["properties"]
-
-        self.assertEqual(schema["properties"]["diagnostic_scope"], {"const": "host_sensor_real_fan_ptc_debug921"})
-        for layer in [
+        layers = schema["properties"]["layers"]["properties"]
+
+        self.assertEqual(schema["properties"]["diagnostic_scope"], {"const": "host_sensor_real_fan_ptc_debug921"})
+        programming_props = schema["properties"]["programming"]["properties"]
+        self.assertEqual(programming_props["jtag_speed_hz"], {"const": 200000})
+        self.assertEqual(programming_props["board_power_present_before_program"], {"const": True})
+        manual_props = layers["manual_sram_programming"]["properties"]
+        self.assertEqual(manual_props["jtag_speed_hz"], {"const": 200000})
+        self.assertEqual(manual_props["board_power_present_before_program"], {"const": True})
+        for layer in [
             "host_command_sequence",
             "host_control_transcript",
             "host_sensor_reports",

+ 359 - 0
tools/binary921.py

@@ -0,0 +1,359 @@
+#!/usr/bin/env python3
+"""J6 binary921 host/debug frame helpers.
+
+The CPLD emits and accepts compact binary frames so the expensive ASCII
+formatting stays in the PC-side harness.
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import sys
+from dataclasses import dataclass
+from enum import IntEnum
+from pathlib import Path
+from typing import Iterable
+
+
+MAGIC = b"\xA5\x5A"
+VERSION = 1
+HEADER_LEN = 14
+CRC_LEN = 2
+MAX_PAYLOAD_LEN = 255
+PROFILE_NAME_TO_ID = {
+    "debug-photo-bmc-replay-binary921": 1,
+    "formal-uart1-bmc-replay-binary921": 2,
+    "production-two-uart-bmc-replay-binary921": 3,
+}
+PROFILE_ID_TO_NAME = {value: key for key, value in PROFILE_NAME_TO_ID.items()}
+
+
+class Binary921FrameError(ValueError):
+    """Raised when a binary921 frame cannot be decoded safely."""
+
+
+class FrameType(IntEnum):
+    READY = 0x01
+    BMC_POLL = 0x02
+    BMC_PAYLOAD = 0x03
+    SENSOR_CACHE = 0x04
+    HOST_CMD = 0x05
+    HOST_ACK = 0x06
+    PWM_STATE = 0x07
+    PID_STATE = 0x08
+    TIMEOUT_STATE = 0x09
+    PIN_PROFILE = 0x0A
+    MODULE_SNAPSHOT = 0x0B
+    ERROR_COUNTERS = 0x0C
+
+
+class CommandId(IntEnum):
+    SET_PTC = 0x20
+    SET_FAN = 0x21
+    GET_SENSOR = 0x22
+    GET_MAP = 0x23
+    GET_STATUS = 0x24
+    SET_PID_REQUESTED = 0x25
+    DISABLE = 0x26
+
+
+def profile_id_for_name(profile: str) -> int:
+    try:
+        return PROFILE_NAME_TO_ID[profile]
+    except KeyError as exc:
+        raise ValueError(f"unknown binary921 profile: {profile}") from exc
+
+
+def profile_name_for_id(profile_id: int) -> str:
+    try:
+        return PROFILE_ID_TO_NAME[int(profile_id)]
+    except KeyError as exc:
+        raise ValueError(f"unknown binary921 profile id: {profile_id}") from exc
+
+
+@dataclass(frozen=True)
+class Binary921Frame:
+    version: int
+    profile_id: int
+    frame_type: int
+    seq: int
+    timestamp_tick: int
+    payload: bytes
+    crc16: int
+    raw: bytes
+
+
+def crc16_ccitt(data: bytes, *, initial: int = 0xFFFF) -> int:
+    crc = initial & 0xFFFF
+    for byte in data:
+        crc ^= byte << 8
+        for _ in range(8):
+            if crc & 0x8000:
+                crc = ((crc << 1) ^ 0x1021) & 0xFFFF
+            else:
+                crc = (crc << 1) & 0xFFFF
+    return crc & 0xFFFF
+
+
+def _le_u32(value: int) -> bytes:
+    if value < 0 or value > 0xFFFFFFFF:
+        raise ValueError("u32 value out of range")
+    return value.to_bytes(4, "little")
+
+
+def encode_frame(
+    *,
+    profile_id: int,
+    frame_type: int,
+    seq: int,
+    timestamp_tick: int,
+    payload: bytes | bytearray | Iterable[int],
+) -> bytes:
+    payload_bytes = bytes(payload)
+    if profile_id < 0 or profile_id > 0xFF:
+        raise ValueError("profile_id must fit in one byte")
+    if int(frame_type) < 0 or int(frame_type) > 0xFF:
+        raise ValueError("frame_type must fit in one byte")
+    if len(payload_bytes) > MAX_PAYLOAD_LEN:
+        raise ValueError("payload too long for binary921 v1")
+    body = bytes(
+        [
+            VERSION,
+            profile_id & 0xFF,
+            int(frame_type) & 0xFF,
+        ]
+    )
+    body += _le_u32(seq)
+    body += _le_u32(timestamp_tick)
+    body += bytes([len(payload_bytes)])
+    body += payload_bytes
+    crc = crc16_ccitt(body)
+    return MAGIC + body + crc.to_bytes(2, "little")
+
+
+def decode_frame(frame: bytes | bytearray) -> Binary921Frame:
+    raw = bytes(frame)
+    if len(raw) < HEADER_LEN + CRC_LEN:
+        raise Binary921FrameError("short binary921 frame")
+    if raw[:2] != MAGIC:
+        raise Binary921FrameError("bad binary921 magic")
+    payload_len = raw[13]
+    expected_len = HEADER_LEN + payload_len + CRC_LEN
+    if len(raw) != expected_len:
+        raise Binary921FrameError(f"length mismatch: expected {expected_len}, got {len(raw)}")
+    body = raw[2:-2]
+    expected_crc = crc16_ccitt(body)
+    actual_crc = int.from_bytes(raw[-2:], "little")
+    if actual_crc != expected_crc:
+        raise Binary921FrameError(f"crc mismatch: expected 0x{expected_crc:04x}, got 0x{actual_crc:04x}")
+    version = raw[2]
+    if version != VERSION:
+        raise Binary921FrameError(f"unsupported binary921 version {version}")
+    return Binary921Frame(
+        version=version,
+        profile_id=raw[3],
+        frame_type=raw[4],
+        seq=int.from_bytes(raw[5:9], "little"),
+        timestamp_tick=int.from_bytes(raw[9:13], "little"),
+        payload=raw[14 : 14 + payload_len],
+        crc16=actual_crc,
+        raw=raw,
+    )
+
+
+def decode_stream(data: bytes | bytearray) -> tuple[list[Binary921Frame], bytes]:
+    buf = bytes(data)
+    frames: list[Binary921Frame] = []
+    offset = 0
+    while True:
+        magic_at = buf.find(MAGIC, offset)
+        if magic_at < 0:
+            tail = buf[-1:] if buf.endswith(MAGIC[:1]) else b""
+            return frames, tail
+        if magic_at + HEADER_LEN + CRC_LEN > len(buf):
+            return frames, buf[magic_at:]
+        payload_len = buf[magic_at + 13]
+        end = magic_at + HEADER_LEN + payload_len + CRC_LEN
+        if end > len(buf):
+            return frames, buf[magic_at:]
+        candidate = buf[magic_at:end]
+        try:
+            frames.append(decode_frame(candidate))
+            offset = end
+        except Binary921FrameError:
+            offset = magic_at + 1
+
+
+def build_host_command(
+    *,
+    seq: int,
+    command: int,
+    channel: int | None = None,
+    percent: int | None = None,
+    profile_id: int = 1,
+    timestamp_tick: int = 0,
+) -> bytes:
+    command_id = CommandId(int(command))
+    if command_id == CommandId.SET_PTC:
+        if channel is None or channel < 1 or channel > 24:
+            raise ValueError("PTC channel must be 1..24")
+        if percent is None or percent < 0 or percent > 100:
+            raise ValueError("percent must be 0..100")
+        payload = bytes([command_id, channel, percent])
+    elif command_id == CommandId.SET_FAN:
+        if channel is None or channel < 1 or channel > 4:
+            raise ValueError("FAN channel must be 1..4")
+        if percent is None or percent < 0 or percent > 100:
+            raise ValueError("percent must be 0..100")
+        payload = bytes([command_id, channel, percent])
+    elif command_id == CommandId.SET_PID_REQUESTED:
+        if percent is None:
+            raise ValueError("SET_PID_REQUESTED uses percent as enabled flag 0/1")
+        payload = bytes([command_id, 1 if percent else 0])
+    else:
+        payload = bytes([command_id])
+    return encode_frame(
+        profile_id=profile_id,
+        frame_type=FrameType.HOST_CMD,
+        seq=seq,
+        timestamp_tick=timestamp_tick,
+        payload=payload,
+    )
+
+
+def _enum_name(enum_cls: type[IntEnum], value: int) -> str:
+    try:
+        return enum_cls(value).name
+    except ValueError:
+        return f"UNKNOWN_0x{value:02X}"
+
+
+def decode_payload(frame: Binary921Frame) -> dict[str, object]:
+    payload = frame.payload
+    if frame.frame_type == FrameType.READY:
+        decoded: dict[str, object] = {"kind": "ready"}
+        if len(payload) >= 1:
+            decoded["profile_id_payload"] = payload[0]
+        return decoded
+    if frame.frame_type == FrameType.HOST_CMD:
+        if len(payload) < 1:
+            return {"kind": "host_cmd", "error": "missing_cmd_id"}
+        command_id = payload[0]
+        decoded = {"kind": "host_cmd", "cmd": _enum_name(CommandId, command_id), "cmd_id": command_id}
+        if len(payload) >= 2:
+            decoded["channel"] = payload[1]
+        if len(payload) >= 3:
+            decoded["percent"] = payload[2]
+        return decoded
+    if frame.frame_type == FrameType.HOST_ACK:
+        if len(payload) < 6:
+            return {"kind": "host_ack", "error": "short_payload", "payload_len": len(payload)}
+        command_id = payload[1]
+        return {
+            "kind": "host_ack",
+            "ok": payload[0] == 1,
+            "cmd": _enum_name(CommandId, command_id),
+            "cmd_id": command_id,
+            "status_code": payload[2],
+            "applied_state_hash": int.from_bytes(payload[4:6], "little"),
+        }
+    if frame.frame_type == FrameType.BMC_PAYLOAD:
+        return {
+            "kind": "bmc_payload",
+            "payload_len_reported": payload[0] if len(payload) >= 1 else None,
+            "payload_count": payload[1] if len(payload) >= 2 else None,
+            "bmc_frame_seq": int.from_bytes(payload[2:4], "little") if len(payload) >= 4 else None,
+            "first_byte": payload[4] if len(payload) >= 5 else None,
+            "last_byte": payload[5] if len(payload) >= 6 else None,
+            "checksum": int.from_bytes(payload[6:8], "little") if len(payload) >= 8 else None,
+        }
+    if frame.frame_type == FrameType.SENSOR_CACHE:
+        return {
+            "kind": "sensor_cache",
+            "profile_id_payload": payload[0] if len(payload) >= 1 else None,
+            "bmc_frame_seq": int.from_bytes(payload[1:3], "little") if len(payload) >= 3 else None,
+            "missing_mask": int.from_bytes(payload[3:6], "little") if len(payload) >= 6 else None,
+            "valid_count": payload[6] if len(payload) >= 7 else None,
+            "missing_count": payload[7] if len(payload) >= 8 else None,
+        }
+    if frame.frame_type == FrameType.ERROR_COUNTERS:
+        return {"kind": "error_counters", "payload_len": len(payload)}
+    if frame.frame_type == FrameType.MODULE_SNAPSHOT:
+        decoded = {"kind": "module_snapshot", "payload_len": len(payload)}
+        if len(payload) >= 20:
+            decoded.update(
+                {
+                    "profile_id_payload": payload[0],
+                    "host_err_count": payload[1],
+                    "command_count_seen": int.from_bytes(payload[2:4], "little"),
+                    "bmc_payload_first": payload[4],
+                    "bmc_payload_last": payload[5],
+                    "bmc_payload_checksum": int.from_bytes(payload[6:8], "little"),
+                    "last_cmd_id": payload[8],
+                    "last_cmd": _enum_name(CommandId, payload[8]),
+                    "last_cmd_ch": payload[9],
+                    "last_cmd_pct": payload[10],
+                    "last_status_code": payload[11],
+                    "pid_requested": payload[12] != 0,
+                    "timeout_active": payload[13] != 0,
+                    "valid_count": payload[14],
+                    "missing_count": payload[15],
+                    "ptc01_percent": payload[16],
+                    "ptc24_percent": payload[17],
+                    "fan01_percent": payload[18],
+                    "fan04_percent": payload[19],
+                }
+            )
+        if len(payload) >= 21:
+            decoded["fan_fg_mask"] = payload[20]
+        if len(payload) >= 22:
+            decoded["fan_install_mask"] = payload[21] & 0x0F
+        return decoded
+    return {"kind": _enum_name(FrameType, frame.frame_type).lower(), "payload_len": len(payload)}
+
+
+def frame_to_dict(frame: Binary921Frame) -> dict[str, object]:
+    return {
+        "version": frame.version,
+        "profile_id": frame.profile_id,
+        "frame_type": frame.frame_type,
+        "frame_type_name": _enum_name(FrameType, frame.frame_type),
+        "seq": frame.seq,
+        "timestamp_tick": frame.timestamp_tick,
+        "payload_hex": frame.payload.hex(),
+        "crc16": f"{frame.crc16:04x}",
+        "decoded": decode_payload(frame),
+    }
+
+
+def cmd_decode(args: argparse.Namespace) -> int:
+    data = Path(args.input).read_bytes()
+    frames, remainder = decode_stream(data)
+    payload = {
+        "schema": "binary921-decode-v1",
+        "status": "pass" if frames and not remainder else "blocked_incomplete_or_empty",
+        "frames": [frame_to_dict(frame) for frame in frames],
+        "remainder_hex": remainder.hex(),
+    }
+    print(json.dumps(payload, indent=2))
+    return 0 if payload["status"] == "pass" else 1
+
+
+def build_parser() -> argparse.ArgumentParser:
+    parser = argparse.ArgumentParser(description=__doc__)
+    sub = parser.add_subparsers(dest="command", required=True)
+    decode = sub.add_parser("decode")
+    decode.add_argument("--input", required=True)
+    decode.set_defaults(func=cmd_decode)
+    return parser
+
+
+def main(argv: list[str] | None = None) -> int:
+    parser = build_parser()
+    args = parser.parse_args(argv)
+    return int(args.func(args))
+
+
+if __name__ == "__main__":
+    raise SystemExit(main(sys.argv[1:]))

+ 89 - 0
tools/bmc_replay_uart.py

@@ -12,12 +12,14 @@ import argparse
 import hashlib
 import json
 import re
+import sys
 import time
 from dataclasses import dataclass
 from datetime import datetime, timezone
 from pathlib import Path
 from typing import Any, Protocol
 
+sys.dont_write_bytecode = True
 
 POLL_COMMAND_TEXT = "ipmitool raw 0x36 0x6c 0xdf 0xdd 0x00 0x03\n"
 POLL_COMMAND_BYTES = [0x36, 0x6C, 0xDF, 0xDD, 0x00, 0x03]
@@ -218,10 +220,18 @@ def run_poll_response_session(
         "status": "pass" if matched == iterations else "blocked_waiting_for_cpld_poll",
         "generated_at": utc_now(),
         "replay_mode": "poll_response",
+        "source": payload.get("source"),
         "bmc_source": "pc_replay_from_real_bmc_capture",
         "live_bmc_link_status": "not_used",
         "matched_poll_count": matched,
         "reply_count": replies,
+        "payload_reply_sha256": payload.get("reply_sha256"),
+        "reply_sha256": payload.get("reply_sha256"),
+        "capture_text_sha256": payload.get("capture_text_sha256"),
+        "byte_count": payload.get("byte_count"),
+        "valid_count": payload.get("valid_count"),
+        "missing_count": payload.get("missing_count"),
+        "rejected_echo_windows": payload.get("rejected_echo_windows"),
         "unsolicited_reply_attempted": False,
         "elapsed_sec": round(time.monotonic() - started, 6),
         "safety": {
@@ -258,6 +268,77 @@ def cmd_selftest(args: argparse.Namespace) -> int:
     return 0
 
 
+def _load_payload(path: Path) -> dict[str, Any]:
+    payload = json.loads(path.read_text(encoding="utf-8"))
+    if not payload.get("reply_text"):
+        raise ValueError("payload missing reply_text")
+    reply_text = str(payload["reply_text"])
+    reply_sha256 = str(payload.get("reply_sha256") or "")
+    if not re.fullmatch(r"[0-9a-fA-F]{64}", reply_sha256):
+        raise ValueError("payload reply_sha256 missing or invalid")
+    actual_reply_sha256 = hashlib.sha256(reply_text.encode("ascii")).hexdigest()
+    if actual_reply_sha256 != reply_sha256.lower():
+        raise ValueError("payload reply_sha256 does not match reply_text")
+    return payload
+
+
+def _open_serial_endpoint(port: str) -> ReplayEndpoint:
+    if not re.fullmatch(r"COM[0-9]+", port.upper()):
+        raise ValueError("port must be an explicit COM port such as COM9")
+    try:
+        import serial  # type: ignore
+    except ImportError as exc:
+        raise RuntimeError("pyserial is required for live replay; install it manually in the isolated lab.") from exc
+    endpoint = serial.Serial()
+    endpoint.port = port
+    endpoint.baudrate = 115200
+    endpoint.bytesize = 8
+    endpoint.parity = "N"
+    endpoint.stopbits = 1
+    endpoint.timeout = 0.02
+    endpoint.write_timeout = 1
+    endpoint.rtscts = False
+    endpoint.dsrdtr = False
+    endpoint.dtr = False
+    endpoint.rts = False
+    endpoint.open()
+    return endpoint
+
+
+def cmd_replay(args: argparse.Namespace) -> int:
+    try:
+        payload = _load_payload(Path(args.payload))
+    except (OSError, json.JSONDecodeError, UnicodeEncodeError, ValueError) as exc:
+        receipt = {
+            "schema": "j6-bmc-replay-session-v1",
+            "status": "blocked_invalid_payload",
+            "generated_at": utc_now(),
+            "error": str(exc),
+        }
+        if args.json:
+            print(json.dumps(receipt, indent=2))
+        else:
+            print(f"replay={receipt['status']} error={receipt['error']}")
+        return 1
+    if args.dry_run:
+        endpoint: ReplayEndpoint = FakeSerialEndpoint(initial_rx=POLL_COMMAND_TEXT.encode("ascii"))
+    else:
+        endpoint = _open_serial_endpoint(args.port)
+    try:
+        iterations = args.iterations if args.iterations > 0 else 1 if args.dry_run else 2**31 - 1
+        timeout_sec = args.timeout_sec if args.timeout_sec > 0 else 0.1 if args.dry_run else 86400.0
+        receipt = run_poll_response_session(endpoint, payload, iterations=iterations, timeout_sec=timeout_sec)
+    finally:
+        close = getattr(endpoint, "close", None)
+        if callable(close):
+            close()
+    if args.json:
+        print(json.dumps(receipt, indent=2))
+    else:
+        print(f"replay={receipt['status']} matched={receipt['matched_poll_count']} replies={receipt['reply_count']}")
+    return 0 if receipt["status"] == "pass" else 1
+
+
 def build_parser() -> argparse.ArgumentParser:
     parser = argparse.ArgumentParser(description=__doc__)
     sub = parser.add_subparsers(dest="command", required=True)
@@ -271,6 +352,14 @@ def build_parser() -> argparse.ArgumentParser:
 
     selftest = sub.add_parser("selftest")
     selftest.set_defaults(func=cmd_selftest)
+    replay = sub.add_parser("replay")
+    replay.add_argument("--port", required=True)
+    replay.add_argument("--payload", required=True)
+    replay.add_argument("--iterations", type=int, default=0)
+    replay.add_argument("--timeout-sec", type=float, default=0.0)
+    replay.add_argument("--dry-run", action="store_true")
+    replay.add_argument("--json", action="store_true")
+    replay.set_defaults(func=cmd_replay)
     return parser
 
 

+ 561 - 0
tools/package_j6_binary921.ps1

@@ -0,0 +1,561 @@
+param(
+    [string]$OutputDir = ".\j6-binary921-deliverables",
+    [string]$PackageName = "",
+    [Parameter(Mandatory = $true)]
+    [ValidateSet("debug-photo-bmc-replay-binary921", "formal-uart1-bmc-replay-binary921", "production-two-uart-bmc-replay-binary921")]
+    [string]$Profile,
+    [Parameter(Mandatory = $true)]
+    [string]$Bitstream,
+    [Parameter(Mandatory = $true)]
+    [string]$TdReceipt,
+    [string]$BmcReplayPayload = "",
+    [switch]$ForceOverwrite
+)
+
+$ErrorActionPreference = "Stop"
+
+$ShortBitName = "j6bin.bit"
+$ShortTdName = "td.json"
+
+function Get-Sha256([string]$Path) {
+    if (-not (Test-Path -LiteralPath $Path -PathType Leaf)) {
+        throw "File not found: $Path"
+    }
+    return (Get-FileHash -LiteralPath $Path -Algorithm SHA256).Hash.ToLowerInvariant()
+}
+
+function Test-Sha256String([object]$Value) {
+    if ($null -eq $Value) { return $false }
+    return ([string]$Value) -match '^[0-9a-fA-F]{64}$'
+}
+
+function Get-AsciiSha256([string]$Text) {
+    $bytes = [System.Text.Encoding]::ASCII.GetBytes($Text)
+    $sha = [System.Security.Cryptography.SHA256]::Create()
+    try {
+        return (($sha.ComputeHash($bytes) | ForEach-Object { $_.ToString("x2") }) -join "")
+    } finally {
+        $sha.Dispose()
+    }
+}
+
+function Read-JsonFile([string]$Path, [string]$Label) {
+    try {
+        return Get-Content -LiteralPath $Path -Raw -Encoding UTF8 | ConvertFrom-Json
+    } catch {
+        throw "$Label is not valid JSON: $Path"
+    }
+}
+
+function Assert-ProductionTdReceipt([string]$ReceiptPath, [string]$BitstreamPath, [string]$SelectedProfile) {
+    $receipt = Read-JsonFile $ReceiptPath "TD receipt"
+    $expectedTop = "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921"
+    $expectedModule = "${expectedTop}_top"
+    if ($receipt.status -ne "pass") { throw "TD receipt status must be pass for production package" }
+    if ($receipt.top -ne $expectedTop) { throw "TD receipt top mismatch for production package" }
+    if ($receipt.top_module -ne $expectedModule) { throw "TD receipt top_module mismatch for production package" }
+    if ($receipt.pin_profile -ne $SelectedProfile) { throw "TD receipt pin_profile mismatch for production package" }
+    if ($receipt.mode -ne "implementation") { throw "TD receipt mode must be implementation for production package" }
+    if ($receipt.timing_gate.status -ne "pass") { throw "TD receipt timing_gate.status must be pass for production package" }
+    $receiptBitSha = [string]$receipt.bitstream.sha256
+    if (-not (Test-Sha256String $receiptBitSha)) { throw "TD receipt bitstream.sha256 missing or invalid for production package" }
+    $actualBitSha = Get-Sha256 $BitstreamPath
+    if ($receiptBitSha.ToLowerInvariant() -ne $actualBitSha) {
+        throw "TD receipt bitstream.sha256 does not match provided bitstream"
+    }
+    return $receipt
+}
+
+function Assert-ProductionBmcPayload([string]$PayloadPath) {
+    $payload = Read-JsonFile $PayloadPath "BMC replay payload"
+    if ($payload.status -ne "pass") { throw "BMC replay payload status must be pass" }
+    if ($payload.source -ne "real_bmc_capture") { throw "BMC replay payload source must be real_bmc_capture" }
+    if ($payload.bmc_source -ne "pc_replay_from_real_bmc_capture") { throw "BMC replay payload bmc_source mismatch" }
+    if ([int]$payload.byte_count -ne 48) { throw "BMC replay payload byte_count must be 48" }
+    if ([int]$payload.valid_count -ne 2 -or [int]$payload.missing_count -ne 22) {
+        throw "BMC replay payload for this production package must be the historical 2-valid/22-missing sample"
+    }
+    $replySha = [string]$payload.reply_sha256
+    if (-not (Test-Sha256String $replySha)) { throw "BMC replay payload reply_sha256 missing or invalid" }
+    $expectedHistoricalSha = "06c173f91f8b6b0e56f9c381b49d5b127d2dbf3a09402843838a0ff2b812f1af"
+    if ($replySha.ToLowerInvariant() -ne $expectedHistoricalSha) {
+        throw "BMC replay payload reply_sha256 must match the locked historical production sample"
+    }
+    $replyText = [string]$payload.reply_text
+    if ([string]::IsNullOrWhiteSpace($replyText)) { throw "BMC replay payload reply_text missing" }
+    $actualReplySha = Get-AsciiSha256 $replyText
+    if ($actualReplySha -ne $replySha.ToLowerInvariant()) {
+        throw "BMC replay payload reply_sha256 does not match reply_text"
+    }
+    if (-not (Test-Sha256String $payload.capture_text_sha256)) {
+        throw "BMC replay payload capture_text_sha256 missing or invalid"
+    }
+    return $payload
+}
+
+function New-InventoryItem([string]$Path, [string]$Root) {
+    $full = (Resolve-Path -LiteralPath $Path).Path
+    $base = (Resolve-Path -LiteralPath $Root).Path.TrimEnd('\')
+    $relative = $full.Substring($base.Length).TrimStart('\').Replace('\', '/')
+    return [ordered]@{
+        path = $relative
+        sha256 = Get-Sha256 $full
+        bytes = (Get-Item -LiteralPath $full).Length
+    }
+}
+
+function Copy-IntoPackage([string]$Source, [string]$DestinationDir, [string]$DestinationName = "") {
+    if (-not (Test-Path -LiteralPath $Source -PathType Leaf)) {
+        throw "File not found: $Source"
+    }
+    New-Item -ItemType Directory -Force -Path $DestinationDir | Out-Null
+    $name = if ([string]::IsNullOrWhiteSpace($DestinationName)) { Split-Path -Leaf $Source } else { $DestinationName }
+    $destination = Join-Path $DestinationDir $name
+    Copy-Item -LiteralPath $Source -Destination $destination -Force
+    return $destination
+}
+
+function Remove-PythonCache([string]$Root) {
+    if (-not (Test-Path -LiteralPath $Root -PathType Container)) { return }
+    Get-ChildItem -LiteralPath $Root -Recurse -Force -Directory -Filter "__pycache__" | ForEach-Object {
+        Remove-Item -LiteralPath $_.FullName -Recurse -Force
+    }
+    Get-ChildItem -LiteralPath $Root -Recurse -Force -File |
+        Where-Object { $_.Extension -in @(".pyc", ".pyo") } |
+        ForEach-Object { Remove-Item -LiteralPath $_.FullName -Force }
+}
+
+function New-Binary921PinMap([string]$SelectedProfile) {
+    $reservedFutureUart = [ordered]@{
+        UART1_TX = [ordered]@{ fpga_ball = "L10"; bank_io_net = "BANK2_GPIO52"; used = ($SelectedProfile -in @("formal-uart1-bmc-replay-binary921", "production-two-uart-bmc-replay-binary921")) }
+        UART1_RX = [ordered]@{ fpga_ball = "M9"; bank_io_net = "BANK2_GPIO53"; used = ($SelectedProfile -in @("formal-uart1-bmc-replay-binary921", "production-two-uart-bmc-replay-binary921")) }
+        UART2_TX = [ordered]@{ fpga_ball = "M10"; bank_io_net = "BANK2_GPIO54"; used = ($SelectedProfile -in @("formal-uart1-bmc-replay-binary921", "production-two-uart-bmc-replay-binary921")) }
+        UART2_RX = [ordered]@{ fpga_ball = "N11"; bank_io_net = "BANK2_GPIO55"; used = ($SelectedProfile -in @("formal-uart1-bmc-replay-binary921", "production-two-uart-bmc-replay-binary921")) }
+    }
+    if ($SelectedProfile -eq "debug-photo-bmc-replay-binary921") {
+        return [ordered]@{
+            name = $SelectedProfile
+            transport = "separate_host_debug_uart"
+            bmc_source = "pc_replay_from_real_bmc_capture"
+            live_bmc_link_status = "not_used"
+            hardware_access_status = "photo_visible_header"
+            uart_assignments = [ordered]@{
+                bmc_replay_uart_tx = [ordered]@{ fpga_ball = "T4"; role = "pc_replay_bmc_tx" }
+                bmc_replay_uart_rx = [ordered]@{ fpga_ball = "R5"; role = "pc_replay_bmc_rx" }
+                host_uart_tx = [ordered]@{ fpga_ball = "P7"; role = "binary921_host_tx" }
+                host_uart_rx = [ordered]@{ fpga_ball = "P8"; role = "binary921_host_rx" }
+                debug_uart_rx = [ordered]@{ fpga_ball = "P10"; role = "binary921_debug_rx" }
+                debug_uart_tx = [ordered]@{ fpga_ball = "R10"; role = "binary921_debug_tx" }
+            }
+            ptc_substitutions = [ordered]@{
+                PTC03 = [ordered]@{ original_ball = "T4"; substitute_ball = "P5"; bank_io_net = "BANK2_GPIO40"; reason = "photo_visible_uart_overlap_remap" }
+                PTC04 = [ordered]@{ original_ball = "R5"; substitute_ball = "T8"; bank_io_net = "BANK2_GPIO41"; reason = "photo_visible_uart_overlap_remap" }
+                PTC17 = [ordered]@{ original_ball = "P8"; substitute_ball = "M14"; bank_io_net = "BANK2_GPIO42"; reason = "photo_visible_uart_overlap_remap" }
+                PTC18 = [ordered]@{ original_ball = "P7"; substitute_ball = "M15"; bank_io_net = "BANK2_GPIO43"; reason = "photo_visible_uart_overlap_remap" }
+                PTC21 = [ordered]@{ original_ball = "P10"; substitute_ball = "P15"; bank_io_net = "BANK2_GPIO44"; reason = "photo_visible_uart_overlap_remap" }
+                PTC22 = [ordered]@{ original_ball = "R10"; substitute_ball = "N14"; bank_io_net = "BANK2_GPIO45"; reason = "photo_visible_uart_overlap_remap" }
+            }
+            reserved_future_uart = $reservedFutureUart
+        }
+    }
+    if ($SelectedProfile -eq "production-two-uart-bmc-replay-binary921") {
+        return [ordered]@{
+            name = $SelectedProfile
+            transport = "combined_host_debug_uart"
+            bmc_source = "pc_replay_from_real_bmc_capture"
+            live_bmc_link_status = "not_used"
+            hardware_access_status = "production_uart1_uart2_access_confirmed_by_user"
+            uart_assignments = [ordered]@{
+                bmc_replay_uart_tx = [ordered]@{ fpga_ball = "L10"; role = "pc_replay_bmc_tx"; baud = 115200 }
+                bmc_replay_uart_rx = [ordered]@{ fpga_ball = "M9"; role = "pc_replay_bmc_rx"; baud = 115200 }
+                combined_debug_host_uart_tx = [ordered]@{ fpga_ball = "M10"; role = "binary921_combined_tx"; baud = 921600 }
+                combined_debug_host_uart_rx = [ordered]@{ fpga_ball = "N11"; role = "binary921_combined_rx"; baud = 921600 }
+            }
+            ptc_substitutions = [ordered]@{}
+            reserved_future_uart = $reservedFutureUart
+            jtag = [ordered]@{
+                connector = "J3 CON/2x5P/2.54"
+                pinout = @("1=TCK", "2=GND", "3=TDO", "4=VREF", "5=TMS", "6=NC", "7=NC", "8=NC", "9=TDI", "10=GND")
+                speed_hz = 200000
+                program_mode = "PROGRAM_SRAM"
+                power_cycle_required = $false
+            }
+        }
+    }
+    return [ordered]@{
+        name = $SelectedProfile
+        transport = "separate_host_debug_uart"
+        bmc_source = "pc_replay_from_real_bmc_capture"
+        live_bmc_link_status = "not_used"
+        hardware_access_status = "blocked_waiting_for_uart1_uart2_access"
+        uart_assignments = [ordered]@{
+            bmc_replay_uart_tx = [ordered]@{ fpga_ball = "L10"; role = "pc_replay_bmc_tx" }
+            bmc_replay_uart_rx = [ordered]@{ fpga_ball = "M9"; role = "pc_replay_bmc_rx" }
+            host_uart_tx = [ordered]@{ fpga_ball = "M10"; role = "binary921_host_tx" }
+            host_uart_rx = [ordered]@{ fpga_ball = "N11"; role = "binary921_host_rx" }
+            debug_uart_rx = [ordered]@{ fpga_ball = "M14"; role = "binary921_debug_rx" }
+            debug_uart_tx = [ordered]@{ fpga_ball = "M15"; role = "binary921_debug_tx" }
+        }
+        ptc_substitutions = [ordered]@{}
+        reserved_future_uart = $reservedFutureUart
+    }
+}
+
+function New-StartHere([string]$SelectedProfile) {
+    $pinMap = New-Binary921PinMap $SelectedProfile
+    if ($SelectedProfile -eq "production-two-uart-bmc-replay-binary921") {
+        return @"
+# 生产温控板两串口 Binary921 包
+
+Profile: $SelectedProfile
+
+## 现场顺序
+
+1. 生产温控板先正常供电;本流程不要求重新上电,也不要求断电重插。
+2. AL-Link 排线接生产板 `J3 CON/2x5P/2.54`,TD/BitWriter speed 设 `200k`。
+3. 先启动 BMC replay。
+4. 再启动 combined collector。
+5. 看到 collector 等待 binary921 READY 后,手动执行 `PROGRAM_SRAM`,选择包根目录短 bitstream:
+
+~~~text
+.\j6bin.bit
+~~~
+
+不要执行 flash/erase/spi flash。这个包只用于 SRAM;如果 BitWriter 识别不到器件,优先检查生产板是否已经外部供电,而不是先反复重启。
+
+## JTAG J3 接线
+
+- 1=TCK
+- 2=GND
+- 3=TDO
+- 4=VREF
+- 5=TMS
+- 6=NC
+- 7=NC
+- 8=NC
+- 9=TDI
+- 10=GND
+
+`VREF` 不是给板子供电,只是 AL-Link 读取目标板 IO 电平参考。生产板必须另行正常供电;之前识别失败优先检查板子是否有电、排线方向、AL-Link 是否被 TD/BitWriter 独占、speed 是否为 200k。
+
+## 两个串口
+
+- BMC replay UART1: TX=L10, RX=M9, 115200 8N1,接 PC replay,不接 live BMC。
+- Combined Debug+Host UART2: TX=M10, RX=N11, 921600 8N1,同一个 COM 口双向使用。
+
+## 启动 BMC replay
+
+~~~powershell
+powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\replay-bmc.ps1 -BmcReplayPort COM9 -Payload .\bmc-replay-payload.json -Iterations 3 -TimeoutSeconds 600
+~~~
+
+该 payload 来自历史真实 BMC 样本:2 valid / 22 missing,DIMM1=30.75C,DIMM13=32.25C,reply SHA256 固化在 `manifest.json`。
+
+## 启动 collector
+
+~~~powershell
+powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\collect-binary921.ps1 -CombinedPort COM7 -Profile $SelectedProfile -OutputDir .\evidence-binary921 -DurationSeconds 180 -Bitstream .\j6bin.bit -TdReceipt .\td.json -BmcReplayReceipt .\bmc-replay-session.json
+~~~
+
+collector 只打开显式 `-CombinedPort`,不枚举未知 COM,不安装 Python/pip/driver。Combined 口会写 Host binary command,也会从同一流读取 READY/ACK/debug frames。
+
+## 边界
+
+- protocol=binary921。
+- transport=combined_host_debug_uart。
+- bmc_source=pc_replay_from_real_bmc_capture。
+- live_bmc_link_status=not_used。
+- real_fan_ptc_hardware_status=not_run,直到风扇/PTC 真实负载接线、极性和示波器/证据验证完成。
+- 不声明 flash、真实热性能、真实 PID 闭环或真实 PTC/FAN 负载通过。
+"@
+    }
+    $substitutionText = if ($SelectedProfile -eq "debug-photo-bmc-replay-binary921") {
+        "PTC03/PTC04/PTC17/PTC18/PTC21/PTC22 use substitute spare GPIO in this debug-photo package. It does not claim full real HEAT pinout pass."
+    } else {
+        "HEAT/PTC/FAN/FG/INSTALL stay on real PDF/inventory pins. UART1/2 access and M14/M15 debug wiring still need board-level access verification."
+    }
+    return @"
+# J6 BMC-Replay Binary921 Package
+
+Profile: $SelectedProfile
+
+## Order
+
+1. Start the BMC replay window first.
+2. Start the binary921 collector.
+3. When the collector is waiting for READY, manually run PROGRAM_SRAM and select the root short bitstream:
+
+~~~text
+.\j6bin.bit
+~~~
+
+Before PROGRAM_SRAM, confirm board power is connected and set BitWriter/TD GUI JTAG speed 200k. A power-cycle is not required for this package; if the JTAG device is not detected, check board power first, then cable/AL-Link and speed.
+
+collector first, then PROGRAM_SRAM. Do not select a deep `bitstreams\...` path for BitWriter unless you are only auditing hashes.
+
+## BMC replay
+
+Use a second PowerShell window:
+
+~~~powershell
+powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\replay-bmc.ps1 -BmcReplayPort COM9 -Payload .\bmc-replay-payload.example.json
+~~~
+
+This writes `.\bmc-replay-session.json`. Strict evidence should replace the example payload with a real BMC capture normalized by `tools\bmc_replay_uart.py`. This package does not install Python, pip, drivers, or enumerate unknown COM ports.
+
+## Collector
+
+Use a third PowerShell window:
+
+~~~powershell
+powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\collect-binary921.ps1 -HostPort COM8 -DebugPort COM7 -Profile $SelectedProfile -OutputDir .\evidence-binary921 -DurationSeconds 180 -Bitstream .\j6bin.bit -TdReceipt .\td.json -BmcReplayReceipt .\bmc-replay-session.json
+~~~
+
+The collector writes binary HostPort commands and reads DebugPort binary921 frames. DebugPort is read-only.
+
+## Pins
+
+- BMC replay UART TX=$($pinMap.uart_assignments.bmc_replay_uart_tx.fpga_ball), RX=$($pinMap.uart_assignments.bmc_replay_uart_rx.fpga_ball), 115200 8N1.
+- HostPort TX=$($pinMap.uart_assignments.host_uart_tx.fpga_ball), RX=$($pinMap.uart_assignments.host_uart_rx.fpga_ball), COM8, 115200 8N1.
+- DebugPort RX=$($pinMap.uart_assignments.debug_uart_rx.fpga_ball), TX=$($pinMap.uart_assignments.debug_uart_tx.fpga_ball), COM7, 921600 8N1.
+- $substitutionText
+
+## Boundary
+
+- protocol=binary921.
+- bmc_source=pc_replay_from_real_bmc_capture.
+- live_bmc_link_status=not_used.
+- real_fan_ptc_hardware_status=not_run until real loads are wired and measured.
+- No flash, no driver install, no unknown COM enumeration, no DebugPort writes, no thermal performance claim, no PID closed-loop pass claim.
+"@
+}
+
+$repoRoot = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
+$out = (Resolve-Path -LiteralPath (New-Item -ItemType Directory -Force -Path $OutputDir)).Path
+if ([string]::IsNullOrWhiteSpace($PackageName)) {
+    $stamp = Get-Date -Format "yyyyMMdd-HHmmss"
+    $PackageName = if ($Profile -eq "debug-photo-bmc-replay-binary921") {
+        "j6bin-debug-photo-$stamp"
+    } elseif ($Profile -eq "production-two-uart-bmc-replay-binary921") {
+        "j6prod-2uart-bmc-replay-$stamp"
+    } else {
+        "j6bin-formal-uart1-$stamp"
+    }
+}
+
+if ($Profile -eq "production-two-uart-bmc-replay-binary921") {
+    Assert-ProductionTdReceipt $TdReceipt $Bitstream $Profile | Out-Null
+    if ([string]::IsNullOrWhiteSpace($BmcReplayPayload)) {
+        throw "BmcReplayPayload is required for production-two-uart-bmc-replay-binary921"
+    }
+    Assert-ProductionBmcPayload $BmcReplayPayload | Out-Null
+}
+
+$stage = Join-Path $out $PackageName
+if (Test-Path -LiteralPath $stage) {
+    if (-not $ForceOverwrite) {
+        throw "Package staging directory already exists: $stage"
+    }
+    Remove-Item -LiteralPath $stage -Recurse -Force
+}
+foreach ($dir in @("bitstreams", "td-receipts", "tools", "commands", "config")) {
+    New-Item -ItemType Directory -Force -Path (Join-Path $stage $dir) | Out-Null
+}
+
+Copy-IntoPackage $Bitstream $stage $ShortBitName | Out-Null
+Copy-IntoPackage $Bitstream (Join-Path $stage "bitstreams") | Out-Null
+Copy-IntoPackage $TdReceipt $stage $ShortTdName | Out-Null
+Copy-IntoPackage $TdReceipt (Join-Path $stage "td-receipts") | Out-Null
+Copy-IntoPackage (Join-Path $repoRoot "tools\remote\collect_j6_binary921.py") (Join-Path $stage "tools") | Out-Null
+Copy-IntoPackage (Join-Path $repoRoot "tools\binary921.py") (Join-Path $stage "tools") | Out-Null
+Copy-IntoPackage (Join-Path $repoRoot "tools\bmc_replay_uart.py") (Join-Path $stage "tools") | Out-Null
+Copy-IntoPackage (Join-Path $repoRoot "config\pin_inventory.fcb_fpga_mcu0611.json") (Join-Path $stage "config") | Out-Null
+
+$bmcReplayPayloadInfo = $null
+if ($Profile -eq "production-two-uart-bmc-replay-binary921") {
+    $payloadTarget = Copy-IntoPackage $BmcReplayPayload $stage "bmc-replay-payload.json"
+    $payloadJson = Assert-ProductionBmcPayload $payloadTarget
+    $bmcReplayPayloadInfo = [ordered]@{
+        path = "bmc-replay-payload.json"
+        sha256 = Get-Sha256 $payloadTarget
+        reply_sha256 = [string]$payloadJson.reply_sha256
+        capture_text_sha256 = [string]$payloadJson.capture_text_sha256
+        byte_count = [int]$payloadJson.byte_count
+        valid_count = [int]$payloadJson.valid_count
+        missing_count = [int]$payloadJson.missing_count
+        source = [string]$payloadJson.source
+    }
+}
+
+$collectorWrapper = @'
+param(
+    [string]$HostPort = "COM8",
+    [string]$DebugPort = "COM7",
+    [string]$CombinedPort = "",
+    [ValidateSet("debug-photo-bmc-replay-binary921", "formal-uart1-bmc-replay-binary921", "production-two-uart-bmc-replay-binary921")]
+    [string]$Profile = "__PROFILE__",
+    [string]$OutputDir = ".\evidence-binary921",
+    [int]$DurationSeconds = 180,
+    [string]$Bitstream = ".\j6bin.bit",
+    [string]$TdReceipt = ".\td.json",
+    [string]$BmcReplayReceipt = ".\bmc-replay-session.json",
+    [switch]$SelfTest
+)
+$ErrorActionPreference = "Stop"
+$root = $PSScriptRoot
+$python = "python"
+$collector = Join-Path $root "tools\collect_j6_binary921.py"
+$env:PYTHONDONTWRITEBYTECODE = "1"
+if ($SelfTest) {
+    & $python $collector --selftest
+} else {
+    if ($Profile -eq "production-two-uart-bmc-replay-binary921") {
+        if ([string]::IsNullOrWhiteSpace($CombinedPort)) { throw "CombinedPort is required for production-two-uart-bmc-replay-binary921" }
+        & $python $collector --transport combined-single-com --combined-port $CombinedPort --profile $Profile --output-dir $OutputDir --duration-sec $DurationSeconds --bitstream $Bitstream --td-receipt $TdReceipt --bmc-replay-receipt $BmcReplayReceipt --json
+    } else {
+        & $python $collector --transport two-uart --host-port $HostPort --debug-port $DebugPort --profile $Profile --output-dir $OutputDir --duration-sec $DurationSeconds --bitstream $Bitstream --td-receipt $TdReceipt --bmc-replay-receipt $BmcReplayReceipt --json
+    }
+}
+if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+'@
+$collectorWrapper = $collectorWrapper.Replace("__PROFILE__", $Profile)
+Set-Content -LiteralPath (Join-Path $stage "collect-binary921.ps1") -Encoding UTF8 -Value $collectorWrapper
+if ($Profile -eq "production-two-uart-bmc-replay-binary921") {
+    Set-Content -LiteralPath (Join-Path $stage "commands\collect-binary921-template.ps1") -Encoding UTF8 -Value ('powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\collect-binary921.ps1 -CombinedPort COM7 -Profile {0} -OutputDir .\evidence-binary921 -DurationSeconds 180 -Bitstream .\j6bin.bit -TdReceipt .\td.json -BmcReplayReceipt .\bmc-replay-session.json' -f $Profile)
+} else {
+    Set-Content -LiteralPath (Join-Path $stage "commands\collect-binary921-template.ps1") -Encoding UTF8 -Value ('powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\collect-binary921.ps1 -HostPort COM8 -DebugPort COM7 -Profile {0} -OutputDir .\evidence-binary921 -DurationSeconds 180 -Bitstream .\j6bin.bit -TdReceipt .\td.json -BmcReplayReceipt .\bmc-replay-session.json' -f $Profile)
+}
+
+$replayWrapper = @'
+param(
+    [ValidatePattern('^COM[0-9]+$')]
+    [string]$BmcReplayPort = "COM9",
+    [string]$Payload = "__BMC_PAYLOAD_DEFAULT__",
+    [int]$Iterations = 3,
+    [int]$TimeoutSeconds = 600,
+    [switch]$SelfTest
+)
+$ErrorActionPreference = "Stop"
+$root = $PSScriptRoot
+$helper = Join-Path $root "tools\bmc_replay_uart.py"
+$env:PYTHONDONTWRITEBYTECODE = "1"
+if ($SelfTest) {
+    & python $helper selftest
+} else {
+    & python $helper replay --port $BmcReplayPort --payload $Payload --iterations $Iterations --timeout-sec $TimeoutSeconds --json | Tee-Object -FilePath (Join-Path $root "bmc-replay-session.json")
+}
+if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+'@
+$replayWrapper = $replayWrapper.Replace("__BMC_PAYLOAD_DEFAULT__", ($(if ($Profile -eq "production-two-uart-bmc-replay-binary921") { ".\bmc-replay-payload.json" } else { ".\bmc-replay-payload.example.json" })))
+Set-Content -LiteralPath (Join-Path $stage "replay-bmc.ps1") -Encoding UTF8 -Value $replayWrapper
+
+$examplePayload = [ordered]@{
+    schema = "j6-bmc-replay-payload-v1"
+    status = "debug_example_only"
+    source = "synthetic_example"
+    bmc_source = "pc_replay_from_real_bmc_capture"
+    live_bmc_link_status = "not_used"
+    replay_mode = "poll_response"
+    poll_text = "ipmitool raw 0x36 0x6c 0xdf 0xdd 0x00 0x03"
+    poll_command_text = "ipmitool raw 0x36 0x6c 0xdf 0xdd 0x00 0x03`n"
+    reply_text = "28 00 29 00 2a 00 2b 00 2c 00 2d 00 2e 00 2f 00 30 00 31 00 32 00 33 00 34 00 35 00 36 00 37 00 38 00 39 00 3a 00 3b 00 3c 00 3d 00 3e 00 3f 00`r`n"
+    byte_count = 48
+    valid_count = 24
+    missing_count = 0
+    authority_boundary = "Synthetic example payload for temporary BMC replay wiring debug only. It is not real BMC evidence."
+}
+$examplePayload | ConvertTo-Json -Depth 16 | Set-Content -LiteralPath (Join-Path $stage "bmc-replay-payload.example.json") -Encoding UTF8
+Set-Content -LiteralPath (Join-Path $stage "START-HERE.zh-CN.md") -Encoding UTF8 -Value (New-StartHere $Profile)
+
+$pinMap = New-Binary921PinMap $Profile
+$packageStatus = if ($Profile -eq "formal-uart1-bmc-replay-binary921") {
+    "blocked_waiting_for_uart1_uart2_access"
+} else {
+    "pass"
+}
+$transport = if ($Profile -eq "production-two-uart-bmc-replay-binary921") { "combined_host_debug_uart" } else { "separate_host_debug_uart" }
+$manifest = [ordered]@{
+    schema = "j6-bmc-replay-binary921-package-manifest-v1"
+    status = $packageStatus
+    generated_at = (Get-Date).ToUniversalTime().ToString("o")
+    package_name = $PackageName
+    protocol = "binary921"
+    pin_profile = $Profile
+    transport = $transport
+    combined_uart_baud = $(if ($transport -eq "combined_host_debug_uart") { 921600 } else { $null })
+    bmc_replay_uart_baud = 115200
+    programming_mode = "PROGRAM_SRAM"
+    jtag_programming = [ordered]@{
+        program_mode = "PROGRAM_SRAM"
+        jtag_speed_hz = 200000
+        board_power_present_before_program = $true
+        power_cycle_required = $false
+        connector = "J3 CON/2x5P/2.54"
+        pinout = @("1=TCK", "2=GND", "3=TDO", "4=VREF", "5=TMS", "6=NC", "7=NC", "8=NC", "9=TDI", "10=GND")
+        tooling = "manual BitWriter/TD GUI"
+        cli_programming_supported = $false
+        cli_speed_mapping_proven = $false
+    }
+    bitstream = [ordered]@{ path = $ShortBitName; sha256 = Get-Sha256 (Join-Path $stage $ShortBitName) }
+    td_receipt = [ordered]@{ path = $ShortTdName; sha256 = Get-Sha256 (Join-Path $stage $ShortTdName) }
+    bmc_source = "pc_replay_from_real_bmc_capture"
+    live_bmc_link_status = "not_used"
+    bmc_replay_payload = $bmcReplayPayloadInfo
+    pin_map = $pinMap
+    real_fan_ptc_hardware_status = "not_run"
+    hardware_access_status = $pinMap.hardware_access_status
+    collector = [ordered]@{
+        wrapper = "collect-binary921.ps1"
+        python = "tools/collect_j6_binary921.py"
+        transport = $transport
+        host_port = $(if ($transport -eq "combined_host_debug_uart") { $null } else { "COM8" })
+        debug_port = $(if ($transport -eq "combined_host_debug_uart") { $null } else { "COM7" })
+        combined_port = $(if ($transport -eq "combined_host_debug_uart") { "COM7" } else { $null })
+        debug_port_write_policy = $(if ($transport -eq "combined_host_debug_uart") { "combined_port_writes_host_commands_only" } else { "read_only" })
+        bmc_replay_receipt = "bmc-replay-session.json"
+        expected_artifact = "binary921-evidence-manifest.json"
+    }
+    host_control_commands = @("SET_PTC 1 10", "SET_PTC 24 20", "SET_FAN 1 40", "SET_FAN 4 30", "SET_PID_REQUESTED 1", "GET_STATUS", "GET_MAP", "GET_SENSOR", "GET_SENSOR", "GET_SENSOR", "SET_PID_REQUESTED 0", "DISABLE")
+    safety = [ordered]@{
+        flash_attempted = $false
+        driver_install_attempted = $false
+        programs_nonvolatile = $false
+        enumerates_com_ports = $false
+        debug_port_writes_to_serial = $false
+        toggles_dtr_rts = $false
+    }
+    authority_boundary = "SRAM-only binary921 diagnostic package. It does not claim live BMC, thermal performance, PID closed-loop, or real PTC/FAN load pass."
+}
+$manifest | ConvertTo-Json -Depth 64 | Set-Content -LiteralPath (Join-Path $stage "manifest.json") -Encoding UTF8
+
+Remove-PythonCache $stage
+
+$inventory = New-Object System.Collections.Generic.List[object]
+Get-ChildItem -LiteralPath $stage -Recurse -File | Sort-Object FullName | ForEach-Object {
+    if ($_.Name -eq "sha256-inventory.json") { return }
+    $inventory.Add((New-InventoryItem $_.FullName $stage)) | Out-Null
+}
+[ordered]@{
+    schema = "j6-bmc-replay-binary921-package-sha256-inventory-v1"
+    generated_at = (Get-Date).ToUniversalTime().ToString("o")
+    self_hash_policy = "excluded_self_referential_file"
+    inventory = $inventory
+} | ConvertTo-Json -Depth 32 | Set-Content -LiteralPath (Join-Path $stage "sha256-inventory.json") -Encoding UTF8
+
+$zipPath = Join-Path $out ($PackageName + ".zip")
+if (Test-Path -LiteralPath $zipPath) {
+    if (-not $ForceOverwrite) { throw "Package zip already exists: $zipPath" }
+    Remove-Item -LiteralPath $zipPath -Force
+}
+$zipSidecar = $zipPath + ".sha256.txt"
+if (Test-Path -LiteralPath $zipSidecar) {
+    if (-not $ForceOverwrite) { throw "Package zip sidecar already exists: $zipSidecar" }
+    Remove-Item -LiteralPath $zipSidecar -Force
+}
+Compress-Archive -Path (Join-Path $stage "*") -DestinationPath $zipPath -Force
+$zipSha = Get-Sha256 $zipPath
+Set-Content -LiteralPath $zipSidecar -Encoding ASCII -Value ("{0}  {1}" -f $zipSha, (Split-Path -Leaf $zipPath))
+
+Write-Host "Wrote $stage"
+Write-Host "Wrote $zipPath"
+Write-Host ("SHA256 {0} {1}" -f $zipSha, $zipPath)

+ 111 - 0
tools/pid_harness.py

@@ -191,6 +191,89 @@ TD_TOP_PROFILES = {
         "requires_verified_real_fan_ptc_pin_map": True,
         "authority_boundary": "SRAM-only formal-uart1-bmc-replay diagnostic evidence. BMC replay uses reserved UART1 pins and host control uses reserved UART2 pins, with debug UART on SPARE_GPIO44/45 as TX=N14/RX=P15. It does not claim a live BMC link, UART1/2 hardware access, real thermal performance, production PTC/FAN qualification, flash, or PID closed-loop pass.",
     },
+    "uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921": {
+        "mode": "implementation",
+        "display_name": "J6 host sensor real FAN/PTC debug-photo binary921 diagnostic with PC replay from a real BMC capture",
+        "top_module": "uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top",
+        "source_prj": "td/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.prj",
+        "build_subdir": "uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921",
+        "syn_script": "uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.tcl",
+        "phy_script": "uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.tcl",
+        "bitstream": "uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921.bit",
+        "area_report": "uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_phy.area",
+        "timing_report": "uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_pr.timing",
+        "pin_profile": "debug-photo-bmc-replay-binary921",
+        "protocol": "binary921",
+        "bmc_source": "pc_replay_from_real_bmc_capture",
+        "tx_ball": "T4",
+        "rx_ball": "R5",
+        "host_uart_tx_ball": "P7",
+        "host_uart_rx_ball": "P8",
+        "debug_uart_rx_ball": "P10",
+        "debug_uart_tx_ball": "R10",
+        "host_uart_baud": 115200,
+        "bmc_uart_baud": 115200,
+        "debug_uart_baud": 921600,
+        "debug_uart_clks_per_bit": 27,
+        "live_bmc_link_status": "not_used",
+        "requires_verified_real_fan_ptc_pin_map": True,
+        "authority_boundary": "SRAM-only debug-photo-bmc-replay-binary921 diagnostic evidence. Photo-visible UART wiring is retained, six overlapping HEAT outputs are substituted, and Host/Debug evidence uses binary921 machine frames instead of CPLD ASCII log builders. It does not claim a live BMC link, full real HEAT pinout, real thermal performance, production PTC/FAN qualification, flash, or PID closed-loop pass.",
+    },
+    "uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921": {
+        "mode": "implementation",
+        "display_name": "J6 host sensor real FAN/PTC formal UART1/2 binary921 diagnostic with PC replay from a real BMC capture",
+        "top_module": "uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_top",
+        "source_prj": "td/uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.prj",
+        "build_subdir": "uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921",
+        "syn_script": "uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.tcl",
+        "phy_script": "uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.tcl",
+        "bitstream": "uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921.bit",
+        "area_report": "uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_phy.area",
+        "timing_report": "uart_rs232_j6_host_sensor_real_fan_ptc_formal_uart1_bmc_replay_binary921_pr.timing",
+        "pin_profile": "formal-uart1-bmc-replay-binary921",
+        "protocol": "binary921",
+        "bmc_source": "pc_replay_from_real_bmc_capture",
+        "tx_ball": "L10",
+        "rx_ball": "M9",
+        "host_uart_tx_ball": "M10",
+        "host_uart_rx_ball": "N11",
+        "debug_uart_rx_ball": "M14",
+        "debug_uart_tx_ball": "M15",
+        "host_uart_baud": 115200,
+        "bmc_uart_baud": 115200,
+        "debug_uart_baud": 921600,
+        "debug_uart_clks_per_bit": 27,
+        "live_bmc_link_status": "not_used",
+        "requires_verified_real_fan_ptc_pin_map": True,
+        "authority_boundary": "SRAM-only formal-uart1-bmc-replay-binary921 diagnostic evidence. BMC replay uses UART1 pins, host control uses UART2 pins, DebugPort uses M14/M15 spare GPIO, and real HEAT/FAN/FG/INSTALL pinout is retained. It does not claim a live BMC link, UART1/2 hardware access, real thermal performance, production PTC/FAN qualification, flash, or PID closed-loop pass until TD and board evidence pass.",
+    },
+    "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921": {
+        "mode": "implementation",
+        "display_name": "Production temperature board two-UART binary921 diagnostic with PC replay from a real BMC capture",
+        "top_module": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top",
+        "source_prj": "td/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.prj",
+        "build_subdir": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921",
+        "syn_script": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.tcl",
+        "phy_script": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.tcl",
+        "bitstream": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921.bit",
+        "area_report": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_phy.area",
+        "timing_report": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_pr.timing",
+        "pin_profile": "production-two-uart-bmc-replay-binary921",
+        "protocol": "binary921",
+        "transport": "combined_host_debug_uart",
+        "bmc_source": "pc_replay_from_real_bmc_capture",
+        "tx_ball": "L10",
+        "rx_ball": "M9",
+        "host_uart_tx_ball": "M10",
+        "host_uart_rx_ball": "N11",
+        "host_uart_baud": 921600,
+        "bmc_uart_baud": 115200,
+        "debug_uart_baud": 921600,
+        "debug_uart_clks_per_bit": 27,
+        "live_bmc_link_status": "not_used",
+        "requires_verified_real_fan_ptc_pin_map": True,
+        "authority_boundary": "SRAM-only production-two-uart-bmc-replay-binary921 evidence. BMC replay uses UART1 L10/M9, combined Host+Debug binary921 uses UART2 M10/N11 at 921600, and real HEAT/FAN/FG/INSTALL pinout is retained. JTAG uses J3 and PROGRAM_SRAM only. It does not claim live BMC, flash, real thermal performance, production PTC/FAN qualification, or PID closed-loop pass.",
+    },
 }
 TD_GENERATED_SUFFIXES = {
     ".area",
@@ -910,6 +993,34 @@ def hdl_testbenches() -> list[dict[str, Any]]:
                 "tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_debug921_top_tb.v",
             ],
         },
+        {
+            "name": "uart_rs232_j6_host_sensor_real_fan_ptc_binary921_top_tb",
+            "sources": [
+                "src/rtl/uart_tx_8n1.v",
+                "src/rtl/uart_rx_8n1.v",
+                "src/rtl/bmc_uart_raw48_poll_lite.v",
+                "src/rtl/binary921_crc16.v",
+                "src/rtl/binary921_frame_tx.v",
+                "src/rtl/binary921_host_rx.v",
+                "src/rtl/binary921_diag_core.v",
+                "src/top/uart_rs232_j6_host_sensor_real_fan_ptc_debug_photo_uart_bmc_replay_binary921_top.v",
+                "tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_binary921_top_tb.v",
+            ],
+        },
+        {
+            "name": "uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top_tb",
+            "sources": [
+                "src/rtl/uart_tx_8n1.v",
+                "src/rtl/uart_rx_8n1.v",
+                "src/rtl/bmc_uart_raw48_poll_lite.v",
+                "src/rtl/binary921_crc16.v",
+                "src/rtl/binary921_frame_tx.v",
+                "src/rtl/binary921_host_rx.v",
+                "src/rtl/binary921_diag_core.v",
+                "src/top/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top.v",
+                "tests/sim/uart_rs232_j6_host_sensor_real_fan_ptc_production_two_uart_bmc_replay_binary921_top_tb.v",
+            ],
+        },
         {"name": "bmc_uart_phy_bridge_tb", "sources": ["src/rtl/bmc_uart_phy_bridge.v", "tests/sim/bmc_uart_phy_bridge_tb.v"]},
         {"name": "bmc_uart_ascii_poll_tb", "sources": ["src/rtl/bmc_uart_ascii_poll.v", "tests/sim/bmc_uart_ascii_poll_tb.v"]},
         {"name": "bmc_dimm_frame_parser_tb", "sources": ["src/rtl/bmc_dimm_frame_parser.v", "tests/sim/bmc_dimm_frame_parser_tb.v"]},

+ 76 - 17
tools/pin_inventory.py

@@ -49,6 +49,22 @@ FORMAL_UART1_BMC_REPLAY_ASSIGNMENTS = {
     "debug_uart_tx": "N14",
 }
 
+FORMAL_UART1_BMC_REPLAY_BINARY921_ASSIGNMENTS = {
+    "bmc_uart_tx": "L10",
+    "bmc_uart_rx": "M9",
+    "host_uart_tx": "M10",
+    "host_uart_rx": "N11",
+    "debug_uart_rx": "M14",
+    "debug_uart_tx": "M15",
+}
+
+PRODUCTION_TWO_UART_BMC_REPLAY_BINARY921_ASSIGNMENTS = {
+    "bmc_uart_tx": "L10",
+    "bmc_uart_rx": "M9",
+    "host_uart_tx": "M10",
+    "host_uart_rx": "N11",
+}
+
 RESERVED_FUTURE_UART_SIGNALS = ["UART1_TX", "UART1_RX", "UART2_TX", "UART2_RX"]
 
 REQUIRED_IO_GROUPS = [
@@ -261,6 +277,9 @@ def diagnostic_profile_assignments(inventory: dict[str, Any], profile: str) -> d
         "formal-uart",
         "debug-photo-uart-bmc-replay",
         "formal-uart1-bmc-replay",
+        "debug-photo-bmc-replay-binary921",
+        "formal-uart1-bmc-replay-binary921",
+        "production-two-uart-bmc-replay-binary921",
     }
     if profile not in supported_profiles:
         return {
@@ -280,18 +299,18 @@ def diagnostic_profile_assignments(inventory: dict[str, Any], profile: str) -> d
     reserved_uart_use_policy = "reserved_unused"
     uart_aliases: dict[str, str] = {}
     allowed_reserved_balls: set[str] = set()
-    if profile in {"temp-uart-ptc-remap", "debug-photo-uart-bmc-replay"}:
+    if profile in {"temp-uart-ptc-remap", "debug-photo-uart-bmc-replay", "debug-photo-bmc-replay-binary921"}:
         uart_assignments = dict(LOCKED_DEBUG_UART_ASSIGNMENTS)
         for item in TEMP_UART_PTC_REMAP_SUBSTITUTIONS.values():
             assignments[item["signal"]] = item["substitute_ball"]
         substitution_reason = (
             "photo_visible_uart_overlap_remap"
-            if profile == "debug-photo-uart-bmc-replay"
+            if profile in {"debug-photo-uart-bmc-replay", "debug-photo-bmc-replay-binary921"}
             else "temporary_uart_overlap_remap"
         )
         ptc_substitutions = _ptc_substitution_rows(inventory, assignments, reason=substitution_reason)
         hardware_status = "not_run"
-        if profile == "debug-photo-uart-bmc-replay":
+        if profile in {"debug-photo-uart-bmc-replay", "debug-photo-bmc-replay-binary921"}:
             bmc_source = "pc_replay_from_real_bmc_capture"
             live_bmc_link_status = "not_used"
             hardware_access_status = "photo_visible_header"
@@ -299,12 +318,20 @@ def diagnostic_profile_assignments(inventory: dict[str, Any], profile: str) -> d
                 "bmc_replay_uart_tx": "bmc_uart_tx",
                 "bmc_replay_uart_rx": "bmc_uart_rx",
             }
-            boundary = (
-                "BMC-replay debug-photo profile: photo-visible/current J6/COM7/COM8 UART wiring is kept, "
-                "the CPLD BMC UART talks to a PC poll-response replay emulator instead of a live BMC, "
-                "and six overlapping HEAT/PTC channels are moved to verified spare GPIO. "
-                "It is debug-only and does not claim full real HEAT pinout pass."
-            )
+            if profile == "debug-photo-bmc-replay-binary921":
+                boundary = (
+                    "BMC-replay debug-photo binary921 profile: photo-visible/current J6/COM7/COM8 UART wiring is kept, "
+                    "the CPLD BMC UART talks to a PC poll-response replay emulator instead of a live BMC, "
+                    "HostPort and DebugPort use binary921 machine frames, and six overlapping HEAT/PTC channels are moved to verified spare GPIO. "
+                    "It is debug-only and does not claim full real HEAT pinout pass."
+                )
+            else:
+                boundary = (
+                    "BMC-replay debug-photo profile: photo-visible/current J6/COM7/COM8 UART wiring is kept, "
+                    "the CPLD BMC UART talks to a PC poll-response replay emulator instead of a live BMC, "
+                    "and six overlapping HEAT/PTC channels are moved to verified spare GPIO. "
+                    "It is debug-only and does not claim full real HEAT pinout pass."
+                )
         else:
             boundary = (
                 "Temporary debug pin profile: current J6/COM7/COM8 UART wiring is kept, "
@@ -319,24 +346,55 @@ def diagnostic_profile_assignments(inventory: dict[str, Any], profile: str) -> d
             "and all three diagnostic UARTs move to verified spare GPIO; schematic UART1/2 are reserved unused."
         )
     else:
-        uart_assignments = dict(FORMAL_UART1_BMC_REPLAY_ASSIGNMENTS)
+        if profile == "production-two-uart-bmc-replay-binary921":
+            uart_assignments = dict(PRODUCTION_TWO_UART_BMC_REPLAY_BINARY921_ASSIGNMENTS)
+        elif profile == "formal-uart1-bmc-replay-binary921":
+            uart_assignments = dict(FORMAL_UART1_BMC_REPLAY_BINARY921_ASSIGNMENTS)
+        else:
+            uart_assignments = dict(FORMAL_UART1_BMC_REPLAY_ASSIGNMENTS)
         ptc_substitutions = {}
         hardware_status = "not_run"
         bmc_source = "pc_replay_from_real_bmc_capture"
         live_bmc_link_status = "not_used"
-        hardware_access_status = "blocked_waiting_for_uart1_uart2_access"
+        hardware_access_status = (
+            "production_uart1_uart2_access_confirmed_by_user"
+            if profile == "production-two-uart-bmc-replay-binary921"
+            else "blocked_waiting_for_uart1_uart2_access"
+        )
         reserved_uart_use_policy = "intentional_uart1_uart2_bmc_replay_host"
         uart_aliases = {
             "bmc_replay_uart_tx": "bmc_uart_tx",
             "bmc_replay_uart_rx": "bmc_uart_rx",
         }
+        if profile == "production-two-uart-bmc-replay-binary921":
+            uart_aliases.update(
+                {
+                    "combined_debug_host_uart_tx": "host_uart_tx",
+                    "combined_debug_host_uart_rx": "host_uart_rx",
+                }
+            )
         allowed_reserved_balls = {"L10", "M9", "M10", "N11"}
-        boundary = (
-            "BMC-replay formal-uart1 profile: HEAT/FAN/FG/INSTALL stay on the schematic pins, "
-            "BMC replay uses UART1 L10/M9, HostPort uses UART2 M10/N11, and DebugPort uses SPARE_GPIO44/45 "
-            "as TX=N14/RX=P15. "
-            "Photo evidence did not prove UART1/2 are physically accessible, so hardware access remains blocked until continuity/header access is verified."
-        )
+        if profile == "production-two-uart-bmc-replay-binary921":
+            boundary = (
+                "Production two-UART BMC-replay binary921 profile for J3 SRAM-only bring-up: HEAT/FAN/FG/INSTALL stay on PDF/inventory pins, "
+                "BMC replay uses UART1 L10/M9 at 115200, and a combined Host+Debug binary921 port uses UART2 M10/N11 at 921600. "
+                "The board is programmed through J3 with target board power present and PROGRAM_SRAM only; VREF is a reference, not board power. "
+                "It does not claim live BMC, flash, thermal performance, PID closed-loop, or real PTC/FAN load pass."
+            )
+        elif profile == "formal-uart1-bmc-replay-binary921":
+            boundary = (
+                "BMC-replay formal-uart1 binary921 profile: HEAT/FAN/FG/INSTALL stay on the schematic pins, "
+                "BMC replay uses UART1 L10/M9, HostPort uses UART2 M10/N11, DebugPort uses M14/M15 spare GPIO, "
+                "and HostPort/DebugPort use binary921 machine frames. "
+                "Photo evidence did not prove UART1/2 are physically accessible, so hardware access remains blocked until continuity/header access is verified."
+            )
+        else:
+            boundary = (
+                "BMC-replay formal-uart1 profile: HEAT/FAN/FG/INSTALL stay on the schematic pins, "
+                "BMC replay uses UART1 L10/M9, HostPort uses UART2 M10/N11, and DebugPort uses SPARE_GPIO44/45 "
+                "as TX=N14/RX=P15. "
+                "Photo evidence did not prove UART1/2 are physically accessible, so hardware access remains blocked until continuity/header access is verified."
+            )
     assignments.update(uart_assignments)
     conflict = check_pin_conflicts(inventory, assignments, allowed_reserved_balls=allowed_reserved_balls)
     reserved_future_uart = _reserved_future_uart(inventory)
@@ -365,6 +423,7 @@ def diagnostic_profile_assignments(inventory: dict[str, Any], profile: str) -> d
         "reserved_uart_use_policy": reserved_uart_use_policy,
         "bmc_source": bmc_source,
         "live_bmc_link_status": live_bmc_link_status,
+        "transport": "combined_host_debug_uart" if profile == "production-two-uart-bmc-replay-binary921" else "separate_host_debug_uart",
         "hardware_access_status": hardware_access_status,
         "real_fan_ptc_hardware_status": hardware_status,
         "conflict_check": conflict,

+ 729 - 0
tools/remote/collect_j6_binary921.py

@@ -0,0 +1,729 @@
+#!/usr/bin/env python3
+"""Collect J6 binary921 Host/Debug evidence.
+
+This collector uses explicit COM ports only. It opens HostPort for binary921
+host commands and reads DebugPort binary921 machine frames; DebugPort is never
+written.
+"""
+
+from __future__ import annotations
+
+import argparse
+import hashlib
+import json
+import sys
+import time
+from datetime import datetime, timezone
+from pathlib import Path
+from typing import Any
+
+sys.dont_write_bytecode = True
+ROOT = Path(__file__).resolve().parents[2]
+TOOLS = ROOT / "tools"
+if str(TOOLS) not in sys.path:
+    sys.path.insert(0, str(TOOLS))
+
+from binary921 import CommandId, FrameType, build_host_command, decode_stream, frame_to_dict, profile_id_for_name  # noqa: E402
+
+COMMAND_SEQUENCE = [
+    ("SET_PTC", CommandId.SET_PTC, 1, 10),
+    ("SET_PTC", CommandId.SET_PTC, 24, 20),
+    ("SET_FAN", CommandId.SET_FAN, 1, 40),
+    ("SET_FAN", CommandId.SET_FAN, 4, 30),
+    ("SET_PID_REQUESTED", CommandId.SET_PID_REQUESTED, None, 1),
+    ("GET_STATUS", CommandId.GET_STATUS, None, None),
+    ("GET_MAP", CommandId.GET_MAP, None, None),
+    ("GET_SENSOR", CommandId.GET_SENSOR, None, None),
+    ("GET_SENSOR", CommandId.GET_SENSOR, None, None),
+    ("GET_SENSOR", CommandId.GET_SENSOR, None, None),
+    ("SET_PID_REQUESTED", CommandId.SET_PID_REQUESTED, None, 0),
+    ("DISABLE", CommandId.DISABLE, None, None),
+]
+COMBINED_UART_PROFILES = {"production-two-uart-bmc-replay-binary921"}
+SEPARATE_UART_PROFILES = {"debug-photo-bmc-replay-binary921", "formal-uart1-bmc-replay-binary921"}
+ALL_PROFILES = sorted(COMBINED_UART_PROFILES | SEPARATE_UART_PROFILES)
+
+
+def utc_now() -> str:
+    return datetime.now(timezone.utc).isoformat(timespec="seconds").replace("+00:00", "Z")
+
+
+def sha256_bytes(data: bytes) -> str:
+    return hashlib.sha256(data).hexdigest()
+
+
+def _profile_id(profile: str) -> int:
+    return profile_id_for_name(profile)
+
+
+def is_combined_uart_profile(profile: str) -> bool:
+    return profile in COMBINED_UART_PROFILES
+
+
+def transport_for_args(args: argparse.Namespace) -> str:
+    requested = getattr(args, "transport", "auto") or "auto"
+    if requested == "auto":
+        return "combined-single-com" if is_combined_uart_profile(args.profile) else "two-uart"
+    return str(requested)
+
+
+def _require_explicit_com(name: str, value: str) -> None:
+    if not value.upper().startswith("COM") or not value[3:].isdigit():
+        raise ValueError(f"{name} must be an explicit COM port such as COM7")
+
+
+def _open_serial(port: str, baud: int) -> Any:
+    try:
+        import serial  # type: ignore
+    except ImportError as exc:
+        raise RuntimeError(
+            "pyserial is required for live binary921 collection. "
+            "Install it manually in the isolated lab before running live collection."
+        ) from exc
+    endpoint = serial.Serial()
+    endpoint.port = port
+    endpoint.baudrate = baud
+    endpoint.bytesize = 8
+    endpoint.parity = "N"
+    endpoint.stopbits = 1
+    endpoint.timeout = 0.02
+    endpoint.write_timeout = 1
+    endpoint.rtscts = False
+    endpoint.dsrdtr = False
+    endpoint.dtr = False
+    endpoint.rts = False
+    endpoint.open()
+    return endpoint
+
+
+def decode_accumulated_frames(buffer: bytearray) -> tuple[list[dict[str, Any]], bytearray]:
+    frames, remainder = decode_stream(bytes(buffer))
+    return [frame_to_dict(frame) for frame in frames], bytearray(remainder)
+
+
+def wait_for_ready(debug_serial: Any, *, timeout_sec: float) -> tuple[dict[str, Any], bytearray, list[dict[str, Any]]]:
+    deadline = time.monotonic() + timeout_sec
+    raw = bytearray()
+    decoded: list[dict[str, Any]] = []
+    remainder = bytearray()
+    while time.monotonic() < deadline:
+        chunk = debug_serial.read(4096)
+        if chunk:
+            raw += chunk
+            remainder += chunk
+            frames, remainder = decode_accumulated_frames(remainder)
+            decoded.extend(frames)
+            for frame in frames:
+                if int(frame.get("frame_type", -1)) == int(FrameType.READY):
+                    return frame, raw, decoded
+        else:
+            time.sleep(0.005)
+    raise TimeoutError("blocked_waiting_for_binary921_ready")
+
+
+def drain_frames(debug_serial: Any, host_serial: Any, *, duration_sec: float) -> tuple[bytes, bytes, list[dict[str, Any]], list[dict[str, Any]]]:
+    deadline = time.monotonic() + duration_sec
+    debug_raw = bytearray()
+    host_raw = bytearray()
+    debug_decoded: list[dict[str, Any]] = []
+    host_decoded: list[dict[str, Any]] = []
+    debug_remainder = bytearray()
+    host_remainder = bytearray()
+    while time.monotonic() < deadline:
+        chunk = debug_serial.read(4096)
+        if chunk:
+            debug_raw += chunk
+            debug_remainder += chunk
+            frames, debug_remainder = decode_accumulated_frames(debug_remainder)
+            debug_decoded.extend(frames)
+        chunk = host_serial.read(4096)
+        if chunk:
+            host_raw += chunk
+            host_remainder += chunk
+            frames, host_remainder = decode_accumulated_frames(host_remainder)
+            host_decoded.extend(frames)
+        if not chunk:
+            time.sleep(0.005)
+    return bytes(debug_raw), bytes(host_raw), debug_decoded, host_decoded
+
+
+def drain_combined_frames(combined_serial: Any, *, duration_sec: float) -> tuple[bytes, list[dict[str, Any]]]:
+    deadline = time.monotonic() + duration_sec
+    combined_raw = bytearray()
+    combined_decoded: list[dict[str, Any]] = []
+    remainder = bytearray()
+    while time.monotonic() < deadline:
+        chunk = combined_serial.read(4096)
+        if chunk:
+            combined_raw += chunk
+            remainder += chunk
+            frames, remainder = decode_accumulated_frames(remainder)
+            combined_decoded.extend(frames)
+        else:
+            time.sleep(0.005)
+    return bytes(combined_raw), combined_decoded
+
+
+def _expected_ack(command: dict[str, Any]) -> dict[str, Any]:
+    return {
+        "seq": int(command["seq"]),
+        "cmd_id": int(command["command_id"]),
+    }
+
+
+def _ack_match(command: dict[str, Any], ack: dict[str, Any], *, profile_id: int) -> dict[str, Any]:
+    decoded = ack.get("decoded") if isinstance(ack.get("decoded"), dict) else {}
+    expected = _expected_ack(command)
+    return {
+        "seq": expected["seq"],
+        "cmd": command["name"],
+        "expected_cmd_id": expected["cmd_id"],
+        "ack_seq": ack.get("seq"),
+        "ack_cmd_id": decoded.get("cmd_id"),
+        "ack_status_code": decoded.get("status_code"),
+        "ack_ok": decoded.get("ok"),
+        "ack_profile_id": ack.get("profile_id"),
+        "seq_match": ack.get("seq") == expected["seq"],
+        "cmd_match": decoded.get("cmd_id") == expected["cmd_id"],
+        "status_match": decoded.get("status_code") == 0 and decoded.get("ok") is True,
+        "profile_match": ack.get("profile_id") == profile_id,
+    }
+
+
+def match_host_acks(host_commands: list[dict[str, Any]], host_frames: list[dict[str, Any]], *, profile_id: int) -> tuple[list[dict[str, Any]], int]:
+    ack_frames = [frame for frame in host_frames if int(frame.get("frame_type", -1)) == int(FrameType.HOST_ACK)]
+    matches: list[dict[str, Any]] = []
+    matched_count = 0
+    for index, command in enumerate(host_commands):
+        ack = ack_frames[index] if index < len(ack_frames) else {}
+        match = _ack_match(command, ack, profile_id=profile_id)
+        match["accepted"] = all(
+            bool(match[key]) for key in ["seq_match", "cmd_match", "status_match", "profile_match"]
+        )
+        if match["accepted"]:
+            matched_count += 1
+        matches.append(match)
+    return matches, matched_count
+
+
+def build_manifest_from_frames(
+    *,
+    profile: str,
+    startup_ready: dict[str, Any] | None,
+    host_commands: list[dict[str, Any]],
+    host_frames: list[dict[str, Any]],
+    debug_frames: list[dict[str, Any]],
+    debug_raw: bytes,
+    host_raw: bytes,
+    combined_raw: bytes | None = None,
+    bmc_replay: dict[str, Any] | None = None,
+) -> dict[str, Any]:
+    profile_id = _profile_id(profile)
+    transport = "combined_host_debug_uart" if is_combined_uart_profile(profile) or combined_raw is not None else "separate_host_debug_uart"
+    ack_frames = [frame for frame in host_frames if int(frame.get("frame_type", -1)) == int(FrameType.HOST_ACK)]
+    ack_matches, ack_matched_count = match_host_acks(host_commands, host_frames, profile_id=profile_id)
+    bmc_payload_frames = [
+        frame for frame in debug_frames if int(frame.get("frame_type", -1)) == int(FrameType.BMC_PAYLOAD)
+    ]
+    sensor_cache_frames = [
+        frame for frame in debug_frames if int(frame.get("frame_type", -1)) == int(FrameType.SENSOR_CACHE)
+    ]
+    module_snapshot_frames = [
+        frame for frame in debug_frames if int(frame.get("frame_type", -1)) == int(FrameType.MODULE_SNAPSHOT)
+    ]
+    latest_module_snapshot = (
+        module_snapshot_frames[-1].get("decoded")
+        if module_snapshot_frames and isinstance(module_snapshot_frames[-1].get("decoded"), dict)
+        else {}
+    )
+    host_command_coverage = {
+        "set_ptc_channels": sorted(
+            int(command["channel"])
+            for command in host_commands
+            if command.get("name") == "SET_PTC" and command.get("channel") is not None
+        ),
+        "set_fan_channels": sorted(
+            int(command["channel"])
+            for command in host_commands
+            if command.get("name") == "SET_FAN" and command.get("channel") is not None
+        ),
+        "pid_requested_values": [
+            int(command["percent"])
+            for command in host_commands
+            if command.get("name") == "SET_PID_REQUESTED" and command.get("percent") is not None
+        ],
+        "disable_seen": any(command.get("name") == "DISABLE" for command in host_commands),
+    }
+    pwm_logic_evidence = {
+        "status": "pass"
+        if host_command_coverage["set_ptc_channels"] == [1, 24]
+        and host_command_coverage["set_fan_channels"] == [1, 4]
+        and ack_matched_count == len(COMMAND_SEQUENCE)
+        else "blocked",
+        "requested_ptc_channels": host_command_coverage["set_ptc_channels"],
+        "requested_fan_channels": host_command_coverage["set_fan_channels"],
+        "host_ack_matched_count": ack_matched_count,
+    }
+    pid_evidence = {
+        "status": "pass"
+        if host_command_coverage["pid_requested_values"] == [1, 0]
+        and latest_module_snapshot.get("pid_requested") is False
+        else "blocked",
+        "requested_values": host_command_coverage["pid_requested_values"],
+        "latest_pid_requested": latest_module_snapshot.get("pid_requested"),
+        "policy": "pid_request_is_recorded_but_pid_control_remains_inactive_in_this_profile",
+    }
+    timeout_fallback_evidence = {
+        "status": "pass"
+        if latest_module_snapshot.get("timeout_active") is True
+        and latest_module_snapshot.get("ptc01_percent") == 0
+        and latest_module_snapshot.get("ptc24_percent") == 0
+        and latest_module_snapshot.get("fan01_percent") == 30
+        and latest_module_snapshot.get("fan04_percent") == 30
+        else "blocked",
+        "latest_timeout_active": latest_module_snapshot.get("timeout_active"),
+        "latest_ptc01_percent": latest_module_snapshot.get("ptc01_percent"),
+        "latest_ptc24_percent": latest_module_snapshot.get("ptc24_percent"),
+        "latest_fan01_percent": latest_module_snapshot.get("fan01_percent"),
+        "latest_fan04_percent": latest_module_snapshot.get("fan04_percent"),
+    }
+    blockers: list[str] = []
+    if len(host_commands) != len(COMMAND_SEQUENCE):
+        blockers.append("wrong_host_command_count")
+    if len(ack_frames) != len(COMMAND_SEQUENCE):
+        blockers.append("wrong_host_ack_count")
+    if ack_matched_count != len(COMMAND_SEQUENCE):
+        blockers.append("host_ack_mismatch")
+    if not bmc_payload_frames:
+        blockers.append("missing_bmc_payload")
+    if not sensor_cache_frames:
+        blockers.append("missing_sensor_cache")
+    if not isinstance(bmc_replay, dict) or bmc_replay.get("status") != "pass":
+        blockers.append("missing_or_blocked_bmc_replay")
+    if profile == "production-two-uart-bmc-replay-binary921":
+        if not module_snapshot_frames:
+            blockers.append("missing_module_snapshot")
+        if latest_module_snapshot.get("profile_id_payload") != profile_id:
+            blockers.append("module_snapshot_profile_mismatch")
+        if int(latest_module_snapshot.get("command_count_seen") or 0) < len(COMMAND_SEQUENCE):
+            blockers.append("module_snapshot_missing_command_coverage")
+        if latest_module_snapshot.get("host_err_count") not in (0, None):
+            blockers.append("module_snapshot_host_errors_nonzero")
+        if pwm_logic_evidence["status"] != "pass":
+            blockers.append("pwm_logic_evidence_incomplete")
+        if pid_evidence["status"] != "pass":
+            blockers.append("pid_inactive_evidence_incomplete")
+        if timeout_fallback_evidence["status"] != "pass":
+            blockers.append("timeout_fallback_evidence_incomplete")
+
+    status = "pass" if not blockers else ("blocked_host_ack" if any("ack" in item for item in blockers) else "blocked_evidence_incomplete")
+    artifact_hashes = {
+        "debug-uart-binary921.raw": sha256_bytes(debug_raw),
+        "host-port-binary921.raw": sha256_bytes(host_raw),
+    }
+    if combined_raw is not None:
+        artifact_hashes = {"combined-uart-binary921.raw": sha256_bytes(combined_raw)}
+
+    return {
+        "schema": "j6-binary921-evidence-manifest-v1",
+        "status": status,
+        "generated_at": utc_now(),
+        "protocol": "binary921",
+        "profile": profile,
+        "transport": transport,
+        "combined_uart_baud": 921600 if transport == "combined_host_debug_uart" else None,
+        "bmc_replay_uart_baud": 115200,
+        "bmc_source": "pc_replay_from_real_bmc_capture",
+        "live_bmc_link_status": "not_used",
+        "real_fan_ptc_hardware_status": "not_run",
+        "startup_ready": startup_ready or {},
+        "host_command_count": len(host_commands),
+        "host_ack_count": len(ack_frames),
+        "host_ack_matched_count": ack_matched_count,
+        "host_ack_matches": ack_matches,
+        "debug_frame_count": len(debug_frames),
+        "bmc_payload_frame_count": len(bmc_payload_frames),
+        "sensor_cache_frame_count": len(sensor_cache_frames),
+        "module_snapshot_count": len(module_snapshot_frames),
+        "latest_module_snapshot": latest_module_snapshot,
+        "host_command_coverage": host_command_coverage,
+        "pwm_logic_evidence": pwm_logic_evidence,
+        "pid_evidence": pid_evidence,
+        "timeout_fallback_evidence": timeout_fallback_evidence,
+        "bmc_replay": bmc_replay or {"status": "missing"},
+        "blockers": blockers,
+        "artifact_hashes": artifact_hashes,
+        "safety": {
+            "flash_attempted": False,
+            "driver_install_attempted": False,
+            "programs_nonvolatile": False,
+            "enumerates_com_ports": False,
+            "debug_port_writes_to_serial": False,
+            "toggles_dtr_rts": False,
+        },
+    }
+
+
+def write_blocked_manifest(
+    output_dir: Path,
+    *,
+    profile: str,
+    status: str,
+    startup_raw: bytes,
+    startup_frames: list[dict[str, Any]],
+    error: str,
+) -> dict[str, Any]:
+    output_dir.mkdir(parents=True, exist_ok=True)
+    (output_dir / "debug-uart-binary921.raw").write_bytes(startup_raw)
+    (output_dir / "host-port-binary921.raw").write_bytes(b"")
+    (output_dir / "debug-binary921-frames.json").write_text(json.dumps(startup_frames, indent=2) + "\n", encoding="utf-8")
+    (output_dir / "host-binary921-frames.json").write_text("[]\n", encoding="utf-8")
+    (output_dir / "host-command-transcript.json").write_text("[]\n", encoding="utf-8")
+    (output_dir / "startup-preflight.json").write_text(
+        json.dumps(
+            {
+                "status": status,
+                "ready_seen": False,
+                "pre_sram_noise_sha256": sha256_bytes(startup_raw),
+                "error": error,
+            },
+            indent=2,
+        )
+        + "\n",
+        encoding="utf-8",
+    )
+    manifest = {
+        "schema": "j6-binary921-evidence-manifest-v1",
+        "status": status,
+        "generated_at": utc_now(),
+        "protocol": "binary921",
+        "profile": profile,
+        "transport": "combined_host_debug_uart" if is_combined_uart_profile(profile) else "separate_host_debug_uart",
+        "bmc_source": "pc_replay_from_real_bmc_capture",
+        "live_bmc_link_status": "not_used",
+        "real_fan_ptc_hardware_status": "not_run",
+        "startup_ready": {},
+        "startup_pre_sram_noise_sha256": sha256_bytes(startup_raw),
+        "host_command_count": 0,
+        "host_ack_count": 0,
+        "host_ack_matched_count": 0,
+        "debug_frame_count": len(startup_frames),
+        "bmc_payload_frame_count": 0,
+        "sensor_cache_frame_count": 0,
+        "bmc_replay": {"status": "not_run"},
+        "blockers": [status],
+        "error": error,
+        "artifact_hashes": {
+            "debug-uart-binary921.raw": sha256_bytes(startup_raw),
+            "host-port-binary921.raw": sha256_bytes(b""),
+        },
+        "safety": {
+            "flash_attempted": False,
+            "driver_install_attempted": False,
+            "programs_nonvolatile": False,
+            "enumerates_com_ports": False,
+            "debug_port_writes_to_serial": False,
+            "toggles_dtr_rts": False,
+        },
+    }
+    (output_dir / "binary921-evidence-manifest.json").write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
+    return manifest
+
+
+def collect_live(args: argparse.Namespace) -> dict[str, Any]:
+    output_dir = Path(args.output_dir)
+    output_dir.mkdir(parents=True, exist_ok=True)
+    profile_id = _profile_id(args.profile)
+    transport = transport_for_args(args)
+
+    if transport == "combined-single-com":
+        combined_port = getattr(args, "combined_port", "") or args.host_port
+        _require_explicit_com("CombinedPort", combined_port)
+
+        combined_serial = _open_serial(combined_port, 921600)
+        host_commands: list[dict[str, Any]] = []
+        all_frames: list[dict[str, Any]] = []
+        combined_raw = bytearray()
+        ready: dict[str, Any] | None = None
+        try:
+            try:
+                ready, ready_raw, ready_frames = wait_for_ready(combined_serial, timeout_sec=args.ready_timeout_sec)
+            except TimeoutError as exc:
+                return write_blocked_manifest(
+                    output_dir,
+                    profile=args.profile,
+                    status="blocked_waiting_for_binary921_ready",
+                    startup_raw=bytes(combined_raw),
+                    startup_frames=all_frames,
+                    error=str(exc),
+                )
+            combined_raw += ready_raw
+            all_frames.extend(ready_frames)
+            for index, (name, command, channel, percent) in enumerate(COMMAND_SEQUENCE, start=1):
+                frame_bytes = build_host_command(
+                    seq=index,
+                    command=command,
+                    channel=channel,
+                    percent=percent,
+                    profile_id=profile_id,
+                )
+                combined_serial.write(frame_bytes)
+                combined_serial.flush()
+                host_commands.append(
+                    {
+                        "seq": index,
+                        "name": name,
+                        "command_id": int(command),
+                        "channel": channel,
+                        "percent": percent,
+                        "wire_sha256": sha256_bytes(frame_bytes),
+                    }
+                )
+                c_raw, c_frames = drain_combined_frames(combined_serial, duration_sec=args.ack_window_sec)
+                combined_raw += c_raw
+                all_frames.extend(c_frames)
+            c_raw, c_frames = drain_combined_frames(combined_serial, duration_sec=max(0.0, args.duration_sec))
+            combined_raw += c_raw
+            all_frames.extend(c_frames)
+        finally:
+            combined_serial.close()
+
+        (output_dir / "combined-uart-binary921.raw").write_bytes(bytes(combined_raw))
+        (output_dir / "combined-binary921-frames.json").write_text(json.dumps(all_frames, indent=2) + "\n", encoding="utf-8")
+        (output_dir / "debug-uart-binary921.raw").write_bytes(bytes(combined_raw))
+        (output_dir / "host-port-binary921.raw").write_bytes(bytes(combined_raw))
+        (output_dir / "debug-binary921-frames.json").write_text(json.dumps(all_frames, indent=2) + "\n", encoding="utf-8")
+        (output_dir / "host-binary921-frames.json").write_text(json.dumps(all_frames, indent=2) + "\n", encoding="utf-8")
+        (output_dir / "host-command-transcript.json").write_text(json.dumps(host_commands, indent=2) + "\n", encoding="utf-8")
+        (output_dir / "startup-preflight.json").write_text(
+            json.dumps({"status": "pass", "ready": ready, "transport": "combined_host_debug_uart"}, indent=2) + "\n",
+            encoding="utf-8",
+        )
+
+        bmc_replay = {}
+        if args.bmc_replay_receipt:
+            try:
+                bmc_replay = json.loads(Path(args.bmc_replay_receipt).read_text(encoding="utf-8"))
+            except (OSError, json.JSONDecodeError) as exc:
+                bmc_replay = {"status": "blocked_unreadable_bmc_replay_receipt", "error": str(exc)}
+        manifest = build_manifest_from_frames(
+            profile=args.profile,
+            startup_ready=ready,
+            host_commands=host_commands,
+            host_frames=all_frames,
+            debug_frames=all_frames,
+            debug_raw=bytes(combined_raw),
+            host_raw=bytes(combined_raw),
+            combined_raw=bytes(combined_raw),
+            bmc_replay=bmc_replay,
+        )
+        (output_dir / "binary921-evidence-manifest.json").write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
+        return manifest
+
+    if transport != "two-uart":
+        raise ValueError(f"unknown binary921 transport: {transport}")
+    _require_explicit_com("HostPort", args.host_port)
+    _require_explicit_com("DebugPort", args.debug_port)
+    if args.host_port.upper() == args.debug_port.upper():
+        raise ValueError("HostPort and DebugPort must be different; use --transport combined-single-com --combined-port for production combined UART")
+
+    host_serial = _open_serial(args.host_port, 115200)
+    debug_serial = _open_serial(args.debug_port, 921600)
+    host_commands: list[dict[str, Any]] = []
+    all_debug_frames: list[dict[str, Any]] = []
+    all_host_frames: list[dict[str, Any]] = []
+    debug_raw = bytearray()
+    host_raw = bytearray()
+    ready: dict[str, Any] | None = None
+    try:
+        try:
+            ready, ready_raw, ready_frames = wait_for_ready(debug_serial, timeout_sec=args.ready_timeout_sec)
+        except TimeoutError as exc:
+            return write_blocked_manifest(
+                output_dir,
+                profile=args.profile,
+                status="blocked_waiting_for_binary921_ready",
+                startup_raw=bytes(debug_raw),
+                startup_frames=all_debug_frames,
+                error=str(exc),
+            )
+        debug_raw += ready_raw
+        all_debug_frames.extend(ready_frames)
+        for index, (name, command, channel, percent) in enumerate(COMMAND_SEQUENCE, start=1):
+            frame_bytes = build_host_command(seq=index, command=command, channel=channel, percent=percent, profile_id=profile_id)
+            host_serial.write(frame_bytes)
+            host_serial.flush()
+            host_commands.append(
+                {
+                    "seq": index,
+                    "name": name,
+                    "command_id": int(command),
+                    "channel": channel,
+                    "percent": percent,
+                    "wire_sha256": sha256_bytes(frame_bytes),
+                }
+            )
+            d_raw, h_raw, d_frames, h_frames = drain_frames(debug_serial, host_serial, duration_sec=args.ack_window_sec)
+            debug_raw += d_raw
+            host_raw += h_raw
+            all_debug_frames.extend(d_frames)
+            all_host_frames.extend(h_frames)
+        d_raw, h_raw, d_frames, h_frames = drain_frames(debug_serial, host_serial, duration_sec=max(0.0, args.duration_sec))
+        debug_raw += d_raw
+        host_raw += h_raw
+        all_debug_frames.extend(d_frames)
+        all_host_frames.extend(h_frames)
+    finally:
+        debug_serial.close()
+        host_serial.close()
+
+    (output_dir / "debug-uart-binary921.raw").write_bytes(bytes(debug_raw))
+    (output_dir / "host-port-binary921.raw").write_bytes(bytes(host_raw))
+    (output_dir / "debug-binary921-frames.json").write_text(json.dumps(all_debug_frames, indent=2) + "\n", encoding="utf-8")
+    (output_dir / "host-binary921-frames.json").write_text(json.dumps(all_host_frames, indent=2) + "\n", encoding="utf-8")
+    (output_dir / "host-command-transcript.json").write_text(json.dumps(host_commands, indent=2) + "\n", encoding="utf-8")
+    (output_dir / "startup-preflight.json").write_text(json.dumps({"status": "pass", "ready": ready}, indent=2) + "\n", encoding="utf-8")
+
+    bmc_replay = {}
+    if args.bmc_replay_receipt:
+        try:
+            bmc_replay = json.loads(Path(args.bmc_replay_receipt).read_text(encoding="utf-8"))
+        except (OSError, json.JSONDecodeError) as exc:
+            bmc_replay = {"status": "blocked_unreadable_bmc_replay_receipt", "error": str(exc)}
+    manifest = build_manifest_from_frames(
+        profile=args.profile,
+        startup_ready=ready,
+        host_commands=host_commands,
+        host_frames=all_host_frames,
+        debug_frames=all_debug_frames,
+        debug_raw=bytes(debug_raw),
+        host_raw=bytes(host_raw),
+        bmc_replay=bmc_replay,
+    )
+    (output_dir / "binary921-evidence-manifest.json").write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
+    return manifest
+
+
+def run_selftest() -> dict[str, Any]:
+    from binary921 import encode_frame, decode_frame
+
+    ready = frame_to_dict(decode_frame(encode_frame(profile_id=1, frame_type=FrameType.READY, seq=1, timestamp_tick=2, payload=b"\x01\x00\x00\x00")))
+    commands = [
+        frame_to_dict(decode_stream(build_host_command(seq=index, command=command, channel=channel, percent=percent))[0][0])
+        for index, (_, command, channel, percent) in enumerate(COMMAND_SEQUENCE, start=1)
+    ]
+    host_command_rows = [
+        {
+            "seq": int(frame["seq"]),
+            "name": COMMAND_SEQUENCE[index - 1][0],
+            "command_id": int(COMMAND_SEQUENCE[index - 1][1]),
+            "channel": COMMAND_SEQUENCE[index - 1][2],
+            "percent": COMMAND_SEQUENCE[index - 1][3],
+        }
+        for index, frame in enumerate(commands, start=1)
+    ]
+    ack_frames = [
+        frame_to_dict(
+            decode_frame(
+                encode_frame(
+                    profile_id=1,
+                    frame_type=FrameType.HOST_ACK,
+                    seq=row["seq"],
+                    timestamp_tick=0,
+                    payload=bytes([1, row["command_id"], 0, 0, 0x34, 0x12]),
+                )
+            )
+        )
+        for row in host_command_rows
+    ]
+    bmc_payload = frame_to_dict(
+        decode_frame(
+            encode_frame(
+                profile_id=1,
+                frame_type=FrameType.BMC_PAYLOAD,
+                seq=2,
+                timestamp_tick=0,
+                payload=bytes([48, 48, 0, 1, 0x28, 0, 0x04, 0x14]),
+            )
+        )
+    )
+    sensor_cache = frame_to_dict(
+        decode_frame(
+            encode_frame(
+                profile_id=1,
+                frame_type=FrameType.SENSOR_CACHE,
+                seq=3,
+                timestamp_tick=0,
+                payload=bytes([1, 0, 1, 0, 0, 0, 24, 0]),
+            )
+        )
+    )
+    manifest = build_manifest_from_frames(
+        profile="debug-photo-bmc-replay-binary921",
+        startup_ready=ready,
+        host_commands=host_command_rows,
+        host_frames=ack_frames,
+        debug_frames=[ready, bmc_payload, sensor_cache],
+        debug_raw=b"debug",
+        host_raw=b"host",
+        bmc_replay={
+            "status": "pass",
+            "bmc_source": "pc_replay_from_real_bmc_capture",
+            "byte_count": 48,
+            "valid_count": 24,
+            "missing_count": 0,
+            "payload_sha256": "0" * 64,
+        },
+    )
+    if ready["decoded"]["kind"] != "ready":
+        raise AssertionError("READY decode failed")
+    if commands[0]["decoded"]["cmd"] != "SET_PTC":
+        raise AssertionError("SET_PTC build/decode failed")
+    if manifest["status"] != "pass":
+        raise AssertionError(f"manifest selftest did not pass: {manifest}")
+    return {
+        "schema": "j6-binary921-collector-selftest-v1",
+        "status": "pass",
+        "ready": ready,
+        "command_count": len(commands),
+        "first_command": commands[0],
+        "manifest": manifest,
+        "bmc_source": "pc_replay_from_real_bmc_capture",
+        "real_fan_ptc_hardware_status": "not_run",
+    }
+
+
+def build_parser() -> argparse.ArgumentParser:
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument("--host-port", dest="host_port", default="")
+    parser.add_argument("--debug-port", dest="debug_port", default="")
+    parser.add_argument("--combined-port", dest="combined_port", default="")
+    parser.add_argument("--transport", choices=["auto", "two-uart", "combined-single-com"], default="auto")
+    parser.add_argument("--profile", choices=ALL_PROFILES, default="debug-photo-bmc-replay-binary921")
+    parser.add_argument("--output-dir", default="evidence-binary921")
+    parser.add_argument("--duration-sec", type=float, default=5.0)
+    parser.add_argument("--ready-timeout-sec", type=float, default=30.0)
+    parser.add_argument("--ack-window-sec", type=float, default=0.25)
+    parser.add_argument("--bitstream", default="")
+    parser.add_argument("--td-receipt", default="")
+    parser.add_argument("--bmc-replay-receipt", default="")
+    parser.add_argument("--selftest", action="store_true")
+    parser.add_argument("--json", action="store_true")
+    return parser
+
+
+def main(argv: list[str] | None = None) -> int:
+    args = build_parser().parse_args(argv)
+    if args.selftest:
+        payload = run_selftest()
+    else:
+        payload = collect_live(args)
+    if args.json or args.selftest:
+        print(json.dumps(payload, indent=2))
+    if args.selftest:
+        print("selftest=pass")
+    return 0 if payload["status"] == "pass" else 1
+
+
+if __name__ == "__main__":
+    raise SystemExit(main(sys.argv[1:]))

+ 54 - 0
tools/uart_receipts.py

@@ -78,6 +78,7 @@ UART_SCHEMAS = {
 BINARY921_ALLOWED_PROFILES = {
     "debug-photo-bmc-replay-binary921",
     "formal-uart1-bmc-replay-binary921",
+    "production-two-uart-bmc-replay-binary921",
 }
 BINARY921_REQUIRED_SAFETY_FALSE_FIELDS = [
     "flash_attempted",
@@ -85,6 +86,7 @@ BINARY921_REQUIRED_SAFETY_FALSE_FIELDS = [
     "programs_nonvolatile",
     "enumerates_com_ports",
     "debug_port_writes_to_serial",
+    "toggles_dtr_rts",
 ]
 BINARY921_FORBIDDEN_ACTION_MARKERS = [
     "PROGRAM_FLASH",
@@ -973,6 +975,21 @@ def _validate_binary921_evidence_manifest(receipt: dict[str, Any], *, strict: bo
         failures.append("binary921_protocol_not_binary921")
     if receipt.get("profile") not in BINARY921_ALLOWED_PROFILES:
         failures.append("binary921_profile_not_allowed")
+    transport = receipt.get("transport") or "separate_host_debug_uart"
+    if receipt.get("profile") == "production-two-uart-bmc-replay-binary921":
+        if transport != "combined_host_debug_uart":
+            failures.append("binary921_production_transport_not_combined")
+        if receipt.get("combined_uart_baud") != 921600:
+            failures.append("binary921_combined_uart_baud_not_921600")
+        if receipt.get("bmc_replay_uart_baud") != 115200:
+            failures.append("binary921_bmc_replay_uart_baud_not_115200")
+        artifact_hashes = receipt.get("artifact_hashes") or {}
+        if not isinstance(artifact_hashes, dict) or not artifact_hashes.get("combined-uart-binary921.raw"):
+            failures.append("binary921_combined_uart_artifact_missing")
+        elif not re.fullmatch(r"[0-9a-fA-F]{64}", str(artifact_hashes.get("combined-uart-binary921.raw"))):
+            failures.append("binary921_combined_uart_artifact_hash_invalid")
+    elif transport not in {"separate_host_debug_uart", None}:
+        failures.append("binary921_nonproduction_transport_not_separate")
     if receipt.get("bmc_source") != "pc_replay_from_real_bmc_capture":
         failures.append("binary921_bmc_source_not_pc_replay")
     if receipt.get("live_bmc_link_status") != "not_used":
@@ -1011,6 +1028,43 @@ def _validate_binary921_evidence_manifest(receipt: dict[str, Any], *, strict: bo
             failures.append("binary921_bmc_replay_source_not_pc_replay")
         if bmc_replay.get("byte_count") != 48:
             failures.append("binary921_bmc_replay_byte_count_not_48")
+        if receipt.get("profile") == "production-two-uart-bmc-replay-binary921":
+            if bmc_replay.get("source") != "real_bmc_capture":
+                failures.append("binary921_bmc_replay_source_not_real_capture")
+            if not bmc_replay.get("payload_reply_sha256") and not bmc_replay.get("reply_sha256"):
+                failures.append("binary921_bmc_replay_payload_hash_missing")
+            for hash_field in ["payload_reply_sha256", "reply_sha256", "capture_text_sha256"]:
+                value = bmc_replay.get(hash_field)
+                if value is not None and not re.fullmatch(r"[0-9a-fA-F]{64}", str(value)):
+                    failures.append(f"binary921_bmc_replay_{hash_field}_invalid")
+            if not bmc_replay.get("capture_text_sha256"):
+                failures.append("binary921_bmc_replay_capture_hash_missing")
+            if bmc_replay.get("valid_count") is None or bmc_replay.get("missing_count") is None:
+                failures.append("binary921_bmc_replay_valid_missing_counts_absent")
+            if int(receipt.get("module_snapshot_count") or 0) <= 0:
+                failures.append("binary921_module_snapshot_missing")
+            latest_snapshot = receipt.get("latest_module_snapshot") or {}
+            if not isinstance(latest_snapshot, dict):
+                failures.append("binary921_latest_module_snapshot_not_object")
+                latest_snapshot = {}
+            if latest_snapshot.get("profile_id_payload") != 3:
+                failures.append("binary921_module_snapshot_profile_mismatch")
+            if int(latest_snapshot.get("command_count_seen") or 0) < 12:
+                failures.append("binary921_module_snapshot_command_count_lt_12")
+            if latest_snapshot.get("host_err_count") not in (0, None):
+                failures.append("binary921_module_snapshot_host_err_nonzero")
+            if latest_snapshot.get("pid_requested") is not False:
+                failures.append("binary921_pid_not_inactive")
+            if latest_snapshot.get("timeout_active") is not True:
+                failures.append("binary921_timeout_not_active")
+            if latest_snapshot.get("ptc01_percent") != 0 or latest_snapshot.get("ptc24_percent") != 0:
+                failures.append("binary921_timeout_ptc_not_zero")
+            if latest_snapshot.get("fan01_percent") != 30 or latest_snapshot.get("fan04_percent") != 30:
+                failures.append("binary921_timeout_fan_not_30")
+            for evidence_field in ["pwm_logic_evidence", "pid_evidence", "timeout_fallback_evidence"]:
+                evidence = receipt.get(evidence_field) or {}
+                if not isinstance(evidence, dict) or evidence.get("status") != "pass":
+                    failures.append(f"binary921_{evidence_field}_not_pass")
 
     safety = receipt.get("safety") or {}
     if not isinstance(safety, dict):