Prechádzať zdrojové kódy

fix(prod2u): prioritize trusted jog commands

Codex Resource Selftest 4 mesiacov pred
rodič
commit
1d6fdbe4c2
47 zmenil súbory, kde vykonal 3790 pridanie a 423 odobranie
  1. 5 1
      AGENTS.md
  2. 31 1
      README.zh-CN.md
  3. 5 0
      config/prod2u_p4_normal_host_contract_v4.json
  4. 5 0
      config/prod2u_p4_normal_v3_hw_binding.json
  5. 2 2
      config/prod2u_p4_normal_v3_resource_baseline.json
  6. 9 0
      config/prod2u_p4_verification_targets_v1.json
  7. 7 4
      docs/prod2u-p4-normal-v3-runbook.zh-CN.md
  8. 6 1
      schemas/prod2u_p4_normal_host_contract_v4.schema.json
  9. 1 1
      schemas/prod2u_p4_normal_v3_final_gate_receipt.schema.json
  10. 6 2
      schemas/prod2u_p4_normal_v3_package_selftest_receipt.schema.json
  11. 7 5
      schemas/prod2u_p4_normal_v3_td_build_receipt.schema.json
  12. 13 8
      src/rtl/prod2u_p4_axis_executor.v
  13. 54 46
      src/rtl/prod2u_p4_normal_v3_core.v
  14. 42 6
      src/rtl/prod2u_p4_normal_v3_rx.v
  15. 12 0
      src/top/prod2u_p4_normal_v3_top.v
  16. 45 27
      td/phy/prod2u_p4_normal_v3.tcl
  17. 45 27
      td/syn/prod2u_p4_normal_v3.tcl
  18. 2 0
      tests/README.md
  19. 96 0
      tests/cocotb/prod2u_p4_fast_jog_top.v
  20. 58 0
      tests/cocotb/run_prod2u_p4_fast_jog_top.py
  21. 241 0
      tests/cocotb/test_prod2u_p4_fast_jog_top.py
  22. 1 0
      tests/formal/README.md
  23. 39 8
      tests/formal/prod2u_p4_axis_safety_formal.v
  24. 9 20
      tests/formal/prod2u_p4_core_disable_motor_safety_formal.v
  25. 7 9
      tests/formal/prod2u_p4_core_watchdog_race_formal.v
  26. 48 0
      tests/formal/prod2u_p4_fast_jog_path.sby
  27. 627 0
      tests/formal/prod2u_p4_fast_jog_path_formal.v
  28. 12 19
      tests/formal/prod2u_p4_normal_v3_rx_formal.v
  29. 30 9
      tests/formal/prod2u_p4_normal_v3_rx_payload_formal.v
  30. 17 13
      tests/sim/prod2u_p4_completion_ack_contract_tb.v
  31. 15 7
      tests/sim/prod2u_p4_core_watchdog_refresh_tb.v
  32. 365 0
      tests/sim/prod2u_p4_fast_jog_core_tb.v
  33. 24 7
      tests/sim/prod2u_p4_minimal_snapshot_contract_tb.v
  34. 327 0
      tests/sim/prod2u_p4_normal_v3_rx_fast_jog_tb.v
  35. 44 9
      tests/sim/prod2u_p4_normal_v3_rx_tb.v
  36. 382 0
      tests/unit/test_prod2u_p4_fast_jog_contract.py
  37. 61 0
      tests/unit/test_prod2u_p4_fast_jog_rx_contract.py
  38. 291 5
      tests/unit/test_prod2u_p4_harness.py
  39. 198 18
      tests/unit/test_prod2u_p4_minimal_delivery_contract.py
  40. 242 133
      tests/unit/test_prod2u_p4_motion_source_mutations.py
  41. 6 4
      tests/unit/test_prod2u_p4_normal_v3_model.py
  42. 4 1
      tests/unit/test_prod2u_p4_normal_v3_td_files.py
  43. 64 17
      tests/unit/test_prod2u_p4_td_cdc_structure.py
  44. 38 0
      tools/package_prod2u_p4_normal_v3.ps1
  45. 51 0
      tools/package_templates/selftest.ps1
  46. 172 11
      tools/prod2u_p4_harness.py
  47. 24 2
      tools/prod2u_p4_normal_v3_model.py

+ 5 - 1
AGENTS.md

@@ -16,9 +16,11 @@
 - binary921-v3 输入 envelope、Profile ID 4、50 字节输出 snapshot 和 10 字节 MOTION_STATUS 保持兼容。
 - X/Y 固定 `DIR=0` 打开、`DIR=1` 关闭,使用独立执行器并允许同时运动。
 - 只有 `0x35 JOG` 驱动电机。Snapshot 的 X/Y/Z 字节保持线格式兼容、允许任意 `u8`,但完全忽略且无电机作用;旧标准 OPEN/CLOSE CLI 仅发送这些无作用字段。
-- 合法 X/Y JOG 永不返回 BUSY;超过 800 步的请求仍会完整执行,完整范围为 `1..65535`。`speed_code=0..3` 的 speed 字段仅校验,执行时忽略并统一固定 1000 step/s;非法 axis/方向/速度/零步仍返回 BAD_VALUE。
+- JOG 步数字段策略为 `RAW_U16_TRUSTED_HOST_NO_CPLD_CAP`:CPLD 不检查、钳位或修正原始 16 位 `steps`;上位机构造器负责只发送 `1..65535`。`speed_code=0..3` 仅校验,执行时忽略并统一固定 1000 step/s;非法 axis/方向/速度/保留字段在普通槽可用时返回 BAD_VALUE。
+- RX 快速路径策略为 `RX_FAST_JOG_BYPASSES_NORMAL_REQUEST_SLOT`:完整、CRC 正确且字段合法的 JOG 不进入普通请求槽,普通槽挂起、core 非 IDLE、旧响应或 TX 停顿都不能延迟运动启动;槽满时新的非快速完整帧静默丢弃。
 - JOG ACK 仅在首个实际 STEP 上升沿已经发出后返回。同轴新 JOG 立即将旧 STEP 拉低、丢弃旧剩余步数并重新等待完整 1 ms DIR setup;旧脉冲允许被截短。
 - JOG 忽略限位;同轴新 JOG 直接替换旧命令,不保留待处理队列。
+- 上位机规则为 `HOST_MUST_NOT_REPEAT_SAME_AXIS_BEFORE_COMPLETION`,完成由上位机计时;违规重发采用 `LATEST_COMMAND_WINS_OLD_ACK_NOT_GUARANTEED`。下位机完成事件为 `NONE_HOST_TRACKS_TIME`,只保留一个快速 ACK 记录。
 - `busy_mask`、`fault_mask` 和 `position_valid_mask` 是恒为 0 的只读遥测,current/target 恒为 `0xFF`,EN active 恒为 1。
 - LS1/LS2 不接入同步、滤波、状态机或任何运动判断。JOG 不 arm/refresh watchdog;DISABLE 和 watchdog 只把 PTC/FAN/solenoid 置安全值,不停止电机。电机只会因复位、断电或重新配置停止。
 - 合法 JOG 无需先发送 DISABLE;GET_STATUS 和 GET_MOTOR_STATUS 都不能复活、暂停或停止电机运动。
@@ -31,6 +33,8 @@
 
 - 离线 gate 覆盖源码完整性、协议、模型、RTL、formal、CDC、STA、TD、资源和包自检。
 - TD 结构要求所有 9K/32K/128K/256K BRAM 均为 0、`DSP=0`、`IO=41`、正 setup/hold、非空 bitstream、仅 UART 的 2 个 CDC 同步寄存器和 X/Y 两位顺序 `motion_phase`。
+- strict offline、两次 TD、打包自检和 final gate 必须显式绑定同一个 32 位小写十六进制 `verification_run_id`;包内验证 receipt 不得来自其他批次。
+- normal dual-TD 的两次构建必须使用不同仓外 work-root 和不同 TD `run_id`,但 synthesis manifest、synthesis input hash 和 bitstream SHA-256 必须完全相同。
 - 总 LUT/FF/slice 差值仅为 advisory,不得改变 bitgen 状态。
 - Windows 运行 Verilator 前使用 `tools/activate_verification_toolchain.ps1` 或仓库 resolver,不得修改全局 PATH。
 - blocked、fail、dry-run、fixture 或缺少证据均不等于 pass;离线通过不等于实板机械验收。只要 TD 已产生非空 bitstream,验证失败不得阻止临时镜像打包,但必须原样随包记录。

+ 31 - 1
README.zh-CN.md

@@ -9,6 +9,7 @@
 - Snapshot 的 X/Y/Z 字段允许任意 `u8`,但全部忽略且没有电机作用。
 - JOG 保持 `1..65535` 请求字段;超过 800 步的请求也会完整执行,两个方向都忽略限位。
 - 合法 X/Y JOG 永不返回 BUSY。ACK 在首个实际 STEP 上升沿已经发出后返回,但不表示整段运动完成。
+- CPLD 按 `RAW_U16_TRUSTED_HOST_NO_CPLD_CAP` 原样加载 16 位步数;RX 按 `RX_FAST_JOG_BYPASSES_NORMAL_REQUEST_SLOT` 让合法 JOG 绕过普通请求槽和响应阻塞。完成由上位机计时,同轴完成前不得重发。
 - 同轴新 JOG 立即拉低旧 STEP、丢弃旧剩余步数并重新等待 1 ms DIR setup;X/Y 互不阻塞。
 - `busy_mask`、`fault_mask` 和 `position_valid_mask` 恒为 0,current/target 恒为 `0xFF`。
 - DISABLE、watchdog 和 LS 都不会停止电机;异常时必须断电、复位或重新配置 CPLD。
@@ -19,8 +20,10 @@
 
 ```powershell
 Set-Location 'C:\Users\Administrator\CodexTemp\p4-normal-v1-no-gates-73df4ee'
+$verificationRunId = [Guid]::NewGuid().ToString('N').ToLowerInvariant()
 python tools\prod2u_p4_harness.py p4-normal-v3-strict-offline-gate `
   --work-root C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-offline `
+  --verification-run-id $verificationRunId `
   --json `
   --report-file C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-offline\receipt.json
 ```
@@ -32,8 +35,15 @@ python tools\prod2u_p4_harness.py p4-normal-v3-strict-offline-gate `
 ```powershell
 python tools\prod2u_p4_harness.py td-build --run --top prod2u_p4_normal_v3 `
   --work-root C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-td-a `
+  --verification-run-id $verificationRunId `
   --json `
   --report-file C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-td-a\receipt.json
+
+python tools\prod2u_p4_harness.py td-build --run --top prod2u_p4_normal_v3 `
+  --work-root C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-td-b `
+  --verification-run-id $verificationRunId `
+  --json `
+  --report-file C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-td-b\receipt.json
 ```
 
 TD 记录 `BRAM`、`DSP`、`IO`、setup/hold 和全部失败。只要路由数据库可用就继续尝试 bitgen;验证失败不伪装成通过,也不阻止非空 bitstream 的临时包交付。
@@ -46,10 +56,30 @@ powershell.exe -NoProfile -ExecutionPolicy Bypass `
   -OutputDir C:\Users\Administrator\CodexTemp\p4-normal-images `
   -NormalBitstream '<td-bitgen-path>\prod2u_p4_normal_v3.bit' `
   -TdReceipt '<td-a-path>\receipt.json' `
+  -VerificationRunId $verificationRunId `
   -ConfirmationTdReceipt '<td-b-path>\receipt.json' `
-  -ValidationReceipt '<offline-or-layer-receipt>.json'
+  -ValidationReceipt '<strict-offline-path>\receipt.json'
+
+$commit = (git rev-parse HEAD).Trim().ToLowerInvariant()
+$bitstreamSha256 = (Get-FileHash -Algorithm SHA256 '<td-bitgen-path>\prod2u_p4_normal_v3.bit').Hash.ToLowerInvariant()
+$packageDir = "C:\Users\Administrator\CodexTemp\p4-normal-images\$commit\prod2u-p4-normal-$commit-$($bitstreamSha256.Substring(0, 16))"
+
+python tools\prod2u_p4_harness.py package-selftest `
+  --package-dir $packageDir `
+  --verification-run-id $verificationRunId `
+  --report-file C:\Users\Administrator\CodexTemp\p4-normal-v3-package-selftest-receipt.json
+
+python tools\prod2u_p4_harness.py p4-normal-v3-final-gate `
+  --offline-receipt C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-offline\receipt.json `
+  --td-receipt C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-td-a\receipt.json `
+  --confirmation-td-receipt C:\Users\Administrator\CodexTemp\p4-normal-v3-minimal-td-b\receipt.json `
+  --package-receipt C:\Users\Administrator\CodexTemp\p4-normal-v3-package-selftest-receipt.json `
+  --verification-run-id $verificationRunId `
+  --report-file C:\Users\Administrator\CodexTemp\p4-normal-v3-final-gate-v3-receipt.json
 ```
 
 输出固定为 `C:\Users\Administrator\CodexTemp\p4-normal-images\<40位commit>\prod2u-p4-normal-<40位commit>-<bitstream-sha256前16位>`。包内包含两份 TD receipt/报告、验证矩阵、包自检结果、SRAM 脚本、初始化 DISABLE、通用 HEX 发送方法以及兼容 Snapshot 和 JOG 的冻结 HEX。
 
+strict offline、两次 TD、打包自检和 final gate 必须显式使用同一个 32 位小写十六进制 `verification_run_id`。最终 normal dual-TD 交付只接受两份独立 TD receipt 的 bitstream SHA-256 完全相同;run ID、位流或包内验证 receipt 任一不一致都会 fail closed。
+
 仓库构建和打包不会连接串口或 JTAG,也不会执行 SRAM/Flash 操作。详细风险与实板步骤见 [运行手册](docs/prod2u-p4-normal-v3-runbook.zh-CN.md)。

+ 5 - 0
config/prod2u_p4_normal_host_contract_v4.json

@@ -91,6 +91,8 @@
       "direction": {"OPEN_UP": 0, "CLOSE_DOWN": 1},
       "speed_codes": [0, 1, 2, 3],
       "step_range": [1, 65535],
+      "step_field_policy": "RAW_U16_TRUSTED_HOST_NO_CPLD_CAP",
+      "fast_path_policy": "RX_FAST_JOG_BYPASSES_NORMAL_REQUEST_SLOT",
       "executed_step_cap": null,
       "over_cap_status": "NOT_APPLICABLE",
       "over_cap_behavior": "EXECUTE_REQUESTED_U16_STEPS",
@@ -99,6 +101,8 @@
       "ack_semantics": "FIRST_STEP_EMITTED",
       "arms_watchdog": false,
       "same_axis_active_policy": "IMMEDIATE_RELOAD_AND_RESTART_DIR_SETUP",
+      "same_axis_host_rule": "HOST_MUST_NOT_REPEAT_SAME_AXIS_BEFORE_COMPLETION",
+      "same_axis_violation_policy": "LATEST_COMMAND_WINS_OLD_ACK_NOT_GUARANTEED",
       "multiple_pending_policy": "NONE",
       "replacement_dir_setup_us": 1000,
       "limit_policy": "IGNORE_ALL_INPUTS",
@@ -111,6 +115,7 @@
       ],
       "watchdog_timeout_recovery": "NOT_APPLICABLE_TIMEOUT_HAS_NO_MOTOR_EFFECT",
       "peer_axis_busy_does_not_block": true,
+      "completion_event": "NONE_HOST_TRACKS_TIME",
       "response": "HOST_ACK"
     },
     "mark_closed": {

+ 5 - 0
config/prod2u_p4_normal_v3_hw_binding.json

@@ -29,6 +29,8 @@
     "motor_driving_commands": ["0x35"],
     "legacy_snapshot_xyz_motor_effect": "none",
     "jog_requested_step_range": [1, 65535],
+    "jog_step_field_policy": "RAW_U16_TRUSTED_HOST_NO_CPLD_CAP",
+    "jog_fast_path_policy": "RX_FAST_JOG_BYPASSES_NORMAL_REQUEST_SLOT",
     "jog_executed_step_cap": null,
     "jog_limit_policy": "retained_pins_no_consumer",
     "jog_speed_field_policy": "validate_then_ignore",
@@ -36,6 +38,9 @@
     "ack_semantics": "FIRST_STEP_EMITTED",
     "jog_arms_watchdog": false,
     "active_axis_jog_policy": "immediate_reload",
+    "same_axis_host_rule": "HOST_MUST_NOT_REPEAT_SAME_AXIS_BEFORE_COMPLETION",
+    "same_axis_violation_policy": "LATEST_COMMAND_WINS_OLD_ACK_NOT_GUARANTEED",
+    "completion_event": "NONE_HOST_TRACKS_TIME",
     "replacement_boundary": "same_clock_step_low_then_full_1ms_dir_setup",
     "old_pulse_may_truncate": true,
     "reported_busy_policy": "constant_zero",

+ 2 - 2
config/prod2u_p4_normal_v3_resource_baseline.json

@@ -19,8 +19,8 @@
   "measurement": {
     "required_clean_builds": 2,
     "aggregation": "min_max_envelope",
-    "reason": "remeasure_after_force_motion_800_step_v1",
-    "candidate_contract": "force_motion_800_step_v1",
+    "reason": "remeasure_after_trusted_fast_jog",
+    "candidate_contract": "RAW_U16_TRUSTED_HOST_NO_CPLD_CAP",
     "advisory_estimate": {
       "lut": [2350, 2900],
       "ff": [1280, 1480],

+ 9 - 0
config/prod2u_p4_verification_targets_v1.json

@@ -8,6 +8,8 @@
       "tests.unit.test_prod2u_p4_ack_only_host_contract",
       "tests.unit.test_prod2u_p4_activate_verification_toolchain",
       "tests.unit.test_prod2u_p4_cli_v3",
+      "tests.unit.test_prod2u_p4_fast_jog_contract",
+      "tests.unit.test_prod2u_p4_fast_jog_rx_contract",
       "tests.unit.test_prod2u_p4_harness",
       "tests.unit.test_prod2u_p4_minimal_delivery_contract",
       "tests.unit.test_prod2u_p4_minimal_snapshot_contract_rtl",
@@ -28,11 +30,13 @@
       "prod2u_p4_cdc_sync_depth_tb",
       "prod2u_p4_completion_ack_contract_tb",
       "prod2u_p4_core_watchdog_refresh_tb",
+      "prod2u_p4_fast_jog_core_tb",
       "prod2u_p4_jog_no_gates_contract_tb",
       "prod2u_p4_minimal_snapshot_contract_tb",
       "prod2u_p4_motor_hub_axis_isolation_tb",
       "prod2u_p4_motor_status_payload_tb",
       "prod2u_p4_normal_v3_output_state_tb",
+      "prod2u_p4_normal_v3_rx_fast_jog_tb",
       "prod2u_p4_normal_v3_rx_tb",
       "prod2u_p4_normal_v3_top_tb",
       "prod2u_p4_normal_v3_tx_tb",
@@ -49,6 +53,7 @@
       "prod2u_p4_normal_v3_top_lint"
     ],
     "cocotb": [
+      "prod2u_p4_fast_jog_top",
       "prod2u_p4_normal_v3_ack_only_top_e2e"
     ],
     "formal": [
@@ -76,6 +81,10 @@
         "name": "prod2u_p4_core_watchdog_race",
         "tasks": ["bmc", "cover"]
       },
+      {
+        "name": "prod2u_p4_fast_jog_path",
+        "tasks": ["prove_path", "cover_path", "bmc_rx_path", "cover_rx_path", "prove_production_timing"]
+      },
       {
         "name": "prod2u_p4_jog_no_gates",
         "tasks": ["bmc_core", "cover_core", "bmc_hub", "cover_hub"]

+ 7 - 4
docs/prod2u-p4-normal-v3-runbook.zh-CN.md

@@ -6,12 +6,13 @@
 - X/Y 是独立执行器,可以同时运动;`DIR=0` 为打开,`DIR=1` 为关闭。
 - X/Y 的 STEP 和 DIR 独立,板上共享 `motor_en_n` 恒为低电平使能;MOTION_STATUS 的 EN active 恒为 1。
 - 只有 `0x35 JOG` 能驱动电机。Snapshot 中原有 X/Y/Z 字节和旧 OPEN/CLOSE CLI 线格式仍保留,但任意 `0..255` 值都被忽略,不产生 STEP。
-- JOG 步数保持 16 位,合法范围 `1..65535`;超过 800 步的请求也会完整执行,不再截断。
+- JOG 步数策略为 `RAW_U16_TRUSTED_HOST_NO_CPLD_CAP`:字段保持原始 16 位,CPLD 不检查、钳位或修正;上位机构造器必须保证 `steps=1..65535`。超过 800 步的请求也会完整执行,不再截断。
 - `speed_code=0..3` 的 speed 字段仍会校验,但执行时忽略该值,四个值的实际速度都固定为 1000 step/s。
-- 合法 X/Y JOG 永不返回 BUSY,也不受 snapshot、LS、watchdog timeout 或 DISABLE 状态阻止。ACK 在该命令首个实际 STEP 上升沿已经发出后才返回,不表示整段运动完成。
+- 快速路径策略为 `RX_FAST_JOG_BYPASSES_NORMAL_REQUEST_SLOT`。合法 X/Y JOG 永不返回 BUSY,也不受普通请求槽、core 状态、旧响应、TX 停顿、snapshot、LS、watchdog timeout 或 DISABLE 阻止。ACK 在该命令首个实际 STEP 上升沿已经发出后才返回,不表示整段运动完成。
 - 两个方向 JOG 都忽略限位。LS1/X=B9、LS2/Y=A11 只保留物理引脚,没有同步、滤波或 RTL 消费者。
 - LS1/X 使用 B9,LS2/Y 使用 A11;`0V=未触发`,`3.3V=关闭端触发`。A5 不使用。
 - 同轴新 JOG 会立即把旧 STEP 拉低并丢弃旧剩余步数,然后重新等待完整 1 ms DIR setup;旧 STEP 高脉冲允许被截短。X/Y 可独立重载并重叠运行。
+- 上位机必须遵守 `HOST_MUST_NOT_REPEAT_SAME_AXIS_BEFORE_COMPLETION`,并自行根据步数和固定 1 kHz 波形判断每轴完成。违规重发采用 `LATEST_COMMAND_WINS_OLD_ACK_NOT_GUARANTEED`;下位机没有完成事件(`NONE_HOST_TRACKS_TIME`),只保留一个快速 ACK 记录。
 - `busy_mask`、`fault_mask`、`position_valid_mask` 是恒为 0 的只读遥测,current/target 恒为 `0xFF`;这些字段不再表示运动进度或位置。
 - Snapshot 的合法 PTC/FAN/solenoid 总是提交并返回 OK,result_flags 只有 bit0 为 1;X/Y/Z 对应的轴位全部为 0。
 - watchdog 仍保护非电机输出,但 JOG 不 arm 或 refresh watchdog。watchdog 到期和 DISABLE 都不会停止、暂停或改变电机;只能通过复位、断电或重新配置停止。
@@ -22,6 +23,8 @@
 
 ## 离线检查
 
+从 clean commit 开始先生成一个 32 位小写十六进制 `verification_run_id`,并把同一个值传给 strict offline、两次独立 TD、打包器、package selftest 和 final gate。不得混用同一 commit 的不同批次 receipt。两份 TD 必须来自不同仓外 work-root 和不同 TD `run_id`,但 synthesis manifest、synthesis input hash 与 bitstream SHA-256 必须完全相同;任一不一致都不是可交付的 normal dual-TD 包。
+
 在包目录执行:
 
 ```powershell
@@ -84,9 +87,9 @@ powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\SEND_HEX.ps1 -Port COM
 | 旧 `0x29` 请求,固定返回 UNSUPPORTED | `A55A020405000000000000000004290000002A7A` |
 | 旧 MARK_CLOSED X/DIR0,固定返回 UNSUPPORTED | `A55A0204110000000000000000083600000000000000E738` |
 
-JOG payload 为 `35 axis dir speed steps_le16 0000`。`axis=0/1` 分别为 X/Y,`dir=0/1` 分别为打开/关闭;speed `0/1/2/3` 都执行 1 ms 完整步周期。表中 65535 步会实际执行 65535 步。修改字段后必须重新计算 CRC,不能只替换表格 HEX 中的字节。
+JOG payload 为 `35 axis dir speed steps_le16 0000`。`axis=0/1` 分别为 X/Y,`dir=0/1` 分别为打开/关闭;speed `0/1/2/3` 都执行 1 ms 完整步周期。表中 65535 步会实际执行 65535 步。ACK 超时只覆盖首 STEP 启动,不按总步数推导完成时间;修改字段后必须重新计算 CRC,不能只替换表格 HEX 中的字节。
 
-请求帧和 HEX 不变。`axis` 非 X/Y、非法方向或速度、`steps=0` 等线格式或字段错误仍返回 BAD_VALUE;合法 JOG 不会返回 BUSY。
+请求帧和 HEX 不变。`axis` 非 X/Y、非法方向或速度、保留字段非零等错误在普通请求槽可用时返回 BAD_VALUE;`steps=0` 是上位机合同违规,CPLD 不为其定义运动或响应语义。合法 JOG 不会返回 BUSY。
 
 ### X ACK 后启动 Y
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 6 - 1
schemas/prod2u_p4_normal_host_contract_v4.schema.json


+ 1 - 1
schemas/prod2u_p4_normal_v3_final_gate_receipt.schema.json

@@ -12,7 +12,7 @@
     "schema": {"const": "prod2u-p4-normal-v3-final-gate-v3"},
     "status": {"enum": ["pass", "fail"]},
     "generated_at": {"type": "string", "minLength": 1},
