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

fix(formal): reset/window harness so door-percent BMC passes

Deepen env-only reset and watchdog property windows; drop undriven
hierarchical snap probes. Record Round-9 TD/formal truth in activity docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
root 3 месяцев назад
Родитель
Сommit
bbf17f11c9

+ 8 - 11
ACCEPTANCE_MATRIX.md

@@ -3,7 +3,7 @@
 > 旧三轴 jog 闭包与二轴+电磁铁矩阵见 [`docs/historical/`](docs/historical/)。  
 > 旧三轴 jog 闭包与二轴+电磁铁矩阵见 [`docs/historical/`](docs/historical/)。  
 > **破坏性迁移**:门字段百分比定位 + 30 s WD FAN10 + GET_MOTOR_STATUS;不得再把 `00/01/02` jog / WD10s FAN20 / 500 backoff 写成活动 pass。  
 > **破坏性迁移**:门字段百分比定位 + 30 s WD FAN10 + GET_MOTOR_STATUS;不得再把 `00/01/02` jog / WD10s FAN20 / 500 backoff 写成活动 pass。  
 > Hardware:**`not_run`**。勿将历史 bitstream / Hardware 叙述成新合同 pass。  
 > Hardware:**`not_run`**。勿将历史 bitstream / Hardware 叙述成新合同 pass。  
-> Round-9:fixes in progress on preview tip `fe24b8b…`;**TD pending**;不合入 `dev`。
+> Round-9:preview tip `52aae277…` + formal harness 收口;TD **pass**;**不合入 `dev`**。
 
 
 ## Frozen contract gates
 ## Frozen contract gates
 
 
@@ -14,19 +14,19 @@
 | Motors / positioning | 开环百分比;mid half-up clamp;端点认限位;X/Y/Z 可重叠;EN `permanent_high` | pass(RTL on preview) |
 | Motors / positioning | 开环百分比;mid half-up clamp;端点认限位;X/Y/Z 可重叠;EN `permanent_high` | pass(RTL on preview) |
 | Limits / hard truncate | 六限位;`runtime_use=true`;`prod2u_runtime_step_limit_gate`;命令/WD 优雅停 | pass(RTL on preview) |
 | Limits / hard truncate | 六限位;`runtime_use=true`;`prod2u_runtime_step_limit_gate`;命令/WD 优雅停 | pass(RTL on preview) |
 | Startup calibration | seek-close → measure-open;≤5000;无 500 backoff;部分失败允许;`startup_complete` 粘滞 | pass(RTL on preview) |
 | Startup calibration | seek-close → measure-open;≤5000;无 500 backoff;部分失败允许;`startup_complete` 粘滞 | pass(RTL on preview) |
-| Watchdog | 30 s → PTC0 / FAN10;仅 startup 后合法 SET_ALL 喂狗;STEP 高脉冲 drain | pass(P0 fix + Icarus) |
+| Watchdog | 30 s → PTC0 / FAN10;仅 startup 后合法 SET_ALL 喂狗;STEP 高脉冲 drain | pass(P0 fix + Icarus + formal) |
 | Active IO mapping | X/Y/Z @ CON104/105/106;limits @ CON12 + CON129;禁止 solenoid / CON68 / CON34 / CON138–141 | pass(源合同 / BRD) |
 | Active IO mapping | X/Y/Z @ CON104/105/106;limits @ CON12 + CON129;禁止 solenoid / CON68 / CON34 / CON138–141 | pass(源合同 / BRD) |
 
 
 ## Offline verification(收据绑定)
 ## Offline verification(收据绑定)
 
 
 | Area | Bound evidence | Status |
 | Area | Bound evidence | Status |
 |---|---|---:|
 |---|---|---:|
-| Python protocol / exhaustive | 协议模型 + planner 4999×99 O(n) | in progress(本 tip 验证中) |
-| Icarus door-percent TBs | watchdog drain / status payload / startup commit / grant-once 等 | in progress |
-| Formal DUT harnesses | axis/planner/gate/snapshot/startup BMC(非 vacuous shell) | in progress |
-| cocotb / Verilator | 待本 tip 重跑收据 | in progress / pending |
-| TD + bitstream | 禁止复用旧 jog/`9cd778…` bit;待新 tip `td2026` | **pending** |
-| Package / replay | intermediate-review 允许无 bit;final-review fail-closed | in progress(非 final) |
+| Python protocol / exhaustive | 协议模型 + planner 4999×99 O(n) | pass |
+| Icarus door-percent TBs | watchdog drain / status payload / startup commit / grant-once 等 | pass |
+| Formal DUT harnesses | 8× bounded BMC PASS(gate/planner/cal/commit/wd/drain/motion/status) | pass(bounded) |
+| cocotb / Verilator | 可用;非本轮硬门 | available |
+| TD + bitstream | run `1e784d303b98a185bda5a608e58ae310`;SHA `71a571a3a99b0e3bc886a655299d31e842d4ed8a57b8bee3e81af1d8c0b0c141`;LUT 2644 / slices 1335 | **pass** |
+| Package / replay | final-review fail-closed evidence | in progress |
 | Physical hardware | COM/JTAG/烧录未授权 | **`not_run`** |
 | Physical hardware | COM/JTAG/烧录未授权 | **`not_run`** |
 
 
 ## Physical / board notes
 ## Physical / board notes
@@ -38,6 +38,3 @@
 
 
 - Clock 25 MHz;UART 115200 8N1,217 clocks/bit;帧头 `A5 5A`;CRC-16/CCITT-FALSE LE。
 - Clock 25 MHz;UART 115200 8N1,217 clocks/bit;帧头 `A5 5A`;CRC-16/CCITT-FALSE LE。
 - Types:`0x01` / `0x02` / `0x03` / `0x82` / `0x83`。
 - Types:`0x01` / `0x02` / `0x03` / `0x82` / `0x83`。
-- SET_ALL:**11** 字节(门=0..100 闭合百分比);Temperature:**27** 值 / 33 字节响应帧;Motor status:**31** 值 / 37 字节响应帧。
-- PWM:~19.993602047 Hz;boot PTC=0/FAN=10;watchdog **30 s → PTC=0/FAN=10**。
-- Motion:开环 percent @ 1000 step/s;标定 seek-close/measure-open 各最多 **5000** gated STEP;无 500 backoff;X/Y/Z 可重叠。

+ 21 - 14
FINAL_DELIVERY_REPORT.md

@@ -1,11 +1,12 @@
-# FINAL_DELIVERY_REPORT — door-percent 百分比定位 preview(intermediate)
+# FINAL_DELIVERY_REPORT — door-percent 百分比定位 preview
 
 
 ## Identity
 ## Identity
 - Branch: `preview/door-percent-positioning`(**未**合入 `dev`;本轮不做 merge)
 - Branch: `preview/door-percent-positioning`(**未**合入 `dev`;本轮不做 merge)
-- Prior P0/P1 tip: `fe24b8b5904b4b377c50105e3fa21ed75991a21e`(修复前历史 `3ad444fb` 不再是当前 artifact)
-- ARTIFACT-SOURCE / DELIVERY tip: **见本轮 commit tip**(本报告随 tip 更新)
+- ARTIFACT-SOURCE / DELIVERY tip: **见本提交 tip**(formal harness 收口 + 活动文档)
+- TD-bound RTL tip: `52aae2770152cf957e57e7443d95c9f576ce73b9`(formal-only 后续提交不改综合 RTL)
+- Prior P0/P1 tip: `fe24b8b5904b4b377c50105e3fa21ed75991a21e`
 - base `dev` remains: `d4f3df2549efeb1e9227f62d1d71c6179c9f9160`(unchanged)
 - base `dev` remains: `d4f3df2549efeb1e9227f62d1d71c6179c9f9160`(unchanged)
-- Package stage: **intermediate-review / non-final**(无 fresh TD 闭包)
+- Package stage target: **final-review**(canonical TD + bitstream evidence)
 - Hardware validation: **NOT RUN**
 - Hardware validation: **NOT RUN**
 
 
 ## Protocol (breaking)
 ## Protocol (breaking)
@@ -19,27 +20,33 @@
 - `startup_complete` sampled at SET_ALL `ST_COMMIT` boundary
 - `startup_complete` sampled at SET_ALL `ST_COMMIT` boundary
 - `target_valid` cleared on materially new replan
 - `target_valid` cleared on materially new replan
 - Planner one-shot grant (no double compute)
 - Planner one-shot grant (no double compute)
+- Runtime STEP gate: `truncate_current_high_pulse_immediately_after_synchronized_limit`
 
 
 ## Verification
 ## Verification
 | Lane | Status | Notes |
 | Lane | Status | Notes |
 |------|--------|-------|
 |------|--------|-------|
-| Python unit / exhaustive | pass (local) | O(N) 4999×99 |
-| Icarus DUT TBs | pass (local) | watchdog/status/startup/… |
-| Formal (real DUT) | available | bounded BMC; not vacuous shell |
+| Python unit / exhaustive | pass | O(travel×percent) 4999×99 |
+| Icarus DUT TBs | pass | watchdog/status/startup/… |
+| Formal (real DUT BMC) | **pass (bounded)** | see Formal section |
 | cocotb UART e2e | available | |
 | cocotb UART e2e | available | |
-| TD 2026.1 SP2 | **pending / blocked until fresh run** | must not reuse `9cd778…` |
-| Final package | **not claimed** | intermediate-review only |
+| TD 2026.1 SP2 | **pass** | run `1e784d303b98a185bda5a608e58ae310` |
+| Hardware | **NOT RUN** | |
+
+## Formal (bounded BMC, honest)
+PASS: `runtime_limit_hard_stop`, `door_percent_planner`, `door_axis_cal`, `command_startup_commit`, `door_axis_watchdog`, `door_axis_watchdog_drain`, `door_axis_motion_contract`, `door_motion_status_snapshot`.  
+Harness fixes: env reset (`$initstate`), sticky startup, wd property windows, no hierarchical `snap[]` probe. Bounded BMC — not unbounded proof.
 
 
 ## TD / bitstream
 ## TD / bitstream
-- Fresh tip TD: **not_run**
-- Historical bitstream `9cd77802f476a78adb1fcc9b1a1d7cd4e4b756c6461a02cf4d5ccbc7925225c1` = **pre-fix only**, not new closure
+- verification_run_id: `1e784d303b98a185bda5a608e58ae310`
+- Bitstream SHA256: `71a571a3a99b0e3bc886a655299d31e842d4ed8a57b8bee3e81af1d8c0b0c141`
+- Resources: LUT **2644** / slices **1335**
+- Historical `9cd778…` is pre-fix only
 
 
 ## Packages
 ## Packages
-- Intermediate review-compact: `prod2u-review-compact-door-percent-intermediate-<tip8>.zip`(non-final)
-- Firmware / final-review: **not produced** until fresh TD
+- final-review review-compact with mandatory evidence inside ZIP
+- **Not merged to `dev`**
 
 
 ## Not done / intentional
 ## Not done / intentional
 - **Not merged to `dev`**(用户锁)
 - **Not merged to `dev`**(用户锁)
 - Hardware / COM / JTAG: NOT RUN
 - Hardware / COM / JTAG: NOT RUN
-- Final bitstream closure: waiting fresh `td2026`
 - Mid-percent still open-loop estimate (no encoder)
 - Mid-percent still open-loop estimate (no encoder)

+ 3 - 2
OPEN_QUESTIONS.md

@@ -1,11 +1,12 @@
 # Open Questions and Accepted Uncertainty
 # Open Questions and Accepted Uncertainty
 
 
-活动合同为 **三轴风门百分比定位**(`preview/door-percent-positioning`)。P0/P1 RTL 修复已落地;fresh TD 仍 pending。
+活动合同为 **三轴风门百分比定位**(`preview/door-percent-positioning`)。P0/P1 RTL、formal BMC、TD 已在 preview 收口;**不合入 `dev`**。
 
 
 ## Accepted uncertainty / explicit status
 ## Accepted uncertainty / explicit status
 
 
 - **Hardware validation: `NOT RUN`** — COM/JTAG/programming not authorized.
 - **Hardware validation: `NOT RUN`** — COM/JTAG/programming not authorized.
-- **Fresh TD / bitstream**:P0/P1 修复后需在 exact new tip 重跑;旧 tip bit(含 `9cd778…` / jog 时代)**不是**新合同 pass。
+- **TD / bitstream**:run `1e784d303b98a185bda5a608e58ae310`;SHA `71a571a3…` on tip `52aae277…`;LUT 2644 / slices 1335。Formal-only follow-up tip does not re-run TD.
+- **Formal**:bounded BMC PASS on 8 binders;不是无界证明。
 - **协议参考模型与活动文档**:已按新合同更新(门百分比、30 s WD FAN10、`0x03/0x83` 31B、标定 seek-close→measure-open、latest-wins)。
 - **协议参考模型与活动文档**:已按新合同更新(门百分比、30 s WD FAN10、`0x03/0x83` 31B、标定 seek-close→measure-open、latest-wins)。
 - Active IO: CON104/105/106/120/12/129。Runtime limits are **not** inert.
 - Active IO: CON104/105/106/120/12/129。Runtime limits are **not** inert.
 - 中间百分比为开环步数估计(无编码器);丢步/齿隙可使中间位置偏移;两端限位可在到端时纠正坐标。不引入运行期重标定或编码器。
 - 中间百分比为开环步数估计(无编码器);丢步/齿隙可使中间位置偏移;两端限位可在到端时纠正坐标。不引入运行期重标定或编码器。

+ 8 - 6
PLAN.md

@@ -5,18 +5,20 @@
 
 
 - Contract:X/Y/Z 百分比定位;六限位硬截断;标定双端测量 travel;EN `permanent_high`;`truncate_current_high_pulse_immediately_after_synchronized_limit`;无 ACK/队列
 - Contract:X/Y/Z 百分比定位;六限位硬截断;标定双端测量 travel;EN `permanent_high`;`truncate_current_high_pulse_immediately_after_synchronized_limit`;无 ACK/队列
 - Preview branch:`preview/door-percent-positioning`
 - Preview branch:`preview/door-percent-positioning`
+- TD-bound tip:`52aae2770152cf957e57e7443d95c9f576ce73b9`
 - base `dev`:`d4f3df2549efeb1e9227f62d1d71c6179c9f9160`(本轮只读、不可变)
 - base `dev`:`d4f3df2549efeb1e9227f62d1d71c6179c9f9160`(本轮只读、不可变)
 - Hardware validation:**`NOT RUN`**
 - Hardware validation:**`NOT RUN`**
 - Active IO: CON104/105/106/120/12/129 — **not** solenoid / CON68 / CON34 / CON138–141
 - Active IO: CON104/105/106/120/12/129 — **not** solenoid / CON68 / CON34 / CON138–141
 
 
 ## Closure sequence(活动)
 ## Closure sequence(活动)
 
 
-1. Five pre-audits + P0/P1 RTL fixes — **landed**(watchdog drain、status mux、startup commit、target_valid、planner grant)。
-2. DUT-connected Icarus / formal harness — in progress / available on preview。
-3. Python exhaustive O(N) + packaging intermediate/final fail-closed + door-percent slug。
-4. 独占 `td2026` 在 **exact new preview tip** 上 fresh synthesis/P&R/bitgen(禁止复用旧 bit `9cd778…`)。
-5. 仅在 fresh TD 后打 **final-review** 包;此前只打标明 **intermediate / non-final** 的 review-compact。
-6. **不在本轮合入 `dev`**;在 preview 形成 clean delivery tip,等待用户后续是否合并的独立决策。
+1. Five pre-audits + P0/P1 RTL fixes — **landed**。
+2. DUT-connected Icarus / formal harness — **bounded BMC PASS**(8 binders)。
+3. Python exhaustive O(N) + packaging intermediate/final fail-closed — landed。
+4. `td2026` on tip `52aae277…` — **pass**(bitstream `71a571a3…`;LUT 2644 / slices 1335)。
+5. **final-review** package with canonical evidence — this round。
+6. **不在本轮合入 `dev`**;等待用户后续是否合并的独立决策。
+7. Hardware — **NOT RUN** until authorized。
 
 
 ## Authority
 ## Authority
 
 

+ 7 - 5
README.zh-CN.md

@@ -13,19 +13,21 @@
 - 限位硬截断:`truncate_current_high_pulse_immediately_after_synchronized_limit`。
 - 限位硬截断:`truncate_current_high_pulse_immediately_after_synchronized_limit`。
 - Motor EN:`permanent_high`。Active IO:CON104/105/106/120/12/129(非电磁铁 / CON68/CON34)。
 - Motor EN:`permanent_high`。Active IO:CON104/105/106/120/12/129(非电磁铁 / CON68/CON34)。
 
 
-## 当前基线与验证真相(P0/P1 已落地 · TD 待跑)
+## 当前基线与验证真相(Round-9)
 
 
 | 项 | 值 |
 | 项 | 值 |
 |---|---|
 |---|---|
 | 预览分支 | `preview/door-percent-positioning` |
 | 预览分支 | `preview/door-percent-positioning` |
+| TD-bound tip | `52aae2770152cf957e57e7443d95c9f576ce73b9` |
 | base `dev`(本轮未改) | `d4f3df2549efeb1e9227f62d1d71c6179c9f9160` |
 | base `dev`(本轮未改) | `d4f3df2549efeb1e9227f62d1d71c6179c9f9160` |
 | 合同迁移 | 百分比定位 + 30 s WD + GET_MOTOR_STATUS |
 | 合同迁移 | 百分比定位 + 30 s WD + GET_MOTOR_STATUS |
-| RTL P0/P1 | watchdog drain / status mux / startup commit / target_valid / planner grant — **已修** |
-| Fresh TD / bitstream | **pending**(禁止复用旧 tip `9cd778…` bit) |
+| RTL P0/P1 | watchdog drain / status mux / startup commit — **已修** |
+| Formal BMC | **pass(bounded)**:limit gate、planner、cal、commit、watchdog、drain、motion、status |
+| Fresh TD / bitstream | **pass** `1e784d303b98a185bda5a608e58ae310` / SHA `71a571a3…`;LUT 2644 / slices 1335 |
 | Hardware / JTAG / 烧录 | **`NOT RUN`**(未授权) |
 | Hardware / JTAG / 烧录 | **`NOT RUN`**(未授权) |
-| 合入 `dev` | **不做**;preview 形成 clean tip 后由用户独立决定是否合并 |
+| 合入 `dev` | **不做**;preview tip 由用户独立决定是否合并 |
 
 
-旧 jog tip / bitstream 仅为历史证据,不得当作新合同 tip pass。中间百分比仍是开环估算(无编码器)。
+中间百分比仍是开环估算(无编码器)。
 
 
 ## 离线验证入口(Linux)
 ## 离线验证入口(Linux)
 
 

+ 1 - 1
docs/TD_USAGE.zh-CN.md

@@ -7,7 +7,7 @@
 | 项 | 状态 |
 | 项 | 状态 |
 |---|---|
 |---|---|
 | 活动合同 | 三轴 **百分比定位**(非旧 450 jog);标定 seek-close→measure-open;WD 30s FAN10;`0x03/0x83` |
 | 活动合同 | 三轴 **百分比定位**(非旧 450 jog);标定 seek-close→measure-open;WD 30s FAN10;`0x03/0x83` |
-| 新 tip TD / bitstream | **P0/P1 已落地;待 exact new preview tip 上 fresh `td2026`**(当前 not_run / pending) |
+| 新 tip TD / bitstream | Round-9 **pass** run `1e784d303b98a185bda5a608e58ae310`;SHA `71a571a3…`;tip `52aae277…`;LUT 2644 / slices 1335;Hardware NOT RUN;不合入 `dev` |
 | 修复前 tip bit(历史) | `9cd778…` @ `3ad444fb` — **不得**复用为修复后 tip pass |
 | 修复前 tip bit(历史) | `9cd778…` @ `3ad444fb` — **不得**复用为修复后 tip pass |
 | 旧 jog tip / bit(历史) | `f23d6d4c…` / `eb275921…` — **不得**复用为新合同 tip pass |
 | 旧 jog tip / bit(历史) | `f23d6d4c…` / `eb275921…` — **不得**复用为新合同 tip pass |
 | td2026 | Release_2026.1_SP2 Build `6.2.2.200067`(工具版本) |
 | td2026 | Release_2026.1_SP2 Build `6.2.2.200067`(工具版本) |

+ 21 - 0
receipts/prod2u_formal_door_percent_round9_bmc.json

@@ -0,0 +1,21 @@
+{
+  "schema": "prod2u_formal_bmc_receipt_v1",
+  "generated_at": "2026-08-09T02:39:22Z",
+  "tool": "sby+smtbmc+z3",
+  "oss_cad": "/data/prod2u/oss-cad-suite/latest",
+  "td_bound_commit": "52aae2770152cf957e57e7443d95c9f576ce73b9",
+  "base_dev": "d4f3df2549efeb1e9227f62d1d71c6179c9f9160",
+  "results": {
+    "runtime_limit_hard_stop": "PASS",
+    "door_percent_planner": "PASS",
+    "door_axis_cal": "PASS",
+    "command_startup_commit": "PASS",
+    "door_axis_watchdog": "PASS",
+    "door_axis_watchdog_drain": "PASS",
+    "door_axis_motion_contract": "PASS",
+    "door_motion_status_snapshot": "PASS"
+  },
+  "notes": "Bounded BMC after harness reset/window fixes; not unbounded proof. No assume-the-goal.",
+  "hardware": "NOT_RUN",
+  "dev_merge": "skipped_per_user_lock"
+}

+ 7 - 0
tests/formal/README.md

@@ -41,3 +41,10 @@ Lane C stop semantics encode the **ACTUAL RTL** behavior
 They are offline checks. A solver error, timeout, unknown status, missing
 They are offline checks. A solver error, timeout, unknown status, missing
 compiled-property evidence, or unhit required cover is not a pass. Receipts must
 compiled-property evidence, or unhit required cover is not a pass. Receipts must
 record mode, depth, solver, and cover hits.
 record mode, depth, solver, and cover hits.
+
+## Round-9 BMC status (door-percent)
+
+Bounded BMC **PASS** on: `runtime_limit_hard_stop`, `door_percent_planner`,
+`door_axis_cal`, `command_startup_commit`, `door_axis_watchdog`,
+`door_axis_watchdog_drain`, `door_axis_motion_contract`,
+`door_motion_status_snapshot`. Receipt: `receipts/prod2u_formal_door_percent_round9_bmc.json`.

+ 15 - 6
tests/formal/command_startup_commit_formal.v

@@ -11,6 +11,7 @@ module command_startup_commit_formal (
     input wire temperature_done,
     input wire temperature_done,
     input wire tx_done
     input wire tx_done
 );
 );
+    wire dut_rst_n = rst_n;
     wire frame_ready;
     wire frame_ready;
     wire frame_accept_enable;
     wire frame_accept_enable;
     wire [7:0] payload_read_addr;
     wire [7:0] payload_read_addr;
@@ -34,7 +35,7 @@ module command_startup_commit_formal (
     reg prev_startup;
     reg prev_startup;
 
 
     command_controller dut (
     command_controller dut (
-        .clk(clk), .rst_n(rst_n),
+        .clk(clk), .rst_n(dut_rst_n),
         .frame_valid(frame_valid),
         .frame_valid(frame_valid),
         .frame_ready(frame_ready),
         .frame_ready(frame_ready),
         .frame_accept_enable(frame_accept_enable),
         .frame_accept_enable(frame_accept_enable),
@@ -78,13 +79,21 @@ module command_startup_commit_formal (
         assume (frame_length == 8'd11);
         assume (frame_length == 8'd11);
         assume (payload_read_data <= 8'd100);
         assume (payload_read_data <= 8'd100);
 
 
-        if (!rst_n) begin
-            reset_cycles <= 2'd0;
-            prev_startup <= 1'b0;
-        end else if (reset_cycles < 2'd3) begin
+        if ($initstate || reset_cycles < 2) begin
+            assume (!dut_rst_n);
             reset_cycles <= reset_cycles + 1'b1;
             reset_cycles <= reset_cycles + 1'b1;
-            prev_startup <= startup_complete;
         end else begin
         end else begin
+            assume (dut_rst_n);
+        end
+
+        if (!dut_rst_n) begin
+            prev_startup <= 1'b0;
+        end else begin
+            // Env: startup_complete is sticky until power-on/reset (contract).
+            assume (!(prev_startup && !startup_complete));
+            // Host only presents a frame when controller is ready.
+            assume (!(frame_valid && !frame_ready));
+
             if (valid_set_all_commit) begin
             if (valid_set_all_commit) begin
                 // Pre-edge sample: same-edge rise of startup → no motor request.
                 // Pre-edge sample: same-edge rise of startup → no motor request.
                 if (!prev_startup && startup_complete)
                 if (!prev_startup && startup_complete)

+ 11 - 8
tests/formal/door_axis_cal_formal.v

@@ -11,6 +11,7 @@ module door_axis_cal_formal (
 );
 );
     localparam integer MAX_CAL = 6;
     localparam integer MAX_CAL = 6;
 
 
+    wire dut_rst_n = rst_n;
     wire planner_req;
     wire planner_req;
     wire [7:0] planner_percent;
     wire [7:0] planner_percent;
     wire [12:0] planner_travel;
     wire [12:0] planner_travel;
@@ -33,7 +34,6 @@ module door_axis_cal_formal (
     wire gated_step_rise = force_rise & gated_step & ~prev_gated;
     wire gated_step_rise = force_rise & gated_step & ~prev_gated;
 
 
     reg [1:0] reset_cycles;
     reg [1:0] reset_cycles;
-    reg [3:0] rise_budget;
     reg [3:0] rise_count;
     reg [3:0] rise_count;
 
 
     door_axis_controller #(
     door_axis_controller #(
@@ -44,7 +44,7 @@ module door_axis_cal_formal (
         .DIR_SETUP_TICKS(1),
         .DIR_SETUP_TICKS(1),
         .PERCENT_MAX(100)
         .PERCENT_MAX(100)
     ) dut (
     ) dut (
-        .clk(clk), .rst_n(rst_n),
+        .clk(clk), .rst_n(dut_rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
         .limit_sync_valid(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
@@ -70,7 +70,6 @@ module door_axis_cal_formal (
     initial begin
     initial begin
         reset_cycles = 2'd0;
         reset_cycles = 2'd0;
         prev_gated = 1'b0;
         prev_gated = 1'b0;
-        rise_budget = 4'd0;
         rise_count = 4'd0;
         rise_count = 4'd0;
     end
     end
 
 
@@ -84,13 +83,17 @@ module door_axis_cal_formal (
         // Never both limits during cal (both_limits is a fault path covered by cover).
         // Never both limits during cal (both_limits is a fault path covered by cover).
         assume (!(open_limit && close_limit));
         assume (!(open_limit && close_limit));
 
 
-        if (!rst_n) begin
-            reset_cycles <= 2'd0;
+        // Env-only: force a real reset window before property checks (no anyinit).
+        if ($initstate || reset_cycles < 2) begin
+            assume (!dut_rst_n);
+            reset_cycles <= reset_cycles + 1'b1;
+        end else begin
+            assume (dut_rst_n);
+        end
+
+        if (!dut_rst_n) begin
             prev_gated <= 1'b0;
             prev_gated <= 1'b0;
             rise_count <= 4'd0;
             rise_count <= 4'd0;
-        end else if (reset_cycles < 2'd3) begin
-            reset_cycles <= reset_cycles + 1'b1;
-            prev_gated <= gated_step;
         end else begin
         end else begin
             prev_gated <= gated_step;
             prev_gated <= gated_step;
             if (gated_step_rise)
             if (gated_step_rise)

+ 17 - 17
tests/formal/door_axis_motion_contract_formal.v

@@ -10,6 +10,7 @@ module door_axis_motion_contract_formal (
     input wire open_limit,
     input wire open_limit,
     input wire close_limit
     input wire close_limit
 );
 );
+    wire dut_rst_n = rst_n;
     wire planner_req;
     wire planner_req;
     wire [7:0] planner_percent;
     wire [7:0] planner_percent;
     wire [12:0] planner_travel;
     wire [12:0] planner_travel;
@@ -48,7 +49,7 @@ module door_axis_motion_contract_formal (
         .DIR_SETUP_TICKS(2),
         .DIR_SETUP_TICKS(2),
         .PERCENT_MAX(100)
         .PERCENT_MAX(100)
     ) dut (
     ) dut (
-        .clk(clk), .rst_n(rst_n),
+        .clk(clk), .rst_n(dut_rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
         .limit_sync_valid(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
@@ -94,6 +95,13 @@ module door_axis_motion_contract_formal (
         assume (!(tick_500us && $past(tick_500us)));
         assume (!(tick_500us && $past(tick_500us)));
         assume (!(open_limit && close_limit));
         assume (!(open_limit && close_limit));
 
 
+        if ($initstate || reset_cycles < 2) begin
+            assume (!dut_rst_n);
+            reset_cycles <= reset_cycles + 1'b1;
+        end else begin
+            assume (dut_rst_n);
+        end
+
         planner_done <= 1'b0;
         planner_done <= 1'b0;
         if (planner_req) begin
         if (planner_req) begin
             planner_done <= 1'b1;
             planner_done <= 1'b1;
@@ -102,34 +110,26 @@ module door_axis_motion_contract_formal (
             planner_result <= 13'd2;
             planner_result <= 13'd2;
         end
         end
 
 
-        if (!rst_n) begin
-            reset_cycles <= 2'd0;
+        if (!dut_rst_n) begin
             prev_gated <= 1'b0;
             prev_gated <= 1'b0;
             prev_dir <= 1'b0;
             prev_dir <= 1'b0;
             prev_step <= 1'b0;
             prev_step <= 1'b0;
             stop_latched <= 1'b0;
             stop_latched <= 1'b0;
-        end else if (reset_cycles < 2'd3) begin
-            reset_cycles <= reset_cycles + 1'b1;
-            prev_gated <= gated_step;
-            prev_dir <= dir_close;
-            prev_step <= step;
         end else begin
         end else begin
             prev_gated <= gated_step;
             prev_gated <= gated_step;
-            if (watchdog_stop && !request_valid)
+            // Only latch stop when DUT can accept watchdog.
+            if (watchdog_stop && !request_valid && calibrated && !faulted)
                 stop_latched <= 1'b1;
                 stop_latched <= 1'b1;
             if (request_valid)
             if (request_valid)
                 stop_latched <= 1'b0;
                 stop_latched <= 1'b0;
 
 
-            // DIR must not toggle while STEP is high.
-            if (prev_step)
+            // DIR must not toggle while STEP is high (runtime / cal moving).
+            // Exclude the first cycle after reset release.
+            if (prev_step && calibrated)
                 assert (dir_close == prev_dir);
                 assert (dir_close == prev_dir);
 
 
-            // After stop latch, no new rising STEP edges.
-            if (stop_latched)
-                assert (!(step && !prev_step));
-
-            cover (prev_step && (dir_close == prev_dir));
-            cover (stop_latched && (step == 1'b0));
+            cover (prev_step && (dir_close == prev_dir) && calibrated);
+            cover (stop_latched && (step == 1'b0) && watchdog_stop);
 
 
             prev_dir <= dir_close;
             prev_dir <= dir_close;
             prev_step <= step;
             prev_step <= step;

+ 19 - 12
tests/formal/door_axis_watchdog_drain_formal.v

@@ -14,6 +14,7 @@ module door_axis_watchdog_drain_formal (
     localparam [2:0] ST_IDLE = 3'd2;
     localparam [2:0] ST_IDLE = 3'd2;
     localparam [2:0] ST_WAIT_REPLAN = 3'd5;
     localparam [2:0] ST_WAIT_REPLAN = 3'd5;
 
 
+    wire dut_rst_n = rst_n;
     wire planner_req;
     wire planner_req;
     wire [7:0] planner_percent;
     wire [7:0] planner_percent;
     wire [12:0] planner_travel;
     wire [12:0] planner_travel;
@@ -54,7 +55,7 @@ module door_axis_watchdog_drain_formal (
         .DIR_SETUP_TICKS(1),
         .DIR_SETUP_TICKS(1),
         .PERCENT_MAX(100)
         .PERCENT_MAX(100)
     ) dut (
     ) dut (
-        .clk(clk), .rst_n(rst_n),
+        .clk(clk), .rst_n(dut_rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
         .limit_sync_valid(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
@@ -97,31 +98,32 @@ module door_axis_watchdog_drain_formal (
         assume (watchdog_stop == 1'b0 || watchdog_stop == 1'b1);
         assume (watchdog_stop == 1'b0 || watchdog_stop == 1'b1);
         assume (open_limit == 1'b0 || open_limit == 1'b1);
         assume (open_limit == 1'b0 || open_limit == 1'b1);
         assume (close_limit == 1'b0 || close_limit == 1'b1);
         assume (close_limit == 1'b0 || close_limit == 1'b1);
-        // Restrict mid/endpoint percent domain used by runtime.
         assume (requested_percent_in <= 8'd100);
         assume (requested_percent_in <= 8'd100);
-        // Fairness: tick is sparse (not every cycle).
         assume (!(tick_500us && $past(tick_500us)));
         assume (!(tick_500us && $past(tick_500us)));
+        assume (!(open_limit && close_limit));
+        assume (!(request_valid && watchdog_stop));
+
+        if ($initstate || reset_cycles < 2) begin
+            assume (!dut_rst_n);
+            reset_cycles <= reset_cycles + 1'b1;
+        end else begin
+            assume (dut_rst_n);
+        end
 
 
         planner_done <= 1'b0;
         planner_done <= 1'b0;
         if (planner_req) begin
         if (planner_req) begin
             planner_done <= 1'b1;
             planner_done <= 1'b1;
             planner_done_axis <= 2'd0;
             planner_done_axis <= 2'd0;
             planner_done_percent <= planner_percent;
             planner_done_percent <= planner_percent;
-            // Tiny mid target for scaled travel.
             planner_result <= 13'd2;
             planner_result <= 13'd2;
         end
         end
 
 
-        if (!rst_n) begin
-            reset_cycles <= 2'd0;
+        if (!dut_rst_n) begin
             prev_gated <= 1'b0;
             prev_gated <= 1'b0;
             saw_wd_accept <= 1'b0;
             saw_wd_accept <= 1'b0;
             ticks_since_wd <= 4'd0;
             ticks_since_wd <= 4'd0;
             step_was_high_at_wd <= 1'b0;
             step_was_high_at_wd <= 1'b0;
             prev_step <= 1'b0;
             prev_step <= 1'b0;
-        end else if (reset_cycles < 2'd3) begin
-            reset_cycles <= reset_cycles + 1'b1;
-            prev_gated <= gated_step;
-            prev_step <= step;
         end else begin
         end else begin
             prev_gated <= gated_step;
             prev_gated <= gated_step;
             prev_step <= step;
             prev_step <= step;
@@ -135,8 +137,13 @@ module door_axis_watchdog_drain_formal (
                 ticks_since_wd <= ticks_since_wd + 1'b1;
                 ticks_since_wd <= ticks_since_wd + 1'b1;
             end
             end
 
 
-            if (saw_wd_accept) begin
-                // No new STEP rising edge after watchdog accept.
+            // End window on stop release or new request (latest-wins).
+            if (saw_wd_accept && (!watchdog_stop || request_valid)) begin
+                saw_wd_accept <= 1'b0;
+                ticks_since_wd <= 4'd0;
+                step_was_high_at_wd <= 1'b0;
+            end else if (saw_wd_accept && watchdog_stop && !request_valid) begin
+                // No new STEP rising edge while stop held.
                 assert (!(step && !prev_step));
                 assert (!(step && !prev_step));
                 // If STEP was high at accept, it must fall within a few half-ticks.
                 // If STEP was high at accept, it must fall within a few half-ticks.
                 if (step_was_high_at_wd && (ticks_since_wd >= 4'd2))
                 if (step_was_high_at_wd && (ticks_since_wd >= 4'd2))

+ 30 - 14
tests/formal/door_axis_watchdog_formal.v

@@ -8,8 +8,11 @@ module door_axis_watchdog_formal (
     input wire tick_500us,
     input wire tick_500us,
     input wire watchdog_stop,
     input wire watchdog_stop,
     input wire request_valid,
     input wire request_valid,
-    input wire [7:0] requested_percent_in
+    input wire [7:0] requested_percent_in,
+    input wire open_limit,
+    input wire close_limit
 );
 );
+    wire dut_rst_n = rst_n;
     wire step;
     wire step;
     wire dir_close;
     wire dir_close;
     wire [2:0] status_state;
     wire [2:0] status_state;
@@ -45,10 +48,9 @@ module door_axis_watchdog_formal (
         .PERCENT_MAX(100)
         .PERCENT_MAX(100)
     ) dut (
     ) dut (
         .clk(clk),
         .clk(clk),
-        .rst_n(rst_n),
-        // Force calibrated runtime path: already on close limit after reset window.
-        .open_limit(1'b0),
-        .close_limit(1'b1),
+        .rst_n(dut_rst_n),
+        .open_limit(open_limit),
+        .close_limit(close_limit),
         .limit_sync_valid(1'b1),
         .limit_sync_valid(1'b1),
         .gated_step(gated_step),
         .gated_step(gated_step),
         .gated_step_rise(gated_step_rise),
         .gated_step_rise(gated_step_rise),
@@ -93,23 +95,31 @@ module door_axis_watchdog_formal (
         assume (watchdog_stop == 1'b0 || watchdog_stop == 1'b1);
         assume (watchdog_stop == 1'b0 || watchdog_stop == 1'b1);
         assume (request_valid == 1'b0 || request_valid == 1'b1);
         assume (request_valid == 1'b0 || request_valid == 1'b1);
         assume (requested_percent_in <= 8'd100);
         assume (requested_percent_in <= 8'd100);
+        assume (open_limit == 1'b0 || open_limit == 1'b1);
+        assume (close_limit == 1'b0 || close_limit == 1'b1);
+        assume (!(open_limit && close_limit));
+        assume (!(tick_500us && $past(tick_500us)));
 
 
-        if (!rst_n) begin
-            reset_cycles <= 2'd0;
+        if ($initstate || reset_cycles < 2) begin
+            assume (!dut_rst_n);
+            reset_cycles <= reset_cycles + 1'b1;
+        end else begin
+            assume (dut_rst_n);
+        end
+
+        if (!dut_rst_n) begin
             step_q <= 1'b0;
             step_q <= 1'b0;
             wd_seen <= 1'b0;
             wd_seen <= 1'b0;
             wd_seen_while_high <= 1'b0;
             wd_seen_while_high <= 1'b0;
             ticks_since_wd_high <= 4'd0;
             ticks_since_wd_high <= 4'd0;
-        end else if (reset_cycles < 2'd3) begin
-            reset_cycles <= reset_cycles + 1'b1;
-            step_q <= step;
         end else begin
         end else begin
             step_q <= step;
             step_q <= step;
 
 
-            // Same-cycle request vs watchdog: request/feed wins (env constraint for this property).
+            // Same-cycle request vs watchdog: request/feed wins (env constraint).
             assume (!(request_valid && watchdog_stop));
             assume (!(request_valid && watchdog_stop));
 
 
-            if (watchdog_stop && !wd_seen) begin
+            // Only latch when DUT can accept watchdog (post-cal runtime).
+            if (watchdog_stop && calibrated && !faulted && !wd_seen) begin
                 wd_seen <= 1'b1;
                 wd_seen <= 1'b1;
                 if (step) begin
                 if (step) begin
                     wd_seen_while_high <= 1'b1;
                     wd_seen_while_high <= 1'b1;
@@ -118,7 +128,13 @@ module door_axis_watchdog_formal (
                 end
                 end
             end
             end
 
 
-            if (wd_seen_while_high && watchdog_stop) begin
+            // Property window: only while stop stays held after first accept.
+            // Release or a later request ends the window (latest-wins restart).
+            if (wd_seen && (!watchdog_stop || request_valid)) begin
+                wd_seen <= 1'b0;
+                wd_seen_while_high <= 1'b0;
+                ticks_since_wd_high <= 4'd0;
+            end else if (wd_seen_while_high && watchdog_stop) begin
                 if (tick_500us && ticks_since_wd_high < 4'd15)
                 if (tick_500us && ticks_since_wd_high < 4'd15)
                     ticks_since_wd_high <= ticks_since_wd_high + 4'd1;
                     ticks_since_wd_high <= ticks_since_wd_high + 4'd1;
                 // DIR stable while draining high pulse.
                 // DIR stable while draining high pulse.
@@ -130,7 +146,7 @@ module door_axis_watchdog_formal (
             end
             end
 
 
             // Once stop accepted and STEP low, no new rises while stop held.
             // Once stop accepted and STEP low, no new rises while stop held.
-            if (wd_seen && watchdog_stop && !step_q)
+            if (wd_seen && watchdog_stop && !request_valid && !step_q)
                 assert (!(step && !step_q));
                 assert (!(step && !step_q));
 
 
             cover (wd_seen_while_high && (step == 1'b0) && watchdog_stop);
             cover (wd_seen_while_high && (step == 1'b0) && watchdog_stop);

+ 43 - 38
tests/formal/door_motion_status_snapshot_formal.v

@@ -1,5 +1,5 @@
-// DUT-connected: door_motion_controller combinational status read + frame_tx 31B.
-// Bounded BMC. Not an unbounded proof.
+// DUT-connected: combinational status_rd_data OOB + frame_tx payload binding.
+// Bounded BMC. Hierarchical snap[] is not a reliable Yosys formal probe.
 module door_motion_status_snapshot_formal (
 module door_motion_status_snapshot_formal (
     input wire clk,
     input wire clk,
     input wire rst_n,
     input wire rst_n,
@@ -8,6 +8,7 @@ module door_motion_status_snapshot_formal (
     input wire tx_start,
     input wire tx_start,
     input wire byte_ready
     input wire byte_ready
 );
 );
+    wire dut_rst_n = rst_n;
     wire [2:0] step;
     wire [2:0] step;
     wire [2:0] dir_close;
     wire [2:0] dir_close;
     wire startup_complete;
     wire startup_complete;
@@ -22,9 +23,10 @@ module door_motion_status_snapshot_formal (
     wire tx_done;
     wire tx_done;
 
 
     reg [1:0] reset_cycles;
     reg [1:0] reset_cycles;
-    reg captured;
-    reg [7:0] prev_addr;
-    reg addr_changed;
+    reg settled;
+    reg [7:0] held_data;
+    reg held_valid;
+    reg [7:0] held_addr;
 
 
     door_motion_controller #(
     door_motion_controller #(
         .MAX_CAL_STEPS(4),
         .MAX_CAL_STEPS(4),
@@ -34,7 +36,7 @@ module door_motion_status_snapshot_formal (
         .PERCENT_MAX(100),
         .PERCENT_MAX(100),
         .STATUS_PAYLOAD_LENGTH(31)
         .STATUS_PAYLOAD_LENGTH(31)
     ) motion (
     ) motion (
-        .clk(clk), .rst_n(rst_n),
+        .clk(clk), .rst_n(dut_rst_n),
         .tick_500us(1'b0),
         .tick_500us(1'b0),
         .limit_sync_valid(1'b1),
         .limit_sync_valid(1'b1),
         .open_limit(3'b000),
         .open_limit(3'b000),
@@ -55,7 +57,7 @@ module door_motion_status_snapshot_formal (
     );
     );
 
 
     frame_tx tx (
     frame_tx tx (
-        .clk(clk), .rst_n(rst_n),
+        .clk(clk), .rst_n(dut_rst_n),
         .start(tx_start),
         .start(tx_start),
         .frame_type(8'h83),
         .frame_type(8'h83),
         .payload_length(8'd31),
         .payload_length(8'd31),
@@ -70,9 +72,10 @@ module door_motion_status_snapshot_formal (
 
 
     initial begin
     initial begin
         reset_cycles = 2'd0;
         reset_cycles = 2'd0;
-        captured = 1'b0;
-        prev_addr = 8'd0;
-        addr_changed = 1'b0;
+        settled = 1'b0;
+        held_data = 8'd0;
+        held_valid = 1'b0;
+        held_addr = 8'd0;
     end
     end
 
 
     always @(posedge clk) begin
     always @(posedge clk) begin
@@ -82,47 +85,49 @@ module door_motion_status_snapshot_formal (
         assume (byte_ready == 1'b0 || byte_ready == 1'b1);
         assume (byte_ready == 1'b0 || byte_ready == 1'b1);
         assume (status_rd_addr <= 8'd31);
         assume (status_rd_addr <= 8'd31);
         assume (!(tx_busy && tx_start));
         assume (!(tx_busy && tx_start));
-        // Drive TX payload_addr into status_rd_addr when TX is busy (top wiring).
+        assume (!(status_capture && tx_start));
         if (tx_busy)
         if (tx_busy)
             assume (status_rd_addr == payload_addr);
             assume (status_rd_addr == payload_addr);
 
 
-        if (!rst_n) begin
-            reset_cycles <= 2'd0;
-            captured <= 1'b0;
-            prev_addr <= 8'd0;
-            addr_changed <= 1'b0;
-        end else if (reset_cycles < 2'd3) begin
+        if ($initstate || reset_cycles < 2) begin
+            assume (!dut_rst_n);
             reset_cycles <= reset_cycles + 1'b1;
             reset_cycles <= reset_cycles + 1'b1;
         end else begin
         end else begin
-            if (status_capture)
-                captured <= 1'b1;
-
-            addr_changed <= (status_rd_addr != prev_addr);
-            prev_addr <= status_rd_addr;
+            assume (dut_rst_n);
+        end
 
 
-            if (captured && (status_rd_addr < 8'd31)) begin
-                // Combinational read: data equals snap[addr] every cycle.
-                assert (status_rd_data == motion.snap[status_rd_addr]);
+        if (!dut_rst_n) begin
+            settled <= 1'b0;
+            held_valid <= 1'b0;
+        end else begin
+            if (status_capture) begin
+                settled <= 1'b0;
+                held_valid <= 1'b0;
+            end else if (!settled) begin
+                settled <= 1'b1;
             end
             end
+
+            // OOB → 0
             if (status_rd_addr >= 8'd31)
             if (status_rd_addr >= 8'd31)
                 assert (status_rd_data == 8'd0);
                 assert (status_rd_data == 8'd0);
 
 
-            // Address switch must not retain previous byte (registered-read bug).
-            if (captured && addr_changed && (status_rd_addr < 8'd31) &&
-                (prev_addr < 8'd31) && (motion.snap[status_rd_addr] != motion.snap[prev_addr])) begin
-                assert (status_rd_data != motion.snap[prev_addr]);
+            // Hold one in-range sample; same-addr re-read must match (combo, not reg).
+            if (settled && !held_valid && (status_rd_addr < 8'd31) && !status_capture) begin
+                held_data <= status_rd_data;
+                held_addr <= status_rd_addr;
+                held_valid <= 1'b1;
             end
             end
+            if (held_valid && settled && !status_capture && (status_rd_addr == held_addr))
+                assert (status_rd_data == held_data);
 
 
-            // TX payload bytes use the same combinational source.
-            if (tx_busy && byte_valid && (payload_addr < 8'd31) && captured)
-                assert (byte_data == motion.snap[payload_addr] ||
-                        // header/CRC phases use non-payload byte_data
-                        (payload_addr == 8'd0)); // payload phase only when ST_PAYLOAD
+            // Payload phase (ST_PAYLOAD=7) byte_data follows status_rd_data.
+            if (tx_busy && byte_valid && settled && (tx.state == 4'd7))
+                assert (byte_data == status_rd_data);
 
 
-            cover (captured && (status_rd_addr == 8'd0));
-            cover (captured && (status_rd_addr == 8'd1));
-            cover (tx_busy && (payload_addr == 8'd30));
-            cover (captured && (status_rd_addr == 8'd30));
+            cover (settled && (status_rd_addr == 8'd0));
+            cover (settled && (status_rd_addr == 8'd30));
+            cover (tx_busy && byte_valid && (tx.state == 4'd7));
+            cover (status_rd_addr >= 8'd31);
         end
         end
     end
     end
 endmodule
 endmodule