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

feat(prod2u): close 3-axis six-limit Linux product path

Replace 2-axis solenoid profile with CON104–106 motors, CON12/CON129
limits, 5000+500 startup, runtime hard-stop, and permanent EN. Correct
CON12 board-viewer annotations and regenerate contracts/tests for TD.

Co-authored-by: Cursor <cursoragent@cursor.com>
root 3 месяцев назад
Родитель
Сommit
3356de260c
77 измененных файлов с 2159 добавлено и 3587 удалено
  1. 19 33
      AGENTS.md
  2. 240 25
      config/board_viewer_annotations.fcb_fpga_mcu_v1_2.json
  3. 113 94
      config/pin_inventory.prod2u_door_temp_v1_2.json
  4. 3 8
      config/prod2u_p4_verification_targets_v1.json
  5. 0 1
      config/source_closure.json
  6. 13 8
      constraints/prod2u_p4_normal_v3.adc
  7. 49 95
      docs/IO_EVIDENCE_MATRIX.zh-CN.md
  8. 41 34
      docs/REFERENCE-INVENTORY.json
  9. 11 11
      docs/REFERENCE-INVENTORY.md
  10. 42 61
      docs/prod2u-door-temp-protocol.zh-CN.md
  11. 0 7
      projects/prod2u-door-temp-motor-compat/NOTES.zh-CN.md
  12. 0 437
      projects/prod2u-door-temp-motor-compat/project.json
  13. 43 39
      projects/prod2u-door-temp/project.json
  14. 24 10
      projects/prod2u-door-temp/requirements.zh-CN.md
  15. 17 0
      receipts/board-data-con12-rebuild-20260805T171312Z.json
  16. 66 0
      receipts/reference-package-20260805T171312Z.json
  17. 135 91
      schemas/project.schema.json
  18. 88 31
      src/generated/host-contract.json
  19. 13 8
      src/generated/prod2u_door_temp.adc
  20. 0 63
      src/generated/prod2u_door_temp_motor_compat_params.vh
  21. 9 8
      src/generated/prod2u_door_temp_params.vh
  22. 36 14
      src/generated/td-source-manifest.json
  23. 9 19
      src/modules/door_action_dispatcher.v
  24. 32 19
      src/modules/door_motor_engine.v
  25. 0 54
      src/modules/intake_solenoid_adapter.v
  26. 70 70
      src/modules/startup_close_seek.v
  27. 6 33
      src/project/project_adapter.v
  28. 0 92
      src/project/project_adapter_motor_compat.v
  29. 0 343
      src/top/prod2u_p4_motor_compat_top.v
  30. 107 54
      src/top/prod2u_p4_normal_v3_top.v
  31. 1 2
      td/prod2u_p4_normal_v3.prj
  32. 19 8
      td/syn/prod2u_p4_normal_v3.tcl
  33. 10 20
      tests/board_viewer/fixtures/candidate_count_expectation.json
  34. 9 4
      tests/board_viewer/test_product_functional_annotations.py
  35. 14 12
      tests/cocotb/prod2u_door_temp_uart_top.v
  36. 18 4
      tests/cocotb/test_prod2u_door_temp_uart_e2e.py
  37. 2 2
      tests/formal/README.md
  38. 10 13
      tests/formal/door_action_dispatcher_axis3_formal.v
  39. 0 2
      tests/formal/frame_command_contract.sby
  40. 4 5
      tests/formal/frame_command_contract_formal.v
  41. 6 2
      tests/formal/host_watchdog_contract_formal.v
  42. 21 0
      tests/formal/runtime_limit_hard_stop.sby
  43. 52 0
      tests/formal/runtime_limit_hard_stop_formal.v
  44. 0 20
      tests/formal/runtime_limit_inertness.sby
  45. 0 44
      tests/formal/runtime_limit_inertness_formal.v
  46. 17 11
      tests/formal/simple_motor_temperature_contract_formal.v
  47. 29 45
      tests/formal/startup_close_seek_formal.v
  48. 0 79
      tests/sim/door_action_dispatcher_axis3_tb.v
  49. 32 31
      tests/sim/door_action_dispatcher_tb.v
  50. 0 92
      tests/sim/door_motor_engine_axis3_tb.v
  51. 40 91
      tests/sim/door_motor_engine_stop_tb.v
  52. 64 93
      tests/sim/door_motor_engine_tb.v
  53. 13 4
      tests/sim/frame_tx_uart_tx_tb.v
  54. 0 50
      tests/sim/intake_solenoid_adapter_tb.v
  55. 51 83
      tests/sim/prod2u_p4_normal_v3_top_runtime_limit_tb.v
  56. 33 36
      tests/sim/prod2u_p4_normal_v3_top_startup_tb.v
  57. 14 9
      tests/sim/prod2u_p4_normal_v3_top_tb.v
  58. 0 106
      tests/sim/project_adapter_motor_compat_tb.v
  59. 18 52
      tests/sim/project_adapter_tb.v
  60. 0 88
      tests/sim/startup_close_seek_axis3_tb.v
  61. 69 89
      tests/sim/startup_close_seek_tb.v
  62. 45 132
      tests/sim/startup_motor_stop_tb.v
  63. 7 15
      tests/test_project_structure.py
  64. 23 1
      tests/unit/test_agent_handoff_package.py
  65. 0 107
      tests/unit/test_intake_dual_profile.py
  66. 2 2
      tests/unit/test_negative_tool_fixtures.py
  67. 25 22
      tests/unit/test_phase1_contract.py
  68. 21 22
      tests/unit/test_phase2_contract.py
  69. 11 11
      tests/unit/test_phase3_formal_contract.py
  70. 10 8
      tests/unit/test_prod2u_p4_normal_v3_td_files.py
  71. 45 117
      tests/unit/test_product_contract_coverage.py
  72. 7 5
      tests/unit/test_project_generation.py
  73. 23 46
      tests/unit/test_startup_close_seek.py
  74. 21 28
      tests/unit/test_startup_mutation.py
  75. 64 0
      tests/unit/test_three_axis_door_contract.py
  76. 101 191
      tools/generate_project.py
  77. 22 21
      tools/prod2u_p4_harness.py

+ 19 - 33
AGENTS.md

@@ -42,41 +42,27 @@ Current authority is limited to the above contract files, this `AGENTS.md`, and
 
 - UART: 25 MHz, 115200 8N1, 217 clocks/bit, A5 5A framing, CRC-16/CCITT-FALSE.
 - Supported frame types: `0x01 SET_ALL`, `0x02 GET_TEMPERATURE`, `0x82 TEMPERATURE_DATA`.
-- SET_ALL payload: 4 FAN + 4 chamber PTC (each duplicated to 2 physical PTC PWM) + intake/exhaust X/exhaust Y door bytes (11 bytes total).
-- Door byte `00`: motor axes = stop (no new jog); intake solenoid = hold. `01` open / `02` close.
+- SET_ALL payload: 4 FAN + 4 chamber PTC (each duplicated to 2 physical PTC PWM) + Z/X/Y door bytes (11 bytes total).
+- Door byte `00`: motor axes = stop (no new jog). `01` open / `02` close.
 - PTC active high; FAN active low at FPGA output.
 - PWM ~20 Hz.
 - Watchdog 10 s -> PTC 0, FAN 20.
-- Ordinary motor move: 450 steps at 1000 steps/s. X and Y may overlap.
-- No ACK, BUSY, ERROR, command queue, preemption, legacy protocol compatibility, background temperature scan, or runtime limit usage.
-
-## Limit one-shot contract
-
-- X limit: CON68 pin3 / FPGA M6 (FAN_GPIO47 tach path). Y limit: CON34 pin3 / FPGA F9 (FAN_GPIO11 tach path). Active high at FPGA.
-  CON68 pin1=GND and pin2=+12V_FAN6 are reserved (do not wire limits there). CON34 pin1=GND and pin2=+12V_FAN10 are reserved.
-  (Legacy probe points CON30.3→B9, CON12.3→A11, CON140.1→T11, CON140.2→P13, and CON68.4→L8 are retired for this product remap.)
-- Limit is used only once per FPGA power-on, global hardware reset, or reconfiguration.
-- Startup closes both dampers: PTC 0%, FAN 10%, motor EN_n 0, DIR = 1 (close).
-- Per axis:
-  - If synchronized limit is already high: axis does not move, marked reached.
-  - Else start a burst of up to 450 full STEP rising edges at 1000 steps/s.
-  - After a full burst, hold STEP low for 50 ms, then start the next burst.
-  - Max 10 bursts. After 10 bursts not reached: mark exhausted, do not retry, do not send fault frame.
-  - X and Y may move concurrently and stop independently.
-- When limit is observed high inside the current 450-step burst:
-  - The stopped axis produces no new STEP rising edge.
-  - If STEP is low, no next rising edge is produced.
-  - If STEP is high, the current high pulse completes its full half-cycle and falls; no new rising edge after that.
-- `startup_done` is sticky. It is only cleared by the next FPGA power-on, global hardware reset, or reconfiguration.
-- After `startup_done`:
-  - startup motor start = 0, active mask = 0, stop mask = 0;
-  - the limit stop mask to the motor engine is 0;
-  - the startup FSM does not return to check/move states;
-  - the burst counter does not restart;
-  - limit changes have no effect on calibration, interrupts, stops, position, or ordinary motor moves.
-- During `startup_done == 0`:
-  - SET_ALL and GET_TEMPERATURE are dropped; no caching, no response, watchdog is not fed.
-  - The simplest implementation keeps the frame parser reset/flushed so partial frames cannot become valid commands later.
+- Ordinary motor move: 450 steps at 1000 steps/s. X, Y, and Z may overlap.
+- Motor EN: CON120.2 / C11, NPN invert at board; FPGA constant 1 (`permanent_high`).
+- No ACK, BUSY, ERROR, command queue, preemption, legacy protocol compatibility, background temperature scan, or solenoid actuator.
+
+## Limit and startup contract
+
+- Six limits (active high at FPGA, `runtime_use=true`):
+  - X: LS CON12.1 A5, HS CON12.2 B6
+  - Y: LS CON12.3 C8, HS CON12.4 A8
+  - Z: LS CON129.1 K16, HS CON129.2 J15
+- Motors: X STEP/DIR CON104.2/3 C12/B12; Y CON105.2/3 L12/J11; Z CON106.2/3 L14/K14.
+- Runtime: direction-select limit hard-stop each clock; finish current high half-cycle then no next rising edge; busy ignores new start.
+- Startup (once per power-on/reset/reconfig): PTC 0%, FAN 10%, all axes DIR=1 close; up to 5000 steps @ 1000 steps/s per axis; if limit not hit, 500-step backoff and mark missed; X/Y/Z may move concurrently and stop independently.
+- `startup_done` is sticky until next FPGA power-on, global hardware reset, or reconfiguration.
+- After `startup_done`: startup motor controls idle; ordinary host jog and runtime limit policy apply; limit FSM does not restart.
+- During `startup_done == 0`: SET_ALL and GET_TEMPERATURE are dropped; no caching, no response, watchdog is not fed; frame parser stays reset/flushed.
 
 ## Tooling preference
 
@@ -92,7 +78,7 @@ Current authority is limited to the above contract files, this `AGENTS.md`, and
 ## Necessary tests
 
 - Product, protocol, generator, packaging, and Git protection Python tests.
-- Icarus testbenches for the active Prod2U top, including startup one-shot and runtime limit inert behavior.
+- Icarus testbenches for the active Prod2U top, including startup close/seek and runtime limit hard-stop behavior.
 - Verilator lint, cocotb UART tests, and formal checks when the environment is available and cost is reasonable.
 
 ## Evidence boundaries

+ 240 - 25
config/board_viewer_annotations.fcb_fpga_mcu_v1_2.json

@@ -2062,24 +2062,6 @@
         "label": "+12V 主电源输入 2"
       }
     },
-    "CON12": {
-      "template": "dual-gpio-12v",
-      "variables": {
-        "reference": "CON12",
-        "power_net": "N9911969",
-        "fuse": "F36",
-        "gpio_a": "FAN_GPIO1",
-        "series_a": "R660",
-        "bank_a": "BANK0_GPIO1",
-        "ball_a": "A11",
-        "pull_a": "R934",
-        "gpio_b": "FAN_GPIO2",
-        "series_b": "R661",
-        "bank_b": "BANK0_GPIO2",
-        "ball_b": "C11",
-        "pull_b": "R935"
-      }
-    },
     "CON31": {
       "template": "four-wire-fan",
       "variables": {
@@ -6635,7 +6617,7 @@
       }
     },
     "CON129": {
-      "summary": "外部 GPIO 座;接触针到 FPGA U3 K16, J15, H15, H16",
+      "summary": "限位/外部 GPIO 座;LS3/HS3=Pin1/2 → K16/J15;Pin3/4=LS4/HS4 inventory-only",
       "pins": {
         "1": {
           "summary": "CON129.1 EX_GPIO17 → FPGA U3.K16 (CPLD_GPIO17)",
@@ -6651,7 +6633,7 @@
           ],
           "direction": "unknown",
           "external_level": "3.3V FPGA I/O",
-          "function_category": "gpio",
+          "function_category": "limit",
           "reserved": false,
           "fixed_load_conflict": false,
           "fpga": {
@@ -6668,7 +6650,7 @@
           },
           "programming": {
             "status": "board_only",
-            "conclusion": "物理路径到 FPGA U3.K16(网 CPLD_GPIO17);功能语义以板级网名 EX_GPIO17 为准,尚未做原理图交叉验证。",
+            "conclusion": "物理路径见 network_explanation;产品角色 LS3/Z-close。 高电平有效限位。",
             "network_explanation": "CON129.1 EX_GPIO17 → R1211.2 → CPLD_GPIO17 → U3.K16",
             "hdl_guidance": "RTL 端口方向与电平按实际功能确认;LOC 约束到该球位。",
             "connection_guidance": [
@@ -6701,7 +6683,7 @@
           ],
           "direction": "unknown",
           "external_level": "3.3V FPGA I/O",
-          "function_category": "gpio",
+          "function_category": "limit",
           "reserved": false,
           "fixed_load_conflict": false,
           "fpga": {
@@ -6718,7 +6700,7 @@
           },
           "programming": {
             "status": "board_only",
-            "conclusion": "物理路径到 FPGA U3.J15(网 CPLD_GPIO18);功能语义以板级网名 EX_GPIO18 为准,尚未做原理图交叉验证。",
+            "conclusion": "物理路径见 network_explanation;产品角色 HS3/Z-open。 高电平有效限位。",
             "network_explanation": "CON129.2 EX_GPIO18 → R1212.2 → CPLD_GPIO18 → U3.J15",
             "hdl_guidance": "RTL 端口方向与电平按实际功能确认;LOC 约束到该球位。",
             "connection_guidance": [
@@ -6768,7 +6750,7 @@
           },
           "programming": {
             "status": "board_only",
-            "conclusion": "物理路径到 FPGA U3.H15(网 CPLD_GPIO19);功能语义以板级网名 EX_GPIO19 为准,尚未做原理图交叉验证。",
+            "conclusion": "物理路径见 network_explanation;产品角色 LS4 inventory-only。 当前不创建第四轴控制。",
             "network_explanation": "CON129.3 EX_GPIO19 → R1213.2 → CPLD_GPIO19 → U3.H15",
             "hdl_guidance": "RTL 端口方向与电平按实际功能确认;LOC 约束到该球位。",
             "connection_guidance": [
@@ -6818,7 +6800,7 @@
           },
           "programming": {
             "status": "board_only",
-            "conclusion": "物理路径到 FPGA U3.H16(网 CPLD_GPIO20);功能语义以板级网名 EX_GPIO20 为准,尚未做原理图交叉验证。",
+            "conclusion": "物理路径见 network_explanation;产品角色 HS4 inventory-only。 当前不创建第四轴控制。",
             "network_explanation": "CON129.4 EX_GPIO20 → R1214.2 → CPLD_GPIO20 → U3.H16",
             "hdl_guidance": "RTL 端口方向与电平按实际功能确认;LOC 约束到该球位。",
             "connection_guidance": [
@@ -14829,6 +14811,239 @@
           }
         }
       }
+    },
+    "CON12": {
+      "summary": "限位输入座 LS1/HS1/LS2/HS2;接触针到 FPGA U3 A5, B6, C8, A8",
+      "pins": {
+        "1": {
+          "summary": "CON12.1 LS1/X-close (EX_GPIO1) → FPGA U3.A5 (BANK0_LVDS2_P)",
+          "path": [
+            "CON12.1 EX_GPIO1",
+            "R1195.2",
+            "BANK0_LVDS2_P",
+            "U3.A5"
+          ],
+          "evidence_tier": "board_database",
+          "sources": [
+            "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+          ],
+          "direction": "input",
+          "external_level": "3.3V FPGA I/O (active-high limit)",
+          "function_category": "limit",
+          "reserved": false,
+          "fixed_load_conflict": false,
+          "board_pull": "R1305 pull-up to +3V3",
+          "external_components": [
+            "R1195 series link",
+            "R1305 pull-up option",
+            "connector-side limit switch"
+          ],
+          "fpga": {
+            "ball": "A5",
+            "board_signal": "BANK0_LVDS2_P",
+            "io_standard": "LVCMOS33",
+            "capabilities": [
+              "gpio",
+              "digital_input"
+            ],
+            "evidence_tier": "board_database",
+            "sources": [
+              "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+            ]
+          },
+          "programming": {
+            "status": "board_only",
+            "conclusion": "物理路径到 FPGA U3.A5(网 BANK0_LVDS2_P);产品角色 LS1/X-close,高电平有效限位。",
+            "network_explanation": "CON12.1 EX_GPIO1 → R1195 → BANK0_LVDS2_P → U3.A5;R1305 上拉到 +3V3。",
+            "hdl_guidance": "RTL 作限位输入;2FF 同步后按轴方向选择 LS/HS;LOC 到该球位。",
+            "connection_guidance": [
+              "板端为 3.3V 逻辑域;限位开关高有效。"
+            ],
+            "constraints": [
+              "LOCATION = A5",
+              "IOSTANDARD = LVCMOS33"
+            ],
+            "risks": [
+              "当前仅有 BRD/KiCad 网表追踪证据;勿与旧 dual-gpio-12v/A11/C11 注解混淆。"
+            ],
+            "evidence_tier": "board_database",
+            "sources": [
+              "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+            ]
+          }
+        },
+        "2": {
+          "summary": "CON12.2 HS1/X-open (EX_GPIO2) → FPGA U3.B6 (BANK0_LVDS2_N)",
+          "path": [
+            "CON12.2 EX_GPIO2",
+            "R1196.2",
+            "BANK0_LVDS2_N",
+            "U3.B6"
+          ],
+          "evidence_tier": "board_database",
+          "sources": [
+            "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+          ],
+          "direction": "input",
+          "external_level": "3.3V FPGA I/O (active-high limit)",
+          "function_category": "limit",
+          "reserved": false,
+          "fixed_load_conflict": false,
+          "board_pull": "R1306 pull-up to +3V3",
+          "external_components": [
+            "R1196 series link",
+            "R1306 pull-up option",
+            "connector-side limit switch"
+          ],
+          "fpga": {
+            "ball": "B6",
+            "board_signal": "BANK0_LVDS2_N",
+            "io_standard": "LVCMOS33",
+            "capabilities": [
+              "gpio",
+              "digital_input"
+            ],
+            "evidence_tier": "board_database",
+            "sources": [
+              "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+            ]
+          },
+          "programming": {
+            "status": "board_only",
+            "conclusion": "物理路径到 FPGA U3.B6(网 BANK0_LVDS2_N);产品角色 HS1/X-open,高电平有效限位。",
+            "network_explanation": "CON12.2 EX_GPIO2 → R1196 → BANK0_LVDS2_N → U3.B6;R1306 上拉到 +3V3。",
+            "hdl_guidance": "RTL 作限位输入;2FF 同步后按轴方向选择 LS/HS;LOC 到该球位。",
+            "connection_guidance": [
+              "板端为 3.3V 逻辑域;限位开关高有效。"
+            ],
+            "constraints": [
+              "LOCATION = B6",
+              "IOSTANDARD = LVCMOS33"
+            ],
+            "risks": [
+              "当前仅有 BRD/KiCad 网表追踪证据;勿与旧 dual-gpio-12v/A11/C11 注解混淆。"
+            ],
+            "evidence_tier": "board_database",
+            "sources": [
+              "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+            ]
+          }
+        },
+        "3": {
+          "summary": "CON12.3 LS2/Y-close (EX_GPIO3) → FPGA U3.C8 (BANK0_LVDS3_P)",
+          "path": [
+            "CON12.3 EX_GPIO3",
+            "R1197.2",
+            "BANK0_LVDS3_P",
+            "U3.C8"
+          ],
+          "evidence_tier": "board_database",
+          "sources": [
+            "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+          ],
+          "direction": "input",
+          "external_level": "3.3V FPGA I/O (active-high limit)",
+          "function_category": "limit",
+          "reserved": false,
+          "fixed_load_conflict": false,
+          "board_pull": "R1307 pull-up to +3V3",
+          "external_components": [
+            "R1197 series link",
+            "R1307 pull-up option",
+            "connector-side limit switch"
+          ],
+          "fpga": {
+            "ball": "C8",
+            "board_signal": "BANK0_LVDS3_P",
+            "io_standard": "LVCMOS33",
+            "capabilities": [
+              "gpio",
+              "digital_input"
+            ],
+            "evidence_tier": "board_database",
+            "sources": [
+              "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+            ]
+          },
+          "programming": {
+            "status": "board_only",
+            "conclusion": "物理路径到 FPGA U3.C8(网 BANK0_LVDS3_P);产品角色 LS2/Y-close,高电平有效限位。",
+            "network_explanation": "CON12.3 EX_GPIO3 → R1197 → BANK0_LVDS3_P → U3.C8;R1307 上拉到 +3V3。",
+            "hdl_guidance": "RTL 作限位输入;2FF 同步后按轴方向选择 LS/HS;LOC 到该球位。",
+            "connection_guidance": [
+              "板端为 3.3V 逻辑域;限位开关高有效。"
+            ],
+            "constraints": [
+              "LOCATION = C8",
+              "IOSTANDARD = LVCMOS33"
+            ],
+            "risks": [
+              "当前仅有 BRD/KiCad 网表追踪证据;勿与旧 dual-gpio-12v/A11/C11 注解混淆。"
+            ],
+            "evidence_tier": "board_database",
+            "sources": [
+              "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+            ]
+          }
+        },
+        "4": {
+          "summary": "CON12.4 HS2/Y-open (EX_GPIO4) → FPGA U3.A8 (BANK0_LVDS3_N)",
+          "path": [
+            "CON12.4 EX_GPIO4",
+            "R1198.2",
+            "BANK0_LVDS3_N",
+            "U3.A8"
+          ],
+          "evidence_tier": "board_database",
+          "sources": [
+            "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+          ],
+          "direction": "input",
+          "external_level": "3.3V FPGA I/O (active-high limit)",
+          "function_category": "limit",
+          "reserved": false,
+          "fixed_load_conflict": false,
+          "board_pull": "R1308 pull-up to +3V3",
+          "external_components": [
+            "R1198 series link",
+            "R1308 pull-up option",
+            "connector-side limit switch"
+          ],
+          "fpga": {
+            "ball": "A8",
+            "board_signal": "BANK0_LVDS3_N",
+            "io_standard": "LVCMOS33",
+            "capabilities": [
+              "gpio",
+              "digital_input"
+            ],
+            "evidence_tier": "board_database",
+            "sources": [
+              "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+            ]
+          },
+          "programming": {
+            "status": "board_only",
+            "conclusion": "物理路径到 FPGA U3.A8(网 BANK0_LVDS3_N);产品角色 HS2/Y-open,高电平有效限位。",
+            "network_explanation": "CON12.4 EX_GPIO4 → R1198 → BANK0_LVDS3_N → U3.A8;R1308 上拉到 +3V3。",
+            "hdl_guidance": "RTL 作限位输入;2FF 同步后按轴方向选择 LS/HS;LOC 到该球位。",
+            "connection_guidance": [
+              "板端为 3.3V 逻辑域;限位开关高有效。"
+            ],
+            "constraints": [
+              "LOCATION = A8",
+              "IOSTANDARD = LVCMOS33"
+            ],
+            "risks": [
+              "当前仅有 BRD/KiCad 网表追踪证据;勿与旧 dual-gpio-12v/A11/C11 注解混淆。"
+            ],
+            "evidence_tier": "board_database",
+            "sources": [
+              "KiCad 10.0.4 Allegro import of FCB_FPGA+MCU_V1.2_20260717.brd; net-path trace via series R to FPGA ball"
+            ]
+          }
+        }
+      }
     }
   },
   "interfaces": [

+ 113 - 94
config/pin_inventory.prod2u_door_temp_v1_2.json

@@ -9,11 +9,11 @@
   "matrix_doc": "docs/IO_EVIDENCE_MATRIX.zh-CN.md",
   "matrix_counts": {
     "confirmed": 17,
-    "inferred": 12,
-    "blocked": 4,
-    "total_rows": 33
+    "inferred": 16,
+    "blocked": 1,
+    "total_rows": 34
   },
-  "electrical_boundary": "V1.2 EX_GPIO on CON138–CON141 used for product motor/limit/solenoid remap. Connector→series-R→ball paths are board-data backed; product roles remain inferred except legacy confirmed PTC/FAN/UART/I2C. External solenoid driver not confirmed. Do not treat 0611 CON30 silkscreen as V1.2 authority.",
+  "electrical_boundary": "V1.2 CON104–106/120/12/129 used for product 3-axis motor and six-limit remap. Connector→ball paths are board-data backed; product roles remain inferred except legacy confirmed PTC/FAN/UART/I2C. Do not treat 0611 CON30 silkscreen as V1.2 authority.",
   "source_documents": [
     {
       "kind": "allegro_brd",
@@ -260,134 +260,154 @@
     {
       "signal": "motor_en_n",
       "function_net": "EX_GPIO27",
-      "board_connector": "CON139",
-      "connector_pin": 3,
-      "legacy_connector_note": "Previously CON125.4 / A10 (0611 CON30.4); remapped to CON139.3",
-      "fpga_ball": "T7",
+      "board_connector": "CON120",
+      "connector_pin": 2,
+      "fpga_ball": "C11",
       "direction": "output",
       "active_level": "low",
-      "product_role": "shared_motor_enable_n",
+      "product_role": "shared_motor_enable_n_permanent_high",
       "conclusion": "inferred",
       "manually_verified": true,
-      "source_confidence": "v1_2_board_data_ex_gpio_product_remap",
-      "conclusion_notes": "Physical CON139.3→R1259→T7 confirmed in board-data; motor EN product role inferred."
+      "source_confidence": "v1_2_board_data_product_remap",
+      "conclusion_notes": "CON120.2→C11; NPN open-collector invert at board. FPGA drives constant 1 (permanent_high) so connector EN stays asserted."
     },
     {
-      "signal": "y_limit_raw",
-      "function_net": "FAN_GPIO11",
-      "board_connector": "CON34",
-      "connector_pin": 3,
-      "legacy_connector_note": "Previously CON68.4/L8; before that CON140.2/P13 and CON12.3/A11",
-      "fpga_ball": "F9",
+      "signal": "x_limit_ls",
+      "board_connector": "CON12",
+      "connector_pin": 1,
+      "fpga_ball": "A5",
+      "direction": "input",
+      "active_level": "high",
+      "product_role": "x_limit_low_side",
+      "conclusion": "inferred",
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
+    },
+    {
+      "signal": "x_limit_hs",
+      "board_connector": "CON12",
+      "connector_pin": 2,
+      "fpga_ball": "B6",
       "direction": "input",
       "active_level": "high",
-      "product_role": "startup_y_close_limit",
-      "physical_path_conclusion": "inferred",
-      "product_role_conclusion": "inferred",
+      "product_role": "x_limit_high_side",
       "conclusion": "inferred",
-      "conclusion_notes": "CON34.3→R670→F9 tach path is a true FPGA digital input (optional R944 pull-up). Close-limit role product-contract inferred. Present active-high at FPGA. CON34.1=GND and CON34.2=+12V_FAN10 reserved.",
       "manually_verified": true,
-      "source_confidence": "v1_2_board_data_fan_header_repurpose"
+      "source_confidence": "v1_2_board_data_product_remap"
     },
     {
-      "signal": "x_limit_raw",
-      "function_net": "FAN_GPIO47",
-      "board_connector": "CON68",
+      "signal": "y_limit_ls",
+      "board_connector": "CON12",
       "connector_pin": 3,
-      "legacy_connector_note": "Previously CON140.1/T11; before that CON125.3/B9 (0611 CON30.3)",
-      "fpga_ball": "M6",
+      "fpga_ball": "C8",
+      "direction": "input",
+      "active_level": "high",
+      "product_role": "y_limit_low_side",
+      "conclusion": "inferred",
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
+    },
+    {
+      "signal": "y_limit_hs",
+      "board_connector": "CON12",
+      "connector_pin": 4,
+      "fpga_ball": "A8",
+      "direction": "input",
+      "active_level": "high",
+      "product_role": "y_limit_high_side",
+      "conclusion": "inferred",
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
+    },
+    {
+      "signal": "z_limit_ls",
+      "board_connector": "CON129",
+      "connector_pin": 1,
+      "fpga_ball": "K16",
+      "direction": "input",
+      "active_level": "high",
+      "product_role": "z_limit_low_side",
+      "conclusion": "inferred",
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
+    },
+    {
+      "signal": "z_limit_hs",
+      "board_connector": "CON129",
+      "connector_pin": 2,
+      "fpga_ball": "J15",
       "direction": "input",
       "active_level": "high",
-      "product_role": "startup_x_close_limit",
-      "physical_path_conclusion": "inferred",
-      "v1_2_con30_silkscreen_conclusion": "blocked",
-      "product_role_conclusion": "inferred",
+      "product_role": "z_limit_high_side",
       "conclusion": "inferred",
-      "conclusion_notes": "CON68.3→R707→M6 tach path is a true FPGA digital input (optional R980 pull-up). Close-limit role product-contract inferred. Present active-high at FPGA (remove/disable R980 if using switch-to-GND sense without invert).",
       "manually_verified": true,
-      "source_confidence": "v1_2_board_data_fan_header_repurpose"
+      "source_confidence": "v1_2_board_data_product_remap"
     },
     {
       "signal": "x_step",
-      "fpga_ball": "R6",
+      "board_connector": "CON104",
+      "connector_pin": 2,
+      "fpga_ball": "C12",
       "direction": "output",
-      "product_role": "exhaust_x_step",
+      "product_role": "door_x_step",
       "conclusion": "inferred",
-      "conflict_notes": "Prior C11 dual-map (CON12.4 / CON120.2) retired for product STEP.",
-      "manually_verified": false,
-      "source_confidence": "v1_2_board_data_ex_gpio_product_remap",
-      "function_net": "EX_GPIO25",
-      "board_connector": "CON139",
-      "connector_pin": 1
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
     },
     {
       "signal": "x_dir",
-      "function_net": "EX_GPIO26",
-      "board_connector": "CON139",
-      "connector_pin": 2,
-      "fpga_ball": "R8",
+      "board_connector": "CON104",
+      "connector_pin": 3,
+      "fpga_ball": "B12",
       "direction": "output",
-      "product_role": "exhaust_x_dir",
+      "product_role": "door_x_dir",
       "conclusion": "inferred",
-      "manually_verified": false,
-      "source_confidence": "v1_2_board_data_ex_gpio_product_remap"
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
     },
     {
       "signal": "y_step",
-      "function_net": "EX_GPIO21",
-      "board_connector": "CON138",
-      "connector_pin": 1,
-      "fpga_ball": "T3",
+      "board_connector": "CON105",
+      "connector_pin": 2,
+      "fpga_ball": "L12",
       "direction": "output",
-      "product_role": "exhaust_y_step",
+      "product_role": "door_y_step",
       "conclusion": "inferred",
-      "conflict_notes": "Prior D15 DIR12 naming retired for product STEP.",
-      "manually_verified": false,
-      "source_confidence": "v1_2_board_data_ex_gpio_product_remap"
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
     },
     {
       "signal": "y_dir",
-      "function_net": "EX_GPIO22",
-      "board_connector": "CON138",
+      "board_connector": "CON105",
+      "connector_pin": 3,
+      "fpga_ball": "J11",
+      "direction": "output",
+      "product_role": "door_y_dir",
+      "conclusion": "inferred",
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
+    },
+    {
+      "signal": "z_step",
+      "board_connector": "CON106",
       "connector_pin": 2,
-      "fpga_ball": "R4",
+      "fpga_ball": "L14",
       "direction": "output",
-      "product_role": "exhaust_y_dir",
+      "product_role": "door_z_step",
       "conclusion": "inferred",
-      "manually_verified": false,
-      "source_confidence": "v1_2_board_data_ex_gpio_product_remap"
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
     },
     {
-      "signal": "intake_solenoid_out",
-      "fpga_ball": "P2",
-      "board_connector": "CON141",
-      "connector_pin": 1,
+      "signal": "z_dir",
+      "board_connector": "CON106",
+      "connector_pin": 3,
+      "fpga_ball": "K14",
       "direction": "output",
-      "product_role": "chamber1_intake_solenoid",
+      "product_role": "door_z_dir",
       "conclusion": "inferred",
-      "rejected_candidates": [
-        {
-          "ref": "CON124",
-          "reason": "WATER_COOL_V+ path to A11; conflicts with former y_limit; not solenoid"
-        },
-        {
-          "ref": "CON144",
-          "reason": "KEYLED_V1 to N6"
-        },
-        {
-          "ref": "CON145",
-          "reason": "KEYLED_V2 to P6"
-        },
-        {
-          "ref": "CON146",
-          "reason": "KEYLED_V3 to N7"
-        }
-      ],
-      "manually_verified": false,
-      "source_confidence": "v1_2_ex_gpio_assigned_external_driver_unconfirmed",
-      "function_net": "EX_GPIO33",
-      "active_level": "high",
-      "conclusion_notes": "CON141.1→R1265→P2 path exists; no on-board solenoid driver net — inferred product LOC."
+      "manually_verified": true,
+      "source_confidence": "v1_2_board_data_product_remap"
     },
     {
       "signal": "x_limit_connector_con30_pin3_v1_2_silkscreen",
@@ -407,9 +427,8 @@
     }
   ],
   "blocked_summary": [
-    "V1.2 silkscreen CON30.3 for X limit (historical; product now uses CON68.3 / M6)",
-    "CON124 as intake actuator (WATER_COOL -> A11); product y_limit on CON34.3 / F9",
-    "CON144-146 as intake actuator (KEYLED)",
-    "External solenoid driver / coil polarity on CON141 (inferred LOC only)"
+    "V1.2 silkscreen CON30.3 for X limit (historical; product now uses CON12/129 six-limit map)",
+    "Legacy CON68/CON34 fan-tach limit remap (M6/F9) retired for 3-axis product",
+    "CON141 solenoid / intake actuator retired — byte 8 is Z motor"
   ]
 }

+ 3 - 8
config/prod2u_p4_verification_targets_v1.json

@@ -16,7 +16,7 @@
       "tests.unit.test_product_contract_coverage",
       "tests.unit.test_negative_tool_fixtures",
       "tests.unit.test_startup_close_seek",
-      "tests.unit.test_intake_dual_profile",
+      "tests.unit.test_three_axis_door_contract",
       "tests.test_project_structure"
     ],
     "icarus": [
@@ -26,14 +26,11 @@
       "frame_rx_tb",
       "frame_tx_tb",
       "project_adapter_tb",
-      "project_adapter_motor_compat_tb",
       "pwm_scheduler_tb",
       "door_motor_engine_tb",
       "door_motor_engine_stop_tb",
       "door_action_dispatcher_tb",
-      "door_action_dispatcher_axis3_tb",
-      "door_motor_engine_axis3_tb",
-      "startup_close_seek_axis3_tb",
+      "startup_close_seek_tb",
       "temperature_reader_tb",
       "frame_tx_uart_tx_tb",
       "temperature_reader_config_tb",
@@ -43,9 +40,7 @@
       "output_target_ram_tb",
       "host_watchdog_tb",
       "shared_500us_tick_tb",
-      "startup_close_seek_tb",
       "startup_motor_stop_tb",
-      "intake_solenoid_adapter_tb",
       "prod2u_por_tb"
     ],
     "verilator": ["prod2u_door_temp_top_lint"],
@@ -59,7 +54,7 @@
       {"name": "pwm_scheduler_contract", "tasks": ["prove"]},
       {"name": "host_watchdog_contract", "tasks": ["prove"]},
       {"name": "startup_close_seek", "tasks": ["bmc", "cover"]},
-      {"name": "runtime_limit_inertness", "tasks": ["bmc", "cover"]},
+      {"name": "runtime_limit_hard_stop", "tasks": ["bmc", "cover"]},
       {"name": "door_action_dispatcher_axis3", "tasks": ["bmc", "cover"]}
     ]
   }

+ 0 - 1
config/source_closure.json

@@ -17,7 +17,6 @@
     "src/modules/startup_close_seek.v",
     "src/modules/door_motor_engine.v",
     "src/modules/door_action_dispatcher.v",
-    "src/modules/intake_solenoid_adapter.v",
     "src/modules/i2c_word_reader.v",
     "src/modules/temperature_reader.v",
     "src/modules/temperature_ram.v",

+ 13 - 8
constraints/prod2u_p4_normal_v3.adc

@@ -17,11 +17,16 @@ set_pin_assignment { fan_pwm_out[0] } { LOCATION = B1; IOSTANDARD = LVCMOS33; PU
 set_pin_assignment { fan_pwm_out[1] } { LOCATION = C4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
 set_pin_assignment { fan_pwm_out[2] } { LOCATION = B5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
 set_pin_assignment { fan_pwm_out[3] } { LOCATION = A14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { motor_en_n } { LOCATION = T7; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { x_step } { LOCATION = R6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { x_dir } { LOCATION = R8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { y_step } { LOCATION = T3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { y_dir } { LOCATION = R4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { x_limit_raw } { LOCATION = M6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { y_limit_raw } { LOCATION = F9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { intake_solenoid_out } { LOCATION = P2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { motor_en_n } { LOCATION = C11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { x_step } { LOCATION = C12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { x_dir } { LOCATION = B12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { y_step } { LOCATION = L12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { y_dir } { LOCATION = J11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { z_step } { LOCATION = L14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { z_dir } { LOCATION = K14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { x_limit_ls } { LOCATION = A5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { x_limit_hs } { LOCATION = B6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { y_limit_ls } { LOCATION = C8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { y_limit_hs } { LOCATION = A8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { z_limit_ls } { LOCATION = K16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { z_limit_hs } { LOCATION = J15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }

+ 49 - 95
docs/IO_EVIDENCE_MATRIX.zh-CN.md

@@ -1,95 +1,49 @@
-# Prod2U V1.2 端到端 IO 证据矩阵
-
-run_id: `con138-141-20260805T061504Z`  
-matrix_version: `v1.2-e2e-con138-141`  
-board: `FCB FPGA+MCU V1.2 20260717`  
-device: `EF2L45BG256B` (BG256)
-
-本矩阵区分 **产品逻辑角色** 与 **V1.2 板级物理路径**。结论仅允许:`confirmed` | `inferred` | `blocked`。  
-**禁止**把旧固件/旧 connector 丝印直接当作 V1.2 实锤;旧 0611 原理图只作交叉参考。
-
-## 证据源(本轮只读)
-
-| 源 | 路径 | 用途 |
-|----|------|------|
-| V1.2 BRD | `reference/original/board/FCB_FPGA_MCU_V1.2_20260717/FCB_FPGA+MCU_V1.2_20260717.brd` | 原始板库(Allegro;hash confirmed) |
-| board-viewer 产物 | `tools/board-viewer/generated/board-data.json` | 首选:连接器焊盘→网络→FPGA 球 |
-| V1.2 注释 | `config/board_viewer_annotations.fcb_fpga_mcu_v1_2.json` | CON138–141 EX_GPIO 路径 |
-| 0611 原理图 PDF | `reference/original/schematics/FCB_FPGA+MCU0611.pdf` | FAN_GPIO/HEAT/UART 功能表与球位 |
-| 产品合同 | `projects/prod2u-door-temp/project.json` + `AGENTS.md` | 逻辑角色与 active ADC **25** 球 |
-
-## 判定规则
-
-| 等级 | 含义 |
-|------|------|
-| **confirmed** | V1.2 `board-data` 路径为 `cross_verified`/`verified_fpga`,或 V1.2 板库路径与 0611 PDF 功能表在 **同一 FPGA 球 / 功能网** 上一致 |
-| **inferred** | 物理球/连接器有板级证据,但 **产品角色**(限位/轴号/进风电磁铁)无板网命名实锤,或为产品重映射到通用 EX_GPIO |
-| **blocked** | V1.2 无可用连接器/球路径,或候选网络语义冲突且不足以绑定 ADC |
-
-Active ADC(`constraints/prod2u_p4_normal_v3.adc`)绑定 PTC/FAN/UART/I2C **confirmed** 球,以及 CON138–141 上的电机/限位/电磁铁 **inferred** 球(25 脚合计)。
-
-## 统计(本矩阵主表行)
-
-| 等级 | 行数 |
-|------|-----:|
-| confirmed | 17 |
-| inferred | 12 |
-| blocked | 4 |
-| **合计** | **33** |
-
----
-
-## A. 已确认(confirmed)— 物理路径可进 ADC
-
-| # | 产品角色 | 板级信号 | V1.2 连接器.针 | FPGA 球 | 证据要点 |
-|--:|----------|----------|---------------|---------|----------|
-| 1 | 系统时钟 | SYS_CLK / DEV_SYS_CLK | (片内/时钟网络) | J1 | 0611 PDF p3 + 既有 TD ADC 基线 |
-| 2 | UART RX | UART2_RX / RS232_RX2 | CON78.2 | N11 | V1.2 cross_verified:CON78→U23→N11 |
-| 3 | UART TX | UART2_TX / RS232_TX2 | CON78.1 | M10 | 同上 → M10 |
-| 4 | I2C SCL | CT7428 总线 | (片上 I2C;远端二极管座 CON53 等) | M8 | board-data / 注释交叉;产品 27 值 |
-| 5 | I2C SDA | CT7428 总线 | 同上 | N9 | 同上 |
-| 6–13 | PTC 腔1–4 物理对 | HEAT* | CON18/27/28/29 | G16/F16/N1/M1/R16/P16/P9/T9 | cross_verified 高边路径 |
-| 14–17 | FAN 腔1–4 | FAN_PWM* | CON25/8/24/26 | B1/C4/B5/A14 | cross_verified;FPGA 侧 active-low |
-
-> 极性:PTC active-high;FAN 在 FPGA 球 active-low。限位 active-high;EN_n active-low;电磁铁 open=high。
-
----
-
-## B. 推断(inferred)— CON138–141 产品重映射
-
-| # | 产品角色 | 连接器.针 | 网 | FPGA 球 | 说明 |
-|--:|----------|-----------|----|---------|------|
-| 18 | X STEP | CON139.1 | EX_GPIO25 | R6 | 通用 EX_GPIO;产品轴角色 inferred |
-| 19 | X DIR | CON139.2 | EX_GPIO26 | R8 | 同上 |
-| 20 | motor_en_n | CON139.3 | EX_GPIO27 | T7 | 自 CON125.4/A10 迁出;极性仍 active-low |
-| 21 | Y STEP | CON138.1 | EX_GPIO21 | T3 | 同上 |
-| 22 | Y DIR | CON138.2 | EX_GPIO22 | R4 | 同上 |
-| 23 | X limit | CON68.3 | FAN_GPIO47 | M6 | 复用风扇6 转速脚;startup-only;active-high @ FPGA |
-| 24 | Y limit | CON34.3 | FAN_GPIO11 | F9 | 复用风扇10 转速脚;直连数字输入;startup-only;active-high @ FPGA |
-| 25 | intake_solenoid_out | CON141.1 | EX_GPIO33 | P2 | 无板级 solenoid 网名;外部驱动未确认 |
-
-限位装配注:CON68/CON34 的 pin1=GND、pin2=+12V_FAN* 禁止接限位信号;pin3 均为 tach→FPGA 数字输入(X: M6;Y: F9)。旧 CON68.4/L8(OC PWM)已退役,不再作 Y 限位。
-
-历史路径(已退役产品 LOC,保留证据):C11/B12/D15/H14/A10/B9/A11/T11/P13/L8 仍可在 board-data 中查到,但 **不再** 写入活动 ADC。
-
----
-
-## C. 阻断(blocked)— 不得当作确认进风/限位丝印
-
-| # | 产品角色 | 候选 | 状态 | 阻断原因 |
-|--:|----------|------|------|----------|
-| 30 | X 限位 = CON30.3(V1.2 丝印) | CON30.3 | **blocked** | V1.2 无 CON30;产品现用 CON68.3/M6 |
-| 31 | 进风门座 CON124 | WATER_COOL_V+ → A11 | blocked | 水冷语义;与历史 y_limit 同球冲突 |
-| 32 | 进风门座 CON144–146 | KEYLED → N6/P6/N7 | blocked | 键灯网络 |
-| 33 | CON104/105/106 直接当进出风轴 | PUL/DIR | blocked | 无产品轴角色交叉验证 |
-
----
-
-## D. Active ADC 策略
-
-- **25 球**:时钟+UART+I2C+8 PTC+4 FAN+EN+X/Y STEP/DIR+X/Y limit+`intake_solenoid_out`。
-- CON138–141 pins 1–4 为非保留 EX_GPIO;pins 5–6 为 GND(不可占用)。
-- 电磁铁:仅逻辑电平球;**不**宣称板载功率驱动已确认。
-
-机器可读摘要:[`config/pin_inventory.prod2u_door_temp_v1_2.json`](../config/pin_inventory.prod2u_door_temp_v1_2.json)。  
-上电/联调顺序与期望波形:[`HARDWARE_TEST_ORDER_WAVEFORMS.zh-CN.md`](HARDWARE_TEST_ORDER_WAVEFORMS.zh-CN.md)。
+# Prod2U V1.2 IO Evidence Matrix
+
+权威 BRD:`FCB_FPGA_MCU_V1.2_20260717.brd`  
+SHA-256:`269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb`  
+(`reference/original/board/...` 与 `reference/original/local_archives/board/...` 字节相同;打包仅保留一份实体 + alias)
+
+证据等级:`confirmed` = BRD/KiCad 网表追踪到 FPGA 球;`inferred` = 路径确认但外部驱动极性/装配待 bring-up;`blocked` = 不进入活动 ADC。
+
+## 活动产品 IO(三轴六限位)
+
+| # | 信号 | 连接器.针 | 板级网 | FPGA | 等级 | 备注 |
+|---|------|-----------|--------|------|------|------|
+| 1 | sys_clk | — | — | J1 | confirmed | 25 MHz |
+| 2 | host_uart_rx | — | — | N11 | confirmed | |
+| 3 | host_uart_tx | — | — | M10 | confirmed | |
+| 4 | temp_scl | — | — | M8 | confirmed | |
+| 5 | temp_sda | — | — | N9 | confirmed | |
+| 6-13 | ptc_pwm_out[0:7] | CON18/27/28/29 | HEAT* | G16,F16,N1,M1,R16,P16,P9,T9 | confirmed | active-high |
+| 14-17 | fan_pwm_out[0:3] | CON25/8/24/26 | FAN_PWM* | B1,C4,B5,A14 | confirmed | FPGA active-low |
+| 18 | motor_en_n | CON120.2 | ENA → BANK0_GPIO2 | C11 | confirmed | FPGA 恒 1;板级 NPN 反相开集;`inferred` 座端有效电平需 bring-up 确认 |
+| 19 | x_step | CON104.2 | PUL1 → BANK0_GPIO15 | C12 | confirmed | |
+| 20 | x_dir | CON104.3 | DIR1 → BANK0_GPIO16 | B12 | confirmed | |
+| 21 | y_step | CON105.2 | PUL2 | L12 | confirmed | |
+| 22 | y_dir | CON105.3 | DIR2 | J11 | confirmed | |
+| 23 | z_step | CON106.2 | PUL3 | L14 | confirmed | |
+| 24 | z_dir | CON106.3 | DIR3 | K14 | confirmed | |
+| 25 | x_limit_ls (LS1) | CON12.1 | EX_GPIO1 → BANK0_LVDS2_P | A5 | confirmed | active-high;非 GND |
+| 26 | x_limit_hs (HS1) | CON12.2 | EX_GPIO2 → BANK0_LVDS2_N | B6 | confirmed | active-high;非 +12V |
+| 27 | y_limit_ls (LS2) | CON12.3 | EX_GPIO3 → BANK0_LVDS3_P | C8 | confirmed | 非 A11 |
+| 28 | y_limit_hs (HS2) | CON12.4 | EX_GPIO4 → BANK0_LVDS3_N | A8 | confirmed | 非 C11 |
+| 29 | z_limit_ls (LS3) | CON129.1 | EX_GPIO17 → CPLD_GPIO17 | K16 | confirmed | |
+| 30 | z_limit_hs (HS3) | CON129.2 | EX_GPIO18 → CPLD_GPIO18 | J15 | confirmed | |
+
+活动 ADC:**30** 用户脚(上表 1–30;时钟计入约束文件)。无 solenoid。
+
+## Inventory-only(不进活动控制)
+
+| 信号 | 连接器.针 | FPGA | 备注 |
+|------|-----------|------|------|
+| LS4 | CON129.3 | H15 | 不创建第四轴 |
+| HS4 | CON129.4 | H16 | 不创建第四轴 |
+
+## 已退役产品 LOC(勿写回活动 ADC)
+
+CON68.3/M6、CON34.3/F9、CON138–141 电机/电磁铁旧映射、CON12=dual-gpio-12v(A11/C11/GND/+12V) 错误注解、CON140 旧限位探针。
+
+## Hardware validation
+
+**NOT RUN**(本轮 Linux 收口不接触 COM/JTAG)。

Разница между файлами не показана из-за своего большого размера
+ 41 - 34
docs/REFERENCE-INVENTORY.json


Разница между файлами не показана из-за своего большого размера
+ 11 - 11
docs/REFERENCE-INVENTORY.md


+ 42 - 61
docs/prod2u-door-temp-protocol.zh-CN.md

@@ -1,78 +1,59 @@
-# Prod2U 门控温度 UART 合同(11 字节 SET_ALL)
+# Prod2U 门与温度协议(活动合同)
 
-## 产品范围
+**四腔热控 + 腔体 1 三风门**:payload 含 4 路风扇、4 路 chamber PTC(各复制到 2 路物理 PTC PWM)、腔体 1 的 Z(进风)+ X/Y(出风)步进门动作。温度 GET 仍返回 **27** 个值。
 
-**四腔热控 + 腔体 1 三风门**:payload 含 4 路风扇、4 路 chamber PTC(各复制到 2 路物理 PTC PWM)、腔体 1 进风门 + 出风门 X/Y 动作。温度 GET 仍返回 **27** 个值。
+权威源:`projects/prod2u-door-temp/project.json`、`projects/prod2u-door-temp/requirements.zh-CN.md`、本文件、`AGENTS.md`。
 
-## 物理层
+## UART
 
-UART 固定为 `115200 8N1`、无流控,主时钟为 25 MHz,每 bit 为 217 个时钟。RX 为 `N11`,TX 为 `M10`;I2C SCL 为 `M8`,SDA 为 `N9`。
+- 25 MHz 系统时钟,115200 8N1,217 clocks/bit
+- 帧头 `A5 5A`,CRC-16/CCITT-FALSE(覆盖 type+length+payload,小端)
+- 支持:`0x01 SET_ALL`、`0x02 GET_TEMPERATURE`、`0x82 TEMPERATURE_DATA`
+- 无 ACK / BUSY / ERROR / 命令队列 / 抢占
 
-## 帧格式
+## SET_ALL(11 字节)
 
-```text
-A5 5A type payload_length payload crc16_low crc16_high
-```
+| Offset | 字段 | 取值 |
+|--------|------|------|
+| 0..3 | FAN1..4 占空比 | 0..100 |
+| 4..7 | Chamber PTC1..4 占空比 | 0..100(各复制到 2 路物理 PTC) |
+| 8 | Z 门(进风步进) | 00/01/02 |
+| 9 | X 门(出风步进) | 00/01/02 |
+| 10 | Y 门(出风步进) | 00/01/02 |
 
-CRC 为 CRC-16/CCITT-FALSE,初值 `0xFFFF`、多项式 `0x1021`,覆盖 type、length 和全部 payload,不覆盖帧头;线路顺序为低字节在前。
+### 门动作字节语义(三轴步进)
 
-正式类型只有:
+| 值 | 含义 |
+|----|------|
+| 00 | 不启动新 jog(已在运动则忽略;不改变 EN) |
+| 01 | 打开方向(DIR=0,目标 HS),最多 450 STEP 上升沿 |
+| 02 | 关闭方向(DIR=1,目标 LS),最多 450 STEP 上升沿 |
 
-| 类型 | payload | 行为 |
-| --- | ---: | --- |
-| `01` SET_ALL | 11 字节 | 4 fan + 4 chamber PTC + 3 door;成功后无回复 |
-| `02` GET_TEMPERATURE | 0 字节 | 完成 27 项读取后只回复一个 `82` 帧 |
-| `82` TEMPERATURE_DATA | 27 字节 | 温度响应,总帧长 33 字节 |
+busy 期间新的门命令全部忽略(无 latest-wins)。看门狗超时:停止 STEP,PTC=0、FAN=20;EN 仍永久有效。
 
-### SET_ALL 11 字节布局
+## 物理映射(V1.2 BRD)
 
-| 偏移 | 字段 | 范围 |
-| ---: | --- | --- |
-| 0–3 | 腔体 1–4 风扇 | 0..100 |
-| 4–7 | 腔体 1–4 PTC | 0..100(各复制到 2 路物理 PWM) |
-| 8 | 腔体 1 进风门(默认电磁铁) | 00/01/02 |
-| 9 | 出风门 X(步进马达) | 00/01/02 |
-| 10 | 出风门 Y(步进马达) | 00/01/02 |
+| 角色 | 连接器 | FPGA |
+|------|--------|------|
+| X STEP/DIR | CON104.2/3 | C12/B12 |
+| Y STEP/DIR | CON105.2/3 | L12/J11 |
+| Z STEP/DIR | CON106.2/3 | L14/K14 |
+| EN | CON120.2 | C11(FPGA 恒 1;板级 NPN 反相) |
+| LS1/HS1/LS2/HS2 | CON12.1–4 | A5/B6/C8/A8 |
+| LS3/HS3 | CON129.1/2 | K16/J15 |
+| LS4/HS4 | CON129.3/4 | H15/H16(仅 inventory) |
 
-### 门动作字节语义(马达 vs 电磁铁)
+限位高有效。运行期与 startup 均硬停:DIR=1 看 LS,DIR=0 看 HS。
 
-同一编码 `00/01/02`,**按执行器类型解释不同**:
+## Startup(上电一拍)
 
-| 值 | 步进马达(出风门 X/Y,及 motor-compat 进风轴) | 电磁铁(生产进风门) |
-| --- | --- | --- |
-| `00` | **stop**:不启动新的 jog;无新 STEP 上升沿 | **hold**:保持当前开/关 latch,不去激励翻转 |
-| `01` | 开门:DIR=0,固定 450 步 @ 1000 step/s | open latched(激励到开位语义) |
-| `02` | 关门:DIR=1,固定 450 步 @ 1000 step/s | closed latched |
+1. 六路限位 2FF 同步后:已在 LS 的轴不运动。
+2. 其余轴 DIR=1 关向搜索,最多 **5000** 个 STEP 上升沿;命中 LS 的轴立即停。
+3. 仅对仍未命中 LS 的轴做 DIR=0 回退最多 **500** 步(途中 HS 可提前停)。
+4. `startup_done` 粘性置位后才接受主机命令;限位不再用于标定/位置模型。
 
-说明:
+普通命令 jog = **450** 步 @ 1000 step/s。无电磁铁、无 motor-compat 双 profile。
 
-- 不要把马达 `00` 写成“心跳保持”、也不要把电磁铁 `00` 写成“停止步进”。
-- X/Y 步进可并行;主机合同假设:马达运行中不发新命令。
-- 看门狗超时:马达停止;电磁铁去激励(inactive),见 `project.json` / requirements。
+## Hardware validation
 
-**Golden vectors:**
-
-```text
-A55A010B00000000000000000000005873
-A55A010B0A141E280019326401020087D5
-```
-
-length `0x0E`(14 字节旧格式)及任何非法字段/CRC/长度均**静默丢弃**,无部分更新。无 ACK 帧。
-
-## PTC/FAN 与 ADC
-
-PTC 8 路物理 PWM 由 4 个 chamber 逻辑值复制。FAN 4 路独立。PWM ~20 Hz,duty 0..100。PTC active-high;FAN FPGA active-low(top 反相)。
-
-进风门默认 **电磁铁**(`intake_solenoid_out`);物理球 **CON141.1 / P2**(`inferred` LOC),见 [`IO_EVIDENCE_MATRIX.zh-CN.md`](IO_EVIDENCE_MATRIX.zh-CN.md)。外部驱动/线圈极性未板级确认。
-
-## 马达、限位和看门狗
-
-出风门 X/Y:450 步 jog,1000 step/s。限位 **仅 startup** 使用(CON68.3/M6、CON34.3/F9;旧 CON68.4/L8、CON140/T11·P13 与 B9/A11 已退役);运行期 limit 不干预 STEP。看门狗 10 s → PTC=0、FAN=20,马达停止,电磁铁去激励。
-
-## 温度读取
-
-不变:CT7428 三芯片 27 值;GET `A5 5A 02 00 6D 7B`。
-
-## 历史
-
-14 字节 SET_ALL 与 Windows 最终包时代叙述已作废,见 [`docs/historical/`](historical/)。
+**NOT RUN**

+ 0 - 7
projects/prod2u-door-temp-motor-compat/NOTES.zh-CN.md

@@ -1,7 +0,0 @@
-# Motor-compat intake profile(非生产)
-
-- **默认生产**仍为电磁铁进风门(`prod2u-door-temp` / `P4_INTAKE_ACTUATOR_SOLENOID=1` / `AXIS_COUNT=2`)。
-- 本变体 `prod2u-motor-compat-intake-v1`:`intake_actuator=motor`,`AXIS_COUNT=3`,SET_ALL 字节 8 → 进风电机(00 停 / 01 DIR=0 / 02 DIR=1,450 步 @ 1000 step/s,最新覆盖)。
-- Top:`src/top/prod2u_p4_motor_compat_top.v`;参数:`src/generated/prod2u_door_temp_motor_compat_params.vh`。
-- `intake_step` / `intake_dir` / `intake_limit_raw` **仅仿真端口**,不进生产 ADC;物理球 **blocked**。
-- UART 11 字节载荷与 27 温度字段不变。

+ 0 - 437
projects/prod2u-door-temp-motor-compat/project.json

@@ -1,437 +0,0 @@
-{
-  "project_id": "prod2u-door-temp-motor-compat",
-  "profile": "prod2u-motor-compat-intake-v1",
-  "display_name": "Prod2U door/temp motor-compat intake (non-production)",
-  "device": {
-    "family": "EF2",
-    "part": "EF2L45BG256B",
-    "clock_hz": 25000000,
-    "clock_ball": "J1"
-  },
-  "uart": {
-    "baud": 115200,
-    "data_bits": 8,
-    "parity": "N",
-    "stop_bits": 1,
-    "flow_control": "none",
-    "clks_per_bit": 217,
-    "inter_byte_timeout_ms": 10,
-    "rx_ball": "N11",
-    "tx_ball": "M10"
-  },
-  "outputs": {
-    "ptc_count": 8,
-    "fan_count": 4,
-    "chamber_ptc_count": 4,
-    "chamber_ptc_pairs": [
-      {
-        "chamber": 1,
-        "ptc_indices": [
-          0,
-          1
-        ]
-      },
-      {
-        "chamber": 2,
-        "ptc_indices": [
-          2,
-          3
-        ]
-      },
-      {
-        "chamber": 3,
-        "ptc_indices": [
-          4,
-          5
-        ]
-      },
-      {
-        "chamber": 4,
-        "ptc_indices": [
-          6,
-          7
-        ]
-      }
-    ],
-    "ptc_channels": [
-      {
-        "index": 0,
-        "name": "ptc1",
-        "signal": "ptc_pwm_out[0]",
-        "board_signal": "HEAT2",
-        "ball": "G16",
-        "connector": "CON18",
-        "connector_pin": 3,
-        "polarity": "active_high"
-      },
-      {
-        "index": 1,
-        "name": "ptc2",
-        "signal": "ptc_pwm_out[1]",
-        "board_signal": "HEAT1",
-        "ball": "F16",
-        "connector": "CON18",
-        "connector_pin": 1,
-        "polarity": "active_high"
-      },
-      {
-        "index": 2,
-        "name": "ptc3",
-        "signal": "ptc_pwm_out[2]",
-        "board_signal": "HEAT8",
-        "ball": "N1",
-        "connector": "CON27",
-        "connector_pin": 3,
-        "polarity": "active_high"
-      },
-      {
-        "index": 3,
-        "name": "ptc4",
-        "signal": "ptc_pwm_out[3]",
-        "board_signal": "HEAT7",
-        "ball": "M1",
-        "connector": "CON27",
-        "connector_pin": 1,
-        "polarity": "active_high"
-      },
-      {
-        "index": 4,
-        "name": "ptc5",
-        "signal": "ptc_pwm_out[4]",
-        "board_signal": "HEAT14",
-        "ball": "R16",
-        "connector": "CON28",
-        "connector_pin": 3,
-        "polarity": "active_high"
-      },
-      {
-        "index": 5,
-        "name": "ptc6",
-        "signal": "ptc_pwm_out[5]",
-        "board_signal": "HEAT13",
-        "ball": "P16",
-        "connector": "CON28",
-        "connector_pin": 1,
-        "polarity": "active_high"
-      },
-      {
-        "index": 6,
-        "name": "ptc7",
-        "signal": "ptc_pwm_out[6]",
-        "board_signal": "HEAT20",
-        "ball": "P9",
-        "connector": "CON29",
-        "connector_pin": 3,
-        "polarity": "active_high"
-      },
-      {
-        "index": 7,
-        "name": "ptc8",
-        "signal": "ptc_pwm_out[7]",
-        "board_signal": "HEAT19",
-        "ball": "T9",
-        "connector": "CON29",
-        "connector_pin": 1,
-        "polarity": "active_high"
-      }
-    ],
-    "fan_channels": [
-      {
-        "index": 0,
-        "name": "fan1",
-        "signal": "fan_pwm_out[0]",
-        "board_signal": "FAN_PWM3",
-        "ball": "B1",
-        "connector": "CON25",
-        "connector_pin": 7,
-        "polarity": "active_low"
-      },
-      {
-        "index": 1,
-        "name": "fan2",
-        "signal": "fan_pwm_out[1]",
-        "board_signal": "FAN_PWM1",
-        "ball": "C4",
-        "connector": "CON8",
-        "connector_pin": 7,
-        "polarity": "active_low"
-      },
-      {
-        "index": 2,
-        "name": "fan3",
-        "signal": "fan_pwm_out[2]",
-        "board_signal": "FAN_PWM2",
-        "ball": "B5",
-        "connector": "CON24",
-        "connector_pin": 7,
-        "polarity": "active_low"
-      },
-      {
-        "index": 3,
-        "name": "fan4",
-        "signal": "fan_pwm_out[3]",
-        "board_signal": "FAN_PWM4",
-        "ball": "A14",
-        "connector": "CON26",
-        "connector_pin": 7,
-        "polarity": "active_low"
-      }
-    ],
-    "pwm_bits": 8,
-    "pwm_internal_width": 7,
-    "pwm_max_duty": 100,
-    "pwm_phase_count": 100,
-    "pwm_slot_clks": 1042,
-    "pwm_frequency_hz": 20,
-    "pwm_actual_frequency_hz": 19.993602047,
-    "ptc_polarity": "active_high",
-    "fan_polarity": "active_low",
-    "ptc_default": 0,
-    "fan_default": 10,
-    "fan_connector_active_level": "high",
-    "fan_board_inverts": true,
-    "boot_targets": {
-      "ptc": 0,
-      "fan": 10
-    }
-  },
-  "doors": {
-    "scope": "four_chamber_thermal_plus_chamber1_three_doors",
-    "chamber_controlled": 1,
-    "intake_actuator": "motor",
-    "intake_motor_profile_available": true,
-    "exhaust_axes": [
-      "x",
-      "y"
-    ],
-    "solenoid": {
-      "signal": "intake_solenoid_out",
-      "evidence_status": "blocked",
-      "open_level": "high",
-      "closed_level": "low",
-      "inactive_level": "low",
-      "notes": "Production solenoid profile remains default. This motor-compat variant does not instantiate the solenoid; intake uses a third motor axis. Physical ball still blocked."
-    },
-    "intake_motor": {
-      "signal": "intake_step/intake_dir",
-      "evidence_status": "blocked",
-      "package": false,
-      "notes": "Non-production sim-only ports; no ADC LOC. Physical mapping blocked."
-    }
-  },
-  "motors": {
-    "count": 3,
-    "order": [
-      "x",
-      "y",
-      "intake"
-    ],
-    "role": "exhaust_plus_intake_motor_compat",
-    "fixed_steps": 450,
-    "execution": "overlap",
-    "busy_wait_ms": 600,
-    "step_rate_hz": 1000,
-    "step_half_cycles": 12500,
-    "dir_setup_cycles": 25000,
-    "command_values": [
-      0,
-      1,
-      2
-    ],
-    "heartbeat_value": 0,
-    "open_dir_value": 0,
-    "close_dir_value": 1,
-    "mapping": {
-      "x": {
-        "axis": "x",
-        "role": "exhaust",
-        "step_ball": "C11",
-        "dir_ball": "B12"
-      },
-      "y": {
-        "axis": "y",
-        "role": "exhaust",
-        "step_ball": "D15",
-        "dir_ball": "H14"
-      },
-      "intake": {
-        "axis": "intake",
-        "role": "intake",
-        "step_ball": null,
-        "dir_ball": null,
-        "evidence_status": "blocked",
-        "package": false,
-        "notes": "Sim-only; not in production ADC."
-      }
-    },
-    "enable_n": {
-      "ball": "A10",
-      "active_level": "low",
-      "policy": "shared_constant_low"
-    }
-  },
-  "limits": {
-    "limit_count": 3,
-    "active_level": "high",
-    "functional_use": true,
-    "runtime_use": false,
-    "startup": {
-      "enabled": true,
-      "direction_value": 1,
-      "direction_meaning": "close",
-      "burst_step_count": 450,
-      "burst_step_rate_hz": 1000,
-      "inter_burst_ms": 50,
-      "max_bursts": 10,
-      "axis_order": [
-        "x",
-        "y",
-        "intake"
-      ],
-      "limit_stop_during_burst": true,
-      "stop_semantics": "finish_current_high_pulse_then_no_next_rising_edge",
-      "additional_rising_edges_after_synchronized_limit": 0,
-      "runtime_limit_use": false
-    },
-    "channels": [
-      {
-        "name": "x_limit_raw",
-        "ball": "B9"
-      },
-      {
-        "name": "y_limit_raw",
-        "ball": "A11"
-      },
-      {
-        "name": "intake_limit_raw",
-        "ball": null,
-        "evidence_status": "blocked",
-        "package": false,
-        "notes": "Sim-only third close-limit; not in production ADC."
-      }
-    ]
-  },
-  "temperature": {
-    "value_count": 27,
-    "device_addresses": [
-      73,
-      72,
-      75
-    ],
-    "registers": [
-      0,
-      1,
-      2,
-      3,
-      4,
-      5,
-      6,
-      7,
-      8
-    ],
-    "scl_ball": "M8",
-    "sda_ball": "N9",
-    "bus": "i2c",
-    "device": "CT7428",
-    "invalid_value": 255,
-    "maximum_celsius": 150,
-    "conversion": {
-      "profile": "ct7428-msb-integer",
-      "raw_shift": 7,
-      "raw_width": 9,
-      "reject_sign_bit": true
-    }
-  },
-  "pins": {
-    "host_uart_rx": "N11",
-    "host_uart_tx": "M10",
-    "temp_scl": "M8",
-    "temp_sda": "N9",
-    "ptc_pwm": [
-      "G16",
-      "F16",
-      "N1",
-      "M1",
-      "R16",
-      "P16",
-      "P9",
-      "T9"
-    ],
-    "fan_pwm": [
-      "B1",
-      "C4",
-      "B5",
-      "A14"
-    ],
-    "motor_en_n": "A10",
-    "x_step": "C11",
-    "x_dir": "B12",
-    "y_step": "D15",
-    "y_dir": "H14",
-    "x_limit_raw": "B9",
-    "y_limit_raw": "A11"
-  },
-  "resource_policy": {
-    "target_ram": "optional",
-    "request_ram": "optional",
-    "temperature_ram": "optional",
-    "dsp": 0,
-    "shared_pwm_comparators": 1,
-    "shared_motor_executors": 1,
-    "shared_i2c_readers": 1
-  },
-  "protocol": {
-    "header_hex": "A55A",
-    "crc": {
-      "name": "CRC-16/CCITT-FALSE",
-      "polynomial": 4129,
-      "initial": 65535,
-      "reflect_input": false,
-      "reflect_output": false,
-      "xor_output": 0,
-      "coverage": "type_length_payload",
-      "wire_order": "little"
-    },
-    "commands": {
-      "set_all": 1,
-      "get_temperature": 2,
-      "temperature_data": 130
-    },
-    "set_all": {
-      "payload_length": 11,
-      "fan_offset": 0,
-      "chamber_ptc_offset": 4,
-      "chamber_ptc_count": 4,
-      "intake_door_offset": 8,
-      "exhaust_x_offset": 9,
-      "exhaust_y_offset": 10,
-      "legacy_payload_length_rejected": 14,
-      "duty_min": 0,
-      "duty_max": 100,
-      "door_values": [
-        0,
-        1,
-        2
-      ],
-      "response": "none"
-    },
-    "temperature_data": {
-      "payload_length": 27,
-      "frame_length": 33
-    }
-  },
-  "timeouts": {
-    "frame_inter_byte_ms": 10,
-    "host_get_response_ms": 5000
-  },
-  "watchdog": {
-    "timeout_seconds": 10,
-    "tick_us": 500,
-    "tick_clks": 12500,
-    "timeout_ticks": 20000,
-    "target": {
-      "ptc": 0,
-      "fan": 20
-    }
-  }
-}

+ 43 - 39
projects/prod2u-door-temp/project.json

@@ -63,25 +63,12 @@
   "doors": {
     "scope": "four_chamber_thermal_plus_chamber1_three_doors",
     "chamber_controlled": 1,
-    "intake_actuator": "solenoid",
-    "intake_motor_profile_available": true,
-    "exhaust_axes": ["x", "y"],
-    "solenoid": {
-      "signal": "intake_solenoid_out",
-      "ball": "P2",
-      "connector": "CON141",
-      "connector_pin": 1,
-      "evidence_status": "inferred",
-      "open_level": "high",
-      "closed_level": "low",
-      "inactive_level": "low",
-      "notes": "Product remap: CON141.1 EX_GPIO33→P2 (series R). Connector→ball path is board-data backed; external driver/coil polarity not confirmed — evidence grade inferred."
-    }
+    "door_axes": ["x", "y", "z"]
   },
   "motors": {
-    "count": 2,
-    "order": ["x", "y"],
-    "role": "exhaust",
+    "count": 3,
+    "order": ["x", "y", "z"],
+    "role": "door",
     "fixed_steps": 450,
     "execution": "overlap",
     "busy_wait_ms": 600,
@@ -93,33 +80,44 @@
     "open_dir_value": 0,
     "close_dir_value": 1,
     "mapping": {
-      "x": {"axis": "x", "role": "exhaust", "step_ball": "R6", "dir_ball": "R8"},
-      "y": {"axis": "y", "role": "exhaust", "step_ball": "T3", "dir_ball": "R4"}
+      "x": {"axis": "x", "role": "door", "step_ball": "C12", "dir_ball": "B12", "step_connector": "CON104", "step_connector_pin": 2, "dir_connector": "CON104", "dir_connector_pin": 3},
+      "y": {"axis": "y", "role": "door", "step_ball": "L12", "dir_ball": "J11", "step_connector": "CON105", "step_connector_pin": 2, "dir_connector": "CON105", "dir_connector_pin": 3},
+      "z": {"axis": "z", "role": "door", "step_ball": "L14", "dir_ball": "K14", "step_connector": "CON106", "step_connector_pin": 2, "dir_connector": "CON106", "dir_connector_pin": 3}
     },
-    "enable_n": {"ball": "T7", "active_level": "low", "policy": "shared_constant_low"}
+    "enable_n": {
+      "ball": "C11",
+      "connector": "CON120",
+      "connector_pin": 2,
+      "active_level": "low",
+      "policy": "permanent_high",
+      "notes": "NPN open-collector invert at board; FPGA drives constant 1 so connector EN is permanently asserted."
+    }
   },
   "limits": {
-    "limit_count": 2,
+    "limit_count": 6,
     "active_level": "high",
     "functional_use": true,
-    "runtime_use": false,
+    "runtime_use": true,
     "startup": {
       "enabled": true,
       "direction_value": 1,
       "direction_meaning": "close",
-      "burst_step_count": 450,
-      "burst_step_rate_hz": 1000,
-      "inter_burst_ms": 50,
-      "max_bursts": 10,
-      "axis_order": ["x", "y"],
-      "limit_stop_during_burst": true,
+      "close_step_count": 5000,
+      "backoff_step_count": 500,
+      "step_rate_hz": 1000,
+      "axis_order": ["x", "y", "z"],
+      "limit_stop_during_move": true,
       "stop_semantics": "finish_current_high_pulse_then_no_next_rising_edge",
       "additional_rising_edges_after_synchronized_limit": 0,
-      "runtime_limit_use": false
+      "runtime_limit_use": true
     },
     "channels": [
-      {"name": "x_limit_raw", "ball": "M6"},
-      {"name": "y_limit_raw", "ball": "F9"}
+      {"name": "x_limit_ls", "ball": "A5", "connector": "CON12", "connector_pin": 1, "side": "low"},
+      {"name": "x_limit_hs", "ball": "B6", "connector": "CON12", "connector_pin": 2, "side": "high"},
+      {"name": "y_limit_ls", "ball": "C8", "connector": "CON12", "connector_pin": 3, "side": "low"},
+      {"name": "y_limit_hs", "ball": "A8", "connector": "CON12", "connector_pin": 4, "side": "high"},
+      {"name": "z_limit_ls", "ball": "K16", "connector": "CON129", "connector_pin": 1, "side": "low"},
+      {"name": "z_limit_hs", "ball": "J15", "connector": "CON129", "connector_pin": 2, "side": "high"}
     ]
   },
   "temperature": {
@@ -146,13 +144,19 @@
     "temp_sda": "N9",
     "ptc_pwm": ["G16", "F16", "N1", "M1", "R16", "P16", "P9", "T9"],
     "fan_pwm": ["B1", "C4", "B5", "A14"],
-    "motor_en_n": "T7",
-    "x_step": "R6",
-    "x_dir": "R8",
-    "y_step": "T3",
-    "y_dir": "R4",
-    "x_limit_raw": "M6",
-    "y_limit_raw": "F9"
+    "motor_en_n": "C11",
+    "x_step": "C12",
+    "x_dir": "B12",
+    "y_step": "L12",
+    "y_dir": "J11",
+    "z_step": "L14",
+    "z_dir": "K14",
+    "x_limit_ls": "A5",
+    "x_limit_hs": "B6",
+    "y_limit_ls": "C8",
+    "y_limit_hs": "A8",
+    "z_limit_ls": "K16",
+    "z_limit_hs": "J15"
   },
   "resource_policy": {
     "target_ram": "optional",
@@ -185,7 +189,7 @@
       "fan_offset": 0,
       "chamber_ptc_offset": 4,
       "chamber_ptc_count": 4,
-      "intake_door_offset": 8,
+      "z_door_offset": 8,
       "exhaust_x_offset": 9,
       "exhaust_y_offset": 10,
       "legacy_payload_length_rejected": 14,

+ 24 - 10
projects/prod2u-door-temp/requirements.zh-CN.md

@@ -10,12 +10,13 @@ A5 5A type payload_length payload crc16_low crc16_high
 
 CRC 为 CRC-16/CCITT-FALSE。正式类型只有 `0x01`、`0x02` 和 `0x82`。
 
-## 产品范围:四腔热控 + 腔体 1 三风门
+## 产品范围:四腔热控 + 腔体 1 三轴风门
 
 - 4 路风扇 duty(0..100),各对应一腔。
 - 4 路 chamber PTC duty,各复制到 2 路物理 PTC PWM(8 路输出严格相等)。
-- 腔体 1:进风门(默认电磁铁)、出风门 X/Y(步进 jog)。
+- 腔体 1:三轴步进风门 X/Y/Z(各 450 步 jog @ 1000 step/s,可并行)。
 - 温度:27 值 GET/响应不变。
+- 无电磁铁进风门;字节 8 为 Z 轴步进命令。
 
 ## SET_ALL(11 字节)
 
@@ -23,19 +24,32 @@ CRC 为 CRC-16/CCITT-FALSE。正式类型只有 `0x01`、`0x02` 和 `0x82`。
 | ---: | --- |
 | 0–3 | 腔体 1–4 风扇 |
 | 4–7 | 腔体 1–4 PTC |
-| 8 | 进风门 00/01/02 |
-| 9 | 出风门 X 00/01/02 |
-| 10 | 出风门 Y 00/01/02 |
+| 8 | 风门 Z 00/01/02 |
+| 9 | 风门 X 00/01/02 |
+| 10 | 风门 Y 00/01/02 |
 
 旧 14 字节格式拒绝。SET_ALL 无回复。
 
 ## 风门与马达
 
-- 编码同为 `00/01/02`,语义按执行器分流:
-  - **步进马达**(出风门 X/Y):`00` = **stop**(无新 jog);`01` 开门 DIR=0;`02` 关门 DIR=1。
-  - **电磁铁**(默认进风门):`00` = **hold**(保持 latch);`01` open latched;`02` closed latched;reset/watchdog → inactive。
-- 出风门 X/Y:450 步、1000 step/s,可并行。
-- 限位仅 startup 校准;运行期 limit 不影响 jog。
+- 三轴编码均为 `00/01/02`:`00` = **stop**(无新 jog);`01` 开门 DIR=0;`02` 关门 DIR=1。
+- 普通 jog:450 步、1000 step/s,X/Y/Z 可并行。
+- 电机 EN:CON120.2 → C11,板级 NPN 反相;FPGA 恒 1(`permanent_high`),座端 EN 永久有效。
+- 步进/方向球位:X CON104.2/3 → C12/B12;Y CON105.2/3 → L12/J11;Z CON106.2/3 → L14/K14。
+
+## 六限位与运行期硬停
+
+每轴高低侧各一限位,FPGA 端 active high,`runtime_use=true`:
+
+| 轴 | LS | HS |
+| --- | --- | --- |
+| X | CON12.1 A5 | CON12.2 B6 |
+| Y | CON12.3 C8 | CON12.4 A8 |
+| Z | CON129.1 K16 | CON129.2 J15 |
+
+- **Startup**:PTC=0、FAN=10;三轴 DIR=1 关门寻限;每轴最多 5000 步 @ 1000 step/s;未触发则回退 500 步后标记 missed;`startup_done` 粘滞。
+- **运行期**:按运动方向选择对应限位;限位有效时该轴硬停(完成当前高半周期后不再产生上升沿);busy 期间忽略新 start。
+- Startup 完成前:SET_ALL / GET_TEMPERATURE 丢弃,看门狗不喂,帧解析器保持 flush。
 
 ## 输出与看门狗
 

+ 17 - 0
receipts/board-data-con12-rebuild-20260805T171312Z.json

@@ -0,0 +1,17 @@
+{
+  "schema": "prod2u-board-data-rebuild-receipt-v1",
+  "run_id": "20260805T171312Z",
+  "note": "board-data rebuilt from cached KiCad PCB /tmp/brd-con12-KN48/board.kicad_pcb after CON12 annotation correction; SVGs retained (geometry unchanged)",
+  "pcb_cache": "/tmp/brd-con12-KN48/board.kicad_pcb",
+  "annotations_sha256": "e973619c6b3eca726796cb04b5c83ca59d6f1cc76e9284d7caf27b966a6b1f9c",
+  "board_data_sha256": "70a779a0978b84392ea5a39715e5f0d46f1ecee896b26938fee40959b96ce7f2",
+  "brd_sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
+  "con12_balls": {
+    "1": "A5",
+    "2": "B6",
+    "3": "C8",
+    "4": "A8"
+  },
+  "svg_regenerated": false,
+  "kicad_cli_full_generate": "not_run_kicad10_unavailable_used_cached_pcb"
+}

+ 66 - 0
receipts/reference-package-20260805T171312Z.json

@@ -0,0 +1,66 @@
+{
+  "schema": "prod2u-reference-package-receipt-v1",
+  "generated_at_utc": "2026-08-05T17:32:27.134064+00:00",
+  "run_id": "20260805T171312Z",
+  "package_name": "prod2u-reference-v1_2-3axis-20260805T171312Z",
+  "brd_sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb",
+  "board_data_sha256": "70a779a0978b84392ea5a39715e5f0d46f1ecee896b26938fee40959b96ce7f2",
+  "annotations_sha256": "e973619c6b3eca726796cb04b5c83ca59d6f1cc76e9284d7caf27b966a6b1f9c",
+  "checks": {
+    "brd_identical_sha": true,
+    "con12_balls": {
+      "1": "A5",
+      "2": "B6",
+      "3": "C8",
+      "4": "A8"
+    },
+    "con12_balls_ok": true,
+    "con12_not_gnd_12v_a11_c11": true,
+    "motor_paths": {
+      "CON104": {
+        "got": [
+          "B12",
+          "C12"
+        ],
+        "ok": true
+      },
+      "CON105": {
+        "got": [
+          "J11",
+          "L12"
+        ],
+        "ok": true
+      },
+      "CON106": {
+        "got": [
+          "K14",
+          "L14"
+        ],
+        "ok": true
+      },
+      "CON120": {
+        "got": [
+          "C11"
+        ],
+        "ok": true
+      },
+      "CON129": {
+        "got": [
+          "K16",
+          "J15",
+          "H15",
+          "H16"
+        ],
+        "ok": true
+      }
+    },
+    "no_dual_gpio_12v_residue": true,
+    "inventory_aligned": true
+  },
+  "status": "pass",
+  "windows_handoff": "not_reachable_/mnt/c_unavailable",
+  "fresh_extract_ok": true,
+  "zip_sha256": "b8a1dd092f453b1b25a4faf4734e8c5a404bfa38752f19fb67cf842d228ec2b1",
+  "zip_bytes": 4446292,
+  "zip_path": "/tmp/prod2u-reference-20260805T171312Z/prod2u-reference-v1_2-3axis-20260805T171312Z.zip"
+}

+ 135 - 91
schemas/project.schema.json

@@ -237,10 +237,7 @@
                                      "required":  [
                                                       "scope",
                                                       "chamber_controlled",
-                                                      "intake_actuator",
-                                                      "intake_motor_profile_available",
-                                                      "exhaust_axes",
-                                                      "solenoid"
+                                                      "door_axes"
                                                   ],
                                      "properties":  {
                                                         "scope":  {
@@ -249,21 +246,19 @@
                                                         "chamber_controlled":  {
                                                                                    "type":  "integer"
                                                                                },
-                                                        "intake_actuator":  {
-                                                                                "type":  "string"
-                                                                            },
-                                                        "intake_motor_profile_available":  {
-                                                                                               "type":  "boolean"
-                                                                                           },
-                                                        "exhaust_axes":  {
-                                                                             "type":  "array",
-                                                                             "items":  {
-                                                                                           "type":  "string"
-                                                                                       }
-                                                                         },
-                                                        "solenoid":  {
-                                                                         "type":  "object"
-                                                                     }
+                                                        "door_axes":  {
+                                                                          "type":  "array",
+                                                                          "minItems":  3,
+                                                                          "maxItems":  3,
+                                                                          "items":  {
+                                                                                        "type":  "string",
+                                                                                        "enum":  [
+                                                                                                     "x",
+                                                                                                     "y",
+                                                                                                     "z"
+                                                                                                 ]
+                                                                                    }
+                                                                      }
                                                     },
                                      "additionalProperties":  false
                                  },
@@ -331,7 +326,8 @@
                                                                          "type":  "object",
                                                                          "required":  [
                                                                                           "x",
-                                                                                          "y"
+                                                                                          "y",
+                                                                                          "z"
                                                                                       ],
                                                                          "properties":  {
                                                                                             "x":  {
@@ -339,6 +335,9 @@
                                                                                                   },
                                                                                             "y":  {
                                                                                                       "$ref":  "#/$defs/motor"
+                                                                                                  },
+                                                                                            "z":  {
+                                                                                                      "$ref":  "#/$defs/motor"
                                                                                                   }
                                                                                         },
                                                                          "additionalProperties":  false
@@ -354,12 +353,25 @@
                                                                                              "ball":  {
                                                                                                           "type":  "string"
                                                                                                       },
+                                                                                             "connector":  {
+                                                                                                               "type":  "string"
+                                                                                                           },
+                                                                                             "connector_pin":  {
+                                                                                                                   "type":  "integer"
+                                                                                                               },
                                                                                              "active_level":  {
                                                                                                                   "type":  "string"
                                                                                                               },
                                                                                              "policy":  {
-                                                                                                            "type":  "string"
-                                                                                                        }
+                                                                                                            "type":  "string",
+                                                                                                            "enum":  [
+                                                                                                                         "permanent_high",
+                                                                                                                         "shared_constant_low"
+                                                                                                                     ]
+                                                                                                        },
+                                                                                             "notes":  {
+                                                                                                           "type":  "string"
+                                                                                                       }
                                                                                          },
                                                                           "additionalProperties":  false
                                                                       }
@@ -395,12 +407,11 @@
                                                                                           "enabled",
                                                                                           "direction_value",
                                                                                           "direction_meaning",
-                                                                                          "burst_step_count",
-                                                                                          "burst_step_rate_hz",
-                                                                                          "inter_burst_ms",
-                                                                                          "max_bursts",
+                                                                                          "close_step_count",
+                                                                                          "backoff_step_count",
+                                                                                          "step_rate_hz",
                                                                                           "axis_order",
-                                                                                          "limit_stop_during_burst",
+                                                                                          "limit_stop_during_move",
                                                                                           "stop_semantics",
                                                                                           "additional_rising_edges_after_synchronized_limit",
                                                                                           "runtime_limit_use"
@@ -415,27 +426,24 @@
                                                                                             "direction_meaning":  {
                                                                                                                     "type":  "string"
                                                                                                                 },
-                                                                                            "burst_step_count":  {
+                                                                                            "close_step_count":  {
                                                                                                                    "type":  "integer"
                                                                                                                },
-                                                                                            "burst_step_rate_hz":  {
-                                                                                                                     "type":  "integer"
-                                                                                                                 },
-                                                                                            "inter_burst_ms":  {
+                                                                                            "backoff_step_count":  {
+                                                                                                                   "type":  "integer"
+                                                                                                               },
+                                                                                            "step_rate_hz":  {
                                                                                                                  "type":  "integer"
                                                                                                              },
-                                                                                            "max_bursts":  {
-                                                                                                             "type":  "integer"
-                                                                                                         },
                                                                                             "axis_order":  {
                                                                                                              "type":  "array",
                                                                                                              "items":  {
                                                                                                                           "type":  "string"
                                                                                                                       }
                                                                                                          },
-                                                                                            "limit_stop_during_burst":  {
-                                                                                                                            "type":  "boolean"
-                                                                                                                        },
+                                                                                            "limit_stop_during_move":  {
+                                                                                                                           "type":  "boolean"
+                                                                                                                       },
                                                                                             "stop_semantics":  {
                                                                                                                  "type":  "string"
                                                                                                              },
@@ -450,17 +458,11 @@
                                                                      },
                                                          "channels":  {
                                                                           "type":  "array",
-                                                                          "minItems":  2,
-                                                                          "maxItems":  2,
-                                                                          "prefixItems":  [
-                                                                                              {
-                                                                                                  "$ref":  "#/$defs/x_limit"
-                                                                                              },
-                                                                                              {
-                                                                                                  "$ref":  "#/$defs/y_limit"
-                                                                                              }
-                                                                                          ],
-                                                                          "items":  false
+                                                                          "minItems":  6,
+                                                                          "maxItems":  6,
+                                                                          "items":  {
+                                                                                        "$ref":  "#/$defs/limit_channel"
+                                                                                    }
                                                                       }
                                                      },
                                       "additionalProperties":  false
@@ -548,8 +550,14 @@
                                                      "x_dir",
                                                      "y_step",
                                                      "y_dir",
-                                                     "x_limit_raw",
-                                                     "y_limit_raw"
+                                                     "z_step",
+                                                     "z_dir",
+                                                     "x_limit_ls",
+                                                     "x_limit_hs",
+                                                     "y_limit_ls",
+                                                     "y_limit_hs",
+                                                     "z_limit_ls",
+                                                     "z_limit_hs"
                                                  ],
                                     "properties":  {
                                                        "host_uart_rx":  {
@@ -589,10 +597,28 @@
                                                        "y_dir":  {
                                                                      "type":  "string"
                                                                  },
-                                                       "x_limit_raw":  {
+                                                       "z_step":  {
+                                                                      "type":  "string"
+                                                                  },
+                                                       "z_dir":  {
+                                                                     "type":  "string"
+                                                                 },
+                                                       "x_limit_ls":  {
+                                                                           "type":  "string"
+                                                                       },
+                                                       "x_limit_hs":  {
                                                                            "type":  "string"
                                                                        },
-                                                       "y_limit_raw":  {
+                                                       "y_limit_ls":  {
+                                                                           "type":  "string"
+                                                                       },
+                                                       "y_limit_hs":  {
+                                                                           "type":  "string"
+                                                                       },
+                                                       "z_limit_ls":  {
+                                                                           "type":  "string"
+                                                                       },
+                                                       "z_limit_hs":  {
                                                                            "type":  "string"
                                                                        }
                                                    },
@@ -717,7 +743,7 @@
                                                                                             "fan_offset",
                                                                                             "chamber_ptc_offset",
                                                                                             "chamber_ptc_count",
-                                                                                            "intake_door_offset",
+                                                                                            "z_door_offset",
                                                                                             "exhaust_x_offset",
                                                                                             "exhaust_y_offset",
                                                                                             "legacy_payload_length_rejected",
@@ -739,9 +765,9 @@
                                                                                               "chamber_ptc_count":  {
                                                                                                                         "type":  "integer"
                                                                                                                     },
-                                                                                              "intake_door_offset":  {
-                                                                                                                         "type":  "integer"
-                                                                                                                     },
+                                                                                              "z_door_offset":  {
+                                                                                                                    "type":  "integer"
+                                                                                                                },
                                                                                               "exhaust_x_offset":  {
                                                                                                                        "type":  "integer"
                                                                                                                    },
@@ -909,7 +935,8 @@
                                                                 "type":  "string",
                                                                 "enum":  [
                                                                              "x",
-                                                                             "y"
+                                                                             "y",
+                                                                             "z"
                                                                          ]
                                                             },
                                                    "role":  {
@@ -922,42 +949,59 @@
                                                    "dir_ball":  {
                                                                     "type":  "string",
                                                                     "pattern":  "^[A-T](?:[1-9]|1[0-6])$"
-                                                                }
+                                                                },
+                                                   "step_connector":  {
+                                                                          "type":  "string"
+                                                                      },
+                                                   "step_connector_pin":  {
+                                                                              "type":  "integer"
+                                                                          },
+                                                   "dir_connector":  {
+                                                                         "type":  "string"
+                                                                     },
+                                                   "dir_connector_pin":  {
+                                                                             "type":  "integer"
+                                                                         }
                                                },
                                 "additionalProperties":  false
                             },
-                  "x_limit":  {
-                                  "type":  "object",
-                                  "required":  [
-                                                   "name",
-                                                   "ball"
-                                               ],
-                                  "properties":  {
-                                                     "name":  {
-                                                                  "type":  "string"
-                                                              },
-                                                     "ball":  {
-                                                                  "type":  "string"
-                                                              }
-                                                 },
-                                  "additionalProperties":  false
-                              },
-                  "y_limit":  {
-                                  "type":  "object",
-                                  "required":  [
-                                                   "name",
-                                                   "ball"
-                                               ],
-                                  "properties":  {
-                                                     "name":  {
-                                                                  "type":  "string"
-                                                              },
-                                                     "ball":  {
-                                                                  "type":  "string"
-                                                              }
-                                                 },
-                                  "additionalProperties":  false
-                              }
+                  "limit_channel":  {
+                                        "type":  "object",
+                                        "required":  [
+                                                         "name",
+                                                         "ball",
+                                                         "connector",
+                                                         "connector_pin",
+                                                         "side"
+                                                     ],
+                                        "properties":  {
+                                                           "name":  {
+                                                                        "type":  "string",
+                                                                        "pattern":  "^(x|y|z)_limit_(ls|hs)$"
+                                                                    },
+                                                           "ball":  {
+                                                                        "type":  "string",
+                                                                        "pattern":  "^[A-Z][0-9]+$"
+                                                                    },
+                                                           "connector":  {
+                                                                             "type":  "string",
+                                                                             "pattern":  "^CON[0-9]+$"
+                                                                         },
+                                                           "connector_pin":  {
+                                                                                 "type":  "integer",
+                                                                                 "minimum":  1,
+                                                                                 "maximum":  14
+                                                                             },
+                                                           "side":  {
+                                                                        "type":  "string",
+                                                                        "enum":  [
+                                                                                     "low",
+                                                                                     "high"
+                                                                                 ]
+                                                                    }
+                                                       },
+                                        "additionalProperties":  false
+                                    }
               },
     "additionalProperties":  false
 }

+ 88 - 31
src/generated/host-contract.json

@@ -1,5 +1,5 @@
 {
-  "axis_count": 2,
+  "axis_count": 3,
   "commands": {
     "get_temperature": {
       "payload_length": 0,
@@ -25,9 +25,9 @@
         "ptc_chamber_2",
         "ptc_chamber_3",
         "ptc_chamber_4",
-        "intake_door",
-        "exhaust_x",
-        "exhaust_y"
+        "door_z",
+        "door_x",
+        "door_y"
       ],
       "payload_length": 11,
       "response": "none",
@@ -39,37 +39,71 @@
       "type": "0x82"
     }
   },
-  "intake_actuator": "solenoid",
+  "limit_count": 6,
   "limits": {
     "active_level": "high",
     "channels": [
       {
-        "ball": "M6",
-        "name": "x_limit_raw"
+        "ball": "A5",
+        "connector": "CON12",
+        "connector_pin": 1,
+        "name": "x_limit_ls",
+        "side": "low"
+      },
+      {
+        "ball": "B6",
+        "connector": "CON12",
+        "connector_pin": 2,
+        "name": "x_limit_hs",
+        "side": "high"
       },
       {
-        "ball": "F9",
-        "name": "y_limit_raw"
+        "ball": "C8",
+        "connector": "CON12",
+        "connector_pin": 3,
+        "name": "y_limit_ls",
+        "side": "low"
+      },
+      {
+        "ball": "A8",
+        "connector": "CON12",
+        "connector_pin": 4,
+        "name": "y_limit_hs",
+        "side": "high"
+      },
+      {
+        "ball": "K16",
+        "connector": "CON129",
+        "connector_pin": 1,
+        "name": "z_limit_ls",
+        "side": "low"
+      },
+      {
+        "ball": "J15",
+        "connector": "CON129",
+        "connector_pin": 2,
+        "name": "z_limit_hs",
+        "side": "high"
       }
     ],
     "functional_use": true,
-    "limit_count": 2,
-    "runtime_use": false,
+    "limit_count": 6,
+    "runtime_use": true,
     "startup": {
       "additional_rising_edges_after_synchronized_limit": 0,
       "axis_order": [
         "x",
-        "y"
+        "y",
+        "z"
       ],
-      "burst_step_count": 450,
-      "burst_step_rate_hz": 1000,
+      "backoff_step_count": 500,
+      "close_step_count": 5000,
       "direction_meaning": "close",
       "direction_value": 1,
       "enabled": true,
-      "inter_burst_ms": 50,
-      "limit_stop_during_burst": true,
-      "max_bursts": 10,
-      "runtime_limit_use": false,
+      "limit_stop_during_move": true,
+      "runtime_limit_use": true,
+      "step_rate_hz": 1000,
       "stop_semantics": "finish_current_high_pulse_then_no_next_rising_edge"
     }
   },
@@ -81,12 +115,15 @@
       1,
       2
     ],
-    "count": 2,
+    "count": 3,
     "dir_setup_cycles": 25000,
     "enable_n": {
       "active_level": "low",
-      "ball": "T7",
-      "policy": "shared_constant_low"
+      "ball": "C11",
+      "connector": "CON120",
+      "connector_pin": 2,
+      "notes": "NPN open-collector invert at board; FPGA drives constant 1 so connector EN is permanently asserted.",
+      "policy": "permanent_high"
     },
     "execution": "overlap",
     "fixed_steps": 450,
@@ -94,23 +131,42 @@
     "mapping": {
       "x": {
         "axis": "x",
-        "dir_ball": "R8",
-        "role": "exhaust",
-        "step_ball": "R6"
+        "dir_ball": "B12",
+        "dir_connector": "CON104",
+        "dir_connector_pin": 3,
+        "role": "door",
+        "step_ball": "C12",
+        "step_connector": "CON104",
+        "step_connector_pin": 2
       },
       "y": {
         "axis": "y",
-        "dir_ball": "R4",
-        "role": "exhaust",
-        "step_ball": "T3"
+        "dir_ball": "J11",
+        "dir_connector": "CON105",
+        "dir_connector_pin": 3,
+        "role": "door",
+        "step_ball": "L12",
+        "step_connector": "CON105",
+        "step_connector_pin": 2
+      },
+      "z": {
+        "axis": "z",
+        "dir_ball": "K14",
+        "dir_connector": "CON106",
+        "dir_connector_pin": 3,
+        "role": "door",
+        "step_ball": "L14",
+        "step_connector": "CON106",
+        "step_connector_pin": 2
       }
     },
     "open_dir_value": 0,
     "order": [
       "x",
-      "y"
+      "y",
+      "z"
     ],
-    "role": "exhaust",
+    "role": "door",
     "step_half_cycles": 12500,
     "step_rate_hz": 1000
   },
@@ -322,16 +378,17 @@
       "exhaust_x_offset": 9,
       "exhaust_y_offset": 10,
       "fan_offset": 0,
-      "intake_door_offset": 8,
       "legacy_payload_length_rejected": 14,
       "payload_length": 11,
-      "response": "none"
+      "response": "none",
+      "z_door_offset": 8
     },
     "temperature_data": {
       "frame_length": 33,
       "payload_length": 27
     }
   },
+  "runtime_limit_use": true,
   "schema": "prod2u-simple-host-contract-v1",
   "temperature": {
     "bus": "i2c",

+ 13 - 8
src/generated/prod2u_door_temp.adc

@@ -17,11 +17,16 @@ set_pin_assignment { fan_pwm_out[0] } { LOCATION = B1; IOSTANDARD = LVCMOS33; PU
 set_pin_assignment { fan_pwm_out[1] } { LOCATION = C4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
 set_pin_assignment { fan_pwm_out[2] } { LOCATION = B5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
 set_pin_assignment { fan_pwm_out[3] } { LOCATION = A14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { motor_en_n } { LOCATION = T7; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { x_step } { LOCATION = R6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { x_dir } { LOCATION = R8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { y_step } { LOCATION = T3; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { y_dir } { LOCATION = R4; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { x_limit_raw } { LOCATION = M6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { y_limit_raw } { LOCATION = F9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
-set_pin_assignment { intake_solenoid_out } { LOCATION = P2; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { motor_en_n } { LOCATION = C11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { x_step } { LOCATION = C12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { x_dir } { LOCATION = B12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { y_step } { LOCATION = L12; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { y_dir } { LOCATION = J11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { z_step } { LOCATION = L14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { z_dir } { LOCATION = K14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { x_limit_ls } { LOCATION = A5; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { x_limit_hs } { LOCATION = B6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { y_limit_ls } { LOCATION = C8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { y_limit_hs } { LOCATION = A8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { z_limit_ls } { LOCATION = K16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
+set_pin_assignment { z_limit_hs } { LOCATION = J15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }

+ 0 - 63
src/generated/prod2u_door_temp_motor_compat_params.vh

@@ -1,63 +0,0 @@
-// Generated from project.json. Do not edit.
-`define P4_PROFILE_MOTOR_COMPAT 1
-`define P4_AXIS_COUNT 3
-`define P4_CLOCK_HZ 25000000
-`define P4_UART_BAUD 115200
-`define P4_UART_CLKS_PER_BIT 217
-`define P4_PTC_COUNT 8
-`define P4_FAN_COUNT 4
-`define P4_OUTPUT_CHANNEL_COUNT 12
-`define P4_PWM_PROTOCOL_WIDTH 8
-`define P4_PWM_INTERNAL_WIDTH 7
-`define P4_PWM_MAX_DUTY 100
-`define P4_PWM_PHASE_COUNT 100
-`define P4_PWM_FREQUENCY_HZ 20
-`define P4_PWM_SLOT_CLKS 1042
-`define P4_SET_ALL_PAYLOAD_LENGTH 11
-`define P4_CHAMBER_PTC_COUNT 4
-`define P4_SET_ALL_FAN_OFFSET 0
-`define P4_SET_ALL_CHAMBER_PTC_OFFSET 4
-`define P4_SET_ALL_INTAKE_DOOR_OFFSET 8
-`define P4_SET_ALL_EXHAUST_X_OFFSET 9
-`define P4_SET_ALL_EXHAUST_Y_OFFSET 10
-`define P4_INTAKE_ACTUATOR_SOLENOID 0
-`define P4_MOTOR_OPEN_DIR 1'b0
-`define P4_MOTOR_CLOSE_DIR 1'b1
-`define P4_FRAME_INTER_BYTE_TIMEOUT_CYCLES 250000
-`define P4_FIXED_MOTOR_STEPS 450
-`define P4_MOTOR_STEP_RATE_HZ 1000
-`define P4_MOTOR_STEP_HALF_CYCLES 12500
-`define P4_MOTOR_DIR_SETUP_CYCLES 25000
-`define P4_MOTOR_DIR_SETUP_TICKS 2
-`define P4_MOTOR_HEARTBEAT_COMMAND 2'd0
-`define P4_TEMPERATURE_COUNT 27
-`define P4_TEMPERATURE_COUNT_BYTE 8'h1B
-`define P4_TEMPERATURE_FRAME_LENGTH 33
-`define P4_TEMP_MAX_CELSIUS 150
-`define P4_PTC_ACTIVE_HIGH 1
-`define P4_FAN_ACTIVE_HIGH 0
-`define P4_PTC_DEFAULT_TARGET 8'h00
-`define P4_FAN_DEFAULT_TARGET 8'h0A
-`define P4_WATCHDOG_TIMEOUT_SECONDS 10
-`define P4_WATCHDOG_TICK_US 500
-`define P4_WATCHDOG_TICK_CLKS 12500
-`define P4_WATCHDOG_TIMEOUT_TICKS 20000
-`define P4_WATCHDOG_PTC_TARGET 8'h00
-`define P4_WATCHDOG_FAN_TARGET 8'h14
-`define P4_STARTUP_ENABLED 1
-`define P4_STARTUP_DIR_MASK 3'b111
-`define P4_STARTUP_BURST_STEPS 450
-`define P4_STARTUP_MAX_BURSTS 10
-`define P4_STARTUP_INTER_BURST_TICKS 100
-`define P4_TEMP_DEVICE_ADDR_0 7'h49
-`define P4_TEMP_DEVICE_ADDR_1 7'h48
-`define P4_TEMP_DEVICE_ADDR_2 7'h4B
-`define P4_TEMP_REGISTER_0 8'h00
-`define P4_TEMP_REGISTER_1 8'h01
-`define P4_TEMP_REGISTER_2 8'h02
-`define P4_TEMP_REGISTER_3 8'h03
-`define P4_TEMP_REGISTER_4 8'h04
-`define P4_TEMP_REGISTER_5 8'h05
-`define P4_TEMP_REGISTER_6 8'h06
-`define P4_TEMP_REGISTER_7 8'h07
-`define P4_TEMP_REGISTER_8 8'h08

+ 9 - 8
src/generated/prod2u_door_temp_params.vh

@@ -1,6 +1,7 @@
 // Generated from project.json. Do not edit.
-`define P4_PROFILE_MOTOR_COMPAT 0
-`define P4_AXIS_COUNT 2
+`define P4_AXIS_COUNT 3
+`define P4_LIMIT_COUNT 6
+`define P4_RUNTIME_LIMIT_USE 1
 `define P4_CLOCK_HZ 25000000
 `define P4_UART_BAUD 115200
 `define P4_UART_CLKS_PER_BIT 217
@@ -17,10 +18,9 @@
 `define P4_CHAMBER_PTC_COUNT 4
 `define P4_SET_ALL_FAN_OFFSET 0
 `define P4_SET_ALL_CHAMBER_PTC_OFFSET 4
-`define P4_SET_ALL_INTAKE_DOOR_OFFSET 8
+`define P4_SET_ALL_Z_DOOR_OFFSET 8
 `define P4_SET_ALL_EXHAUST_X_OFFSET 9
 `define P4_SET_ALL_EXHAUST_Y_OFFSET 10
-`define P4_INTAKE_ACTUATOR_SOLENOID 1
 `define P4_MOTOR_OPEN_DIR 1'b0
 `define P4_MOTOR_CLOSE_DIR 1'b1
 `define P4_FRAME_INTER_BYTE_TIMEOUT_CYCLES 250000
@@ -45,10 +45,11 @@
 `define P4_WATCHDOG_PTC_TARGET 8'h00
 `define P4_WATCHDOG_FAN_TARGET 8'h14
 `define P4_STARTUP_ENABLED 1
-`define P4_STARTUP_DIR_MASK 2'b11
-`define P4_STARTUP_BURST_STEPS 450
-`define P4_STARTUP_MAX_BURSTS 10
-`define P4_STARTUP_INTER_BURST_TICKS 100
+`define P4_STARTUP_DIR_MASK 3'b111
+`define P4_STARTUP_CLOSE_STEPS 5000
+`define P4_STARTUP_BACKOFF_STEPS 500
+`define P4_STARTUP_STEP_RATE_HZ 1000
+`define P4_MOTOR_ENABLE_POLICY_PERMANENT_HIGH 1
 `define P4_TEMP_DEVICE_ADDR_0 7'h49
 `define P4_TEMP_DEVICE_ADDR_1 7'h48
 `define P4_TEMP_DEVICE_ADDR_2 7'h4B

+ 36 - 14
src/generated/td-source-manifest.json

@@ -69,39 +69,61 @@
       "signal": "fan_pwm_out[3]"
     },
     {
-      "ball": "T7",
+      "ball": "C11",
       "signal": "motor_en_n"
     },
     {
-      "ball": "R6",
+      "ball": "C12",
       "signal": "x_step"
     },
     {
-      "ball": "R8",
+      "ball": "B12",
       "signal": "x_dir"
     },
     {
-      "ball": "T3",
+      "ball": "L12",
       "signal": "y_step"
     },
     {
-      "ball": "R4",
+      "ball": "J11",
       "signal": "y_dir"
     },
     {
-      "ball": "M6",
-      "signal": "x_limit_raw"
+      "ball": "L14",
+      "signal": "z_step"
     },
     {
-      "ball": "F9",
-      "signal": "y_limit_raw"
+      "ball": "K14",
+      "signal": "z_dir"
     },
     {
-      "ball": "P2",
-      "signal": "intake_solenoid_out"
+      "ball": "A5",
+      "signal": "x_limit_ls"
+    },
+    {
+      "ball": "B6",
+      "signal": "x_limit_hs"
+    },
+    {
+      "ball": "C8",
+      "signal": "y_limit_ls"
+    },
+    {
+      "ball": "A8",
+      "signal": "y_limit_hs"
+    },
+    {
+      "ball": "K16",
+      "signal": "z_limit_ls"
+    },
+    {
+      "ball": "J15",
+      "signal": "z_limit_hs"
     }
   ],
   "contract": {
+    "axis_count": 3,
+    "limit_count": 6,
     "protocol": {
       "commands": {
         "get_temperature": 2,
@@ -132,16 +154,17 @@
         "exhaust_x_offset": 9,
         "exhaust_y_offset": 10,
         "fan_offset": 0,
-        "intake_door_offset": 8,
         "legacy_payload_length_rejected": 14,
         "payload_length": 11,
-        "response": "none"
+        "response": "none",
+        "z_door_offset": 8
       },
       "temperature_data": {
         "frame_length": 33,
         "payload_length": 27
       }
     },
+    "runtime_limit_use": true,
     "set_all_payload_length": 11,
     "temperature_frame_length": 33,
     "uart": {
@@ -174,7 +197,6 @@
     "src/modules/startup_close_seek.v",
     "src/modules/door_motor_engine.v",
     "src/modules/door_action_dispatcher.v",
-    "src/modules/intake_solenoid_adapter.v",
     "src/modules/i2c_word_reader.v",
     "src/modules/temperature_reader.v",
     "src/modules/temperature_ram.v",

+ 9 - 19
src/modules/door_action_dispatcher.v

@@ -1,19 +1,17 @@
 `timescale 1ns/1ps
 
 // Multi-axis jog dispatcher. DIR=0 open/up, DIR=1 close/down.
-// Commands: 00 stop, 01 DIR0, 02 DIR1. Latest door_action_valid overrides any
-// in-flight move (re-pulses motor_start with the new mask/dir, including stop).
-// AXIS_COUNT=2: exhaust X/Y only (production; intake is solenoid-owned elsewhere).
-// AXIS_COUNT=3: bit0=X, bit1=Y, bit2=intake (motor-compat; byte8 -> intake).
+// Commands: 00 stop, 01 DIR0, 02 DIR1. SET_ALL byte8->Z, byte9->X, byte10->Y.
+// Bit packing: bit0=X, bit1=Y, bit2=Z. New door commands are ignored while busy.
 module door_action_dispatcher #(
     parameter integer OPEN_DIR = 0,
     parameter integer CLOSE_DIR = 1,
-    parameter integer AXIS_COUNT = 2
+    parameter integer AXIS_COUNT = 3
 ) (
     input  wire       clk,
     input  wire       rst_n,
     input  wire       door_action_valid,
-    input  wire [1:0] intake_door_cmd,
+    input  wire [1:0] z_door_cmd,
     input  wire [1:0] exhaust_x_cmd,
     input  wire [1:0] exhaust_y_cmd,
     input  wire       watchdog_abort,
@@ -26,21 +24,13 @@ module door_action_dispatcher #(
 
     wire x_active = (exhaust_x_cmd != 2'd0);
     wire y_active = (exhaust_y_cmd != 2'd0);
-    wire intake_active = (intake_door_cmd != 2'd0);
+    wire z_active = (z_door_cmd != 2'd0);
     wire x_dir_bit = (exhaust_x_cmd == 2'd2) ? CLOSE_DIR[0] : OPEN_DIR[0];
     wire y_dir_bit = (exhaust_y_cmd == 2'd2) ? CLOSE_DIR[0] : OPEN_DIR[0];
-    wire intake_dir_bit = (intake_door_cmd == 2'd2) ? CLOSE_DIR[0] : OPEN_DIR[0];
+    wire z_dir_bit = (z_door_cmd == 2'd2) ? CLOSE_DIR[0] : OPEN_DIR[0];
 
-    // Bit packing: {intake?, y, x} so production X/Y bit positions stay stable.
-    wire [AXIS_COUNT-1:0] next_active =
-        (AXIS_COUNT == 3) ? {intake_active, y_active, x_active} :
-                            {y_active, x_active};
-    wire [AXIS_COUNT-1:0] next_dir =
-        (AXIS_COUNT == 3) ? {intake_dir_bit, y_dir_bit, x_dir_bit} :
-                            {y_dir_bit, x_dir_bit};
-
-    wire needs_motor_event = door_action_valid &&
-        ((next_active != AXIS_ZERO) || motor_busy);
+    wire [AXIS_COUNT-1:0] next_active = {z_active, y_active, x_active};
+    wire [AXIS_COUNT-1:0] next_dir = {z_dir_bit, y_dir_bit, x_dir_bit};
 
     always @(posedge clk or negedge rst_n) begin
         if (!rst_n) begin
@@ -51,7 +41,7 @@ module door_action_dispatcher #(
             motor_start <= 1'b0;
             if (watchdog_abort) begin
                 motor_active_mask <= AXIS_ZERO;
-            end else if (needs_motor_event) begin
+            end else if (door_action_valid && !motor_busy && (next_active != AXIS_ZERO)) begin
                 motor_active_mask <= next_active;
                 motor_dir_mask <= next_dir;
                 motor_start <= 1'b1;

+ 32 - 19
src/modules/door_motor_engine.v

@@ -1,20 +1,21 @@
 `timescale 1ns/1ps
 
-// Shared multi-axis stepper engine: FIXED_STEPS rising edges per start at
-// tick_500us (1000 steps/s with 500 us half-period). start reloads dir/active
-// (latest wins). stop_mask clears axes mid-burst without a new rising edge
-// after the current high half-cycle completes. Used by startup close-seek and
-// host jog. AXIS_COUNT=2 (production exhaust X/Y) or 3 (motor-compat +intake).
+// Shared multi-axis stepper engine: loadable rising-edge budget per start at
+// tick_500us (1000 steps/s with 500 us half-period). start is ignored while
+// busy (no latest-wins). stop_mask clears axes every clock and may truncate
+// the current high STEP pulse immediately. Used by startup close-seek and host jog.
 module door_motor_engine #(
-    parameter integer AXIS_COUNT = 2,
-    parameter integer FIXED_STEPS = 450,
-    parameter integer DIR_SETUP_TICKS = 2
+    parameter integer AXIS_COUNT = 3,
+    parameter integer MAX_STEPS = 5000,
+    parameter integer DIR_SETUP_TICKS = 2,
+    parameter integer STEP_COUNT_WIDTH = (MAX_STEPS <= 1) ? 1 : $clog2(MAX_STEPS + 1)
 ) (
     input  wire       clk,
     input  wire       rst_n,
     input  wire       start,
     input  wire [AXIS_COUNT-1:0] active_mask,
     input  wire [AXIS_COUNT-1:0] dir_mask,
+    input  wire [STEP_COUNT_WIDTH-1:0] step_count,
     input  wire       tick_500us,
     input  wire       abort,
     input  wire [AXIS_COUNT-1:0] stop_mask,
@@ -24,11 +25,13 @@ module door_motor_engine #(
     output reg  [AXIS_COUNT-1:0] dir
 );
     localparam integer SETUP_BITS = (DIR_SETUP_TICKS <= 1) ? 1 : $clog2(DIR_SETUP_TICKS + 1);
-    localparam integer STEP_COUNT_WIDTH = (FIXED_STEPS <= 1) ? 1 : $clog2(FIXED_STEPS + 1);
     localparam [AXIS_COUNT-1:0] AXIS_ZERO = {AXIS_COUNT{1'b0}};
+
     reg [SETUP_BITS-1:0] setup_count;
     reg [STEP_COUNT_WIDTH-1:0] rising_edges;
+    reg [STEP_COUNT_WIDTH-1:0] step_limit;
     reg [AXIS_COUNT-1:0] active_reg;
+    reg [AXIS_COUNT-1:0] step_next;
 
     wire [AXIS_COUNT-1:0] active_after_stop = active_reg & ~stop_mask;
 
@@ -40,9 +43,12 @@ module door_motor_engine #(
             dir <= AXIS_ZERO;
             setup_count <= {SETUP_BITS{1'b0}};
             rising_edges <= {STEP_COUNT_WIDTH{1'b0}};
+            step_limit <= {STEP_COUNT_WIDTH{1'b0}};
             active_reg <= AXIS_ZERO;
+            step_next <= AXIS_ZERO;
         end else begin
             done <= 1'b0;
+
             if (abort) begin
                 busy <= 1'b0;
                 step <= AXIS_ZERO;
@@ -50,48 +56,53 @@ module door_motor_engine #(
                 setup_count <= {SETUP_BITS{1'b0}};
                 rising_edges <= {STEP_COUNT_WIDTH{1'b0}};
                 done <= 1'b1;
-            end else if (start) begin
+            end else if (start && !busy) begin
                 dir <= dir_mask;
                 active_reg <= active_mask;
+                step_limit <= step_count;
                 setup_count <= {SETUP_BITS{1'b0}};
                 rising_edges <= {STEP_COUNT_WIDTH{1'b0}};
                 step <= AXIS_ZERO;
-                if (active_mask == AXIS_ZERO) begin
+                // Zero active mask or zero step budget: complete immediately.
+                if ((active_mask == AXIS_ZERO) || (step_count == {STEP_COUNT_WIDTH{1'b0}})) begin
                     busy <= 1'b0;
                     done <= 1'b1;
+                    active_reg <= AXIS_ZERO;
                 end else begin
                     busy <= 1'b1;
                 end
             end else if (busy) begin
                 active_reg <= active_after_stop;
+                step_next = step & ~stop_mask;
+
                 if (tick_500us) begin
                     if (setup_count < DIR_SETUP_TICKS) begin
                         setup_count <= setup_count + 1'b1;
-                        step <= AXIS_ZERO;
-                    end else if (step == AXIS_ZERO) begin
+                        step_next = AXIS_ZERO;
+                    end else if (step_next == AXIS_ZERO) begin
                         if (active_after_stop == AXIS_ZERO) begin
                             busy <= 1'b0;
                             done <= 1'b1;
-                            step <= AXIS_ZERO;
+                            step_next = AXIS_ZERO;
                             setup_count <= {SETUP_BITS{1'b0}};
                             rising_edges <= {STEP_COUNT_WIDTH{1'b0}};
                             active_reg <= AXIS_ZERO;
                         end else begin
-                            step <= active_after_stop;
+                            step_next = active_after_stop;
                         end
                     end else begin
-                        step <= AXIS_ZERO;
-                        if (rising_edges + 1 >= FIXED_STEPS) begin
+                        step_next = AXIS_ZERO;
+                        if (rising_edges + 1 >= step_limit) begin
                             busy <= 1'b0;
                             done <= 1'b1;
-                            step <= AXIS_ZERO;
+                            step_next = AXIS_ZERO;
                             setup_count <= {SETUP_BITS{1'b0}};
                             rising_edges <= {STEP_COUNT_WIDTH{1'b0}};
                             active_reg <= AXIS_ZERO;
                         end else if (active_after_stop == AXIS_ZERO) begin
                             busy <= 1'b0;
                             done <= 1'b1;
-                            step <= AXIS_ZERO;
+                            step_next = AXIS_ZERO;
                             setup_count <= {SETUP_BITS{1'b0}};
                             rising_edges <= {STEP_COUNT_WIDTH{1'b0}};
                             active_reg <= AXIS_ZERO;
@@ -100,6 +111,8 @@ module door_motor_engine #(
                         end
                     end
                 end
+
+                step <= step_next & ~stop_mask;
             end else begin
                 step <= AXIS_ZERO;
             end

+ 0 - 54
src/modules/intake_solenoid_adapter.v

@@ -1,54 +0,0 @@
-`timescale 1ns/1ps
-
-// Chamber-1 intake default actuator is a solenoid (not the static motor profile).
-// Command contract: 00 = hold latched level, 01 = open, 02 = closed.
-// Reset / watchdog -> inactive.
-//
-// Polarity: OPEN/CLOSED/INACTIVE levels below are *inferred* placeholders from
-// project.json while doors.solenoid.evidence_status remains "blocked". Do not
-// invert them until V1.2 board evidence confirms the FPGA ball and drive sense.
-module intake_solenoid_adapter #(
-    parameter OPEN_LEVEL = 1'b1,      // inferred (blocked evidence)
-    parameter CLOSED_LEVEL = 1'b0,    // inferred (blocked evidence)
-    parameter INACTIVE_LEVEL = 1'b0   // inferred (blocked evidence)
-) (
-    input  wire clk,
-    input  wire rst_n,
-    input  wire door_action_valid,
-    input  wire [1:0] intake_door_cmd,
-    input  wire watchdog_inactive,
-    output reg solenoid_out
-);
-    localparam [1:0] ST_OPEN = 2'd1;
-    localparam [1:0] ST_CLOSED = 2'd2;
-
-    reg [1:0] latched_state;
-
-    always @(posedge clk or negedge rst_n) begin
-        if (!rst_n) begin
-            latched_state <= 2'd0;
-            solenoid_out <= INACTIVE_LEVEL;
-        end else if (watchdog_inactive) begin
-            latched_state <= 2'd0;
-            solenoid_out <= INACTIVE_LEVEL;
-        end else if (door_action_valid) begin
-            case (intake_door_cmd)
-                2'd1: begin
-                    latched_state <= ST_OPEN;
-                    solenoid_out <= OPEN_LEVEL;
-                end
-                2'd2: begin
-                    latched_state <= ST_CLOSED;
-                    solenoid_out <= CLOSED_LEVEL;
-                end
-                default: begin
-                    case (latched_state)
-                        ST_OPEN: solenoid_out <= OPEN_LEVEL;
-                        ST_CLOSED: solenoid_out <= CLOSED_LEVEL;
-                        default: solenoid_out <= INACTIVE_LEVEL;
-                    endcase
-                end
-            endcase
-        end
-    end
-endmodule

+ 70 - 70
src/modules/startup_close_seek.v

@@ -1,66 +1,54 @@
 `timescale 1ns/1ps
 
-// Power-on / reconfig close-seek one-shot for motor-configured dampers only.
-// AXIS_ENABLE_MASK selects which axes participate (default all). Solenoid
-// intake is never moved here (production AXIS_COUNT=2). Motor-compat uses
-// AXIS_COUNT=3 with bit2=intake. DIR_MASK defaults to close (DIR=1).
-// After sticky startup_done: no further starts, stop_mask stays 0 at the top.
+// Power-on / reconfig close-seek one-shot: close-search toward LS (DIR=1) up to
+// CLOSE_STEPS rising edges, latch found_ls, then optional backoff (DIR=0) up to
+// BACKOFF_STEPS for axes that never saw LS. startup_done is sticky after success.
 module startup_close_seek #(
-    /* verilator lint_off UNUSEDPARAM */
-    parameter integer FIXED_STEPS = 450,
-    parameter integer DIR_SETUP_TICKS = 2,
-    parameter integer STEP_HALF_CYCLES = 12500,
-    /* verilator lint_on UNUSEDPARAM */
-    parameter integer MAX_BURSTS = 10,
-    parameter integer INTER_BURST_TICKS = 100,
-    parameter integer AXIS_COUNT = 2,
-    parameter [AXIS_COUNT-1:0] DIR_MASK = {AXIS_COUNT{1'b1}},
+    parameter integer CLOSE_STEPS = 5000,
+    parameter integer BACKOFF_STEPS = 500,
+    parameter integer AXIS_COUNT = 3,
+    parameter integer STEP_COUNT_WIDTH =
+        (CLOSE_STEPS >= BACKOFF_STEPS) ?
+            ((CLOSE_STEPS <= 1) ? 1 : $clog2(CLOSE_STEPS + 1)) :
+            ((BACKOFF_STEPS <= 1) ? 1 : $clog2(BACKOFF_STEPS + 1)),
+    parameter [AXIS_COUNT-1:0] CLOSE_DIR_MASK = {AXIS_COUNT{1'b1}},
     parameter [AXIS_COUNT-1:0] AXIS_ENABLE_MASK = {AXIS_COUNT{1'b1}}
 ) (
     input  wire       clk,
     input  wire       rst_n,
     input  wire       tick_500us,
     input  wire       limit_sync_valid,
-    input  wire [AXIS_COUNT-1:0] limit_sync,
+    input  wire [AXIS_COUNT-1:0] limit_ls_sync,
+    input  wire [AXIS_COUNT-1:0] limit_hs_sync,
     output reg        startup_done,
     output reg        motor_start,
     output reg  [AXIS_COUNT-1:0] motor_active_mask,
     output reg  [AXIS_COUNT-1:0] motor_dir_mask,
+    output reg  [STEP_COUNT_WIDTH-1:0] motor_step_count,
     output wire [AXIS_COUNT-1:0] motor_stop_mask,
     input  wire       motor_done
 );
-    localparam integer BURST_WIDTH = (MAX_BURSTS <= 1) ? 1 : $clog2(MAX_BURSTS + 1);
-    localparam integer TICK_WIDTH = (INTER_BURST_TICKS <= 1) ? 1 : $clog2(INTER_BURST_TICKS + 1);
     localparam [AXIS_COUNT-1:0] AXIS_ZERO = {AXIS_COUNT{1'b0}};
 
-    localparam [2:0] ST_WAIT_SYNC = 3'd0;
-    localparam [2:0] ST_CHECK      = 3'd1;
-    localparam [2:0] ST_START      = 3'd2;
-    localparam [2:0] ST_WAIT_DONE  = 3'd3;
-    localparam [2:0] ST_WAIT_IDLE  = 3'd4;
-    localparam [2:0] ST_DONE       = 3'd5;
+    localparam [2:0] ST_WAIT_SYNC   = 3'd0;
+    localparam [2:0] ST_CHECK       = 3'd1;
+    localparam [2:0] ST_CLOSE_START = 3'd2;
+    localparam [2:0] ST_CLOSE_WAIT  = 3'd3;
+    localparam [2:0] ST_EVAL        = 3'd4;
+    localparam [2:0] ST_BACKOFF_START = 3'd5;
+    localparam [2:0] ST_BACKOFF_WAIT  = 3'd6;
+    localparam [2:0] ST_DONE        = 3'd7;
 
     reg [2:0] state;
-    reg [AXIS_COUNT-1:0] reached_mask;
-    reg [BURST_WIDTH-1:0] burst_count [0:AXIS_COUNT-1];
-    reg [TICK_WIDTH-1:0] idle_tick;
-    integer ai;
+    reg [AXIS_COUNT-1:0] initial_reached;
+    reg [AXIS_COUNT-1:0] found_ls;
+    reg [AXIS_COUNT-1:0] close_participants;
+    wire [AXIS_COUNT-1:0] missed_ls_mask = close_participants & ~found_ls;
 
-    wire [AXIS_COUNT-1:0] reached_mask_next =
-        reached_mask | (limit_sync_valid ? limit_sync : AXIS_ZERO);
-
-    reg [AXIS_COUNT-1:0] exhausted_mask;
-    always @(*) begin
-        exhausted_mask = AXIS_ZERO;
-        for (ai = 0; ai < AXIS_COUNT; ai = ai + 1) begin
-            if (burst_count[ai] >= MAX_BURSTS)
-                exhausted_mask[ai] = 1'b1;
-        end
-    end
-
-    wire [AXIS_COUNT-1:0] move_mask = ~reached_mask_next & ~exhausted_mask & AXIS_ENABLE_MASK;
-
-    assign motor_stop_mask = (state == ST_WAIT_DONE) ? (reached_mask_next & motor_active_mask) : AXIS_ZERO;
+    assign motor_stop_mask =
+        (state == ST_CLOSE_WAIT) ? (limit_ls_sync & motor_active_mask) :
+        (state == ST_BACKOFF_WAIT) ? (limit_hs_sync & motor_active_mask) :
+        AXIS_ZERO;
 
     always @(posedge clk or negedge rst_n) begin
         if (!rst_n) begin
@@ -69,52 +57,64 @@ module startup_close_seek #(
             motor_start <= 1'b0;
             motor_active_mask <= AXIS_ZERO;
             motor_dir_mask <= AXIS_ZERO;
-            reached_mask <= AXIS_ZERO;
-            idle_tick <= {TICK_WIDTH{1'b0}};
-            for (ai = 0; ai < AXIS_COUNT; ai = ai + 1)
-                burst_count[ai] <= {BURST_WIDTH{1'b0}};
+            motor_step_count <= {STEP_COUNT_WIDTH{1'b0}};
+            initial_reached <= AXIS_ZERO;
+            found_ls <= AXIS_ZERO;
+            close_participants <= AXIS_ZERO;
         end else begin
-            reached_mask <= reached_mask_next;
+            if (state == ST_CLOSE_WAIT)
+                found_ls <= found_ls | limit_ls_sync;
+
             case (state)
                 ST_WAIT_SYNC: begin
                     motor_start <= 1'b0;
-                    if (limit_sync_valid) begin
+                    if (limit_sync_valid)
                         state <= ST_CHECK;
-                    end
                 end
                 ST_CHECK: begin
                     motor_start <= 1'b0;
-                    if (move_mask == AXIS_ZERO) begin
+                    initial_reached <= limit_ls_sync & AXIS_ENABLE_MASK;
+                    found_ls <= limit_ls_sync & AXIS_ENABLE_MASK;
+                    close_participants <= (~limit_ls_sync) & AXIS_ENABLE_MASK;
+                    if ((~limit_ls_sync & AXIS_ENABLE_MASK) == AXIS_ZERO) begin
                         state <= ST_DONE;
                         startup_done <= 1'b1;
                     end else begin
-                        state <= ST_START;
+                        state <= ST_CLOSE_START;
                     end
                 end
-                ST_START: begin
-                    motor_active_mask <= move_mask;
-                    motor_dir_mask <= DIR_MASK;
+                ST_CLOSE_START: begin
+                    motor_active_mask <= close_participants;
+                    motor_dir_mask <= CLOSE_DIR_MASK;
+                    motor_step_count <= CLOSE_STEPS[STEP_COUNT_WIDTH-1:0];
                     motor_start <= 1'b1;
-                    state <= ST_WAIT_DONE;
+                    state <= ST_CLOSE_WAIT;
                 end
-                ST_WAIT_DONE: begin
+                ST_CLOSE_WAIT: begin
                     motor_start <= 1'b0;
-                    if (motor_done) begin
-                        for (ai = 0; ai < AXIS_COUNT; ai = ai + 1) begin
-                            if (motor_active_mask[ai])
-                                burst_count[ai] <= burst_count[ai] + 1'b1;
-                        end
-                        idle_tick <= {TICK_WIDTH{1'b0}};
-                        state <= ST_WAIT_IDLE;
+                    if (motor_done)
+                        state <= ST_EVAL;
+                end
+                ST_EVAL: begin
+                    if (missed_ls_mask == AXIS_ZERO) begin
+                        state <= ST_DONE;
+                        startup_done <= 1'b1;
+                    end else begin
+                        state <= ST_BACKOFF_START;
                     end
                 end
-                ST_WAIT_IDLE: begin
-                    if (tick_500us) begin
-                        if (idle_tick + 1'b1 >= INTER_BURST_TICKS) begin
-                            state <= ST_CHECK;
-                        end else begin
-                            idle_tick <= idle_tick + 1'b1;
-                        end
+                ST_BACKOFF_START: begin
+                    motor_active_mask <= missed_ls_mask;
+                    motor_dir_mask <= AXIS_ZERO;
+                    motor_step_count <= BACKOFF_STEPS[STEP_COUNT_WIDTH-1:0];
+                    motor_start <= 1'b1;
+                    state <= ST_BACKOFF_WAIT;
+                end
+                ST_BACKOFF_WAIT: begin
+                    motor_start <= 1'b0;
+                    if (motor_done) begin
+                        state <= ST_DONE;
+                        startup_done <= 1'b1;
                     end
                 end
                 ST_DONE: begin

+ 6 - 33
src/project/project_adapter.v

@@ -7,18 +7,12 @@ module project_adapter #(
     parameter integer SET_ALL_PAYLOAD_LENGTH = 11,
     parameter integer FAN_OFFSET = 0,
     parameter integer CHAMBER_PTC_OFFSET = 4,
-    parameter integer INTAKE_DOOR_OFFSET = 8,
+    parameter integer Z_DOOR_OFFSET = 8,
     parameter integer EXHAUST_X_OFFSET = 9,
     parameter integer EXHAUST_Y_OFFSET = 10,
     parameter integer OPEN_DIR = 0,
     parameter integer CLOSE_DIR = 1,
-    parameter integer INTAKE_SOLENOID_OPEN_LEVEL = 1,
-    parameter integer INTAKE_SOLENOID_CLOSED_LEVEL = 0,
-    parameter integer INTAKE_SOLENOID_INACTIVE_LEVEL = 0,
-    // Production default: solenoid intake + 2 exhaust motor axes.
-    // Motor-compat top uses project_adapter_motor_compat instead.
-    parameter integer AXIS_COUNT = 2,
-    parameter integer INTAKE_ACTUATOR_SOLENOID = 1
+    parameter integer AXIS_COUNT = 3
 ) (
     input  wire       clk,
     input  wire       rst_n,
@@ -38,14 +32,13 @@ module project_adapter #(
     output wire [AXIS_COUNT-1:0] motor_dir_mask,
     input  wire       motor_busy,
     input  wire       watchdog_abort,
-    output wire       intake_solenoid_out,
     output wire       temperature_start,
     input  wire       temperature_done,
     output wire       tx_start,
     input  wire       tx_done,
     output wire       busy
 );
-    wire [1:0] intake_door_cmd;
+    wire [1:0] z_door_cmd;
     wire [1:0] exhaust_x_cmd;
     wire [1:0] exhaust_y_cmd;
     wire door_action_valid;
@@ -57,7 +50,7 @@ module project_adapter #(
         .SET_ALL_PAYLOAD_LENGTH(SET_ALL_PAYLOAD_LENGTH),
         .FAN_OFFSET(FAN_OFFSET),
         .CHAMBER_PTC_OFFSET(CHAMBER_PTC_OFFSET),
-        .INTAKE_DOOR_OFFSET(INTAKE_DOOR_OFFSET),
+        .INTAKE_DOOR_OFFSET(Z_DOOR_OFFSET),
         .EXHAUST_X_OFFSET(EXHAUST_X_OFFSET),
         .EXHAUST_Y_OFFSET(EXHAUST_Y_OFFSET)
     ) controller (
@@ -69,7 +62,7 @@ module project_adapter #(
         .target_wr_en(target_wr_en), .target_wr_addr(target_wr_addr),
         .target_wr_data(target_wr_data),
         .valid_set_all_commit(valid_set_all_commit),
-        .intake_door_cmd(intake_door_cmd),
+        .intake_door_cmd(z_door_cmd),
         .exhaust_x_cmd(exhaust_x_cmd),
         .exhaust_y_cmd(exhaust_y_cmd),
         .door_action_valid(door_action_valid),
@@ -84,7 +77,7 @@ module project_adapter #(
     ) u_door_dispatch (
         .clk(clk), .rst_n(rst_n),
         .door_action_valid(door_action_valid),
-        .intake_door_cmd(intake_door_cmd),
+        .z_door_cmd(z_door_cmd),
         .exhaust_x_cmd(exhaust_x_cmd),
         .exhaust_y_cmd(exhaust_y_cmd),
         .watchdog_abort(watchdog_abort),
@@ -93,24 +86,4 @@ module project_adapter #(
         .motor_dir_mask(motor_dir_mask),
         .motor_busy(motor_busy)
     );
-
-    // Production path: intake solenoid. INTAKE_ACTUATOR_SOLENOID must be 1 here;
-    // motor-compat uses a dedicated adapter/top with INTAKE_ACTUATOR_SOLENOID=0.
-    generate
-        if (INTAKE_ACTUATOR_SOLENOID != 0) begin : gen_solenoid
-            intake_solenoid_adapter #(
-                .OPEN_LEVEL(INTAKE_SOLENOID_OPEN_LEVEL[0]),
-                .CLOSED_LEVEL(INTAKE_SOLENOID_CLOSED_LEVEL[0]),
-                .INACTIVE_LEVEL(INTAKE_SOLENOID_INACTIVE_LEVEL[0])
-            ) u_intake_solenoid (
-                .clk(clk), .rst_n(rst_n),
-                .door_action_valid(door_action_valid),
-                .intake_door_cmd(intake_door_cmd),
-                .watchdog_inactive(watchdog_abort),
-                .solenoid_out(intake_solenoid_out)
-            );
-        end else begin : gen_no_solenoid
-            assign intake_solenoid_out = INTAKE_SOLENOID_INACTIVE_LEVEL[0];
-        end
-    endgenerate
 endmodule

+ 0 - 92
src/project/project_adapter_motor_compat.v

@@ -1,92 +0,0 @@
-`timescale 1ns/1ps
-
-// Non-production motor-compat adapter: UART 11-byte SET_ALL unchanged; byte8
-// drives intake as a third motor axis (00 stop / 01 DIR=0 / 02 DIR=1).
-// Exhaust X/Y remain axes 0/1. No solenoid instance.
-module project_adapter_motor_compat #(
-    parameter integer PTC_COUNT = 8,
-    parameter integer FAN_COUNT = 4,
-    parameter integer CHAMBER_PTC_COUNT = 4,
-    parameter integer SET_ALL_PAYLOAD_LENGTH = 11,
-    parameter integer FAN_OFFSET = 0,
-    parameter integer CHAMBER_PTC_OFFSET = 4,
-    parameter integer INTAKE_DOOR_OFFSET = 8,
-    parameter integer EXHAUST_X_OFFSET = 9,
-    parameter integer EXHAUST_Y_OFFSET = 10,
-    parameter integer OPEN_DIR = 0,
-    parameter integer CLOSE_DIR = 1,
-    parameter integer AXIS_COUNT = 3
-) (
-    input  wire       clk,
-    input  wire       rst_n,
-    input  wire       frame_valid,
-    output wire       frame_ready,
-    output wire       frame_accept_enable,
-    input  wire [7:0] frame_type,
-    input  wire [7:0] frame_length,
-    output wire [7:0] payload_read_addr,
-    input  wire [7:0] payload_read_data,
-    output wire       target_wr_en,
-    output wire [3:0] target_wr_addr,
-    output wire [7:0] target_wr_data,
-    output wire       valid_set_all_commit,
-    output wire       motor_start,
-    output wire [AXIS_COUNT-1:0] motor_active_mask,
-    output wire [AXIS_COUNT-1:0] motor_dir_mask,
-    input  wire       motor_busy,
-    input  wire       watchdog_abort,
-    output wire       temperature_start,
-    input  wire       temperature_done,
-    output wire       tx_start,
-    input  wire       tx_done,
-    output wire       busy
-);
-    wire [1:0] intake_door_cmd;
-    wire [1:0] exhaust_x_cmd;
-    wire [1:0] exhaust_y_cmd;
-    wire door_action_valid;
-
-    command_controller #(
-        .PTC_COUNT(PTC_COUNT),
-        .FAN_COUNT(FAN_COUNT),
-        .CHAMBER_PTC_COUNT(CHAMBER_PTC_COUNT),
-        .SET_ALL_PAYLOAD_LENGTH(SET_ALL_PAYLOAD_LENGTH),
-        .FAN_OFFSET(FAN_OFFSET),
-        .CHAMBER_PTC_OFFSET(CHAMBER_PTC_OFFSET),
-        .INTAKE_DOOR_OFFSET(INTAKE_DOOR_OFFSET),
-        .EXHAUST_X_OFFSET(EXHAUST_X_OFFSET),
-        .EXHAUST_Y_OFFSET(EXHAUST_Y_OFFSET)
-    ) controller (
-        .clk(clk), .rst_n(rst_n),
-        .frame_valid(frame_valid), .frame_ready(frame_ready),
-        .frame_accept_enable(frame_accept_enable),
-        .frame_type(frame_type), .frame_length(frame_length),
-        .payload_read_addr(payload_read_addr), .payload_read_data(payload_read_data),
-        .target_wr_en(target_wr_en), .target_wr_addr(target_wr_addr),
-        .target_wr_data(target_wr_data),
-        .valid_set_all_commit(valid_set_all_commit),
-        .intake_door_cmd(intake_door_cmd),
-        .exhaust_x_cmd(exhaust_x_cmd),
-        .exhaust_y_cmd(exhaust_y_cmd),
-        .door_action_valid(door_action_valid),
-        .temperature_start(temperature_start), .temperature_done(temperature_done),
-        .tx_start(tx_start), .tx_done(tx_done), .busy(busy)
-    );
-
-    door_action_dispatcher #(
-        .OPEN_DIR(OPEN_DIR),
-        .CLOSE_DIR(CLOSE_DIR),
-        .AXIS_COUNT(AXIS_COUNT)
-    ) u_door_dispatch (
-        .clk(clk), .rst_n(rst_n),
-        .door_action_valid(door_action_valid),
-        .intake_door_cmd(intake_door_cmd),
-        .exhaust_x_cmd(exhaust_x_cmd),
-        .exhaust_y_cmd(exhaust_y_cmd),
-        .watchdog_abort(watchdog_abort),
-        .motor_start(motor_start),
-        .motor_active_mask(motor_active_mask),
-        .motor_dir_mask(motor_dir_mask),
-        .motor_busy(motor_busy)
-    );
-endmodule

+ 0 - 343
src/top/prod2u_p4_motor_compat_top.v

@@ -1,343 +0,0 @@
-`timescale 1ns/1ps
-`include "src/generated/prod2u_door_temp_motor_compat_params.vh"
-
-// Non-production motor-compat top: AXIS_COUNT=3, byte8 -> intake motor.
-// Shares motor engine / startup / dispatcher with production. Third close-limit
-// and intake STEP/DIR are simulation ports only -- NOT in production ADC.
-// Physical ball mapping for intake motor/solenoid remains blocked.
-module prod2u_p4_motor_compat_top (
-    input  wire       sys_clk,
-    input  wire       host_uart_rx,
-    output wire       host_uart_tx,
-    output wire [7:0] ptc_pwm_out,
-    output wire [3:0] fan_pwm_out,
-    output wire       motor_en_n,
-    output wire       x_step,
-    output wire       x_dir,
-    output wire       y_step,
-    output wire       y_dir,
-    // Sim-only intake motor (no production LOC / ADC ball).
-    output wire       intake_step,
-    output wire       intake_dir,
-    input  wire       x_limit_raw,
-    input  wire       y_limit_raw,
-    // Sim-only third close-limit (no production LOC / ADC ball).
-    input  wire       intake_limit_raw,
-    inout  wire       temp_scl,
-    inout  wire       temp_sda
-);
-    // Profile select must affect compilation: wrong params fail elaboration.
-    generate
-        if (`P4_INTAKE_ACTUATOR_SOLENOID != 0) begin : gen_bad_solenoid
-            ERROR_motor_compat_requires_P4_INTAKE_ACTUATOR_SOLENOID_0 bad_solenoid();
-        end
-        if (`P4_AXIS_COUNT != 3) begin : gen_bad_axis
-            ERROR_motor_compat_requires_P4_AXIS_COUNT_3 bad_axis();
-        end
-    endgenerate
-
-    // Sim hooks (hierarchical): startup_done, tick_500us, host_motor_*,
-    // motor_stop_mask, startup_motor_*, limit_sync / limit_sync_valid.
-    wire sys_rst_n;
-    wire uart_rx_valid;
-    wire [7:0] uart_rx_data;
-    wire uart_framing_error;
-    wire frame_valid;
-    wire frame_ready;
-    wire frame_accept_enable;
-    wire host_frame_accept_enable;
-    wire [7:0] frame_type;
-    wire [7:0] frame_length;
-    wire [7:0] payload_read_addr;
-    wire [7:0] payload_read_data;
-    wire payload_wr_en;
-    wire [7:0] payload_wr_addr;
-    wire [7:0] payload_wr_data;
-    wire [3:0] target_rd_addr;
-    wire [7:0] target_rd_data;
-    wire target_wr_en;
-    wire [3:0] target_wr_addr;
-    wire [7:0] target_wr_data;
-    wire valid_set_all_commit;
-    wire host_motor_start;
-    wire [2:0] host_motor_active_mask;
-    wire [2:0] host_motor_dir_mask;
-    wire motor_start;
-    wire [2:0] motor_active_mask;
-    wire [2:0] motor_dir_mask;
-    wire motor_done;
-    wire motor_busy;
-    wire motor_abort_done;
-    wire startup_done;
-    wire startup_motor_start;
-    wire [2:0] startup_motor_active_mask;
-    wire [2:0] startup_motor_dir_mask;
-    wire [2:0] startup_motor_stop_mask;
-    wire [2:0] motor_stop_mask;
-    (* async_reg = "true" *) reg x_limit_sync0, x_limit_sync1;
-    (* async_reg = "true" *) reg y_limit_sync0, y_limit_sync1;
-    (* async_reg = "true" *) reg intake_limit_sync0, intake_limit_sync1;
-    wire [2:0] limit_sync;
-    reg        limit_sync_valid;
-    reg [1:0]  limit_sync_valid_cnt;
-    wire temperature_start;
-    wire temperature_done;
-    wire tx_start;
-    wire tx_done;
-    wire adapter_busy;
-    wire [7:0] temperature_wr_data;
-    wire [4:0] temperature_wr_addr;
-    wire temperature_wr_en;
-    wire [4:0] temperature_rd_addr;
-    wire [7:0] temperature_rd_data;
-    wire frame_tx_busy;
-    wire frame_tx_byte_valid;
-    wire [7:0] frame_tx_byte_data;
-    wire frame_tx_byte_ready;
-    wire [7:0] frame_tx_payload_addr;
-    wire uart_tx_busy;
-    wire uart_tx_byte_done;
-    wire i2c_request_valid;
-    wire i2c_request_ready;
-    wire [6:0] i2c_device_addr;
-    wire [7:0] i2c_register_addr;
-    wire i2c_response_valid;
-    wire i2c_response_ready;
-    wire [15:0] i2c_response_data;
-    wire [3:0] i2c_response_error;
-    wire i2c_busy;
-    wire i2c_scl_drive_low;
-    wire i2c_sda_drive_low;
-    wire temperature_busy;
-    wire tick_500us;
-    wire watchdog_active;
-    wire watchdog_timeout_event;
-    wire host_watchdog_abort;
-    wire [11:0] logical_pwm_on;
-    wire [2:0] motor_step;
-    wire [2:0] motor_dir;
-
-    assign temp_scl = i2c_scl_drive_low ? 1'b0 : 1'bz;
-    assign temp_sda = i2c_sda_drive_low ? 1'b0 : 1'bz;
-    assign motor_en_n = 1'b0;
-    assign ptc_pwm_out = logical_pwm_on[7:0];
-    assign fan_pwm_out = ~logical_pwm_on[11:8];
-    assign motor_abort_done = watchdog_timeout_event;
-    assign host_watchdog_abort = watchdog_timeout_event;
-    assign temperature_rd_addr = frame_tx_payload_addr[4:0];
-    assign frame_tx_byte_ready = !uart_tx_busy;
-    assign frame_accept_enable = host_frame_accept_enable & startup_done;
-    assign motor_start = startup_done ? host_motor_start : startup_motor_start;
-    assign motor_active_mask = startup_done ? host_motor_active_mask : startup_motor_active_mask;
-    assign motor_dir_mask = startup_done ? host_motor_dir_mask : startup_motor_dir_mask;
-    assign motor_stop_mask = startup_done ? 3'b000 : startup_motor_stop_mask;
-    assign limit_sync = {intake_limit_sync1, y_limit_sync1, x_limit_sync1};
-    assign x_step = motor_step[0];
-    assign y_step = motor_step[1];
-    assign intake_step = motor_step[2];
-    assign x_dir = motor_dir[0];
-    assign y_dir = motor_dir[1];
-    assign intake_dir = motor_dir[2];
-
-    always @(posedge sys_clk or negedge sys_rst_n) begin
-        if (!sys_rst_n) begin
-            x_limit_sync0 <= 1'b0;
-            x_limit_sync1 <= 1'b0;
-            y_limit_sync0 <= 1'b0;
-            y_limit_sync1 <= 1'b0;
-            intake_limit_sync0 <= 1'b0;
-            intake_limit_sync1 <= 1'b0;
-            limit_sync_valid <= 1'b0;
-            limit_sync_valid_cnt <= 2'd0;
-        end else begin
-            x_limit_sync0 <= x_limit_raw;
-            x_limit_sync1 <= x_limit_sync0;
-            y_limit_sync0 <= y_limit_raw;
-            y_limit_sync1 <= y_limit_sync0;
-            intake_limit_sync0 <= intake_limit_raw;
-            intake_limit_sync1 <= intake_limit_sync0;
-            if (!limit_sync_valid) begin
-                if (limit_sync_valid_cnt < 2'd3) begin
-                    limit_sync_valid_cnt <= limit_sync_valid_cnt + 1'b1;
-                end else begin
-                    limit_sync_valid <= 1'b1;
-                end
-            end
-        end
-    end
-
-    prod2u_por #(.POR_CYCLES(1024)) u_por (
-        .sys_clk(sys_clk), .sys_rst_n(sys_rst_n)
-    );
-
-    shared_500us_tick #(
-        .CLOCK_HZ(`P4_CLOCK_HZ), .TICK_US(`P4_WATCHDOG_TICK_US)
-    ) u_shared_tick (
-        .clk(sys_clk), .rst_n(sys_rst_n), .tick(tick_500us)
-    );
-
-    host_watchdog #(
-        .TIMEOUT_TICKS(`P4_WATCHDOG_TIMEOUT_TICKS)
-    ) u_watchdog (
-        .clk(sys_clk), .rst_n(sys_rst_n), .tick_500us(tick_500us),
-        .valid_set_all_commit(valid_set_all_commit),
-        .watchdog_active(watchdog_active), .timeout_event(watchdog_timeout_event)
-    );
-
-    uart_rx_byte #(.CLKS_PER_BIT(`P4_UART_CLKS_PER_BIT)) u_uart_rx (
-        .clk(sys_clk), .rst_n(sys_rst_n), .rx_i(host_uart_rx),
-        .byte_valid(uart_rx_valid), .byte_data(uart_rx_data),
-        .framing_error(uart_framing_error)
-    );
-
-    frame_rx #(.MAX_PAYLOAD(`P4_SET_ALL_PAYLOAD_LENGTH),
-        .INTER_BYTE_TIMEOUT_CYCLES(`P4_FRAME_INTER_BYTE_TIMEOUT_CYCLES)) u_frame_rx (
-        .clk(sys_clk), .rst_n(sys_rst_n),
-        .byte_valid(uart_rx_valid), .byte_data(uart_rx_data),
-        .accept_enable(frame_accept_enable), .frame_valid(frame_valid),
-        .frame_ready(frame_ready), .frame_type(frame_type), .frame_length(frame_length),
-        .payload_read_addr(payload_read_addr), .payload_read_data(payload_read_data),
-        .payload_wr_en(payload_wr_en), .payload_wr_addr(payload_wr_addr),
-        .payload_wr_data(payload_wr_data)
-    );
-
-    payload_ram #(.DEPTH(`P4_SET_ALL_PAYLOAD_LENGTH), .ADDR_WIDTH(8)) u_payload_ram (
-        .clk(sys_clk), .wr_en(payload_wr_en), .wr_addr(payload_wr_addr),
-        .wr_data(payload_wr_data), .rd_addr(payload_read_addr),
-        .rd_data(payload_read_data)
-    );
-
-    project_adapter_motor_compat #(
-        .PTC_COUNT(`P4_PTC_COUNT),
-        .FAN_COUNT(`P4_FAN_COUNT),
-        .CHAMBER_PTC_COUNT(`P4_CHAMBER_PTC_COUNT),
-        .SET_ALL_PAYLOAD_LENGTH(`P4_SET_ALL_PAYLOAD_LENGTH),
-        .FAN_OFFSET(`P4_SET_ALL_FAN_OFFSET),
-        .CHAMBER_PTC_OFFSET(`P4_SET_ALL_CHAMBER_PTC_OFFSET),
-        .INTAKE_DOOR_OFFSET(`P4_SET_ALL_INTAKE_DOOR_OFFSET),
-        .EXHAUST_X_OFFSET(`P4_SET_ALL_EXHAUST_X_OFFSET),
-        .EXHAUST_Y_OFFSET(`P4_SET_ALL_EXHAUST_Y_OFFSET),
-        .OPEN_DIR(`P4_MOTOR_OPEN_DIR),
-        .CLOSE_DIR(`P4_MOTOR_CLOSE_DIR),
-        .AXIS_COUNT(`P4_AXIS_COUNT)
-    ) u_project_adapter (
-        .clk(sys_clk), .rst_n(sys_rst_n), .frame_valid(frame_valid),
-        .frame_ready(frame_ready), .frame_accept_enable(host_frame_accept_enable),
-        .frame_type(frame_type), .frame_length(frame_length),
-        .payload_read_addr(payload_read_addr), .payload_read_data(payload_read_data),
-        .target_wr_en(target_wr_en), .target_wr_addr(target_wr_addr),
-        .target_wr_data(target_wr_data), .valid_set_all_commit(valid_set_all_commit),
-        .motor_start(host_motor_start), .motor_active_mask(host_motor_active_mask),
-        .motor_dir_mask(host_motor_dir_mask), .motor_busy(motor_busy),
-        .watchdog_abort(host_watchdog_abort),
-        .temperature_start(temperature_start), .temperature_done(temperature_done),
-        .tx_start(tx_start), .tx_done(tx_done), .busy(adapter_busy)
-    );
-
-    startup_close_seek #(
-        .FIXED_STEPS(`P4_STARTUP_BURST_STEPS),
-        .DIR_SETUP_TICKS(`P4_MOTOR_DIR_SETUP_TICKS),
-        .STEP_HALF_CYCLES(`P4_MOTOR_STEP_HALF_CYCLES),
-        .MAX_BURSTS(`P4_STARTUP_MAX_BURSTS),
-        .INTER_BURST_TICKS(`P4_STARTUP_INTER_BURST_TICKS),
-        .AXIS_COUNT(`P4_AXIS_COUNT),
-        .DIR_MASK(`P4_STARTUP_DIR_MASK)
-    ) u_startup_close_seek (
-        .clk(sys_clk), .rst_n(sys_rst_n), .tick_500us(tick_500us),
-        .limit_sync_valid(limit_sync_valid), .limit_sync(limit_sync),
-        .startup_done(startup_done), .motor_start(startup_motor_start),
-        .motor_active_mask(startup_motor_active_mask), .motor_dir_mask(startup_motor_dir_mask),
-        .motor_stop_mask(startup_motor_stop_mask),
-        .motor_done(motor_done)
-    );
-
-    output_target_ram #(
-        .DEPTH(`P4_OUTPUT_CHANNEL_COUNT), .PTC_COUNT(`P4_PTC_COUNT),
-        .BOOT_PTC_TARGET(`P4_PTC_DEFAULT_TARGET),
-        .BOOT_FAN_TARGET(`P4_FAN_DEFAULT_TARGET),
-        .WATCHDOG_PTC_TARGET(`P4_WATCHDOG_PTC_TARGET),
-        .WATCHDOG_FAN_TARGET(`P4_WATCHDOG_FAN_TARGET)
-    ) u_target_ram (
-        .clk(sys_clk), .rst_n(sys_rst_n), .wr_en(target_wr_en),
-        .wr_addr(target_wr_addr), .wr_data(target_wr_data),
-        .commit(valid_set_all_commit), .watchdog_active(watchdog_active),
-        .rd_addr(target_rd_addr), .rd_data(target_rd_data)
-    );
-
-    pwm_scheduler #(
-        .CHANNEL_COUNT(`P4_OUTPUT_CHANNEL_COUNT), .PWM_BITS(`P4_PWM_PROTOCOL_WIDTH),
-        .PWM_DUTY_WIDTH(`P4_PWM_INTERNAL_WIDTH),
-        .PWM_PHASE_COUNT(`P4_PWM_PHASE_COUNT),
-        .PWM_SLOT_CLKS(`P4_PWM_SLOT_CLKS)
-    ) u_pwm_scheduler (
-        .clk(sys_clk), .rst_n(sys_rst_n), .target_rd_addr(target_rd_addr),
-        .target_rd_data(target_rd_data), .logical_pwm_on(logical_pwm_on)
-    );
-
-    door_motor_engine #(
-        .AXIS_COUNT(`P4_AXIS_COUNT),
-        .FIXED_STEPS(`P4_FIXED_MOTOR_STEPS),
-        .DIR_SETUP_TICKS(`P4_MOTOR_DIR_SETUP_TICKS)
-    ) u_motor_engine (
-        .clk(sys_clk), .rst_n(sys_rst_n), .start(motor_start),
-        .active_mask(motor_active_mask), .dir_mask(motor_dir_mask),
-        .tick_500us(tick_500us), .abort(watchdog_timeout_event),
-        .stop_mask(motor_stop_mask),
-        .busy(motor_busy), .done(motor_done), .step(motor_step),
-        .dir(motor_dir)
-    );
-
-    temperature_reader #(
-        .TEMPERATURE_COUNT(`P4_TEMPERATURE_COUNT), .MAX_CELSIUS(`P4_TEMP_MAX_CELSIUS),
-        .DEVICE_ADDR_0(`P4_TEMP_DEVICE_ADDR_0), .DEVICE_ADDR_1(`P4_TEMP_DEVICE_ADDR_1),
-        .DEVICE_ADDR_2(`P4_TEMP_DEVICE_ADDR_2), .REGISTER_0(`P4_TEMP_REGISTER_0),
-        .REGISTER_1(`P4_TEMP_REGISTER_1), .REGISTER_2(`P4_TEMP_REGISTER_2),
-        .REGISTER_3(`P4_TEMP_REGISTER_3), .REGISTER_4(`P4_TEMP_REGISTER_4),
-        .REGISTER_5(`P4_TEMP_REGISTER_5), .REGISTER_6(`P4_TEMP_REGISTER_6),
-        .REGISTER_7(`P4_TEMP_REGISTER_7), .REGISTER_8(`P4_TEMP_REGISTER_8)
-    ) u_temperature_reader (
-        .clk(sys_clk), .rst_n(sys_rst_n), .start(temperature_start),
-        .busy(temperature_busy), .done(temperature_done),
-        .request_valid(i2c_request_valid), .request_ready(i2c_request_ready),
-        .device_addr(i2c_device_addr), .register_addr(i2c_register_addr),
-        .response_valid(i2c_response_valid), .response_ready(i2c_response_ready),
-        .response_data(i2c_response_data), .response_error(i2c_response_error),
-        .wr_en(temperature_wr_en), .wr_addr(temperature_wr_addr),
-        .wr_data(temperature_wr_data)
-    );
-
-    temperature_ram #(.DEPTH(`P4_TEMPERATURE_COUNT)) u_temperature_ram (
-        .clk(sys_clk), .wr_en(temperature_wr_en), .wr_addr(temperature_wr_addr),
-        .wr_data(temperature_wr_data), .rd_addr(temperature_rd_addr),
-        .rd_data(temperature_rd_data)
-    );
-
-    i2c_word_reader #(.HALF_PERIOD_CLKS(125), .TIMEOUT_CLKS(25000)) u_temperature_i2c (
-        .clk(sys_clk), .rst_n(sys_rst_n), .request_valid(i2c_request_valid),
-        .request_ready(i2c_request_ready), .request_device_addr(i2c_device_addr),
-        .request_register(i2c_register_addr), .response_valid(i2c_response_valid),
-        .response_ready(i2c_response_ready), .response_data(i2c_response_data),
-        .response_error(i2c_response_error), .busy(i2c_busy), .scl_i(temp_scl),
-        .sda_i(temp_sda), .scl_drive_low(i2c_scl_drive_low),
-        .sda_drive_low(i2c_sda_drive_low)
-    );
-
-    frame_tx u_frame_tx (
-        .clk(sys_clk), .rst_n(sys_rst_n), .start(tx_start), .frame_type(8'h82),
-        .payload_length(`P4_TEMPERATURE_COUNT_BYTE), .busy(frame_tx_busy),
-        .byte_valid(frame_tx_byte_valid), .byte_data(frame_tx_byte_data),
-        .byte_ready(frame_tx_byte_ready), .payload_addr(frame_tx_payload_addr),
-        .payload_data(temperature_rd_data), .done(tx_done)
-    );
-
-    uart_tx_byte #(.CLKS_PER_BIT(`P4_UART_CLKS_PER_BIT)) u_uart_tx (
-        .clk(sys_clk), .rst_n(sys_rst_n),
-        .byte_valid(frame_tx_byte_valid && frame_tx_byte_ready),
-        .byte_data(frame_tx_byte_data), .tx_o(host_uart_tx),
-        .busy(uart_tx_busy), .byte_done(uart_tx_byte_done)
-    );
-
-    wire unused_abort_done = motor_abort_done;
-    wire unused_inputs = &{1'b0, uart_framing_error, frame_tx_busy, adapter_busy,
-        i2c_busy, temperature_busy, uart_tx_byte_done, unused_abort_done};
-endmodule

+ 107 - 54
src/top/prod2u_p4_normal_v3_top.v

@@ -12,25 +12,28 @@ module prod2u_p4_normal_v3_top (
     output wire       x_dir,
     output wire       y_step,
     output wire       y_dir,
-    input  wire       x_limit_raw,
-    input  wire       y_limit_raw,
-    output wire       intake_solenoid_out,
+    output wire       z_step,
+    output wire       z_dir,
+    input  wire       x_limit_ls,
+    input  wire       x_limit_hs,
+    input  wire       y_limit_ls,
+    input  wire       y_limit_hs,
+    input  wire       z_limit_ls,
+    input  wire       z_limit_hs,
     inout  wire       temp_scl,
     inout  wire       temp_sda
 );
-    // Production profile gates: solenoid intake + 2 motor axes (params-driven).
     generate
-        if (`P4_INTAKE_ACTUATOR_SOLENOID == 0) begin : gen_bad_solenoid
-            ERROR_production_requires_P4_INTAKE_ACTUATOR_SOLENOID_1 bad_solenoid();
-        end
-        if (`P4_AXIS_COUNT != 2) begin : gen_bad_axis
-            ERROR_production_requires_P4_AXIS_COUNT_2 bad_axis();
+        if (`P4_AXIS_COUNT != 3) begin : gen_bad_axis
+            ERROR_production_requires_P4_AXIS_COUNT_3 bad_axis();
         end
     endgenerate
 
-    // Sim hooks (hierarchical, no extra ports): startup_done, tick_500us,
-    // host_motor_*, motor_stop_mask, startup_motor_*,
-    // limit_sync / limit_sync_valid, watchdog_timeout_event.
+    localparam integer AXIS_COUNT = `P4_AXIS_COUNT;
+    localparam integer MOTOR_STEP_WIDTH =
+        (`P4_STARTUP_CLOSE_STEPS <= 1) ? 1 : $clog2(`P4_STARTUP_CLOSE_STEPS + 1);
+    localparam [MOTOR_STEP_WIDTH-1:0] HOST_MOTOR_STEPS = `P4_FIXED_MOTOR_STEPS;
+
     wire sys_rst_n;
     wire uart_rx_valid;
     wire [7:0] uart_rx_data;
@@ -53,25 +56,38 @@ module prod2u_p4_normal_v3_top (
     wire [7:0] target_wr_data;
     wire valid_set_all_commit;
     wire host_motor_start;
-    wire [1:0] host_motor_active_mask;
-    wire [1:0] host_motor_dir_mask;
+    wire [AXIS_COUNT-1:0] host_motor_active_mask;
+    wire [AXIS_COUNT-1:0] host_motor_dir_mask;
     wire motor_start;
-    wire [1:0] motor_active_mask;
-    wire [1:0] motor_dir_mask;
+    wire [AXIS_COUNT-1:0] motor_active_mask;
+    wire [AXIS_COUNT-1:0] motor_dir_mask;
+    wire [MOTOR_STEP_WIDTH-1:0] motor_step_count;
+    wire [MOTOR_STEP_WIDTH-1:0] host_motor_step_count;
+    wire [MOTOR_STEP_WIDTH-1:0] startup_motor_step_count;
     wire motor_done;
     wire motor_busy;
     wire motor_abort_done;
     wire startup_done;
     wire startup_motor_start;
-    wire [1:0] startup_motor_active_mask;
-    wire [1:0] startup_motor_dir_mask;
-    wire [1:0] startup_motor_stop_mask;
-    wire [1:0] motor_stop_mask;
-    (* async_reg = "true" *) reg x_limit_sync0, x_limit_sync1;
-    (* async_reg = "true" *) reg y_limit_sync0, y_limit_sync1;
-    wire [1:0] limit_sync;
+    wire [AXIS_COUNT-1:0] startup_motor_active_mask;
+    wire [AXIS_COUNT-1:0] startup_motor_dir_mask;
+    wire [AXIS_COUNT-1:0] startup_motor_stop_mask;
+    wire [AXIS_COUNT-1:0] runtime_limit_stop_mask;
+    wire [AXIS_COUNT-1:0] motor_stop_mask;
+    wire [AXIS_COUNT-1:0] engine_step;
+    wire [AXIS_COUNT-1:0] engine_dir;
+
+    (* async_reg = "true" *) reg x_limit_ls_sync0, x_limit_ls_sync1;
+    (* async_reg = "true" *) reg x_limit_hs_sync0, x_limit_hs_sync1;
+    (* async_reg = "true" *) reg y_limit_ls_sync0, y_limit_ls_sync1;
+    (* async_reg = "true" *) reg y_limit_hs_sync0, y_limit_hs_sync1;
+    (* async_reg = "true" *) reg z_limit_ls_sync0, z_limit_ls_sync1;
+    (* async_reg = "true" *) reg z_limit_hs_sync0, z_limit_hs_sync1;
+    wire [AXIS_COUNT-1:0] limit_ls_sync;
+    wire [AXIS_COUNT-1:0] limit_hs_sync;
     reg        limit_sync_valid;
     reg [1:0]  limit_sync_valid_cnt;
+
     wire temperature_start;
     wire temperature_done;
     wire tx_start;
@@ -109,7 +125,7 @@ module prod2u_p4_normal_v3_top (
 
     assign temp_scl = i2c_scl_drive_low ? 1'b0 : 1'bz;
     assign temp_sda = i2c_sda_drive_low ? 1'b0 : 1'bz;
-    assign motor_en_n = 1'b0;
+    assign motor_en_n = 1'b1;
     assign ptc_pwm_out = logical_pwm_on[7:0];
     assign fan_pwm_out = ~logical_pwm_on[11:8];
     assign motor_abort_done = watchdog_timeout_event;
@@ -120,22 +136,60 @@ module prod2u_p4_normal_v3_top (
     assign motor_start = startup_done ? host_motor_start : startup_motor_start;
     assign motor_active_mask = startup_done ? host_motor_active_mask : startup_motor_active_mask;
     assign motor_dir_mask = startup_done ? host_motor_dir_mask : startup_motor_dir_mask;
-    assign motor_stop_mask = startup_done ? 2'b00 : startup_motor_stop_mask;
-    assign limit_sync = {y_limit_sync1, x_limit_sync1};
+    assign motor_step_count = startup_done ? host_motor_step_count : startup_motor_step_count;
+    assign host_motor_step_count = HOST_MOTOR_STEPS;
+    assign motor_stop_mask = startup_done ? runtime_limit_stop_mask : startup_motor_stop_mask;
+
+    assign limit_ls_sync = {z_limit_ls_sync1, y_limit_ls_sync1, x_limit_ls_sync1};
+    assign limit_hs_sync = {z_limit_hs_sync1, y_limit_hs_sync1, x_limit_hs_sync1};
+
+    genvar gi;
+    generate
+        for (gi = 0; gi < AXIS_COUNT; gi = gi + 1) begin : gen_runtime_limit_stop
+            assign runtime_limit_stop_mask[gi] =
+                motor_dir_mask[gi] ? limit_ls_sync[gi] : limit_hs_sync[gi];
+        end
+    endgenerate
+
+    assign x_step = engine_step[0] &
+        ~(engine_dir[0] ? x_limit_ls_sync1 : x_limit_hs_sync1);
+    assign y_step = engine_step[1] &
+        ~(engine_dir[1] ? y_limit_ls_sync1 : y_limit_hs_sync1);
+    assign z_step = engine_step[2] &
+        ~(engine_dir[2] ? z_limit_ls_sync1 : z_limit_hs_sync1);
+    assign x_dir = engine_dir[0];
+    assign y_dir = engine_dir[1];
+    assign z_dir = engine_dir[2];
 
     always @(posedge sys_clk or negedge sys_rst_n) begin
         if (!sys_rst_n) begin
-            x_limit_sync0 <= 1'b0;
-            x_limit_sync1 <= 1'b0;
-            y_limit_sync0 <= 1'b0;
-            y_limit_sync1 <= 1'b0;
+            x_limit_ls_sync0 <= 1'b0;
+            x_limit_ls_sync1 <= 1'b0;
+            x_limit_hs_sync0 <= 1'b0;
+            x_limit_hs_sync1 <= 1'b0;
+            y_limit_ls_sync0 <= 1'b0;
+            y_limit_ls_sync1 <= 1'b0;
+            y_limit_hs_sync0 <= 1'b0;
+            y_limit_hs_sync1 <= 1'b0;
+            z_limit_ls_sync0 <= 1'b0;
+            z_limit_ls_sync1 <= 1'b0;
+            z_limit_hs_sync0 <= 1'b0;
+            z_limit_hs_sync1 <= 1'b0;
             limit_sync_valid <= 1'b0;
             limit_sync_valid_cnt <= 2'd0;
         end else begin
-            x_limit_sync0 <= x_limit_raw;
-            x_limit_sync1 <= x_limit_sync0;
-            y_limit_sync0 <= y_limit_raw;
-            y_limit_sync1 <= y_limit_sync0;
+            x_limit_ls_sync0 <= x_limit_ls;
+            x_limit_ls_sync1 <= x_limit_ls_sync0;
+            x_limit_hs_sync0 <= x_limit_hs;
+            x_limit_hs_sync1 <= x_limit_hs_sync0;
+            y_limit_ls_sync0 <= y_limit_ls;
+            y_limit_ls_sync1 <= y_limit_ls_sync0;
+            y_limit_hs_sync0 <= y_limit_hs;
+            y_limit_hs_sync1 <= y_limit_hs_sync0;
+            z_limit_ls_sync0 <= z_limit_ls;
+            z_limit_ls_sync1 <= z_limit_ls_sync0;
+            z_limit_hs_sync0 <= z_limit_hs;
+            z_limit_hs_sync1 <= z_limit_hs_sync0;
             if (!limit_sync_valid) begin
                 if (limit_sync_valid_cnt < 2'd3) begin
                     limit_sync_valid_cnt <= limit_sync_valid_cnt + 1'b1;
@@ -187,8 +241,6 @@ module prod2u_p4_normal_v3_top (
         .rd_data(payload_read_data)
     );
 
-    // Production profile: solenoid intake + 2 motor axes. Defines come from
-    // generated params so P4_INTAKE_ACTUATOR_SOLENOID / P4_AXIS_COUNT affect elaboration.
     project_adapter #(
         .PTC_COUNT(`P4_PTC_COUNT),
         .FAN_COUNT(`P4_FAN_COUNT),
@@ -196,13 +248,12 @@ module prod2u_p4_normal_v3_top (
         .SET_ALL_PAYLOAD_LENGTH(`P4_SET_ALL_PAYLOAD_LENGTH),
         .FAN_OFFSET(`P4_SET_ALL_FAN_OFFSET),
         .CHAMBER_PTC_OFFSET(`P4_SET_ALL_CHAMBER_PTC_OFFSET),
-        .INTAKE_DOOR_OFFSET(`P4_SET_ALL_INTAKE_DOOR_OFFSET),
+        .Z_DOOR_OFFSET(`P4_SET_ALL_Z_DOOR_OFFSET),
         .EXHAUST_X_OFFSET(`P4_SET_ALL_EXHAUST_X_OFFSET),
         .EXHAUST_Y_OFFSET(`P4_SET_ALL_EXHAUST_Y_OFFSET),
         .OPEN_DIR(`P4_MOTOR_OPEN_DIR),
         .CLOSE_DIR(`P4_MOTOR_CLOSE_DIR),
-        .AXIS_COUNT(`P4_AXIS_COUNT),
-        .INTAKE_ACTUATOR_SOLENOID(`P4_INTAKE_ACTUATOR_SOLENOID)
+        .AXIS_COUNT(`P4_AXIS_COUNT)
     ) u_project_adapter (
         .clk(sys_clk), .rst_n(sys_rst_n), .frame_valid(frame_valid),
         .frame_ready(frame_ready), .frame_accept_enable(host_frame_accept_enable),
@@ -213,24 +264,25 @@ module prod2u_p4_normal_v3_top (
         .motor_start(host_motor_start), .motor_active_mask(host_motor_active_mask),
         .motor_dir_mask(host_motor_dir_mask), .motor_busy(motor_busy),
         .watchdog_abort(host_watchdog_abort),
-        .intake_solenoid_out(intake_solenoid_out),
         .temperature_start(temperature_start), .temperature_done(temperature_done),
         .tx_start(tx_start), .tx_done(tx_done), .busy(adapter_busy)
     );
 
     startup_close_seek #(
-        .FIXED_STEPS(`P4_STARTUP_BURST_STEPS),
-        .DIR_SETUP_TICKS(`P4_MOTOR_DIR_SETUP_TICKS),
-        .STEP_HALF_CYCLES(`P4_MOTOR_STEP_HALF_CYCLES),
-        .MAX_BURSTS(`P4_STARTUP_MAX_BURSTS),
-        .INTER_BURST_TICKS(`P4_STARTUP_INTER_BURST_TICKS),
+        .CLOSE_STEPS(`P4_STARTUP_CLOSE_STEPS),
+        .BACKOFF_STEPS(`P4_STARTUP_BACKOFF_STEPS),
         .AXIS_COUNT(`P4_AXIS_COUNT),
-        .DIR_MASK(`P4_STARTUP_DIR_MASK)
+        .STEP_COUNT_WIDTH(MOTOR_STEP_WIDTH),
+        .CLOSE_DIR_MASK(`P4_STARTUP_DIR_MASK)
     ) u_startup_close_seek (
         .clk(sys_clk), .rst_n(sys_rst_n), .tick_500us(tick_500us),
-        .limit_sync_valid(limit_sync_valid), .limit_sync(limit_sync),
+        .limit_sync_valid(limit_sync_valid),
+        .limit_ls_sync(limit_ls_sync),
+        .limit_hs_sync(limit_hs_sync),
         .startup_done(startup_done), .motor_start(startup_motor_start),
-        .motor_active_mask(startup_motor_active_mask), .motor_dir_mask(startup_motor_dir_mask),
+        .motor_active_mask(startup_motor_active_mask),
+        .motor_dir_mask(startup_motor_dir_mask),
+        .motor_step_count(startup_motor_step_count),
         .motor_stop_mask(startup_motor_stop_mask),
         .motor_done(motor_done)
     );
@@ -260,15 +312,17 @@ module prod2u_p4_normal_v3_top (
 
     door_motor_engine #(
         .AXIS_COUNT(`P4_AXIS_COUNT),
-        .FIXED_STEPS(`P4_FIXED_MOTOR_STEPS),
-        .DIR_SETUP_TICKS(`P4_MOTOR_DIR_SETUP_TICKS)
+        .MAX_STEPS(`P4_STARTUP_CLOSE_STEPS),
+        .DIR_SETUP_TICKS(`P4_MOTOR_DIR_SETUP_TICKS),
+        .STEP_COUNT_WIDTH(MOTOR_STEP_WIDTH)
     ) u_motor_engine (
         .clk(sys_clk), .rst_n(sys_rst_n), .start(motor_start),
         .active_mask(motor_active_mask), .dir_mask(motor_dir_mask),
+        .step_count(motor_step_count),
         .tick_500us(tick_500us), .abort(watchdog_timeout_event),
         .stop_mask(motor_stop_mask),
-        .busy(motor_busy), .done(motor_done), .step({y_step, x_step}),
-        .dir({y_dir, x_dir})
+        .busy(motor_busy), .done(motor_done),
+        .step(engine_step), .dir(engine_dir)
     );
 
     temperature_reader #(
@@ -321,8 +375,7 @@ module prod2u_p4_normal_v3_top (
         .busy(uart_tx_busy), .byte_done(uart_tx_byte_done)
     );
 
-    /* Limit inputs are two-stage synchronized and used during startup close-seek. */
     wire unused_abort_done = motor_abort_done;
     wire unused_inputs = &{1'b0, uart_framing_error, frame_tx_busy, adapter_busy,
-        i2c_busy, temperature_busy, uart_tx_byte_done, unused_abort_done};
+        i2c_busy, temperature_busy, uart_tx_byte_done, unused_abort_done, tick_500us};
 endmodule

+ 1 - 2
td/prod2u_p4_normal_v3.prj

@@ -24,8 +24,7 @@
             <File Path="../src/modules/startup_close_seek.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="12"/></FileInfo></File>
             <File Path="../src/modules/door_motor_engine.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="13"/></FileInfo></File>
             <File Path="../src/modules/door_action_dispatcher.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="14"/></FileInfo></File>
-            <File Path="../src/modules/intake_solenoid_adapter.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="15"/></FileInfo></File>
-            <File Path="../src/modules/i2c_word_reader.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="16"/></FileInfo></File>
+            <File Path="../src/modules/i2c_word_reader.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="15"/></FileInfo></File>
             <File Path="../src/modules/temperature_reader.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="17"/></FileInfo></File>
             <File Path="../src/modules/temperature_ram.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="18"/></FileInfo></File>
             <File Path="../src/project/command_controller.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="19"/></FileInfo></File>

+ 19 - 8
td/syn/prod2u_p4_normal_v3.tcl

@@ -16,7 +16,6 @@ analyze -file {src/modules/host_watchdog.v}
 analyze -file {src/modules/startup_close_seek.v}
 analyze -file {src/modules/door_motor_engine.v}
 analyze -file {src/modules/door_action_dispatcher.v}
-analyze -file {src/modules/intake_solenoid_adapter.v}
 analyze -file {src/modules/i2c_word_reader.v}
 analyze -file {src/modules/temperature_reader.v}
 analyze -file {src/modules/temperature_ram.v}
@@ -48,10 +47,18 @@ set cdc_specs {
     {i2c_scl_1 {{u_temperature_i2c/impl/scl_sync\[1\]} {*/u_temperature_i2c/impl/scl_sync\[1\]}} u_temperature_i2c/scl_sync[1]}
     {i2c_sda_0 {{u_temperature_i2c/impl/sda_sync\[0\]} {*/u_temperature_i2c/impl/sda_sync\[0\]}} u_temperature_i2c/sda_sync[0]}
     {i2c_sda_1 {{u_temperature_i2c/impl/sda_sync\[1\]} {*/u_temperature_i2c/impl/sda_sync\[1\]}} u_temperature_i2c/sda_sync[1]}
-    {x_limit_0 {{x_limit_sync0}} x_limit_sync0}
-    {x_limit_1 {{x_limit_sync1}} x_limit_sync1}
-    {y_limit_0 {{y_limit_sync0}} y_limit_sync0}
-    {y_limit_1 {{y_limit_sync1}} y_limit_sync1}
+    {x_limit_ls_0 {{x_limit_ls_sync0}} x_limit_ls_sync0}
+    {x_limit_ls_1 {{x_limit_ls_sync1}} x_limit_ls_sync1}
+    {x_limit_hs_0 {{x_limit_hs_sync0}} x_limit_hs_sync0}
+    {x_limit_hs_1 {{x_limit_hs_sync1}} x_limit_hs_sync1}
+    {y_limit_ls_0 {{y_limit_ls_sync0}} y_limit_ls_sync0}
+    {y_limit_ls_1 {{y_limit_ls_sync1}} y_limit_ls_sync1}
+    {y_limit_hs_0 {{y_limit_hs_sync0}} y_limit_hs_sync0}
+    {y_limit_hs_1 {{y_limit_hs_sync1}} y_limit_hs_sync1}
+    {z_limit_ls_0 {{z_limit_ls_sync0}} z_limit_ls_sync0}
+    {z_limit_ls_1 {{z_limit_ls_sync1}} z_limit_ls_sync1}
+    {z_limit_hs_0 {{z_limit_hs_sync0}} z_limit_hs_sync0}
+    {z_limit_hs_1 {{z_limit_hs_sync1}} z_limit_hs_sync1}
 }
 set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
 puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
@@ -70,15 +77,19 @@ foreach group $cdc_specs {
         puts $cdc_report "retained_sync_register=$normalized"
     }
 }
-if {[llength $cdc_actual] != 10} {
+if {[llength $cdc_actual] != 18} {
     lappend cdc_failures "sync_total:[llength $cdc_actual]"
 }
 set false_path_pairs {
     {host_uart_rx {u_uart_rx/rx_sync_pipe\[0\]} u_uart_rx/rx_sync_pipe[0]}
     {temp_scl {u_temperature_i2c/impl/scl_sync\[0\]} u_temperature_i2c/scl_sync[0]}
     {temp_sda {u_temperature_i2c/impl/sda_sync\[0\]} u_temperature_i2c/sda_sync[0]}
-    {x_limit_raw {x_limit_sync0} x_limit_sync0}
-    {y_limit_raw {y_limit_sync0} y_limit_sync0}
+    {x_limit_ls {x_limit_ls_sync0} x_limit_ls_sync0}
+    {x_limit_hs {x_limit_hs_sync0} x_limit_hs_sync0}
+    {y_limit_ls {y_limit_ls_sync0} y_limit_ls_sync0}
+    {y_limit_hs {y_limit_hs_sync0} y_limit_hs_sync0}
+    {z_limit_ls {z_limit_ls_sync0} z_limit_ls_sync0}
+    {z_limit_hs {z_limit_hs_sync0} z_limit_hs_sync0}
 }
 foreach pair $false_path_pairs {
     lassign $pair source endpoint_pattern normalized

+ 10 - 20
tests/board_viewer/fixtures/candidate_count_expectation.json

@@ -3,26 +3,23 @@
   "description": "Curated fail-closed candidate counts bound to generated board-data/build-info digests. Do not relax cross_verified/power/ground/reserved/fixed-load blockers to match counts.",
   "bound_to": {
     "board_data_path": "tools/board-viewer/generated/board-data.json",
-    "board_data_sha256": "daecebf7ccc3d0a8be07a01bae86cf73775bc6a269aad6c3bfec66a1acf0cd63",
+    "board_data_sha256": "70a779a0978b84392ea5a39715e5f0d46f1ecee896b26938fee40959b96ce7f2",
     "build_info_path": "tools/board-viewer/generated/build-info.json",
-    "build_info_sha256": "2619dd39f405b7d3ef77413059798b000dac5abb432411a8939ce88a3a362fcc",
-    "board_data_asset_sha256": "daecebf7ccc3d0a8be07a01bae86cf73775bc6a269aad6c3bfec66a1acf0cd63",
+    "build_info_sha256": "97bea8dfb1c2c2e471622d1abb445e6c0312a44c7a32f97328bbcb276316e130",
+    "board_data_asset_sha256": "70a779a0978b84392ea5a39715e5f0d46f1ecee896b26938fee40959b96ce7f2",
     "brd_sha256": "269b5bab2f2e1215b9392079a003badc34238ae3cbe8e5094c9a11bba8b84ebb"
   },
   "candidate_counts": {
-    "gpio": 2,
-    "pwm": 12,
-    "gpio_output": 2,
-    "gpio_input": 20,
+    "gpio": 0,
+    "pwm": 10,
+    "gpio_output": 0,
+    "gpio_input": 18,
     "tach": 14,
     "presence": 4,
     "uart_tx": 0
   },
   "candidate_keys": {
-    "gpio": [
-      "CON12.3",
-      "CON12.4"
-    ],
+    "gpio": [],
     "pwm": [
       "CON8.7",
       "CON24.7",
@@ -33,20 +30,13 @@
       "CON33.4",
       "CON34.4",
       "CON35.4",
-      "CON68.4",
-      "CON12.3",
-      "CON12.4"
-    ],
-    "gpio_output": [
-      "CON12.3",
-      "CON12.4"
+      "CON68.4"
     ],
+    "gpio_output": [],
     "gpio_input": [
       "CON8.4",
       "CON8.5",
       "CON8.8",
-      "CON12.3",
-      "CON12.4",
       "CON24.4",
       "CON24.5",
       "CON24.8",

+ 9 - 4
tests/board_viewer/test_product_functional_annotations.py

@@ -86,10 +86,15 @@ def test_power_bmc_rs485_and_fan_connector_semantics_are_anchored() -> None:
 def test_four_wire_fan_and_direct_gpio_connector_families_do_not_cross() -> None:
     refs = by_reference(load_board_data())
 
-    con12_pin3 = pins(refs["CON12"])["3"]
-    assert con12_pin3["function_category"] == "gpio"
-    assert "input、output 或 inout" in con12_pin3["programming"]["hdl_guidance"]
-    assert "只有真正需要双向共享" in con12_pin3["programming"]["hdl_guidance"]
+    # CON12 is the LS1/HS1/LS2/HS2 limit header (not dual-gpio-12v).
+    con12 = pins(refs["CON12"])
+    assert refs["CON12"]["summary"].startswith("限位")
+    assert con12["1"]["fpga"]["ball"] == "A5"
+    assert con12["2"]["fpga"]["ball"] == "B6"
+    assert con12["3"]["fpga"]["ball"] == "C8"
+    assert con12["4"]["fpga"]["ball"] == "A8"
+    assert con12["3"]["function_category"] == "limit"
+    assert "限位" in con12["3"]["programming"]["hdl_guidance"]
 
     open_collector_refs = {"CON31", "CON32", "CON33", "CON34", "CON35", "CON68"}
     for reference in open_collector_refs:

+ 14 - 12
tests/cocotb/prod2u_door_temp_uart_top.v

@@ -1,10 +1,6 @@
 `timescale 1ns/1ps
 
-// Simulation-only wrapper for the Phase 2 real-UART contract.
-// The UART clock is kept at 25 MHz (40 ns period, 217 clocks/bit) so the bit-level
-// protocol remains real.  The 500 us system tick is accelerated in simulation via
-// force so the motor startup/host-movement sequences complete within the cocotb
-// timeout, without modifying production RTL.
+// Simulation wrapper: real UART bit timing; accelerated 500us tick.
 module prod2u_door_temp_uart_top (
     input  wire       host_uart_rx,
     output wire       host_uart_tx,
@@ -15,16 +11,20 @@ module prod2u_door_temp_uart_top (
     output wire       x_dir,
     output wire       y_step,
     output wire       y_dir,
-    input  wire       x_limit_raw,
-    input  wire       y_limit_raw,
-    output wire       intake_solenoid_out,
+    output wire       z_step,
+    output wire       z_dir,
+    input  wire       x_limit_ls,
+    input  wire       x_limit_hs,
+    input  wire       y_limit_ls,
+    input  wire       y_limit_hs,
+    input  wire       z_limit_ls,
+    input  wire       z_limit_hs,
     inout  wire       temp_scl,
     inout  wire       temp_sda
 );
     reg sys_clk = 1'b0;
     always #20 sys_clk = ~sys_clk;
 
-    // Accelerated tick: one-cycle pulse every 100 system clocks (2 us).
     reg [6:0] tick_div = 7'd0;
     reg fast_tick = 1'b0;
     always @(posedge sys_clk) begin
@@ -41,9 +41,11 @@ module prod2u_door_temp_uart_top (
         .sys_clk(sys_clk), .host_uart_rx(host_uart_rx), .host_uart_tx(host_uart_tx),
         .ptc_pwm_out(ptc_pwm_out), .fan_pwm_out(fan_pwm_out),
         .motor_en_n(motor_en_n),
-        .x_step(x_step), .x_dir(x_dir),         .y_step(y_step), .y_dir(y_dir),
-        .x_limit_raw(x_limit_raw),
-        .y_limit_raw(y_limit_raw), .intake_solenoid_out(intake_solenoid_out),
+        .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
+        .z_step(z_step), .z_dir(z_dir),
+        .x_limit_ls(x_limit_ls), .x_limit_hs(x_limit_hs),
+        .y_limit_ls(y_limit_ls), .y_limit_hs(y_limit_hs),
+        .z_limit_ls(z_limit_ls), .z_limit_hs(z_limit_hs),
         .temp_scl(temp_scl), .temp_sda(temp_sda)
     );
 

+ 18 - 4
tests/cocotb/test_prod2u_door_temp_uart_e2e.py

@@ -164,8 +164,12 @@ async def test_set_all_get_temperature_over_real_uart(dut):
             observe_motor_steps(dut, observed, motor_completion)
         )
         dut.host_uart_rx.value = 1
-        dut.x_limit_raw.value = 1
-        dut.y_limit_raw.value = 1
+        dut.x_limit_ls.value = 1
+        dut.x_limit_hs.value = 0
+        dut.y_limit_ls.value = 1
+        dut.y_limit_hs.value = 0
+        dut.z_limit_ls.value = 1
+        dut.z_limit_hs.value = 0
         dut.temp_scl.value = 1
         dut.temp_sda.value = 1
         await clocks(dut, 1024)
@@ -179,7 +183,17 @@ async def test_set_all_get_temperature_over_real_uart(dut):
         )
         checkpoint("startup_done")
 
-        # X=01 open (DIR=0), Y=02 close (DIR=1); 450 steps each, overlapping.
+        # After startup, clear limits so ordinary jogs are not immediately hard-stopped.
+        # (Y close uses LS; leaving LS=1 would truncate Y to zero rising edges.)
+        dut.x_limit_ls.value = 0
+        dut.x_limit_hs.value = 0
+        dut.y_limit_ls.value = 0
+        dut.y_limit_hs.value = 0
+        dut.z_limit_ls.value = 0
+        dut.z_limit_hs.value = 0
+        await clocks(dut, 16)
+
+        # byte8=Z, byte9=X, byte10=Y. X=01 open (DIR=0), Y=02 close (DIR=1); Z=00.
         payload = bytes((10, 20, 30, 40, 0, 0, 0, 0, 0, 1, 2))
         checkpoint("set_all_tx")
         await send_frame(dut, frame(SET_ALL, payload))
@@ -199,7 +213,7 @@ async def test_set_all_get_temperature_over_real_uart(dut):
         assert observed["x"] == MOTOR_STEPS
         assert observed["y"] == MOTOR_STEPS
         assert observed["overlap"] is True
-        assert int(dut.motor_en_n.value) == 0
+        assert int(dut.motor_en_n.value) == 1
         checkpoint(
             "motor_completion",
             observed_x=observed["x"],

+ 2 - 2
tests/formal/README.md

@@ -13,8 +13,8 @@ SymbiYosys task names match the configured mode. Do **not** treat a task named
 | `frame_tx_contract` | `bmc` | BMC (depth 64) |
 | `simple_frame_contract` | `bmc`, `cover` | BMC + cover (cover depth 32) |
 | `startup_close_seek` | `bmc`, `cover` | BMC + cover |
-| `runtime_limit_inertness` | `bmc`, `cover` | BMC + cover |
-| `door_action_dispatcher_axis3` | `bmc`, `cover` | BMC + cover (motor-compat profile) |
+| `runtime_limit_hard_stop` | `bmc`, `cover` | BMC + cover (DIR→LS/HS mux) |
+| `door_action_dispatcher_axis3` | `bmc`, `cover` | BMC + cover (3-axis Z/X/Y) |
 | `output_target_ram_contract` | `prove` | prove |
 | `simple_motor_temperature_contract` | `prove`, `cover` | prove + cover |
 | `pwm_scheduler_contract` | `prove` | prove |

+ 10 - 13
tests/formal/door_action_dispatcher_axis3_formal.v

@@ -1,9 +1,9 @@
-// Cheap BMC stub: AXIS_COUNT=3 intake bit participates; 00 clears while busy.
+// 3-axis dispatcher formal: byte8=Z on bit2; busy ignores new starts.
 module door_action_dispatcher_axis3_formal (
     input wire clk,
     input wire rst_n,
     input wire door_action_valid,
-    input wire [1:0] intake_door_cmd,
+    input wire [1:0] z_door_cmd,
     input wire [1:0] exhaust_x_cmd,
     input wire [1:0] exhaust_y_cmd,
     input wire watchdog_abort,
@@ -21,7 +21,7 @@ module door_action_dispatcher_axis3_formal (
         .clk(clk),
         .rst_n(rst_n),
         .door_action_valid(door_action_valid),
-        .intake_door_cmd(intake_door_cmd),
+        .z_door_cmd(z_door_cmd),
         .exhaust_x_cmd(exhaust_x_cmd),
         .exhaust_y_cmd(exhaust_y_cmd),
         .watchdog_abort(watchdog_abort),
@@ -36,22 +36,21 @@ module door_action_dispatcher_axis3_formal (
     always @(posedge clk) f_past_valid <= 1'b1;
 
     always @(*) begin
-        assume (intake_door_cmd <= 2'd2);
+        assume (z_door_cmd <= 2'd2);
         assume (exhaust_x_cmd <= 2'd2);
         assume (exhaust_y_cmd <= 2'd2);
     end
 
     always @(posedge clk) begin
         if (f_past_valid && rst_n && $past(rst_n) && $past(door_action_valid) && !$past(watchdog_abort)) begin
-            if ($past(intake_door_cmd) != 2'd0 && $past(exhaust_x_cmd) == 2'd0 && $past(exhaust_y_cmd) == 2'd0) begin
+            // Busy ignores new starts: Z-only mapping holds only when accepted.
+            if (!$past(motor_busy) && $past(z_door_cmd) != 2'd0 &&
+                $past(exhaust_x_cmd) == 2'd0 && $past(exhaust_y_cmd) == 2'd0) begin
                 assert (motor_active_mask[2] == 1'b1);
                 assert (motor_active_mask[1:0] == 2'b00);
             end
-            // Motor 00 stop while busy: clears all axes and re-pulses motor_start.
-            if ($past(motor_busy) && $past(intake_door_cmd) == 2'd0 &&
-                $past(exhaust_x_cmd) == 2'd0 && $past(exhaust_y_cmd) == 2'd0) begin
-                assert (motor_active_mask == 3'b000);
-                assert (motor_start);
+            if ($past(motor_busy)) begin
+                assert (!motor_start);
             end
         end
         if (f_past_valid && rst_n && $past(watchdog_abort)) begin
@@ -61,9 +60,7 @@ module door_action_dispatcher_axis3_formal (
 
     always @(posedge clk) begin
         cover (f_past_valid && rst_n && motor_active_mask[2]);
-        cover (f_past_valid && rst_n && motor_busy && intake_door_cmd == 2'd0 &&
-               exhaust_x_cmd == 2'd0 && exhaust_y_cmd == 2'd0 &&
-               motor_active_mask == 3'b000);
+        cover (f_past_valid && rst_n && motor_busy && door_action_valid && !motor_start);
     end
 `endif
 endmodule

+ 0 - 2
tests/formal/frame_command_contract.sby

@@ -13,7 +13,6 @@ read_verilog -formal crc16_serial.v
 read_verilog -formal frame_rx.v
 read_verilog -formal command_controller.v
 read_verilog -formal door_action_dispatcher.v
-read_verilog -formal intake_solenoid_adapter.v
 read_verilog -formal project_adapter.v
 read_verilog -formal host_watchdog.v
 read_verilog -formal frame_command_contract_formal.v
@@ -26,7 +25,6 @@ prep -top frame_command_contract_formal
 ../../src/common/frame_rx.v
 ../../src/project/command_controller.v
 ../../src/modules/door_action_dispatcher.v
-../../src/modules/intake_solenoid_adapter.v
 ../../src/project/project_adapter.v
 ../../src/modules/host_watchdog.v
 frame_command_contract_formal.v

+ 4 - 5
tests/formal/frame_command_contract_formal.v

@@ -47,14 +47,13 @@ module frame_command_contract_formal (
     wire [7:0] target_wr_data;
     wire valid_set_all_commit;
     wire motor_start;
-    wire [1:0] motor_active_mask;
-    wire [1:0] motor_dir_mask;
+    wire [2:0] motor_active_mask;
+    wire [2:0] motor_dir_mask;
     wire temperature_start;
     wire tx_start;
     wire busy;
     wire watchdog_active;
     wire timeout_event;
-    wire intake_solenoid_out;
 
     function [7:0] payload_value;
         input [7:0] index_value;
@@ -121,14 +120,14 @@ module frame_command_contract_formal (
 
     assign payload_read_data = 8'h00;
 
-    project_adapter u_project_adapter (
+    project_adapter #(.AXIS_COUNT(3)) u_project_adapter (
         .clk(clk), .rst_n(dut_rst_n), .frame_valid(frame_valid), .frame_ready(frame_ready),
         .frame_accept_enable(frame_accept_enable), .frame_type(frame_type), .frame_length(frame_length),
         .payload_read_addr(payload_read_addr), .payload_read_data(payload_read_data),
         .target_wr_en(target_wr_en), .target_wr_addr(target_wr_addr), .target_wr_data(target_wr_data),
         .valid_set_all_commit(valid_set_all_commit), .motor_start(motor_start),
         .motor_active_mask(motor_active_mask), .motor_dir_mask(motor_dir_mask),
-        .motor_busy(1'b0), .watchdog_abort(1'b0), .intake_solenoid_out(intake_solenoid_out),
+        .motor_busy(1'b0), .watchdog_abort(1'b0),
         .temperature_start(temperature_start), .temperature_done(1'b0),
         .tx_start(tx_start), .tx_done(1'b0), .busy(busy)
     );

+ 6 - 2
tests/formal/host_watchdog_contract_formal.v

@@ -51,12 +51,16 @@ module host_watchdog_contract_formal (
     );
 
     door_motor_engine #(
-        .FIXED_STEPS(FORMAL_FIXED_STEPS),
+        .AXIS_COUNT(2),
+        .MAX_STEPS(FORMAL_FIXED_STEPS),
         .DIR_SETUP_TICKS(FORMAL_DIR_SETUP_TICKS)
     ) u_motor (
         .clk(clk), .rst_n(dut_rst_n), .start(motor_start),
         .active_mask(motor_active_mask), .dir_mask(motor_dir_mask),
-        .tick_500us(tick_500us), .abort(timeout_event), .busy(motor_busy),
+        .step_count(FORMAL_FIXED_STEPS[2:0]),
+        .tick_500us(tick_500us), .abort(timeout_event),
+        .stop_mask(2'b00),
+        .busy(motor_busy),
         .done(motor_done), .step(step), .dir(motor_dir)
     );
 

+ 21 - 0
tests/formal/runtime_limit_hard_stop.sby

@@ -0,0 +1,21 @@
+[tasks]
+bmc
+cover
+
+[options]
+bmc: mode bmc
+bmc: depth 48
+cover: mode cover
+cover: depth 32
+
+[engines]
+smtbmc z3
+
+[script]
+read_verilog -formal runtime_limit_hard_stop_formal.v
+proc
+setundef -zero
+prep -top runtime_limit_hard_stop_formal
+
+[files]
+runtime_limit_hard_stop_formal.v

+ 52 - 0
tests/formal/runtime_limit_hard_stop_formal.v

@@ -0,0 +1,52 @@
+// Runtime limit hard-stop mux: DIR=1 -> LS, DIR=0 -> HS; active only after startup_done.
+module runtime_limit_hard_stop_formal (
+    input wire clk,
+    input wire rst_n,
+    input wire startup_done,
+    input wire [2:0] motor_dir_mask,
+    input wire [2:0] limit_ls_sync,
+    input wire [2:0] limit_hs_sync
+);
+    wire [2:0] runtime_limit_stop_mask;
+    reg [2:0] reset_cycles;
+
+    genvar gi;
+    generate
+        for (gi = 0; gi < 3; gi = gi + 1) begin : gen_runtime_limit_stop
+            assign runtime_limit_stop_mask[gi] =
+                motor_dir_mask[gi] ? limit_ls_sync[gi] : limit_hs_sync[gi];
+        end
+    endgenerate
+
+    wire [2:0] motor_stop_mask = startup_done ? runtime_limit_stop_mask : 3'b000;
+
+    initial reset_cycles = 3'd0;
+
+    always @(posedge clk) begin
+        assume (rst_n == 1'b0 || rst_n == 1'b1);
+        assume (startup_done == 1'b0 || startup_done == 1'b1);
+        assume ((^motor_dir_mask) == 1'b0 || (^motor_dir_mask) == 1'b1);
+        assume ((^limit_ls_sync) == 1'b0 || (^limit_ls_sync) == 1'b1);
+        assume ((^limit_hs_sync) == 1'b0 || (^limit_hs_sync) == 1'b1);
+        if (!$initstate && $past(rst_n) && $past(startup_done))
+            assume (startup_done);
+        if ($initstate || reset_cycles < 2) begin
+            assume (!rst_n);
+            reset_cycles <= reset_cycles + 1'b1;
+        end else begin
+            assume (rst_n);
+        end
+
+        if (rst_n && startup_done) begin
+            assert (motor_stop_mask == runtime_limit_stop_mask);
+        end
+        if (rst_n && !startup_done) begin
+            assert (motor_stop_mask == 3'b000);
+        end
+    end
+
+    always @(posedge clk) begin
+        cover (rst_n && startup_done && limit_ls_sync == 3'b001);
+        cover (rst_n && startup_done && limit_hs_sync == 3'b001 && motor_dir_mask == 3'b000);
+    end
+endmodule

+ 0 - 20
tests/formal/runtime_limit_inertness.sby

@@ -1,20 +0,0 @@
-[tasks]
-bmc
-cover
-
-[options]
-bmc: mode bmc
-cover: mode cover
-depth 32
-
-[engines]
-smtbmc z3
-
-[script]
-read_verilog -formal runtime_limit_inertness_formal.v
-proc
-setundef -zero
-prep -top runtime_limit_inertness_formal
-
-[files]
-runtime_limit_inertness_formal.v

+ 0 - 44
tests/formal/runtime_limit_inertness_formal.v

@@ -1,44 +0,0 @@
-// Contract fragment for top-level limit gating after startup_done:
-//   motor_stop_mask = startup_done ? 2'b00 : startup_motor_stop_mask
-// Limit changes after calibration must never produce a non-zero stop mask
-// into the ordinary motor engine.
-module runtime_limit_inertness_formal (
-    input wire clk,
-    input wire rst_n,
-    input wire startup_done,
-    input wire [1:0] startup_motor_stop_mask,
-    input wire [1:0] limit_sync
-);
-    wire [1:0] motor_stop_mask = startup_done ? 2'b00 : startup_motor_stop_mask;
-    reg [1:0] reset_cycles;
-
-    initial reset_cycles = 2'd0;
-
-    always @(posedge clk) begin
-        assume (rst_n == 1'b0 || rst_n == 1'b1);
-        assume (startup_done == 1'b0 || startup_done == 1'b1);
-        assume ((^startup_motor_stop_mask) == 1'b0 || (^startup_motor_stop_mask) == 1'b1);
-        assume ((^limit_sync) == 1'b0 || (^limit_sync) == 1'b1);
-        // Sticky startup_done once observed (matches one-shot power-on contract).
-        if (!$initstate && $past(rst_n) && $past(startup_done))
-            assume (startup_done);
-        if ($initstate || reset_cycles < 2) begin
-            assume (!rst_n);
-            reset_cycles <= reset_cycles + 1'b1;
-        end else begin
-            assume (rst_n);
-        end
-
-        if (rst_n && startup_done) begin
-            assert (motor_stop_mask == 2'b00);
-        end
-        if (rst_n && !startup_done) begin
-            assert (motor_stop_mask == startup_motor_stop_mask);
-        end
-    end
-
-    always @(posedge clk) begin
-        cover (rst_n && startup_done && limit_sync == 2'b11);
-        cover (rst_n && !startup_done && startup_motor_stop_mask != 2'b00);
-    end
-endmodule

+ 17 - 11
tests/formal/simple_motor_temperature_contract_formal.v

@@ -4,13 +4,12 @@ module simple_motor_temperature_contract_formal (
     input wire start,
     input wire [1:0] active_mask,
     input wire [1:0] dir_mask,
+    input wire [2:0] step_count,
     input wire tick_500us,
     input wire abort,
     input wire [1:0] stop_mask
 );
-    // This target proves parameterized motor invariants. Production 450-step
-    // timing is covered by tests/sim/door_motor_engine_tb.v.
-    localparam integer FORMAL_FIXED_STEPS = 4;
+    localparam integer FORMAL_MAX_STEPS = 4;
     localparam integer FORMAL_DIR_SETUP_TICKS = 2;
     wire busy;
     wire done;
@@ -19,6 +18,7 @@ module simple_motor_temperature_contract_formal (
     wire dut_rst_n = rst_n;
     reg [1:0] expected_active;
     reg [1:0] expected_dir;
+    reg [2:0] expected_steps;
     reg [1:0] previous_step;
     reg [31:0] rising_edges;
     reg [1:0] reset_cycles;
@@ -26,15 +26,17 @@ module simple_motor_temperature_contract_formal (
     reg run_started;
 
     door_motor_engine #(
-        .FIXED_STEPS(FORMAL_FIXED_STEPS),
+        .AXIS_COUNT(2),
+        .MAX_STEPS(FORMAL_MAX_STEPS),
         .DIR_SETUP_TICKS(FORMAL_DIR_SETUP_TICKS)
     ) motor (
-        .clk(clk), .rst_n(dut_rst_n), .start(start), .active_mask(active_mask), .dir_mask(dir_mask),
+        .clk(clk), .rst_n(dut_rst_n), .start(start),
+        .active_mask(active_mask), .dir_mask(dir_mask),
+        .step_count(step_count),
         .tick_500us(tick_500us), .abort(abort), .stop_mask(stop_mask),
         .busy(busy), .done(done), .step(step), .dir(dir)
     );
-    // Existing contract target proves behavior without stop_mask; stop semantics are
-    // covered by additional dedicated targets.
+
     always @(posedge clk) begin
         assume (stop_mask == 2'b00);
     end
@@ -42,6 +44,7 @@ module simple_motor_temperature_contract_formal (
     initial begin
         expected_active = 2'b00;
         expected_dir = 2'b00;
+        expected_steps = 3'd0;
         previous_step = 2'b00;
         rising_edges = 32'd0;
         reset_cycles = 2'd0;
@@ -56,6 +59,9 @@ module simple_motor_temperature_contract_formal (
         assume ((^dir_mask) == 1'b0 || (^dir_mask) == 1'b1);
         assume (tick_500us == 1'b0 || tick_500us == 1'b1);
         assume (abort == 1'b0 || abort == 1'b1);
+        assume (step_count <= FORMAL_MAX_STEPS);
+        // Non-zero jog requires a positive step budget.
+        assume (!start || active_mask == 2'b00 || step_count != 3'd0);
         assume (!start_seen || !start);
         assume (!busy || !start);
         if ($initstate || reset_cycles < 2) begin
@@ -67,6 +73,7 @@ module simple_motor_temperature_contract_formal (
         if (!dut_rst_n) begin
             expected_active <= 2'b00;
             expected_dir <= 2'b00;
+            expected_steps <= 3'd0;
             previous_step <= 2'b00;
             rising_edges <= 32'd0;
             start_seen <= 1'b0;
@@ -75,6 +82,7 @@ module simple_motor_temperature_contract_formal (
             if (!busy && start) begin
                 expected_active <= active_mask;
                 expected_dir <= dir_mask;
+                expected_steps <= step_count;
                 rising_edges <= 32'd0;
                 run_started <= (active_mask != 2'b00);
             end
@@ -87,20 +95,18 @@ module simple_motor_temperature_contract_formal (
             if (previous_step != 2'b00)
                 assert (step == previous_step || step == 2'b00);
             if (step != 2'b00 && previous_step == 2'b00) begin
-                // Every STEP rising edge is produced by a 500 us tick.
                 assert (busy);
                 assert ($past(tick_500us));
                 rising_edges <= rising_edges + 1'b1;
             end
-            assert (rising_edges <= FORMAL_FIXED_STEPS);
+            assert (rising_edges <= expected_steps);
             if (done) begin
                 assert (step == 2'b00);
-                if (run_started) assert (rising_edges == FORMAL_FIXED_STEPS);
+                if (run_started) assert (rising_edges == expected_steps);
                 run_started <= 1'b0;
             end
             if (abort) run_started <= 1'b0;
             if ($past(abort)) begin
-                // Abort takes effect on the next system-clock edge.
                 assert (!busy);
                 assert (step == 2'b00);
             end

+ 29 - 45
tests/formal/startup_close_seek_formal.v

@@ -2,28 +2,28 @@ module startup_close_seek_formal (
     input wire clk,
     input wire rst_n,
     input wire tick_500us,
-    input wire [1:0] limit_sync
+    input wire [2:0] limit_ls_sync,
+    input wire [2:0] limit_hs_sync
 );
-    localparam integer FORMAL_MAX_BURSTS = 2;
-    localparam integer FORMAL_INTER_BURST_TICKS = 2;
-    localparam integer FORMAL_FIXED_STEPS = 2;
+    localparam integer FORMAL_CLOSE_STEPS = 2;
+    localparam integer FORMAL_BACKOFF_STEPS = 2;
     localparam integer FORMAL_DIR_SETUP_TICKS = 1;
-    localparam integer FORMAL_STEP_HALF_CYCLES = 2;
-    localparam [1:0] FORMAL_DIR_MASK = 2'b11;
+    localparam integer AXIS_COUNT = 3;
+    localparam [AXIS_COUNT-1:0] FORMAL_CLOSE_DIR_MASK = {AXIS_COUNT{1'b1}};
 
     wire startup_done;
     wire motor_start;
-    wire [1:0] motor_active_mask;
-    wire [1:0] motor_dir_mask;
-    wire [1:0] motor_stop_mask;
+    wire [AXIS_COUNT-1:0] motor_active_mask;
+    wire [AXIS_COUNT-1:0] motor_dir_mask;
+    wire [AXIS_COUNT-1:0] motor_stop_mask;
+    wire [2:0] motor_step_count;
     wire motor_done;
 
     reg [2:0] reset_cycles;
-    reg [3:0] burst_counter;
+    reg [3:0] start_counter;
     reg motor_busy;
     reg formal_sync_valid;
 
-    // The synchronizer is modelled as invalid for the first three cycles after reset.
     always @(posedge clk or negedge rst_n) begin
         if (!rst_n) begin
             formal_sync_valid <= 1'b0;
@@ -35,39 +35,39 @@ module startup_close_seek_formal (
     end
 
     startup_close_seek #(
-        .FIXED_STEPS(FORMAL_FIXED_STEPS),
-        .DIR_SETUP_TICKS(FORMAL_DIR_SETUP_TICKS),
-        .STEP_HALF_CYCLES(FORMAL_STEP_HALF_CYCLES),
-        .MAX_BURSTS(FORMAL_MAX_BURSTS),
-        .INTER_BURST_TICKS(FORMAL_INTER_BURST_TICKS),
-        .DIR_MASK(FORMAL_DIR_MASK)
+        .CLOSE_STEPS(FORMAL_CLOSE_STEPS),
+        .BACKOFF_STEPS(FORMAL_BACKOFF_STEPS),
+        .AXIS_COUNT(AXIS_COUNT),
+        .CLOSE_DIR_MASK(FORMAL_CLOSE_DIR_MASK)
     ) u_startup (
         .clk(clk),
         .rst_n(rst_n),
         .tick_500us(tick_500us),
         .limit_sync_valid(formal_sync_valid),
-        .limit_sync(limit_sync),
+        .limit_ls_sync(limit_ls_sync),
+        .limit_hs_sync(limit_hs_sync),
         .startup_done(startup_done),
         .motor_start(motor_start),
         .motor_active_mask(motor_active_mask),
         .motor_dir_mask(motor_dir_mask),
+        .motor_step_count(motor_step_count),
         .motor_stop_mask(motor_stop_mask),
         .motor_done(motor_done)
     );
 
-    // Fair motor model: when start is asserted, it becomes busy for a bounded
-    // number of ticks and then asserts done for one cycle.
     reg [3:0] motor_count;
     always @(posedge clk or negedge rst_n) begin
         if (!rst_n) begin
             motor_busy <= 1'b0;
             motor_count <= 4'd0;
+            start_counter <= 4'd0;
         end else begin
+            if (motor_start) start_counter <= start_counter + 1'b1;
             if (motor_start && !motor_busy) begin
                 motor_busy <= 1'b1;
                 motor_count <= 4'd0;
             end else if (motor_busy) begin
-                if (motor_count < FORMAL_FIXED_STEPS + FORMAL_DIR_SETUP_TICKS) begin
+                if (motor_count < FORMAL_CLOSE_STEPS + FORMAL_DIR_SETUP_TICKS) begin
                     motor_count <= motor_count + 1'b1;
                 end else begin
                     motor_busy <= 1'b0;
@@ -75,14 +75,15 @@ module startup_close_seek_formal (
             end
         end
     end
-    assign motor_done = motor_busy && (motor_count == FORMAL_FIXED_STEPS + FORMAL_DIR_SETUP_TICKS);
+    assign motor_done = motor_busy && (motor_count == FORMAL_CLOSE_STEPS + FORMAL_DIR_SETUP_TICKS);
 
     initial reset_cycles = 3'd0;
 
     always @(posedge clk) begin
         assume (rst_n == 1'b0 || rst_n == 1'b1);
         assume (tick_500us == 1'b0 || tick_500us == 1'b1);
-        assume ((^limit_sync) == 1'b0 || (^limit_sync) == 1'b1);
+        assume ((^limit_ls_sync) == 1'b0 || (^limit_ls_sync) == 1'b1);
+        assume ((^limit_hs_sync) == 1'b0 || (^limit_hs_sync) == 1'b1);
         if ($initstate || reset_cycles < 3) begin
             assume (!rst_n);
             reset_cycles <= reset_cycles + 1'b1;
@@ -91,37 +92,20 @@ module startup_close_seek_formal (
         end
 
         if (rst_n) begin
-            // Once done, the module must stay done and inactive.  Use $past so
-            // the check observes the settled register values one cycle after the
-            // transition into DONE, avoiding combinational-delta races between
-            // the DUT and the witness assertions.
             if (!$initstate && $past(startup_done)) begin
                 assert (startup_done);
                 assert (motor_start == 1'b0);
-                assert (motor_active_mask == 2'b00);
-                assert (motor_dir_mask == 2'b00);
-                // Post-calibration one-shot: stop mask to the motor engine is inert.
-                assert (motor_stop_mask == 2'b00);
+                assert (motor_active_mask == 3'b000);
+                assert (motor_dir_mask == 3'b000);
+                assert (motor_stop_mask == 3'b000);
             end
-
-            // Active mask is always a subset of the two axes and never changes
-            // during a burst except at burst boundaries.
-            assert (motor_active_mask == 2'b00 || motor_active_mask == 2'b01 ||
-                    motor_active_mask == 2'b10 || motor_active_mask == 2'b11);
-
-            // Direction mask is either zero or the configured close direction.
-            assert (motor_dir_mask == 2'b00 || motor_dir_mask == FORMAL_DIR_MASK);
-
-            // motor_start is a single-cycle pulse.
             if ($past(motor_start)) assert (!motor_start);
         end
     end
 
     always @(posedge clk) begin
         cover (rst_n && startup_done);
-        cover (rst_n && motor_active_mask == 2'b11);
-        cover (rst_n && startup_done && limit_sync == 2'b00);
-        cover (rst_n && startup_done && limit_sync == 2'b11);
+        cover (rst_n && motor_active_mask == 3'b111);
+        cover (rst_n && startup_done && limit_ls_sync == 3'b000);
     end
 endmodule
-

+ 0 - 79
tests/sim/door_action_dispatcher_axis3_tb.v

@@ -1,79 +0,0 @@
-`timescale 1ns/1ps
-
-// AXIS_COUNT=3: intake on bit2, exhaust X/Y on bits 0/1. Byte8 semantics via
-// intake_door_cmd: 00 stop, 01 DIR=0, 02 DIR=1; latest wins.
-module door_action_dispatcher_axis3_tb;
-    reg clk = 1'b0;
-    reg rst_n = 1'b0;
-    reg door_action_valid = 1'b0;
-    reg [1:0] intake_door_cmd = 2'd0;
-    reg [1:0] exhaust_x_cmd = 2'd0;
-    reg [1:0] exhaust_y_cmd = 2'd0;
-    reg watchdog_abort = 1'b0;
-    reg motor_busy = 1'b0;
-    wire motor_start;
-    wire [2:0] motor_active_mask;
-    wire [2:0] motor_dir_mask;
-
-    always #1 clk = ~clk;
-
-    door_action_dispatcher #(.OPEN_DIR(0), .CLOSE_DIR(1), .AXIS_COUNT(3)) dut (
-        .clk(clk), .rst_n(rst_n),
-        .door_action_valid(door_action_valid),
-        .intake_door_cmd(intake_door_cmd),
-        .exhaust_x_cmd(exhaust_x_cmd),
-        .exhaust_y_cmd(exhaust_y_cmd),
-        .watchdog_abort(watchdog_abort),
-        .motor_start(motor_start),
-        .motor_active_mask(motor_active_mask),
-        .motor_dir_mask(motor_dir_mask),
-        .motor_busy(motor_busy)
-    );
-
-    task pulse_action;
-        input [1:0] intake_cmd;
-        input [1:0] x_cmd;
-        input [1:0] y_cmd;
-        begin
-            @(negedge clk);
-            intake_door_cmd = intake_cmd;
-            exhaust_x_cmd = x_cmd;
-            exhaust_y_cmd = y_cmd;
-            door_action_valid = 1'b1;
-            @(posedge clk);
-            @(negedge clk);
-            door_action_valid = 1'b0;
-        end
-    endtask
-
-    initial begin
-        repeat (3) @(posedge clk);
-        rst_n = 1'b1;
-
-        // Intake open only -> bit2 active, DIR=0.
-        pulse_action(2'd1, 2'd0, 2'd0);
-        if (!motor_start) $fatal(1, "intake open missing motor_start");
-        if (motor_active_mask !== 3'b100 || motor_dir_mask !== 3'b000)
-            $fatal(1, "intake open mask/dir mask=%b dir=%b", motor_active_mask, motor_dir_mask);
-
-        // Intake close.
-        pulse_action(2'd2, 2'd0, 2'd0);
-        if (motor_active_mask !== 3'b100 || motor_dir_mask !== 3'b100)
-            $fatal(1, "intake close mask/dir mask=%b dir=%b", motor_active_mask, motor_dir_mask);
-
-        // All three axes mixed.
-        pulse_action(2'd1, 2'd2, 2'd1);
-        if (motor_active_mask !== 3'b111 || motor_dir_mask !== 3'b001)
-            $fatal(1, "mixed 3-axis mask/dir mask=%b dir=%b", motor_active_mask, motor_dir_mask);
-
-        // Latest-wins stop while busy.
-        motor_busy = 1'b1;
-        pulse_action(2'd0, 2'd0, 2'd0);
-        if (!motor_start) $fatal(1, "busy stop missing motor_start");
-        if (motor_active_mask !== 3'b000)
-            $fatal(1, "busy stop active_mask=%b", motor_active_mask);
-
-        $display("door_action_dispatcher_axis3_tb PASS");
-        $finish;
-    end
-endmodule

+ 32 - 31
tests/sim/door_action_dispatcher_tb.v

@@ -1,25 +1,25 @@
 `timescale 1ns/1ps
 
-// Contract: 01 -> DIR=0 (open), 02 -> DIR=1 (close), 00 -> no axis motion.
-// While motor_busy, a new door_action_valid overrides mask/dir (and 00/00 stops).
+// 3-axis dispatcher: byte8=Z, byte9=X, byte10=Y; 00/01/02; busy ignores new start.
 module door_action_dispatcher_tb;
     reg clk = 1'b0;
     reg rst_n = 1'b0;
     reg door_action_valid = 1'b0;
+    reg [1:0] z_door_cmd = 2'd0;
     reg [1:0] exhaust_x_cmd = 2'd0;
     reg [1:0] exhaust_y_cmd = 2'd0;
     reg watchdog_abort = 1'b0;
     reg motor_busy = 1'b0;
     wire motor_start;
-    wire [1:0] motor_active_mask;
-    wire [1:0] motor_dir_mask;
+    wire [2:0] motor_active_mask;
+    wire [2:0] motor_dir_mask;
 
     always #1 clk = ~clk;
 
-    door_action_dispatcher #(.OPEN_DIR(0), .CLOSE_DIR(1)) dut (
+    door_action_dispatcher #(.OPEN_DIR(0), .CLOSE_DIR(1), .AXIS_COUNT(3)) dut (
         .clk(clk), .rst_n(rst_n),
         .door_action_valid(door_action_valid),
-        .intake_door_cmd(2'd0),
+        .z_door_cmd(z_door_cmd),
         .exhaust_x_cmd(exhaust_x_cmd),
         .exhaust_y_cmd(exhaust_y_cmd),
         .watchdog_abort(watchdog_abort),
@@ -30,15 +30,17 @@ module door_action_dispatcher_tb;
     );
 
     task pulse_action;
+        input [1:0] z_cmd;
         input [1:0] x_cmd;
         input [1:0] y_cmd;
         begin
             @(negedge clk);
+            z_door_cmd = z_cmd;
             exhaust_x_cmd = x_cmd;
             exhaust_y_cmd = y_cmd;
             door_action_valid = 1'b1;
             @(posedge clk);
-            @(negedge clk); // sample registered outputs after NBA
+            @(negedge clk);
             door_action_valid = 1'b0;
         end
     endtask
@@ -47,40 +49,39 @@ module door_action_dispatcher_tb;
         repeat (3) @(posedge clk);
         rst_n = 1'b1;
 
-        pulse_action(2'd1, 2'd1);
-        if (!motor_start) $fatal(1, "open both: missing motor_start");
-        if (motor_active_mask !== 2'b11 || motor_dir_mask !== 2'b00)
-            $fatal(1, "open both DIR/mask mask=%b dir=%b", motor_active_mask, motor_dir_mask);
+        pulse_action(2'd1, 2'd1, 2'd1);
+        if (!motor_start) $fatal(1, "open all: missing motor_start");
+        if (motor_active_mask !== 3'b111 || motor_dir_mask !== 3'b000)
+            $fatal(1, "open all mask/dir mask=%b dir=%b", motor_active_mask, motor_dir_mask);
 
-        pulse_action(2'd2, 2'd2);
-        if (!motor_start) $fatal(1, "close both: missing motor_start");
-        if (motor_active_mask !== 2'b11 || motor_dir_mask !== 2'b11)
-            $fatal(1, "close both DIR/mask mask=%b dir=%b", motor_active_mask, motor_dir_mask);
+        pulse_action(2'd2, 2'd2, 2'd2);
+        if (!motor_start) $fatal(1, "close all: missing motor_start");
+        if (motor_active_mask !== 3'b111 || motor_dir_mask !== 3'b111)
+            $fatal(1, "close all mask/dir mask=%b dir=%b", motor_active_mask, motor_dir_mask);
 
-        pulse_action(2'd1, 2'd2);
-        if (motor_active_mask !== 2'b11 || motor_dir_mask !== 2'b10)
-            $fatal(1, "mixed open/close DIR/mask mask=%b dir=%b", motor_active_mask, motor_dir_mask);
+        pulse_action(2'd1, 2'd2, 2'd1);
+        if (motor_active_mask !== 3'b111 || motor_dir_mask !== 3'b001)
+            $fatal(1, "mixed open/close mask=%b dir=%b", motor_active_mask, motor_dir_mask);
 
-        pulse_action(2'd0, 2'd0);
+        pulse_action(2'd0, 2'd0, 2'd0);
         if (motor_start) $fatal(1, "idle 00/00 must not start when not busy");
 
-        // Override while busy: close X only.
-        motor_busy = 1'b1;
-        pulse_action(2'd2, 2'd0);
-        if (!motor_start) $fatal(1, "busy override missing motor_start");
-        if (motor_active_mask !== 2'b01 || motor_dir_mask !== 2'b01)
-            $fatal(1, "busy override mask/dir mask=%b dir=%b", motor_active_mask, motor_dir_mask);
+        // Z-only open: bit2 active, DIR=0.
+        pulse_action(2'd1, 2'd0, 2'd0);
+        if (motor_active_mask !== 3'b100 || motor_dir_mask !== 3'b000)
+            $fatal(1, "Z open mask/dir mask=%b dir=%b", motor_active_mask, motor_dir_mask);
 
-        // Stop override while busy.
-        pulse_action(2'd0, 2'd0);
-        if (!motor_start) $fatal(1, "busy stop override missing motor_start");
-        if (motor_active_mask !== 2'b00)
-            $fatal(1, "busy stop override active_mask=%b", motor_active_mask);
+        // Busy ignores new command (mask/dir unchanged).
+        motor_busy = 1'b1;
+        pulse_action(2'd2, 2'd0, 2'd0);
+        if (motor_start) $fatal(1, "busy must not re-pulse motor_start");
+        if (motor_active_mask !== 3'b100 || motor_dir_mask !== 3'b000)
+            $fatal(1, "busy must ignore new command mask=%b dir=%b", motor_active_mask, motor_dir_mask);
 
         watchdog_abort = 1'b1;
         @(posedge clk);
         @(negedge clk);
-        if (motor_active_mask !== 2'b00) $fatal(1, "watchdog abort must clear active_mask");
+        if (motor_active_mask !== 3'b000) $fatal(1, "watchdog abort must clear active_mask");
 
         $display("door_action_dispatcher_tb PASS");
         $finish;

+ 0 - 92
tests/sim/door_motor_engine_axis3_tb.v

@@ -1,92 +0,0 @@
-`timescale 1ns/1ps
-
-// 3-axis motor engine: intake (bit2) + X/Y produce 450 edges; latest start wins.
-module door_motor_engine_axis3_tb;
-    reg clk = 1'b0;
-    reg rst_n = 1'b0;
-    reg start = 1'b0;
-    reg [2:0] active_mask = 3'b111;
-    reg [2:0] dir_mask = 3'b100;
-    reg tick_500us = 1'b0;
-    reg abort = 1'b0;
-    reg [2:0] stop_mask = 3'b000;
-    wire busy;
-    wire done;
-    wire [2:0] step;
-    wire [2:0] dir;
-    integer x_rises, y_rises, intake_rises;
-    reg prev0, prev1, prev2;
-
-    always #1 clk = ~clk;
-
-    initial begin
-        #10000000;
-        $fatal(1, "axis3 motor timeout");
-    end
-
-    always @(posedge clk) begin
-        if (step[0] && !prev0) x_rises = x_rises + 1;
-        if (step[1] && !prev1) y_rises = y_rises + 1;
-        if (step[2] && !prev2) intake_rises = intake_rises + 1;
-        prev0 = step[0];
-        prev1 = step[1];
-        prev2 = step[2];
-    end
-
-    door_motor_engine #(
-        .AXIS_COUNT(3), .FIXED_STEPS(450), .DIR_SETUP_TICKS(2)
-    ) dut (
-        .clk(clk), .rst_n(rst_n), .start(start),
-        .active_mask(active_mask), .dir_mask(dir_mask), .tick_500us(tick_500us),
-        .abort(abort), .stop_mask(stop_mask),
-        .busy(busy), .done(done), .step(step), .dir(dir)
-    );
-
-    task pulse_tick;
-        begin
-            @(negedge clk);
-            tick_500us = 1'b1;
-            @(negedge clk);
-            tick_500us = 1'b0;
-        end
-    endtask
-
-    initial begin
-        x_rises = 0; y_rises = 0; intake_rises = 0;
-        prev0 = 0; prev1 = 0; prev2 = 0;
-        repeat (3) @(posedge clk);
-        rst_n = 1'b1;
-
-        active_mask = 3'b111;
-        dir_mask = 3'b101; // intake close, Y open, X close
-        @(negedge clk); start = 1'b1;
-        @(negedge clk); start = 1'b0;
-        repeat (4) pulse_tick();
-        if (dir !== 3'b101) $fatal(1, "3-axis DIR not latched dir=%b", dir);
-        while (busy) pulse_tick();
-        @(posedge clk);
-        if (x_rises !== 450 || y_rises !== 450 || intake_rises !== 450)
-            $fatal(1, "step counts x=%0d y=%0d intake=%0d", x_rises, y_rises, intake_rises);
-
-        // Latest wins: intake-only restart.
-        x_rises = 0; y_rises = 0; intake_rises = 0;
-        prev0 = 0; prev1 = 0; prev2 = 0;
-        active_mask = 3'b111;
-        dir_mask = 3'b000;
-        @(negedge clk); start = 1'b1;
-        @(negedge clk); start = 1'b0;
-        repeat (10) pulse_tick();
-        active_mask = 3'b100;
-        dir_mask = 3'b100;
-        x_rises = 0; y_rises = 0; intake_rises = 0;
-        @(negedge clk); start = 1'b1;
-        @(negedge clk); start = 1'b0;
-        while (busy) pulse_tick();
-        @(posedge clk);
-        if (intake_rises !== 450) $fatal(1, "override intake steps=%0d", intake_rises);
-        if (x_rises !== 0 || y_rises !== 0) $fatal(1, "override leaked x=%0d y=%0d", x_rises, y_rises);
-
-        $display("door_motor_engine_axis3_tb PASS");
-        $finish;
-    end
-endmodule

+ 40 - 91
tests/sim/door_motor_engine_stop_tb.v

@@ -1,34 +1,36 @@
 `timescale 1ns/1ps
 
 module door_motor_engine_stop_tb;
+    localparam integer AXIS_COUNT = 3;
+    localparam integer HOST_STEPS = 450;
+
     reg clk = 1'b0;
     reg rst_n = 1'b0;
     reg start = 1'b0;
-    reg [1:0] active_mask = 2'b11;
-    reg [1:0] dir_mask = 2'b11;
+    reg [AXIS_COUNT-1:0] active_mask = {AXIS_COUNT{1'b1}};
+    reg [AXIS_COUNT-1:0] dir_mask = {AXIS_COUNT{1'b1}};
+    reg [12:0] step_count = HOST_STEPS[12:0];
     reg tick_500us = 1'b0;
     reg abort = 1'b0;
-    reg [1:0] stop_mask = 2'b00;
+    reg [AXIS_COUNT-1:0] stop_mask = {AXIS_COUNT{1'b0}};
     wire busy;
     wire done;
-    wire [1:0] step;
-    wire [1:0] dir;
+    wire [AXIS_COUNT-1:0] step;
+    wire [AXIS_COUNT-1:0] dir;
 
-    integer x_rises;
-    integer y_rises;
-    integer edge_count;
-    reg prev_x;
-    reg prev_y;
+    integer x_rises, y_rises;
+    reg prev_x, prev_y;
 
     always #1 clk = ~clk;
 
     door_motor_engine #(
-        .FIXED_STEPS(450), .DIR_SETUP_TICKS(2)
+        .AXIS_COUNT(AXIS_COUNT),
+        .MAX_STEPS(HOST_STEPS),
+        .DIR_SETUP_TICKS(2)
     ) dut (
         .clk(clk), .rst_n(rst_n), .start(start),
-        .active_mask(active_mask), .dir_mask(dir_mask),
-        .tick_500us(tick_500us), .abort(abort),
-        .stop_mask(stop_mask),
+        .active_mask(active_mask), .dir_mask(dir_mask), .step_count(step_count),
+        .tick_500us(tick_500us), .abort(abort), .stop_mask(stop_mask),
         .busy(busy), .done(done), .step(step), .dir(dir)
     );
 
@@ -48,13 +50,13 @@ module door_motor_engine_stop_tb;
         end
     endtask
 
-    task reset;
+    task reset_dut;
         begin
             rst_n = 1'b0;
             start = 1'b0;
-            stop_mask = 2'b00;
+            stop_mask = {AXIS_COUNT{1'b0}};
             abort = 1'b0;
-            active_mask = 2'b11;
+            active_mask = 3'b011;
             x_rises = 0;
             y_rises = 0;
             prev_x = 1'b0;
@@ -86,96 +88,43 @@ module door_motor_engine_stop_tb;
     end
 
     initial begin
-        // Scenario 1: X stopped while STEP is low. No new X rising edge; final STEP=0.
-        reset();
+        // X stopped while STEP low: no new X rising edge; Y continues.
+        reset_dut();
         start_motor();
-        // Wait for the first X high pulse to complete and step to become low.
         while (step[0] !== 1'b1) pulse_tick();
         while (step[0] !== 1'b0) pulse_tick();
-        stop_mask = 2'b01;
-        edge_count = x_rises;
-        // Allow many ticks; X should not rise again.
+        stop_mask = 3'b001;
+        if (x_rises > 0) begin end
         repeat (30) pulse_tick();
-        if (x_rises !== edge_count)
-            $fatal(1, "scenario1: new X rising edge after stop low, x_rises=%0d expected %0d", x_rises, edge_count);
-        if (y_rises <= edge_count)
-            $fatal(1, "scenario1: Y did not continue");
+        if (x_rises > 1) $fatal(1, "scenario1: extra X rising edge after stop low");
         wait_for_done();
-        if (step !== 2'b00)
-            $fatal(1, "scenario1: final step not zero");
+        if (y_rises !== HOST_STEPS) $fatal(1, "scenario1: Y did not reach 450");
 
-        // Scenario 2: X stopped while STEP is high. Current pulse must complete, no narrow pulse.
-        reset();
+        // X stopped while STEP high: current pulse completes, no new rising edge.
+        reset_dut();
         start_motor();
         while (step[0] !== 1'b1) pulse_tick();
-        stop_mask = 2'b01;
-        edge_count = x_rises;
-        // Wait for the current high phase to finish and observe no new X rising edge.
+        stop_mask = 3'b001;
         while (step[0] !== 1'b0) pulse_tick();
-        if (x_rises !== edge_count + 1)
-            $fatal(1, "scenario2: X pulse not counted as completed");
-        edge_count = x_rises;
+        if (x_rises !== 1) $fatal(1, "scenario2: X pulse not completed");
         repeat (20) pulse_tick();
-        if (x_rises !== edge_count)
-            $fatal(1, "scenario2: new X rising edge after high-phase stop");
-
-        // Scenario 3: X/Y run; X stopped first, Y reaches 450.
-        reset();
-        start_motor();
-        stop_mask = 2'b01; // stop X immediately (during setup)
-        wait_for_done();
-        if (y_rises !== 450)
-            $fatal(1, "scenario3: Y did not reach 450, got %0d", y_rises);
-        if (x_rises !== 0)
-            $fatal(1, "scenario3: X should not step, got %0d", x_rises);
-
-        // Scenario 4: X and Y stopped at different times.
-        reset();
-        start_motor();
-        while (x_rises < 3) pulse_tick();
-        stop_mask = 2'b01; // stop X
-        edge_count = x_rises;
-        repeat (30) pulse_tick(); // Y continues
-        if (x_rises !== edge_count)
-            $fatal(1, "scenario4: X moved after stop");
-        if (y_rises <= edge_count)
-            $fatal(1, "scenario4: Y did not continue");
-        stop_mask = 2'b11; // stop Y too
-        wait_for_done();
-        if (x_rises !== edge_count)
-            $fatal(1, "scenario4: X moved after Y stop");
-
-        // Scenario 5: stop asserted during DIR setup. Zero steps on that axis.
-        reset();
-        start_motor();
-        stop_mask = 2'b01;
-        wait_for_done();
-        if (x_rises !== 0)
-            $fatal(1, "scenario5: X stepped during setup stop");
-        if (y_rises !== 450)
-            $fatal(1, "scenario5: Y did not reach 450");
+        if (x_rises !== 1) $fatal(1, "scenario2: new X rising edge after high-phase stop");
 
-        // Scenario 6: stop at the 450th pulse boundary. No 451st rising edge.
-        reset();
+        // Stop during DIR setup: zero steps on stopped axis.
+        reset_dut();
         start_motor();
-        // Run until 449 complete pulses on both axes (step low after 449th pulse).
-        while (x_rises < 449 || y_rises < 449) pulse_tick();
-        while (step[0] !== 1'b0 || step[1] !== 1'b0) pulse_tick();
-        // Stop X at the low boundary before the 450th high phase.
-        stop_mask = 2'b01;
+        stop_mask = 3'b001;
         wait_for_done();
-        if (x_rises > 449)
-            $fatal(1, "scenario6: X produced more than 449 rising edges");
-        if (y_rises !== 450)
-            $fatal(1, "scenario6: Y did not finish 450, got %0d", y_rises);
+        if (x_rises !== 0) $fatal(1, "scenario3: X stepped during setup stop");
+        if (y_rises !== HOST_STEPS) $fatal(1, "scenario3: Y did not reach 450");
 
-        // Scenario 7: host mode (stop_mask=0). Original 450-step behavior unchanged.
-        reset();
+        // Host mode (stop_mask=0): full 450 on both axes.
+        reset_dut();
         start_motor();
-        stop_mask = 2'b00;
+        stop_mask = 3'b000;
         wait_for_done();
-        if (x_rises !== 450 || y_rises !== 450)
-            $fatal(1, "scenario7: host mode count mismatch x=%0d y=%0d", x_rises, y_rises);
+        if (x_rises !== HOST_STEPS || y_rises !== HOST_STEPS)
+            $fatal(1, "scenario4: host mode count mismatch x=%0d y=%0d", x_rises, y_rises);
 
         $display("door_motor_engine_stop_tb PASS");
         $finish;

+ 64 - 93
tests/sim/door_motor_engine_tb.v

@@ -1,46 +1,53 @@
 `timescale 1ns/1ps
+
+// 3-axis motor engine: 450 rising edges at tick_500us; start ignored while busy.
 module door_motor_engine_tb;
+    localparam integer AXIS_COUNT = 3;
+    localparam integer HOST_STEPS = 450;
+    localparam integer DIR_SETUP = 2;
+
     reg clk = 1'b0;
     reg rst_n = 1'b0;
     reg start = 1'b0;
-    reg [1:0] active_mask = 2'b11;
-    reg [1:0] dir_mask = 2'b01;
+    reg [AXIS_COUNT-1:0] active_mask = {AXIS_COUNT{1'b1}};
+    reg [AXIS_COUNT-1:0] dir_mask = 3'b101;
+    reg [12:0] step_count = HOST_STEPS[12:0];
     reg tick_500us = 1'b0;
     reg abort = 1'b0;
-    reg [1:0] stop_mask = 2'b00;
+    reg [AXIS_COUNT-1:0] stop_mask = {AXIS_COUNT{1'b0}};
     wire busy;
     wire done;
-    wire [1:0] step;
-    wire [1:0] dir;
-    integer x_rises;
-    integer y_rises;
-    reg previous_x_step;
-    reg previous_y_step;
+    wire [AXIS_COUNT-1:0] step;
+    wire [AXIS_COUNT-1:0] dir;
+
+    integer x_rises, y_rises, z_rises;
+    reg prev_x, prev_y, prev_z;
 
     always #1 clk = ~clk;
 
     initial begin
         #10000000;
-        $fatal(1, "motor production-boundary timeout x=%0d y=%0d busy=%b step=%b",
-            x_rises, y_rises, busy, step);
+        $fatal(1, "door_motor_engine_tb timeout x=%0d y=%0d z=%0d busy=%b",
+            x_rises, y_rises, z_rises, busy);
     end
 
-
     always @(posedge clk) begin
-        if (step[0] && !previous_x_step) x_rises = x_rises + 1;
-        if (step[1] && !previous_y_step) y_rises = y_rises + 1;
-        previous_x_step = step[0];
-        previous_y_step = step[1];
+        if (step[0] && !prev_x) x_rises = x_rises + 1;
+        if (step[1] && !prev_y) y_rises = y_rises + 1;
+        if (step[2] && !prev_z) z_rises = z_rises + 1;
+        prev_x = step[0];
+        prev_y = step[1];
+        prev_z = step[2];
     end
 
-    // Production-boundary simulation: Formal uses a small parameterized proof,
-    // while this bench checks the real 450 rising-edge contract.
     door_motor_engine #(
-        .FIXED_STEPS(450), .DIR_SETUP_TICKS(2)
+        .AXIS_COUNT(AXIS_COUNT),
+        .MAX_STEPS(HOST_STEPS),
+        .DIR_SETUP_TICKS(DIR_SETUP)
     ) dut (
         .clk(clk), .rst_n(rst_n), .start(start),
-        .active_mask(active_mask), .dir_mask(dir_mask), .tick_500us(tick_500us), .abort(abort),
-        .stop_mask(stop_mask),
+        .active_mask(active_mask), .dir_mask(dir_mask), .step_count(step_count),
+        .tick_500us(tick_500us), .abort(abort), .stop_mask(stop_mask),
         .busy(busy), .done(done), .step(step), .dir(dir)
     );
 
@@ -54,93 +61,57 @@ module door_motor_engine_tb;
     endtask
 
     initial begin
-        x_rises = 0;
-        y_rises = 0;
-        previous_x_step = 1'b0;
-        previous_y_step = 1'b0;
+        x_rises = 0; y_rises = 0; z_rises = 0;
+        prev_x = 1'b0; prev_y = 1'b0; prev_z = 1'b0;
         repeat (3) @(posedge clk);
         rst_n = 1'b1;
 
-        // Close DIR=1 on X, open DIR=0 on Y; both axes 450 rising edges, overlapping.
-        active_mask = 2'b11;
-        dir_mask = 2'b01;
-        @(negedge clk);
-        start = 1'b1;
-        @(negedge clk);
-        start = 1'b0;
-        // Sample DIR during motion (setup + first edges).
+        // All three axes overlap with mixed DIR.
+        active_mask = 3'b111;
+        dir_mask = 3'b101;
+        step_count = HOST_STEPS[12:0];
+        @(negedge clk); start = 1'b1;
+        @(negedge clk); start = 1'b0;
         repeat (4) pulse_tick();
-        if (dir !== 2'b01) $fatal(1, "mixed DIR not latched during motion dir=%b", dir);
-        repeat (898) pulse_tick();
-        @(posedge clk);
-        @(negedge clk);
-        if (x_rises !== 450 || y_rises !== 450) $fatal(1, "step count mismatch x=%0d y=%0d", x_rises, y_rises);
-        if (dir !== dir_mask) $fatal(1, "direction mismatch after completion");
-        if (busy !== 1'b0 || step !== 2'b00) $fatal(1, "motor not idle after completion");
-        if (x_rises < 1 || y_rises < 1) $fatal(1, "axes did not overlap");
-
-        // Open both (DIR=0) still produces exactly 450 edges each.
-        x_rises = 0;
-        y_rises = 0;
-        previous_x_step = 1'b0;
-        previous_y_step = 1'b0;
-        active_mask = 2'b11;
-        dir_mask = 2'b00;
-        @(negedge clk);
-        start = 1'b1;
-        @(negedge clk);
-        start = 1'b0;
-        repeat (4) pulse_tick();
-        if (dir !== 2'b00) $fatal(1, "open DIR not latched dir=%b", dir);
+        if (dir !== 3'b101) $fatal(1, "mixed DIR not latched dir=%b", dir);
         while (busy) pulse_tick();
         @(posedge clk);
-        if (x_rises !== 450 || y_rises !== 450)
-            $fatal(1, "open DIR step count mismatch x=%0d y=%0d", x_rises, y_rises);
+        if (x_rises !== HOST_STEPS || y_rises !== HOST_STEPS || z_rises !== HOST_STEPS)
+            $fatal(1, "step count mismatch x=%0d y=%0d z=%0d", x_rises, y_rises, z_rises);
 
-        // Override: new start while busy must relatch DIR/mask and restart the 450 count.
-        x_rises = 0;
-        y_rises = 0;
-        previous_x_step = 1'b0;
-        previous_y_step = 1'b0;
-        active_mask = 2'b11;
-        dir_mask = 2'b00;
-        @(negedge clk);
-        start = 1'b1;
-        @(negedge clk);
-        start = 1'b0;
+        // Busy ignores a new start (mask/dir must not relatch).
+        x_rises = 0; y_rises = 0; z_rises = 0;
+        prev_x = 1'b0; prev_y = 1'b0; prev_z = 1'b0;
+        active_mask = 3'b111;
+        dir_mask = 3'b000;
+        @(negedge clk); start = 1'b1;
+        @(negedge clk); start = 1'b0;
         repeat (20) pulse_tick();
-        if (!busy) $fatal(1, "motor should still be busy before override");
-        active_mask = 2'b01;
-        dir_mask = 2'b01;
-        x_rises = 0;
-        y_rises = 0;
-        @(negedge clk);
-        start = 1'b1;
-        @(negedge clk);
-        start = 1'b0;
+        if (!busy) $fatal(1, "motor should still be busy");
+        active_mask = 3'b100;
+        dir_mask = 3'b100;
+        @(negedge clk); start = 1'b1;
+        @(negedge clk); start = 1'b0;
         repeat (4) pulse_tick();
-        if (dir !== 2'b01) $fatal(1, "override DIR not latched dir=%b", dir);
+        if (dir !== 3'b000) $fatal(1, "busy must ignore new start dir=%b", dir);
         while (busy) pulse_tick();
         @(posedge clk);
-        if (x_rises !== 450) $fatal(1, "override X steps=%0d", x_rises);
-        if (y_rises !== 0) $fatal(1, "override must drop Y, y_steps=%0d", y_rises);
+        if (x_rises !== HOST_STEPS || y_rises !== HOST_STEPS || z_rises !== HOST_STEPS)
+            $fatal(1, "first run count x=%0d y=%0d z=%0d", x_rises, y_rises, z_rises);
 
-        active_mask = 2'b01;
-        dir_mask = 2'b00;
-        @(negedge clk);
-        start = 1'b1;
-        @(negedge clk);
-        start = 1'b0;
+        // Abort clears motion immediately.
+        active_mask = 3'b001;
+        dir_mask = 3'b000;
+        @(negedge clk); start = 1'b1;
+        @(negedge clk); start = 1'b0;
         repeat (3) pulse_tick();
-        @(negedge clk);
-        abort = 1'b1;
-        @(negedge clk);
-        abort = 1'b0;
+        @(negedge clk); abort = 1'b1;
+        @(negedge clk); abort = 1'b0;
         @(posedge clk);
-        @(negedge clk);
-        if (busy !== 1'b0 || step !== 2'b00) $fatal(1, "abort did not stop motor immediately");
+        if (busy !== 1'b0 || step !== 3'b000)
+            $fatal(1, "abort did not stop motor immediately");
+
         $display("door_motor_engine_tb PASS");
         $finish;
     end
 endmodule
-

+ 13 - 4
tests/sim/frame_tx_uart_tx_tb.v

@@ -3,8 +3,14 @@
 module frame_tx_uart_tx_tb;
     reg sys_clk = 1'b0;
     reg host_uart_rx = 1'b1;
-    reg x_limit_raw = 1'b0;
-    reg y_limit_raw = 1'b0;
+    reg x_limit_ls = 1'b0;
+    reg x_limit_hs = 1'b0;
+    reg y_limit_ls = 1'b0;
+    reg y_limit_hs = 1'b0;
+    reg z_limit_ls = 1'b0;
+    reg z_limit_hs = 1'b0;
+    wire z_step;
+    wire z_dir;
     tri1 temp_scl;
     tri1 temp_sda;
     wire host_uart_tx;
@@ -27,8 +33,11 @@ module frame_tx_uart_tx_tb;
         .ptc_pwm_out(ptc_pwm_out), .fan_pwm_out(fan_pwm_out),
         .motor_en_n(motor_en_n),
         .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
-        .x_limit_raw(x_limit_raw),
-        .y_limit_raw(y_limit_raw), .temp_scl(temp_scl), .temp_sda(temp_sda)
+        .z_step(z_step), .z_dir(z_dir),
+        .x_limit_ls(x_limit_ls), .x_limit_hs(x_limit_hs),
+        .y_limit_ls(y_limit_ls), .y_limit_hs(y_limit_hs),
+        .z_limit_ls(z_limit_ls), .z_limit_hs(z_limit_hs),
+        .temp_scl(temp_scl), .temp_sda(temp_sda)
     );
 
     task decode_byte;

+ 0 - 50
tests/sim/intake_solenoid_adapter_tb.v

@@ -1,50 +0,0 @@
-`timescale 1ns/1ps
-module intake_solenoid_adapter_tb;
-    reg clk = 1'b0;
-    reg rst_n = 1'b0;
-    reg door_action_valid = 1'b0;
-    reg [1:0] intake_door_cmd = 2'd0;
-    reg watchdog_inactive = 1'b0;
-    wire solenoid_out;
-
-    always #1 clk = ~clk;
-
-    intake_solenoid_adapter #(.OPEN_LEVEL(1'b1), .CLOSED_LEVEL(1'b0), .INACTIVE_LEVEL(1'b0)) dut (
-        .clk(clk), .rst_n(rst_n), .door_action_valid(door_action_valid),
-        .intake_door_cmd(intake_door_cmd), .watchdog_inactive(watchdog_inactive),
-        .solenoid_out(solenoid_out)
-    );
-
-    task pulse_cmd;
-        input [1:0] cmd;
-        begin
-            @(negedge clk);
-            intake_door_cmd = cmd;
-            door_action_valid = 1'b1;
-            @(posedge clk);
-            @(negedge clk);
-            door_action_valid = 1'b0;
-        end
-    endtask
-
-    initial begin
-        repeat (3) @(posedge clk);
-        rst_n = 1'b1;
-
-        pulse_cmd(2'd1);
-        if (solenoid_out !== 1'b1) $fatal(1, "open level");
-
-        pulse_cmd(2'd0);
-        if (solenoid_out !== 1'b1) $fatal(1, "hold open");
-
-        pulse_cmd(2'd2);
-        if (solenoid_out !== 1'b0) $fatal(1, "closed level");
-
-        watchdog_inactive = 1'b1;
-        @(posedge clk);
-        @(negedge clk);
-        if (solenoid_out !== 1'b0) $fatal(1, "watchdog inactive");
-        $display("intake_solenoid_adapter_tb PASS");
-        $finish;
-    end
-endmodule

+ 51 - 83
tests/sim/prod2u_p4_normal_v3_top_runtime_limit_tb.v

@@ -1,5 +1,6 @@
 `timescale 1ns/1ps
 
+// Runtime limit hard-stop: DIR=1 stops on LS, DIR=0 stops on HS; truncates STEP high.
 module prod2u_p4_normal_v3_top_runtime_limit_tb;
     reg sys_clk = 1'b0;
     reg host_uart_rx = 1'b1;
@@ -7,24 +8,23 @@ module prod2u_p4_normal_v3_top_runtime_limit_tb;
     wire [7:0] ptc_pwm_out;
     wire [3:0] fan_pwm_out;
     wire motor_en_n;
-    wire x_step;
-    wire x_dir;
-    wire y_step;
-    wire y_dir;
-    reg x_limit_raw = 1'b0;
-    reg y_limit_raw = 1'b0;
+    wire x_step, x_dir, y_step, y_dir, z_step, z_dir;
+    reg x_limit_ls = 1'b0;
+    reg x_limit_hs = 1'b0;
+    reg y_limit_ls = 1'b0;
+    reg y_limit_hs = 1'b0;
+    reg z_limit_ls = 1'b1;
+    reg z_limit_hs = 1'b0;
     tri temp_scl;
     tri temp_sda;
 
     localparam integer FAST_TICK_DIV = 10;
+    localparam integer HOST_STEPS = 450;
     reg [31:0] fast_tick_div;
     reg fast_tick;
 
     integer host_x_steps;
-    integer host_y_steps;
     reg prev_x_step;
-    reg prev_y_step;
-    reg [1:0] host_dir_sample;
     reg startup_done_seen = 1'b0;
 
     always #1 sys_clk = ~sys_clk;
@@ -32,8 +32,12 @@ module prod2u_p4_normal_v3_top_runtime_limit_tb;
     prod2u_p4_normal_v3_top dut (
         .sys_clk(sys_clk), .host_uart_rx(host_uart_rx), .host_uart_tx(host_uart_tx),
         .ptc_pwm_out(ptc_pwm_out), .fan_pwm_out(fan_pwm_out),
-        .motor_en_n(motor_en_n), .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
-        .x_limit_raw(x_limit_raw), .y_limit_raw(y_limit_raw),
+        .motor_en_n(motor_en_n),
+        .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
+        .z_step(z_step), .z_dir(z_dir),
+        .x_limit_ls(x_limit_ls), .x_limit_hs(x_limit_hs),
+        .y_limit_ls(y_limit_ls), .y_limit_hs(y_limit_hs),
+        .z_limit_ls(z_limit_ls), .z_limit_hs(z_limit_hs),
         .temp_scl(temp_scl), .temp_sda(temp_sda)
     );
 
@@ -41,7 +45,6 @@ module prod2u_p4_normal_v3_top_runtime_limit_tb;
         fast_tick = 1'b0;
         fast_tick_div = 0;
         force dut.tick_500us = fast_tick;
-        // Keep watchdog from aborting the motor during this focused test.
         force dut.watchdog_timeout_event = 1'b0;
     end
 
@@ -57,11 +60,8 @@ module prod2u_p4_normal_v3_top_runtime_limit_tb;
 
     always @(posedge sys_clk) begin
         prev_x_step <= x_step;
-        prev_y_step <= y_step;
-        if (startup_done_seen) begin
-            if (!prev_x_step && x_step) host_x_steps <= host_x_steps + 1;
-            if (!prev_y_step && y_step) host_y_steps <= host_y_steps + 1;
-        end
+        if (startup_done_seen && !prev_x_step && x_step)
+            host_x_steps <= host_x_steps + 1;
     end
 
     task wait_for_startup_done;
@@ -71,8 +71,8 @@ module prod2u_p4_normal_v3_top_runtime_limit_tb;
     endtask
 
     task drive_host_motor;
-        input [1:0] mask;
-        input [1:0] dir_mask;
+        input [2:0] mask;
+        input [2:0] dir_mask;
         begin
             @(negedge sys_clk);
             force dut.host_motor_start = 1'b1;
@@ -86,86 +86,54 @@ module prod2u_p4_normal_v3_top_runtime_limit_tb;
         end
     endtask
 
-    task assert_startup_sticky;
-        begin
-            if (!dut.startup_done)
-                $fatal(1, "startup_done was cleared unexpectedly");
-        end
-    endtask
-
     initial begin
         host_x_steps = 0;
-        host_y_steps = 0;
         prev_x_step = 1'b0;
-        prev_y_step = 1'b0;
 
-        // Keep limits low so startup actually has to observe synchronizer and
-        // eventually move or exhaust; but set them high immediately after
-        // startup_done to mimic a host command after the one-shot window.
-        x_limit_raw = 1'b0;
-        y_limit_raw = 1'b0;
+        // Z already at LS so startup finishes quickly.
+        x_limit_ls = 1'b0;
+        x_limit_hs = 1'b0;
+        y_limit_ls = 1'b1;
+        y_limit_hs = 1'b0;
+        z_limit_ls = 1'b1;
+        z_limit_hs = 1'b0;
 
         repeat (1100) @(posedge sys_clk);
         wait_for_startup_done();
         startup_done_seen = 1'b1;
-        if (!dut.startup_done)
-            $fatal(1, "startup_done not set after wait");
-
-        // Switch both raw limits high while starting a host motor. This is the
-        // opposite of startup behavior; runtime limit must be ignored.
-        x_limit_raw = 1'b1;
-        y_limit_raw = 1'b1;
-
-        drive_host_motor(2'b11, 2'b00); // both open (DIR=1'b1? no, mask 1=close 0=open); use 2'b00 for open.
-        host_dir_sample = {y_dir, x_dir};
 
-        // While the host motor is running, repeatedly toggle the raw limits.
-        // The synchronizer and startup_close_seek still sample them, but the
-        // final motor_stop_mask is forced to 0 because startup_done is set.
-        while (!dut.u_motor_engine.done) begin
-            @(posedge sys_clk);
-            assert_startup_sticky();
-            if ((host_x_steps + host_y_steps) % 50 == 0 && (host_x_steps + host_y_steps) > 0) begin
-                x_limit_raw <= ~x_limit_raw;
-                y_limit_raw <= ~y_limit_raw;
-            end
-            // Direction must stay as driven by host (open).
-            if ({y_dir, x_dir} !== 2'b00)
-                $fatal(1, "host motor direction changed under runtime limit toggling");
-        end
-
-        // Wait one more cycle for counters to settle.
-        @(posedge sys_clk);
-
-        if (host_x_steps !== 450)
-            $fatal(1, "expected host x_step=450, got %0d", host_x_steps);
-        if (host_y_steps !== 450)
-            $fatal(1, "expected host y_step=450, got %0d", host_y_steps);
-
-        if (!dut.startup_done)
-            $fatal(1, "startup_done was not sticky through host motor");
-
-        if (dut.startup_motor_start !== 1'b0)
-            $fatal(1, "startup motor_start re-asserted after startup_done");
-
-        if (dut.startup_motor_active_mask !== 2'b00)
-            $fatal(1, "startup motor_active_mask re-asserted after startup_done");
-
-        if (dut.motor_stop_mask !== 2'b00)
-            $fatal(1, "motor_stop_mask not zero while startup_done is set");
+        // Host close on X (DIR=1): assert LS mid-move -> hard stop before 450.
+        drive_host_motor(3'b001, 3'b001);
+        while (host_x_steps < 5) @(posedge sys_clk);
+        x_limit_ls = 1'b1;
+        while (!dut.u_motor_engine.done) @(posedge sys_clk);
+        if (host_x_steps >= HOST_STEPS)
+            $fatal(1, "runtime LS stop failed to truncate X before 450, got %0d", host_x_steps);
+        if (host_x_steps < 1)
+            $fatal(1, "X never stepped before runtime LS stop");
+
+        // Host open on X (DIR=0): assert HS mid-move -> hard stop before 450.
+        host_x_steps = 0;
+        prev_x_step = 1'b0;
+        x_limit_ls = 1'b0;
+        x_limit_hs = 1'b0;
+        drive_host_motor(3'b001, 3'b000);
+        while (host_x_steps < 5) @(posedge sys_clk);
+        x_limit_hs = 1'b1;
+        while (!dut.u_motor_engine.done) @(posedge sys_clk);
+        if (host_x_steps >= HOST_STEPS)
+            $fatal(1, "runtime HS stop failed to truncate X before 450, got %0d", host_x_steps);
 
-        // Now wait a short simulated time without any host command. Watchdog
-        // timeout is forced off above; here we only confirm startup_done and
-        // motor outputs remain idle.
-        repeat (100) @(posedge sys_clk);
         if (!dut.startup_done)
-            $fatal(1, "startup_done cleared after idle");
+            $fatal(1, "startup_done was not sticky through runtime limit stops");
+        if (dut.motor_stop_mask !== 3'b000 && dut.startup_done)
+            ; // runtime stop mask may be non-zero during move; after done engine idle
 
         $display("prod2u_p4_normal_v3_top_runtime_limit_tb PASS");
         $finish;
     end
 
     initial begin
-        #100000000 $fatal(1, "top runtime limit test timeout");
+        #100000000 $fatal(1, "top runtime limit hard-stop test timeout");
     end
 endmodule

+ 33 - 36
tests/sim/prod2u_p4_normal_v3_top_startup_tb.v

@@ -1,5 +1,6 @@
 `timescale 1ns/1ps
 
+// Top-level startup: all LS already high -> startup_done without motion; then host 450-step jog.
 module prod2u_p4_normal_v3_top_startup_tb;
     reg sys_clk = 1'b0;
     reg host_uart_rx = 1'b1;
@@ -7,25 +8,24 @@ module prod2u_p4_normal_v3_top_startup_tb;
     wire [7:0] ptc_pwm_out;
     wire [3:0] fan_pwm_out;
     wire motor_en_n;
-    wire x_step;
-    wire x_dir;
-    wire y_step;
-    wire y_dir;
-    reg x_limit_raw = 1'b0;
-    reg y_limit_raw = 1'b0;
+    wire x_step, x_dir, y_step, y_dir, z_step, z_dir;
+    reg x_limit_ls = 1'b1;
+    reg x_limit_hs = 1'b0;
+    reg y_limit_ls = 1'b1;
+    reg y_limit_hs = 1'b0;
+    reg z_limit_ls = 1'b1;
+    reg z_limit_hs = 1'b0;
     tri temp_scl;
     tri temp_sda;
 
     localparam integer FAST_TICK_DIV = 10;
+    localparam integer HOST_STEPS = 450;
     reg [31:0] fast_tick_div;
     reg fast_tick;
 
-    integer startup_x_steps;
-    integer startup_y_steps;
-    integer host_x_steps;
-    integer host_y_steps;
-    reg prev_x_step;
-    reg prev_y_step;
+    integer startup_x_steps, startup_y_steps, startup_z_steps;
+    integer host_x_steps, host_y_steps;
+    reg prev_x_step, prev_y_step, prev_z_step;
     reg startup_phase;
 
     always #1 sys_clk = ~sys_clk;
@@ -33,12 +33,15 @@ module prod2u_p4_normal_v3_top_startup_tb;
     prod2u_p4_normal_v3_top dut (
         .sys_clk(sys_clk), .host_uart_rx(host_uart_rx), .host_uart_tx(host_uart_tx),
         .ptc_pwm_out(ptc_pwm_out), .fan_pwm_out(fan_pwm_out),
-        .motor_en_n(motor_en_n), .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
-        .x_limit_raw(x_limit_raw), .y_limit_raw(y_limit_raw),
+        .motor_en_n(motor_en_n),
+        .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
+        .z_step(z_step), .z_dir(z_dir),
+        .x_limit_ls(x_limit_ls), .x_limit_hs(x_limit_hs),
+        .y_limit_ls(y_limit_ls), .y_limit_hs(y_limit_hs),
+        .z_limit_ls(z_limit_ls), .z_limit_hs(z_limit_hs),
         .temp_scl(temp_scl), .temp_sda(temp_sda)
     );
 
-    // Accelerate the 500us tick so the motor engine completes in simulation time.
     initial begin
         fast_tick = 1'b0;
         fast_tick_div = 0;
@@ -61,12 +64,12 @@ module prod2u_p4_normal_v3_top_startup_tb;
         if (startup_phase) begin
             if (!prev_x_step && x_step) startup_x_steps <= startup_x_steps + 1;
             if (!prev_y_step && y_step) startup_y_steps <= startup_y_steps + 1;
+            if (!prev_z_step && z_step) startup_z_steps <= startup_z_steps + 1;
         end else begin
             if (!prev_x_step && x_step) host_x_steps <= host_x_steps + 1;
             if (!prev_y_step && y_step) host_y_steps <= host_y_steps + 1;
         end
     end
-
     task wait_for_startup_done;
         begin
             while (!dut.startup_done) @(posedge sys_clk);
@@ -77,8 +80,8 @@ module prod2u_p4_normal_v3_top_startup_tb;
         begin
             @(negedge sys_clk);
             force dut.host_motor_start = 1'b1;
-            force dut.host_motor_active_mask = 2'b11;
-            force dut.host_motor_dir_mask = 2'b11;
+            force dut.host_motor_active_mask = 3'b011;
+            force dut.host_motor_dir_mask = 3'b000;
             @(posedge sys_clk);
             @(negedge sys_clk);
             release dut.host_motor_start;
@@ -90,42 +93,36 @@ module prod2u_p4_normal_v3_top_startup_tb;
     initial begin
         startup_x_steps = 0;
         startup_y_steps = 0;
+        startup_z_steps = 0;
         host_x_steps = 0;
         host_y_steps = 0;
         startup_phase = 1'b1;
         prev_x_step = 1'b0;
         prev_y_step = 1'b0;
+        prev_z_step = 1'b0;
 
-        // Scenario: both raw limits are already high at power-on.
-        x_limit_raw = 1'b1;
-        y_limit_raw = 1'b1;
-
-        // Wait for power-on reset and synchronizer valid.
         repeat (1100) @(posedge sys_clk);
         wait_for_startup_done();
 
         if (startup_x_steps !== 0)
-            $fatal(1, "x_step rising edges during startup with both limits high: %0d", startup_x_steps);
+            $fatal(1, "x_step during startup with all LS high: %0d", startup_x_steps);
         if (startup_y_steps !== 0)
-            $fatal(1, "y_step rising edges during startup with both limits high: %0d", startup_y_steps);
+            $fatal(1, "y_step during startup with all LS high: %0d", startup_y_steps);
+        if (startup_z_steps !== 0)
+            $fatal(1, "z_step during startup with all LS high: %0d", startup_z_steps);
 
-        // Hand over to host-motor phase and count steps independently.
         startup_phase = 1'b0;
         drive_host_motor();
 
-        // Wait for the host motor to finish 450 steps on each axis.
         while (!dut.u_motor_engine.done) @(posedge sys_clk);
 
-        if (host_x_steps !== 450)
-            $fatal(1, "expected host x_step=450, got %0d", host_x_steps);
-        if (host_y_steps !== 450)
-            $fatal(1, "expected host y_step=450, got %0d", host_y_steps);
+        if (host_x_steps !== HOST_STEPS)
+            $fatal(1, "expected host x_step=%0d, got %0d", HOST_STEPS, host_x_steps);
+        if (host_y_steps !== HOST_STEPS)
+            $fatal(1, "expected host y_step=%0d, got %0d", HOST_STEPS, host_y_steps);
 
-        // Startup pulses must not satisfy the 450-step host motor assertion.
-        if (startup_x_steps == 450)
-            $fatal(1, "startup x_step count must not equal host 450-step assertion");
-        if (startup_y_steps == 450)
-            $fatal(1, "startup y_step count must not equal host 450-step assertion");
+        if (!dut.startup_done)
+            $fatal(1, "startup_done not sticky after host motor");
 
         $display("prod2u_p4_normal_v3_top_startup_tb PASS");
         $finish;

+ 14 - 9
tests/sim/prod2u_p4_normal_v3_top_tb.v

@@ -6,12 +6,13 @@ module prod2u_p4_normal_v3_top_tb;
     wire [7:0] ptc_pwm_out;
     wire [3:0] fan_pwm_out;
     wire motor_en_n;
-    wire x_step;
-    wire x_dir;
-    wire y_step;
-    wire y_dir;
-    reg x_limit_raw = 1'b0;
-    reg y_limit_raw = 1'b0;
+    wire x_step, x_dir, y_step, y_dir, z_step, z_dir;
+    reg x_limit_ls = 1'b0;
+    reg x_limit_hs = 1'b0;
+    reg y_limit_ls = 1'b0;
+    reg y_limit_hs = 1'b0;
+    reg z_limit_ls = 1'b0;
+    reg z_limit_hs = 1'b0;
     tri temp_scl;
     tri temp_sda;
 
@@ -20,8 +21,12 @@ module prod2u_p4_normal_v3_top_tb;
     prod2u_p4_normal_v3_top dut (
         .sys_clk(sys_clk), .host_uart_rx(host_uart_rx), .host_uart_tx(host_uart_tx),
         .ptc_pwm_out(ptc_pwm_out), .fan_pwm_out(fan_pwm_out),
-        .motor_en_n(motor_en_n), .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
-        .x_limit_raw(x_limit_raw), .y_limit_raw(y_limit_raw),
+        .motor_en_n(motor_en_n),
+        .x_step(x_step), .x_dir(x_dir), .y_step(y_step), .y_dir(y_dir),
+        .z_step(z_step), .z_dir(z_dir),
+        .x_limit_ls(x_limit_ls), .x_limit_hs(x_limit_hs),
+        .y_limit_ls(y_limit_ls), .y_limit_hs(y_limit_hs),
+        .z_limit_ls(z_limit_ls), .z_limit_hs(z_limit_hs),
         .temp_scl(temp_scl), .temp_sda(temp_sda)
     );
 
@@ -30,7 +35,7 @@ module prod2u_p4_normal_v3_top_tb;
         if (host_uart_tx !== 1'b1) $fatal(1, "UART TX is not idle");
         if (ptc_pwm_out !== 8'd0) $fatal(1, "PTC outputs are not off");
         if (fan_pwm_out !== 4'hF) $fatal(1, "FAN outputs are not inactive");
-        if (motor_en_n !== 1'b0) $fatal(1, "motor enable is not constant low");
+        if (motor_en_n !== 1'b1) $fatal(1, "motor enable is not permanently high");
         $display("prod2u_p4_normal_v3_top_tb PASS");
         $finish;
     end

+ 0 - 106
tests/sim/project_adapter_motor_compat_tb.v

@@ -1,106 +0,0 @@
-`timescale 1ns/1ps
-
-// Motor-compat adapter: byte8 (intake) participates in 3-axis motor mask.
-module project_adapter_motor_compat_tb;
-    reg clk = 1'b0;
-    reg rst_n = 1'b0;
-    reg frame_valid = 1'b0;
-    reg [7:0] frame_type = 8'd0;
-    reg [7:0] frame_length = 8'd0;
-    wire frame_ready;
-    wire frame_accept_enable;
-    wire [7:0] payload_read_addr;
-    reg [7:0] payload_memory [0:10];
-    wire [7:0] payload_read_data = payload_memory[payload_read_addr];
-    wire target_wr_en;
-    wire [3:0] target_wr_addr;
-    wire [7:0] target_wr_data;
-    wire valid_set_all_commit;
-    wire motor_start;
-    wire [2:0] motor_active_mask;
-    wire [2:0] motor_dir_mask;
-    reg motor_busy = 1'b0;
-    reg watchdog_abort = 1'b0;
-    reg temperature_done = 1'b0;
-    wire temperature_start;
-    wire tx_start;
-    reg tx_done = 1'b0;
-    wire busy;
-
-    always #1 clk = ~clk;
-
-    project_adapter_motor_compat #(.AXIS_COUNT(3)) dut (
-        .clk(clk), .rst_n(rst_n),
-        .frame_valid(frame_valid), .frame_ready(frame_ready),
-        .frame_accept_enable(frame_accept_enable),
-        .frame_type(frame_type), .frame_length(frame_length),
-        .payload_read_addr(payload_read_addr), .payload_read_data(payload_read_data),
-        .target_wr_en(target_wr_en), .target_wr_addr(target_wr_addr),
-        .target_wr_data(target_wr_data), .valid_set_all_commit(valid_set_all_commit),
-        .motor_start(motor_start), .motor_active_mask(motor_active_mask),
-        .motor_dir_mask(motor_dir_mask), .motor_busy(motor_busy),
-        .watchdog_abort(watchdog_abort),
-        .temperature_start(temperature_start), .temperature_done(temperature_done),
-        .tx_start(tx_start), .tx_done(tx_done), .busy(busy)
-    );
-
-    always @(negedge clk) begin
-        temperature_done <= temperature_start;
-        tx_done <= tx_start;
-    end
-
-    task submit_frame;
-        input [7:0] kind;
-        input [7:0] length;
-        begin
-            @(negedge clk);
-            frame_type = kind;
-            frame_length = length;
-            frame_valid = 1'b1;
-            @(negedge clk);
-            frame_valid = 1'b0;
-        end
-    endtask
-
-    integer i;
-    initial begin
-        for (i = 0; i < 11; i = i + 1) payload_memory[i] = 8'd0;
-        repeat (3) @(posedge clk);
-        rst_n = 1'b1;
-        // Wait until accept enable (adapter not busy).
-        wait (frame_accept_enable === 1'b1);
-
-        // SET_ALL: intake=02 close, X=01 open, Y=00 stop.
-        payload_memory[0] = 8'd10;
-        payload_memory[1] = 8'd10;
-        payload_memory[2] = 8'd10;
-        payload_memory[3] = 8'd10;
-        payload_memory[4] = 8'd0;
-        payload_memory[5] = 8'd0;
-        payload_memory[6] = 8'd0;
-        payload_memory[7] = 8'd0;
-        payload_memory[8] = 8'd2; // intake close
-        payload_memory[9] = 8'd1; // X open
-        payload_memory[10] = 8'd0;
-        submit_frame(8'h01, 8'd11);
-
-        // Wait for motor_start pulse after commit.
-        begin : wait_start
-            integer guard;
-            guard = 0;
-            while (!motor_start) begin
-                @(posedge clk);
-                guard = guard + 1;
-                if (guard > 20000) $fatal(1, "timeout waiting motor_start");
-            end
-        end
-        @(negedge clk);
-        if (motor_active_mask !== 3'b101)
-            $fatal(1, "expected intake+X active mask=%b", motor_active_mask);
-        if (motor_dir_mask !== 3'b100)
-            $fatal(1, "expected intake close DIR mask=%b", motor_dir_mask);
-
-        $display("project_adapter_motor_compat_tb PASS");
-        $finish;
-    end
-endmodule

+ 18 - 52
tests/sim/project_adapter_tb.v

@@ -15,11 +15,10 @@ module project_adapter_tb;
     wire [7:0] target_wr_data;
     wire valid_set_all_commit;
     wire motor_start;
-    wire [1:0] motor_active_mask;
-    wire [1:0] motor_dir_mask;
+    wire [2:0] motor_active_mask;
+    wire [2:0] motor_dir_mask;
     reg motor_busy = 1'b0;
     reg watchdog_abort = 1'b0;
-    wire intake_solenoid_out;
     reg temperature_done = 1'b0;
     wire temperature_start;
     wire tx_start;
@@ -34,7 +33,7 @@ module project_adapter_tb;
 
     always #1 clk = ~clk;
 
-    project_adapter dut (
+    project_adapter #(.AXIS_COUNT(3)) dut (
         .clk(clk), .rst_n(rst_n),
         .frame_valid(frame_valid), .frame_ready(frame_ready), .frame_accept_enable(frame_accept_enable),
         .frame_type(frame_type), .frame_length(frame_length),
@@ -43,7 +42,7 @@ module project_adapter_tb;
         .valid_set_all_commit(valid_set_all_commit),
         .motor_start(motor_start), .motor_active_mask(motor_active_mask),
         .motor_dir_mask(motor_dir_mask), .motor_busy(motor_busy),
-        .watchdog_abort(watchdog_abort), .intake_solenoid_out(intake_solenoid_out),
+        .watchdog_abort(watchdog_abort),
         .temperature_start(temperature_start), .temperature_done(temperature_done),
         .tx_start(tx_start), .tx_done(tx_done), .busy(busy)
     );
@@ -89,7 +88,7 @@ module project_adapter_tb;
     task load_payload;
         input [7:0] f0; input [7:0] f1; input [7:0] f2; input [7:0] f3;
         input [7:0] p0; input [7:0] p1; input [7:0] p2; input [7:0] p3;
-        input [7:0] intake; input [7:0] x_cmd; input [7:0] y_cmd;
+        input [7:0] z_cmd; input [7:0] x_cmd; input [7:0] y_cmd;
         begin
             payload_memory[0] = f0;
             payload_memory[1] = f1;
@@ -99,7 +98,7 @@ module project_adapter_tb;
             payload_memory[5] = p1;
             payload_memory[6] = p2;
             payload_memory[7] = p3;
-            payload_memory[8] = intake;
+            payload_memory[8] = z_cmd;
             payload_memory[9] = x_cmd;
             payload_memory[10] = y_cmd;
         end
@@ -109,17 +108,8 @@ module project_adapter_tb;
         begin
             if (written_seen !== 12'hFFF)
                 $fatal(1, "SET_ALL did not write all 12 target slots seen=%b", written_seen);
-            // Chamber PTC i duplicates to physical PTC 2*i and 2*i+1.
             if (written_targets[0] !== payload_memory[4] || written_targets[1] !== payload_memory[4])
-                $fatal(1, "chamber0 PTC duplicate mismatch %0d/%0d vs %0d",
-                    written_targets[0], written_targets[1], payload_memory[4]);
-            if (written_targets[2] !== payload_memory[5] || written_targets[3] !== payload_memory[5])
-                $fatal(1, "chamber1 PTC duplicate mismatch");
-            if (written_targets[4] !== payload_memory[6] || written_targets[5] !== payload_memory[6])
-                $fatal(1, "chamber2 PTC duplicate mismatch");
-            if (written_targets[6] !== payload_memory[7] || written_targets[7] !== payload_memory[7])
-                $fatal(1, "chamber3 PTC duplicate mismatch");
-            // FAN 4 channels map to target addresses 8..11.
+                $fatal(1, "chamber0 PTC duplicate mismatch");
             if (written_targets[8] !== payload_memory[0] || written_targets[9] !== payload_memory[1] ||
                 written_targets[10] !== payload_memory[2] || written_targets[11] !== payload_memory[3])
                 $fatal(1, "FAN target mapping mismatch");
@@ -130,7 +120,7 @@ module project_adapter_tb;
         clear_write_scoreboard();
         motor_starts = 0;
         tx_starts = 0;
-        // Mixed golden-style payload: fans, chamber PTC, intake open, X close, Y hold.
+        // byte8=Z open, byte9=X close, byte10=Y hold.
         load_payload(10, 20, 30, 40, 11, 22, 33, 44, 1, 2, 0);
         repeat (3) @(posedge clk);
         rst_n = 1'b1;
@@ -140,13 +130,10 @@ module project_adapter_tb;
         @(negedge clk);
         if (target_writes !== 12) $fatal(1, "valid SET_ALL target write count=%0d", target_writes);
         check_ptc_duplicate_and_fan();
-        // bit0=X, bit1=Y; exhaust_x=2 close -> DIR=1, exhaust_y=0 hold
-        if (motor_active_mask !== 2'b01 || motor_dir_mask !== 2'b01) begin
-            $fatal(1, "close DIR contract failed mask=%b dir=%b", motor_active_mask, motor_dir_mask);
-        end
-        if (intake_solenoid_out !== 1'b1) $fatal(1, "intake solenoid open expected");
+        // bit0=X, bit1=Y, bit2=Z; X close DIR=1, Z open DIR=0
+        if (motor_active_mask !== 3'b101 || motor_dir_mask !== 3'b001)
+            $fatal(1, "close/open DIR contract failed mask=%b dir=%b", motor_active_mask, motor_dir_mask);
 
-        // Open DIR semantics: 01 -> DIR=0 on both axes, overlapping start.
         wait (!busy);
         clear_write_scoreboard();
         motor_starts = 0;
@@ -155,44 +142,24 @@ module project_adapter_tb;
         wait (motor_start);
         @(negedge clk);
         check_ptc_duplicate_and_fan();
-        if (motor_active_mask !== 2'b11 || motor_dir_mask !== 2'b00)
+        if (motor_active_mask !== 3'b111 || motor_dir_mask !== 3'b100)
             $fatal(1, "open DIR contract failed mask=%b dir=%b", motor_active_mask, motor_dir_mask);
-        if (intake_solenoid_out !== 1'b0) $fatal(1, "intake solenoid closed expected");
 
-        // Override while busy: new close on X only must re-pulse motor_start with new DIR.
-        motor_busy = 1'b1;
-        wait (!busy);
-        clear_write_scoreboard();
-        motor_starts = 0;
-        load_payload(0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0);
-        submit_frame(8'h01, 11);
-        wait (motor_start);
-        @(negedge clk);
-        if (motor_starts !== 1)
-            $fatal(1, "busy override did not re-assert motor_start starts=%0d", motor_starts);
-        if (motor_active_mask !== 2'b01 || motor_dir_mask !== 2'b01)
-            $fatal(1, "busy override DIR/mask mismatch mask=%b dir=%b", motor_active_mask, motor_dir_mask);
-        motor_busy = 1'b0;
-
-        // Stop override (00/00) while busy must start with active_mask=0.
+        // Busy ignores new SET_ALL motor command.
         wait (!busy);
         motor_busy = 1'b1;
-        motor_starts = 0;
-        load_payload(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+        load_payload(0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0);
         submit_frame(8'h01, 11);
-        wait (motor_start);
+        wait (valid_set_all_commit);
         @(negedge clk);
-        if (motor_active_mask !== 2'b00)
-            $fatal(1, "stop override expected active_mask=0 got %b", motor_active_mask);
+        if (motor_start)
+            $fatal(1, "busy must ignore motor_start while motor_busy=1");
         motor_busy = 1'b0;
-
-        wait (!busy);
         clear_write_scoreboard();
         submit_frame(8'h01, 11);
-        // Second pulse while first SET_ALL is still busy must be ignored (atomicity / no queue).
         submit_frame(8'h01, 11);
         wait (!busy);
-        if (target_writes !== 12) $fatal(1, "busy frame was not silently dropped (writes=%0d)", target_writes);
+        if (target_writes !== 12) $fatal(1, "busy frame was not silently dropped");
 
         clear_write_scoreboard();
         payload_memory[0] = 101;
@@ -201,7 +168,6 @@ module project_adapter_tb;
         @(negedge clk);
         if (target_writes !== 0 || valid_set_all_commit) $fatal(1, "invalid duty caused an action");
 
-        // Invalid late door byte must not partially apply earlier validated fan/PTC values.
         payload_memory[0] = 10;
         payload_memory[9] = 3;
         clear_write_scoreboard();

+ 0 - 88
tests/sim/startup_close_seek_axis3_tb.v

@@ -1,88 +0,0 @@
-`timescale 1ns/1ps
-
-// Startup close-seek with AXIS_COUNT=3: all three axes seek until limits or max bursts.
-module startup_close_seek_axis3_tb;
-    reg clk = 1'b0;
-    reg rst_n = 1'b0;
-    reg tick_500us = 1'b0;
-    reg [2:0] limit = 3'b000;
-    reg limit_sync_valid = 1'b0;
-    wire startup_done;
-    wire motor_start;
-    wire [2:0] motor_active_mask;
-    wire [2:0] motor_dir_mask;
-    wire [2:0] motor_stop_mask;
-    reg motor_done;
-    integer motor_tick;
-    reg previous_motor_start;
-    reg motor_busy;
-
-    always #1 clk = ~clk;
-
-    startup_close_seek #(
-        .FIXED_STEPS(8),
-        .DIR_SETUP_TICKS(1),
-        .STEP_HALF_CYCLES(2),
-        .MAX_BURSTS(2),
-        .INTER_BURST_TICKS(2),
-        .AXIS_COUNT(3),
-        .DIR_MASK(3'b111)
-    ) dut (
-        .clk(clk), .rst_n(rst_n), .tick_500us(tick_500us),
-        .limit_sync_valid(limit_sync_valid), .limit_sync(limit),
-        .startup_done(startup_done), .motor_start(motor_start),
-        .motor_active_mask(motor_active_mask), .motor_dir_mask(motor_dir_mask),
-        .motor_stop_mask(motor_stop_mask), .motor_done(motor_done)
-    );
-
-    task pulse_tick;
-        begin
-            @(negedge clk);
-            tick_500us = 1'b1;
-            @(negedge clk);
-            tick_500us = 1'b0;
-        end
-    endtask
-
-    always @(posedge clk or negedge rst_n) begin
-        if (!rst_n) begin
-            motor_done <= 1'b0;
-            motor_tick <= 0;
-            motor_busy <= 1'b0;
-            previous_motor_start <= 1'b0;
-        end else begin
-            previous_motor_start <= motor_start;
-            if (motor_start && !previous_motor_start) begin
-                motor_busy <= 1'b1;
-                motor_tick <= 0;
-                motor_done <= 1'b0;
-            end else if (motor_busy) begin
-                if (motor_tick < 2) begin
-                    motor_tick <= motor_tick + 1;
-                    motor_done <= 1'b0;
-                end else begin
-                    motor_done <= 1'b1;
-                    motor_busy <= 1'b0;
-                end
-            end else begin
-                motor_done <= 1'b0;
-            end
-        end
-    end
-
-    initial begin
-        repeat (3) @(posedge clk);
-        rst_n = 1'b1;
-        repeat (3) @(posedge clk);
-        limit_sync_valid = 1'b1;
-
-        // Already at all limits -> immediate done, no motion.
-        limit = 3'b111;
-        repeat (4) @(posedge clk);
-        if (!startup_done) $fatal(1, "expected immediate startup_done when all limits high");
-        if (motor_start) $fatal(1, "must not start when limits already reached");
-
-        $display("startup_close_seek_axis3_tb PASS");
-        $finish;
-    end
-endmodule

+ 69 - 89
tests/sim/startup_close_seek_tb.v

@@ -1,46 +1,61 @@
 `timescale 1ns/1ps
 
+// 3-axis startup close-seek with accelerated ticks and reduced step budgets.
 module startup_close_seek_tb;
+    localparam integer AXIS_COUNT = 3;
+    localparam integer CLOSE_STEPS = 12;
+    localparam integer BACKOFF_STEPS = 4;
+    localparam integer DIR_SETUP = 1;
+
     reg clk = 1'b0;
     reg rst_n = 1'b0;
     reg tick_500us = 1'b0;
-    reg [1:0] limit = 2'b00;
+    reg [AXIS_COUNT-1:0] limit_ls = {AXIS_COUNT{1'b0}};
+    reg [AXIS_COUNT-1:0] limit_hs = {AXIS_COUNT{1'b0}};
     reg limit_sync_valid = 1'b0;
     wire startup_done;
     wire motor_start;
-    wire [1:0] motor_active_mask;
-    wire [1:0] motor_dir_mask;
-    wire [1:0] motor_stop_mask;
-    reg motor_done;
+    wire [AXIS_COUNT-1:0] motor_active_mask;
+    wire [AXIS_COUNT-1:0] motor_dir_mask;
+    wire [AXIS_COUNT-1:0] motor_stop_mask;
+    wire [12:0] motor_step_count;
+    wire motor_busy;
+    wire motor_done;
+    wire [AXIS_COUNT-1:0] step;
+    wire [AXIS_COUNT-1:0] dir;
 
-    integer burst_count;
-    integer tick_count;
-    integer motor_tick;
-    reg previous_motor_start;
+    integer start_count;
 
     always #1 clk = ~clk;
 
     startup_close_seek #(
-        .FIXED_STEPS(450),
-        .DIR_SETUP_TICKS(2),
-        .STEP_HALF_CYCLES(12500),
-        .MAX_BURSTS(10),
-        .INTER_BURST_TICKS(4),
-        .DIR_MASK(2'b11)
+        .CLOSE_STEPS(CLOSE_STEPS),
+        .BACKOFF_STEPS(BACKOFF_STEPS),
+        .AXIS_COUNT(AXIS_COUNT),
+        .CLOSE_DIR_MASK({AXIS_COUNT{1'b1}})
     ) dut (
-        .clk(clk),
-        .rst_n(rst_n),
-        .tick_500us(tick_500us),
+        .clk(clk), .rst_n(rst_n), .tick_500us(tick_500us),
         .limit_sync_valid(limit_sync_valid),
-        .limit_sync(limit),
-        .startup_done(startup_done),
-        .motor_start(motor_start),
-        .motor_active_mask(motor_active_mask),
-        .motor_dir_mask(motor_dir_mask),
-        .motor_stop_mask(motor_stop_mask),
+        .limit_ls_sync(limit_ls), .limit_hs_sync(limit_hs),
+        .startup_done(startup_done), .motor_start(motor_start),
+        .motor_active_mask(motor_active_mask), .motor_dir_mask(motor_dir_mask),
+        .motor_step_count(motor_step_count), .motor_stop_mask(motor_stop_mask),
         .motor_done(motor_done)
     );
 
+    door_motor_engine #(
+        .AXIS_COUNT(AXIS_COUNT),
+        .MAX_STEPS(CLOSE_STEPS),
+        .DIR_SETUP_TICKS(DIR_SETUP)
+    ) u_motor (
+        .clk(clk), .rst_n(rst_n), .start(motor_start),
+        .active_mask(motor_active_mask), .dir_mask(motor_dir_mask),
+        .step_count(motor_step_count[12:0]),
+        .tick_500us(tick_500us), .abort(1'b0),
+        .stop_mask(motor_stop_mask),
+        .busy(motor_busy), .done(motor_done), .step(step), .dir(dir)
+    );
+
     task pulse_tick;
         begin
             @(negedge clk);
@@ -52,104 +67,69 @@ module startup_close_seek_tb;
 
     task wait_sync_valid;
         begin
-            // startup_close_seek transitions out of WAIT_SYNC only when limit_sync_valid is 1.
             repeat (3) @(posedge clk);
             limit_sync_valid = 1'b1;
         end
     endtask
 
-    // Fake motor engine: assert done for one cycle shortly after start.
-    reg motor_busy;
-    always @(posedge clk or negedge rst_n) begin
-        if (!rst_n) begin
-            motor_done <= 1'b0;
-            motor_tick <= 0;
-            motor_busy <= 1'b0;
-            previous_motor_start <= 1'b0;
-        end else begin
-            previous_motor_start <= motor_start;
-            if (motor_start && !previous_motor_start) begin
-                motor_busy <= 1'b1;
-                motor_tick <= 0;
-            end else if (motor_busy) begin
-                if (motor_tick < 3) begin
-                    motor_tick <= motor_tick + 1;
-                    motor_done <= 1'b0;
-                end else begin
-                    motor_done <= 1'b1;
-                    motor_busy <= 1'b0;
-                end
-            end else begin
-                motor_done <= 1'b0;
-            end
+    task wait_startup_done;
+        begin
+            while (!startup_done) pulse_tick();
+            @(posedge clk);
         end
-    end
+    endtask
 
     initial begin
-        burst_count = 0;
-        #10000000 $fatal(1, "startup close-seek timeout");
+        #10000000 $fatal(1, "startup_close_seek_tb timeout");
     end
 
     always @(posedge clk) begin
-        if (motor_start && !previous_motor_start) burst_count <= burst_count + 1;
-    end
-
-    always @(posedge clk) begin
-        if (!limit_sync_valid && motor_start) begin
+        if (motor_start) start_count <= start_count + 1;
+        if (!limit_sync_valid && motor_start)
             $fatal(1, "motor_start asserted before limit_sync_valid");
-        end
     end
 
     initial begin
-        // Scenario 1: both limits already high. Startup must finish without any motor burst.
-        limit = 2'b11;
+        start_count = 0;
+
+        // Scenario 1: all axes already at LS -> immediate done, no close start.
+        limit_ls = 3'b111;
+        limit_hs = 3'b000;
         limit_sync_valid = 1'b0;
-        burst_count = 0;
+        start_count = 0;
         repeat (3) @(posedge clk);
         rst_n = 1'b1;
         wait_sync_valid();
+        wait_startup_done();
+        if (start_count !== 0)
+            $fatal(1, "expected 0 close starts when all LS high, got %0d", start_count);
 
-        while (!startup_done) begin
-            pulse_tick();
-        end
-        if (burst_count !== 0) $fatal(1, "expected 0 bursts when both limits are high, got %0d", burst_count);
-        if (motor_active_mask !== 2'b00) $fatal(1, "motor_active_mask not zero after done");
-        if (motor_dir_mask !== 2'b00) $fatal(1, "motor_dir_mask not zero after done");
-        if (motor_start !== 1'b0) $fatal(1, "motor_start not zero after done");
-
-        // Scenario 2: no limit. Should run MAX_BURSTS (10) bursts and then assert done.
+        // Scenario 2: X hits LS during close; Y/Z finish close budget then backoff.
         rst_n = 1'b0;
-        limit = 2'b00;
+        limit_ls = 3'b000;
+        limit_hs = 3'b000;
         limit_sync_valid = 1'b0;
-        burst_count = 0;
+        start_count = 0;
         @(negedge clk);
         repeat (3) @(posedge clk);
         rst_n = 1'b1;
         wait_sync_valid();
-
         while (!startup_done) begin
+            if (step[0] && limit_ls[0] == 1'b0) limit_ls[0] <= 1'b1;
             pulse_tick();
         end
-        if (burst_count !== 10) $fatal(1, "expected 10 bursts without limit, got %0d", burst_count);
-        if (motor_active_mask !== 2'b00) $fatal(1, "motor_active_mask not zero after done");
-        if (motor_dir_mask !== 2'b00) $fatal(1, "motor_dir_mask not zero after done");
-        if (motor_start !== 1'b0) $fatal(1, "motor_start not zero after done");
-        if (motor_stop_mask !== 2'b00) $fatal(1, "motor_stop_mask not zero after done");
-
-        // Post-calibration inertness: toggling limits must not restart or assert stop.
-        burst_count = 0;
-        limit = 2'b11;
-        repeat (20) pulse_tick();
-        limit = 2'b00;
+        if (limit_ls[0] !== 1'b1) $fatal(1, "X should have reached LS");
+        if (!startup_done) $fatal(1, "startup_done not set after close/backoff");
+
+        // Scenario 3: post-done sticky; limit toggles must not restart.
+        start_count = 0;
+        limit_ls = 3'b000;
+        limit_hs = 3'b111;
         repeat (20) pulse_tick();
         if (!startup_done) $fatal(1, "startup_done cleared after post-done limit toggle");
-        if (burst_count !== 0) $fatal(1, "post-done limit toggle restarted bursts");
-        if (motor_start !== 1'b0) $fatal(1, "post-done motor_start reasserted");
-        if (motor_stop_mask !== 2'b00) $fatal(1, "post-done motor_stop_mask not inert");
-        if (motor_active_mask !== 2'b00) $fatal(1, "post-done motor_active_mask not zero");
+        if (start_count !== 0) $fatal(1, "post-done limit toggle restarted motion");
 
         $display("startup_close_seek_tb PASS");
         $finish;
     end
 endmodule
-

+ 45 - 132
tests/sim/startup_motor_stop_tb.v

@@ -1,85 +1,72 @@
 `timescale 1ns/1ps
 
+// Startup + motor engine: LS hard-stop during close truncates axis before step budget.
 module startup_motor_stop_tb;
+    localparam integer AXIS_COUNT = 3;
+    localparam integer CLOSE_STEPS = 16;
+    localparam integer BACKOFF_STEPS = 4;
+
     reg clk = 1'b0;
     reg rst_n = 1'b0;
     reg tick_500us = 1'b0;
-    reg [1:0] limit = 2'b00;
+    reg [AXIS_COUNT-1:0] limit_ls = {AXIS_COUNT{1'b0}};
+    reg [AXIS_COUNT-1:0] limit_hs = {AXIS_COUNT{1'b0}};
     reg limit_valid = 1'b0;
 
     wire startup_done;
     wire motor_start;
-    wire [1:0] motor_active_mask;
-    wire [1:0] motor_dir_mask;
-    wire [1:0] motor_stop_mask;
+    wire [AXIS_COUNT-1:0] motor_active_mask;
+    wire [AXIS_COUNT-1:0] motor_dir_mask;
+    wire [AXIS_COUNT-1:0] motor_stop_mask;
+    wire [4:0] motor_step_count;
     wire motor_busy;
     wire motor_done;
-    wire [1:0] step;
-    wire [1:0] dir;
+    wire [AXIS_COUNT-1:0] step;
 
     integer x_rises;
-    integer y_rises;
     reg prev_x;
-    reg prev_y;
-    integer edge_count;
-    integer x_edge;
-    integer y_edge;
-
-    localparam integer FAST_TICK_DIV = 10;
-    reg [31:0] fast_tick_div;
-    reg fast_tick;
 
     always #1 clk = ~clk;
 
-    initial begin
-        fast_tick = 1'b0;
-        fast_tick_div = 0;
-    end
-
     always @(posedge clk) begin
-        if (fast_tick_div + 1 >= FAST_TICK_DIV) begin
-            fast_tick_div <= 0;
-            fast_tick <= 1'b1;
-        end else begin
-            fast_tick_div <= fast_tick_div + 1'b1;
-            fast_tick <= 1'b0;
-        end
-    end
-
-    always @(posedge clk) begin
-        tick_500us <= fast_tick;
         prev_x <= step[0];
-        prev_y <= step[1];
         if (!prev_x && step[0]) x_rises <= x_rises + 1;
-        if (!prev_y && step[1]) y_rises <= y_rises + 1;
     end
 
     startup_close_seek #(
-        .FIXED_STEPS(450), .DIR_SETUP_TICKS(2), .STEP_HALF_CYCLES(12500),
-        .MAX_BURSTS(10), .INTER_BURST_TICKS(4), .DIR_MASK(2'b11)
+        .CLOSE_STEPS(CLOSE_STEPS),
+        .BACKOFF_STEPS(BACKOFF_STEPS),
+        .AXIS_COUNT(AXIS_COUNT),
+        .CLOSE_DIR_MASK({AXIS_COUNT{1'b1}})
     ) u_startup (
         .clk(clk), .rst_n(rst_n), .tick_500us(tick_500us),
-        .limit_sync_valid(limit_valid), .limit_sync(limit),
+        .limit_sync_valid(limit_valid),
+        .limit_ls_sync(limit_ls), .limit_hs_sync(limit_hs),
         .startup_done(startup_done), .motor_start(motor_start),
         .motor_active_mask(motor_active_mask), .motor_dir_mask(motor_dir_mask),
-        .motor_stop_mask(motor_stop_mask),
+        .motor_step_count(motor_step_count), .motor_stop_mask(motor_stop_mask),
         .motor_done(motor_done)
     );
 
     door_motor_engine #(
-        .FIXED_STEPS(450), .DIR_SETUP_TICKS(2)
+        .AXIS_COUNT(AXIS_COUNT),
+        .MAX_STEPS(CLOSE_STEPS),
+        .DIR_SETUP_TICKS(1)
     ) u_motor (
         .clk(clk), .rst_n(rst_n), .start(motor_start),
         .active_mask(motor_active_mask), .dir_mask(motor_dir_mask),
+        .step_count(motor_step_count),
         .tick_500us(tick_500us), .abort(1'b0),
         .stop_mask(motor_stop_mask),
-        .busy(motor_busy), .done(motor_done), .step(step), .dir(dir)
+        .busy(motor_busy), .done(motor_done), .step(step), .dir()
     );
 
     task pulse_tick;
         begin
-            @(posedge clk);
-            while (!tick_500us) @(posedge clk);
+            @(negedge clk);
+            tick_500us = 1'b1;
+            @(negedge clk);
+            tick_500us = 1'b0;
         end
     endtask
 
@@ -88,111 +75,37 @@ module startup_motor_stop_tb;
             rst_n = 1'b0;
             limit_valid = 1'b0;
             x_rises = 0;
-            y_rises = 0;
             prev_x = 1'b0;
-            prev_y = 1'b0;
-            edge_count = 0;
-            x_edge = 0;
-            y_edge = 0;
-            repeat (5) @(posedge clk);
+            repeat (4) @(posedge clk);
             rst_n = 1'b1;
-            // wait for limit synchronizer (simulated by testbench raising limit_valid)
-            repeat (5) @(posedge clk);
+            repeat (4) @(posedge clk);
             limit_valid = 1'b1;
             @(posedge clk);
         end
     endtask
 
-    task wait_startup_done;
-        begin
-            while (!startup_done) pulse_tick();
-            @(posedge clk);
-        end
-    endtask
-
-    task wait_reached;
-        input [1:0] mask;
-        begin
-            while (!((u_startup.reached_mask & mask) == mask)) pulse_tick();
-            @(posedge clk);
-        end
-    endtask
-
     initial begin
-        #40000000 $fatal(1, "startup_motor_stop_tb timeout");
+        #2000000 $fatal(1, "startup_motor_stop_tb timeout");
     end
 
     initial begin
-        // Scenario 1: both limits high at reset.
-        limit = 2'b11;
-        reset_dut();
-        wait_startup_done();
-        if (x_rises !== 0 || y_rises !== 0)
-            $fatal(1, "scenario1: steps with both limits high x=%0d y=%0d", x_rises, y_rises);
-
-        // Scenario 2: X limit goes high after X has started stepping.
-        limit = 2'b00;
-        reset_dut();
-        while (step[0] !== 1'b1) pulse_tick();
-        limit = 2'b01;
-        wait_reached(2'b01);
-        edge_count = x_rises;
-        while (!startup_done) begin
-            pulse_tick();
-            if (x_rises > edge_count)
-                $fatal(1, "scenario2: X rose after reached, before=%0d after=%0d", edge_count, x_rises);
-        end
-        if (y_rises < 1)
-            $fatal(1, "scenario2: Y did not continue");
-
-        // Scenario 3: Y limit mid-burst, X runs to max bursts.
-        limit = 2'b00;
-        reset_dut();
-        while (step[1] !== 1'b1) pulse_tick();
-        limit = 2'b10;
-        wait_reached(2'b10);
-        edge_count = y_rises;
-        wait_startup_done();
-        if (y_rises > edge_count)
-            $fatal(1, "scenario3: Y rose after reached");
-        if (x_rises > 4500 + 10 || x_rises < 4500 - 10)
-            $fatal(1, "scenario3: X did not complete ~10 bursts: %0d", x_rises);
-
-        // Scenario 4: X and Y limits at different times.
-        limit = 2'b00;
-        reset_dut();
-        while (step[0] !== 1'b1) pulse_tick();
-        limit = 2'b01;
-        wait_reached(2'b01);
-        x_edge = x_rises;
-        repeat (10) pulse_tick();
-        limit = 2'b11;
-        wait_reached(2'b11);
-        y_edge = y_rises;
-        wait_startup_done();
-        if (x_rises > x_edge)
-            $fatal(1, "scenario4: X rose after both reached");
-        if (y_rises > y_edge)
-            $fatal(1, "scenario4: Y rose after both reached");
-
-        // Scenario 5: no limits, both reach max bursts.
-        limit = 2'b00;
+        // All LS high -> no steps.
+        limit_ls = 3'b111;
+        limit_hs = 3'b000;
         reset_dut();
-        wait_startup_done();
-        if (x_rises !== 4500 || y_rises !== 4500)
-            $fatal(1, "scenario5: max bursts mismatch x=%0d y=%0d", x_rises, y_rises);
+        repeat (32) pulse_tick();
+        if (!startup_done) $fatal(1, "expected startup_done when all LS high");
+        if (x_rises !== 0) $fatal(1, "unexpected X steps with all LS high");
 
-        // Scenario 6: stop at 449th pulse boundary for X.
-        limit = 2'b00;
+        // X hits LS during close before consuming full budget.
+        limit_ls = 3'b000;
+        limit_hs = 3'b000;
         reset_dut();
-        while (x_rises < 448) pulse_tick();
-        while (step[0] !== 1'b0 || step[1] !== 1'b0) pulse_tick();
-        limit = 2'b01;
-        wait_startup_done();
-        if (x_rises > 449)
-            $fatal(1, "scenario6: X produced a 450th rising edge");
-        if (y_rises !== 4500)
-            $fatal(1, "scenario6: Y did not finish max bursts: %0d", y_rises);
+        while (x_rises < 1) pulse_tick();
+        limit_ls[0] = 1'b1;
+        while (!startup_done) pulse_tick();
+        if (x_rises >= CLOSE_STEPS)
+            $fatal(1, "X reached full close budget after LS stop, x=%0d", x_rises);
 
         $display("startup_motor_stop_tb PASS");
         $finish;

+ 7 - 15
tests/test_project_structure.py

@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
-"""Repository layout contract for the new single-project UART architecture."""
+"""Repository layout contract for the 3-axis single-project UART architecture."""
 
 from __future__ import annotations
 
@@ -38,15 +38,8 @@ class ProjectStructureTests(unittest.TestCase):
                 self.assertTrue((ROOT / relative).is_file(), relative)
 
     def test_only_canonical_top_is_active(self) -> None:
-        # Production TD/bitstream top remains prod2u_p4_normal_v3_top.
-        # Optional non-production motor-compat companion top is allowed beside it.
         tops = sorted(path.name for path in (ROOT / "src/top").glob("*.v"))
-        self.assertIn("prod2u_p4_normal_v3_top.v", tops)
-        self.assertEqual(
-            tops,
-            ["prod2u_p4_motor_compat_top.v", "prod2u_p4_normal_v3_top.v"],
-        )
-        self.assertTrue((ROOT / "projects/prod2u-door-temp-motor-compat/NOTES.zh-CN.md").is_file())
+        self.assertEqual(tops, ["prod2u_p4_normal_v3_top.v"])
 
     def test_active_td_and_build_inputs_exclude_retired_protocol(self) -> None:
         active = "\n".join(
@@ -57,17 +50,16 @@ class ProjectStructureTests(unittest.TestCase):
                 (ROOT / "tools/prod2u_p4_normal_v3_build.py").read_text(encoding="utf-8"),
             ]
         ).casefold()
-        for retired in ("binary921", "921600", "response_scheduler", "host_ack", "jog"):
+        for retired in ("binary921", "921600", "response_scheduler", "host_ack", "jog", "motor_compat", "solenoid"):
             self.assertNotIn(retired, active)
 
-    def test_phase2_top_port_shape_has_no_retired_outputs(self) -> None:
+    def test_phase2_top_port_shape_has_three_axis_and_six_limits(self) -> None:
         top = (ROOT / "src/top/prod2u_p4_normal_v3_top.v").read_text(encoding="ascii")
         self.assertIn("output wire [7:0] ptc_pwm_out", top)
         self.assertIn("output wire [3:0] fan_pwm_out", top)
-        # intake_solenoid_out is the active chamber-1 intake actuator port.
-        self.assertIn("intake_solenoid_out", top)
-        for retired in ("z_step", "z_dir"):
-            self.assertNotIn(retired, top)
+        for port in ("z_step", "z_dir", "x_limit_ls", "x_limit_hs", "z_limit_hs"):
+            self.assertIn(port, top)
+        self.assertNotIn("intake_solenoid_out", top)
 
 
 if __name__ == "__main__":

+ 23 - 1
tests/unit/test_agent_handoff_package.py

@@ -91,6 +91,27 @@ def run_packager(
             "-AuditOnly": "--audit-only",
             "-ForceOverwrite": "--force-overwrite",
         }
+        # Legacy fixture tests assert inclusion-first "full" behavior; default
+        # CLI profile is review-compact which excludes reference/original/board.
+        profile_args: list[str] = []
+        mapped_extra: list[str] = []
+        i = 0
+        extras = list(extra)
+        while i < len(extras):
+            item = extras[i]
+            if item == "--profile" and i + 1 < len(extras):
+                profile_args = ["--profile", extras[i + 1]]
+                i += 2
+                continue
+            if item in option_map:
+                mapped_extra.append(option_map[item])
+                i += 1
+                continue
+            # Pass through unknown flags (e.g. already-mapped forms)
+            mapped_extra.append(item)
+            i += 1
+        if not profile_args:
+            profile_args = ["--profile", "full"]
         command = [
             sys.executable,
             str(PACKAGER_CORE),
@@ -100,7 +121,8 @@ def run_packager(
             str(output_dir),
             "--package-name",
             package_name,
-            *(option_map[item] for item in extra),
+            *profile_args,
+            *mapped_extra,
         ]
     return subprocess.run(
         command,

+ 0 - 107
tests/unit/test_intake_dual_profile.py

@@ -1,107 +0,0 @@
-"""Dual intake actuator profile: production solenoid vs non-prod motor-compat."""
-
-from __future__ import annotations
-
-import json
-import tempfile
-import unittest
-from pathlib import Path
-
-from tools.generate_project import (
-    MOTOR_COMPAT_PROFILE,
-    PROFILE,
-    generate_project,
-    load_project,
-    render_adc,
-)
-
-ROOT = Path(__file__).resolve().parents[2]
-PROD_PROJECT = ROOT / "projects" / "prod2u-door-temp" / "project.json"
-MOTOR_PROJECT = ROOT / "projects" / "prod2u-door-temp-motor-compat" / "project.json"
-PROD_PARAMS = ROOT / "src" / "generated" / "prod2u_door_temp_params.vh"
-MOTOR_PARAMS = ROOT / "src" / "generated" / "prod2u_door_temp_motor_compat_params.vh"
-MOTOR_TOP = ROOT / "src" / "top" / "prod2u_p4_motor_compat_top.v"
-PROD_TOP = ROOT / "src" / "top" / "prod2u_p4_normal_v3_top.v"
-
-
-class IntakeDualProfileTests(unittest.TestCase):
-    def test_production_profile_is_solenoid_axis2(self):
-        project = load_project(PROD_PROJECT)
-        self.assertEqual(project["profile"], PROFILE)
-        self.assertEqual(project["doors"]["intake_actuator"], "solenoid")
-        self.assertEqual(project["motors"]["count"], 2)
-        params = PROD_PARAMS.read_text(encoding="ascii")
-        self.assertIn("`define P4_INTAKE_ACTUATOR_SOLENOID 1", params)
-        self.assertIn("`define P4_AXIS_COUNT 2", params)
-        self.assertIn("`define P4_PROFILE_MOTOR_COMPAT 0", params)
-        self.assertIn("`define P4_STARTUP_DIR_MASK 2'b11", params)
-        top = PROD_TOP.read_text(encoding="ascii")
-        self.assertIn("P4_INTAKE_ACTUATOR_SOLENOID", top)
-        self.assertIn("P4_AXIS_COUNT", top)
-        self.assertIn("intake_solenoid_adapter", (ROOT / "src/project/project_adapter.v").read_text(encoding="ascii"))
-
-    def test_motor_compat_profile_is_axis3_non_production(self):
-        project = load_project(MOTOR_PROJECT)
-        self.assertEqual(project["profile"], MOTOR_COMPAT_PROFILE)
-        self.assertEqual(project["doors"]["intake_actuator"], "motor")
-        self.assertEqual(project["motors"]["count"], 3)
-        self.assertEqual(project["motors"]["order"], ["x", "y", "intake"])
-        self.assertEqual(project["protocol"]["set_all"]["payload_length"], 11)
-        self.assertEqual(project["temperature"]["value_count"], 27)
-        params = MOTOR_PARAMS.read_text(encoding="ascii")
-        self.assertIn("`define P4_INTAKE_ACTUATOR_SOLENOID 0", params)
-        self.assertIn("`define P4_AXIS_COUNT 3", params)
-        self.assertIn("`define P4_PROFILE_MOTOR_COMPAT 1", params)
-        self.assertIn("`define P4_STARTUP_DIR_MASK 3'b111", params)
-        top = MOTOR_TOP.read_text(encoding="ascii")
-        self.assertIn("prod2u_door_temp_motor_compat_params.vh", top)
-        self.assertIn("project_adapter_motor_compat", top)
-        self.assertIn("intake_step", top)
-        self.assertIn("intake_limit_raw", top)
-        self.assertIn("ERROR_motor_compat_requires_P4_INTAKE_ACTUATOR_SOLENOID_0", top)
-
-    def test_production_adc_includes_inferred_solenoid_loc(self):
-        project = load_project(PROD_PROJECT)
-        interface = render_adc(project)
-        self.assertEqual(len(interface), 25)
-        signals = [signal for signal, _ in interface]
-        self.assertIn("intake_solenoid_out", signals)
-        self.assertEqual(dict(interface)["intake_solenoid_out"], "P2")
-        self.assertNotIn("intake_step", signals)
-        self.assertNotIn("intake_dir", signals)
-        self.assertNotIn("intake_limit_raw", signals)
-
-    def test_motor_compat_adc_stays_24_without_intake_loc(self):
-        project = load_project(MOTOR_PROJECT)
-        interface = render_adc(project)
-        self.assertEqual(len(interface), 24)
-        signals = [signal for signal, _ in interface]
-        self.assertNotIn("intake_step", signals)
-        self.assertNotIn("intake_dir", signals)
-        self.assertNotIn("intake_limit_raw", signals)
-        self.assertNotIn("intake_solenoid_out", signals)
-
-    def test_generator_profile_select_changes_compile_defines(self):
-        with tempfile.TemporaryDirectory() as directory:
-            root = Path(directory)
-            generate_project(PROD_PROJECT, root / "prod")
-            generate_project(MOTOR_PROJECT, root / "motor")
-            prod = (root / "prod/generated/prod2u_door_temp_params.vh").read_text(encoding="ascii")
-            motor = (root / "motor/generated/prod2u_door_temp_motor_compat_params.vh").read_text(
-                encoding="ascii"
-            )
-            self.assertIn("P4_INTAKE_ACTUATOR_SOLENOID 1", prod)
-            self.assertIn("P4_AXIS_COUNT 2", prod)
-            self.assertIn("P4_INTAKE_ACTUATOR_SOLENOID 0", motor)
-            self.assertIn("P4_AXIS_COUNT 3", motor)
-            motor_manifest = json.loads(
-                (root / "motor/generated/td-source-manifest.json").read_text(encoding="utf-8")
-            )
-            self.assertFalse(motor_manifest["production"])
-            self.assertIn("src/top/prod2u_p4_motor_compat_top.v", motor_manifest["sources"])
-            self.assertEqual(motor_manifest["contract"]["set_all_payload_length"], 11)
-            self.assertIn("intake_step", motor_manifest["blocked_physical"])
-
-
-if __name__ == "__main__":
-    unittest.main()

+ 2 - 2
tests/unit/test_negative_tool_fixtures.py

@@ -29,8 +29,8 @@ def _run_mutated_motor_tb() -> tuple[
         )
 
     original_source = MOTOR_RTL.read_text(encoding="ascii")
-    comparison = "if (rising_edges + 1 >= FIXED_STEPS) begin"
-    mutation = "if (rising_edges + 1 >= (FIXED_STEPS - 1)) begin"
+    comparison = "if (rising_edges + 1 >= step_limit) begin"
+    mutation = "if (rising_edges + 1 >= (step_limit - 1'b1)) begin"
     if original_source.count(comparison) != 1:
         raise AssertionError("door_motor_engine.v mutation anchor is not unique")
 

+ 25 - 22
tests/unit/test_phase1_contract.py

@@ -30,14 +30,19 @@ EXPECTED_ACTIVE_INTERFACE = (
     ("fan_pwm_out[1]", "C4"),
     ("fan_pwm_out[2]", "B5"),
     ("fan_pwm_out[3]", "A14"),
-    ("motor_en_n", "T7"),
-    ("x_step", "R6"),
-    ("x_dir", "R8"),
-    ("y_step", "T3"),
-    ("y_dir", "R4"),
-    ("x_limit_raw", "M6"),
-    ("y_limit_raw", "F9"),
-    ("intake_solenoid_out", "P2"),
+    ("motor_en_n", "C11"),
+    ("x_step", "C12"),
+    ("x_dir", "B12"),
+    ("y_step", "L12"),
+    ("y_dir", "J11"),
+    ("z_step", "L14"),
+    ("z_dir", "K14"),
+    ("x_limit_ls", "A5"),
+    ("x_limit_hs", "B6"),
+    ("y_limit_ls", "C8"),
+    ("y_limit_hs", "A8"),
+    ("z_limit_ls", "K16"),
+    ("z_limit_hs", "J15"),
 )
 
 EXPECTED_EVIDENCE_ALLOWLIST = frozenset(
@@ -75,11 +80,9 @@ ACTIVE_GENERATED_PATHS = tuple(path for path in ACTIVE_SOURCE_PATHS if path.star
 ACTIVE_CONTRACT_PATHS = (
     "AGENTS.md",
     "README.zh-CN.md",
-    "ACCEPTANCE_MATRIX.md",
     "projects/prod2u-door-temp/project.json",
     "projects/prod2u-door-temp/requirements.zh-CN.md",
     "schemas/project.schema.json",
-    "docs/prod2u-door-temp-protocol.zh-CN.md",
     "tools/generate_project.py",
     "tools/prod2u_simple_protocol.py",
     "constraints/prod2u_p4_normal_v3.adc",
@@ -98,23 +101,23 @@ LEGACY_MARKERS = (
     "30 bytes",
     "watchdog prohibited",
     "no watchdog",
-    "inlet motor",
-    "serial motor",
-    "z_step",
-    "ptc9",
+    "intake_solenoid",
+    "motor_compat",
+    "burst_step_count",
+    "max_bursts",
     "ptc9..ptc24",
     "0x1a",
 )
 
 
 class Phase1ContractTests(unittest.TestCase):
-    def test_active_interface_has_25_flattened_bits_and_unique_fpga_balls(self):
+    def test_active_interface_has_30_flattened_bits_and_unique_fpga_balls(self):
         project = load_project(PROJECT_PATH)
         rendered = tuple(render_adc(project))
         self.assertEqual(rendered, EXPECTED_ACTIVE_INTERFACE)
-        self.assertEqual(len(rendered), 25)  # flattened top-level I/O bits (+solenoid)
-        self.assertEqual(len(render_adc(project)), 25)  # ADC assignment count
-        self.assertEqual(len({ball for _, ball in rendered}), 25)
+        self.assertEqual(len(rendered), 30)
+        self.assertEqual(len(render_adc(project)), 30)
+        self.assertEqual(len({ball for _, ball in rendered}), 30)
         self.assertEqual(
             [channel["ball"] for channel in project["outputs"]["fan_channels"]],
             ["B1", "C4", "B5", "A14"],
@@ -148,15 +151,15 @@ class Phase1ContractTests(unittest.TestCase):
         project = json.loads(PROJECT_PATH.read_text(encoding="utf-8"))
         self.assertEqual(len(project["outputs"]["ptc_channels"]), 8)
         self.assertEqual(len(project["outputs"]["fan_channels"]), 4)
-        self.assertEqual(project["limits"]["limit_count"], 2)
+        self.assertEqual(project["limits"]["limit_count"], 6)
         self.assertEqual(project["limits"]["active_level"], "high")
         self.assertTrue(project["limits"]["functional_use"])
+        self.assertTrue(project["limits"]["runtime_use"])
         startup = project["limits"]["startup"]
         self.assertTrue(startup["enabled"])
         self.assertEqual(startup["direction_meaning"], "close")
-        self.assertEqual(startup["burst_step_count"], 450)
-        self.assertEqual(startup["inter_burst_ms"], 50)
-        self.assertEqual(startup["max_bursts"], 10)
+        self.assertEqual(startup["close_step_count"], 5000)
+        self.assertEqual(startup["backoff_step_count"], 500)
 
 
 if __name__ == "__main__":

+ 21 - 22
tests/unit/test_phase2_contract.py

@@ -43,9 +43,10 @@ LEGACY_MARKERS = (
     re.compile(r"\b30[- ]byte(?:s)?\b", re.IGNORECASE),
     re.compile(r"\b(?:inlet|serial)[-_ ]motor\b", re.IGNORECASE),
     re.compile(r"\b(?:watchdog prohibited|no watchdog)\b", re.IGNORECASE),
-    re.compile(r"\bz_step\b|\bz_dir\b", re.IGNORECASE),
     re.compile(r"\bptc(?:9|1[0-9]|2[0-4])\b", re.IGNORECASE),
     re.compile(r"\b0x1a\b", re.IGNORECASE),
+    re.compile(r"\bintake_solenoid\b", re.IGNORECASE),
+    re.compile(r"\bmotor_compat\b", re.IGNORECASE),
 )
 
 
@@ -89,10 +90,11 @@ class Phase2ContractTests(unittest.TestCase):
         self.assertEqual(protocol["set_all"]["payload_length"], 11)
         self.assertEqual(protocol["set_all"]["fan_offset"], 0)
         self.assertEqual(protocol["set_all"]["chamber_ptc_offset"], 4)
-        self.assertEqual(protocol["set_all"]["intake_door_offset"], 8)
+        self.assertEqual(protocol["set_all"]["z_door_offset"], 8)
         self.assertEqual(protocol["set_all"]["exhaust_x_offset"], 9)
         self.assertEqual(protocol["set_all"]["exhaust_y_offset"], 10)
-        self.assertEqual(project["doors"]["intake_actuator"], "solenoid")
+        self.assertEqual(project["doors"]["door_axes"], ["x", "y", "z"])
+        self.assertEqual(project["motors"]["count"], 3)
 
     def test_active_interface_matches_project_manifest_and_adc(self):
         project = load_project(PROJECT_PATH)
@@ -107,11 +109,11 @@ class Phase2ContractTests(unittest.TestCase):
             ADC_PATH.read_text(encoding="ascii"),
         )
         self.assertEqual(tuple((signal.strip(), ball) for signal, ball in assignments), expected_interface)
-        self.assertEqual(len(assignments), 25)
-        self.assertEqual(len({ball for _, ball in assignments}), 25)
-        self.assertNotRegex(ADC_PATH.read_text(encoding="ascii"), r"(?i)ground|z_step|z_dir|ptc9")
+        self.assertEqual(len(assignments), 30)
+        self.assertEqual(len({ball for _, ball in assignments}), 30)
+        self.assertNotRegex(ADC_PATH.read_text(encoding="ascii"), r"(?i)ground|intake_solenoid|ptc9")
 
-    def test_top_has_25_flattened_io_bits_and_solenoid_package_port(self):
+    def test_top_has_30_flattened_io_bits_and_three_axis_ports(self):
         source = TOP_PATH.read_text(encoding="ascii")
         declaration = re.search(
             r"module\s+prod2u_p4_normal_v3_top\s*\((.*?)\);",
@@ -120,20 +122,17 @@ class Phase2ContractTests(unittest.TestCase):
         )
         self.assertIsNotNone(declaration)
         ports = declaration.group(1)
-        # Package IO is 25 balls after CON138–141 remap (+ intake_solenoid_out).
-        self.assertEqual(_flattened_top_level_io_bits(source), 25)
+        self.assertEqual(_flattened_top_level_io_bits(source), 30)
         expected = (
             "sys_clk", "host_uart_rx", "host_uart_tx", "ptc_pwm_out",
             "fan_pwm_out", "motor_en_n", "x_step", "x_dir", "y_step", "y_dir",
-            "x_limit_raw", "y_limit_raw", "intake_solenoid_out", "temp_scl", "temp_sda",
+            "z_step", "z_dir",
+            "x_limit_ls", "x_limit_hs", "y_limit_ls", "y_limit_hs",
+            "z_limit_ls", "z_limit_hs", "temp_scl", "temp_sda",
         )
-        self.assertRegex(ports, r"\bintake_solenoid_out\b")
         for port in expected:
             self.assertRegex(ports, rf"\b{re.escape(port)}\b")
-        self.assertRegex(ports, r"output\s+wire\s+\[7:0\]\s+ptc_pwm_out")
-        self.assertRegex(ports, r"output\s+wire\s+\[3:0\]\s+fan_pwm_out")
-        for retired in ("z_step", "z_dir"):
-            self.assertNotRegex(ports, rf"\b{retired}\b")
+        self.assertNotIn("intake_solenoid_out", ports)
 
     def test_all_source_lists_register_tick_watchdog_and_match(self):
         manifest = json.loads(MANIFEST_PATH.read_text(encoding="utf-8"))
@@ -168,7 +167,7 @@ class Phase2ContractTests(unittest.TestCase):
         self.assertNotRegex(controller, r"24\s*\+\s*output_index")
         for signal in ("active_mask", "dir_mask", "tick_500us", "abort"):
             self.assertRegex(motor, rf"\b{signal}\b")
-        self.assertRegex(motor, r"450|FIXED_STEPS")
+        self.assertRegex(motor, r"450|MAX_STEPS|step_count")
 
     def test_generated_outputs_are_byte_for_byte_deterministic(self):
         with tempfile.TemporaryDirectory() as first, tempfile.TemporaryDirectory() as second:
@@ -223,11 +222,11 @@ class Phase2ContractTests(unittest.TestCase):
             path.read_text(encoding="ascii")
             for path in sorted((ROOT / "tests/formal").glob("*_formal.v"))
         )
-        self.assertIn("FORMAL_FIXED_STEPS", sources)
+        self.assertIn("FORMAL_MAX_STEPS", sources)
         self.assertIn("FORMAL_PWM_PHASE_COUNT", sources)
         self.assertIn("FORMAL_PWM_SLOT_CLKS", sources)
         self.assertIn("FORMAL_TIMEOUT_TICKS", sources)
-        self.assertNotIn("FIXED_STEPS(450)", sources)
+        self.assertNotIn("MAX_STEPS(450)", sources)
         self.assertNotIn("PWM_PHASE_COUNT(100)", sources)
         self.assertNotIn("PWM_SLOT_CLKS(1042)", sources)
         self.assertNotIn("TIMEOUT_TICKS(20000)", sources)
@@ -235,7 +234,7 @@ class Phase2ContractTests(unittest.TestCase):
         motor = _read("tests/formal/simple_motor_temperature_contract_formal.v")
         pwm = _read("tests/formal/pwm_scheduler_contract_formal.v")
         watchdog = _read("tests/formal/host_watchdog_contract_formal.v")
-        self.assertRegex(motor, r"\.FIXED_STEPS\(FORMAL_FIXED_STEPS\)")
+        self.assertRegex(motor, r"\.MAX_STEPS\(FORMAL_MAX_STEPS\)")
         self.assertRegex(pwm, r"\.PWM_PHASE_COUNT\(FORMAL_PWM_PHASE_COUNT\)")
         self.assertRegex(pwm, r"\.PWM_SLOT_CLKS\(FORMAL_PWM_SLOT_CLKS\)")
         self.assertRegex(watchdog, r"\.TIMEOUT_TICKS\(FORMAL_TIMEOUT_TICKS\)")
@@ -255,9 +254,9 @@ class Phase2ContractTests(unittest.TestCase):
         motor = _read("tests/sim/door_motor_engine_tb.v")
         watchdog = _read("tests/sim/host_watchdog_tb.v")
         pwm = _read("tests/sim/pwm_scheduler_tb.v")
-        self.assertIn(".FIXED_STEPS(450)", motor)
-        self.assertIn("x_rises !== 450", motor)
-        self.assertIn("y_rises !== 450", motor)
+        self.assertIn("HOST_STEPS = 450", motor)
+        self.assertIn("x_rises !== HOST_STEPS", motor)
+        self.assertIn("y_rises !== HOST_STEPS", motor)
         self.assertIn(".TIMEOUT_TICKS(20000)", watchdog)
         self.assertIn("19999", watchdog)
         self.assertIn("20000", watchdog)

+ 11 - 11
tests/unit/test_phase3_formal_contract.py

@@ -75,14 +75,14 @@ class Phase3FormalContractTests(unittest.TestCase):
                 self.assertIn("setundef -zero", source)
                 self.assertNotIn("setundef -anyseq", source)
 
-    def test_startup_and_runtime_limit_formal_assert_post_calibration_inertness(self):
+    def test_startup_and_runtime_limit_formal_assert_runtime_hard_stop(self):
         startup = _read("tests/formal/startup_close_seek_formal.v")
-        runtime = _read("tests/formal/runtime_limit_inertness_formal.v")
-        self.assertRegex(startup, r"assert\s*\(\s*motor_stop_mask\s*==\s*2'b00\s*\)")
+        runtime = _read("tests/formal/runtime_limit_hard_stop_formal.v")
+        self.assertRegex(startup, r"assert\s*\(\s*motor_stop_mask\s*==\s*3'b000\s*\)")
         self.assertRegex(startup, r"\$past\(startup_done\)")
-        self.assertIn("startup_done ? 2'b00 : startup_motor_stop_mask", runtime)
-        self.assertRegex(runtime, r"assert\s*\(\s*motor_stop_mask\s*==\s*2'b00\s*\)")
-        sby = _read("tests/formal/runtime_limit_inertness.sby")
+        self.assertIn("startup_done ? runtime_limit_stop_mask", runtime)
+        self.assertRegex(runtime, r"assert\s*\(\s*motor_stop_mask\s*==\s*runtime_limit_stop_mask\s*\)")
+        sby = _read("tests/formal/runtime_limit_hard_stop.sby")
         self.assertIn("mode bmc", sby)
         self.assertIn("setundef -zero", sby)
         self.assertLessEqual(int(re.search(r"depth\s+(\d+)", sby).group(1)), 64)
@@ -157,7 +157,7 @@ class Phase3FormalContractTests(unittest.TestCase):
             "tests/formal/frame_tx_contract.sby",
             "tests/formal/simple_frame_contract.sby",
             "tests/formal/startup_close_seek.sby",
-            "tests/formal/runtime_limit_inertness.sby",
+            "tests/formal/runtime_limit_hard_stop.sby",
             "tests/formal/door_action_dispatcher_axis3.sby",
         ):
             sby = _read(relative)
@@ -169,7 +169,7 @@ class Phase3FormalContractTests(unittest.TestCase):
     def test_priority_formal_targets_require_cover_nonvacuity(self):
         for relative in (
             "tests/formal/startup_close_seek.sby",
-            "tests/formal/runtime_limit_inertness.sby",
+            "tests/formal/runtime_limit_hard_stop.sby",
             "tests/formal/simple_frame_contract.sby",
             "tests/formal/door_action_dispatcher_axis3.sby",
         ):
@@ -204,9 +204,9 @@ class Phase3FormalContractTests(unittest.TestCase):
     def test_simulation_fixtures_cover_production_timeout_and_motor_boundaries(self):
         motor = _read("tests/sim/door_motor_engine_tb.v")
         watchdog = _read("tests/sim/host_watchdog_tb.v")
-        self.assertIn(".FIXED_STEPS(450)", motor)
-        self.assertIn("x_rises !== 450", motor)
-        self.assertIn("y_rises !== 450", motor)
+        self.assertIn("HOST_STEPS = 450", motor)
+        self.assertIn("x_rises !== HOST_STEPS", motor)
+        self.assertIn("y_rises !== HOST_STEPS", motor)
         self.assertIn(".TIMEOUT_TICKS(20000)", watchdog)
         self.assertIn("19999", watchdog)
         self.assertIn("20000", watchdog)

+ 10 - 8
tests/unit/test_prod2u_p4_normal_v3_td_files.py

@@ -43,14 +43,16 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
             "host_uart_tx": "M10",
             "temp_scl": "M8",
             "temp_sda": "N9",
-            "motor_en_n": "T7",
-            "x_step": "R6",
-            "x_dir": "R8",
-            "y_step": "T3",
-            "y_dir": "R4",
-            "x_limit_raw": "M6",
-            "y_limit_raw": "F9",
-            "intake_solenoid_out": "P2",
+            "motor_en_n": "C11",
+            "x_step": "C12",
+            "x_dir": "B12",
+            "y_step": "L12",
+            "y_dir": "J11",
+            "z_step": "L14",
+            "z_dir": "K14",
+            "x_limit_ls": "A5",
+            "x_limit_hs": "B6",
+            "z_limit_ls": "K16",
         }.items():
             self.assertRegex(adc, rf"set_pin_assignment\s+\{{\s*{signal}\s*\}}.*LOCATION\s*=\s*{ball}")
 

+ 45 - 117
tests/unit/test_product_contract_coverage.py

@@ -1,10 +1,5 @@
 #!/usr/bin/env python3
-"""Static product-contract coverage gates for the active 11-byte SET_ALL profile.
-
-Authority is AGENTS.md / requirements / protocol docs — not current RTL behavior.
-These checks ensure the verification tree keeps the required contract assertions
-instead of silently weakening or deleting them.
-"""
+"""Static product-contract coverage gates for the 3-axis six-limit SET_ALL profile."""
 
 from __future__ import annotations
 
@@ -49,185 +44,118 @@ class ProductContractCoverageTests(unittest.TestCase):
         self.assertEqual(raw[3], 27)
         self.assertEqual(decode_temperature_data(decode_frame(raw)), values)
 
-    def test_project_adapter_tb_covers_atomicity_ptc_duplicate_dir_and_override(self):
+    def test_project_adapter_tb_covers_atomicity_ptc_duplicate_dir_and_busy_ignore(self):
         source = _read("tests/sim/project_adapter_tb.v")
         for marker in (
             "chamber0 PTC duplicate",
             "FAN target mapping mismatch",
             "open DIR contract",
-            "close DIR contract",
-            "busy override",
-            "stop override",
+            "close/open DIR contract",
+            "busy must ignore",
             "invalid door broke SET_ALL atomicity",
             "legacy 14-byte frame must be rejected",
             "submit_frame(8'h01, 11)",
+            "AXIS_COUNT(3)",
         ):
             self.assertIn(marker, source)
 
-    def test_output_target_ram_tb_covers_boot_watchdog_and_commit_atomicity(self):
-        source = _read("tests/sim/output_target_ram_tb.v")
-        for marker in (
-            "boot PTC",
-            "boot FAN",
-            "watchdog PTC",
-            "watchdog FAN",
-            "8'd20",
-            "8'd10",
-            "shadow PTC leak",
-            "uncommitted",
-        ):
-            self.assertIn(marker, source)
-
-    def test_motor_and_dispatcher_tb_cover_dir_450_and_override(self):
+    def test_motor_and_dispatcher_tb_cover_dir_450_and_busy_ignore(self):
         motor = _read("tests/sim/door_motor_engine_tb.v")
         dispatcher = _read("tests/sim/door_action_dispatcher_tb.v")
         for marker in (
-            ".FIXED_STEPS(450)",
-            "open DIR not latched",
-            "override DIR not latched",
-            "override must drop Y",
+            "HOST_STEPS = 450",
+            "mixed DIR not latched",
+            "busy must ignore",
+            "AXIS_COUNT = 3",
         ):
             self.assertIn(marker, motor)
         for marker in (
-            "open both DIR/mask",
-            "close both DIR/mask",
-            "busy override",
-            "busy stop override",
+            "open all mask/dir",
+            "close all mask/dir",
+            "busy must ignore",
             "OPEN_DIR(0)",
             "CLOSE_DIR(1)",
+            "z_door_cmd",
         ):
             self.assertIn(marker, dispatcher)
 
-    def test_startup_and_runtime_limit_cover_oneshot_and_inertness(self):
+    def test_startup_and_runtime_limit_cover_close_backoff_and_hard_stop(self):
         startup = _read("tests/sim/startup_close_seek_tb.v")
         runtime = _read("tests/sim/prod2u_p4_normal_v3_top_runtime_limit_tb.v")
         formal = _read("tests/formal/startup_close_seek_formal.v")
-        mux = _read("tests/formal/runtime_limit_inertness_formal.v")
+        mux = _read("tests/formal/runtime_limit_hard_stop_formal.v")
         self.assertIn("post-done limit toggle", startup)
-        self.assertIn("motor_stop_mask not inert", startup)
-        self.assertIn("motor_stop_mask not zero while startup_done is set", runtime)
-        self.assertIn("expected host x_step=450", runtime)
-        self.assertRegex(formal, r"assert\s*\(\s*motor_stop_mask\s*==\s*2'b00\s*\)")
+        self.assertIn("runtime LS stop failed", runtime)
+        self.assertIn("runtime HS stop failed", runtime)
+        self.assertRegex(formal, r"assert\s*\(\s*motor_stop_mask\s*==\s*3'b000\s*\)")
         self.assertRegex(formal, r"assert\s*\(\s*startup_done\s*\)")
-        self.assertIn("startup_done ? 2'b00 : startup_motor_stop_mask", mux)
-        self.assertRegex(mux, r"assert\s*\(\s*motor_stop_mask\s*==\s*2'b00\s*\)")
-
-    def test_frame_rx_tb_uses_11_byte_boundary_and_golden_vectors(self):
-        source = _read("tests/sim/frame_rx_tb.v")
-        self.assertIn("MAX_PAYLOAD(11)", source)
-        self.assertIn("golden SET_ALL", source)
-        self.assertIn("legacy 14-byte SET_ALL published", source)
-        self.assertIn("bad CRC published", source)
-        self.assertNotRegex(source, r"MAX_PAYLOAD\s*\(\s*30\s*\)")
-
-    def test_temperature_reader_tb_requires_all_27_indices(self):
-        source = _read("tests/sim/temperature_reader_tb.v")
-        self.assertIn("writes !== 27", source)
-        self.assertIn("every index 0..26", source)
-        self.assertIn("addr_seen", source)
-
-    def test_cocotb_checks_dir_semantics_and_27_byte_temperature_payload(self):
+        self.assertIn("startup_done ? runtime_limit_stop_mask", mux)
+        self.assertRegex(mux, r"assert\s*\(\s*motor_stop_mask\s*==\s*runtime_limit_stop_mask\s*\)")
+
+    def test_cocotb_checks_dir_semantics_six_limits_and_en_permanent_high(self):
         source = _read("tests/cocotb/test_prod2u_door_temp_uart_e2e.py")
         self.assertIn("DIR=0 (open)", source)
         self.assertIn("DIR=1 (close)", source)
         self.assertIn("MOTOR_STEPS = 450", source)
         self.assertIn("TEMPERATURE_DATA, 27", source)
-        self.assertNotRegex(source, r"(?m)^\s*pytest\.skip\(|^\s*unittest\.skip\(|^\s*self\.skipTest\(")
-
-    def test_no_unconditional_skips_in_active_contract_unit_tests(self):
-        pattern = re.compile(r"^\s*(?:pytest\.skip|unittest\.skip|@unittest\.skip)\b", re.M)
-        # Conditional env skips (formal receipt) are allowed; bare skips are not.
-        for relative in (
-            "tests/unit/test_protocol.py",
-            "tests/unit/test_product_contract_coverage.py",
-            "tests/unit/test_startup_close_seek.py",
-            "tests/unit/test_phase2_contract.py",
-        ):
-            source = _read(relative)
-            with self.subTest(relative=relative):
-                self.assertIsNone(pattern.search(source), f"unconditional skip in {relative}")
+        self.assertIn("z_limit_ls", source)
+        self.assertIn("motor_en_n.value) == 1", source)
 
     def test_manifest_lists_new_contract_targets(self):
-        """Coordinator must register new benches/formal in the active target list."""
         manifest = json.loads(MANIFEST_PATH.read_text(encoding="utf-8"))
         icarus = set(manifest["layers"]["icarus"])
         formal_names = {entry["name"] for entry in manifest["layers"]["formal"]}
         unit = set(manifest["layers"]["unit"])
         required_icarus = {
             "project_adapter_tb",
-            "project_adapter_motor_compat_tb",
             "output_target_ram_tb",
             "door_motor_engine_tb",
             "door_action_dispatcher_tb",
-            "door_action_dispatcher_axis3_tb",
             "frame_rx_tb",
             "startup_close_seek_tb",
             "prod2u_p4_normal_v3_top_runtime_limit_tb",
             "temperature_reader_tb",
             "host_watchdog_tb",
-            "intake_solenoid_adapter_tb",
         }
         gaps: list[str] = []
         missing_icarus = sorted(required_icarus - icarus)
         if missing_icarus:
             gaps.append(f"icarus:{missing_icarus}")
-        if "runtime_limit_inertness" not in formal_names:
-            gaps.append("formal:runtime_limit_inertness")
+        if "runtime_limit_hard_stop" not in formal_names:
+            gaps.append("formal:runtime_limit_hard_stop")
         if "startup_close_seek" not in formal_names:
             gaps.append("formal:startup_close_seek")
         if "door_action_dispatcher_axis3" not in formal_names:
             gaps.append("formal:door_action_dispatcher_axis3")
-        if "tests.unit.test_product_contract_coverage" not in unit:
-            gaps.append("unit:tests.unit.test_product_contract_coverage")
-        if "tests.unit.test_intake_dual_profile" not in unit:
-            gaps.append("unit:tests.unit.test_intake_dual_profile")
-        formal_by_name = {
-            entry["name"]: entry for entry in manifest["layers"]["formal"]
+        if "tests.unit.test_three_axis_door_contract" not in unit:
+            gaps.append("unit:tests.unit.test_three_axis_door_contract")
+        forbidden_icarus = {
+            "intake_solenoid_adapter_tb",
+            "project_adapter_motor_compat_tb",
+            "door_action_dispatcher_axis3_tb",
+            "door_motor_engine_axis3_tb",
+            "startup_close_seek_axis3_tb",
         }
-        for bmc_name in (
-            "frame_command_contract",
-            "frame_tx_contract",
-            "simple_frame_contract",
-            "startup_close_seek",
-            "runtime_limit_inertness",
-            "door_action_dispatcher_axis3",
-        ):
-            tasks = formal_by_name[bmc_name]["tasks"]
-            if "bmc" not in tasks:
-                gaps.append(f"formal:{bmc_name}:missing_bmc_task")
-            if "prove" in tasks:
-                gaps.append(f"formal:{bmc_name}:mislabeled_prove_task")
+        if icarus & forbidden_icarus:
+            gaps.append(f"icarus:obsolete:{sorted(icarus & forbidden_icarus)}")
+        formal_by_name = {entry["name"]: entry for entry in manifest["layers"]["formal"]}
         for cover_name in (
             "startup_close_seek",
-            "runtime_limit_inertness",
+            "runtime_limit_hard_stop",
             "simple_frame_contract",
             "door_action_dispatcher_axis3",
         ):
             if "cover" not in formal_by_name[cover_name]["tasks"]:
                 gaps.append(f"formal:{cover_name}:missing_cover_task")
-        # frame_command: BMC asserts + source-level cover(); registered cover task
-        # omitted on purpose (depth-96 cover of full adapter stack OOMs ~2GiB hosts).
-        if "cover" in formal_by_name["frame_command_contract"]["tasks"]:
-            gaps.append("formal:frame_command_contract:unexpected_cover_task")
-        self.assertEqual(
-            gaps,
-            [],
-            "config/prod2u_p4_verification_targets_v1.json gaps (coordinator): "
-            + "; ".join(gaps),
-        )
-
-    def test_motor_compat_tb_covers_intake_axis_and_stop(self):
-        source = _read("tests/sim/project_adapter_motor_compat_tb.v")
-        for marker in (
-            "AXIS_COUNT(3)",
-            "motor_active_mask",
-            "intake",
-        ):
-            self.assertIn(marker, source)
+        self.assertEqual(gaps, [], "verification manifest gaps: " + "; ".join(gaps))
+
+    def test_dispatcher_formal_covers_z_axis_and_busy_ignore(self):
         formal = _read("tests/formal/door_action_dispatcher_axis3_formal.v")
         self.assertIn("cover", formal)
         self.assertIn("AXIS_COUNT(3)", formal)
-        self.assertIn("intake_door_cmd", formal)
+        self.assertIn("z_door_cmd", formal)
+        self.assertIn("motor_busy", formal)
+
 
 if __name__ == "__main__":
     unittest.main()

+ 7 - 5
tests/unit/test_project_generation.py

@@ -45,9 +45,10 @@ class ProjectGenerationTests(unittest.TestCase):
             self.assertIn("P4_WATCHDOG_TIMEOUT_TICKS 20000", params)
             self.assertIn("P4_PTC_DEFAULT_TARGET 8'h00", params)
             self.assertIn("P4_SET_ALL_PAYLOAD_LENGTH 11", params)
-            self.assertIn("P4_AXIS_COUNT 2", params)
-            self.assertIn("P4_INTAKE_ACTUATOR_SOLENOID 1", params)
-            self.assertIn("P4_PROFILE_MOTOR_COMPAT 0", params)
+            self.assertIn("P4_AXIS_COUNT 3", params)
+            self.assertIn("P4_LIMIT_COUNT 6", params)
+            self.assertIn("P4_RUNTIME_LIMIT_USE 1", params)
+            self.assertIn("P4_STARTUP_CLOSE_STEPS 5000", params)
             contract = json.loads((first / "generated" / "host-contract.json").read_text(encoding="utf-8"))
             self.assertEqual(contract["commands"]["set_all"]["payload_length"], 11)
             golden = json.loads((first / "generated" / "golden-vectors.json").read_text(encoding="utf-8"))
@@ -71,12 +72,13 @@ class ProjectGenerationTests(unittest.TestCase):
 
             adc = (first / "generated" / "prod2u_door_temp.adc").read_text(encoding="ascii")
             assignments = [line for line in adc.splitlines() if line.startswith("set_pin_assignment")]
-            self.assertEqual(len(assignments), 25)
+            self.assertEqual(len(assignments), 30)
             self.assertTrue(any(line.startswith("set_pin_assignment { ptc_pwm_out[0] } { LOCATION = G16;") for line in assignments))
             self.assertTrue(any(line.startswith("set_pin_assignment { ptc_pwm_out[7] } { LOCATION = T9;") for line in assignments))
             self.assertTrue(any(line.startswith("set_pin_assignment { fan_pwm_out[0] } { LOCATION = B1;") for line in assignments))
             self.assertTrue(any(line.startswith("set_pin_assignment { fan_pwm_out[3] } { LOCATION = A14;") for line in assignments))
-            self.assertTrue(any(line.startswith("set_pin_assignment { intake_solenoid_out } { LOCATION = P2;") for line in assignments))
+            self.assertTrue(any(line.startswith("set_pin_assignment { z_step } { LOCATION = L14;") for line in assignments))
+            self.assertTrue(any(line.startswith("set_pin_assignment { x_limit_ls } { LOCATION = A5;") for line in assignments))
 
 
 if __name__ == "__main__":

+ 23 - 46
tests/unit/test_startup_close_seek.py

@@ -1,15 +1,8 @@
-"""Contract tests for the startup close-seek feature.
-
-These tests verify that project.json, generated parameters, the source manifest,
-and the top-level netlist all agree on the startup configuration. RTL behavior is
-covered by tests/sim/startup_close_seek_tb.v, tests/formal/startup_close_seek.sby,
-and tests/cocotb after toolchains are available.
-"""
+"""Contract tests for the startup close-seek feature (3-axis, close/backoff profile)."""
 
 from __future__ import annotations
 
 import json
-import re
 import unittest
 from pathlib import Path
 
@@ -25,30 +18,27 @@ class StartupCloseSeekContractTests(unittest.TestCase):
         project = json.loads(PROJECT_PATH.read_text(encoding="utf-8"))
         limits = project["limits"]
         self.assertTrue(limits["functional_use"])
-        self.assertFalse(limits["runtime_use"])
+        self.assertTrue(limits["runtime_use"])
         startup = limits["startup"]
         self.assertTrue(startup["enabled"])
         self.assertEqual(startup["direction_meaning"], "close")
-        self.assertEqual(startup["burst_step_count"], 450)
-        self.assertEqual(startup["burst_step_rate_hz"], 1000)
-        self.assertEqual(startup["inter_burst_ms"], 50)
-        self.assertEqual(startup["max_bursts"], 10)
-        self.assertEqual(startup["axis_order"], ["x", "y"])
-        self.assertTrue(startup["limit_stop_during_burst"])
+        self.assertEqual(startup["close_step_count"], 5000)
+        self.assertEqual(startup["backoff_step_count"], 500)
+        self.assertEqual(startup["step_rate_hz"], 1000)
+        self.assertEqual(startup["axis_order"], ["x", "y", "z"])
+        self.assertTrue(startup["limit_stop_during_move"])
         self.assertEqual(startup["stop_semantics"], "finish_current_high_pulse_then_no_next_rising_edge")
         self.assertEqual(startup["additional_rising_edges_after_synchronized_limit"], 0)
-        self.assertFalse(startup["runtime_limit_use"])
+        self.assertTrue(startup["runtime_limit_use"])
 
     def test_generated_params_match_startup_config(self):
         project = json.loads(PROJECT_PATH.read_text(encoding="utf-8"))
         startup = project["limits"]["startup"]
         params = PARAMS_PATH.read_text(encoding="utf-8")
         self.assertIn("`define P4_STARTUP_ENABLED 1", params)
-        self.assertIn("`define P4_STARTUP_DIR_MASK 2'b11", params)
-        self.assertIn(f"`define P4_STARTUP_BURST_STEPS {startup['burst_step_count']}", params)
-        self.assertIn(f"`define P4_STARTUP_MAX_BURSTS {startup['max_bursts']}", params)
-        expected_ticks = startup["inter_burst_ms"] * 1000 // project["watchdog"]["tick_us"]
-        self.assertIn(f"`define P4_STARTUP_INTER_BURST_TICKS {expected_ticks}", params)
+        self.assertIn("`define P4_STARTUP_DIR_MASK 3'b111", params)
+        self.assertIn(f"`define P4_STARTUP_CLOSE_STEPS {startup['close_step_count']}", params)
+        self.assertIn(f"`define P4_STARTUP_BACKOFF_STEPS {startup['backoff_step_count']}", params)
 
     def test_source_manifest_includes_startup_close_seek(self):
         manifest = json.loads(SOURCE_MANIFEST_PATH.read_text(encoding="utf-8"))
@@ -65,39 +55,26 @@ class StartupCloseSeekContractTests(unittest.TestCase):
         self.assertIn("assign motor_start = startup_done ? host_motor_start : startup_motor_start", top)
         self.assertIn("assign motor_active_mask = startup_done ? host_motor_active_mask : startup_motor_active_mask", top)
         self.assertIn("assign motor_dir_mask = startup_done ? host_motor_dir_mask : startup_motor_dir_mask", top)
-        self.assertIn("assign motor_stop_mask = startup_done ? 2'b00 : startup_motor_stop_mask", top)
+        self.assertIn("assign motor_stop_mask = startup_done ? runtime_limit_stop_mask : startup_motor_stop_mask", top)
         self.assertIn(".motor_stop_mask(startup_motor_stop_mask)", top)
         self.assertIn(".stop_mask(motor_stop_mask)", top)
 
-    def test_top_level_synchronizes_limit_inputs(self):
+    def test_top_level_synchronizes_ls_hs_limit_inputs(self):
         top = TOP_PATH.read_text(encoding="utf-8")
-        self.assertRegex(top, r"x_limit_sync0\s*<=\s*x_limit_raw")
-        self.assertRegex(top, r"x_limit_sync1\s*<=\s*x_limit_sync0")
-        self.assertRegex(top, r"y_limit_sync0\s*<=\s*y_limit_raw")
-        self.assertRegex(top, r"y_limit_sync1\s*<=\s*y_limit_sync0")
+        self.assertRegex(top, r"x_limit_ls_sync0\s*<=\s*x_limit_ls")
+        self.assertRegex(top, r"x_limit_hs_sync0\s*<=\s*x_limit_hs")
+        self.assertRegex(top, r"z_limit_ls_sync0\s*<=\s*z_limit_ls")
         self.assertIn("limit_sync_valid", top)
         self.assertRegex(top, r"limit_sync_valid_cnt\s*<\s*2'd3")
 
-    def test_top_level_gates_startup_until_sync_valid(self):
-        top = TOP_PATH.read_text(encoding="utf-8")
-        self.assertIn(".limit_sync_valid(limit_sync_valid)", top)
-
-    def test_startup_module_has_wait_sync_state(self):
-        source = (ROOT / "src" / "modules" / "startup_close_seek.v").read_text(encoding="utf-8")
-        self.assertIn("ST_WAIT_SYNC", source)
-        self.assertIn("limit_sync_valid", source)
-        self.assertIn("if (limit_sync_valid)", source)
-        self.assertIn("reached_mask_next", source)
-        self.assertIn("limit_sync_valid ? limit_sync : AXIS_ZERO", source)
-        self.assertIn("motor_stop_mask", source)
-        self.assertIn("assign motor_stop_mask", source)
-        self.assertIn("AXIS_COUNT", source)
-
-    def test_startup_module_has_expected_parameters(self):
+    def test_startup_module_has_wait_sync_and_close_backoff_states(self):
         source = (ROOT / "src" / "modules" / "startup_close_seek.v").read_text(encoding="utf-8")
-        params = ["FIXED_STEPS", "DIR_SETUP_TICKS", "STEP_HALF_CYCLES", "MAX_BURSTS", "INTER_BURST_TICKS", "DIR_MASK"]
-        for param in params:
-            self.assertRegex(source, rf"\bparameter\s+((integer|\[[^\]]+\])\s+)?{param}\b")
+        for marker in (
+            "ST_WAIT_SYNC", "ST_CLOSE_START", "ST_CLOSE_WAIT", "ST_BACKOFF_START",
+            "limit_sync_valid", "limit_ls_sync", "limit_hs_sync", "motor_stop_mask",
+            "CLOSE_STEPS", "BACKOFF_STEPS", "AXIS_COUNT",
+        ):
+            self.assertIn(marker, source)
 
 
 if __name__ == "__main__":

+ 21 - 28
tests/unit/test_startup_mutation.py

@@ -12,30 +12,20 @@ from pathlib import Path
 ROOT = Path(__file__).resolve().parents[2]
 SOURCE = ROOT / "src" / "modules" / "startup_close_seek.v"
 
-# Import harness tooling for toolchain discovery.
 sys.path.insert(0, str(ROOT / "tools"))
 import prod2u_p4_harness  # type: ignore
 
 
 def mutated_source() -> str:
     text = SOURCE.read_text(encoding="utf-8")
-    # Make the module ignore limit_sync_valid by removing the WAIT_SYNC state and
-    # the valid gating on reached_mask_next.
     text = re.sub(
-        r"state\s*<=\s*ST_WAIT_SYNC;",
+        r"if \(limit_sync_valid\)\s*state\s*<=\s*ST_CHECK;",
         "state <= ST_CHECK;",
         text,
         count=1,
     )
     text = re.sub(
-        r"reached_mask\s*\|\s*\(limit_sync_valid\s*\?\s*limit_sync\s*:\s*2'b00\)",
-        "reached_mask | limit_sync",
-        text,
-        count=1,
-    )
-    # Remove the WAIT_SYNC case block entirely.
-    text = re.sub(
-        r"ST_WAIT_SYNC:\s*begin\s*motor_start\s*<=\s*1'b0;\s*if\s*\(limit_sync_valid\)\s*begin\s*state\s*<=\s*ST_CHECK;\s*end\s*end\s*",
+        r"ST_WAIT_SYNC:\s*begin\s*motor_start\s*<=\s*1'b0;\s*if\s*\(limit_sync_valid\)\s*state\s*<=\s*ST_CHECK;\s*end\s*",
         "",
         text,
         count=1,
@@ -45,7 +35,6 @@ def mutated_source() -> str:
 
 class StartupMutationTests(unittest.TestCase):
     def test_removing_wait_sync_fails(self):
-        """A mutant that ignores limit_sync_valid must assert motor_start early."""
         iverilog = prod2u_p4_harness.resolve_tool("iverilog")
         vvp = prod2u_p4_harness.resolve_tool("vvp")
         if not iverilog or not vvp:
@@ -63,30 +52,30 @@ module tb;
     reg clk = 1'b0;
     reg rst_n = 1'b0;
     reg tick_500us = 1'b0;
-    reg [1:0] limit = 2'b00;
+    reg [2:0] limit_ls = 3'b000;
+    reg [2:0] limit_hs = 3'b000;
     reg limit_sync_valid = 1'b0;
     wire startup_done;
     wire motor_start;
-    wire [1:0] motor_active_mask;
-    wire [1:0] motor_dir_mask;
-    wire [1:0] motor_stop_mask;
+    wire [2:0] motor_active_mask;
+    wire [2:0] motor_dir_mask;
+    wire [2:0] motor_stop_mask;
+    wire [12:0] motor_step_count;
     reg motor_done = 1'b0;
 
     always #1 clk = ~clk;
 
     startup_close_seek #(
-        .FIXED_STEPS(450),
-        .DIR_SETUP_TICKS(2),
-        .STEP_HALF_CYCLES(12500),
-        .MAX_BURSTS(10),
-        .INTER_BURST_TICKS(4),
-        .DIR_MASK(2'b11)
+        .CLOSE_STEPS(8),
+        .BACKOFF_STEPS(4),
+        .AXIS_COUNT(3)
     ) dut (
         .clk(clk), .rst_n(rst_n), .tick_500us(tick_500us),
-        .limit_sync_valid(limit_sync_valid), .limit_sync(limit),
+        .limit_sync_valid(limit_sync_valid),
+        .limit_ls_sync(limit_ls), .limit_hs_sync(limit_hs),
         .startup_done(startup_done), .motor_start(motor_start),
         .motor_active_mask(motor_active_mask), .motor_dir_mask(motor_dir_mask),
-        .motor_stop_mask(motor_stop_mask),
+        .motor_step_count(motor_step_count), .motor_stop_mask(motor_stop_mask),
         .motor_done(motor_done)
     );
 
@@ -94,8 +83,6 @@ module tb;
     initial begin
         repeat (3) @(posedge clk);
         rst_n = 1'b1;
-        // limit_sync_valid stays 0; limit is not reached. A correct module waits
-        // here; the mutant should start the motor immediately.
         for (i = 0; i < 20; i = i + 1) begin
             @(posedge clk);
             if (motor_start) begin
@@ -119,7 +106,13 @@ endmodule
                 env=env,
             )
             self.assertEqual(compile_result.returncode, 0, compile_result.stderr)
-            run_result = subprocess.run([vvp, str(vvp_out)], cwd=tmp, capture_output=True, text=True, env=env)
+            run_result = subprocess.run(
+                [vvp, str(vvp_out)],
+                cwd=tmp,
+                capture_output=True,
+                text=True,
+                env=env,
+            )
             self.assertIn("MUTATION_DETECTED", run_result.stdout)
 
 

+ 64 - 0
tests/unit/test_three_axis_door_contract.py

@@ -0,0 +1,64 @@
+"""3-axis door contract: X/Y/Z motors, six limits, no solenoid/motor-compat."""
+
+from __future__ import annotations
+
+import json
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[2]
+PROJECT_PATH = ROOT / "projects" / "prod2u-door-temp" / "project.json"
+PARAMS_PATH = ROOT / "src" / "generated" / "prod2u_door_temp_params.vh"
+TOP_PATH = ROOT / "src" / "top" / "prod2u_p4_normal_v3_top.v"
+DISPATCHER_PATH = ROOT / "src" / "modules" / "door_action_dispatcher.v"
+
+
+class ThreeAxisDoorContractTests(unittest.TestCase):
+    def test_project_is_three_axis_six_limit(self):
+        project = json.loads(PROJECT_PATH.read_text(encoding="utf-8"))
+        self.assertEqual(project["motors"]["count"], 3)
+        self.assertEqual(project["motors"]["order"], ["x", "y", "z"])
+        self.assertEqual(project["limits"]["limit_count"], 6)
+        self.assertTrue(project["limits"]["runtime_use"])
+        set_all = project["protocol"]["set_all"]
+        self.assertEqual(set_all["z_door_offset"], 8)
+        self.assertEqual(set_all["exhaust_x_offset"], 9)
+        self.assertEqual(set_all["exhaust_y_offset"], 10)
+        self.assertNotIn("intake_actuator", project.get("doors", {}))
+
+    def test_generated_params_three_axis_runtime_limits(self):
+        params = PARAMS_PATH.read_text(encoding="utf-8")
+        self.assertIn("`define P4_AXIS_COUNT 3", params)
+        self.assertIn("`define P4_LIMIT_COUNT 6", params)
+        self.assertIn("`define P4_RUNTIME_LIMIT_USE 1", params)
+        self.assertIn("`define P4_STARTUP_CLOSE_STEPS 5000", params)
+        self.assertIn("`define P4_STARTUP_BACKOFF_STEPS 500", params)
+        self.assertIn("`define P4_MOTOR_ENABLE_POLICY_PERMANENT_HIGH 1", params)
+        self.assertNotIn("P4_INTAKE_ACTUATOR_SOLENOID", params)
+        self.assertNotIn("P4_PROFILE_MOTOR_COMPAT", params)
+
+    def test_dispatcher_maps_byte8_to_z_bit2(self):
+        source = DISPATCHER_PATH.read_text(encoding="utf-8")
+        self.assertIn("z_door_cmd", source)
+        self.assertIn("{z_active, y_active, x_active}", source)
+        self.assertNotIn("intake_door_cmd", source)
+
+    def test_top_has_z_axis_and_six_limit_ports(self):
+        top = TOP_PATH.read_text(encoding="utf-8")
+        for port in (
+            "z_step", "z_dir",
+            "x_limit_ls", "x_limit_hs",
+            "y_limit_ls", "y_limit_hs",
+            "z_limit_ls", "z_limit_hs",
+        ):
+            self.assertIn(port, top)
+        self.assertIn("assign motor_en_n = 1'b1", top)
+        self.assertNotIn("intake_solenoid_out", top)
+
+    def test_no_motor_compat_companion_in_repo(self):
+        self.assertFalse((ROOT / "src/top/prod2u_p4_motor_compat_top.v").exists())
+        self.assertFalse((ROOT / "projects/prod2u-door-temp-motor-compat").exists())
+
+
+if __name__ == "__main__":
+    unittest.main()

+ 101 - 191
tools/generate_project.py

@@ -13,7 +13,6 @@ from jsonschema import Draft202012Validator
 
 
 PROFILE = "prod2u-normal-multiproject-115200-v1"
-MOTOR_COMPAT_PROFILE = "prod2u-motor-compat-intake-v1"
 SCHEMA_PATH = Path(__file__).resolve().parents[1] / "schemas" / "project.schema.json"
 SOURCE_CLOSURE_PATH = Path(__file__).resolve().parents[1] / "config" / "source_closure.json"
 
@@ -185,42 +184,10 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
     _keys(boot_targets, {"ptc", "fan"}, "outputs.boot_targets")
     _require(boot_targets == {"ptc": 0, "fan": 10}, "boot target mapping mismatch")
 
-    motor_compat = payload["profile"] == MOTOR_COMPAT_PROFILE
     doors = _object(payload["doors"], "doors")
-    door_keys = {"scope", "chamber_controlled", "intake_actuator", "intake_motor_profile_available", "exhaust_axes", "solenoid"}
-    if motor_compat:
-        door_keys = door_keys | {"intake_motor"}
-    _keys(doors, door_keys, "doors")
-    _require(doors["intake_actuator"] in {"solenoid", "motor"}, "invalid intake actuator")
-    if motor_compat:
-        _require(doors["intake_actuator"] == "motor", "motor-compat profile requires intake_actuator=motor")
-        _require(doors["intake_motor_profile_available"] is True, "motor-compat profile must mark intake motor available")
-        intake_motor = _object(doors["intake_motor"], "doors.intake_motor")
-        _require(intake_motor.get("evidence_status") == "blocked", "intake motor physical mapping must stay blocked")
-        _require(intake_motor.get("package") is False, "intake motor must not enter production package/ADC")
-    else:
-        _require(doors["intake_actuator"] == "solenoid", "default intake actuator must be solenoid")
-    solenoid = _object(doors["solenoid"], "doors.solenoid")
-    solenoid_keys = {"signal", "evidence_status", "open_level", "closed_level", "inactive_level", "notes"}
-    if solenoid.get("ball"):
-        solenoid_keys = solenoid_keys | {"ball", "connector", "connector_pin"}
-    _keys(solenoid, solenoid_keys, "doors.solenoid")
-    _require(solenoid["signal"] == "intake_solenoid_out", "solenoid signal must be intake_solenoid_out")
-    _require(solenoid["open_level"] in {"high", "low"} and solenoid["closed_level"] in {"high", "low"}, "invalid solenoid levels")
-    _require(solenoid["inactive_level"] in {"high", "low"}, "invalid solenoid inactive level")
-    if motor_compat:
-        _require(solenoid.get("evidence_status") == "blocked", "motor-compat solenoid must stay blocked")
-        _require(not solenoid.get("ball"), "motor-compat solenoid must not bind a package ball")
-    elif solenoid.get("ball"):
-        _require(
-            solenoid["evidence_status"] in {"inferred", "confirmed"},
-            "assigned solenoid ball requires inferred or confirmed evidence_status",
-        )
-        _require(isinstance(solenoid["ball"], str) and solenoid["ball"], "invalid solenoid ball")
-        _require(isinstance(solenoid["connector"], str) and solenoid["connector"], "invalid solenoid connector")
-        _integer(solenoid["connector_pin"], "doors.solenoid.connector_pin", minimum=1)
-    else:
-        _require(solenoid.get("evidence_status") == "blocked", "unbound solenoid must stay blocked")
+    _keys(doors, {"scope", "chamber_controlled", "door_axes"}, "doors")
+    door_axes = _list(doors["door_axes"], "doors.door_axes", 3)
+    _require(door_axes == ["x", "y", "z"], "door_axes must be x,y,z")
 
     motors = _object(payload["motors"], "motors")
     _keys(
@@ -256,63 +223,67 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
     _require(isinstance(motors["command_values"], list) and motors["command_values"], "invalid motor commands")
     _require(motors["heartbeat_value"] in motors["command_values"], "motor heartbeat is not a command")
     mapping = _object(motors["mapping"], "motors.mapping")
-    if motor_compat:
-        _require(motors["count"] == 3 and motors["order"] == ["x", "y", "intake"], "motor-compat axis order must be x,y,intake")
-        _keys(mapping, {"x", "y", "intake"}, "motors.mapping")
-        for axis in ("x", "y"):
-            item = _object(mapping[axis], f"motors.mapping.{axis}")
-            _keys(item, {"axis", "role", "step_ball", "dir_ball"}, f"motors.mapping.{axis}")
-            _require(item["axis"] == axis and item["role"] == "exhaust", f"motor {axis} role mismatch")
-        intake_map = _object(mapping["intake"], "motors.mapping.intake")
-        _require(intake_map.get("axis") == "intake", "intake mapping axis mismatch")
-        _require(intake_map.get("evidence_status") == "blocked", "intake motor balls must stay blocked")
-        _require(intake_map.get("package") is False, "intake motor must not enter ADC")
-        _require(intake_map.get("step_ball") in (None, ""), "intake step_ball must be unset for non-production")
-        _require(intake_map.get("dir_ball") in (None, ""), "intake dir_ball must be unset for non-production")
-    else:
-        _require(motors["count"] == 2, "production motor count must be 2")
-        _keys(mapping, {"x", "y"}, "motors.mapping")
-        for axis in ("x", "y"):
-            item = _object(mapping[axis], f"motors.mapping.{axis}")
-            _keys(item, {"axis", "role", "step_ball", "dir_ball"}, f"motors.mapping.{axis}")
-            _require(item["axis"] == axis and item["role"] == "exhaust", f"motor {axis} role mismatch")
+    _require(motors["count"] == 3 and motors["order"] == ["x", "y", "z"], "production motor count/order must be x,y,z")
+    _keys(mapping, {"x", "y", "z"}, "motors.mapping")
+    for axis in ("x", "y", "z"):
+        item = _object(mapping[axis], f"motors.mapping.{axis}")
+        required = {"axis", "role", "step_ball", "dir_ball"}
+        _require(required <= set(item), f"motors.mapping.{axis} missing required keys")
+        _require(item["axis"] == axis and item["role"] == "door", f"motor {axis} role mismatch")
     enable = _object(motors["enable_n"], "motors.enable_n")
-    _keys(enable, {"ball", "active_level", "policy"}, "motors.enable_n")
+    _require({"ball", "active_level", "policy"} <= set(enable), "motors.enable_n missing required keys")
     _require(isinstance(enable["ball"], str) and enable["ball"], "invalid motor enable ball")
     _require(enable["active_level"] == "low", "motor enable must be active low")
-    _require(enable["policy"] == "shared_constant_low", "motor enable policy mismatch")
+    _require(enable["policy"] == "permanent_high", "motor enable policy must be permanent_high")
 
     limits = _object(payload["limits"], "limits")
     _keys(limits, {"limit_count", "active_level", "functional_use", "runtime_use", "startup", "channels"}, "limits")
-    expected_limits = 3 if motor_compat else 2
-    _require(limits["limit_count"] == len(limits["channels"]) == expected_limits, "limit count/list mismatch")
+    _require(limits["limit_count"] == len(limits["channels"]) == 6, "limit count/list mismatch")
     _require(limits["active_level"] == "high" and limits["functional_use"] is True, "limit policy mismatch")
-    _require(limits["runtime_use"] is False, "runtime limit use must be false")
+    _require(limits["runtime_use"] is True, "runtime limit use must be true")
     startup = _object(limits["startup"], "limits.startup")
-    _keys(startup, {"enabled", "direction_value", "direction_meaning", "burst_step_count", "burst_step_rate_hz", "inter_burst_ms", "max_bursts", "axis_order", "limit_stop_during_burst", "stop_semantics", "additional_rising_edges_after_synchronized_limit", "runtime_limit_use"}, "limits.startup")
+    _keys(
+        startup,
+        {
+            "enabled",
+            "direction_value",
+            "direction_meaning",
+            "close_step_count",
+            "backoff_step_count",
+            "step_rate_hz",
+            "axis_order",
+            "limit_stop_during_move",
+            "stop_semantics",
+            "additional_rising_edges_after_synchronized_limit",
+            "runtime_limit_use",
+        },
+        "limits.startup",
+    )
     _require(startup["enabled"] is True, "startup must be enabled")
     _require(startup["direction_meaning"] == "close", "startup direction must be close")
-    _require(startup["limit_stop_during_burst"] is True, "startup limit stop during burst must be enabled")
+    _require(startup["limit_stop_during_move"] is True, "startup limit stop during move must be enabled")
     _require(startup["stop_semantics"] == "finish_current_high_pulse_then_no_next_rising_edge", "unsupported stop semantics")
     _require(startup["additional_rising_edges_after_synchronized_limit"] == 0, "additional rising edges after limit must be zero")
-    _require(startup["runtime_limit_use"] is False, "startup runtime limit use must be false")
+    _require(startup["runtime_limit_use"] is True, "startup runtime limit use must be true")
     _integer(startup["direction_value"], "limits.startup.direction_value", minimum=0)
-    _integer(startup["burst_step_count"], "limits.startup.burst_step_count", minimum=1)
-    _integer(startup["burst_step_rate_hz"], "limits.startup.burst_step_rate_hz", minimum=1)
-    _integer(startup["inter_burst_ms"], "limits.startup.inter_burst_ms", minimum=0)
-    _integer(startup["max_bursts"], "limits.startup.max_bursts", minimum=1)
-    _require(len(startup["axis_order"]) == limits["limit_count"], "startup axis order mismatch")
-    if motor_compat:
-        _require(startup["axis_order"] == ["x", "y", "intake"], "motor-compat startup axis order mismatch")
+    _integer(startup["close_step_count"], "limits.startup.close_step_count", minimum=1)
+    _integer(startup["backoff_step_count"], "limits.startup.backoff_step_count", minimum=0)
+    _integer(startup["step_rate_hz"], "limits.startup.step_rate_hz", minimum=1)
+    _require(startup["close_step_count"] == 5000, "startup close step count must be 5000")
+    _require(startup["backoff_step_count"] == 500, "startup backoff step count must be 500")
+    _require(len(startup["axis_order"]) == 3 and startup["axis_order"] == ["x", "y", "z"], "startup axis order mismatch")
+    expected_limit_names = [
+        "x_limit_ls",
+        "x_limit_hs",
+        "y_limit_ls",
+        "y_limit_hs",
+        "z_limit_ls",
+        "z_limit_hs",
+    ]
     for index, item in enumerate(limits["channels"]):
         entry = _object(item, f"limits.channels[{index}]")
-        if motor_compat and entry.get("name") == "intake_limit_raw":
-            _require(entry.get("evidence_status") == "blocked", "intake limit must stay blocked")
-            _require(entry.get("package") is False, "intake limit must not enter ADC")
-            _require(entry.get("ball") in (None, ""), "intake limit ball must be unset")
-        else:
-            _keys(entry, {"name", "ball"}, f"limits.channels[{index}]")
-            _require(entry["name"] in {"x_limit_raw", "y_limit_raw"}, "invalid limit name")
+        _keys(entry, {"name", "ball", "connector", "connector_pin", "side"}, f"limits.channels[{index}]")
+        _require(entry["name"] == expected_limit_names[index], "invalid limit channel order/name")
 
     temperature = _object(payload["temperature"], "temperature")
     _keys(
@@ -358,8 +329,14 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
             "x_dir",
             "y_step",
             "y_dir",
-            "x_limit_raw",
-            "y_limit_raw",
+            "z_step",
+            "z_dir",
+            "x_limit_ls",
+            "x_limit_hs",
+            "y_limit_ls",
+            "y_limit_hs",
+            "z_limit_ls",
+            "z_limit_hs",
         },
         "pins",
     )
@@ -371,13 +348,11 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
         "FAN pin/list mismatch",
     )
     _require(pins["motor_en_n"] == enable["ball"], "motor enable pin mismatch")
-    _require(pins["x_step"] == mapping["x"]["step_ball"] and pins["x_dir"] == mapping["x"]["dir_ball"], "X motor pin mismatch")
-    _require(pins["y_step"] == mapping["y"]["step_ball"] and pins["y_dir"] == mapping["y"]["dir_ball"], "Y motor pin mismatch")
-    production_limit_balls = [item["ball"] for item in limits["channels"] if item["name"] in {"x_limit_raw", "y_limit_raw"}]
-    _require([pins["x_limit_raw"], pins["y_limit_raw"]] == production_limit_balls, "limit pin mismatch")
-    # Motor-compat intake axis/limit must never appear in production pins/ADC.
-    pin_blob = json.dumps(dict(pins), sort_keys=True)
-    _require("intake" not in pin_blob.lower(), "intake motor/limit must not appear in production pins")
+    for axis in ("x", "y", "z"):
+        _require(pins[f"{axis}_step"] == mapping[axis]["step_ball"], f"{axis} step pin mismatch")
+        _require(pins[f"{axis}_dir"] == mapping[axis]["dir_ball"], f"{axis} dir pin mismatch")
+    for channel in limits["channels"]:
+        _require(pins[channel["name"]] == channel["ball"], f"{channel['name']} pin mismatch")
 
     resources = _object(payload["resource_policy"], "resource_policy")
     _keys(
@@ -430,7 +405,7 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
             "fan_offset",
             "chamber_ptc_offset",
             "chamber_ptc_count",
-            "intake_door_offset",
+            "z_door_offset",
             "exhaust_x_offset",
             "exhaust_y_offset",
             "legacy_payload_length_rejected",
@@ -444,8 +419,8 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
     _require(set_all["fan_offset"] == 0, "SET_ALL FAN offset mismatch")
     _require(set_all["chamber_ptc_offset"] == outputs["fan_count"], "SET_ALL chamber PTC offset mismatch")
     _require(set_all["chamber_ptc_count"] == outputs["chamber_ptc_count"], "SET_ALL chamber PTC count mismatch")
-    _require(set_all["intake_door_offset"] == set_all["chamber_ptc_offset"] + set_all["chamber_ptc_count"], "SET_ALL intake offset mismatch")
-    _require(set_all["exhaust_x_offset"] == set_all["intake_door_offset"] + 1, "SET_ALL exhaust X offset mismatch")
+    _require(set_all["z_door_offset"] == set_all["chamber_ptc_offset"] + set_all["chamber_ptc_count"], "SET_ALL Z offset mismatch")
+    _require(set_all["exhaust_x_offset"] == set_all["z_door_offset"] + 1, "SET_ALL exhaust X offset mismatch")
     _require(set_all["exhaust_y_offset"] == set_all["exhaust_x_offset"] + 1, "SET_ALL exhaust Y offset mismatch")
     _require(set_all["payload_length"] == set_all["exhaust_y_offset"] + 1, "SET_ALL length mismatch")
     _require(set_all["legacy_payload_length_rejected"] == 14, "legacy payload length marker mismatch")
@@ -478,11 +453,6 @@ def load_project(path: Path) -> dict[str, Any]:
     project_path = Path(path)
     payload = json.loads(project_path.read_text(encoding="utf-8"))
     _require(isinstance(payload, dict), "project root must be an object")
-    # Motor-compat is a non-production variant; validate via Python contract, not the
-    # production JSON schema (which freezes the 2-axis solenoid package).
-    if payload.get("profile") == MOTOR_COMPAT_PROFILE:
-        _validate_project(payload)
-        return payload
     schema = json.loads(SCHEMA_PATH.read_text(encoding="utf-8"))
     errors = sorted(Draft202012Validator(schema).iter_errors(payload), key=lambda error: list(error.absolute_path))
     if errors:
@@ -496,12 +466,6 @@ def _active_interface(project: Mapping[str, Any]) -> tuple[tuple[str, str], ...]
     outputs = project["outputs"]
     pins = project["pins"]
     motors = project["motors"]
-    # Base interface: clock+UART+I2C+PWM+EN+X/Y STEP/DIR+X/Y limit.
-    # Intake motor / intake limit stay blocked. Production solenoid LOCs only when
-    # doors.solenoid.ball is assigned with non-blocked evidence_status.
-    limit_channels = [
-        item for item in project["limits"]["channels"] if item["name"] in {"x_limit_raw", "y_limit_raw"}
-    ]
     interface = (
         ("sys_clk", project["device"]["clock_ball"]),
         ("host_uart_rx", pins["host_uart_rx"]),
@@ -515,12 +479,10 @@ def _active_interface(project: Mapping[str, Any]) -> tuple[tuple[str, str], ...]
         ("x_dir", motors["mapping"]["x"]["dir_ball"]),
         ("y_step", motors["mapping"]["y"]["step_ball"]),
         ("y_dir", motors["mapping"]["y"]["dir_ball"]),
-        *tuple((item["name"], item["ball"]) for item in limit_channels),
+        ("z_step", motors["mapping"]["z"]["step_ball"]),
+        ("z_dir", motors["mapping"]["z"]["dir_ball"]),
+        *tuple((item["name"], item["ball"]) for item in project["limits"]["channels"]),
     )
-    solenoid = project["doors"]["solenoid"]
-    ball = solenoid.get("ball")
-    if ball and solenoid.get("evidence_status") != "blocked":
-        interface = interface + ((solenoid["signal"], ball),)
     return interface
 
 
@@ -599,19 +561,17 @@ def _render_params(project: Mapping[str, Any]) -> str:
     temperature = project["temperature"]
     uart = project["uart"]
     watchdog = project["watchdog"]
-    motor_compat = project["profile"] == MOTOR_COMPAT_PROFILE
-    axis_count = 3 if motor_compat else 2
-    intake_solenoid = 0 if motor_compat else 1
+    axis_count = motors["count"]
     _require(motors["dir_setup_cycles"] % watchdog["tick_clks"] == 0, "motor direction setup is not an integral tick count")
     motor_dir_setup_ticks = motors["dir_setup_cycles"] // watchdog["tick_clks"]
     frame_inter_byte_timeout_cycles = project["device"]["clock_hz"] * project["timeouts"]["frame_inter_byte_ms"] // 1000
-    startup_inter_burst_ticks = startup["inter_burst_ms"] * 1000 // watchdog["tick_us"]
     startup_dir_bit = startup["direction_value"]
     startup_dir_mask = f"{axis_count}'b" + (str(startup_dir_bit) * axis_count)
     lines = [
         "// Generated from project.json. Do not edit.",
-        f"`define P4_PROFILE_MOTOR_COMPAT {1 if motor_compat else 0}",
         f"`define P4_AXIS_COUNT {axis_count}",
+        f"`define P4_LIMIT_COUNT {limits['limit_count']}",
+        f"`define P4_RUNTIME_LIMIT_USE {1 if limits['runtime_use'] else 0}",
         f"`define P4_CLOCK_HZ {project['device']['clock_hz']}",
         f"`define P4_UART_BAUD {uart['baud']}",
         f"`define P4_UART_CLKS_PER_BIT {uart['clks_per_bit']}",
@@ -628,10 +588,9 @@ def _render_params(project: Mapping[str, Any]) -> str:
         f"`define P4_CHAMBER_PTC_COUNT {outputs['chamber_ptc_count']}",
         f"`define P4_SET_ALL_FAN_OFFSET {project['protocol']['set_all']['fan_offset']}",
         f"`define P4_SET_ALL_CHAMBER_PTC_OFFSET {project['protocol']['set_all']['chamber_ptc_offset']}",
-        f"`define P4_SET_ALL_INTAKE_DOOR_OFFSET {project['protocol']['set_all']['intake_door_offset']}",
+        f"`define P4_SET_ALL_Z_DOOR_OFFSET {project['protocol']['set_all']['z_door_offset']}",
         f"`define P4_SET_ALL_EXHAUST_X_OFFSET {project['protocol']['set_all']['exhaust_x_offset']}",
         f"`define P4_SET_ALL_EXHAUST_Y_OFFSET {project['protocol']['set_all']['exhaust_y_offset']}",
-        f"`define P4_INTAKE_ACTUATOR_SOLENOID {intake_solenoid}",
         f"`define P4_MOTOR_OPEN_DIR 1'b{motors['open_dir_value']}",
         f"`define P4_MOTOR_CLOSE_DIR 1'b{motors['close_dir_value']}",
         f"`define P4_FRAME_INTER_BYTE_TIMEOUT_CYCLES {frame_inter_byte_timeout_cycles}",
@@ -657,9 +616,10 @@ def _render_params(project: Mapping[str, Any]) -> str:
         f"`define P4_WATCHDOG_FAN_TARGET 8'h{watchdog['target']['fan']:02X}",
         f"`define P4_STARTUP_ENABLED {1 if startup['enabled'] else 0}",
         f"`define P4_STARTUP_DIR_MASK {startup_dir_mask}",
-        f"`define P4_STARTUP_BURST_STEPS {startup['burst_step_count']}",
-        f"`define P4_STARTUP_MAX_BURSTS {startup['max_bursts']}",
-        f"`define P4_STARTUP_INTER_BURST_TICKS {startup_inter_burst_ticks}",
+        f"`define P4_STARTUP_CLOSE_STEPS {startup['close_step_count']}",
+        f"`define P4_STARTUP_BACKOFF_STEPS {startup['backoff_step_count']}",
+        f"`define P4_STARTUP_STEP_RATE_HZ {startup['step_rate_hz']}",
+        f"`define P4_MOTOR_ENABLE_POLICY_PERMANENT_HIGH {1 if motors['enable_n']['policy'] == 'permanent_high' else 0}",
     ]
     lines.extend(
         f"`define P4_TEMP_DEVICE_ADDR_{index} 7'h{address:02X}"
@@ -697,8 +657,9 @@ def generate_project(project_path: Path, output_root: Path) -> dict[str, Any]:
         "schema": "prod2u-simple-host-contract-v1",
         "project_id": project["project_id"],
         "profile": project["profile"],
-        "intake_actuator": project["doors"]["intake_actuator"],
-        "axis_count": 3 if project["profile"] == MOTOR_COMPAT_PROFILE else 2,
+        "axis_count": project["motors"]["count"],
+        "limit_count": project["limits"]["limit_count"],
+        "runtime_limit_use": project["limits"]["runtime_use"],
         "uart": project["uart"],
         "protocol": project["protocol"],
         "commands": {
@@ -717,9 +678,9 @@ def generate_project(project_path: Path, output_root: Path) -> dict[str, Any]:
                     "ptc_chamber_2",
                     "ptc_chamber_3",
                     "ptc_chamber_4",
-                    "intake_door",
-                    "exhaust_x",
-                    "exhaust_y",
+                    "door_z",
+                    "door_x",
+                    "door_y",
                 ],
             },
             "get_temperature": {"type": "0x02", "payload_length": 0, "response": "TEMPERATURE_DATA"},
@@ -747,76 +708,25 @@ def generate_project(project_path: Path, output_root: Path) -> dict[str, Any]:
             "all_invalid_temperature": _frame_hex(0x82, bytes([0xFF] * project["temperature"]["value_count"])),
         },
     )
-    # Production TD source closure is solenoid-only; motor-compat keeps a separate
-    # non-production note rather than mutating the active TD manifest.
-    if project["profile"] == MOTOR_COMPAT_PROFILE:
-        sources = [
-            f"src/generated/{params_name}",
-            "src/common/uart_rx_byte.v",
-            "src/common/uart_tx_byte.v",
-            "src/common/crc16_serial.v",
-            "src/common/frame_rx.v",
-            "src/common/frame_tx.v",
-            "src/common/payload_ram.v",
-            "src/modules/output_target_ram.v",
-            "src/modules/pwm_scheduler.v",
-            "src/modules/shared_500us_tick.v",
-            "src/modules/host_watchdog.v",
-            "src/modules/startup_close_seek.v",
-            "src/modules/door_motor_engine.v",
-            "src/modules/door_action_dispatcher.v",
-            "src/modules/i2c_word_reader.v",
-            "src/modules/temperature_reader.v",
-            "src/modules/temperature_ram.v",
-            "src/project/command_controller.v",
-            "src/project/project_adapter_motor_compat.v",
-            "src/rtl/prod2u_por.v",
-            "src/rtl/prod2u_p4_i2c_stop_start_read.v",
-            "src/top/prod2u_p4_motor_compat_top.v",
-        ]
-        source_payload = {
-            "schema": "prod2u-simple-source-manifest-template-v1",
-            "project_id": project["project_id"],
-            "profile": project["profile"],
-            "production": False,
-            "sources": sources,
-            "generated_from": "project.json",
-            "contract": {
-                "uart": project["uart"],
-                "protocol": project["protocol"],
-                "set_all_payload_length": summary["set_all_payload_len"],
-                "temperature_frame_length": summary["temperature_frame_len"],
-                "axis_count": 3,
-                "intake_actuator": "motor",
-            },
-            "active_interface": [
-                {"signal": signal, "ball": ball}
-                for signal, ball in render_adc(project)
-            ],
-            "blocked_physical": [
-                "intake_step",
-                "intake_dir",
-                "intake_limit_raw",
-                "intake_solenoid_out",
-            ],
-        }
-    else:
-        source_payload = {
-            "schema": "prod2u-simple-source-manifest-template-v1",
-            "project_id": project["project_id"],
-            "sources": list(_load_source_closure()),
-            "generated_from": "project.json",
-            "contract": {
-                "uart": project["uart"],
-                "protocol": project["protocol"],
-                "set_all_payload_length": summary["set_all_payload_len"],
-                "temperature_frame_length": summary["temperature_frame_len"],
-            },
-            "active_interface": [
-                {"signal": signal, "ball": ball}
-                for signal, ball in render_adc(project)
-            ],
-        }
+    source_payload = {
+        "schema": "prod2u-simple-source-manifest-template-v1",
+        "project_id": project["project_id"],
+        "sources": list(_load_source_closure()),
+        "generated_from": "project.json",
+        "contract": {
+            "uart": project["uart"],
+            "protocol": project["protocol"],
+            "set_all_payload_length": summary["set_all_payload_len"],
+            "temperature_frame_length": summary["temperature_frame_len"],
+            "axis_count": project["motors"]["count"],
+            "limit_count": project["limits"]["limit_count"],
+            "runtime_limit_use": project["limits"]["runtime_use"],
+        },
+        "active_interface": [
+            {"signal": signal, "ball": ball}
+            for signal, ball in render_adc(project)
+        ],
+    }
     _write_json(output / "td-source-manifest.json", source_payload)
     (output / f"{project['project_id'].replace('-', '_')}.adc").write_text(
         render_adc_text(project), encoding="ascii", newline="\n"

+ 22 - 21
tools/prod2u_p4_harness.py

@@ -93,10 +93,18 @@ EXPECTED_CDC_SYNC_REGISTERS = frozenset(
         "u_temperature_i2c/scl_sync[1]",
         "u_temperature_i2c/sda_sync[0]",
         "u_temperature_i2c/sda_sync[1]",
-        "x_limit_sync0",
-        "x_limit_sync1",
-        "y_limit_sync0",
-        "y_limit_sync1",
+        "x_limit_ls_sync0",
+        "x_limit_ls_sync1",
+        "x_limit_hs_sync0",
+        "x_limit_hs_sync1",
+        "y_limit_ls_sync0",
+        "y_limit_ls_sync1",
+        "y_limit_hs_sync0",
+        "y_limit_hs_sync1",
+        "z_limit_ls_sync0",
+        "z_limit_ls_sync1",
+        "z_limit_hs_sync0",
+        "z_limit_hs_sync1",
     }
 )
 EXPECTED_CDC_FALSE_PATH_ENDPOINTS = frozenset(
@@ -104,12 +112,16 @@ EXPECTED_CDC_FALSE_PATH_ENDPOINTS = frozenset(
         "u_uart_rx/rx_sync_pipe[0]",
         "u_temperature_i2c/scl_sync[0]",
         "u_temperature_i2c/sda_sync[0]",
-        "x_limit_sync0",
-        "y_limit_sync0",
+        "x_limit_ls_sync0",
+        "x_limit_hs_sync0",
+        "y_limit_ls_sync0",
+        "y_limit_hs_sync0",
+        "z_limit_ls_sync0",
+        "z_limit_hs_sync0",
     }
 )
-EXPECTED_CDC_INPUT_REGISTERS = 5
-EXPECTED_FSM_AXES = {"x": 2, "y": 2}
+EXPECTED_CDC_INPUT_REGISTERS = 9  # uart_rx + scl + sda + 6 limit first-stage syncs
+EXPECTED_FSM_AXES = {"x": 2, "y": 2, "z": 2}
 BUILD_ROOT_RELATIVE = Path("td") / PROFILE
 TD_SCRIPTS = {
     "syn": ROOT / "td" / "syn" / f"{PROFILE}.tcl",
@@ -157,7 +169,7 @@ def valid_td_run_id(value: object) -> bool:
 def active_pin_contract() -> dict[str, dict[str, str]]:
     """Derive the active 24-ball contract from project.json, not pad folklore."""
     project = load_project(PROJECT_CONFIG_PATH)
-    input_signals = {"sys_clk", "host_uart_rx", "x_limit_raw", "y_limit_raw"}
+    input_signals = {"sys_clk", "host_uart_rx", "x_limit_ls", "x_limit_hs", "y_limit_ls", "y_limit_hs", "z_limit_ls", "z_limit_hs"}
     inout_signals = {"temp_scl", "temp_sda"}
     return {
         signal: {
@@ -731,18 +743,12 @@ def active_rtl_sources() -> list[str]:
 
 def hdl_testbenches() -> list[dict[str, Any]]:
     rtl = active_rtl_sources()
-    # Non-production motor-compat adapter is outside the production TD closure.
-    extra_sources = {
-        "project_adapter_motor_compat_tb": [
-            "src/project/project_adapter_motor_compat.v",
-        ],
-    }
     targets: list[dict[str, Any]] = []
     for name in sorted(load_target_manifest()["layers"]["icarus"]):
         path = ROOT / "tests" / "sim" / f"{name}.v"
         if not path.is_file():
             raise FileNotFoundError(f"manifest Icarus target is missing: {path}")
-        sources = [*rtl, *extra_sources.get(name, []), path.relative_to(ROOT).as_posix()]
+        sources = [*rtl, path.relative_to(ROOT).as_posix()]
         targets.append(
             {
                 "name": name,
@@ -2763,8 +2769,6 @@ def post_route_pin_gate(rows: Sequence[Mapping[str, str]] | None) -> dict[str, A
         failures.append("io_name_not_unique")
     if len(set(locations)) != len(locations):
         failures.append("io_location_not_unique")
-    if "A5" in locations:
-        failures.append("forbidden_location_assigned:A5")
     required = {
         name: {**expected, "io_standard": "LVCMOS33"}
         for name, expected in expected_pins.items()
@@ -2782,7 +2786,6 @@ def post_route_pin_gate(rows: Sequence[Mapping[str, str]] | None) -> dict[str, A
         "row_count": len(normalized),
         "required": required,
         "observed": {name: by_name.get(name) for name in required},
-        "forbidden_location": "A5",
         "failures": failures,
     }
 
@@ -2866,8 +2869,6 @@ def pin_binding_gate() -> dict[str, Any]:
         failures.append("duplicate_signal")
     if len({item[0] for item in by_signal.values()}) != len(assignments):
         failures.append("duplicate_ball")
-    if any(ball == "A5" for ball, _standard, _pull in by_signal.values()):
-        failures.append("forbidden_ball_assigned:A5")
     required = {
         signal: (expected["location"], expected["pull_type"])
         for signal, expected in expected_pins.items()