-    "verification_run_id": {"type": ["string", "null"], "pattern": "^[0-9a-f]{32}$"},
+    "verification_run_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
     "commit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
     "source_state": {"type": "object"},
     "child_receipts": {

+ 6 - 2
schemas/prod2u_p4_normal_v3_package_selftest_receipt.schema.json

@@ -5,7 +5,8 @@
   "additionalProperties": false,
   "required": [
     "schema", "status", "generated_at", "verification_run_id", "commit",
-    "bitstream_sha256", "package_dir", "package_info_sha256", "td_receipt_sha256",
+    "bitstream_sha256", "package_dir", "delivery_mode", "verification_complete",
+    "confirmation_td_present", "package_info_sha256", "td_receipt_sha256",
     "confirmation_td_receipt_sha256", "validation_summary_sha256",
     "package_selftest_result_sha256", "td_run_id", "confirmation_td_run_id",
     "synthesis_input_hash", "confirmation_synthesis_input_hash",
@@ -21,6 +22,9 @@
     "commit": {"type": ["string", "null"], "pattern": "^[0-9a-f]{40}$"},
     "bitstream_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
     "package_dir": {"type": "string", "minLength": 1},
+    "delivery_mode": {"enum": ["normal_dual_td", "urgent_single_td", null]},
+    "verification_complete": {"type": ["boolean", "null"]},
+    "confirmation_td_present": {"type": ["boolean", "null"]},
     "package_info_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
     "td_receipt_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
     "confirmation_td_receipt_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
@@ -31,7 +35,7 @@
     "synthesis_input_hash": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
     "confirmation_synthesis_input_hash": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
     "confirmation_bitstream_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
-    "validation_status": {"enum": ["pass", "fail"]},
+    "validation_status": {"enum": ["pass", "fail", "running", "not_run"]},
     "packaged_selftest_status": {"enum": ["pass", "fail", "not_run", null]},
     "package_file_sha256": {"type": "object", "additionalProperties": {"type": "string", "pattern": "^[0-9a-f]{64}$"}},
     "package_file_manifest_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},

+ 7 - 5
schemas/prod2u_p4_normal_v3_td_build_receipt.schema.json

@@ -18,6 +18,8 @@
     "profile": {"const": "prod2u_p4_normal_v3"},
     "runtime_profile": {"const": "prod2u-p4-normal-actuator-binary921-v3"},
     "verification_run_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
+    "run_id": {"type": "string", "pattern": "^[0-9a-f]{32}$"},
+    "work_root": {"type": "string", "pattern": "^[A-Za-z]:[\\\\/]"},
     "commit": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
     "bitstream_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
     "synthesis_input_hash": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
@@ -45,7 +47,7 @@
       "if": {"properties": {"status": {"const": "pass"}}, "required": ["status"]},
       "then": {
         "required": [
-          "commit", "bitstream_sha256", "synthesis_input_hash", "resources", "timing",
+          "run_id", "work_root", "commit", "bitstream_sha256", "synthesis_input_hash", "resources", "timing",
           "structural_gate", "timing_gate", "source_binding_gate", "pin_binding_gate", "post_route_pin_gate",
           "binding_gate", "syn", "phy", "bitgen", "bitstream", "error_summary",
           "resource_gate", "resource_delta"
@@ -104,10 +106,10 @@
           "required": ["status", "async_reg", "input_registers", "retained_sync_registers", "first_stage_endpoints", "failures"],
           "properties": {
             "status": {"enum": ["pass", "fail"]},
-            "async_reg": {"properties": {"used": {"const": 8}}},
+            "async_reg": {"properties": {"used": {"const": 2}}},
             "input_registers": {"properties": {"used": {"const": 0}}},
-            "retained_sync_registers": {"properties": {"used": {"const": 8}}},
-            "first_stage_endpoints": {"properties": {"used": {"const": 3}}},
+            "retained_sync_registers": {"properties": {"used": {"const": 2}}},
+            "first_stage_endpoints": {"properties": {"used": {"const": 1}}},
             "failures": {"type": "array", "items": {"type": "string"}}
           }
         },
@@ -117,7 +119,7 @@
           "properties": {
             "status": {"enum": ["pass", "fail"]},
             "encoding": {"type": ["string", "null"]},
-            "axes": {"const": {"x": 3, "y": 3}},
+            "axes": {"const": {"x": 2, "y": 2}},
             "td_log_marker": {"type": "boolean"},
             "reencoded_motion_phase_count": {"type": "integer", "minimum": 0},
             "failures": {"type": "array", "items": {"type": "string"}}

+ 13 - 8
src/rtl/prod2u_p4_axis_executor.v

@@ -12,6 +12,11 @@ module prod2u_p4_axis_executor #(
     output wire        step_out,
     output wire        dir_out,
     output reg         started_pulse
+`ifdef FORMAL
+    , output wire [1:0]  formal_motion_phase
+    , output wire [31:0] formal_phase_counter
+    , output wire [15:0] formal_remaining_steps
+`endif
 );
     localparam [1:0] PHASE_IDLE = 2'd0;
     localparam [1:0] PHASE_DIR_SETUP = 2'd1;
@@ -38,6 +43,11 @@ module prod2u_p4_axis_executor #(
 
     assign step_out = (motion_phase == PHASE_STEP_HIGH);
     assign dir_out = dir_reg;
+`ifdef FORMAL
+    assign formal_motion_phase = motion_phase;
+    assign formal_phase_counter = {{(32-PHASE_COUNTER_BITS){1'b0}}, phase_counter};
+    assign formal_remaining_steps = remaining_steps;
+`endif
 
     generate
         if ((DIR_SETUP_CYCLES < 1) || (STEP_HALF_CYCLES < 1)) begin : g_invalid_motion_period
@@ -61,13 +71,8 @@ module prod2u_p4_axis_executor #(
             if (command_start) begin
                 dir_reg <= command_dir;
                 remaining_steps <= command_steps;
-                if (command_steps == 16'd0) begin
-                    motion_phase <= PHASE_IDLE;
-                    phase_counter <= {PHASE_COUNTER_BITS{1'b0}};
-                end else begin
-                    motion_phase <= PHASE_DIR_SETUP;
-                    phase_counter <= DIR_SETUP_LAST;
-                end
+                motion_phase <= PHASE_DIR_SETUP;
+                phase_counter <= DIR_SETUP_LAST;
             end else begin
                 case (motion_phase)
                     PHASE_IDLE: begin
@@ -97,7 +102,7 @@ module prod2u_p4_axis_executor #(
                     PHASE_STEP_LOW: begin
                         if (phase_counter != {PHASE_COUNTER_BITS{1'b0}}) begin
                             phase_counter <= phase_counter - 1'b1;
-                        end else if (remaining_steps <= 16'd1) begin
+                        end else if (remaining_steps == 16'd1) begin
                             motion_phase <= PHASE_IDLE;
                             remaining_steps <= 16'd0;
                             phase_counter <= {PHASE_COUNTER_BITS{1'b0}};

+ 54 - 46
src/rtl/prod2u_p4_normal_v3_core.v

@@ -14,6 +14,10 @@ module prod2u_p4_normal_v3_core #(
     input  wire [5:0]   request_length,
     input  wire [271:0] request_payload,
     input  wire [15:0]  request_crc16,
+    input  wire         fast_jog_valid,
+    input  wire [1:0]   fast_jog_axis,
+    input  wire         fast_jog_dir,
+    input  wire [15:0]  fast_jog_steps,
     output wire         frame_valid,
     input  wire         frame_ready,
     output wire [7:0]   frame_type,
@@ -28,6 +32,9 @@ module prod2u_p4_normal_v3_core #(
     output wire         en_n,
     output wire         disabled,
     output wire         watchdog_timeout
+`ifdef FORMAL
+    , output wire [2:0] formal_state
+`endif
 );
     localparam [7:0] FT_HOST_CMD = 8'h05;
     localparam [7:0] FT_HOST_BATCH_CMD = 8'h07;
@@ -50,21 +57,19 @@ module prod2u_p4_normal_v3_core #(
     localparam [2:0] ST_IDLE = 3'd0;
     localparam [2:0] ST_SNAPSHOT_VALIDATE = 3'd1;
     localparam [2:0] ST_SNAPSHOT_COMMIT = 3'd2;
-    localparam [2:0] ST_JOG_WAIT_START = 3'd3;
-    localparam [2:0] ST_DISABLE_WAIT = 3'd4;
+    localparam [2:0] ST_DISABLE_WAIT = 3'd3;
 
     reg [2:0] state;
+`ifdef FORMAL
+    assign formal_state = state;
+`endif
     wire command_accept = request_valid && request_ready;
     wire [7:0] request_command = request_payload[7:0];
     wire [7:0] request_channel = request_payload[15:8];
     wire [7:0] request_value = request_payload[23:16];
     wire [7:0] request_flags = request_payload[31:24];
-    wire [15:0] request_steps = request_payload[47:32];
     wire host_zeros_valid = (request_channel == 8'd0) &&
         (request_value == 8'd0) && (request_flags == 8'd0);
-    wire jog_payload_valid = (request_channel <= 8'd1) &&
-        (request_value <= 8'd1) && (request_flags <= 8'd3) &&
-        (request_steps != 16'd0) && (request_payload[63:48] == 16'd0);
     wire motor_status_payload_valid = (request_payload[63:8] == 56'd0);
 
     reg snapshot_scan_start;
@@ -75,12 +80,18 @@ module prod2u_p4_normal_v3_core #(
     wire snapshot_output_accepted;
     wire snapshot_commit_pulse;
 
-    reg motor_jog_start;
-    reg [1:0] motor_jog_axis;
-    reg motor_jog_dir;
-    reg [15:0] motor_jog_steps;
-    reg [1:0] jog_wait_axis;
     wire [1:0] motor_axis_started_pulse;
+    reg fast_jog_ack_pending;
+    reg fast_jog_ack_ready;
+    reg [1:0] fast_jog_ack_axis;
+    reg [63:0] fast_jog_ack_payload;
+    wire fast_jog_started =
+        ((fast_jog_ack_axis == 2'd0) && motor_axis_started_pulse[0]) ||
+        ((fast_jog_ack_axis == 2'd1) && motor_axis_started_pulse[1]);
+    wire [63:0] fast_jog_ok_payload = {
+        8'd0, 8'd0, state_hash16[15:8], state_hash16[7:0],
+        8'd0, STATUS_OK, MOTION_JOG, 8'h01
+    };
 
     reg watchdog_disable;
     reg watchdog_snapshot_arm;
@@ -111,6 +122,7 @@ module prod2u_p4_normal_v3_core #(
     wire [143:0] response_payload;
 
     assign request_ready = (state == ST_IDLE) && !command_inflight &&
+        !fast_jog_ack_pending && !fast_jog_ack_ready &&
         (!request_valid || (request_type != FT_HOST_BATCH_CMD) ||
          (request_length != 6'd34) || snapshot_ready);
     assign frame_valid = response_frame_valid;
@@ -186,10 +198,10 @@ module prod2u_p4_normal_v3_core #(
     ) u_motors (
         .clk(clk),
         .rst_n(rst_n),
-        .jog_start(motor_jog_start),
-        .jog_axis(motor_jog_axis),
-        .jog_dir(motor_jog_dir),
-        .jog_steps(motor_jog_steps),
+        .jog_start(fast_jog_valid),
+        .jog_axis(fast_jog_axis),
+        .jog_dir(fast_jog_dir),
+        .jog_steps(fast_jog_steps),
         .axis_started_pulse(motor_axis_started_pulse),
         .step_out(step_out),
         .dir_out(dir_out)
@@ -217,11 +229,10 @@ module prod2u_p4_normal_v3_core #(
             snapshot_scan_start <= 1'b0;
             snapshot_commit_authorize <= 1'b0;
             snapshot_payload_latched <= 272'd0;
-            motor_jog_start <= 1'b0;
-            motor_jog_axis <= 2'd0;
-            motor_jog_dir <= 1'b0;
-            motor_jog_steps <= 16'd0;
-            jog_wait_axis <= 2'd0;
+            fast_jog_ack_pending <= 1'b0;
+            fast_jog_ack_ready <= 1'b0;
+            fast_jog_ack_axis <= 2'd0;
+            fast_jog_ack_payload <= 64'd0;
             watchdog_disable <= 1'b0;
             watchdog_snapshot_arm <= 1'b0;
             command_inflight <= 1'b0;
@@ -233,10 +244,19 @@ module prod2u_p4_normal_v3_core #(
         end else begin
             snapshot_scan_start <= 1'b0;
             snapshot_commit_authorize <= 1'b0;
-            motor_jog_start <= 1'b0;
             watchdog_disable <= 1'b0;
             watchdog_snapshot_arm <= 1'b0;
 
+            if (fast_jog_valid) begin
+                fast_jog_ack_pending <= 1'b1;
+                fast_jog_ack_ready <= 1'b0;
+                fast_jog_ack_axis <= fast_jog_axis;
+            end else if (fast_jog_ack_pending && fast_jog_started) begin
+                fast_jog_ack_pending <= 1'b0;
+                fast_jog_ack_ready <= 1'b1;
+                fast_jog_ack_payload <= fast_jog_ok_payload;
+            end
+
             if (response_command_done) begin
                 command_inflight <= 1'b0;
                 command_response_valid <= 1'b0;
@@ -245,7 +265,16 @@ module prod2u_p4_normal_v3_core #(
 
             case (state)
                 ST_IDLE: begin
-                    if (command_accept) begin
+                    if (!response_command_done && !fast_jog_valid &&
+                        !command_inflight && fast_jog_ack_ready) begin
+                        command_inflight <= 1'b1;
+                        command_ack_payload <= fast_jog_ack_payload;
+                        command_followup_valid <= 1'b0;
+                        command_followup_frame_type <= 8'd0;
+                        command_followup_payload <= 80'd0;
+                        command_response_valid <= 1'b1;
+                        fast_jog_ack_ready <= 1'b0;
+                    end else if (command_accept) begin
                         command_inflight <= 1'b1;
                         command_response_valid <= 1'b0;
                         command_followup_valid <= 1'b0;
@@ -291,18 +320,9 @@ module prod2u_p4_normal_v3_core #(
                                     STATUS_BAD_LENGTH, 8'd0, state_hash16,
                                     8'd0, 8'd0, 1'b0, 80'd0);
                             end else if (request_command == MOTION_JOG) begin
-                                if (!jog_payload_valid) begin
-                                    queue_response(1'b0, MOTION_JOG,
-                                        STATUS_BAD_VALUE, 8'd0, state_hash16,
-                                        8'd0, 8'd0, 1'b0, 80'd0);
-                                end else begin
-                                    motor_jog_axis <= request_channel[1:0];
-                                    motor_jog_dir <= request_value[0];
-                                    motor_jog_steps <= request_steps;
-                                    jog_wait_axis <= request_channel[1:0];
-                                    motor_jog_start <= 1'b1;
-                                    state <= ST_JOG_WAIT_START;
-                                end
+                                queue_response(1'b0, MOTION_JOG,
+                                    STATUS_BAD_VALUE, 8'd0, state_hash16,
+                                    8'd0, 8'd0, 1'b0, 80'd0);
                             end else if (request_command == MOTION_MARK_CLOSED) begin
                                 queue_response(1'b0, MOTION_MARK_CLOSED,
                                     STATUS_UNSUPPORTED, 8'd0, state_hash16,
@@ -355,18 +375,6 @@ module prod2u_p4_normal_v3_core #(
                     end
                 end
 
-                ST_JOG_WAIT_START: begin
-                    if ((jog_wait_axis == 2'd0 &&
-                         motor_axis_started_pulse[0]) ||
-                        (jog_wait_axis == 2'd1 &&
-                         motor_axis_started_pulse[1])) begin
-                        queue_response(1'b1, MOTION_JOG, STATUS_OK,
-                            8'd0, state_hash16, 8'd0, 8'd0,
-                            1'b0, 80'd0);
-                        state <= ST_IDLE;
-                    end
-                end
-
                 ST_DISABLE_WAIT: begin
                     if (disabled && (ptc_percent == 192'd0) &&
                         (fan_percent == {4{8'd30}}) &&

+ 42 - 6
src/rtl/prod2u_p4_normal_v3_rx.v

@@ -15,6 +15,10 @@ module prod2u_p4_normal_v3_rx #(
     output wire [5:0]   request_length,
     output wire [271:0] request_payload,
     output reg  [15:0]  request_crc16,
+    output reg          fast_jog_valid,
+    output reg  [1:0]   fast_jog_axis,
+    output reg          fast_jog_dir,
+    output reg  [15:0]  fast_jog_steps,
     output reg  [15:0]  crc_error_count,
     output reg  [15:0]  timeout_count,
     output reg  [15:0]  format_error_count
@@ -26,6 +30,7 @@ module prod2u_p4_normal_v3_rx #(
     localparam [7:0] HOST_CMD = 8'h05;
     localparam [7:0] HOST_BATCH_CMD = 8'h07;
     localparam [7:0] MOTION_CMD = 8'h11;
+    localparam [7:0] MOTION_JOG = 8'h35;
 
     localparam [2:0] ST_MAGIC0 = 3'd0;
     localparam [2:0] ST_MAGIC1 = 3'd1;
@@ -55,11 +60,23 @@ module prod2u_p4_normal_v3_rx #(
     reg [7:0] candidate_type;
     reg [5:0] candidate_length;
     reg [271:0] candidate_payload;
+    reg [7:0] request_type_reg;
+    reg [5:0] request_length_reg;
+    reg [271:0] request_payload_reg;
 
-    assign rx_ready = rst_n && !request_valid;
-    assign request_type = candidate_type;
-    assign request_length = candidate_length;
-    assign request_payload = candidate_payload;
+    wire candidate_is_fast_jog =
+        (candidate_type == MOTION_CMD) &&
+        (candidate_length == 6'd8) &&
+        (candidate_payload[7:0] == MOTION_JOG) &&
+        (candidate_payload[15:8] <= 8'd1) &&
+        (candidate_payload[23:16] <= 8'd1) &&
+        (candidate_payload[31:24] <= 8'd3) &&
+        (candidate_payload[63:48] == 16'd0);
+
+    assign rx_ready = rst_n;
+    assign request_type = request_type_reg;
+    assign request_length = request_length_reg;
+    assign request_payload = request_payload_reg;
 
     binary921_crc16 u_crc (
         .crc_in(crc),
@@ -114,12 +131,21 @@ module prod2u_p4_normal_v3_rx #(
             candidate_type <= 8'd0;
             candidate_length <= 6'd0;
             candidate_payload <= 272'd0;
+            request_type_reg <= 8'd0;
+            request_length_reg <= 6'd0;
+            request_payload_reg <= 272'd0;
             request_valid <= 1'b0;
             request_crc16 <= 16'd0;
+            fast_jog_valid <= 1'b0;
+            fast_jog_axis <= 2'd0;
+            fast_jog_dir <= 1'b0;
+            fast_jog_steps <= 16'd0;
             crc_error_count <= 16'd0;
             timeout_count <= 16'd0;
             format_error_count <= 16'd0;
         end else begin
+            fast_jog_valid <= 1'b0;
+
             if (request_valid && request_ready) begin
                 request_valid <= 1'b0;
             end
@@ -192,8 +218,18 @@ module prod2u_p4_normal_v3_rx #(
                                 saturating_increment16(crc_error_count);
                             reset_parser_from_byte(rx_data);
                         end else begin
-                            request_crc16 <= crc;
-                            request_valid <= 1'b1;
+                            if (candidate_is_fast_jog) begin
+                                fast_jog_valid <= 1'b1;
+                                fast_jog_axis <= candidate_payload[9:8];
+                                fast_jog_dir <= candidate_payload[16];
+                                fast_jog_steps <= candidate_payload[47:32];
+                            end else if (!request_valid || request_ready) begin
+                                request_type_reg <= candidate_type;
+                                request_length_reg <= candidate_length;
+                                request_payload_reg <= candidate_payload;
+                                request_crc16 <= crc;
+                                request_valid <= 1'b1;
+                            end
                             state <= ST_MAGIC0;
                             body_index <= 6'd0;
                             crc <= 16'hffff;

+ 12 - 0
src/top/prod2u_p4_normal_v3_top.v

@@ -44,6 +44,10 @@ module prod2u_p4_normal_v3_top #(
     wire [5:0] request_length;
     wire [271:0] request_payload;
     wire [15:0] request_crc16;
+    wire fast_jog_valid;
+    wire [1:0] fast_jog_axis;
+    wire fast_jog_dir;
+    wire [15:0] fast_jog_steps;
     wire [15:0] parser_crc_error_count;
     wire [15:0] parser_timeout_count;
     wire [15:0] parser_format_error_count;
@@ -120,6 +124,10 @@ module prod2u_p4_normal_v3_top #(
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
         .crc_error_count(parser_crc_error_count),
         .timeout_count(parser_timeout_count),
         .format_error_count(parser_format_error_count)
@@ -139,6 +147,10 @@ module prod2u_p4_normal_v3_top #(
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
         .frame_valid(frame_valid),
         .frame_ready(frame_ready),
         .frame_type(frame_type),

+ 45 - 27
td/phy/prod2u_p4_normal_v3.tcl

@@ -4,24 +4,38 @@ import_db ../syn/prod2u_p4_normal_v3_gate.db
 read_adc {constraints/prod2u_p4_normal_v3.adc}
 read_sdc {constraints/prod2u_p4_normal_v3.sdc}
 
-set cdc_patterns {
-    */u_uart_rx/rx_sync_pipe[0]
-    */u_uart_rx/rx_sync_pipe[1]
+proc p4_find_unique_regs {patterns} {
+    set matches {}
+    foreach pattern $patterns {
+        foreach reg [get_regs -quiet $pattern] {
+            if {[lsearch -exact $matches $reg] < 0} {
+                lappend matches $reg
+            }
+        }
+    }
+    return $matches
+}
+
+set cdc_groups {
+    u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}
+    u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}
 }
 set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
 puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
 set cdc_failures {}
 set cdc_regs {}
-foreach pattern $cdc_patterns {
-    set matches [get_regs -quiet $pattern]
+array set cdc_actual_by_normalized {}
+foreach {normalized patterns} $cdc_groups {
+    set matches [p4_find_unique_regs $patterns]
     if {[llength $matches] != 1} {
-        set reason "retained_sync_register_count:$pattern:[llength $matches]"
+        set reason "retained_sync_register_count:$normalized:[llength $matches]"
         lappend cdc_failures $reason
         puts $cdc_report "structural_failure=$reason"
-    }
-    foreach reg $matches {
+    } else {
+        set reg [lindex $matches 0]
+        set cdc_actual_by_normalized($normalized) $reg
         lappend cdc_regs $reg
-        puts $cdc_report "retained_sync_register=$reg"
+        puts $cdc_report "retained_sync_register=$normalized"
     }
 }
 if {[llength $cdc_regs] != 2} {
@@ -31,9 +45,9 @@ if {[llength $cdc_regs] != 2} {
 }
 
 set cdc_input_pairs {
-    host_uart_rx */u_uart_rx/rx_sync_pipe[0]
+    host_uart_rx u_uart_rx/rx_sync_pipe[0]
 }
-foreach {source_port pattern} $cdc_input_pairs {
+foreach {source_port normalized} $cdc_input_pairs {
     set source_matches [get_ports -quiet $source_port]
     if {[llength $source_matches] != 1} {
         set reason "asynchronous_input_port_count:$source_port:[llength $source_matches]"
@@ -42,15 +56,12 @@ foreach {source_port pattern} $cdc_input_pairs {
         continue
     }
     set source [lindex $source_matches 0]
-    set endpoint_matches [get_regs -quiet $pattern]
-    if {[llength $endpoint_matches] == 1} {
-        set endpoint [lindex $endpoint_matches 0]
+    if {[info exists cdc_actual_by_normalized($normalized)]} {
+        set endpoint $cdc_actual_by_normalized($normalized)
         set_false_path -from $source -to $endpoint
-        puts $cdc_report "false_path_endpoint=$endpoint"
+        puts $cdc_report "false_path_endpoint=$normalized"
     } else {
-        set_false_path -from $source
-        puts $cdc_report "false_path_source=$source_port"
-        set reason "first_stage_endpoint_count:$source_port:$pattern:[llength $endpoint_matches]"
+        set reason "first_stage_endpoint_count:$source_port:$normalized:0"
         lappend cdc_failures $reason
         puts $cdc_report "structural_failure=$reason"
     }
@@ -59,26 +70,32 @@ close $cdc_report
 if {[llength $cdc_failures] == 0} {
     puts {CDC_GATE_PASS=1}
 } else {
-    puts "CDC_GATE_ADVISORY_FAIL=[llength $cdc_failures]"
+    puts "CDC_GATE_FAIL=[llength $cdc_failures]"
+    error "PROD2U_P4_NORMAL_V3_CDC_GATE_FAIL:[join $cdc_failures ,]"
 }
 
 set phase_groups {
-    x {*/u_core/u_motors/u_x_axis/motion_phase*}
-    y {*/u_core/u_motors/u_y_axis/motion_phase*}
+    x {{u_core/u_motors/u_x_axis/motion_phase*} {*/u_core/u_motors/u_x_axis/motion_phase*}}
+    y {{u_core/u_motors/u_y_axis/motion_phase*} {*/u_core/u_motors/u_y_axis/motion_phase*}}
 }
 set fsm_report [open {prod2u_p4_normal_v3_fsm_encoding.rpt} w]
 puts $fsm_report {schema=prod2u-p4-normal-v3-fsm-encoding-v2}
 set fsm_failures {}
-foreach {axis pattern} $phase_groups {
+foreach {axis patterns} $phase_groups {
     set matches {}
-    foreach candidate [get_regs -quiet $pattern] {
-        if {[regexp {/motion_phase\[[0-1]\]$} $candidate]} {
+    set normalized_matches {}
+    set phase_regexp [format {(u_core/u_motors/u_%s_axis/motion_phase\[[0-1]\])$} $axis]
+    foreach candidate [p4_find_unique_regs $patterns] {
+        if {[regexp $phase_regexp $candidate -> normalized]} {
             lappend matches $candidate
+            if {[lsearch -exact $normalized_matches $normalized] < 0} {
+                lappend normalized_matches $normalized
+            }
         }
     }
-    if {[llength $matches] != 2} {
+    if {[llength $matches] != 2 || [llength $normalized_matches] != 2} {
         puts $fsm_report "motion_phase=${axis}:[llength $matches]:unknown"
-        set reason "motion_phase_register_count:$axis:[llength $matches]"
+        set reason "motion_phase_register_count:$axis:[llength $matches]:normalized:[llength $normalized_matches]"
         lappend fsm_failures $reason
         puts $fsm_report "structural_failure=$reason"
     } else {
@@ -89,7 +106,8 @@ close $fsm_report
 if {[llength $fsm_failures] == 0} {
     puts {FSM_ENCODING_GATE_PASS=sequential}
 } else {
-    puts "FSM_ENCODING_GATE_ADVISORY_FAIL=[llength $fsm_failures]"
+    puts "FSM_ENCODING_GATE_FAIL=[llength $fsm_failures]"
+    error "PROD2U_P4_NORMAL_V3_FSM_ENCODING_GATE_FAIL:[join $fsm_failures ,]"
 }
 
 set_param route effort routability

+ 45 - 27
td/syn/prod2u_p4_normal_v3.tcl

@@ -22,24 +22,38 @@ read_adc {constraints/prod2u_p4_normal_v3.adc}
 read_sdc {constraints/prod2u_p4_normal_v3.sdc}
 optimize_rtl
 
-set cdc_patterns {
-    */u_uart_rx/rx_sync_pipe[0]
-    */u_uart_rx/rx_sync_pipe[1]
+proc p4_find_unique_regs {patterns} {
+    set matches {}
+    foreach pattern $patterns {
+        foreach reg [get_regs -quiet $pattern] {
+            if {[lsearch -exact $matches $reg] < 0} {
+                lappend matches $reg
+            }
+        }
+    }
+    return $matches
+}
+
+set cdc_groups {
+    u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}
+    u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}
 }
 set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
 puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
 set cdc_failures {}
 set cdc_regs {}
-foreach pattern $cdc_patterns {
-    set matches [get_regs -quiet $pattern]
+array set cdc_actual_by_normalized {}
+foreach {normalized patterns} $cdc_groups {
+    set matches [p4_find_unique_regs $patterns]
     if {[llength $matches] != 1} {
-        set reason "retained_sync_register_count:$pattern:[llength $matches]"
+        set reason "retained_sync_register_count:$normalized:[llength $matches]"
         lappend cdc_failures $reason
         puts $cdc_report "structural_failure=$reason"
-    }
-    foreach reg $matches {
+    } else {
+        set reg [lindex $matches 0]
+        set cdc_actual_by_normalized($normalized) $reg
         lappend cdc_regs $reg
-        puts $cdc_report "retained_sync_register=$reg"
+        puts $cdc_report "retained_sync_register=$normalized"
     }
 }
 if {[llength $cdc_regs] != 2} {
@@ -51,9 +65,9 @@ if {[llength $cdc_regs] > 0} {
     set_property async_reg true $cdc_regs
 }
 set cdc_input_pairs {
-    host_uart_rx */u_uart_rx/rx_sync_pipe[0]
+    host_uart_rx u_uart_rx/rx_sync_pipe[0]
 }
-foreach {source_port pattern} $cdc_input_pairs {
+foreach {source_port normalized} $cdc_input_pairs {
     set source_matches [get_ports -quiet $source_port]
     if {[llength $source_matches] != 1} {
         set reason "asynchronous_input_port_count:$source_port:[llength $source_matches]"
@@ -62,15 +76,12 @@ foreach {source_port pattern} $cdc_input_pairs {
         continue
     }
     set source [lindex $source_matches 0]
-    set endpoint_matches [get_regs -quiet $pattern]
-    if {[llength $endpoint_matches] == 1} {
-        set endpoint [lindex $endpoint_matches 0]
+    if {[info exists cdc_actual_by_normalized($normalized)]} {
+        set endpoint $cdc_actual_by_normalized($normalized)
         set_false_path -from $source -to $endpoint
-        puts $cdc_report "false_path_endpoint=$endpoint"
+        puts $cdc_report "false_path_endpoint=$normalized"
     } else {
-        set_false_path -from $source
-        puts $cdc_report "false_path_source=$source_port"
-        set reason "first_stage_endpoint_count:$source_port:$pattern:[llength $endpoint_matches]"
+        set reason "first_stage_endpoint_count:$source_port:$normalized:0"
         lappend cdc_failures $reason
         puts $cdc_report "structural_failure=$reason"
     }
@@ -79,7 +90,8 @@ close $cdc_report
 if {[llength $cdc_failures] == 0} {
     puts {CDC_GATE_PASS=1}
 } else {
-    puts "CDC_GATE_ADVISORY_FAIL=[llength $cdc_failures]"
+    puts "CDC_GATE_FAIL=[llength $cdc_failures]"
+    error "PROD2U_P4_NORMAL_V3_CDC_GATE_FAIL:[join $cdc_failures ,]"
 }
 
 report_area -file prod2u_p4_normal_v3_rtl.area
@@ -89,22 +101,27 @@ set_param gate pack_effort high
 optimize_gate prod2u_p4_normal_v3_gate.area
 
 set phase_groups {
-    x {*/u_core/u_motors/u_x_axis/motion_phase*}
-    y {*/u_core/u_motors/u_y_axis/motion_phase*}
+    x {{u_core/u_motors/u_x_axis/motion_phase*} {*/u_core/u_motors/u_x_axis/motion_phase*}}
+    y {{u_core/u_motors/u_y_axis/motion_phase*} {*/u_core/u_motors/u_y_axis/motion_phase*}}
 }
 set fsm_report [open {prod2u_p4_normal_v3_fsm_encoding.rpt} w]
 puts $fsm_report {schema=prod2u-p4-normal-v3-fsm-encoding-v2}
 set fsm_failures {}
-foreach {axis pattern} $phase_groups {
+foreach {axis patterns} $phase_groups {
     set matches {}
-    foreach candidate [get_regs -quiet $pattern] {
-        if {[regexp {/motion_phase\[[0-1]\]$} $candidate]} {
+    set normalized_matches {}
+    set phase_regexp [format {(u_core/u_motors/u_%s_axis/motion_phase\[[0-1]\])$} $axis]
+    foreach candidate [p4_find_unique_regs $patterns] {
+        if {[regexp $phase_regexp $candidate -> normalized]} {
             lappend matches $candidate
+            if {[lsearch -exact $normalized_matches $normalized] < 0} {
+                lappend normalized_matches $normalized
+            }
         }
     }
-    if {[llength $matches] != 2} {
+    if {[llength $matches] != 2 || [llength $normalized_matches] != 2} {
         puts $fsm_report "motion_phase=${axis}:[llength $matches]:unknown"
-        set reason "motion_phase_register_count:$axis:[llength $matches]"
+        set reason "motion_phase_register_count:$axis:[llength $matches]:normalized:[llength $normalized_matches]"
         lappend fsm_failures $reason
         puts $fsm_report "structural_failure=$reason"
     } else {
@@ -115,7 +132,8 @@ close $fsm_report
 if {[llength $fsm_failures] == 0} {
     puts {FSM_ENCODING_GATE_PASS=sequential}
 } else {
-    puts "FSM_ENCODING_GATE_ADVISORY_FAIL=[llength $fsm_failures]"
+    puts "FSM_ENCODING_GATE_FAIL=[llength $fsm_failures]"
+    error "PROD2U_P4_NORMAL_V3_FSM_ENCODING_GATE_FAIL:[join $fsm_failures ,]"
 }
 
 report_area -io_info -file prod2u_p4_normal_v3_gate.area

+ 2 - 0
tests/README.md

@@ -10,4 +10,6 @@ The active verification tree covers only Prod2U P4 Normal v3.
 
 The active motor contract is intentionally unprotected: only opcode `0x35` drives X/Y, `1..65535` steps execute without a cap at fixed 1000 step/s, and ACK follows the first STEP rise. Limit inputs, DISABLE, and watchdog expiry do not stop a motor; formal checks must not reintroduce those retired gates.
 
+The fast-JOG targets are `prod2u_p4_normal_v3_rx_fast_jog_tb`, `prod2u_p4_fast_jog_core_tb`, `prod2u_p4_fast_jog_top`, and `prod2u_p4_fast_jog_path`. Together they cover the held ordinary slot, non-IDLE core states, TX backpressure, latest-wins ACK storage, full setup/phase reload, exact raw nonzero `u16` counts, and X/Y isolation.
+
 Missing tools are reported as blocked; a missing test, detector gap or counterexample is a failure. Offline checks and TD builds never imply that a board was programmed or moved.

+ 96 - 0
tests/cocotb/prod2u_p4_fast_jog_top.v

@@ -0,0 +1,96 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_fast_jog_top;
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg rx_valid = 1'b0;
+    reg [7:0] rx_data = 8'd0;
+    wire rx_ready;
+    reg frame_ready = 1'b0;
+
+    wire request_valid;
+    wire request_ready;
+    wire [7:0] request_type;
+    wire [5:0] request_length;
+    wire [271:0] request_payload;
+    wire [15:0] request_crc16;
+    wire fast_jog_valid;
+    wire [1:0] fast_jog_axis;
+    wire fast_jog_dir;
+    wire [15:0] fast_jog_steps;
+    wire [15:0] crc_error_count;
+    wire [15:0] timeout_count;
+    wire [15:0] format_error_count;
+
+    wire frame_valid;
+    wire [7:0] frame_type;
+    wire [7:0] frame_payload_len;
+    wire [143:0] frame_payload;
+    wire [191:0] ptc_percent;
+    wire [31:0] fan_percent;
+    wire [7:0] solenoid_percent;
+    wire [15:0] state_hash16;
+    wire [2:0] step_out;
+    wire [2:0] dir_out;
+    wire en_n;
+    wire disabled;
+    wire watchdog_timeout;
+
+    prod2u_p4_normal_v3_rx #(
+        .CLK_HZ(1000),
+        .INTER_BYTE_TIMEOUT_MS(64)
+    ) u_rx (
+        .clk(clk),
+        .rst_n(rst_n),
+        .rx_valid(rx_valid),
+        .rx_ready(rx_ready),
+        .rx_data(rx_data),
+        .request_valid(request_valid),
+        .request_ready(request_ready),
+        .request_type(request_type),
+        .request_length(request_length),
+        .request_payload(request_payload),
+        .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
+        .crc_error_count(crc_error_count),
+        .timeout_count(timeout_count),
+        .format_error_count(format_error_count)
+    );
+
+    prod2u_p4_normal_v3_core #(
+        .CLK_HZ(128),
+        .WATCHDOG_SECONDS(1),
+        .DIR_SETUP_CYCLES(8),
+        .STEP_HALF_CYCLES(2)
+    ) u_core (
+        .clk(clk),
+        .rst_n(rst_n),
+        .request_valid(request_valid),
+        .request_ready(request_ready),
+        .request_type(request_type),
+        .request_length(request_length),
+        .request_payload(request_payload),
+        .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
+        .frame_valid(frame_valid),
+        .frame_ready(frame_ready),
+        .frame_type(frame_type),
+        .frame_payload_len(frame_payload_len),
+        .frame_payload(frame_payload),
+        .ptc_percent(ptc_percent),
+        .fan_percent(fan_percent),
+        .solenoid_percent(solenoid_percent),
+        .state_hash16(state_hash16),
+        .step_out(step_out),
+        .dir_out(dir_out),
+        .en_n(en_n),
+        .disabled(disabled),
+        .watchdog_timeout(watchdog_timeout)
+    );
+endmodule

+ 58 - 0
tests/cocotb/run_prod2u_p4_fast_jog_top.py

@@ -0,0 +1,58 @@
+#!/usr/bin/env python3
+"""Run the RX/core fast-JOG cocotb RED tests."""
+
+from __future__ import annotations
+
+import os
+from pathlib import Path
+import xml.etree.ElementTree as ET
+
+
+ROOT = Path(__file__).resolve().parents[2]
+TEST_DIR = Path(__file__).resolve().parent
+TEMP_ROOT = Path(os.environ.get("TEMP", ROOT / "tmp"))
+BUILD_DIR = TEMP_ROOT / "cocotb" / "prod2u_p4_fast_jog_top"
+RESULTS_XML = BUILD_DIR / "results.xml"
+
+
+def rtl_sources() -> list[Path]:
+    return sorted(path for path in (ROOT / "src" / "rtl").glob("*.v") if path.is_file())
+
+
+def results_xml_has_failures(results: Path) -> bool:
+    root = ET.parse(results).getroot()
+    return bool(
+        root.findall(".//failure")
+        or root.findall(".//error")
+        or sum(int(node.attrib.get("failures", "0")) for node in root.findall(".//testsuite"))
+        or sum(int(node.attrib.get("errors", "0")) for node in root.findall(".//testsuite"))
+        or int(root.attrib.get("failures", "0"))
+        or int(root.attrib.get("errors", "0"))
+    )
+
+
+def main() -> int:
+    from cocotb_tools.runner import get_runner
+
+    runner = get_runner("icarus")
+    runner.build(
+        sources=[*rtl_sources(), TEST_DIR / "prod2u_p4_fast_jog_top.v"],
+        hdl_toplevel="prod2u_p4_fast_jog_top",
+        build_dir=BUILD_DIR,
+        always=True,
+        verbose=False,
+    )
+    results = Path(
+        runner.test(
+            hdl_toplevel="prod2u_p4_fast_jog_top",
+            test_module="test_prod2u_p4_fast_jog_top",
+            build_dir=BUILD_DIR,
+            test_dir=TEST_DIR,
+            results_xml=str(RESULTS_XML),
+        )
+    )
+    return 1 if not results.is_file() or results_xml_has_failures(results) else 0
+
+
+if __name__ == "__main__":
+    raise SystemExit(main())

+ 241 - 0
tests/cocotb/test_prod2u_p4_fast_jog_top.py

@@ -0,0 +1,241 @@
+"""RED tests for the independent RX-to-axis JOG fast path."""
+
+from __future__ import annotations
+
+import sys
+from pathlib import Path
+
+import cocotb
+from cocotb.clock import Clock
+from cocotb.triggers import ClockCycles, FallingEdge, ReadOnly, RisingEdge
+
+
+ROOT = Path(__file__).resolve().parents[2]
+sys.path.insert(0, str(ROOT / "tools"))
+
+import prod2u_p4_protocol as protocol  # noqa: E402
+
+
+HOST_ACK = int(protocol.FrameType.HOST_ACK)
+GET_STATUS = int(protocol.CommandId.GET_STATUS)
+SET_SNAPSHOT = int(protocol.CommandId.SET_OUTPUT_SNAPSHOT)
+JOG = int(protocol.MotionOpcode.JOG)
+
+
+async def start_and_reset(dut) -> None:
+    cocotb.start_soon(Clock(dut.clk, 10, unit="ns").start())
+    dut.rst_n.value = 0
+    dut.rx_valid.value = 0
+    dut.rx_data.value = 0
+    dut.frame_ready.value = 0
+    await ClockCycles(dut.clk, 5)
+    dut.rst_n.value = 1
+    await ClockCycles(dut.clk, 5)
+
+
+async def send_frame_bytes(dut, frame: bytes) -> None:
+    for byte in frame:
+        for _ in range(256):
+            await FallingEdge(dut.clk)
+            if int(dut.rx_ready.value):
+                break
+        else:
+            raise AssertionError("RX stopped accepting bytes while a fast JOG was pending")
+        dut.rx_data.value = byte
+        dut.rx_valid.value = 1
+        await RisingEdge(dut.clk)
+        await FallingEdge(dut.clk)
+        dut.rx_valid.value = 0
+
+
+async def wait_until(dut, predicate, cycles: int, message: str) -> None:
+    for _ in range(cycles):
+        await RisingEdge(dut.clk)
+        await ReadOnly()
+        if predicate():
+            return
+    raise AssertionError(message)
+
+
+async def step_monitor(dut, observed: dict[str, int | bool]) -> None:
+    previous_x = 0
+    previous_y = 0
+    while True:
+        await RisingEdge(dut.clk)
+        await ReadOnly()
+        x_step = int(dut.step_out.value) & 1
+        y_step = (int(dut.step_out.value) >> 1) & 1
+        if x_step and not previous_x:
+            observed["x_rises"] = int(observed["x_rises"]) + 1
+        if y_step and not previous_y:
+            observed["y_rises"] = int(observed["y_rises"]) + 1
+        if x_step and y_step:
+            observed["overlap"] = True
+        previous_x = x_step
+        previous_y = y_step
+
+
+async def ack_monitor(dut, commands: list[int]) -> None:
+    while True:
+        await FallingEdge(dut.clk)
+        await ReadOnly()
+        if (
+            int(dut.frame_valid.value)
+            and int(dut.frame_ready.value)
+            and int(dut.frame_type.value) == HOST_ACK
+        ):
+            commands.append((int(dut.frame_payload.value) >> 8) & 0xFF)
+
+
+def build_snapshot() -> bytes:
+    return protocol.build_output_snapshot(
+        ptc_percent=[10] * 24,
+        fan_percent=[30] * 4,
+        solenoid=0,
+        xyz=(255, 1, 77),
+    )
+
+
+def build_jog(axis: int, direction: int, steps: int) -> bytes:
+    return protocol.build_motor_jog(
+        axis=axis,
+        raw_dir=direction,
+        speed_code=3,
+        steps=steps,
+    )
+
+
+@cocotb.test()
+async def fast_jog_runs_while_old_response_is_stalled(dut) -> None:
+    await start_and_reset(dut)
+    observed: dict[str, int | bool] = {
+        "x_rises": 0,
+        "y_rises": 0,
+        "overlap": False,
+    }
+    acks: list[int] = []
+    cocotb.start_soon(step_monitor(dut, observed))
+    cocotb.start_soon(ack_monitor(dut, acks))
+
+    await send_frame_bytes(
+        dut,
+        protocol.build_host_command(command=protocol.CommandId.GET_STATUS),
+    )
+    await wait_until(
+        dut,
+        lambda: int(dut.frame_valid.value) == 1,
+        64,
+        "GET_STATUS response did not enter the stalled TX slot",
+    )
+    assert int(dut.frame_type.value) == HOST_ACK
+    assert ((int(dut.frame_payload.value) >> 8) & 0xFF) == GET_STATUS
+    assert int(dut.request_ready.value) == 0
+
+    await send_frame_bytes(
+        dut,
+        protocol.build_host_command(command=protocol.CommandId.GET_STATUS),
+    )
+    await wait_until(
+        dut,
+        lambda: int(dut.request_valid.value) == 1
+        and int(dut.request_ready.value) == 0,
+        32,
+        "second ordinary request did not remain pending behind the old response",
+    )
+
+    await send_frame_bytes(dut, build_jog(axis=0, direction=1, steps=6))
+    await wait_until(
+        dut,
+        lambda: int(observed["x_rises"]) >= 1,
+        32,
+        "fast X JOG was blocked by command_inflight/TX backpressure",
+    )
+    assert ((int(dut.frame_payload.value) >> 8) & 0xFF) == GET_STATUS
+
+    await wait_until(
+        dut,
+        lambda: int(observed["x_rises"]) == 6,
+        256,
+        "X motion did not finish while TX remained stalled",
+    )
+    assert acks == []
+
+    await FallingEdge(dut.clk)
+    dut.frame_ready.value = 1
+    await wait_until(
+        dut,
+        lambda: JOG in acks,
+        512,
+        "pending JOG ACK did not drain after TX resumed",
+    )
+    assert acks[0] == GET_STATUS
+
+
+@cocotb.test()
+async def fast_jog_runs_while_core_is_non_idle(dut) -> None:
+    await start_and_reset(dut)
+    observed: dict[str, int | bool] = {
+        "x_rises": 0,
+        "y_rises": 0,
+        "overlap": False,
+    }
+    cocotb.start_soon(step_monitor(dut, observed))
+
+    await send_frame_bytes(dut, build_snapshot())
+    await wait_until(
+        dut,
+        lambda: int(dut.request_ready.value) == 0,
+        16,
+        "snapshot did not make the normal core path non-IDLE",
+    )
+    await send_frame_bytes(dut, build_jog(axis=1, direction=0, steps=3))
+    await wait_until(
+        dut,
+        lambda: int(observed["y_rises"]) == 3,
+        192,
+        "fast Y JOG was blocked by the normal snapshot state machine",
+    )
+    assert int(observed["x_rises"]) == 0
+
+
+@cocotb.test()
+async def x_ack_then_y_jog_runs_with_axis_overlap(dut) -> None:
+    await start_and_reset(dut)
+    dut.frame_ready.value = 1
+    observed: dict[str, int | bool] = {
+        "x_rises": 0,
+        "y_rises": 0,
+        "overlap": False,
+    }
+    acks: list[int] = []
+    cocotb.start_soon(step_monitor(dut, observed))
+    cocotb.start_soon(ack_monitor(dut, acks))
+
+    await send_frame_bytes(dut, build_jog(axis=0, direction=0, steps=40))
+    await wait_until(
+        dut,
+        lambda: len(acks) >= 1,
+        128,
+        "X JOG ACK did not follow the first X STEP",
+    )
+    assert acks[0] == JOG
+    assert int(observed["x_rises"]) >= 1
+
+    await send_frame_bytes(dut, build_jog(axis=1, direction=1, steps=6))
+    await wait_until(
+        dut,
+        lambda: len(acks) >= 2,
+        128,
+        "Y JOG ACK did not follow the first Y STEP",
+    )
+    assert acks[1] == JOG
+    assert int(observed["y_rises"]) >= 1
+
+    await wait_until(
+        dut,
+        lambda: int(observed["x_rises"]) == 40
+        and int(observed["y_rises"]) == 6,
+        512,
+        "X/Y independent pulse counts did not complete",
+    )
+    assert bool(observed["overlap"]), "X/Y STEP waveforms never overlapped"

+ 1 - 0
tests/formal/README.md

@@ -13,6 +13,7 @@ Formal targets cover independent digital properties for Prod2U P4 Normal v3:
 - motor enable remains active; only reset, power loss, or reconfiguration stops motion;
 - DISABLE/watchdog still force non-motor outputs safe and preserve expiry-over-refresh priority;
 - RX framing/payload integrity and continuous held-request intake without an emergency DISABLE bypass;
+- the dedicated RX/core fast-JOG path remains independent of ordinary request admission and TX state, with a separate countdown oracle for replacement, exact nonzero `u16` distance, and production 25,000/12,500-cycle timing;
 - output-state invariants.
 
 These properties prove digital STEP/DIR/EN and status behavior. They do not

+ 39 - 8
tests/formal/prod2u_p4_axis_safety_formal.v

@@ -16,6 +16,9 @@ module prod2u_p4_axis_safety_formal;
     wire step_out;
     wire dir_out;
     wire started_pulse;
+    wire [1:0] dut_motion_phase;
+    wire [31:0] dut_phase_counter;
+    wire [15:0] dut_remaining_steps;
 
     // Independent observable oracle. It deliberately does not mirror the
     // production four-state encoding: setup, high, and low use mutually
@@ -40,12 +43,19 @@ module prod2u_p4_axis_safety_formal;
         .clk(clk), .rst_n(rst_n),
         .command_start(command_start), .command_dir(command_dir),
         .command_steps(command_steps), .step_out(step_out),
-        .dir_out(dir_out), .started_pulse(started_pulse)
+        .dir_out(dir_out), .started_pulse(started_pulse),
+        .formal_motion_phase(dut_motion_phase),
+        .formal_phase_counter(dut_phase_counter),
+        .formal_remaining_steps(dut_remaining_steps)
     );
 
     always @(posedge clk) begin
         rst_n <= 1'b1;
         previous_step <= step_out;
+        if (rst_n && command_start) begin
+            // RAW_U16_TRUSTED_HOST_NO_CPLD_CAP: zero is rejected by the host.
+            assume(command_steps != 16'd0);
+        end
 
         if (!rst_n) begin
             spec_active <= 1'b0;
@@ -74,13 +84,8 @@ module prod2u_p4_axis_safety_formal;
                 saw_ffff_command <= (command_steps == 16'hffff);
                 saw_three_command <= (command_steps == 16'd3);
                 three_rises <= 2'd0;
-                if (command_steps == 16'd0) begin
-                    spec_active <= 1'b0;
-                    spec_setup_left <= 2'd0;
-                end else begin
-                    spec_active <= 1'b1;
-                    spec_setup_left <= SPEC_DIR_SETUP_CYCLES;
-                end
+                spec_active <= 1'b1;
+                spec_setup_left <= SPEC_DIR_SETUP_CYCLES;
             end else if (spec_active) begin
                 if (spec_setup_left != 0) begin
                     if (spec_setup_left == 1) begin
@@ -125,6 +130,32 @@ module prod2u_p4_axis_safety_formal;
             assert(dir_out == spec_dir);
             assert(started_pulse == spec_started);
             assert(!started_pulse || step_out);
+            assert(dut_remaining_steps == spec_steps_left);
+            if (!spec_active) begin
+                assert(dut_motion_phase == 2'd0);
+                assert(dut_phase_counter == 32'd0);
+                assert(spec_setup_left == 2'd0);
+                assert(!spec_step);
+                assert(spec_high_left == 2'd0);
+                assert(spec_low_left == 2'd0);
+            end else if (spec_setup_left != 2'd0) begin
+                assert(dut_motion_phase == 2'd1);
+                assert(dut_phase_counter == (spec_setup_left - 1'b1));
+                assert(!spec_step);
+                assert(spec_high_left == 2'd0);
+                assert(spec_low_left == 2'd0);
+            end else if (spec_step) begin
+                assert(dut_motion_phase == 2'd2);
+                assert(dut_phase_counter == (spec_high_left - 1'b1));
+                assert(spec_high_left != 2'd0);
+                assert(spec_low_left == 2'd0);
+            end else if (spec_low_left != 2'd0) begin
+                assert(dut_motion_phase == 2'd3);
+                assert(dut_phase_counter == (spec_low_left - 1'b1));
+                assert(spec_high_left == 2'd0);
+            end else begin
+                assert(1'b0);
+            end
         end
 
         cover(rst_n && started_pulse && step_out);

+ 9 - 20
tests/formal/prod2u_p4_core_disable_motor_safety_formal.v

@@ -19,11 +19,11 @@ module prod2u_p4_core_disable_motor_safety_formal;
     reg rst_n = 1'b0;
     reg [3:0] phase = PH_JOG_SEND;
     reg previous_x_step = 1'b0;
-    reg reference_jog_start = 1'b0;
     reg [271:0] request_payload;
 
-    wire request_valid = (phase == PH_JOG_SEND) ||
-        (phase == PH_SNAPSHOT_SEND) || (phase == PH_DISABLE_SEND);
+    wire request_valid = (phase == PH_SNAPSHOT_SEND) ||
+        (phase == PH_DISABLE_SEND);
+    wire fast_jog_valid = (phase == PH_JOG_SEND);
     wire [7:0] request_type = (phase == PH_SNAPSHOT_SEND) ?
         FT_HOST_BATCH_CMD : ((phase == PH_DISABLE_SEND) ?
         FT_HOST_CMD : FT_MOTION_CMD);
@@ -48,8 +48,6 @@ module prod2u_p4_core_disable_motor_safety_formal;
     wire [143:0] frame_payload;
     reg first_step_seen = 1'b0;
     reg jog_ack_seen = 1'b0;
-    reg [1:0] jog_ack_delay = 2'd0;
-    localparam [1:0] EXPECTED_JOG_ACK_DELAY = 2'd2;
 
     always @(*) begin
         request_payload = 272'd0;
@@ -97,6 +95,10 @@ module prod2u_p4_core_disable_motor_safety_formal;
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(16'h3501),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(2'd0),
+        .fast_jog_dir(1'b1),
+        .fast_jog_steps(16'hffff),
         .frame_valid(frame_valid),
         .frame_ready(1'b1),
         .frame_type(frame_type),
@@ -119,7 +121,7 @@ module prod2u_p4_core_disable_motor_safety_formal;
     ) reference_motors (
         .clk(clk),
         .rst_n(rst_n),
-        .jog_start(reference_jog_start),
+        .jog_start(fast_jog_valid),
         .jog_axis(2'd0),
         .jog_dir(1'b1),
         .jog_steps(16'hffff),
@@ -130,16 +132,13 @@ module prod2u_p4_core_disable_motor_safety_formal;
 
     always @(posedge clk) begin
         rst_n <= 1'b1;
-        reference_jog_start <= 1'b0;
         previous_x_step <= step_out[0];
 
         if (!rst_n) begin
             phase <= PH_JOG_SEND;
             previous_x_step <= 1'b0;
-            reference_jog_start <= 1'b0;
             first_step_seen <= 1'b0;
             jog_ack_seen <= 1'b0;
-            jog_ack_delay <= 2'd0;
         end else begin
             assert(en_n == 1'b0);
             assert(step_out == reference_step_out);
@@ -149,9 +148,6 @@ module prod2u_p4_core_disable_motor_safety_formal;
 
             if (reference_started[0]) begin
                 first_step_seen <= 1'b1;
-                jog_ack_delay <= EXPECTED_JOG_ACK_DELAY;
-            end else if (jog_ack_delay != 0) begin
-                jog_ack_delay <= jog_ack_delay - 1'b1;
             end
 
             if (!jog_ack_seen && !first_step_seen) begin
@@ -159,7 +155,6 @@ module prod2u_p4_core_disable_motor_safety_formal;
             end
             if (!jog_ack_seen && frame_valid) begin
                 assert(first_step_seen);
-                assert(jog_ack_delay == 2'd1);
                 assert(frame_type == 8'h06);
                 assert(frame_payload_len == 8'd8);
                 assert(frame_payload[7:0] == 8'h01);
@@ -167,18 +162,12 @@ module prod2u_p4_core_disable_motor_safety_formal;
                 assert(frame_payload[23:16] == 8'h00);
                 jog_ack_seen <= 1'b1;
             end
-            if (!jog_ack_seen && (jog_ack_delay == 2'd1)) begin
-                assert(frame_valid);
-            end
 
             case (phase)
                 PH_JOG_SEND: begin
                     assert(disabled);
                     assert(!watchdog_timeout);
-                    if (request_valid && request_ready) begin
-                        reference_jog_start <= 1'b1;
-                        phase <= PH_WAIT_FIRST_STEP;
-                    end
+                    phase <= PH_WAIT_FIRST_STEP;
                 end
 
                 PH_WAIT_FIRST_STEP: begin

+ 7 - 9
tests/formal/prod2u_p4_core_watchdog_race_formal.v

@@ -26,7 +26,6 @@ module prod2u_p4_core_watchdog_race_formal;
     reg [3:0] phase = PH_UNARMED_STATUS_SEND;
     reg previous_x_step = 1'b0;
     reg saw_jog_step = 1'b0;
-    reg reference_jog_start = 1'b0;
     reg shadow_tracking = 1'b0;
     reg [271:0] request_payload;
     reg request_valid;
@@ -44,6 +43,7 @@ module prod2u_p4_core_watchdog_race_formal;
     wire [5:0] request_length = (phase == PH_SNAPSHOT_SEND) ?
         6'd34 : 6'd8;
     wire request_ready;
+    wire fast_jog_valid = (phase == PH_JOG_SEND);
     wire [191:0] ptc_percent;
     wire [31:0] fan_percent;
     wire [7:0] solenoid_percent;
@@ -62,7 +62,6 @@ module prod2u_p4_core_watchdog_race_formal;
         case (phase)
             PH_UNARMED_STATUS_SEND,
             PH_SNAPSHOT_SEND,
-            PH_JOG_SEND,
             PH_EARLY_STATUS_SEND,
             PH_TIMEOUT_STATUS_SEND: request_valid = 1'b1;
             PH_WAIT_EXPIRY: request_valid = shadow_expiry_due;
@@ -112,6 +111,10 @@ module prod2u_p4_core_watchdog_race_formal;
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(16'h3701),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(2'd0),
+        .fast_jog_dir(1'b1),
+        .fast_jog_steps(16'hffff),
         .frame_valid(),
         .frame_ready(1'b1),
         .frame_type(),
@@ -134,7 +137,7 @@ module prod2u_p4_core_watchdog_race_formal;
     ) reference_motors (
         .clk(clk),
         .rst_n(rst_n),
-        .jog_start(reference_jog_start),
+        .jog_start(fast_jog_valid),
         .jog_axis(2'd0),
         .jog_dir(1'b1),
         .jog_steps(16'hffff),
@@ -168,7 +171,6 @@ module prod2u_p4_core_watchdog_race_formal;
 
     always @(posedge clk) begin
         rst_n <= 1'b1;
-        reference_jog_start <= 1'b0;
         previous_x_step <= step_out[0];
         if (step_out[0]) begin
             saw_jog_step <= 1'b1;
@@ -178,7 +180,6 @@ module prod2u_p4_core_watchdog_race_formal;
             phase <= PH_UNARMED_STATUS_SEND;
             previous_x_step <= 1'b0;
             saw_jog_step <= 1'b0;
-            reference_jog_start <= 1'b0;
             shadow_tracking <= 1'b0;
         end else begin
             assert(en_n == 1'b0);
@@ -227,10 +228,7 @@ module prod2u_p4_core_watchdog_race_formal;
                 PH_JOG_SEND: begin
                     assert(!disabled);
                     assert(!watchdog_timeout);
-                    if (request_valid && request_ready) begin
-                        reference_jog_start <= 1'b1;
-                        phase <= PH_WAIT_JOG;
-                    end
+                    phase <= PH_WAIT_JOG;
                 end
 
                 PH_WAIT_JOG: begin

+ 48 - 0
tests/formal/prod2u_p4_fast_jog_path.sby

@@ -0,0 +1,48 @@
+[tasks]
+prove_path
+cover_path
+bmc_rx_path
+cover_rx_path
+prove_production_timing
+
+[options]
+prove_path: mode prove
+prove_path: depth 64
+cover_path: mode cover
+cover_path: depth 64
+bmc_rx_path: mode bmc
+bmc_rx_path: depth 64
+cover_rx_path: mode cover
+cover_rx_path: depth 64
+prove_production_timing: mode prove
+prove_production_timing: depth 64
+
+[engines]
+prove_path: abc pdr
+cover_path: smtbmc yices
+bmc_rx_path: smtbmc yices
+cover_rx_path: smtbmc yices
+prove_production_timing: abc pdr
+
+[script]
+prove_path: read_verilog -formal binary921_crc16.v prod2u_p4_normal_v3_output_state.v prod2u_p4_normal_v3_watchdog.v prod2u_p4_axis_executor.v prod2u_p4_motor_hub.v prod2u_p4_response_scheduler.v prod2u_p4_normal_v3_core.v prod2u_p4_fast_jog_path_formal.v
+cover_path: read_verilog -formal binary921_crc16.v prod2u_p4_normal_v3_output_state.v prod2u_p4_normal_v3_watchdog.v prod2u_p4_axis_executor.v prod2u_p4_motor_hub.v prod2u_p4_response_scheduler.v prod2u_p4_normal_v3_core.v prod2u_p4_fast_jog_path_formal.v
+bmc_rx_path: read_verilog -formal binary921_crc16.v prod2u_p4_normal_v3_rx.v prod2u_p4_fast_jog_path_formal.v
+cover_rx_path: read_verilog -formal binary921_crc16.v prod2u_p4_normal_v3_rx.v prod2u_p4_fast_jog_path_formal.v
+prove_production_timing: read_verilog -formal prod2u_p4_axis_executor.v prod2u_p4_fast_jog_path_formal.v
+prove_path: prep -top prod2u_p4_fast_jog_path_formal
+cover_path: prep -top prod2u_p4_fast_jog_path_formal
+bmc_rx_path: prep -top prod2u_p4_fast_jog_rx_formal
+cover_rx_path: prep -top prod2u_p4_fast_jog_rx_formal
+prove_production_timing: prep -top prod2u_p4_fast_jog_production_timing_formal
+
+[files]
+../../src/rtl/binary921_crc16.v
+../../src/rtl/prod2u_p4_normal_v3_output_state.v
+../../src/rtl/prod2u_p4_normal_v3_watchdog.v
+../../src/rtl/prod2u_p4_axis_executor.v
+../../src/rtl/prod2u_p4_motor_hub.v
+../../src/rtl/prod2u_p4_response_scheduler.v
+../../src/rtl/prod2u_p4_normal_v3_core.v
+../../src/rtl/prod2u_p4_normal_v3_rx.v
+prod2u_p4_fast_jog_path_formal.v

+ 627 - 0
tests/formal/prod2u_p4_fast_jog_path_formal.v

@@ -0,0 +1,627 @@
+`timescale 1ns/1ps
+`default_nettype none
+
+// Independent observable axis model. The implementation uses a four-state
+// phase machine; this oracle instead uses explicit setup/high/low countdowns.
+module prod2u_p4_fast_jog_axis_oracle #(
+    parameter integer DIR_SETUP_CYCLES = 3,
+    parameter integer STEP_HALF_CYCLES = 2
+) (
+    input  wire        clk,
+    input  wire        rst_n,
+    input  wire        command_start,
+    input  wire        command_dir,
+    input  wire [15:0] command_steps,
+    output reg         step_out,
+    output reg         dir_out,
+    output reg         started_pulse,
+    output reg         active,
+    output reg  [15:0] steps_left
+);
+    reg [15:0] setup_left;
+    reg [15:0] high_left;
+    reg [15:0] low_left;
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            step_out <= 1'b0;
+            dir_out <= 1'b0;
+            started_pulse <= 1'b0;
+            active <= 1'b0;
+            steps_left <= 16'd0;
+            setup_left <= 16'd0;
+            high_left <= 16'd0;
+            low_left <= 16'd0;
+        end else begin
+            started_pulse <= 1'b0;
+            if (command_start) begin
+                step_out <= 1'b0;
+                dir_out <= command_dir;
+                active <= 1'b1;
+                steps_left <= command_steps;
+                setup_left <= DIR_SETUP_CYCLES;
+                high_left <= 16'd0;
+                low_left <= 16'd0;
+            end else if (active) begin
+                if (setup_left != 16'd0) begin
+                    if (setup_left == 16'd1) begin
+                        setup_left <= 16'd0;
+                        step_out <= 1'b1;
+                        high_left <= STEP_HALF_CYCLES;
+                        started_pulse <= 1'b1;
+                    end else begin
+                        setup_left <= setup_left - 16'd1;
+                    end
+                end else if (step_out) begin
+                    if (high_left == 16'd1) begin
+                        step_out <= 1'b0;
+                        high_left <= 16'd0;
+                        low_left <= STEP_HALF_CYCLES;
+                    end else begin
+                        high_left <= high_left - 16'd1;
+                    end
+                end else if (low_left != 16'd0) begin
+                    if (low_left == 16'd1) begin
+                        low_left <= 16'd0;
+                        if (steps_left == 16'd1) begin
+                            active <= 1'b0;
+                            steps_left <= 16'd0;
+                        end else begin
+                            steps_left <= steps_left - 16'd1;
+                            step_out <= 1'b1;
+                            high_left <= STEP_HALF_CYCLES;
+                        end
+                    end else begin
+                        low_left <= low_left - 16'd1;
+                    end
+                end
+            end
+        end
+    end
+endmodule
+
+// End-to-end core proof with deliberately short periods. A legal fast JOG is
+// compared against two independent axis oracles while an unrelated ordinary
+// command and TX backpressure are unconstrained. Any dependency on
+// request_ready, the core state, command_inflight, or frame_ready breaks the
+// observable equivalence.
+module prod2u_p4_fast_jog_path_formal;
+    localparam integer FORMAL_DIR_SETUP_CYCLES = 3;
+    localparam integer FORMAL_STEP_HALF_CYCLES = 2;
+
+    (* gclk *) reg clk;
+    reg rst_n = 1'b0;
+    reg past_valid = 1'b0;
+
+    (* anyseq *) reg ordinary_request_valid;
+    (* anyseq *) reg ordinary_request_is_snapshot;
+    (* anyseq *) reg frame_ready;
+    (* anyseq *) reg fast_jog_valid;
+    (* anyseq *) reg [1:0] fast_jog_axis;
+    (* anyseq *) reg fast_jog_dir;
+    (* anyseq *) reg [15:0] fast_jog_steps;
+
+    wire request_ready;
+    wire frame_valid;
+    wire [7:0] frame_type;
+    wire [7:0] frame_payload_len;
+    wire [143:0] frame_payload;
+    wire [191:0] ptc_percent;
+    wire [31:0] fan_percent;
+    wire [7:0] solenoid_percent;
+    wire [15:0] state_hash16;
+    wire [2:0] step_out;
+    wire [2:0] dir_out;
+    wire en_n;
+    wire disabled;
+    wire watchdog_timeout;
+    wire [2:0] dut_state;
+
+    wire x_spec_step;
+    wire x_spec_dir;
+    wire x_spec_started;
+    wire x_spec_active;
+    wire [15:0] x_spec_steps_left;
+    wire y_spec_step;
+    wire y_spec_dir;
+    wire y_spec_started;
+    wire y_spec_active;
+    wire [15:0] y_spec_steps_left;
+
+    reg [2:0] previous_step = 3'd0;
+    reg saw_tx_blocked_fast = 1'b0;
+    reg blocked_fast_axis = 1'b0;
+    reg saw_nonidle_fast = 1'b0;
+    reg nonidle_fast_axis = 1'b0;
+    reg saw_ffff_fast = 1'b0;
+    reg x_two_active = 1'b0;
+    reg [1:0] x_two_rises = 2'd0;
+    reg x_two_complete = 1'b0;
+
+    // GET_STATUS occupies the response scheduler; a valid snapshot reaches
+    // the non-IDLE validate/commit states without creating a motor command.
+    reg [271:0] snapshot_request_payload;
+    integer snapshot_index;
+    always @* begin
+        snapshot_request_payload = 272'd0;
+        snapshot_request_payload[7:0] = 8'h2a;
+        for (snapshot_index = 0; snapshot_index < 24;
+             snapshot_index = snapshot_index + 1) begin
+            snapshot_request_payload[(snapshot_index + 2) * 8 +: 8] = 8'd10;
+        end
+        for (snapshot_index = 0; snapshot_index < 4;
+             snapshot_index = snapshot_index + 1) begin
+            snapshot_request_payload[(snapshot_index + 26) * 8 +: 8] = 8'd30;
+        end
+    end
+    wire [7:0] ordinary_request_type =
+        ordinary_request_is_snapshot ? 8'h07 : 8'h05;
+    wire [5:0] ordinary_request_length =
+        ordinary_request_is_snapshot ? 6'd34 : 6'd4;
+    wire [271:0] ordinary_payload = ordinary_request_is_snapshot ?
+        snapshot_request_payload : {264'd0, 8'h24};
+
+    prod2u_p4_normal_v3_core #(
+        .CLK_HZ(4),
+        .WATCHDOG_SECONDS(2),
+        .DIR_SETUP_CYCLES(FORMAL_DIR_SETUP_CYCLES),
+        .STEP_HALF_CYCLES(FORMAL_STEP_HALF_CYCLES)
+    ) dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .request_valid(ordinary_request_valid),
+        .request_ready(request_ready),
+        .request_type(ordinary_request_type),
+        .request_length(ordinary_request_length),
+        .request_payload(ordinary_payload),
+        .request_crc16(16'h1234),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
+        .frame_valid(frame_valid),
+        .frame_ready(frame_ready),
+        .frame_type(frame_type),
+        .frame_payload_len(frame_payload_len),
+        .frame_payload(frame_payload),
+        .ptc_percent(ptc_percent),
+        .fan_percent(fan_percent),
+        .solenoid_percent(solenoid_percent),
+        .state_hash16(state_hash16),
+        .step_out(step_out),
+        .dir_out(dir_out),
+        .en_n(en_n),
+        .disabled(disabled),
+        .watchdog_timeout(watchdog_timeout),
+        .formal_state(dut_state)
+    );
+
+    prod2u_p4_fast_jog_axis_oracle #(
+        .DIR_SETUP_CYCLES(FORMAL_DIR_SETUP_CYCLES),
+        .STEP_HALF_CYCLES(FORMAL_STEP_HALF_CYCLES)
+    ) x_oracle (
+        .clk(clk),
+        .rst_n(rst_n),
+        .command_start(fast_jog_valid && (fast_jog_axis == 2'd0)),
+        .command_dir(fast_jog_dir),
+        .command_steps(fast_jog_steps),
+        .step_out(x_spec_step),
+        .dir_out(x_spec_dir),
+        .started_pulse(x_spec_started),
+        .active(x_spec_active),
+        .steps_left(x_spec_steps_left)
+    );
+
+    prod2u_p4_fast_jog_axis_oracle #(
+        .DIR_SETUP_CYCLES(FORMAL_DIR_SETUP_CYCLES),
+        .STEP_HALF_CYCLES(FORMAL_STEP_HALF_CYCLES)
+    ) y_oracle (
+        .clk(clk),
+        .rst_n(rst_n),
+        .command_start(fast_jog_valid && (fast_jog_axis == 2'd1)),
+        .command_dir(fast_jog_dir),
+        .command_steps(fast_jog_steps),
+        .step_out(y_spec_step),
+        .dir_out(y_spec_dir),
+        .started_pulse(y_spec_started),
+        .active(y_spec_active),
+        .steps_left(y_spec_steps_left)
+    );
+
+    always @(posedge clk) begin
+        past_valid <= 1'b1;
+        rst_n <= 1'b1;
+        previous_step <= step_out;
+
+        if (rst_n && fast_jog_valid) begin
+            assume(fast_jog_axis <= 2'd1);
+            // RAW_U16_TRUSTED_HOST_NO_CPLD_CAP: the host owns zero rejection.
+            assume(fast_jog_steps != 16'd0);
+        end
+
+        if (!rst_n) begin
+            saw_tx_blocked_fast <= 1'b0;
+            blocked_fast_axis <= 1'b0;
+            saw_nonidle_fast <= 1'b0;
+            nonidle_fast_axis <= 1'b0;
+            saw_ffff_fast <= 1'b0;
+            x_two_active <= 1'b0;
+            x_two_rises <= 2'd0;
+            x_two_complete <= 1'b0;
+        end else begin
+            if (frame_valid && !frame_ready && fast_jog_valid) begin
+                saw_tx_blocked_fast <= 1'b1;
+                blocked_fast_axis <= fast_jog_axis[0];
+            end
+            if (fast_jog_valid && (dut_state != 3'd0)) begin
+                saw_nonidle_fast <= 1'b1;
+                nonidle_fast_axis <= fast_jog_axis[0];
+            end
+            if (fast_jog_valid && (fast_jog_steps == 16'hffff)) begin
+                saw_ffff_fast <= 1'b1;
+            end
+
+            if (fast_jog_valid && (fast_jog_axis == 2'd0)) begin
+                x_two_active <= (fast_jog_steps == 16'd2);
+                x_two_rises <= 2'd0;
+                x_two_complete <= 1'b0;
+            end else if (x_two_active) begin
+                if (step_out[0] && !previous_step[0]) begin
+                    x_two_rises <= x_two_rises + 1'b1;
+                end
+                if (!x_spec_active && (x_two_rises == 2'd2)) begin
+                    x_two_active <= 1'b0;
+                    x_two_complete <= 1'b1;
+                end
+            end
+        end
+
+        if (rst_n) begin
+            assert(step_out[0] == x_spec_step);
+            assert(dir_out[0] == x_spec_dir);
+            assert(step_out[1] == y_spec_step);
+            assert(dir_out[1] == y_spec_dir);
+            assert(!step_out[2]);
+            assert(!dir_out[2]);
+            assert(!en_n);
+            assert(!x_spec_started || x_spec_step);
+            assert(!y_spec_started || y_spec_step);
+        end
+
+        cover(saw_tx_blocked_fast &&
+            step_out[blocked_fast_axis] &&
+            !previous_step[blocked_fast_axis]);
+        cover(saw_nonidle_fast &&
+            step_out[nonidle_fast_axis] &&
+            !previous_step[nonidle_fast_axis]);
+        cover(rst_n && step_out[0] && step_out[1]);
+        cover(saw_ffff_fast && (step_out[0] || step_out[1]));
+        cover(x_two_complete);
+    end
+
+    wire unused = request_ready ^ frame_type[0] ^ frame_payload_len[0] ^
+        frame_payload[0] ^ ptc_percent[0] ^ fan_percent[0] ^
+        solenoid_percent[0] ^ state_hash16[0] ^ disabled ^
+        watchdog_timeout ^ x_spec_steps_left[0] ^ y_spec_steps_left[0] ^
+        dut_state[0] ^ past_valid;
+endmodule
+
+// A complete CRC-correct JOG must use the RX fast exit even while an older
+// ordinary request is held. Axis, direction, speed, and steps remain symbolic;
+// the classifier intentionally has no assumption on the raw 16-bit steps.
+module prod2u_p4_fast_jog_rx_formal;
+    (* gclk *) reg clk;
+    reg rst_n = 1'b0;
+    reg [6:0] stream_index = 7'd0;
+    reg [15:0] harness_crc = 16'hffff;
+    reg held_request_seen = 1'b0;
+    reg fast_event_seen = 1'b0;
+    reg fast_event_previous = 1'b0;
+    reg [7:0] held_request_type = 8'd0;
+    reg [5:0] held_request_length = 6'd0;
+    reg [271:0] held_request_payload = 272'd0;
+    reg [15:0] held_request_crc16 = 16'd0;
+
+    (* anyconst *) reg [1:0] jog_axis;
+    (* anyconst *) reg jog_dir;
+    (* anyconst *) reg [1:0] jog_speed;
+    (* anyconst *) reg [15:0] jog_steps;
+
+    wire first_frame = (stream_index <= 7'd19);
+    wire second_frame = (stream_index >= 7'd22) &&
+        (stream_index <= 7'd45);
+    wire drive_valid = rst_n && (first_frame || second_frame);
+    wire [6:0] local_index = second_frame ?
+        (stream_index - 7'd22) : stream_index;
+    wire [6:0] crc_low_index = second_frame ? 7'd22 : 7'd18;
+    wire [6:0] crc_high_index = second_frame ? 7'd23 : 7'd19;
+    reg [7:0] drive_data;
+    wire [15:0] harness_crc_next;
+
+    wire rx_ready;
+    wire request_valid;
+    wire [7:0] request_type;
+    wire [5:0] request_length;
+    wire [271:0] request_payload;
+    wire [15:0] request_crc16;
+    wire fast_jog_valid;
+    wire [1:0] fast_jog_axis;
+    wire fast_jog_dir;
+    wire [15:0] fast_jog_steps;
+    wire [15:0] crc_error_count;
+    wire [15:0] timeout_count;
+    wire [15:0] format_error_count;
+
+    binary921_crc16 u_harness_crc (
+        .crc_in(harness_crc),
+        .data(drive_data),
+        .crc_out(harness_crc_next)
+    );
+
+    prod2u_p4_normal_v3_rx #(
+        .CLK_HZ(1000),
+        .INTER_BYTE_TIMEOUT_MS(2)
+    ) dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .rx_valid(drive_valid),
+        .rx_ready(rx_ready),
+        .rx_data(drive_data),
+        .request_valid(request_valid),
+        .request_ready(1'b0),
+        .request_type(request_type),
+        .request_length(request_length),
+        .request_payload(request_payload),
+        .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
+        .crc_error_count(crc_error_count),
+        .timeout_count(timeout_count),
+        .format_error_count(format_error_count)
+    );
+
+    always @* begin
+        if (local_index == 7'd0) begin
+            drive_data = 8'ha5;
+        end else if (local_index == 7'd1) begin
+            drive_data = 8'h5a;
+        end else if (local_index == 7'd2) begin
+            drive_data = 8'h02;
+        end else if (local_index == 7'd3) begin
+            drive_data = 8'h04;
+        end else if (local_index == 7'd4) begin
+            drive_data = second_frame ? 8'h11 : 8'h05;
+        end else if (local_index >= 7'd5 && local_index <= 7'd12) begin
+            drive_data = 8'd0;
+        end else if (local_index == 7'd13) begin
+            drive_data = second_frame ? 8'd8 : 8'd4;
+        end else if (local_index < crc_low_index) begin
+            if (!second_frame) begin
+                case (local_index)
+                    7'd14: drive_data = 8'h24;
+                    default: drive_data = 8'd0;
+                endcase
+            end else begin
+                case (local_index)
+                    7'd14: drive_data = 8'h35;
+                    7'd15: drive_data = {6'd0, jog_axis};
+                    7'd16: drive_data = {7'd0, jog_dir};
+                    7'd17: drive_data = {6'd0, jog_speed};
+                    7'd18: drive_data = jog_steps[7:0];
+                    7'd19: drive_data = jog_steps[15:8];
+                    default: drive_data = 8'd0;
+                endcase
+            end
+        end else if (local_index == crc_low_index) begin
+            drive_data = harness_crc[7:0];
+        end else begin
+            drive_data = harness_crc[15:8];
+        end
+    end
+
+    always @(posedge clk) begin
+        assume(jog_axis <= 2'd1);
+        rst_n <= 1'b1;
+        fast_event_previous <= fast_jog_valid;
+
+        if (!rst_n) begin
+            stream_index <= 7'd0;
+            harness_crc <= 16'hffff;
+            held_request_seen <= 1'b0;
+            fast_event_seen <= 1'b0;
+            fast_event_previous <= 1'b0;
+            held_request_type <= 8'd0;
+            held_request_length <= 6'd0;
+            held_request_payload <= 272'd0;
+            held_request_crc16 <= 16'd0;
+        end else begin
+            assert(rx_ready);
+            assert(crc_error_count == 16'd0);
+            assert(timeout_count == 16'd0);
+            assert(format_error_count == 16'd0);
+
+            if (stream_index < 7'd50) begin
+                stream_index <= stream_index + 1'b1;
+            end
+            if (drive_valid && (local_index >= 7'd2) &&
+                (local_index < crc_low_index)) begin
+                harness_crc <= harness_crc_next;
+            end else if (drive_valid && (local_index == crc_high_index)) begin
+                harness_crc <= 16'hffff;
+            end
+
+            if (request_valid && !held_request_seen) begin
+                held_request_seen <= 1'b1;
+                held_request_type <= request_type;
+                held_request_length <= request_length;
+                held_request_payload <= request_payload;
+                held_request_crc16 <= request_crc16;
+                assert(request_type == 8'h05);
+                assert(request_length == 6'd4);
+                assert(request_payload == {240'd0, 32'h00000024});
+            end
+            if (held_request_seen) begin
+                assert(request_valid);
+                assert(request_type == held_request_type);
+                assert(request_length == held_request_length);
+                assert(request_payload == held_request_payload);
+                assert(request_crc16 == held_request_crc16);
+            end
+
+            if (fast_jog_valid) begin
+                assert(!fast_event_previous);
+                assert(!fast_event_seen);
+                assert(held_request_seen);
+                assert(fast_jog_axis == jog_axis);
+                assert(fast_jog_dir == jog_dir);
+                assert(fast_jog_steps == jog_steps);
+                fast_event_seen <= 1'b1;
+            end
+            if (stream_index >= 7'd48) begin
+                assert(held_request_seen);
+                assert(fast_event_seen);
+            end
+        end
+
+        cover(fast_event_seen && held_request_seen);
+    end
+endmodule
+
+// The small-parameter proof above supplies the independent countdown oracle.
+// This production instance proves the exact reload constants and every local
+// transition, which establishes 25,000 setup clocks and 12,500 clocks for each
+// STEP level without unrolling those full intervals.
+module prod2u_p4_fast_jog_production_timing_formal;
+    localparam integer PRODUCTION_DIR_SETUP_CYCLES = 25000;
+    localparam integer PRODUCTION_STEP_HALF_CYCLES = 12500;
+
+    (* gclk *) reg clk;
+    reg rst_n = 1'b0;
+    (* anyseq *) reg fast_jog_valid;
+    (* anyseq *) reg fast_jog_dir;
+    (* anyseq *) reg [15:0] fast_jog_steps;
+    reg past_valid = 1'b0;
+
+    wire dut_step;
+    wire dut_dir;
+    wire dut_started;
+    wire [1:0] dut_motion_phase;
+    wire [31:0] dut_phase_counter;
+    wire [15:0] dut_remaining_steps;
+
+    prod2u_p4_axis_executor #(
+        .DIR_SETUP_CYCLES(PRODUCTION_DIR_SETUP_CYCLES),
+        .STEP_HALF_CYCLES(PRODUCTION_STEP_HALF_CYCLES)
+    ) dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .command_start(fast_jog_valid),
+        .command_dir(fast_jog_dir),
+        .command_steps(fast_jog_steps),
+        .step_out(dut_step),
+        .dir_out(dut_dir),
+        .started_pulse(dut_started),
+        .formal_motion_phase(dut_motion_phase),
+        .formal_phase_counter(dut_phase_counter),
+        .formal_remaining_steps(dut_remaining_steps)
+    );
+
+    always @(posedge clk) begin
+        past_valid <= 1'b1;
+        rst_n <= 1'b1;
+        if (rst_n && fast_jog_valid) begin
+            assume(fast_jog_steps != 16'd0);
+        end
+
+        if (!rst_n) begin
+            assert(!dut_step);
+            assert(!dut_started);
+        end
+
+        if (past_valid && $past(rst_n)) begin
+            if ($past(fast_jog_valid)) begin
+                assert(dut_motion_phase == 2'd1);
+                assert(dut_phase_counter == 32'd24999);
+                assert(dut_remaining_steps == $past(fast_jog_steps));
+                assert(dut_dir == $past(fast_jog_dir));
+                assert(!dut_step);
+                assert(!dut_started);
+            end else begin
+                case ($past(dut_motion_phase))
+                    2'd0: begin
+                        assert(dut_motion_phase == 2'd0);
+                        assert(dut_phase_counter == 32'd0);
+                        assert(dut_remaining_steps == 16'd0);
+                        assert(!dut_step);
+                        assert(!dut_started);
+                    end
+
+                    2'd1: begin
+                        if ($past(dut_phase_counter) != 32'd0) begin
+                            assert(dut_motion_phase == 2'd1);
+                            assert(dut_phase_counter ==
+                                $past(dut_phase_counter) - 1'b1);
+                            assert(!dut_step);
+                            assert(!dut_started);
+                        end else begin
+                            assert(dut_motion_phase == 2'd2);
+                            assert(dut_phase_counter == 32'd12499);
+                            assert(dut_step);
+                            assert(dut_started);
+                        end
+                        assert(dut_remaining_steps ==
+                            $past(dut_remaining_steps));
+                        assert(dut_dir == $past(dut_dir));
+                    end
+
+                    2'd2: begin
+                        if ($past(dut_phase_counter) != 32'd0) begin
+                            assert(dut_motion_phase == 2'd2);
+                            assert(dut_phase_counter ==
+                                $past(dut_phase_counter) - 1'b1);
+                            assert(dut_step);
+                        end else begin
+                            assert(dut_motion_phase == 2'd3);
+                            assert(dut_phase_counter == 32'd12499);
+                            assert(!dut_step);
+                        end
+                        assert(dut_remaining_steps ==
+                            $past(dut_remaining_steps));
+                        assert(dut_dir == $past(dut_dir));
+                        assert(!dut_started);
+                    end
+
+                    2'd3: begin
+                        if ($past(dut_phase_counter) != 32'd0) begin
+                            assert(dut_motion_phase == 2'd3);
+                            assert(dut_phase_counter ==
+                                $past(dut_phase_counter) - 1'b1);
+                            assert(dut_remaining_steps ==
+                                $past(dut_remaining_steps));
+                            assert(!dut_step);
+                        end else if ($past(dut_remaining_steps) == 16'd1) begin
+                            assert(dut_motion_phase == 2'd0);
+                            assert(dut_phase_counter == 32'd0);
+                            assert(dut_remaining_steps == 16'd0);
+                            assert(!dut_step);
+                        end else begin
+                            assert(dut_motion_phase == 2'd2);
+                            assert(dut_phase_counter == 32'd12499);
+                            assert(dut_remaining_steps ==
+                                $past(dut_remaining_steps) - 1'b1);
+                            assert(dut_step);
+                        end
+                        assert(dut_dir == $past(dut_dir));
+                        assert(!dut_started);
+                    end
+                endcase
+            end
+            assert(!dut_started || dut_step);
+        end
+        cover(rst_n && fast_jog_valid && (fast_jog_steps == 16'hffff));
+    end
+endmodule
+
+`default_nettype wire

+ 12 - 19
tests/formal/prod2u_p4_normal_v3_rx_formal.v

@@ -15,6 +15,10 @@ module prod2u_p4_normal_v3_rx_formal;
     wire [5:0] request_length;
     wire [271:0] request_payload;
     wire [15:0] request_crc16;
+    wire fast_jog_valid;
+    wire [1:0] fast_jog_axis;
+    wire fast_jog_dir;
+    wire [15:0] fast_jog_steps;
     wire [15:0] crc_error_count;
     wire [15:0] timeout_count;
     wire [15:0] format_error_count;
@@ -73,6 +77,10 @@ module prod2u_p4_normal_v3_rx_formal;
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
         .crc_error_count(crc_error_count),
         .timeout_count(timeout_count),
         .format_error_count(format_error_count)
@@ -105,27 +113,12 @@ module prod2u_p4_normal_v3_rx_formal;
         end
 
         if (rst_n) begin
-            assert(rx_ready == !request_valid);
+            assert(rx_ready);
         end
 
         if (past_valid && $past(rst_n)) begin
             if ($past(request_valid && !request_ready)) begin
                 assert(request_valid);
-                assert(!rx_ready);
-                assert(request_type == $past(request_type));
-                assert(request_length == $past(request_length));
-                assert(request_crc16 == $past(request_crc16));
-                assert(request_payload[payload_low_bit] ==
-                    $past(request_payload[payload_low_bit]));
-                assert(request_payload[9'd256 + payload_high_bit] ==
-                    $past(request_payload[9'd256 + payload_high_bit]));
-                assert(crc_error_count == $past(crc_error_count));
-                assert(timeout_count == $past(timeout_count));
-                assert(format_error_count == $past(format_error_count));
-            end
-
-            if ($past(request_valid && request_ready)) begin
-                assert(!request_valid);
                 assert(rx_ready);
                 assert(request_type == $past(request_type));
                 assert(request_length == $past(request_length));
@@ -134,9 +127,6 @@ module prod2u_p4_normal_v3_rx_formal;
                     $past(request_payload[payload_low_bit]));
                 assert(request_payload[9'd256 + payload_high_bit] ==
                     $past(request_payload[9'd256 + payload_high_bit]));
-                assert(crc_error_count == $past(crc_error_count));
-                assert(timeout_count == $past(timeout_count));
-                assert(format_error_count == $past(format_error_count));
             end
         end
 
@@ -144,4 +134,7 @@ module prod2u_p4_normal_v3_rx_formal;
         cover(handshake_seen);
         cover(recovery_seen);
     end
+
+    wire unused_fast_jog = fast_jog_valid ^ fast_jog_axis[0] ^
+        fast_jog_dir ^ fast_jog_steps[0];
 endmodule

+ 30 - 9
tests/formal/prod2u_p4_normal_v3_rx_payload_formal.v

@@ -6,8 +6,9 @@ module prod2u_p4_normal_v3_rx_payload_formal;
     reg [6:0] frame_index = 7'd0;
     reg request_seen = 1'b0;
     reg [15:0] harness_crc = 16'hffff;
-    reg [271:0] expected_payload = 272'd0;
+    reg expected_payload_bit = 1'b0;
     (* anyconst *) reg [1:0] command_kind;
+    (* anyconst *) reg [8:0] payload_bit_index;
     (* anyseq *) reg [7:0] payload_byte;
 
     wire [7:0] selected_type = (command_kind == 2'd0) ? 8'h05 :
@@ -16,6 +17,8 @@ module prod2u_p4_normal_v3_rx_payload_formal;
         (command_kind == 2'd1) ? 6'd34 : 6'd8;
     wire [6:0] crc_low_index = 7'd14 + selected_length;
     wire [6:0] crc_high_index = 7'd15 + selected_length;
+    wire [5:0] selected_payload_byte = payload_bit_index[8:3];
+    wire [2:0] selected_payload_bit = payload_bit_index[2:0];
     wire drive_valid = rst_n && (frame_index <= crc_high_index);
     reg [7:0] drive_data;
 
@@ -25,6 +28,10 @@ module prod2u_p4_normal_v3_rx_payload_formal;
     wire [5:0] request_length;
     wire [271:0] request_payload;
     wire [15:0] request_crc16;
+    wire fast_jog_valid;
+    wire [1:0] fast_jog_axis;
+    wire fast_jog_dir;
+    wire [15:0] fast_jog_steps;
     wire [15:0] crc_error_count;
     wire [15:0] timeout_count;
     wire [15:0] format_error_count;
@@ -51,6 +58,10 @@ module prod2u_p4_normal_v3_rx_payload_formal;
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
         .crc_error_count(crc_error_count),
         .timeout_count(timeout_count),
         .format_error_count(format_error_count)
@@ -86,13 +97,17 @@ module prod2u_p4_normal_v3_rx_payload_formal;
 
     always @(posedge clk) begin
         assume(command_kind < 2'd3);
+        assume(payload_bit_index < 9'd272);
+        if (command_kind == 2'd2 && frame_index == 7'd14) begin
+            assume(payload_byte != 8'h35);
+        end
         rst_n <= 1'b1;
 
         if (!rst_n) begin
             frame_index <= 7'd0;
             request_seen <= 1'b0;
             harness_crc <= 16'hffff;
-            expected_payload <= 272'd0;
+            expected_payload_bit <= 1'b0;
         end else begin
             if (drive_valid) begin
                 assert(rx_ready);
@@ -100,9 +115,9 @@ module prod2u_p4_normal_v3_rx_payload_formal;
                 if (frame_index >= 7'd2 && frame_index < crc_low_index) begin
                     harness_crc <= harness_crc_next;
                 end
-                if (frame_index >= 7'd14 && frame_index < crc_low_index) begin
-                    expected_payload[(frame_index - 7'd14) * 8 +: 8] <=
-                        drive_data;
+                if (frame_index >= 7'd14 && frame_index < crc_low_index &&
+                        frame_index == (7'd14 + selected_payload_byte)) begin
+                    expected_payload_bit <= drive_data[selected_payload_bit];
                 end
             end
 
@@ -111,7 +126,11 @@ module prod2u_p4_normal_v3_rx_payload_formal;
                 assert(request_type == selected_type);
                 assert(request_length == selected_length);
                 assert(request_crc16 == harness_crc);
-                assert(request_payload == expected_payload);
+                if (selected_payload_byte < selected_length) begin
+                    assert(request_payload[payload_bit_index] == expected_payload_bit);
+                end else begin
+                    assert(request_payload[payload_bit_index] == 1'b0);
+                end
                 assert(crc_error_count == 16'd0);
                 assert(timeout_count == 16'd0);
                 assert(format_error_count == 16'd0);
@@ -119,12 +138,14 @@ module prod2u_p4_normal_v3_rx_payload_formal;
                     assert(request_payload[7:0] == 8'h26);
                 end
             end
+            assert(!fast_jog_valid);
 
-            if (frame_index >= (crc_high_index + 7'd2)) begin
-                assert(request_seen);
+            if (frame_index >= (crc_high_index + 7'd1)) begin
+                assert(request_valid || request_seen);
             end
         end
     end
 
-    wire unused_request = request_seen;
+    wire unused_request = request_seen ^ fast_jog_axis[0] ^
+        fast_jog_dir ^ fast_jog_steps[0];
 endmodule

+ 17 - 13
tests/sim/prod2u_p4_completion_ack_contract_tb.v

@@ -18,6 +18,10 @@ module prod2u_p4_completion_ack_contract_tb;
     reg [5:0] request_length = 6'd0;
     reg [271:0] request_payload = 272'd0;
     reg [15:0] request_crc16 = 16'd0;
+    reg fast_jog_valid = 1'b0;
+    reg [1:0] fast_jog_axis = 2'd0;
+    reg fast_jog_dir = 1'b0;
+    reg [15:0] fast_jog_steps = 16'd1;
     wire frame_valid;
     wire [7:0] frame_type;
     wire [7:0] frame_payload_len;
@@ -70,6 +74,10 @@ module prod2u_p4_completion_ack_contract_tb;
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
         .frame_valid(frame_valid),
         .frame_ready(1'b1),
         .frame_type(frame_type),
@@ -102,6 +110,10 @@ module prod2u_p4_completion_ack_contract_tb;
             request_length = 6'd0;
             request_payload = 272'd0;
             request_crc16 = 16'd0;
+            fast_jog_valid = 1'b0;
+            fast_jog_axis = 2'd0;
+            fast_jog_dir = 1'b0;
+            fast_jog_steps = 16'd1;
             overlap_seen = 1'b0;
             repeat (4) @(negedge clk);
             rst_n = 1'b1;
@@ -127,22 +139,14 @@ module prod2u_p4_completion_ack_contract_tb;
         input [15:0] steps;
         input [15:0] crc;
         begin
-            wait_ready("JOG request did not become ready");
             @(negedge clk);
-            request_type = FT_MOTION_CMD;
-            request_length = 6'd8;
-            request_payload = 272'd0;
-            request_payload[7:0] = MOTION_JOG;
-            request_payload[15:8] = {6'd0, axis};
-            request_payload[23:16] = {7'd0, direction};
-            request_payload[31:24] = 8'd3;
-            request_payload[47:32] = steps;
             request_crc16 = crc;
-            request_valid = 1'b1;
-            @(posedge clk);
-            #1;
+            fast_jog_axis = axis;
+            fast_jog_dir = direction;
+            fast_jog_steps = steps;
+            fast_jog_valid = 1'b1;
             @(negedge clk);
-            request_valid = 1'b0;
+            fast_jog_valid = 1'b0;
         end
     endtask
 

+ 15 - 7
tests/sim/prod2u_p4_core_watchdog_refresh_tb.v

@@ -19,6 +19,10 @@ module prod2u_p4_core_watchdog_refresh_tb;
     reg [5:0] request_length = 6'd0;
     reg [271:0] request_payload = 272'd0;
     reg [15:0] request_crc16 = 16'd0;
+    reg fast_jog_valid = 1'b0;
+    reg [1:0] fast_jog_axis = 2'd0;
+    reg fast_jog_dir = 1'b0;
+    reg [15:0] fast_jog_steps = 16'd1;
     wire frame_valid;
     wire [7:0] frame_type;
     wire [143:0] frame_payload;
@@ -53,6 +57,10 @@ module prod2u_p4_core_watchdog_refresh_tb;
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
         .frame_valid(frame_valid),
         .frame_ready(1'b1),
         .frame_type(frame_type),
@@ -137,13 +145,13 @@ module prod2u_p4_core_watchdog_refresh_tb;
     task issue_jog;
         input [15:0] steps;
         begin
-            payload = 272'd0;
-            payload[7:0] = MOTION_JOG;
-            payload[15:8] = 8'd0;
-            payload[23:16] = 8'd1;
-            payload[31:24] = 8'd3;
-            payload[47:32] = steps;
-            send_request(FT_MOTION_CMD, 6'd8, payload);
+            @(negedge clk);
+            fast_jog_axis = 2'd0;
+            fast_jog_dir = 1'b1;
+            fast_jog_steps = steps;
+            fast_jog_valid = 1'b1;
+            @(negedge clk);
+            fast_jog_valid = 1'b0;
             expect_ack(MOTION_JOG);
         end
     endtask

+ 365 - 0
tests/sim/prod2u_p4_fast_jog_core_tb.v

@@ -0,0 +1,365 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_fast_jog_core_tb;
+    localparam [7:0] FT_HOST_CMD = 8'h05;
+    localparam [7:0] FT_HOST_BATCH_CMD = 8'h07;
+    localparam [7:0] FT_HOST_ACK = 8'h06;
+    localparam [7:0] CMD_GET_STATUS = 8'h24;
+    localparam [7:0] CMD_SET_SNAPSHOT = 8'h2a;
+    localparam [7:0] MOTION_JOG = 8'h35;
+
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg request_valid = 1'b0;
+    wire request_ready;
+    reg [7:0] request_type = 8'd0;
+    reg [5:0] request_length = 6'd0;
+    reg [271:0] request_payload = 272'd0;
+    reg [15:0] request_crc16 = 16'd0;
+    reg fast_jog_valid = 1'b0;
+    reg [1:0] fast_jog_axis = 2'd0;
+    reg fast_jog_dir = 1'b0;
+    reg [15:0] fast_jog_steps = 16'd1;
+    wire frame_valid;
+    reg frame_ready = 1'b0;
+    wire [7:0] frame_type;
+    wire [7:0] frame_payload_len;
+    wire [143:0] frame_payload;
+    wire [191:0] ptc_percent;
+    wire [31:0] fan_percent;
+    wire [7:0] solenoid_percent;
+    wire [2:0] step_out;
+    wire [2:0] dir_out;
+    wire en_n;
+    wire disabled;
+    wire watchdog_timeout;
+
+    integer failures = 0;
+    integer guard;
+    integer index;
+    integer x_rises = 0;
+    integer y_rises = 0;
+    integer ack_count = 0;
+    reg [7:0] ack_commands [0:15];
+    reg overlap_seen = 1'b0;
+
+    always #5 clk = ~clk;
+    always @(posedge step_out[0]) x_rises = x_rises + 1;
+    always @(posedge step_out[1]) y_rises = y_rises + 1;
+
+    always @(negedge clk) begin
+        if (!rst_n) begin
+            ack_count = 0;
+        end else if (frame_valid && frame_ready && (frame_type == FT_HOST_ACK)) begin
+            ack_commands[ack_count] = frame_payload[15:8];
+            ack_count = ack_count + 1;
+        end
+    end
+
+    always @(posedge clk) begin
+        #1;
+        if (!rst_n) overlap_seen = 1'b0;
+        else if (step_out[0] && step_out[1]) overlap_seen = 1'b1;
+    end
+
+    prod2u_p4_normal_v3_core #(
+        .CLK_HZ(128),
+        .WATCHDOG_SECONDS(1),
+        .DIR_SETUP_CYCLES(8),
+        .STEP_HALF_CYCLES(2)
+    ) dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .request_valid(request_valid),
+        .request_ready(request_ready),
+        .request_type(request_type),
+        .request_length(request_length),
+        .request_payload(request_payload),
+        .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
+        .frame_valid(frame_valid),
+        .frame_ready(frame_ready),
+        .frame_type(frame_type),
+        .frame_payload_len(frame_payload_len),
+        .frame_payload(frame_payload),
+        .ptc_percent(ptc_percent),
+        .fan_percent(fan_percent),
+        .solenoid_percent(solenoid_percent),
+        .state_hash16(),
+        .step_out(step_out),
+        .dir_out(dir_out),
+        .en_n(en_n),
+        .disabled(disabled),
+        .watchdog_timeout(watchdog_timeout)
+    );
+
+    task fail;
+        input [8*120-1:0] message;
+        begin
+            failures = failures + 1;
+            $display("FAST_JOG_CORE_FAIL: %0s", message);
+        end
+    endtask
+
+    task reset_core;
+        begin
+            rst_n = 1'b0;
+            request_valid = 1'b0;
+            request_type = 8'd0;
+            request_length = 6'd0;
+            request_payload = 272'd0;
+            request_crc16 = 16'd0;
+            fast_jog_valid = 1'b0;
+            fast_jog_axis = 2'd0;
+            fast_jog_dir = 1'b0;
+            fast_jog_steps = 16'd1;
+            frame_ready = 1'b0;
+            repeat (4) @(negedge clk);
+            rst_n = 1'b1;
+            repeat (4) @(negedge clk);
+        end
+    endtask
+
+    task wait_request_ready;
+        input [8*80-1:0] label_text;
+        begin
+            guard = 0;
+            while (!request_ready && guard < 256) begin
+                @(negedge clk);
+                guard = guard + 1;
+            end
+            if (!request_ready) fail(label_text);
+        end
+    endtask
+
+    task pulse_get_status;
+        begin
+            wait_request_ready("GET_STATUS request never became ready");
+            @(negedge clk);
+            request_type = FT_HOST_CMD;
+            request_length = 6'd4;
+            request_payload = 272'd0;
+            request_payload[7:0] = CMD_GET_STATUS;
+            request_crc16 = 16'h2401;
+            request_valid = 1'b1;
+            @(negedge clk);
+            request_valid = 1'b0;
+        end
+    endtask
+
+    task pulse_snapshot;
+        begin
+            wait_request_ready("snapshot request never became ready");
+            @(negedge clk);
+            request_type = FT_HOST_BATCH_CMD;
+            request_length = 6'd34;
+            request_payload = 272'd0;
+            request_payload[7:0] = CMD_SET_SNAPSHOT;
+            for (index = 0; index < 24; index = index + 1)
+                request_payload[(index + 2) * 8 +: 8] = 8'd10;
+            for (index = 0; index < 4; index = index + 1)
+                request_payload[(index + 26) * 8 +: 8] = 8'd30;
+            request_payload[30 * 8 +: 8] = 8'd0;
+            request_crc16 = 16'h2a01;
+            request_valid = 1'b1;
+            @(negedge clk);
+            request_valid = 1'b0;
+        end
+    endtask
+
+    task pulse_fast_jog;
+        input [1:0] axis;
+        input direction;
+        input [15:0] steps;
+        begin
+            @(negedge clk);
+            fast_jog_axis = axis;
+            fast_jog_dir = direction;
+            fast_jog_steps = steps;
+            fast_jog_valid = 1'b1;
+            @(negedge clk);
+            fast_jog_valid = 1'b0;
+        end
+    endtask
+
+    task wait_axis_rises;
+        input [1:0] axis;
+        input integer baseline;
+        input integer expected;
+        input [8*100-1:0] label_text;
+        integer observed;
+        begin
+            guard = 0;
+            observed = 0;
+            while ((observed < expected) && (guard < 4096)) begin
+                @(posedge clk);
+                #1;
+                observed = (axis == 2'd0) ?
+                    (x_rises - baseline) : (y_rises - baseline);
+                guard = guard + 1;
+            end
+            if (observed != expected) begin
+                $display("FAST_JOG_COUNT axis=%0d expected=%0d observed=%0d",
+                    axis, expected, observed);
+                fail(label_text);
+            end
+        end
+    endtask
+
+    task wait_ack_total;
+        input integer expected;
+        input [8*100-1:0] label_text;
+        begin
+            guard = 0;
+            while ((ack_count < expected) && (guard < 1024)) begin
+                @(posedge clk);
+                #1;
+                guard = guard + 1;
+            end
+            if (ack_count < expected) fail(label_text);
+        end
+    endtask
+
+    task run_stalled_response_case;
+        integer x_before;
+        begin
+            reset_core();
+            pulse_get_status();
+
+            guard = 0;
+            while (!frame_valid && guard < 64) begin
+                @(posedge clk);
+                #1;
+                guard = guard + 1;
+            end
+            if (!frame_valid || frame_type != FT_HOST_ACK ||
+                frame_payload[15:8] != CMD_GET_STATUS)
+                fail("old GET_STATUS ACK was not held under TX backpressure");
+            if (request_ready)
+                fail("old response did not establish command_inflight backpressure");
+
+            x_before = x_rises;
+            pulse_fast_jog(2'd0, 1'b1, 16'd4);
+            wait_axis_rises(2'd0, x_before, 4,
+                "fast X JOG did not finish while the old response was stalled");
+            if (!frame_valid || frame_payload[15:8] != CMD_GET_STATUS)
+                fail("fast JOG replaced the stalled old ACK instead of queuing");
+            if (ack_count != 0)
+                fail("an ACK handshook while frame_ready was low");
+
+            frame_ready = 1'b1;
+            wait_ack_total(2, "stalled old ACK and pending JOG ACK did not drain");
+            if (ack_commands[0] != CMD_GET_STATUS ||
+                ack_commands[1] != MOTION_JOG)
+                fail("response order was not old ACK followed by JOG ACK");
+        end
+    endtask
+
+    task run_core_nonidle_case;
+        integer y_before;
+        begin
+            reset_core();
+            pulse_snapshot();
+            if (request_ready)
+                fail("snapshot did not put the core into a non-IDLE interval");
+            y_before = y_rises;
+            pulse_fast_jog(2'd1, 1'b0, 16'd3);
+            wait_axis_rises(2'd1, y_before, 3,
+                "fast Y JOG was blocked by the non-IDLE snapshot state");
+        end
+    endtask
+
+    task run_fast_ack_priority_case;
+        integer x_before;
+        begin
+            reset_core();
+            frame_ready = 1'b1;
+            x_before = x_rises;
+            pulse_fast_jog(2'd0, 1'b0, 16'd2);
+            if (request_ready)
+                fail("ordinary request remained ready while fast JOG ACK was pending");
+            wait_ack_total(1, "fast JOG ACK did not win the next response slot");
+            if (ack_commands[0] != MOTION_JOG)
+                fail("a subsequent ordinary request could precede the fast JOG ACK");
+            wait_axis_rises(2'd0, x_before, 2,
+                "fast ACK priority check changed X motion execution");
+        end
+    endtask
+
+    task run_latest_wins_ack_case;
+        integer x_before;
+        integer replacement_before;
+        begin
+            reset_core();
+            pulse_get_status();
+            guard = 0;
+            while (!frame_valid && guard < 64) begin
+                @(posedge clk);
+                #1;
+                guard = guard + 1;
+            end
+            if (!frame_valid || frame_payload[15:8] != CMD_GET_STATUS)
+                fail("latest-wins case did not stall an old response");
+
+            x_before = x_rises;
+            pulse_fast_jog(2'd0, 1'b0, 16'd20);
+            wait_axis_rises(2'd0, x_before, 1,
+                "first dense JOG never reached its first STEP");
+
+            replacement_before = x_rises;
+            pulse_fast_jog(2'd0, 1'b1, 16'd2);
+            wait_axis_rises(2'd0, replacement_before, 2,
+                "latest dense JOG did not replace the old X motion");
+
+            frame_ready = 1'b1;
+            wait_ack_total(2,
+                "old response and latest dense JOG ACK did not drain");
+            repeat (64) @(posedge clk);
+            #1;
+            if (ack_count != 2 || ack_commands[0] != CMD_GET_STATUS ||
+                ack_commands[1] != MOTION_JOG)
+                fail("dense JOGs retained more than the latest pending ACK");
+        end
+    endtask
+
+    task run_cross_axis_case;
+        integer x_before;
+        integer y_before;
+        begin
+            reset_core();
+            frame_ready = 1'b1;
+            x_before = x_rises;
+            y_before = y_rises;
+
+            pulse_fast_jog(2'd0, 1'b0, 16'd20);
+            wait_ack_total(1, "X first STEP did not produce a JOG ACK");
+            if (ack_commands[0] != MOTION_JOG || x_rises == x_before)
+                fail("X ACK was not tied to the first X STEP");
+
+            pulse_fast_jog(2'd1, 1'b1, 16'd6);
+            wait_ack_total(2, "Y first STEP did not produce a JOG ACK");
+            wait_axis_rises(2'd0, x_before, 20,
+                "X motion did not continue after its ACK");
+            wait_axis_rises(2'd1, y_before, 6,
+                "Y motion did not complete after its ACK");
+            if (!overlap_seen)
+                fail("X and Y STEP waveforms never overlapped");
+        end
+    endtask
+
+    initial begin
+        run_stalled_response_case();
+        run_core_nonidle_case();
+        run_fast_ack_priority_case();
+        run_latest_wins_ack_case();
+        run_cross_axis_case();
+
+        if (failures != 0)
+            $fatal(1, "prod2u_p4_fast_jog_core_tb RED failures=%0d", failures);
+        $display("PASS: prod2u_p4_fast_jog_core_tb");
+        $finish;
+    end
+endmodule

+ 24 - 7
tests/sim/prod2u_p4_minimal_snapshot_contract_tb.v

@@ -17,6 +17,10 @@ module prod2u_p4_minimal_snapshot_contract_tb;
     reg [5:0] request_length = 6'd0;
     reg [271:0] request_payload = 272'd0;
     reg [15:0] request_crc16 = 16'd0;
+    reg fast_jog_valid = 1'b0;
+    reg [1:0] fast_jog_axis = 2'd0;
+    reg fast_jog_dir = 1'b0;
+    reg [15:0] fast_jog_steps = 16'd1;
     wire frame_valid;
     wire [7:0] frame_type;
     wire [143:0] frame_payload;
@@ -56,6 +60,10 @@ module prod2u_p4_minimal_snapshot_contract_tb;
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
         .frame_valid(frame_valid),
         .frame_ready(1'b1),
         .frame_type(frame_type),
@@ -129,6 +137,21 @@ module prod2u_p4_minimal_snapshot_contract_tb;
         end
     endtask
 
+    task issue_fast_jog;
+        input [1:0] axis;
+        input direction;
+        input [15:0] steps;
+        begin
+            @(negedge clk);
+            fast_jog_axis = axis;
+            fast_jog_dir = direction;
+            fast_jog_steps = steps;
+            fast_jog_valid = 1'b1;
+            @(negedge clk);
+            fast_jog_valid = 1'b0;
+        end
+    endtask
+
     function [271:0] snapshot_bytes;
         input [7:0] output_value;
         input [7:0] solenoid_value;
@@ -173,14 +196,8 @@ module prod2u_p4_minimal_snapshot_contract_tb;
             solenoid_percent != 8'd100 || step_out != 3'b000)
             fail("valid snapshot did not commit only non-motor outputs");
 
-        payload = 272'd0;
-        payload[7:0] = MOTION_JOG;
-        payload[15:8] = 8'd0;
-        payload[23:16] = 8'd1;
-        payload[31:24] = 8'd3;
-        payload[47:32] = 16'd100;
         x_before = x_rises;
-        issue_request(FT_MOTION_CMD, 6'd8, payload);
+        issue_fast_jog(2'd0, 1'b1, 16'd100);
         expect_ack(MOTION_JOG, STATUS_OK);
         if ((x_rises - x_before) < 1 || dir_out[0] !== 1'b1)
             fail("JOG ACK preceded physical STEP");

+ 327 - 0
tests/sim/prod2u_p4_normal_v3_rx_fast_jog_tb.v

@@ -0,0 +1,327 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_normal_v3_rx_fast_jog_tb;
+    localparam [7:0] HOST_CMD = 8'h05;
+    localparam [7:0] MOTION_CMD = 8'h11;
+    localparam [7:0] MOTION_JOG = 8'h35;
+
+    reg clk;
+    reg rst_n;
+    reg rx_valid;
+    wire rx_ready;
+    reg [7:0] rx_data;
+    wire request_valid;
+    reg request_ready;
+    wire [7:0] request_type;
+    wire [5:0] request_length;
+    wire [271:0] request_payload;
+    wire [15:0] request_crc16;
+    wire [15:0] crc_error_count;
+    wire [15:0] timeout_count;
+    wire [15:0] format_error_count;
+    wire fast_jog_valid;
+    wire [1:0] fast_jog_axis;
+    wire fast_jog_dir;
+    wire [15:0] fast_jog_steps;
+
+    reg [7:0] frame [0:49];
+    integer frame_length;
+    integer i;
+    integer ready_guard;
+    integer fast_event_count;
+    reg fast_valid_previous;
+    reg [1:0] last_fast_axis;
+    reg last_fast_dir;
+    reg [15:0] last_fast_steps;
+    reg check_held_request;
+    reg [7:0] held_request_type;
+    reg [5:0] held_request_length;
+    reg [271:0] held_request_payload;
+    reg [15:0] held_request_crc16;
+
+    prod2u_p4_normal_v3_rx #(
+        .CLK_HZ(10000),
+        .INTER_BYTE_TIMEOUT_MS(2)
+    ) dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .rx_valid(rx_valid),
+        .rx_ready(rx_ready),
+        .rx_data(rx_data),
+        .request_valid(request_valid),
+        .request_ready(request_ready),
+        .request_type(request_type),
+        .request_length(request_length),
+        .request_payload(request_payload),
+        .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
+        .crc_error_count(crc_error_count),
+        .timeout_count(timeout_count),
+        .format_error_count(format_error_count)
+    );
+
+    initial begin
+        clk = 1'b0;
+        forever #5 clk = ~clk;
+    end
+
+    always @(negedge clk) begin
+        if (!rst_n) begin
+            fast_event_count = 0;
+            fast_valid_previous = 1'b0;
+            last_fast_axis = 2'd0;
+            last_fast_dir = 1'b0;
+            last_fast_steps = 16'd0;
+        end else begin
+            if (fast_jog_valid) begin
+                if (fast_valid_previous) begin
+                    $fatal(1, "FAST_JOG_VALID_NOT_SINGLE_CYCLE");
+                end
+                fast_event_count = fast_event_count + 1;
+                last_fast_axis = fast_jog_axis;
+                last_fast_dir = fast_jog_dir;
+                last_fast_steps = fast_jog_steps;
+            end
+            fast_valid_previous = fast_jog_valid;
+
+            if (check_held_request &&
+                (!request_valid || request_type !== held_request_type ||
+                 request_length !== held_request_length ||
+                 request_payload !== held_request_payload ||
+                 request_crc16 !== held_request_crc16)) begin
+                $fatal(1, "FAST_JOG_OVERWROTE_HELD_NORMAL_REQUEST");
+            end
+        end
+    end
+
+    function [15:0] crc16_byte;
+        input [15:0] crc_in;
+        input [7:0] data;
+        reg [15:0] value;
+        integer bit_index;
+        begin
+            value = crc_in ^ {data, 8'h00};
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                if (value[15]) begin
+                    value = (value << 1) ^ 16'h1021;
+                end else begin
+                    value = value << 1;
+                end
+            end
+            crc16_byte = value;
+        end
+    endfunction
+
+    task begin_frame;
+        input [7:0] frame_type;
+        input [7:0] payload_length;
+        begin
+            for (i = 0; i < 50; i = i + 1) begin
+                frame[i] = 8'h00;
+            end
+            frame[0] = 8'ha5;
+            frame[1] = 8'h5a;
+            frame[2] = 8'h02;
+            frame[3] = 8'h04;
+            frame[4] = frame_type;
+            frame[13] = payload_length;
+            frame_length = 16 + payload_length;
+        end
+    endtask
+
+    task finish_frame;
+        reg [15:0] crc;
+        integer last_body_byte;
+        begin
+            crc = 16'hffff;
+            last_body_byte = frame_length - 3;
+            for (i = 2; i <= last_body_byte; i = i + 1) begin
+                crc = crc16_byte(crc, frame[i]);
+            end
+            frame[frame_length - 2] = crc[7:0];
+            frame[frame_length - 1] = crc[15:8];
+        end
+    endtask
+
+    task build_host_command;
+        input [7:0] command;
+        begin
+            begin_frame(HOST_CMD, 8'd4);
+            frame[14] = command;
+            finish_frame();
+        end
+    endtask
+
+    task build_jog;
+        input [7:0] opcode;
+        input [7:0] axis;
+        input [7:0] dir;
+        input [7:0] speed;
+        input [15:0] steps;
+        input [7:0] reserved0;
+        input [7:0] reserved1;
+        begin
+            begin_frame(MOTION_CMD, 8'd8);
+            frame[14] = opcode;
+            frame[15] = axis;
+            frame[16] = dir;
+            frame[17] = speed;
+            frame[18] = steps[7:0];
+            frame[19] = steps[15:8];
+            frame[20] = reserved0;
+            frame[21] = reserved1;
+            finish_frame();
+        end
+    endtask
+
+    task send_byte;
+        input [7:0] value;
+        begin
+            ready_guard = 0;
+            while (!rx_ready && ready_guard < 16) begin
+                @(negedge clk);
+                ready_guard = ready_guard + 1;
+            end
+            if (!rx_ready) begin
+                $fatal(1, "FAST_JOG_RX_BLOCKED_BY_HELD_REQUEST");
+            end
+            @(negedge clk);
+            rx_data = value;
+            rx_valid = 1'b1;
+            @(negedge clk);
+            rx_valid = 1'b0;
+        end
+    endtask
+
+    task send_built_frame;
+        begin
+            for (i = 0; i < frame_length; i = i + 1) begin
+                send_byte(frame[i]);
+            end
+        end
+    endtask
+
+    task expect_fast_event;
+        input [1:0] expected_axis;
+        input expected_dir;
+        input [15:0] expected_steps;
+        integer count_before;
+        integer wait_cycles;
+        begin
+            count_before = fast_event_count;
+            send_built_frame();
+            wait_cycles = 0;
+            while (fast_event_count == count_before && wait_cycles < 8) begin
+                @(negedge clk);
+                wait_cycles = wait_cycles + 1;
+            end
+            if (fast_event_count !== count_before + 1) begin
+                $fatal(1, "FAST_JOG_VALID_EVENT_COUNT_MISMATCH");
+            end
+            if (last_fast_axis !== expected_axis ||
+                last_fast_dir !== expected_dir ||
+                last_fast_steps !== expected_steps) begin
+                $fatal(1, "FAST_JOG_PAYLOAD_MISMATCH");
+            end
+            repeat (2) @(negedge clk);
+            if (fast_event_count !== count_before + 1) begin
+                $fatal(1, "FAST_JOG_VALID_EVENT_REPEATED");
+            end
+        end
+    endtask
+
+    task expect_no_fast_event;
+        integer count_before;
+        begin
+            count_before = fast_event_count;
+            send_built_frame();
+            repeat (4) @(negedge clk);
+            if (fast_event_count !== count_before) begin
+                $fatal(1, "INVALID_JOG_PRODUCED_FAST_EVENT");
+            end
+        end
+    endtask
+
+    initial begin
+        rst_n = 1'b0;
+        rx_valid = 1'b0;
+        rx_data = 8'h00;
+        request_ready = 1'b0;
+        fast_event_count = 0;
+        fast_valid_previous = 1'b0;
+        check_held_request = 1'b0;
+        repeat (4) @(negedge clk);
+        rst_n = 1'b1;
+        repeat (2) @(negedge clk);
+
+        // Fill the ordinary request slot and deliberately leave it pending.
+        build_host_command(8'h20);
+        send_built_frame();
+        repeat (2) @(negedge clk);
+        if (!request_valid) begin
+            $fatal(1, "NORMAL_REQUEST_DID_NOT_ENTER_HELD_SLOT");
+        end
+        held_request_type = request_type;
+        held_request_length = request_length;
+        held_request_payload = request_payload;
+        held_request_crc16 = request_crc16;
+        check_held_request = 1'b1;
+
+        // A held ordinary request must not backpressure the continuous parser.
+        build_jog(MOTION_JOG, 8'd1, 8'd1, 8'd3, 16'h1234, 8'd0, 8'd0);
+        expect_fast_event(2'd1, 1'b1, 16'h1234);
+
+        // The RTL trusts the host's raw u16 field. Zero is deliberately not gated.
+        build_jog(MOTION_JOG, 8'd0, 8'd0, 8'd0, 16'h0000, 8'd0, 8'd0);
+        expect_fast_event(2'd0, 1'b0, 16'h0000);
+
+        build_jog(MOTION_JOG, 8'd2, 8'd0, 8'd0, 16'd1, 8'd0, 8'd0);
+        expect_no_fast_event();
+        build_jog(MOTION_JOG, 8'd0, 8'd2, 8'd0, 16'd1, 8'd0, 8'd0);
+        expect_no_fast_event();
+        build_jog(MOTION_JOG, 8'd0, 8'd0, 8'd4, 16'd1, 8'd0, 8'd0);
+        expect_no_fast_event();
+        build_jog(MOTION_JOG, 8'd0, 8'd0, 8'd3, 16'd1, 8'd1, 8'd0);
+        expect_no_fast_event();
+        build_jog(MOTION_JOG, 8'd0, 8'd0, 8'd3, 16'd1, 8'd0, 8'd1);
+        expect_no_fast_event();
+        build_jog(8'h37, 8'd0, 8'd0, 8'd3, 16'd1, 8'd0, 8'd0);
+        expect_no_fast_event();
+        build_host_command(MOTION_JOG);
+        expect_no_fast_event();
+        begin_frame(MOTION_CMD, 8'd4);
+        frame[14] = MOTION_JOG;
+        frame[15] = 8'd0;
+        frame[16] = 8'd0;
+        frame[17] = 8'd0;
+        finish_frame();
+        expect_no_fast_event();
+
+        build_jog(MOTION_JOG, 8'd0, 8'd1, 8'd3, 16'h55aa, 8'd0, 8'd0);
+        frame[frame_length - 1] = frame[frame_length - 1] ^ 8'h01;
+        expect_no_fast_event();
+
+        // Consume the held normal request, then prove JOG uses only the fast path.
+        check_held_request = 1'b0;
+        request_ready = 1'b1;
+        @(posedge clk);
+        #1;
+        @(negedge clk);
+        if (request_valid) begin
+            $fatal(1, "HELD_NORMAL_REQUEST_DID_NOT_HANDSHAKE");
+        end
+        request_ready = 1'b0;
+
+        build_jog(MOTION_JOG, 8'd0, 8'd1, 8'd2, 16'hffff, 8'd0, 8'd0);
+        expect_fast_event(2'd0, 1'b1, 16'hffff);
+        if (request_valid) begin
+            $fatal(1, "VALID_JOG_LEAKED_INTO_NORMAL_REQUEST_SLOT");
+        end
+
+        $display("PASS: prod2u_p4_normal_v3_rx_fast_jog_tb");
+        $finish;
+    end
+endmodule

+ 44 - 9
tests/sim/prod2u_p4_normal_v3_rx_tb.v

@@ -16,6 +16,10 @@ module prod2u_p4_normal_v3_rx_tb;
     wire [5:0] request_length;
     wire [271:0] request_payload;
     wire [15:0] request_crc16;
+    wire fast_jog_valid;
+    wire [1:0] fast_jog_axis;
+    wire fast_jog_dir;
+    wire [15:0] fast_jog_steps;
     wire [15:0] crc_error_count;
     wire [15:0] timeout_count;
     wire [15:0] format_error_count;
@@ -56,6 +60,10 @@ module prod2u_p4_normal_v3_rx_tb;
         .request_length(request_length),
         .request_payload(request_payload),
         .request_crc16(request_crc16),
+        .fast_jog_valid(fast_jog_valid),
+        .fast_jog_axis(fast_jog_axis),
+        .fast_jog_dir(fast_jog_dir),
+        .fast_jog_steps(fast_jog_steps),
         .crc_error_count(crc_error_count),
         .timeout_count(timeout_count),
         .format_error_count(format_error_count)
@@ -76,6 +84,10 @@ module prod2u_p4_normal_v3_rx_tb;
         .request_length(),
         .request_payload(),
         .request_crc16(),
+        .fast_jog_valid(),
+        .fast_jog_axis(),
+        .fast_jog_dir(),
+        .fast_jog_steps(),
         .crc_error_count(),
         .timeout_count(timeout1_probe_count),
         .format_error_count()
@@ -96,6 +108,10 @@ module prod2u_p4_normal_v3_rx_tb;
         .request_length(),
         .request_payload(),
         .request_crc16(),
+        .fast_jog_valid(),
+        .fast_jog_axis(),
+        .fast_jog_dir(),
+        .fast_jog_steps(),
         .crc_error_count(),
         .timeout_count(timeout3_probe_count),
         .format_error_count()
@@ -378,12 +394,19 @@ module prod2u_p4_normal_v3_rx_tb;
         expect_request(HOST_CMD, 6'd4, expected_payload);
 
         build_motion_command(8'h35);
-        expected_payload = 272'd0;
-        for (i = 0; i < 8; i = i + 1) begin
-            expected_payload[i * 8 +: 8] = frame[14 + i];
-        end
         send_built_frame();
-        expect_request(MOTION_CMD, 6'd8, expected_payload);
+        if (!fast_jog_valid || fast_jog_axis !== 2'd1 ||
+            fast_jog_dir !== 1'b0 || fast_jog_steps !== 16'd160 ||
+            request_valid) begin
+            $display("legal JOG did not use the fast exit");
+            $fatal;
+        end
+        @(posedge clk);
+        #1;
+        if (fast_jog_valid) begin
+            $display("fast JOG event was not one cycle");
+            $fatal;
+        end
 
         build_host_command(8'h24);
         frame[2] = 8'h03;
@@ -443,7 +466,7 @@ module prod2u_p4_normal_v3_rx_tb;
             $fatal;
         end
 
-        // The one-entry request buffer backpressures RX until the request retires.
+        // The one-entry ordinary slot stays stable while RX continues parsing.
         request_ready = 1'b0;
         build_motion_command(8'h37);
         send_built_frame();
@@ -467,19 +490,31 @@ module prod2u_p4_normal_v3_rx_tb;
         repeat (8) begin
             @(posedge clk);
             #1;
-            if (rx_ready || crc_error_count !== held_crc_error_count ||
+            if (!rx_ready || crc_error_count !== held_crc_error_count ||
                 timeout_count !== held_timeout_count ||
                 format_error_count !== held_format_error_count) begin
-                $display("held request did not backpressure RX or changed parser counters");
+                $display("held request blocked RX or changed parser counters");
                 $fatal;
             end
         end
+
+        build_host_command(8'h29);
+        send_built_frame();
+        repeat (2) @(posedge clk);
+        #1;
+        if (!request_valid || request_type !== held_request_type ||
+            request_length !== held_request_length ||
+            request_payload !== held_request_payload ||
+            request_crc16 !== held_request_crc16) begin
+            $display("ordinary overflow replaced the held request");
+            $fatal;
+        end
         check_held_request = 1'b0;
         request_ready = 1'b1;
         @(posedge clk);
         #1;
         if (request_valid || !rx_ready) begin
-            $display("request handshake did not restore RX ready");
+            $display("request handshake did not retire the held slot");
             $fatal;
         end
 

+ 382 - 0
tests/unit/test_prod2u_p4_fast_jog_contract.py

@@ -0,0 +1,382 @@
+#!/usr/bin/env python3
+"""RED contracts for the trusted-host JOG fast path."""
+
+from __future__ import annotations
+
+import inspect
+import json
+import re
+import sys
+from pathlib import Path
+
+import pytest
+
+
+ROOT = Path(__file__).resolve().parents[2]
+sys.path.insert(0, str(ROOT / "tools"))
+
+import prod2u_p4_normal_v3_model as model  # noqa: E402
+import prod2u_p4_protocol as protocol  # noqa: E402
+
+
+RAW_STEP_POLICY = "RAW_U16_TRUSTED_HOST_NO_CPLD_CAP"
+FAST_PATH_POLICY = "RX_FAST_JOG_BYPASSES_NORMAL_REQUEST_SLOT"
+SAME_AXIS_HOST_RULE = "HOST_MUST_NOT_REPEAT_SAME_AXIS_BEFORE_COMPLETION"
+SAME_AXIS_VIOLATION_POLICY = "LATEST_COMMAND_WINS_OLD_ACK_NOT_GUARANTEED"
+COMPLETION_POLICY = "NONE_HOST_TRACKS_TIME"
+PARALLEL_POLICY = "TWO_INDEPENDENT_PARALLEL_EXECUTORS"
+
+HOST_CONTRACT_PATH = ROOT / "config" / "prod2u_p4_normal_host_contract_v4.json"
+HOST_SCHEMA_PATH = ROOT / "schemas" / "prod2u_p4_normal_host_contract_v4.schema.json"
+HW_BINDING_PATH = ROOT / "config" / "prod2u_p4_normal_v3_hw_binding.json"
+RESOURCE_BASELINE_PATH = ROOT / "config" / "prod2u_p4_normal_v3_resource_baseline.json"
+RX_PATH = ROOT / "src" / "rtl" / "prod2u_p4_normal_v3_rx.v"
+CORE_PATH = ROOT / "src" / "rtl" / "prod2u_p4_normal_v3_core.v"
+TOP_PATH = ROOT / "src" / "top" / "prod2u_p4_normal_v3_top.v"
+AXIS_PATH = ROOT / "src" / "rtl" / "prod2u_p4_axis_executor.v"
+HUB_PATH = ROOT / "src" / "rtl" / "prod2u_p4_motor_hub.v"
+AXIS_FORMAL_PATH = ROOT / "tests" / "formal" / "prod2u_p4_axis_safety_formal.v"
+FAST_FORMAL_PATH = ROOT / "tests" / "formal" / "prod2u_p4_fast_jog_path_formal.v"
+FAST_SBY_PATH = ROOT / "tests" / "formal" / "prod2u_p4_fast_jog_path.sby"
+RX_PAYLOAD_FORMAL_PATH = (
+    ROOT / "tests" / "formal" / "prod2u_p4_normal_v3_rx_payload_formal.v"
+)
+TARGET_MANIFEST_PATH = ROOT / "config" / "prod2u_p4_verification_targets_v1.json"
+RUNBOOK_PATH = ROOT / "docs" / "prod2u-p4-normal-v3-runbook.zh-CN.md"
+SEND_HEX_PATH = ROOT / "tools" / "package_templates" / "SEND_HEX.ps1"
+INITIALIZE_PATH = ROOT / "tools" / "package_templates" / "INITIALIZE_DISABLE.ps1"
+
+
+def _json(path: Path) -> dict[str, object]:
+    return json.loads(path.read_text(encoding="utf-8-sig"))
+
+
+def _text(path: Path) -> str:
+    return path.read_text(encoding="utf-8-sig")
+
+
+def _compact_verilog(value: str) -> str:
+    without_line_comments = re.sub(r"//.*", "", value)
+    return re.sub(r"\s+", "", without_line_comments)
+
+
+@pytest.mark.parametrize("steps", (0, 65536))
+def test_host_builder_rejects_values_outside_nonzero_u16(steps: int) -> None:
+    with pytest.raises(ValueError, match="steps must be from 1 to 65535"):
+        protocol.build_motor_jog(axis=0, raw_dir=0, speed_code=0, steps=steps)
+
+
+@pytest.mark.parametrize("steps", (1, 799, 800, 801, 8191, 65535))
+def test_host_builder_preserves_every_valid_u16_step_value(steps: int) -> None:
+    wire = protocol.build_motor_jog(
+        axis=1,
+        raw_dir=1,
+        speed_code=3,
+        steps=steps,
+    )
+    frame = protocol.decode_frame(wire)
+    command = protocol.decode_motion_command(frame)
+
+    assert frame.payload[4:6] == steps.to_bytes(2, "little")
+    assert command.steps == steps
+
+
+def test_host_contract_declares_trusted_fast_jog_and_host_owned_completion() -> None:
+    contract = _json(HOST_CONTRACT_PATH)
+    jog = contract["commands"]["jog"]
+    motion = contract["motion"]
+
+    assert jog.get("step_field_policy") == RAW_STEP_POLICY
+    assert jog.get("fast_path_policy") == FAST_PATH_POLICY
+    assert jog.get("same_axis_host_rule") == SAME_AXIS_HOST_RULE
+    assert jog.get("same_axis_violation_policy") == SAME_AXIS_VIOLATION_POLICY
+    assert jog.get("completion_event") == COMPLETION_POLICY
+    assert jog["step_range"] == [1, 65535]
+    assert jog["executed_step_cap"] is None
+    assert jog["ack_semantics"] == "FIRST_STEP_EMITTED"
+    assert jog["rejects_busy"] is False
+    assert jog["limit_policy"] == "IGNORE_ALL_INPUTS"
+    assert motion["execution"] == PARALLEL_POLICY
+    assert motion["peer_axis_may_start"] is True
+
+
+def test_host_schema_enforces_the_new_fast_jog_policy_markers() -> None:
+    schema = _json(HOST_SCHEMA_PATH)
+    jog = schema["$defs"]["jogCommand"]
+    required = set(jog["required"])
+    properties = jog["properties"]
+    expected = {
+        "step_field_policy": RAW_STEP_POLICY,
+        "fast_path_policy": FAST_PATH_POLICY,
+        "same_axis_host_rule": SAME_AXIS_HOST_RULE,
+        "same_axis_violation_policy": SAME_AXIS_VIOLATION_POLICY,
+        "completion_event": COMPLETION_POLICY,
+    }
+
+    assert expected.keys() <= required
+    for name, value in expected.items():
+        assert properties[name]["const"] == value
+
+
+def test_hardware_binding_mirrors_the_trusted_host_fast_jog_contract() -> None:
+    motor = _json(HW_BINDING_PATH)["motor"]
+
+    assert motor.get("jog_step_field_policy") == RAW_STEP_POLICY
+    assert motor.get("jog_fast_path_policy") == FAST_PATH_POLICY
+    assert motor.get("same_axis_host_rule") == SAME_AXIS_HOST_RULE
+    assert motor.get("same_axis_violation_policy") == SAME_AXIS_VIOLATION_POLICY
+    assert motor.get("completion_event") == COMPLETION_POLICY
+    assert motor["jog_executed_step_cap"] is None
+    assert motor["ack_semantics"] == "FIRST_STEP_EMITTED"
+    assert motor["valid_xy_jog_busy_rejection_sources"] == []
+    assert motor["limit_logic_consumer"] == "none"
+
+
+def test_resource_remeasurement_metadata_names_the_trusted_u16_contract() -> None:
+    measurement = _json(RESOURCE_BASELINE_PATH)["measurement"]
+
+    assert measurement["candidate_contract"] == RAW_STEP_POLICY
+    assert measurement["reason"] == "remeasure_after_trusted_fast_jog"
+    assert "800" not in (
+        str(measurement["candidate_contract"]) + str(measurement["reason"])
+    )
+
+
+def test_model_publishes_policy_markers_and_keeps_xy_execution_independent() -> None:
+    source = inspect.getsource(model)
+    for marker in (
+        RAW_STEP_POLICY,
+        FAST_PATH_POLICY,
+        SAME_AXIS_HOST_RULE,
+        SAME_AXIS_VIOLATION_POLICY,
+        COMPLETION_POLICY,
+        PARALLEL_POLICY,
+    ):
+        assert marker in source
+
+    subject = model.NormalV3Model()
+    x_result = subject.apply_frame(
+        protocol.build_motor_jog(axis=0, raw_dir=0, speed_code=0, steps=801)
+    )
+    y_result = subject.apply_frame(
+        protocol.build_motor_jog(axis=1, raw_dir=1, speed_code=3, steps=65535)
+    )
+
+    assert x_result.accepted and y_result.accepted
+    assert subject.active_mask == 0x03
+    assert subject.busy_mask == 0
+    assert subject.axes[0].remaining_steps == 801
+    assert subject.axes[1].remaining_steps == 65535
+
+
+def test_rx_exports_the_dedicated_fast_jog_event() -> None:
+    source = _text(RX_PATH)
+    for signal in (
+        "fast_jog_valid",
+        "fast_jog_axis",
+        "fast_jog_dir",
+        "fast_jog_steps",
+    ):
+        assert re.search(
+            rf"output\s+(?:wire|reg)\s+(?:\[[^\]]+\]\s+)?{signal}\b",
+            source,
+        ), signal
+
+
+def test_rx_keeps_parsing_while_the_normal_request_slot_is_pending() -> None:
+    source = _text(RX_PATH)
+    ready_assignment = re.search(r"assign\s+rx_ready\s*=\s*([^;]+);", source)
+
+    assert ready_assignment is not None
+    ready_rhs = ready_assignment.group(1)
+    assert "request_valid" not in ready_rhs
+    assert "request_ready" not in ready_rhs
+
+
+def test_rx_fast_classifier_checks_fields_but_never_checks_the_step_value() -> None:
+    source = _text(RX_PATH)
+    compact = _compact_verilog(source)
+    required_checks = (
+        "candidate_type==MOTION_CMD",
+        "candidate_length==6'd8",
+        "candidate_payload[7:0]==MOTION_JOG",
+        "candidate_payload[15:8]<=8'd1",
+        "candidate_payload[23:16]<=8'd1",
+        "candidate_payload[31:24]<=8'd3",
+        "candidate_payload[63:48]==16'd0",
+        "fast_jog_steps<=candidate_payload[47:32]",
+    )
+
+    for expected in required_checks:
+        assert expected in compact
+    assert not re.search(
+        r"candidate_payload\s*\[\s*47\s*:\s*32\s*\]\s*(?:==|!=|<=|>=|<|>)",
+        source,
+    )
+
+
+def test_core_consumes_fast_jog_without_legacy_request_admission_state() -> None:
+    source = _text(CORE_PATH)
+    for signal in (
+        "fast_jog_valid",
+        "fast_jog_axis",
+        "fast_jog_dir",
+        "fast_jog_steps",
+    ):
+        assert re.search(
+            rf"input\s+wire\s+(?:\[[^\]]+\]\s+)?{signal}\b",
+            source,
+        ), signal
+
+    assert "fast_jog_ack_pending" in source
+    assert "ST_JOG_WAIT_START" not in source
+    assert "jog_payload_valid" not in source
+    assert "request_steps" not in source
+
+
+def test_top_routes_the_fast_jog_event_from_rx_to_core() -> None:
+    source = _text(TOP_PATH)
+    for signal in (
+        "fast_jog_valid",
+        "fast_jog_axis",
+        "fast_jog_dir",
+        "fast_jog_steps",
+    ):
+        assert re.search(rf"wire\s+(?:\[[^\]]+\]\s+)?{signal}\b", source)
+        assert source.count(f".{signal}({signal})") == 2
+
+
+def test_motor_rtl_has_no_cap_busy_limit_or_completion_ack_regression() -> None:
+    sources = {
+        path.name: _text(path)
+        for path in (AXIS_PATH, HUB_PATH, CORE_PATH, RX_PATH)
+    }
+    combined = "\n".join(sources.values())
+
+    assert not re.search(r"\b16\s*'d800\b", combined, re.IGNORECASE)
+    assert "STATUS_BUSY" not in combined
+    for forbidden in (
+        "x_limit",
+        "y_limit",
+        "limit_active",
+        "limit_ready",
+        "ST_JOG_WAIT_DONE",
+        "axis_done",
+        "completion_ack",
+    ):
+        assert forbidden not in combined
+
+
+def test_axis_formal_strengthens_the_independent_oracle_with_dut_state() -> None:
+    source = _text(AXIS_FORMAL_PATH)
+
+    for signal in (
+        "formal_motion_phase",
+        "formal_phase_counter",
+        "formal_remaining_steps",
+    ):
+        assert f".{signal}(dut_{signal.removeprefix('formal_')})" in source
+
+    for required in (
+        "assert(dut_remaining_steps == spec_steps_left);",
+        "assert(dut_motion_phase == 2'd0);",
+        "assert(dut_motion_phase == 2'd1);",
+        "assert(dut_motion_phase == 2'd2);",
+        "assert(dut_motion_phase == 2'd3);",
+        "assert(dut_phase_counter == (spec_setup_left - 1'b1));",
+        "assert(dut_phase_counter == (spec_high_left - 1'b1));",
+        "assert(dut_phase_counter == (spec_low_left - 1'b1));",
+    ):
+        assert required in source
+
+
+def test_formal_covers_rx_fast_exit_and_nonidle_core_state() -> None:
+    core = _text(CORE_PATH)
+    formal = _text(FAST_FORMAL_PATH)
+    sby = _text(FAST_SBY_PATH)
+    manifest = _json(TARGET_MANIFEST_PATH)
+    target = next(
+        item
+        for item in manifest["layers"]["formal"]
+        if item["name"] == "prod2u_p4_fast_jog_path"
+    )
+
+    assert "formal_state" in core
+    assert "assign formal_state = state;" in core
+    assert "module prod2u_p4_fast_jog_rx_formal;" in formal
+    assert ".formal_state(dut_state)" in formal
+    assert "fast_jog_valid && (dut_state != 3'd0)" in formal
+    assert "cover(saw_nonidle_fast" in formal
+    assert "bmc_rx_path: prep -top prod2u_p4_fast_jog_rx_formal" in sby
+    assert "cover_rx_path: prep -top prod2u_p4_fast_jog_rx_formal" in sby
+    assert target["tasks"] == [
+        "prove_path",
+        "cover_path",
+        "bmc_rx_path",
+        "cover_rx_path",
+        "prove_production_timing",
+    ]
+
+
+def test_rx_payload_formal_uses_an_arbitrary_bit_oracle() -> None:
+    source = _compact_verilog(_text(RX_PAYLOAD_FORMAL_PATH))
+
+    assert "reg[271:0]expected_payload" not in source
+    assert "assert(request_payload==expected_payload);" not in source
+    assert "(*anyconst*)reg[8:0]payload_bit_index;" in source
+    assert "assume(payload_bit_index<9'd272);" in source
+    assert "if(selected_payload_byte<selected_length)" in source
+    assert (
+        "assert(request_payload[payload_bit_index]==expected_payload_bit);"
+        in source
+    )
+    assert "assert(request_payload[payload_bit_index]==1'b0);" in source
+    assert "if(frame_index>=(crc_high_index+7'd1))" in source
+    assert "assert(request_valid||request_seen);" in source
+    assert "crc_high_index+7'd2" not in source
+
+
+def test_docs_define_host_responsibility_without_old_motion_semantics() -> None:
+    for path in (ROOT / "AGENTS.md", RUNBOOK_PATH):
+        source = _text(path)
+        for required in (
+            RAW_STEP_POLICY,
+            FAST_PATH_POLICY,
+            SAME_AXIS_HOST_RULE,
+            SAME_AXIS_VIOLATION_POLICY,
+            COMPLETION_POLICY,
+        ):
+            assert required in source, f"{required} missing from {path.name}"
+
+        lowered = source.casefold()
+        assert "min(steps, 800)" not in lowered
+        assert "ack means completion" not in lowered
+        assert "limit stops jog" not in lowered
+        assert "valid jog returns busy" not in lowered
+
+
+def test_sender_waits_for_start_ack_without_deriving_a_completion_timeout() -> None:
+    source = _text(SEND_HEX_PATH)
+    timeout_function = re.search(
+        r"function\s+Get-ResponseTimeoutMs\b(?P<body>.*?)(?=\r?\nfunction\s+)",
+        source,
+        re.DOTALL,
+    )
+
+    assert timeout_function is not None
+    body = timeout_function.group("body").casefold()
+    assert "steps" not in body
+    assert "1000" not in body
+    assert "3000" in body
+    assert "ordinary command must receive exactly one host_ack" in source.casefold()
+    assert "motion_status" not in body
+
+
+def test_initialize_disable_does_not_claim_to_stop_fast_jog() -> None:
+    source = _text(INITIALIZE_PATH).casefold()
+
+    assert "disable does not stop" in source
+    assert "jog" in source
+    assert "reset" in source
+    assert "power-off" in source
+    assert "reconfiguration" in source

+ 61 - 0
tests/unit/test_prod2u_p4_fast_jog_rx_contract.py

@@ -0,0 +1,61 @@
+#!/usr/bin/env python3
+"""Run the independent RX fast-JOG contract directly with Icarus."""
+
+from __future__ import annotations
+
+import subprocess
+import tempfile
+from pathlib import Path
+
+from tools import prod2u_p4_harness as harness
+
+
+ROOT = Path(__file__).resolve().parents[2]
+TESTBENCH = ROOT / "tests/sim/prod2u_p4_normal_v3_rx_fast_jog_tb.v"
+SOURCES = (
+    ROOT / "src/rtl/binary921_crc16.v",
+    ROOT / "src/rtl/prod2u_p4_normal_v3_rx.v",
+    TESTBENCH,
+)
+
+
+def test_rx_fast_jog_bypasses_held_normal_request_slot() -> None:
+    iverilog = harness.resolve_tool("iverilog")
+    vvp = harness.resolve_tool("vvp")
+    assert iverilog is not None, "Icarus Verilog is required"
+    assert vvp is not None, "vvp is required"
+
+    with tempfile.TemporaryDirectory(prefix="p4-rx-fast-jog-") as temporary:
+        executable = Path(temporary) / "rx_fast_jog.vvp"
+        compile_result = subprocess.run(
+            [
+                str(iverilog),
+                "-g2005-sv",
+                "-s",
+                "prod2u_p4_normal_v3_rx_fast_jog_tb",
+                "-o",
+                str(executable),
+                *(str(path) for path in SOURCES),
+            ],
+            cwd=ROOT,
+            env=harness.tool_env(),
+            capture_output=True,
+            text=True,
+            timeout=60,
+            check=False,
+        )
+        compile_output = compile_result.stdout + compile_result.stderr
+        assert compile_result.returncode == 0, compile_output
+
+        run_result = subprocess.run(
+            [str(vvp), str(executable)],
+            cwd=ROOT,
+            env=harness.tool_env(),
+            capture_output=True,
+            text=True,
+            timeout=60,
+            check=False,
+        )
+        output = run_result.stdout + run_result.stderr
+        assert run_result.returncode == 0, output
+        assert "PASS: prod2u_p4_normal_v3_rx_fast_jog_tb" in output

+ 291 - 5
tests/unit/test_prod2u_p4_harness.py

@@ -60,6 +60,7 @@ UART_ONLY_CDC_REGISTERS = frozenset(
     }
 )
 UART_ONLY_CDC_ENDPOINTS = frozenset({"u_uart_rx/rx_sync_pipe[0]"})
+VERIFICATION_RUN_ID = "d" * 32
 
 
 def valid_io_rows() -> list[dict[str, str]]:
@@ -118,6 +119,7 @@ def valid_td_receipt(bitstream: Path, *, commit: str = "a" * 40) -> dict[str, ob
     return {
         "schema": harness.TD_RECEIPT_SCHEMA,
         "status": "pass",
+        "verification_run_id": VERIFICATION_RUN_ID,
         "commit": commit,
         "bitstream_sha256": digest,
         "synthesis_input_hash": "b" * 64,
@@ -131,7 +133,23 @@ def valid_td_receipt(bitstream: Path, *, commit: str = "a" * 40) -> dict[str, ob
         },
         "binding_gate": {"status": "pass"},
         "timing_gate": {"status": "pass"},
-        "structural_gate": {"status": "pass"},
+        "structural_gate": {
+            "status": "pass",
+            "cdc": {
+                "status": "pass",
+                "async_reg": {"used": 2},
+                "input_registers": {"used": 0},
+                "retained_sync_registers": {"used": 2},
+                "first_stage_endpoints": {"used": 1},
+            },
+            "fsm_encoding": {
+                "status": "pass",
+                "encoding": "sequential",
+                "axes": {"x": 2, "y": 2},
+                "td_log_marker": True,
+                "reencoded_motion_phase_count": 0,
+            },
+        },
         "resources": valid_resources(),
         "timing": {
             "fmax_mhz": 50.0,
@@ -177,6 +195,7 @@ def valid_offline_receipt(*, commit: str = "a" * 40) -> dict[str, object]:
     return {
         "schema": harness.OFFLINE_RECEIPT_SCHEMA,
         "status": "pass",
+        "verification_run_id": VERIFICATION_RUN_ID,
         "commit": commit,
         "source_state": {"clean": True, "commit": commit},
         "required_layers": ["source_integrity", "unit", "hdl_sim", "formal"],
@@ -194,6 +213,7 @@ def valid_package_receipt(
     return {
         "schema": harness.PACKAGE_RECEIPT_SCHEMA,
         "status": "pass",
+        "verification_run_id": VERIFICATION_RUN_ID,
         "commit": commit,
         "bitstream_sha256": digest,
         "package_dir": str(package),
@@ -234,6 +254,7 @@ def materialize_valid_package(
     confirmation_path.write_text(json.dumps(confirmation), encoding="utf-8")
     validation = {
         "schema": "prod2u-p4-normal-v3-validation-summary-v1",
+        "verification_run_id": VERIFICATION_RUN_ID,
         "commit": commit,
         "bitstream_sha256": digest,
         "delivery_mode": "normal_dual_td",
@@ -282,6 +303,7 @@ def materialize_valid_package(
     info = {
         "schema": "prod2u-p4-normal-v3-folder-package-info-v3",
         "profile": harness.RUNTIME_PROFILE,
+        "verification_run_id": VERIFICATION_RUN_ID,
         "commit": commit,
         "bitstream_sha256": digest,
         "delivery_mode": "normal_dual_td",
@@ -554,6 +576,148 @@ class Prod2UP4HarnessTests(unittest.TestCase):
         for retired in ("resource-baseline-produce", "normal-actuator-trace-gate", "uart-board-sram-test"):
             self.assertNotIn(retired, commands)
 
+    def test_delivery_commands_require_one_explicit_verification_run_id(self) -> None:
+        parser = harness.build_parser()
+        commands = parser._subparsers._group_actions[0].choices
+
+        for command in (
+            "p4-normal-v3-strict-offline-gate",
+            "td-build",
+            "package-selftest",
+            "p4-normal-v3-final-gate",
+        ):
+            action = next(
+                item
+                for item in commands[command]._actions
+                if item.dest == "verification_run_id"
+            )
+            with self.subTest(command=command):
+                self.assertTrue(action.required)
+
+        with self.assertRaisesRegex(ValueError, "verification_run_id is required"):
+            harness.normalize_verification_run_id(None)
+
+        final_schema = json.loads(
+            (
+                ROOT
+                / "schemas"
+                / "prod2u_p4_normal_v3_final_gate_receipt.schema.json"
+            ).read_text(encoding="utf-8")
+        )
+        self.assertEqual(
+            final_schema["properties"]["verification_run_id"]["type"],
+            "string",
+        )
+
+    def test_package_selftest_schema_matches_emitted_metadata_and_statuses(self) -> None:
+        schema = json.loads(
+            (
+                ROOT
+                / "schemas"
+                / "prod2u_p4_normal_v3_package_selftest_receipt.schema.json"
+            ).read_text(encoding="utf-8")
+        )
+
+        for field in (
+            "delivery_mode",
+            "verification_complete",
+            "confirmation_td_present",
+        ):
+            with self.subTest(field=field):
+                self.assertIn(field, schema["required"])
+                self.assertIn(field, schema["properties"])
+        self.assertEqual(
+            set(schema["properties"]["validation_status"]["enum"]),
+            {"pass", "fail", "running", "not_run"},
+        )
+
+    def test_td_receipt_identifiers_are_valid_and_canonically_independent(self) -> None:
+        schema = json.loads(
+            (
+                ROOT
+                / "schemas"
+                / "prod2u_p4_normal_v3_td_build_receipt.schema.json"
+            ).read_text(encoding="utf-8")
+        )
+        pass_required = schema["allOf"][0]["then"]["required"]
+
+        self.assertIn("run_id", pass_required)
+        self.assertIn("work_root", pass_required)
+        self.assertEqual(
+            schema["properties"]["run_id"]["pattern"],
+            "^[0-9a-f]{32}$",
+        )
+        self.assertEqual(
+            schema["properties"]["work_root"]["pattern"],
+            "^[A-Za-z]:[\\\\/]",
+        )
+
+        primary = {"run_id": "1" * 32, "work_root": "C:/td-a"}
+        confirmation = {"run_id": "2" * 32, "work_root": "C:/td-b"}
+        self.assertTrue(harness.td_receipts_are_independent(primary, confirmation))
+
+        invalid_run_primary = {**primary, "run_id": "invalid-a"}
+        invalid_run_confirmation = {**confirmation, "run_id": "invalid-b"}
+        self.assertFalse(
+            harness.td_receipts_are_independent(
+                invalid_run_primary,
+                invalid_run_confirmation,
+            )
+        )
+        self.assertFalse(
+            harness.td_receipts_are_independent(
+                {**primary, "work_root": "td-a"},
+                {**confirmation, "work_root": "td-b"},
+            )
+        )
+        self.assertFalse(
+            harness.td_receipts_are_independent(
+                primary,
+                {**confirmation, "work_root": "c:\\TD-A\\child\\.."},
+            )
+        )
+
+    def test_readme_documents_one_run_id_across_complete_delivery_chain(self) -> None:
+        readme = (ROOT / "README.zh-CN.md").read_text(encoding="utf-8")
+        run_id_assignment = "$verificationRunId = [Guid]::NewGuid().ToString('N')"
+
+        self.assertLess(
+            readme.index(run_id_assignment),
+            readme.index("p4-normal-v3-strict-offline-gate"),
+        )
+        self.assertGreaterEqual(
+            readme.count("--verification-run-id $verificationRunId"),
+            5,
+        )
+        self.assertIn("p4-normal-v3-minimal-td-b", readme)
+        self.assertIn("-VerificationRunId $verificationRunId", readme)
+        self.assertIn("package-selftest", readme)
+        self.assertIn("p4-normal-v3-final-gate", readme)
+
+    def test_unit_payload_uses_pytest_collection_for_function_tests(self) -> None:
+        completed = subprocess.CompletedProcess(
+            ["python", "-m", "pytest"],
+            0,
+            stdout="195 passed",
+            stderr="",
+        )
+        with tempfile.TemporaryDirectory(dir=ROOT.parent) as temporary:
+            with mock.patch.object(
+                harness.subprocess,
+                "run",
+                return_value=completed,
+            ) as run:
+                payload = harness.unit_payload(Path(temporary))
+
+        command = run.call_args.args[0]
+        self.assertEqual(payload["status"], "pass")
+        self.assertIn("pytest", command)
+        self.assertIn("-p", command)
+        self.assertIn("no:cacheprovider", command)
+        self.assertIn("tests/unit", command)
+        self.assertIn("tests/test_project_structure.py", command)
+        self.assertNotIn("unittest", command)
+
     def test_production_source_manifest_is_exact_and_has_no_retired_rtl(self) -> None:
         self.assertEqual(tuple(harness.PRODUCTION_RTL_SOURCES), EXPECTED_SOURCES)
         self.assertEqual(tuple(harness.active_rtl_sources()), EXPECTED_SOURCES)
@@ -595,7 +759,10 @@ class Prod2UP4HarnessTests(unittest.TestCase):
     def test_dry_run_layers_never_claim_pass_or_hardware_access(self) -> None:
         hdl = harness.hdl_sim_payload(run=False, backend="all")
         formal = harness.formal_payload(run=False)
-        td = harness.td_build_payload(run=False)
+        td = harness.td_build_payload(
+            run=False,
+            verification_run_id=VERIFICATION_RUN_ID,
+        )
 
         for payload in (hdl, formal, td):
             with self.subTest(schema=payload["schema"]):
@@ -939,6 +1106,51 @@ class Prod2UP4HarnessTests(unittest.TestCase):
             self.assertIn("package:primary_td_external_binding", failures)
             self.assertIn("package:confirmation_td_external_binding", failures)
 
+    def test_td_final_reopens_cdc_and_fsm_structure_contracts(self) -> None:
+        with tempfile.TemporaryDirectory(dir=ROOT.parent) as temporary:
+            bitstream = Path(temporary) / "td.bit"
+            bitstream.write_bytes(b"td-structure-contract")
+            receipt = valid_td_receipt(bitstream)
+
+            receipt["structural_gate"]["cdc"]["retained_sync_registers"][
+                "used"
+            ] = 8
+            receipt["structural_gate"]["fsm_encoding"]["axes"] = {
+                "x": 3,
+                "y": 3,
+            }
+            failures = harness._td_final_failures(
+                receipt,
+                label="td",
+                expected_commit="a" * 40,
+            )
+
+        self.assertIn("td:structural_gate:cdc", failures)
+        self.assertIn("td:structural_gate:fsm_encoding", failures)
+
+    def test_package_selftest_rejects_a_different_verification_run(self) -> None:
+        with tempfile.TemporaryDirectory(dir=ROOT.parent) as temporary:
+            package = Path(temporary) / "package"
+            materialize_valid_package(package)
+            completed = subprocess.CompletedProcess(
+                ["powershell.exe"], 0, stdout="selftest pass", stderr=""
+            )
+            with mock.patch.object(
+                harness.subprocess,
+                "run",
+                return_value=completed,
+            ):
+                observed = harness.package_selftest_payload(
+                    package,
+                    verification_run_id="e" * 32,
+                )
+
+        self.assertEqual(observed["status"], "fail")
+        self.assertIn(
+            "verification_run_id_mismatch:package_info",
+            observed["failures"],
+        )
+
     def test_package_validator_preserves_running_but_final_gate_rejects_it(self) -> None:
         bitstream_bytes = b"running-validation-package"
         digest = hashlib.sha256(bitstream_bytes).hexdigest()
@@ -964,7 +1176,10 @@ class Prod2UP4HarnessTests(unittest.TestCase):
                 ["powershell.exe"], 0, stdout="selftest pass", stderr=""
             )
             with mock.patch.object(harness.subprocess, "run", return_value=completed):
-                observed = harness.package_selftest_payload(package)
+                observed = harness.package_selftest_payload(
+                    package,
+                    verification_run_id=VERIFICATION_RUN_ID,
+                )
 
             self.assertEqual(observed["status"], "pass", observed["failures"])
             self.assertEqual(observed["validation_status"], "running")
@@ -980,6 +1195,46 @@ class Prod2UP4HarnessTests(unittest.TestCase):
             )
             self.assertIn("package:validation_incomplete", failures)
 
+    def test_package_selftest_rejects_non_independent_td_receipts(self) -> None:
+        cases = (
+            ("run_id", "td_run_id_not_independent"),
+            ("work_root", "td_work_root_not_independent"),
+        )
+        for field, failure in cases:
+            with self.subTest(field=field), tempfile.TemporaryDirectory(
+                dir=ROOT.parent
+            ) as temporary:
+                commit = "a" * 40
+                digest = hashlib.sha256(b"independent-package-selftest").hexdigest()
+                package = (
+                    Path(temporary)
+                    / commit
+                    / f"prod2u-p4-normal-{commit}-{digest[:16]}"
+                )
+                receipt, primary, confirmation = materialize_valid_package(
+                    package,
+                    bitstream_bytes=b"independent-package-selftest",
+                    commit=commit,
+                )
+                confirmation[field] = primary[field]
+                (package / "evidence" / "td-confirmation-receipt.json").write_text(
+                    json.dumps(confirmation),
+                    encoding="utf-8",
+                )
+                refresh_package_bindings(package, receipt)
+
+                completed = subprocess.CompletedProcess(
+                    ["powershell.exe"], 0, stdout="selftest pass", stderr=""
+                )
+                with mock.patch.object(harness.subprocess, "run", return_value=completed):
+                    observed = harness.package_selftest_payload(
+                        package,
+                        verification_run_id=VERIFICATION_RUN_ID,
+                    )
+
+                self.assertEqual(observed["status"], "fail")
+                self.assertIn(failure, observed["failures"])
+
     def test_urgent_validator_allows_running_td_confirmation_only(self) -> None:
         bitstream_bytes = b"urgent-running-confirmation"
         digest = hashlib.sha256(bitstream_bytes).hexdigest()
@@ -1033,7 +1288,10 @@ class Prod2UP4HarnessTests(unittest.TestCase):
                 ["powershell.exe"], 0, stdout="selftest pass", stderr=""
             )
             with mock.patch.object(harness.subprocess, "run", return_value=completed):
-                observed = harness.package_selftest_payload(package)
+                observed = harness.package_selftest_payload(
+                    package,
+                    verification_run_id=VERIFICATION_RUN_ID,
+                )
 
             self.assertEqual(observed["status"], "pass", observed["failures"])
             self.assertEqual(observed["validation_status"], "running")
@@ -1070,7 +1328,7 @@ class Prod2UP4HarnessTests(unittest.TestCase):
                 td_receipt=paths["td"],
                 confirmation_td_receipt=paths["td_confirmation"],
                 package_receipt=paths["package"],
-                verification_run_id=None,
+                verification_run_id=VERIFICATION_RUN_ID,
                 report_file=None,
                 json=False,
             )
@@ -1116,6 +1374,34 @@ class Prod2UP4HarnessTests(unittest.TestCase):
                 accepted = harness.cmd_final_gate(args)
             self.assertEqual(accepted["status"], "pass", accepted["failures"])
 
+            confirmation["bitstream_sha256"] = "f" * 64
+            paths["td_confirmation"].write_text(
+                json.dumps(confirmation), encoding="utf-8"
+            )
+            with (
+                mock.patch.object(
+                    harness,
+                    "source_state",
+                    return_value={"status": "pass", "commit": "a" * 40, "clean": True},
+                ),
+                mock.patch.object(
+                    harness,
+                    "_emit",
+                    side_effect=lambda payload, _args, _label: payload,
+                ),
+            ):
+                bitstream_mismatch = harness.cmd_final_gate(args)
+            self.assertEqual(bitstream_mismatch["status"], "fail")
+            self.assertIn(
+                "td_bitstream_sha256_mismatch",
+                bitstream_mismatch["failures"],
+            )
+
+            confirmation["bitstream_sha256"] = digest
+            paths["td_confirmation"].write_text(
+                json.dumps(confirmation), encoding="utf-8"
+            )
+
             with (
                 mock.patch.object(
                     harness,

+ 198 - 18
tests/unit/test_prod2u_p4_minimal_delivery_contract.py

@@ -17,6 +17,7 @@ import sys
 
 ROOT = Path(__file__).resolve().parents[2]
 STEM = "prod2u_p4_normal_v3"
+VERIFICATION_RUN_ID = "d" * 32
 DISABLE_HEX = "A55A02040500000000000000000426000000C4AE"
 sys.path.insert(0, str(ROOT / "tools"))
 
@@ -166,6 +167,9 @@ def _build_package(
     *,
     confirmation_commit: str | None = None,
     confirmation_image: bytes | None = None,
+    confirmation_run_id: str = "2" * 32,
+    confirmation_reuses_primary_work_root: bool = False,
+    confirmation_work_root: str | None = None,
     selftest_fails: bool = False,
     urgent_single_td: bool = False,
     include_confirmation: bool = True,
@@ -249,6 +253,7 @@ def _build_package(
             {
                 "schema": primary_schema,
                 "status": primary_status,
+                "verification_run_id": VERIFICATION_RUN_ID,
                 "commit": primary_commit or commit,
                 "source_state": {
                     "clean": primary_source_clean,
@@ -286,6 +291,7 @@ def _build_package(
             {
                 "schema": "prod2u-p4-normal-v3-td-build-receipt-v2",
                 "status": confirmation_status,
+                "verification_run_id": VERIFICATION_RUN_ID,
                 "commit": confirmation_commit or commit,
                 "bitstream_sha256": confirmation_bitstream_sha256,
                 "bitstream": (
@@ -298,8 +304,15 @@ def _build_package(
                     "sha256": "1" * 64,
                     "inputs": {"src/top/prod2u_p4_normal_v3_top.v": "2" * 64},
                 },
-                "run_id": "2" * 32,
-                "work_root": str(td_confirmation_dir),
+                "run_id": confirmation_run_id,
+                "work_root": str(
+                    confirmation_work_root
+                    or (
+                        td_primary_dir
+                        if confirmation_reuses_primary_work_root
+                        else td_confirmation_dir
+                    )
+                ),
                 "post_route_pin_gate": {
                     "status": "pass",
                     "row_count": 41,
@@ -327,6 +340,7 @@ def _build_package(
                     "schema": "prod2u-p4-normal-v3-formal-receipt-v1",
                     "verification_layer": "formal",
                     "status": status,
+                    "verification_run_id": VERIFICATION_RUN_ID,
                     "commit": commit,
                     "failures": [] if status == "pass" else ["fixture_failure"],
                 }
@@ -351,6 +365,7 @@ def _build_package(
         + "    -OutputDir " + _ps_literal(output) + " `\n"
         + "    -NormalBitstream " + _ps_literal(bitstream) + " `\n"
         + "    -TdReceipt " + _ps_literal(td_primary) + " `\n"
+        + "    -VerificationRunId " + _ps_literal(VERIFICATION_RUN_ID) + " `\n"
         + "    -ConfirmationTdReceipt "
         + _ps_literal(td_confirmation if include_confirmation else "")
         + " `\n"
@@ -466,12 +481,15 @@ class Prod2UP4MinimalDeliveryContractTests(unittest.TestCase):
         agents = (ROOT / "AGENTS.md").read_text(encoding="utf-8")
 
         for source in (runbook, agents):
-            self.assertIn("800", source)
+            self.assertIn("RAW_U16_TRUSTED_HOST_NO_CPLD_CAP", source)
+            self.assertIn("1..65535", source)
+            self.assertNotIn("min(steps, 800)", source)
             self.assertIn("忽略限位", source)
             self.assertIn("替换", source)
-            self.assertIn("合法 X/Y JOG 永不返回 BUSY", source)
             self.assertIn("无需先发送 DISABLE", source)
             self.assertIn("只读遥测", source)
+        self.assertIn("超过 800 步的请求也会完整执行", runbook)
+        self.assertIn("合法 X/Y JOG 永不返回 BUSY", runbook)
         self.assertIn("首个实际 STEP", runbook)
         self.assertIn("GET_STATUS 和 GET_MOTOR_STATUS 都不能复活", runbook)
         self.assertIn("请求帧和 HEX 不变", runbook)
@@ -608,7 +626,10 @@ class Prod2UP4MinimalDeliveryContractTests(unittest.TestCase):
                 text=True,
                 check=False,
             )
-            harness_receipt = harness.package_selftest_payload(package)
+            harness_receipt = harness.package_selftest_payload(
+                package,
+                verification_run_id=VERIFICATION_RUN_ID,
+            )
 
         expected_name = f"prod2u-p4-normal-{commit}-{bitstream_sha256[:16]}"
         self.assertEqual(package.name, expected_name)
@@ -705,7 +726,10 @@ class Prod2UP4MinimalDeliveryContractTests(unittest.TestCase):
                 text=True,
                 check=False,
             )
-            harness_receipt = harness.package_selftest_payload(package)
+            harness_receipt = harness.package_selftest_payload(
+                package,
+                verification_run_id=VERIFICATION_RUN_ID,
+            )
 
         self.assertEqual(info["commit"], commit)
         self.assertEqual(info["bitstream_sha256"], bitstream_sha256)
@@ -1080,21 +1104,177 @@ class Prod2UP4MinimalDeliveryContractTests(unittest.TestCase):
             ):
                 _build_package(Path(temporary), confirmation_commit="f" * 40)
 
-    def test_confirmation_bitstream_may_differ_when_self_bound(self) -> None:
+    def test_packager_rejects_confirmation_bitstream_that_differs_from_primary(self) -> None:
         with tempfile.TemporaryDirectory(dir=ROOT.parent) as temporary:
-            package, _commit, primary_sha256 = _build_package(
-                Path(temporary),
-                confirmation_image=b"independent nondeterministic TD bitstream",
-            )
-            info = json.loads((package / "package-info.json").read_text(encoding="utf-8"))
-            validation = json.loads(
-                (package / "evidence" / "validation-summary.json").read_text(
-                    encoding="utf-8"
+            with self.assertRaisesRegex(
+                AssertionError,
+                "Confirmation TD receipt bitstream hash does not match primary",
+            ):
+                _build_package(
+                    Path(temporary),
+                    confirmation_image=b"independent nondeterministic TD bitstream",
                 )
-            )
 
-        self.assertNotEqual(info["confirmation_bitstream_sha256"], primary_sha256)
-        self.assertEqual(validation["layers"]["td_confirmation_bitstream"]["status"], "pass")
+    def test_packager_rejects_non_independent_td_receipts(self) -> None:
+        cases = (
+            (
+                {"confirmation_run_id": "1" * 32},
+                "Primary and confirmation TD run_id must differ",
+            ),
+            (
+                {"confirmation_run_id": "invalid-confirmation"},
+                "Primary and confirmation TD run_id must differ",
+            ),
+            (
+                {"confirmation_reuses_primary_work_root": True},
+                "Primary and confirmation TD work_root must differ",
+            ),
+            (
+                {"confirmation_work_root": "relative-td-confirmation"},
+                "Primary and confirmation TD work_root must differ",
+            ),
+        )
+        for kwargs, message in cases:
+            with self.subTest(message=message), tempfile.TemporaryDirectory(
+                dir=ROOT.parent
+            ) as temporary:
+                with self.assertRaisesRegex(AssertionError, message):
+                    _build_package(Path(temporary), **kwargs)
+
+    def test_packaged_selftest_rejects_non_independent_td_receipts(self) -> None:
+        cases = (
+            ("run_id", "Primary and confirmation TD run_id must differ"),
+            ("work_root", "Primary and confirmation TD work_root must differ"),
+        )
+        for field, message in cases:
+            with self.subTest(field=field), tempfile.TemporaryDirectory(
+                dir=ROOT.parent
+            ) as temporary:
+                package, _commit, _digest = _build_package(Path(temporary))
+                primary_path = package / "evidence" / "td-primary-receipt.json"
+                confirmation_path = (
+                    package / "evidence" / "td-confirmation-receipt.json"
+                )
+                info_path = package / "package-info.json"
+                primary = json.loads(primary_path.read_text(encoding="utf-8"))
+                confirmation = json.loads(
+                    confirmation_path.read_text(encoding="utf-8")
+                )
+                confirmation[field] = primary[field]
+                confirmation_path.write_text(
+                    json.dumps(confirmation),
+                    encoding="utf-8",
+                )
+                confirmation_sha256 = hashlib.sha256(
+                    confirmation_path.read_bytes()
+                ).hexdigest()
+                info = json.loads(info_path.read_text(encoding="utf-8"))
+                info["confirmation_td_receipt_sha256"] = confirmation_sha256
+                info["file_sha256"][
+                    "evidence/td-confirmation-receipt.json"
+                ] = confirmation_sha256
+                info_path.write_text(json.dumps(info), encoding="utf-8")
+
+                completed = subprocess.run(
+                    [
+                        "powershell.exe",
+                        "-NoProfile",
+                        "-ExecutionPolicy",
+                        "Bypass",
+                        "-File",
+                        str(package / "selftest.ps1"),
+                    ],
+                    cwd=package,
+                    capture_output=True,
+                    text=True,
+                    check=False,
+                )
+
+                self.assertNotEqual(completed.returncode, 0)
+                self.assertIn(message, completed.stdout + completed.stderr)
+
+    def test_packaged_selftest_rejects_invalid_distinct_td_identifiers(self) -> None:
+        cases = (
+            (
+                {"run_id": "invalid-primary"},
+                {"run_id": "invalid-confirmation"},
+                "Primary and confirmation TD run_id must differ",
+            ),
+            (
+                {"work_root": "relative-primary"},
+                {"work_root": "relative-confirmation"},
+                "Primary and confirmation TD work_root must differ",
+            ),
+        )
+        for primary_updates, confirmation_updates, message in cases:
+            with self.subTest(message=message), tempfile.TemporaryDirectory(
+                dir=ROOT.parent
+            ) as temporary:
+                package, _commit, _digest = _build_package(Path(temporary))
+                primary_path = package / "evidence" / "td-primary-receipt.json"
+                confirmation_path = (
+                    package / "evidence" / "td-confirmation-receipt.json"
+                )
+                info_path = package / "package-info.json"
+                primary = json.loads(primary_path.read_text(encoding="utf-8"))
+                confirmation = json.loads(
+                    confirmation_path.read_text(encoding="utf-8")
+                )
+                primary.update(primary_updates)
+                confirmation.update(confirmation_updates)
+                primary_path.write_text(json.dumps(primary), encoding="utf-8")
+                confirmation_path.write_text(
+                    json.dumps(confirmation),
+                    encoding="utf-8",
+                )
+                primary_sha256 = hashlib.sha256(primary_path.read_bytes()).hexdigest()
+                confirmation_sha256 = hashlib.sha256(
+                    confirmation_path.read_bytes()
+                ).hexdigest()
+                info = json.loads(info_path.read_text(encoding="utf-8"))
+                info["td_receipt_sha256"] = primary_sha256
+                info["confirmation_td_receipt_sha256"] = confirmation_sha256
+                info["file_sha256"]["evidence/td-primary-receipt.json"] = (
+                    primary_sha256
+                )
+                info["file_sha256"][
+                    "evidence/td-confirmation-receipt.json"
+                ] = confirmation_sha256
+                info_path.write_text(json.dumps(info), encoding="utf-8")
+
+                completed = subprocess.run(
+                    [
+                        "powershell.exe",
+                        "-NoProfile",
+                        "-ExecutionPolicy",
+                        "Bypass",
+                        "-File",
+                        str(package / "selftest.ps1"),
+                    ],
+                    cwd=package,
+                    capture_output=True,
+                    text=True,
+                    check=False,
+                )
+
+                self.assertNotEqual(completed.returncode, 0)
+                self.assertIn(message, completed.stdout + completed.stderr)
+
+    def test_packager_requires_and_binds_shared_verification_run_id(self) -> None:
+        source = (ROOT / "tools" / f"package_{STEM}.ps1").read_text(
+            encoding="utf-8"
+        )
+
+        self.assertIn(
+            "[Parameter(Mandatory = $true)]"
+            "[ValidatePattern('^[0-9a-f]{32}$')]"
+            "[string]$VerificationRunId",
+            source,
+        )
+        self.assertIn("Primary TD receipt verification_run_id mismatch", source)
+        self.assertIn("Confirmation TD receipt verification_run_id mismatch", source)
+        self.assertIn("Validation receipt verification_run_id mismatch", source)
+        self.assertGreaterEqual(source.count("verification_run_id = $VerificationRunId"), 2)
 
     def test_package_selftest_failure_is_recorded_without_suppressing_image(self) -> None:
         with tempfile.TemporaryDirectory(dir=ROOT.parent) as temporary:

+ 242 - 133
tests/unit/test_prod2u_p4_motion_source_mutations.py

@@ -25,6 +25,7 @@ HUB_SOURCE = ROOT / "src/rtl/prod2u_p4_motor_hub.v"
 CORE_SOURCE = ROOT / "src/rtl/prod2u_p4_normal_v3_core.v"
 TOP_SOURCE = ROOT / "src/top/prod2u_p4_normal_v3_top.v"
 AXIS_16BIT_TB = ROOT / "tests/sim/prod2u_p4_axis_jog_16bit_tb.v"
+FAST_JOG_CORE_TB = ROOT / "tests/sim/prod2u_p4_fast_jog_core_tb.v"
 TOP_TB = ROOT / "tests/sim/prod2u_p4_normal_v3_top_tb.v"
 
 
@@ -60,6 +61,7 @@ def _run_icarus(
     sources: Iterable[Path],
     workdir: Path,
     timeout_seconds: float = 120.0,
+    defines: Iterable[str] = (),
 ) -> IcarusResult:
     executable = workdir / f"{top}.vvp"
     started = time.perf_counter()
@@ -67,6 +69,7 @@ def _run_icarus(
         [
             str(iverilog),
             "-g2005-sv",
+            *(f"-D{define}" for define in defines),
             "-s",
             top,
             "-o",
@@ -184,64 +187,12 @@ def _mutate_axis_with_speed_tiers(source: str) -> str:
     )
 
 
-def _mutate_hub_with_speed_tiers(source: str) -> str:
-    source = _replace_exact(
-        source,
-        "    input  wire        jog_dir,\n"
-        "    input  wire [15:0] jog_steps,",
-        "    input  wire        jog_dir,\n"
-        "    input  wire [1:0]  jog_speed,\n"
-        "    input  wire [15:0] jog_steps,",
-        label="hub speed port",
-    )
+def _mutate_core_with_request_ready_gate(source: str) -> str:
     return _replace_exact(
         source,
-        "        .command_steps(jog_steps),\n"
-        "        .step_out",
-        "        .command_steps(jog_steps),\n"
-        "        .command_speed(jog_speed),\n"
-        "        .step_out",
-        label="hub speed routing",
-        expected_count=2,
-    )
-
-
-def _mutate_core_with_speed_tiers(source: str) -> str:
-    source = _replace_exact(
-        source,
-        "    reg motor_jog_dir;\n"
-        "    reg [15:0] motor_jog_steps;",
-        "    reg motor_jog_dir;\n"
-        "    reg [1:0] motor_jog_speed;\n"
-        "    reg [15:0] motor_jog_steps;",
-        label="core speed register",
-    )
-    source = _replace_exact(
-        source,
-        "        .jog_dir(motor_jog_dir),\n"
-        "        .jog_steps(motor_jog_steps),",
-        "        .jog_dir(motor_jog_dir),\n"
-        "        .jog_speed(motor_jog_speed),\n"
-        "        .jog_steps(motor_jog_steps),",
-        label="core speed routing",
-    )
-    source = _replace_exact(
-        source,
-        "            motor_jog_dir <= 1'b0;\n"
-        "            motor_jog_steps <= 16'd0;",
-        "            motor_jog_dir <= 1'b0;\n"
-        "            motor_jog_speed <= 2'd0;\n"
-        "            motor_jog_steps <= 16'd0;",
-        label="core speed reset",
-    )
-    return _replace_exact(
-        source,
-        "                                    motor_jog_dir <= request_value[0];\n"
-        "                                    motor_jog_steps <= request_steps;",
-        "                                    motor_jog_dir <= request_value[0];\n"
-        "                                    motor_jog_speed <= request_flags[1:0];\n"
-        "                                    motor_jog_steps <= request_steps;",
-        label="core speed capture",
+        "        .jog_start(fast_jog_valid),",
+        "        .jog_start(fast_jog_valid && request_ready),",
+        label="fast JOG request_ready gate",
     )
 
 
@@ -267,6 +218,82 @@ def _mutate_top_with_motor_safety_gates(source: str) -> str:
     )
 
 
+def _mutate_top_with_individual_step_gate(
+    source: str,
+    *,
+    gate_expression: str,
+    label: str,
+) -> str:
+    return _replace_exact(
+        source,
+        "    assign x_step = motor_steps[0];",
+        f"    assign x_step = motor_steps[0] && {gate_expression};",
+        label=label,
+    )
+
+
+def _top_individual_gate_tb(
+    *,
+    marker: str,
+    x_limit_raw: int,
+    disabled: int,
+    watchdog_timeout: int,
+) -> str:
+    return textwrap.dedent(
+        f"""
+        `timescale 1ns/1ps
+
+        module prod2u_p4_individual_safety_gate_mutation_tb;
+            reg clk = 1'b0;
+            reg x_limit_raw = 1'b{x_limit_raw};
+            reg y_limit_raw = 1'b0;
+            wire x_step;
+            integer x_rises = 0;
+            integer guard = 0;
+
+            always #5 clk = ~clk;
+            always @(posedge x_step) x_rises = x_rises + 1;
+
+            prod2u_p4_normal_v3_top #(
+                .CLK_HZ(4000000),
+                .HOST_UART_CLKS_PER_BIT(4),
+                .POR_CYCLES(4),
+                .INTER_BYTE_TIMEOUT_MS(2),
+                .PTC_STEP_CLKS(1),
+                .FAN_STEP_CLKS(1),
+                .SOLENOID_ACTIVE_HIGH(1)
+            ) dut (
+                .sys_clk(clk), .host_uart_rx(1'b1), .host_uart_tx(),
+                .ptc_pwm_out(), .fan_pwm_out(), .solenoid_out(),
+                .motor_en_n(), .x_step(x_step), .x_dir(),
+                .y_step(), .y_dir(), .z_step(), .z_dir(),
+                .x_limit_raw(x_limit_raw), .y_limit_raw(y_limit_raw)
+            );
+
+            initial begin
+                wait (dut.sys_rst_n === 1'b1);
+                repeat (4) @(negedge clk);
+                force dut.disabled = 1'b{disabled};
+                force dut.watchdog_timeout = 1'b{watchdog_timeout};
+                force dut.fast_jog_axis = 2'd0;
+                force dut.fast_jog_dir = 1'b1;
+                force dut.fast_jog_steps = 16'd1;
+                force dut.fast_jog_valid = 1'b1;
+                @(negedge clk);
+                force dut.fast_jog_valid = 1'b0;
+                while (x_rises == 0 && guard < 60000) begin
+                    @(negedge clk);
+                    guard = guard + 1;
+                end
+                if (x_rises != 1) $fatal(1, "{marker}");
+                $display("PASS: prod2u_p4_individual_safety_gate_mutation_tb");
+                $finish;
+            end
+        endmodule
+        """
+    ).strip() + "\n"
+
+
 FIXED_SPEED_TB = textwrap.dedent(
     r"""
     `timescale 1ns/1ps
@@ -274,14 +301,12 @@ FIXED_SPEED_TB = textwrap.dedent(
     module prod2u_p4_fixed_speed_contract_mutation_tb;
         reg clk = 1'b0;
         reg rst_n = 1'b0;
-        reg request_valid = 1'b0;
-        reg [7:0] request_type = 8'h11;
-        reg [5:0] request_length = 6'd8;
-        reg [271:0] request_payload = 272'd0;
-        wire request_ready;
-        wire [2:0] step_out;
+        reg command_start = 1'b0;
+        reg command_dir = 1'b0;
+        reg [1:0] command_speed = 2'd0;
+        reg [15:0] command_steps = 16'd2;
+        wire step_out;
         integer cycle_count = 0;
-        integer guard;
         integer interval0;
         integer interval1;
         integer interval2;
@@ -290,28 +315,26 @@ FIXED_SPEED_TB = textwrap.dedent(
         always #5 clk = ~clk;
         always @(posedge clk) cycle_count = cycle_count + 1;
 
-        prod2u_p4_normal_v3_core #(
-            .CLK_HZ(64),
-            .WATCHDOG_SECONDS(8),
+        prod2u_p4_axis_executor #(
             .DIR_SETUP_CYCLES(2),
             .STEP_HALF_CYCLES(2)
         ) dut (
             .clk(clk), .rst_n(rst_n),
-            .request_valid(request_valid), .request_ready(request_ready),
-            .request_type(request_type), .request_length(request_length),
-            .request_payload(request_payload), .request_crc16(16'h3501),
-            .frame_valid(), .frame_ready(1'b1), .frame_type(),
-            .frame_payload_len(), .frame_payload(), .ptc_percent(),
-            .fan_percent(), .solenoid_percent(), .state_hash16(),
-            .step_out(step_out), .dir_out(), .en_n(), .disabled(),
-            .watchdog_timeout()
+            .command_start(command_start), .command_dir(command_dir),
+            .command_steps(command_steps),
+`ifdef MUTANT_SPEED_PORT
+            .command_speed(command_speed),
+`endif
+            .step_out(step_out), .dir_out(), .started_pulse()
         );
 
-        task reset_core;
+        task reset_axis;
             begin
                 rst_n = 1'b0;
-                request_valid = 1'b0;
-                request_payload = 272'd0;
+                command_start = 1'b0;
+                command_dir = 1'b0;
+                command_speed = 2'd0;
+                command_steps = 16'd2;
                 repeat (3) @(negedge clk);
                 rst_n = 1'b1;
                 repeat (2) @(negedge clk);
@@ -323,30 +346,17 @@ FIXED_SPEED_TB = textwrap.dedent(
             output integer interval;
             integer first_cycle;
             begin
-                reset_core();
-                guard = 0;
-                while (!request_ready && guard < 64) begin
-                    @(negedge clk);
-                    guard = guard + 1;
-                end
-                if (!request_ready) $fatal(1, "SPEED_FIXED_RATE_READY_FAIL");
-
+                reset_axis();
                 @(negedge clk);
-                request_payload = 272'd0;
-                request_payload[7:0] = 8'h35;
-                request_payload[15:8] = 8'd0;
-                request_payload[23:16] = 8'd0;
-                request_payload[31:24] = {6'd0, speed_code};
-                request_payload[47:32] = 16'd2;
-                request_valid = 1'b1;
-                @(posedge clk);
-                #1;
+                command_speed = speed_code;
+                command_steps = 16'd2;
+                command_start = 1'b1;
                 @(negedge clk);
-                request_valid = 1'b0;
+                command_start = 1'b0;
 
-                @(posedge step_out[0]);
+                @(posedge step_out);
                 first_cycle = cycle_count;
-                @(posedge step_out[0]);
+                @(posedge step_out);
                 interval = cycle_count - first_cycle;
                 if (interval <= 0) $fatal(1, "SPEED_FIXED_RATE_NO_SECOND_STEP");
             end
@@ -394,6 +404,69 @@ class MotionSourceMutationTests(unittest.TestCase):
         self.assertNotEqual(result.run_returncode, 0, result.output)
         self.assertIn(marker, result.output)
 
+    def assert_individual_top_gate_killed(
+        self,
+        *,
+        gate_expression: str,
+        label: str,
+        marker: str,
+        x_limit_raw: int,
+        disabled: int,
+        watchdog_timeout: int,
+    ) -> None:
+        with tempfile.TemporaryDirectory(
+            prefix=f"p4-mutant-{label}-", dir=ROOT.parent
+        ) as temporary:
+            workdir = Path(temporary)
+            testbench = workdir / "prod2u_p4_individual_safety_gate_mutation_tb.v"
+            testbench.write_text(
+                _top_individual_gate_tb(
+                    marker=marker,
+                    x_limit_raw=x_limit_raw,
+                    disabled=disabled,
+                    watchdog_timeout=watchdog_timeout,
+                ),
+                encoding="ascii",
+                newline="\n",
+            )
+            production_sources = tuple(
+                ROOT / relative for relative in harness.active_rtl_sources()
+            )
+            baseline = _run_icarus(
+                iverilog=self.iverilog,
+                vvp=self.vvp,
+                top="prod2u_p4_individual_safety_gate_mutation_tb",
+                sources=(*production_sources, testbench),
+                workdir=workdir,
+            )
+            self.assert_baseline_passed(
+                baseline,
+                "PASS: prod2u_p4_individual_safety_gate_mutation_tb",
+            )
+
+            mutant_top = workdir / f"prod2u_p4_normal_v3_top_{label}.v"
+            mutant_top.write_text(
+                _mutate_top_with_individual_step_gate(
+                    TOP_SOURCE.read_text(encoding="ascii"),
+                    gate_expression=gate_expression,
+                    label=label,
+                ),
+                encoding="ascii",
+                newline="\n",
+            )
+            mutant_sources = tuple(
+                mutant_top if source == TOP_SOURCE else source
+                for source in production_sources
+            )
+            mutant = _run_icarus(
+                iverilog=self.iverilog,
+                vvp=self.vvp,
+                top="prod2u_p4_individual_safety_gate_mutation_tb",
+                sources=(*mutant_sources, testbench),
+                workdir=workdir,
+            )
+            self.assert_mutant_killed(mutant, marker)
+
     def test_800_step_clamp_is_killed_by_real_16bit_boundary_tb(self) -> None:
         with tempfile.TemporaryDirectory(
             prefix="p4-mutant-clamp-", dir=ROOT.parent
@@ -434,27 +507,11 @@ class MotionSourceMutationTests(unittest.TestCase):
             workdir = Path(temporary)
             speed_tb = workdir / "prod2u_p4_fixed_speed_contract_mutation_tb.v"
             speed_tb.write_text(FIXED_SPEED_TB, encoding="ascii", newline="\n")
-            common = (
-                ROOT / "src/rtl/binary921_crc16.v",
-                ROOT / "src/rtl/prod2u_p4_normal_v3_output_state.v",
-                ROOT / "src/rtl/prod2u_p4_normal_v3_watchdog.v",
-            )
-            tail = (
-                ROOT / "src/rtl/prod2u_p4_response_scheduler.v",
-            )
-
             baseline = _run_icarus(
                 iverilog=self.iverilog,
                 vvp=self.vvp,
                 top="prod2u_p4_fixed_speed_contract_mutation_tb",
-                sources=(
-                    *common,
-                    AXIS_SOURCE,
-                    HUB_SOURCE,
-                    *tail,
-                    CORE_SOURCE,
-                    speed_tb,
-                ),
+                sources=(AXIS_SOURCE, speed_tb),
                 workdir=workdir,
             )
             self.assert_baseline_passed(
@@ -462,8 +519,6 @@ class MotionSourceMutationTests(unittest.TestCase):
             )
 
             mutant_axis = workdir / "prod2u_p4_axis_executor_speed.v"
-            mutant_hub = workdir / "prod2u_p4_motor_hub_speed.v"
-            mutant_core = workdir / "prod2u_p4_normal_v3_core_speed.v"
             mutant_axis.write_text(
                 _mutate_axis_with_speed_tiers(
                     AXIS_SOURCE.read_text(encoding="ascii")
@@ -471,15 +526,43 @@ class MotionSourceMutationTests(unittest.TestCase):
                 encoding="ascii",
                 newline="\n",
             )
-            mutant_hub.write_text(
-                _mutate_hub_with_speed_tiers(
-                    HUB_SOURCE.read_text(encoding="ascii")
-                ),
-                encoding="ascii",
-                newline="\n",
+            mutant = _run_icarus(
+                iverilog=self.iverilog,
+                vvp=self.vvp,
+                top="prod2u_p4_fixed_speed_contract_mutation_tb",
+                sources=(mutant_axis, speed_tb),
+                workdir=workdir,
+                defines=("MUTANT_SPEED_PORT",),
             )
+            self.assert_mutant_killed(mutant, "SPEED_FIXED_RATE_FAIL")
+
+    def test_fast_jog_request_ready_gate_is_killed_by_core_bypass_tb(self) -> None:
+        with tempfile.TemporaryDirectory(
+            prefix="p4-mutant-request-ready-", dir=ROOT.parent
+        ) as temporary:
+            workdir = Path(temporary)
+            sources = (
+                ROOT / "src/rtl/binary921_crc16.v",
+                ROOT / "src/rtl/prod2u_p4_normal_v3_output_state.v",
+                ROOT / "src/rtl/prod2u_p4_normal_v3_watchdog.v",
+                AXIS_SOURCE,
+                HUB_SOURCE,
+                ROOT / "src/rtl/prod2u_p4_response_scheduler.v",
+            )
+            baseline = _run_icarus(
+                iverilog=self.iverilog,
+                vvp=self.vvp,
+                top="prod2u_p4_fast_jog_core_tb",
+                sources=(*sources, CORE_SOURCE, FAST_JOG_CORE_TB),
+                workdir=workdir,
+            )
+            self.assert_baseline_passed(
+                baseline, "PASS: prod2u_p4_fast_jog_core_tb"
+            )
+
+            mutant_core = workdir / "prod2u_p4_normal_v3_core_request_ready.v"
             mutant_core.write_text(
-                _mutate_core_with_speed_tiers(
+                _mutate_core_with_request_ready_gate(
                     CORE_SOURCE.read_text(encoding="ascii")
                 ),
                 encoding="ascii",
@@ -488,18 +571,14 @@ class MotionSourceMutationTests(unittest.TestCase):
             mutant = _run_icarus(
                 iverilog=self.iverilog,
                 vvp=self.vvp,
-                top="prod2u_p4_fixed_speed_contract_mutation_tb",
-                sources=(
-                    *common,
-                    mutant_axis,
-                    mutant_hub,
-                    *tail,
-                    mutant_core,
-                    speed_tb,
-                ),
+                top="prod2u_p4_fast_jog_core_tb",
+                sources=(*sources, mutant_core, FAST_JOG_CORE_TB),
                 workdir=workdir,
             )
-            self.assert_mutant_killed(mutant, "SPEED_FIXED_RATE_FAIL")
+            self.assert_mutant_killed(
+                mutant,
+                "fast X JOG did not finish while the old response was stalled",
+            )
 
     def test_top_motor_safety_gates_are_killed_by_real_uart_top_tb(self) -> None:
         with tempfile.TemporaryDirectory(
@@ -541,6 +620,36 @@ class MotionSourceMutationTests(unittest.TestCase):
             )
             self.assert_mutant_killed(mutant, "NO_GATES_TOP_FAIL")
 
+    def test_limit_gate_is_independently_killed(self) -> None:
+        self.assert_individual_top_gate_killed(
+            gate_expression="!x_limit_raw",
+            label="limit_gate",
+            marker="LIMIT_GATE_FAIL",
+            x_limit_raw=1,
+            disabled=0,
+            watchdog_timeout=0,
+        )
+
+    def test_disable_gate_is_independently_killed(self) -> None:
+        self.assert_individual_top_gate_killed(
+            gate_expression="!disabled",
+            label="disable_gate",
+            marker="DISABLE_GATE_FAIL",
+            x_limit_raw=0,
+            disabled=1,
+            watchdog_timeout=0,
+        )
+
+    def test_watchdog_gate_is_independently_killed(self) -> None:
+        self.assert_individual_top_gate_killed(
+            gate_expression="!watchdog_timeout",
+            label="watchdog_gate",
+            marker="WATCHDOG_GATE_FAIL",
+            x_limit_raw=0,
+            disabled=0,
+            watchdog_timeout=1,
+        )
+
 
 if __name__ == "__main__":
     unittest.main()

+ 6 - 4
tests/unit/test_prod2u_p4_normal_v3_model.py

@@ -160,14 +160,16 @@ class Prod2UP4NormalV3ModelTests(unittest.TestCase):
                 self.assertEqual(subject.axes[0].remaining_steps, 1)
                 self.assertEqual(subject.busy_mask, 0)
 
-    def test_zero_step_jog_remains_bad_value_and_atomic(self) -> None:
+    def test_zero_step_jog_is_a_host_precondition_violation(self) -> None:
         subject = model.NormalV3Model()
         before = subject.state_fingerprint()
 
-        result = subject.apply_frame(zero_step_jog())
+        with self.assertRaisesRegex(
+            ValueError,
+            "RAW_U16_TRUSTED_HOST_NO_CPLD_CAP",
+        ):
+            subject.apply_frame(zero_step_jog())
 
-        self.assertFalse(result.accepted)
-        self.assertEqual(result.status, protocol.StatusCode.BAD_VALUE)
         self.assertEqual(subject.state_fingerprint(), before)
 
     def test_x_and_y_jog_can_overlap_without_busy_or_cross_axis_rejection(self) -> None:

+ 4 - 1
tests/unit/test_prod2u_p4_normal_v3_td_files.py

@@ -161,7 +161,10 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
                     encoding="ascii"
                 )
                 self.assertIn("motion_phase_register_count:$axis:[llength $matches]", source)
-                self.assertIn(r"/motion_phase\[[0-1]\]$", source)
+                self.assertIn(
+                    r"(u_core/u_motors/u_%s_axis/motion_phase\[[0-1]\])$",
+                    source,
+                )
                 self.assertNotIn(r"/motion_phase\[[0-2]\]$", source)
 
     def test_sdc_contains_only_the_25_mhz_clock(self) -> None:

+ 64 - 17
tests/unit/test_prod2u_p4_td_cdc_structure.py

@@ -3,6 +3,7 @@
 
 from __future__ import annotations
 
+import json
 import re
 import unittest
 from pathlib import Path
@@ -12,6 +13,9 @@ ROOT = Path(__file__).resolve().parents[2]
 AXIS = ROOT / "src" / "rtl" / "prod2u_p4_axis_executor.v"
 SYN = ROOT / "td" / "syn" / "prod2u_p4_normal_v3.tcl"
 PHY = ROOT / "td" / "phy" / "prod2u_p4_normal_v3.tcl"
+TD_RECEIPT_SCHEMA = (
+    ROOT / "schemas" / "prod2u_p4_normal_v3_td_build_receipt.schema.json"
+)
 
 
 class Prod2UP4TdCdcStructureTests(unittest.TestCase):
@@ -51,22 +55,25 @@ class Prod2UP4TdCdcStructureTests(unittest.TestCase):
         self.assertRegex(axis, r"reg \[1:0\] motion_phase;")
 
     def test_syn_and_phy_track_only_two_uart_cdc_registers(self) -> None:
-        expected_patterns = {
-            "*/u_uart_rx/rx_sync_pipe[0]",
-            "*/u_uart_rx/rx_sync_pipe[1]",
+        expected_groups = {
+            "u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}",
+            "u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}",
         }
         for path in (SYN, PHY):
             source = path.read_text(encoding="ascii")
-            block = source.split("set cdc_patterns {", 1)[1].split("}", 1)[0]
+            block = source.split("set cdc_groups {", 1)[1].split("\n}", 1)[0]
             observed = {line.strip() for line in block.splitlines() if line.strip()}
             with self.subTest(path=path.name):
-                self.assertEqual(observed, expected_patterns)
+                self.assertEqual(observed, expected_groups)
+                self.assertIn("proc p4_find_unique_regs {patterns}", source)
+                self.assertIn("lsearch -exact $matches $reg", source)
                 self.assertIn("if {[llength $cdc_regs] != 2}", source)
+                self.assertIn('puts $cdc_report "retained_sync_register=$normalized"', source)
                 self.assertNotIn("limit_sync_pipe", source)
 
     def test_only_uart_input_to_first_stage_is_false_pathed(self) -> None:
         expected_pairs = {
-            "host_uart_rx */u_uart_rx/rx_sync_pipe[0]",
+            "host_uart_rx u_uart_rx/rx_sync_pipe[0]",
         }
         for path in (SYN, PHY):
             source = path.read_text(encoding="ascii")
@@ -74,35 +81,75 @@ class Prod2UP4TdCdcStructureTests(unittest.TestCase):
             observed = {line.strip() for line in block.splitlines() if line.strip()}
             with self.subTest(path=path.name):
                 self.assertEqual(observed, expected_pairs)
-                self.assertEqual(source.count("set_false_path -from"), 2)
+                self.assertEqual(source.count("set_false_path -from"), 1)
+                self.assertIn("set_false_path -from $source -to $endpoint", source)
+                self.assertNotIn("set_false_path -from $source\n", source)
+                self.assertIn('puts $cdc_report "false_path_endpoint=$normalized"', source)
                 self.assertNotIn("x_limit_raw", source)
                 self.assertNotIn("y_limit_raw", source)
 
-    def test_td_structure_discovery_is_advisory_and_has_source_only_fallback(self) -> None:
+    def test_td_structure_discovery_fails_closed(self) -> None:
         for path in (SYN, PHY):
             source = path.read_text(encoding="ascii")
             with self.subTest(path=path.name):
-                self.assertNotRegex(source, r'\berror\s+"PROD2U_P4_NORMAL_V3_')
-                self.assertNotIn("_block \"expected", source)
                 self.assertIn("structural_failure=", source)
-                self.assertIn("set_false_path -from $source", source)
                 self.assertIn("set_false_path -from $source -to $endpoint", source)
                 self.assertLess(
                     source.index("set cdc_report [open"),
-                    source.index("foreach pattern $cdc_patterns"),
+                    source.index("foreach {normalized patterns} $cdc_groups"),
+                )
+                self.assertIn("CDC_GATE_FAIL=", source)
+                self.assertIn("FSM_ENCODING_GATE_FAIL=", source)
+                self.assertIn(
+                    'error "PROD2U_P4_NORMAL_V3_CDC_GATE_FAIL:[join $cdc_failures ,]"',
+                    source,
+                )
+                self.assertIn(
+                    'error "PROD2U_P4_NORMAL_V3_FSM_ENCODING_GATE_FAIL:[join $fsm_failures ,]"',
+                    source,
                 )
-                self.assertIn("CDC_GATE_ADVISORY_FAIL=", source)
-                self.assertIn("FSM_ENCODING_GATE_ADVISORY_FAIL=", source)
+                self.assertNotIn("CDC_GATE_ADVISORY_FAIL=", source)
+                self.assertNotIn("FSM_ENCODING_GATE_ADVISORY_FAIL=", source)
+
+    def test_td_receipt_schema_matches_uart_only_cdc_and_two_bit_axes(self) -> None:
+        schema = json.loads(TD_RECEIPT_SCHEMA.read_text(encoding="utf-8"))
+        structural = schema["$defs"]["structuralGate"]["properties"]
+        cdc = structural["cdc"]["properties"]
+        fsm = structural["fsm_encoding"]["properties"]
+
+        self.assertEqual(cdc["async_reg"]["properties"]["used"]["const"], 2)
+        self.assertEqual(cdc["input_registers"]["properties"]["used"]["const"], 0)
+        self.assertEqual(
+            cdc["retained_sync_registers"]["properties"]["used"]["const"],
+            2,
+        )
+        self.assertEqual(
+            cdc["first_stage_endpoints"]["properties"]["used"]["const"],
+            1,
+        )
+        self.assertEqual(fsm["axes"]["const"], {"x": 2, "y": 2})
 
     def test_td_reports_x_and_y_two_bit_sequential_motion_phase(self) -> None:
         for path in (SYN, PHY):
             source = path.read_text(encoding="ascii")
             with self.subTest(path=path.name):
                 self.assertIn("schema=prod2u-p4-normal-v3-fsm-encoding-v2", source)
-                self.assertIn("x {*/u_core/u_motors/u_x_axis/motion_phase*}", source)
-                self.assertIn("y {*/u_core/u_motors/u_y_axis/motion_phase*}", source)
-                self.assertIn("/motion_phase\\[[0-1]\\]$", source)
+                self.assertIn(
+                    "x {{u_core/u_motors/u_x_axis/motion_phase*} {*/u_core/u_motors/u_x_axis/motion_phase*}}",
+                    source,
+                )
+                self.assertIn(
+                    "y {{u_core/u_motors/u_y_axis/motion_phase*} {*/u_core/u_motors/u_y_axis/motion_phase*}}",
+                    source,
+                )
+                self.assertIn("(u_core/u_motors/u_%s_axis/motion_phase\\[[0-1]\\])$", source)
                 self.assertNotIn("/motion_phase\\[[0-2]\\]$", source)
+                self.assertIn("lsearch -exact $normalized_matches $normalized", source)
+                self.assertIn(
+                    "if {[llength $matches] != 2 || "
+                    "[llength $normalized_matches] != 2}",
+                    source,
+                )
                 self.assertIn("motion_phase=${axis}:[llength $matches]:sequential", source)
 
 

+ 38 - 0
tools/package_prod2u_p4_normal_v3.ps1

@@ -2,6 +2,7 @@ param(
     [Parameter(Mandatory = $true)][string]$OutputDir,
     [Parameter(Mandatory = $true)][string]$NormalBitstream,
     [Parameter(Mandatory = $true)][string]$TdReceipt,
+    [Parameter(Mandatory = $true)][ValidatePattern('^[0-9a-f]{32}$')][string]$VerificationRunId,
     [AllowEmptyString()][string]$ConfirmationTdReceipt = "",
     [string[]]$ValidationReceipt = @(),
     [string]$HostContract = "",
@@ -576,6 +577,9 @@ $tdPrimary = Read-Json $TdReceipt "Primary TD build receipt"
 if ([string](Get-PropertyValue $tdPrimary "commit") -ne $resolvedCommit) {
     throw "Primary TD receipt commit does not match package commit"
 }
+if ([string](Get-PropertyValue $tdPrimary "verification_run_id") -ne $VerificationRunId) {
+    throw "Primary TD receipt verification_run_id mismatch"
+}
 if ([string](Get-PropertyValue $tdPrimary "bitstream_sha256") -ne $bitstreamSha256) {
     throw "Primary TD receipt bitstream hash does not match package bitstream"
 }
@@ -594,10 +598,37 @@ if ($confirmationTdPresent) {
     if ($confirmationCommit -ne $resolvedCommit) {
         throw "Confirmation TD receipt commit does not match package commit"
     }
+    if ([string](Get-PropertyValue $tdConfirmation "verification_run_id") -ne $VerificationRunId) {
+        throw "Confirmation TD receipt verification_run_id mismatch"
+    }
     $confirmationBitstreamSha256 = Get-PropertyValue $tdConfirmation "bitstream_sha256"
+    if ($confirmationBitstreamSha256 -and
+        [string]$confirmationBitstreamSha256 -ne $bitstreamSha256) {
+        throw "Confirmation TD receipt bitstream hash does not match primary"
+    }
     $confirmationSynthesisInputHash = Get-PropertyValue $tdConfirmation "synthesis_input_hash"
     $confirmationManifest = Get-PropertyValue $tdConfirmation "synthesis_input_manifest"
     $confirmationManifestSha256 = Get-PropertyValue $confirmationManifest "sha256"
+    $primaryRunId = [string](Get-PropertyValue $tdPrimary "run_id")
+    $confirmationRunId = [string](Get-PropertyValue $tdConfirmation "run_id")
+    if ($primaryRunId -notmatch '^[0-9a-f]{32}$' -or
+        $confirmationRunId -notmatch '^[0-9a-f]{32}$' -or
+        $primaryRunId -eq $confirmationRunId) {
+        throw "Primary and confirmation TD run_id must differ"
+    }
+    $primaryWorkRoot = [string](Get-PropertyValue $tdPrimary "work_root")
+    $confirmationWorkRoot = [string](Get-PropertyValue $tdConfirmation "work_root")
+    if ([string]::IsNullOrWhiteSpace($primaryWorkRoot) -or
+        [string]::IsNullOrWhiteSpace($confirmationWorkRoot) -or
+        $primaryWorkRoot -cnotmatch '^[A-Za-z]:[\\/]' -or
+        $confirmationWorkRoot -cnotmatch '^[A-Za-z]:[\\/]' -or
+        [string]::Equals(
+            [System.IO.Path]::GetFullPath($primaryWorkRoot).TrimEnd('\'),
+            [System.IO.Path]::GetFullPath($confirmationWorkRoot).TrimEnd('\'),
+            [System.StringComparison]::OrdinalIgnoreCase
+        )) {
+        throw "Primary and confirmation TD work_root must differ"
+    }
 }
 
 $outFull = [System.IO.Path]::GetFullPath($OutputDir)
@@ -692,6 +723,9 @@ try {
         if ($null -ne $receiptCommit -and [string]$receiptCommit -ne $resolvedCommit) {
             throw "Validation receipt commit does not match package commit"
         }
+        if ([string](Get-PropertyValue $receipt "verification_run_id") -ne $VerificationRunId) {
+            throw "Validation receipt verification_run_id mismatch"
+        }
         $base = [System.IO.Path]::GetFileNameWithoutExtension($receiptPath) -replace '[^A-Za-z0-9_.-]', '_'
         $fileName = ("{0:D2}-{1}.json" -f $validationIndex, $base)
         $target = Join-Path $validationDir $fileName
@@ -702,6 +736,7 @@ try {
             sha256 = Get-Sha256 $target
             schema = Get-PropertyValue $receipt "schema"
             status = Get-PropertyValue $receipt "status"
+            verification_run_id = $VerificationRunId
         }
         Merge-ValidationReceipt $layers $receipt $relative
     }
@@ -711,6 +746,7 @@ try {
     $validationSummaryPath = Join-Path $evidenceDir "validation-summary.json"
     $validationSummary = [ordered]@{
         schema = "prod2u-p4-normal-v3-validation-summary-v1"
+        verification_run_id = $VerificationRunId
         commit = $resolvedCommit
         bitstream_sha256 = $bitstreamSha256
         delivery_mode = $deliveryMode
@@ -739,6 +775,7 @@ try {
     $packageInfo = [ordered]@{
         schema = "prod2u-p4-normal-v3-folder-package-info-v3"
         profile = "prod2u-p4-normal-actuator-binary921-v3"
+        verification_run_id = $VerificationRunId
         commit = $resolvedCommit
         bitstream_sha256 = $bitstreamSha256
         delivery_mode = $deliveryMode
@@ -782,6 +819,7 @@ try {
         schema = "prod2u-p4-normal-v3-folder-package-v3"
         status = "pass"
         package = $final
+        verification_run_id = $VerificationRunId
         commit = $resolvedCommit
         bitstream_sha256 = $bitstreamSha256
         delivery_mode = $deliveryMode

+ 51 - 0
tools/package_templates/selftest.ps1

@@ -70,6 +70,10 @@ $info = Get-Content -LiteralPath (Join-Path $root "package-info.json") -Raw -Enc
 if ([string]$info.schema -ne "prod2u-p4-normal-v3-folder-package-info-v3") {
     throw "package-info schema mismatch"
 }
+$verificationRunId = [string]$info.verification_run_id
+if ($verificationRunId -notmatch '^[0-9a-f]{32}$') {
+    throw "package verification_run_id is invalid"
+}
 if ([string]$info.profile -ne "prod2u-p4-normal-actuator-binary921-v3") {
     throw "package profile mismatch"
 }
@@ -141,6 +145,9 @@ if ([string]$info.package_selftest_result_sha256 -ne (Get-BoundSha256 $selftestR
 
 $primary = Get-Content -LiteralPath $primaryReceipt -Raw -Encoding UTF8 | ConvertFrom-Json
 if ([string]$primary.commit -ne $commit) { throw "primary TD receipt commit mismatch" }
+if ([string]$primary.verification_run_id -ne $verificationRunId) {
+    throw "primary TD receipt verification_run_id mismatch"
+}
 if ([string]$primary.bitstream_sha256 -ne $bitstreamSha256) {
     throw "primary TD receipt bitstream mismatch"
 }
@@ -152,12 +159,35 @@ if ($confirmationTdPresent) {
     if ([string]$confirmation.commit -ne $commit) {
         throw "confirmation TD receipt commit mismatch"
     }
+    if ([string]$confirmation.verification_run_id -ne $verificationRunId) {
+        throw "confirmation TD receipt verification_run_id mismatch"
+    }
+    if ($null -ne $confirmation.bitstream_sha256 -and
+        [string]$confirmation.bitstream_sha256 -ne $bitstreamSha256) {
+        throw "confirmation TD receipt bitstream mismatch"
+    }
     if ([string]$info.confirmation_synthesis_input_hash -ne [string]$confirmation.synthesis_input_hash) {
         throw "confirmation synthesis input hash mismatch"
     }
     if ([string]$info.confirmation_bitstream_sha256 -ne [string]$confirmation.bitstream_sha256) {
         throw "confirmation bitstream hash binding mismatch"
     }
+    if ([string]$primary.run_id -cnotmatch '^[0-9a-f]{32}$' -or
+        [string]$confirmation.run_id -cnotmatch '^[0-9a-f]{32}$' -or
+        [string]$primary.run_id -eq [string]$confirmation.run_id) {
+        throw "Primary and confirmation TD run_id must differ"
+    }
+    if ([string]::IsNullOrWhiteSpace([string]$primary.work_root) -or
+        [string]::IsNullOrWhiteSpace([string]$confirmation.work_root) -or
+        [string]$primary.work_root -cnotmatch '^[A-Za-z]:[\\/]' -or
+        [string]$confirmation.work_root -cnotmatch '^[A-Za-z]:[\\/]' -or
+        [string]::Equals(
+            [System.IO.Path]::GetFullPath([string]$primary.work_root).TrimEnd('\'),
+            [System.IO.Path]::GetFullPath([string]$confirmation.work_root).TrimEnd('\'),
+            [System.StringComparison]::OrdinalIgnoreCase
+        )) {
+        throw "Primary and confirmation TD work_root must differ"
+    }
 } else {
     if ($null -ne $info.confirmation_synthesis_input_hash -or
         $null -ne $info.confirmation_bitstream_sha256) {
@@ -168,6 +198,9 @@ $validation = Get-Content -LiteralPath $validationSummary -Raw -Encoding UTF8 |
 if ([string]$validation.schema -ne "prod2u-p4-normal-v3-validation-summary-v1") {
     throw "validation summary schema mismatch"
 }
+if ([string]$validation.verification_run_id -ne $verificationRunId) {
+    throw "validation summary verification_run_id mismatch"
+}
 if ([string]$validation.commit -ne $commit -or [string]$validation.bitstream_sha256 -ne $bitstreamSha256) {
     throw "validation summary binding mismatch"
 }
@@ -211,6 +244,23 @@ foreach ($name in $verificationEvidenceLayers) {
 if ($verificationComplete -ne $expectedVerificationComplete) {
     throw "verification_complete does not match validation evidence"
 }
+foreach ($source in @($validation.sources)) {
+    $relative = [string]$source.path
+    $sourcePath = Join-Path $root $relative
+    if (-not (Test-Path -LiteralPath $sourcePath -PathType Leaf)) {
+        throw "validation receipt is missing: $relative"
+    }
+    if ([string]$source.sha256 -ne (Get-BoundSha256 $sourcePath)) {
+        throw "validation receipt hash mismatch: $relative"
+    }
+    if ([string]$source.verification_run_id -ne $verificationRunId) {
+        throw "validation source verification_run_id mismatch: $relative"
+    }
+    $sourceReceipt = Get-Content -LiteralPath $sourcePath -Raw -Encoding UTF8 | ConvertFrom-Json
+    if ([string]$sourceReceipt.verification_run_id -ne $verificationRunId) {
+        throw "validation receipt verification_run_id mismatch: $relative"
+    }
+}
 
 $expectedFiles = @{}
 foreach ($property in @($info.file_sha256.PSObject.Properties)) {
@@ -234,6 +284,7 @@ foreach ($relative in $observedFiles.Keys) {
 [ordered]@{
     schema = "prod2u-p4-normal-v3-folder-selftest-v3"
     status = "pass"
+    verification_run_id = $verificationRunId
     commit = $commit
     bitstream_sha256 = $bitstreamSha256
     delivery_mode = $deliveryMode

+ 172 - 11
tools/prod2u_p4_harness.py

@@ -112,12 +112,45 @@ def new_td_run_id() -> str:
 
 
 def normalize_verification_run_id(value: str | None) -> str:
-    normalized = uuid.uuid4().hex if value is None else str(value).strip().lower()
+    if value is None or not str(value).strip():
+        raise ValueError("verification_run_id is required")
+    normalized = str(value).strip().lower()
     if not re.fullmatch(r"[0-9a-f]{32}", normalized):
         raise ValueError("verification_run_id must be 32 lowercase hex digits")
     return normalized
 
 
+def valid_td_run_id(value: object) -> bool:
+    return isinstance(value, str) and re.fullmatch(r"[0-9a-f]{32}", value) is not None
+
+
+def normalized_td_work_root(value: object) -> str | None:
+    if not isinstance(value, str) or not value.strip():
+        return None
+    candidate = Path(value)
+    if not candidate.is_absolute():
+        return None
+    return os.path.normcase(os.path.normpath(str(candidate.resolve(strict=False))))
+
+
+def td_receipts_are_independent(
+    primary: Mapping[str, Any],
+    confirmation: Mapping[str, Any],
+) -> bool:
+    primary_run_id = primary.get("run_id")
+    confirmation_run_id = confirmation.get("run_id")
+    primary_work_root = normalized_td_work_root(primary.get("work_root"))
+    confirmation_work_root = normalized_td_work_root(confirmation.get("work_root"))
+    return bool(
+        valid_td_run_id(primary_run_id)
+        and valid_td_run_id(confirmation_run_id)
+        and primary_run_id != confirmation_run_id
+        and primary_work_root is not None
+        and confirmation_work_root is not None
+        and primary_work_root != confirmation_work_root
+    )
+
+
 def sha256_file(path: Path) -> str:
     digest = hashlib.sha256()
     with Path(path).open("rb") as stream:
@@ -578,6 +611,10 @@ def hdl_testbenches() -> list[dict[str, Any]]:
 
 def cocotb_tests() -> list[dict[str, str]]:
     candidates = (
+        (
+            "prod2u_p4_fast_jog_top",
+            "run_prod2u_p4_fast_jog_top.py",
+        ),
         (
             "prod2u_p4_normal_v3_ack_only_top_e2e",
             "run_prod2u_p4_normal_v3_ack_only_top_e2e.py",
@@ -1619,7 +1656,17 @@ def target_inventory() -> dict[str, Any]:
 def unit_payload(work_root: Path) -> dict[str, Any]:
     modules = unit_test_modules()
     target_manifest = target_manifest_evidence("unit", modules)
-    command = [sys.executable, "-B", "-m", "unittest", "-v", *modules]
+    command = [
+        sys.executable,
+        "-B",
+        "-m",
+        "pytest",
+        "-q",
+        "-p",
+        "no:cacheprovider",
+        "tests/unit",
+        "tests/test_project_structure.py",
+    ]
     completed = subprocess.run(
         command,
         cwd=ROOT,
@@ -2966,6 +3013,15 @@ def package_selftest_payload(
     validation = loaded_inputs.get("validation", {})
     packaged_selftest = loaded_inputs.get("packaged_selftest", {})
 
+    for label, receipt in (
+        ("package_info", info),
+        ("primary_td", primary_td),
+        ("confirmation_td", confirmation_td),
+        ("validation", validation),
+    ):
+        if receipt and receipt.get("verification_run_id") != run_id:
+            failures.append(f"verification_run_id_mismatch:{label}")
+
     digest = None
     if not bitstream.is_file() or bitstream.stat().st_size <= 0:
         failures.append("bitstream_missing")
@@ -3050,6 +3106,11 @@ def package_selftest_payload(
     if confirmation_td:
         if confirmation_td.get("commit") != commit:
             failures.append("confirmation_td_commit_mismatch")
+        if (
+            confirmation_td.get("bitstream_sha256") not in {None, ""}
+            and confirmation_td.get("bitstream_sha256") != digest
+        ):
+            failures.append("confirmation_td_bitstream_sha256_mismatch")
         if info.get("confirmation_bitstream_sha256") != confirmation_td.get(
             "bitstream_sha256"
         ):
@@ -3058,6 +3119,24 @@ def package_selftest_payload(
             "synthesis_input_hash"
         ):
             failures.append("confirmation_td_synthesis_input_hash_mismatch")
+        primary_run_id = primary_td.get("run_id")
+        confirmation_run_id = confirmation_td.get("run_id")
+        if (
+            not valid_td_run_id(primary_run_id)
+            or not valid_td_run_id(confirmation_run_id)
+            or primary_run_id == confirmation_run_id
+        ):
+            failures.append("td_run_id_not_independent")
+        primary_work_root = normalized_td_work_root(primary_td.get("work_root"))
+        confirmation_work_root = normalized_td_work_root(
+            confirmation_td.get("work_root")
+        )
+        if (
+            primary_work_root is None
+            or confirmation_work_root is None
+            or primary_work_root == confirmation_work_root
+        ):
+            failures.append("td_work_root_not_independent")
     if validation:
         if validation.get("schema") != "prod2u-p4-normal-v3-validation-summary-v1":
             failures.append("validation_summary_schema_mismatch")
@@ -3093,10 +3172,18 @@ def package_selftest_payload(
                 ),
             }
             bitstream_layer = layers.get("td_confirmation_bitstream")
+            expected_bitstream_status = td_receipt_bitstream_binding_status(
+                confirmation_td
+            )
+            if (
+                expected_bitstream_status == "pass"
+                and confirmation_td.get("bitstream_sha256") != digest
+            ):
+                expected_bitstream_status = "fail"
             if (
                 not isinstance(bitstream_layer, Mapping)
                 or bitstream_layer.get("status")
-                != td_receipt_bitstream_binding_status(confirmation_td)
+                != expected_bitstream_status
             ):
                 failures.append(
                     "validation_layer_semantic_mismatch:td_confirmation_bitstream"
@@ -3263,6 +3350,14 @@ def _td_final_failures(
         failures.append(prefix + "status")
     if receipt.get("commit") != expected_commit:
         failures.append(prefix + "commit")
+    if not re.fullmatch(
+        r"[0-9a-f]{32}", str(receipt.get("verification_run_id", ""))
+    ):
+        failures.append(prefix + "verification_run_id")
+    if not valid_td_run_id(receipt.get("run_id")):
+        failures.append(prefix + "run_id")
+    if normalized_td_work_root(receipt.get("work_root")) is None:
+        failures.append(prefix + "work_root")
     if not re.fullmatch(r"[0-9a-f]{64}", str(receipt.get("bitstream_sha256", ""))):
         failures.append(prefix + "bitstream_sha256")
     if not re.fullmatch(r"[0-9a-f]{64}", str(receipt.get("synthesis_input_hash", ""))):
@@ -3281,6 +3376,36 @@ def _td_final_failures(
         if not _gate_is_pass(receipt, gate_name):
             failures.append(prefix + gate_name)
 
+    structural = receipt.get("structural_gate")
+    cdc = structural.get("cdc") if isinstance(structural, Mapping) else None
+    expected_cdc = {
+        "async_reg": 2,
+        "input_registers": 0,
+        "retained_sync_registers": 2,
+        "first_stage_endpoints": 1,
+    }
+    cdc_ok = isinstance(cdc, Mapping) and cdc.get("status") == "pass"
+    for name, expected in expected_cdc.items():
+        item = cdc.get(name) if isinstance(cdc, Mapping) else None
+        cdc_ok = cdc_ok and isinstance(item, Mapping) and item.get("used") == expected
+    if not cdc_ok:
+        failures.append(prefix + "structural_gate:cdc")
+
+    fsm = (
+        structural.get("fsm_encoding")
+        if isinstance(structural, Mapping)
+        else None
+    )
+    if not (
+        isinstance(fsm, Mapping)
+        and fsm.get("status") == "pass"
+        and fsm.get("encoding") == "sequential"
+        and fsm.get("axes") == {"x": 2, "y": 2}
+        and fsm.get("td_log_marker") is True
+        and fsm.get("reencoded_motion_phase_count") == 0
+    ):
+        failures.append(prefix + "structural_gate:fsm_encoding")
+
     resources = receipt.get("resources")
     utilization = resources.get("utilization") if isinstance(resources, Mapping) else None
     required_resources = {
@@ -3391,12 +3516,17 @@ def _package_final_failures(
     expected_confirmation_td_receipt_sha256: str,
 ) -> list[str]:
     failures: list[str] = []
+    expected_verification_run_id = receipt.get("verification_run_id")
     if receipt.get("schema") != PACKAGE_RECEIPT_SCHEMA:
         failures.append("package:schema")
     if receipt.get("status") != "pass" or receipt.get("commit") != expected_commit:
         failures.append("package:status_or_commit")
     if receipt.get("bitstream_sha256") != expected_bitstream_sha256:
         failures.append("package:bitstream_sha256")
+    if not re.fullmatch(
+        r"[0-9a-f]{32}", str(expected_verification_run_id or "")
+    ):
+        failures.append("package:verification_run_id")
     if receipt.get("delivery_mode") != "normal_dual_td":
         failures.append("package:delivery_mode")
     if receipt.get("failures") != []:
@@ -3447,6 +3577,7 @@ def _package_final_failures(
         if (
             info.get("schema") != "prod2u-p4-normal-v3-folder-package-info-v3"
             or info.get("profile") != RUNTIME_PROFILE
+            or info.get("verification_run_id") != expected_verification_run_id
             or info.get("commit") != expected_commit
             or info.get("bitstream_sha256") != expected_bitstream_sha256
         ):
@@ -3511,6 +3642,8 @@ def _package_final_failures(
     if primary_td:
         if (
             primary_td.get("commit") != expected_commit
+            or primary_td.get("verification_run_id")
+            != expected_verification_run_id
             or primary_td.get("bitstream_sha256") != expected_bitstream_sha256
             or info.get("synthesis_input_hash") != primary_td.get("synthesis_input_hash")
         ):
@@ -3518,6 +3651,10 @@ def _package_final_failures(
     if confirmation_td:
         if (
             confirmation_td.get("commit") != expected_commit
+            or confirmation_td.get("verification_run_id")
+            != expected_verification_run_id
+            or confirmation_td.get("bitstream_sha256")
+            != expected_bitstream_sha256
             or info.get("confirmation_bitstream_sha256")
             != confirmation_td.get("bitstream_sha256")
             or info.get("confirmation_synthesis_input_hash")
@@ -3528,6 +3665,8 @@ def _package_final_failures(
         if (
             validation.get("schema")
             != "prod2u-p4-normal-v3-validation-summary-v1"
+            or validation.get("verification_run_id")
+            != expected_verification_run_id
             or validation.get("commit") != expected_commit
             or validation.get("bitstream_sha256") != expected_bitstream_sha256
             or validation.get("delivery_mode") != "normal_dual_td"
@@ -3547,6 +3686,16 @@ def _package_final_failures(
 
 
 def cmd_final_gate(args: argparse.Namespace) -> int:
+    try:
+        verification_run_id = normalize_verification_run_id(
+            args.verification_run_id
+        )
+    except ValueError as exc:
+        return _emit(
+            {"status": "fail", "reason": str(exc)},
+            args,
+            "p4-normal-v3-final-gate",
+        )
     try:
         paths = {
             "offline": resolve_input_receipt(args.offline_receipt),
@@ -3595,7 +3744,7 @@ def cmd_final_gate(args: argparse.Namespace) -> int:
         )
     )
     for name, receipt in child_receipts.items():
-        if args.verification_run_id and receipt.get("verification_run_id") != args.verification_run_id:
+        if receipt.get("verification_run_id") != verification_run_id:
             failures.append(f"verification_run_id_mismatch:{name}")
     primary = child_receipts["td"]
     confirmation = child_receipts["td_confirmation"]
@@ -3613,9 +3762,21 @@ def cmd_final_gate(args: argparse.Namespace) -> int:
     )
     if primary.get("synthesis_input_hash") != confirmation.get("synthesis_input_hash"):
         failures.append("td_synthesis_input_hash_mismatch")
-    if primary.get("run_id") == confirmation.get("run_id"):
+    if primary.get("bitstream_sha256") != confirmation.get("bitstream_sha256"):
+        failures.append("td_bitstream_sha256_mismatch")
+    if (
+        not valid_td_run_id(primary.get("run_id"))
+        or not valid_td_run_id(confirmation.get("run_id"))
+        or primary.get("run_id") == confirmation.get("run_id")
+    ):
         failures.append("td_run_id_not_independent")
-    if primary.get("work_root") == confirmation.get("work_root"):
+    primary_work_root = normalized_td_work_root(primary.get("work_root"))
+    confirmation_work_root = normalized_td_work_root(confirmation.get("work_root"))
+    if (
+        primary_work_root is None
+        or confirmation_work_root is None
+        or primary_work_root == confirmation_work_root
+    ):
         failures.append("td_work_root_not_independent")
     if primary.get("td_tool") != confirmation.get("td_tool"):
         failures.append("td_tool_mismatch")
@@ -3627,7 +3788,7 @@ def cmd_final_gate(args: argparse.Namespace) -> int:
         "schema": "prod2u-p4-normal-v3-final-gate-v3",
         "status": "pass" if not failures else "fail",
         "generated_at": utc_now(),
-        "verification_run_id": args.verification_run_id,
+        "verification_run_id": verification_run_id,
         "commit": expected_commit,
         "source_state": state,
         "child_receipts": {
@@ -3658,7 +3819,7 @@ def build_parser() -> argparse.ArgumentParser:
 
     offline = sub.add_parser("p4-normal-v3-strict-offline-gate", help="run every required offline Normal v3 layer")
     offline.add_argument("--work-root", type=Path, required=True)
-    offline.add_argument("--verification-run-id")
+    offline.add_argument("--verification-run-id", required=True)
     _common_output_options(offline)
     offline.set_defaults(func=cmd_strict_offline)
 
@@ -3679,13 +3840,13 @@ def build_parser() -> argparse.ArgumentParser:
     td.add_argument("--run", action="store_true")
     td.add_argument("--top", choices=(PROFILE,), default=PROFILE)
     td.add_argument("--work-root", type=Path)
-    td.add_argument("--verification-run-id")
+    td.add_argument("--verification-run-id", required=True)
     _common_output_options(td)
     td.set_defaults(func=cmd_td_build)
 
     package = sub.add_parser("package-selftest", help="validate a folder delivery without hardware access")
     package.add_argument("--package-dir", type=Path, required=True)
-    package.add_argument("--verification-run-id")
+    package.add_argument("--verification-run-id", required=True)
     _common_output_options(package)
     package.set_defaults(func=cmd_package_selftest)
 
@@ -3694,7 +3855,7 @@ def build_parser() -> argparse.ArgumentParser:
     final.add_argument("--td-receipt", type=Path, required=True, help="optimized production O-A receipt")
     final.add_argument("--confirmation-td-receipt", type=Path, required=True, help="independent optimized production O-B receipt")
     final.add_argument("--package-receipt", type=Path, required=True)
-    final.add_argument("--verification-run-id")
+    final.add_argument("--verification-run-id", required=True)
     _common_output_options(final)
     final.set_defaults(func=cmd_final_gate)
 

+ 24 - 2
tools/prod2u_p4_normal_v3_model.py

@@ -20,6 +20,12 @@ from typing import Iterable, Sequence
 
 ROOT = Path(__file__).resolve().parents[1]
 PROFILE_ID = "prod2u-p4-normal-actuator-binary921-v3"
+RAW_STEP_POLICY = "RAW_U16_TRUSTED_HOST_NO_CPLD_CAP"
+FAST_PATH_POLICY = "RX_FAST_JOG_BYPASSES_NORMAL_REQUEST_SLOT"
+SAME_AXIS_HOST_RULE = "HOST_MUST_NOT_REPEAT_SAME_AXIS_BEFORE_COMPLETION"
+SAME_AXIS_VIOLATION_POLICY = "LATEST_COMMAND_WINS_OLD_ACK_NOT_GUARANTEED"
+COMPLETION_POLICY = "NONE_HOST_TRACKS_TIME"
+PARALLEL_POLICY = "TWO_INDEPENDENT_PARALLEL_EXECUTORS"
 
 MAGIC = b"\xA5\x5A"
 VERSION = 0x02
@@ -111,6 +117,10 @@ class ModelFrameError(ValueError):
         self.status = status
 
 
+class HostContractViolation(ValueError):
+    """Input excluded by the trusted-host contract, not a modeled device reply."""
+
+
 @dataclass(frozen=True)
 class PinSample:
     time_us: int
@@ -807,6 +817,8 @@ class NormalV3Model:
                 status=exc.status,
                 reason=str(exc),
             )
+        except HostContractViolation:
+            raise
         except ValueError as exc:
             result = self._result(
                 accepted=False,
@@ -911,11 +923,14 @@ class NormalV3Model:
         raw_dir = payload[2]
         speed_code = payload[3]
         steps = int.from_bytes(payload[4:6], "little")
+        if steps == 0:
+            raise HostContractViolation(
+                f"{RAW_STEP_POLICY}: steps=0 violates the trusted-host precondition"
+            )
         if (
             axis_index not in (0, 1)
             or raw_dir not in (0, 1)
             or speed_code >= 4
-            or not 1 <= steps <= 0xFFFF
             or payload[6:] != b"\x00\x00"
         ):
             return self._result(accepted=False, command=MOTION_JOG, status=STATUS_BAD_VALUE)
@@ -1420,7 +1435,14 @@ def run_fuzz(*, seed: int = 921003, iterations: int = 600) -> dict[str, object]:
                 payload[6] = 1
             else:
                 payload[7] = 1
-            result = subject.apply_frame(encode_motion_frame(payload))
+            if variant == 3:
+                try:
+                    subject.apply_frame(encode_motion_frame(payload))
+                except HostContractViolation:
+                    if subject.state_fingerprint() != before:
+                        atomicity_violations += 1
+            else:
+                result = subject.apply_frame(encode_motion_frame(payload))
         elif category == "host_unknown":
             result = subject.apply_frame(encode_host_frame(bytes((0x29, 0, 0, 0))))
         else: