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

feat(mse): keep Scheme A after shared-DDA LUT regression

Scheme B (TDM DDA) restored Fmax but stayed ~+1k LUT over Round-12 after two
synthesis rounds; retain R12 per-axis kernels, archive B evidence, and add the
three-axis overlap TB for concurrent motion coverage.

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

+ 1 - 0
config/prod2u_p4_verification_targets_v1.json

@@ -34,6 +34,7 @@
       "pwm_scheduler_tb",
       "door_percent_planner_tb",
       "door_motion_controller_tb",
+      "door_motion_three_axis_overlap_tb",
       "door_axis_watchdog_drain_tb",
       "door_axis_request_limit_race_tb",
       "door_axis_request_planner_collision_tb",

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


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


+ 21 - 0
receipts/mse-td-manual-phy.json

@@ -0,0 +1,21 @@
+{
+  "status": "pass",
+  "lut": {
+    "used": 4151,
+    "total": 4480,
+    "percent": 92.66
+  },
+  "reg": {
+    "used": 1562,
+    "total": 4480,
+    "percent": 34.87
+  },
+  "motor_lut": 2576,
+  "motor_le": 2937,
+  "fmax_mhz": 23.056,
+  "packing": {
+    "mslice": 1048,
+    "lslice": 1049,
+    "total_slices": 2097
+  }
+}

+ 13 - 0
receipts/mse-td-opt1-phy.json

@@ -0,0 +1,13 @@
+{
+  "status": "pass",
+  "lut": {
+    "used": 3950
+  },
+  "reg": {
+    "used": 1711
+  },
+  "le": 3950,
+  "fmax_mhz": 53.011,
+  "swns_ns": 21.136,
+  "td_root": "/data/prod2u/td-runs/mse-opt1-20260811T101907Z"
+}

+ 13 - 0
receipts/mse-td-opt2-phy.json

@@ -0,0 +1,13 @@
+{
+  "status": "pass",
+  "lut": 3984,
+  "reg": 1700,
+  "fmax_mhz": 61.709,
+  "swns_ns": 23.795,
+  "motor_le": 2773,
+  "motor_lut": 2555,
+  "dda_le": 567,
+  "dda_lut": 518,
+  "td_root": "/data/prod2u/td-runs/mse-opt2-20260811T102516Z",
+  "vs_r12_lut_delta": 1091
+}

+ 12 - 0
receipts/mse-td-schemeA-phy.json

@@ -0,0 +1,12 @@
+{
+  "scheme": "A",
+  "status": "pass",
+  "lut": 2893,
+  "reg": 1233,
+  "fmax_mhz": 67.096,
+  "swns_ns": 25.096,
+  "motor_le": 1686,
+  "motor_lut": 1593,
+  "vs_r12": 0,
+  "td_root": "/data/prod2u/td-runs/mse-schemeA-20260811T102903Z"
+}

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


+ 758 - 0
receipts/scheme-b-attempt/door_axis_controller.v

@@ -0,0 +1,758 @@
+`timescale 1ns/1ps
+
+// Per-axis door percent FSM: cal seek-close → measure-open, then runtime
+// mid/endpoint motion with latest-wins replan. Position only on gated_step_rise.
+module door_axis_controller #(
+    parameter integer AXIS_ID = 0,
+    parameter integer MAX_CAL_STEPS = 5000,
+    parameter integer MIN_TRAVEL = 2,
+    parameter integer ENDPOINT_GUARD_EXTRA = 500,
+    parameter integer DIR_SETUP_TICKS = 2,
+    parameter integer PERCENT_MAX = 100
+) (
+    input  wire        clk,
+    input  wire        rst_n,
+    input  wire        open_limit,
+    input  wire        close_limit,
+    input  wire        limit_sync_valid,
+    input  wire        gated_step,
+    input  wire        gated_step_rise,
+    input  wire        tick_500us,
+    input  wire        cal_enabled,
+    input  wire        exec_toggle_pulse,
+    input  wire        request_valid,
+    input  wire [7:0]  requested_percent_in,
+    input  wire        watchdog_stop,
+    output reg         planner_req,
+    output wire [7:0]  planner_percent,
+    output wire [12:0] planner_travel,
+    input  wire        planner_done,
+    input  wire [1:0]  planner_done_axis,
+    input  wire [7:0]  planner_done_percent,
+    input  wire [12:0] planner_result,
+    output reg         step,
+    output reg         dir_close,
+    output reg  [2:0]  status_state,
+    output reg  [7:0]  status_flags,
+    output reg  [7:0]  status_requested_percent,
+    output reg  [12:0] status_current,
+    output reg  [12:0] status_target,
+    output reg  [12:0] status_travel,
+    output reg  [7:0]  status_fault_code,
+    output wire        calibrated,
+    output wire        faulted,
+    output wire        terminal,
+    // Shared DDA executor observables
+    output wire        dda_cal_active,
+    output wire        dda_run_active,
+    output wire        dda_allow_toggle,
+    output wire        dda_endpoint_crawl,
+    output wire [12:0] dda_distance,
+    output wire [12:0] dda_done_steps,
+    output wire [12:0] dda_ramp_unit,
+    output wire [12:0] dda_travel_steps
+);
+    localparam [2:0] ST_CAL_SEEK_CLOSE   = 3'd0;
+    localparam [2:0] ST_CAL_MEASURE_OPEN = 3'd1;
+    localparam [2:0] ST_IDLE             = 3'd2;
+    localparam [2:0] ST_MOVE_OPEN        = 3'd3;
+    localparam [2:0] ST_MOVE_CLOSE       = 3'd4;
+    localparam [2:0] ST_WAIT_REPLAN      = 3'd5;
+    localparam [2:0] ST_FAULT            = 3'd6;
+
+    localparam [2:0] FC_NONE              = 3'd0;
+    localparam [2:0] FC_BOTH_LIMITS       = 3'd1;
+    localparam [2:0] FC_CAL_CLOSE_TIMEOUT = 3'd2;
+    localparam [2:0] FC_CAL_OPEN_TIMEOUT  = 3'd3;
+    localparam [2:0] FC_TINY_TRAVEL       = 3'd4;
+    localparam [2:0] FC_ENDPOINT_TIMEOUT  = 3'd5;
+
+    localparam [2:0] PH_NONE       = 3'd0;
+    localparam [2:0] PH_DIR_SETUP  = 3'd1;
+    localparam [2:0] PH_RUN        = 3'd2;
+    localparam [2:0] PH_DRAIN_HIGH = 3'd3;
+
+    localparam integer CNT_W = 13;
+    localparam [CNT_W-1:0] MAX_STEPS_W = MAX_CAL_STEPS[CNT_W-1:0];
+    localparam [CNT_W-1:0] MIN_TRAVEL_W = MIN_TRAVEL[CNT_W-1:0];
+    localparam [CNT_W-1:0] CAL_RAMP_UNIT_W = 13'd8;
+
+    reg        calibrated_r;
+    reg [2:0]  fault_code;
+    reg [CNT_W-1:0] travel_steps;
+    reg [CNT_W-1:0] current_position;
+    reg [CNT_W-1:0] target_position;
+    reg [7:0]  requested_percent;
+    reg        replan_pending;
+    reg        endpoint_mode;
+    reg        target_valid;
+    reg        moving;
+    reg [2:0]  phase;
+    reg [3:0]  setup_count;
+    reg [CNT_W-1:0] motion_count;
+    reg        allow_rise;
+    reg        stop_after_budget;
+    reg        cal_started;
+    reg        need_planner;
+    reg        wd_stopped;
+    reg        open_limit_armed;
+    reg        close_limit_armed;
+    reg [CNT_W-1:0] move_distance;
+    reg [CNT_W-1:0] move_ramp_unit;
+    reg [CNT_W-1:0] curve_done_count;
+
+    assign calibrated = calibrated_r;
+    assign faulted = (status_state == ST_FAULT);
+    assign terminal = ((status_state == ST_IDLE) && calibrated_r) || (status_state == ST_FAULT);
+    assign planner_percent = requested_percent;
+    assign planner_travel = travel_steps;
+
+    wire both_limits = open_limit && close_limit;
+    wire mid_request = (requested_percent > 8'd0) && (requested_percent < PERCENT_MAX[7:0]);
+    wire is_open_endpoint = (requested_percent == 8'd0);
+    wire is_close_endpoint = (requested_percent == PERCENT_MAX[7:0]);
+    wire planner_accept = planner_done && (planner_done_axis == AXIS_ID[1:0]) &&
+        (planner_done_percent == requested_percent) && calibrated_r &&
+        (status_state != ST_FAULT) && mid_request && need_planner;
+    wire [CNT_W-1:0] guard_limit = travel_steps + ENDPOINT_GUARD_EXTRA[CNT_W-1:0];
+    wire in_calibration = (status_state == ST_CAL_SEEK_CLOSE) ||
+                          (status_state == ST_CAL_MEASURE_OPEN);
+    wire open_assert_event = open_limit && open_limit_armed;
+    wire close_assert_event = close_limit && close_limit_armed;
+    wire departing_close_source =
+        calibrated_r && !in_calibration &&
+        ((status_state == ST_MOVE_OPEN) || (moving && !dir_close));
+    wire departing_open_source =
+        calibrated_r && !in_calibration &&
+        ((status_state == ST_MOVE_CLOSE) || (moving && dir_close));
+    wire close_snap_accept =
+        calibrated_r && !in_calibration &&
+        close_assert_event && !departing_close_source;
+    wire open_snap_accept =
+        calibrated_r && !in_calibration &&
+        open_assert_event && !departing_open_source;
+    // Pre-NBA view: single-limit coordinate disagrees with accepted snap event.
+    wire limit_pos_mismatch =
+        (close_snap_accept && (current_position != travel_steps)) ||
+        (open_snap_accept && (current_position != {CNT_W{1'b0}}));
+
+    // Combinational endpoint-effective coordinate for same-cycle planner decisions.
+    // Use held source limit (not only one-shot snap): departure may consume arm
+    // without snapping, so a later mid accept while close_limit stays high must
+    // still treat the axis as at travel (never MOVE_CLOSE into the close limit).
+    wire close_source_hold =
+        calibrated_r && !in_calibration && close_limit && !departing_close_source;
+    wire open_source_hold =
+        calibrated_r && !in_calibration && open_limit && !departing_open_source;
+    wire [CNT_W-1:0] effective_current_position =
+        close_source_hold ? travel_steps :
+        open_source_hold ? {CNT_W{1'b0}} :
+        current_position;
+
+    assign dda_travel_steps = travel_steps;
+    assign dda_cal_active = in_calibration;
+    assign dda_run_active =
+        calibrated_r && !in_calibration && moving && (phase == PH_RUN) &&
+        ((status_state == ST_MOVE_OPEN) || (status_state == ST_MOVE_CLOSE));
+    assign dda_allow_toggle =
+        allow_rise && !stop_after_budget &&
+        (phase == PH_RUN) &&
+        ((status_state == ST_CAL_SEEK_CLOSE) ||
+         (status_state == ST_CAL_MEASURE_OPEN) ||
+         (status_state == ST_MOVE_OPEN) ||
+         (status_state == ST_MOVE_CLOSE));
+    assign dda_endpoint_crawl =
+        endpoint_mode && dda_run_active &&
+        ((dir_close && !close_limit) || (!dir_close && !open_limit));
+    assign dda_distance = in_calibration ? MAX_STEPS_W : move_distance;
+    assign dda_done_steps = in_calibration ? motion_count : curve_done_count;
+    assign dda_ramp_unit = in_calibration ? CAL_RAMP_UNIT_W : move_ramp_unit;
+
+    wire [CNT_W-1:0] plan_dist_abs =
+        planner_result >= effective_current_position ?
+        (planner_result - effective_current_position) :
+        (effective_current_position - planner_result);
+    wire [CNT_W-1:0] plan_ramp_raw = (plan_dist_abs + 63) >> 6;
+
+    // Distinguish request bookkeeping from material replan preempt.
+    // Idempotent same-percent heartbeat must not occupy the exclusive FSM branch.
+    wire request_seen = request_valid && calibrated_r;
+    wire idle_not_satisfied =
+        (status_state == ST_IDLE) && (
+            ((requested_percent_in == 8'd0) && !open_limit) ||
+            ((requested_percent_in == PERCENT_MAX[7:0]) && !close_limit) ||
+            ((requested_percent_in > 8'd0) &&
+             (requested_percent_in < PERCENT_MAX[7:0]) &&
+             (current_position != target_position))
+        );
+    wire request_requires_replan = request_seen && (
+        (requested_percent_in != requested_percent) ||
+        wd_stopped ||
+        // Limit snap forces resume only when this cycle cannot accept a matching
+        // planner result (which uses effective_current_position for DIR).
+        (limit_pos_mismatch && !planner_accept) ||
+        idle_not_satisfied
+    );
+
+    always @* begin
+        status_requested_percent = requested_percent;
+        status_current = current_position;
+        status_target = target_position;
+        status_travel = travel_steps;
+        status_fault_code = {5'd0, fault_code};
+        status_flags = {
+            1'b0,
+            replan_pending,
+            target_valid,
+            endpoint_mode,
+            moving,
+            calibrated_r,
+            close_limit,
+            open_limit
+        };
+    end
+
+    // Shared STEP half-period helper: returns next step level
+    function automatic step_toggle;
+        input cur_step;
+        input do_allow_rise;
+        begin
+            if (cur_step)
+                step_toggle = 1'b0;
+            else if (do_allow_rise)
+                step_toggle = 1'b1;
+            else
+                step_toggle = 1'b0;
+        end
+    endfunction
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            status_state <= ST_CAL_SEEK_CLOSE;
+            calibrated_r <= 1'b0;
+            fault_code <= FC_NONE;
+            travel_steps <= {CNT_W{1'b0}};
+            current_position <= {CNT_W{1'b0}};
+            target_position <= {CNT_W{1'b0}};
+            requested_percent <= 8'd0;
+            replan_pending <= 1'b0;
+            endpoint_mode <= 1'b0;
+            target_valid <= 1'b0;
+            moving <= 1'b0;
+            phase <= PH_NONE;
+            setup_count <= 4'd0;
+            motion_count <= {CNT_W{1'b0}};
+            allow_rise <= 1'b0;
+            stop_after_budget <= 1'b0;
+            cal_started <= 1'b0;
+            need_planner <= 1'b0;
+            planner_req <= 1'b0;
+            step <= 1'b0;
+            dir_close <= 1'b1;
+            wd_stopped <= 1'b0;
+            open_limit_armed <= 1'b1;
+            close_limit_armed <= 1'b1;
+            move_distance <= {CNT_W{1'b0}};
+            move_ramp_unit <= 1'b1;
+            curve_done_count <= {CNT_W{1'b0}};
+        end else if (both_limits) begin
+            status_state <= ST_FAULT;
+            fault_code <= FC_BOTH_LIMITS;
+            step <= 1'b0;
+            phase <= PH_NONE;
+            moving <= 1'b0;
+            allow_rise <= 1'b0;
+            stop_after_budget <= 1'b0;
+            planner_req <= 1'b0;
+            need_planner <= 1'b0;
+            replan_pending <= 1'b0;
+            if (request_valid)
+                requested_percent <= requested_percent_in;
+        end else if (status_state == ST_FAULT) begin
+            step <= 1'b0;
+            moving <= 1'b0;
+            planner_req <= 1'b0;
+            if (request_valid)
+                requested_percent <= requested_percent_in;
+        end else begin
+            // ----------------------------------------------------------
+            // 1) Position / cal / guard counts on gated rise (always)
+            // ----------------------------------------------------------
+            if (gated_step_rise) begin
+                if (status_state == ST_CAL_SEEK_CLOSE ||
+                    status_state == ST_CAL_MEASURE_OPEN) begin
+                    motion_count <= motion_count + 1'b1;
+                end else if (calibrated_r) begin
+                    if (endpoint_mode)
+                        motion_count <= motion_count + 1'b1;
+                    if ((status_state == ST_MOVE_OPEN) || (status_state == ST_MOVE_CLOSE))
+                        curve_done_count <= curve_done_count + 1'b1;
+                    if (dir_close) begin
+                        if (current_position < travel_steps)
+                            current_position <= current_position + 1'b1;
+                    end else begin
+                        if (current_position != {CNT_W{1'b0}})
+                            current_position <= current_position - 1'b1;
+                    end
+                end
+            end
+
+            // ----------------------------------------------------------
+            // 1b) One-shot single-limit snap (consumes assertion interval).
+            // Departure from a consumed source limit must not overwrite §1.
+            // ----------------------------------------------------------
+            if (!open_limit)
+                open_limit_armed <= 1'b1;
+            if (!close_limit)
+                close_limit_armed <= 1'b1;
+            if (open_assert_event)
+                open_limit_armed <= 1'b0;
+            if (close_assert_event)
+                close_limit_armed <= 1'b0;
+
+            if (close_snap_accept)
+                current_position <= travel_steps;
+            else if (open_snap_accept)
+                current_position <= {CNT_W{1'b0}};
+
+            // ----------------------------------------------------------
+            // 2a) Non-destructive request bookkeeping (idempotent OK).
+            // Does not occupy the exclusive FSM branch — heartbeat may
+            // coexist with planner_accept / tick_500us / limit progression.
+            // ----------------------------------------------------------
+            if (request_seen) begin
+                requested_percent <= requested_percent_in;
+                wd_stopped <= 1'b0;
+            end
+
+            // ----------------------------------------------------------
+            // 2b) Material host replan only (latest-wins). Preempts tick.
+            // Same-percent heartbeat does NOT enter this branch.
+            // ----------------------------------------------------------
+            if (request_requires_replan) begin
+                replan_pending <= 1'b1;
+                planner_req <= 1'b0;
+                need_planner <= 1'b0;
+                allow_rise <= 1'b0;
+                // Materially new percent or forced replan: old target invalid
+                target_valid <= 1'b0;
+                if (gated_step || step) begin
+                    phase <= PH_DRAIN_HIGH;
+                    status_state <= ST_WAIT_REPLAN;
+                end else begin
+                    step <= 1'b0;
+                    phase <= PH_NONE;
+                    moving <= 1'b0;
+                    status_state <= ST_WAIT_REPLAN;
+                end
+
+            // ----------------------------------------------------------
+            // 3) Watchdog graceful stop (suppressed by same-cycle SET_ALL)
+            // Latch drain once; while PH_DRAIN_HIGH, fall through to §8 so
+            // tick_500us can pull STEP low even if watchdog_stop stays high.
+            // ----------------------------------------------------------
+            end else if (watchdog_stop && calibrated_r && !in_calibration &&
+                         !wd_stopped && !request_seen &&
+                         !(status_state == ST_WAIT_REPLAN && phase == PH_DRAIN_HIGH)) begin
+                allow_rise <= 1'b0;
+                planner_req <= 1'b0;
+                need_planner <= 1'b0;
+                if (gated_step || step) begin
+                    phase <= PH_DRAIN_HIGH;
+                    status_state <= ST_WAIT_REPLAN;
+                    replan_pending <= 1'b0;
+                end else begin
+                    step <= 1'b0;
+                    phase <= PH_NONE;
+                    moving <= 1'b0;
+                    status_state <= ST_IDLE;
+                    wd_stopped <= 1'b1;
+                    replan_pending <= 1'b0;
+                end
+
+            // ----------------------------------------------------------
+            // 4) Planner result (uses effective_current_position for DIR)
+            // ----------------------------------------------------------
+            end else if (planner_accept) begin
+                planner_req <= 1'b0;
+                need_planner <= 1'b0;
+                replan_pending <= 1'b0;
+                target_position <= planner_result;
+                target_valid <= 1'b1;
+                endpoint_mode <= 1'b0;
+                motion_count <= {CNT_W{1'b0}};
+                curve_done_count <= {CNT_W{1'b0}};
+                move_distance <= plan_dist_abs;
+                move_ramp_unit <= (plan_ramp_raw == {CNT_W{1'b0}}) ? 1'b1 : plan_ramp_raw;
+                step <= 1'b0;
+                setup_count <= 4'd0;
+                allow_rise <= 1'b0;
+                stop_after_budget <= 1'b0;
+                if (planner_result == effective_current_position) begin
+                    status_state <= ST_IDLE;
+                    moving <= 1'b0;
+                    phase <= PH_NONE;
+                end else if (planner_result > effective_current_position) begin
+                    dir_close <= 1'b1;
+                    phase <= PH_DIR_SETUP;
+                    moving <= 1'b1;
+                    status_state <= ST_MOVE_CLOSE;
+                end else begin
+                    dir_close <= 1'b0;
+                    phase <= PH_DIR_SETUP;
+                    moving <= 1'b1;
+                    status_state <= ST_MOVE_OPEN;
+                end
+
+            // ----------------------------------------------------------
+            // 5) Calibration start
+            // ----------------------------------------------------------
+            end else if (!cal_started) begin
+                if (cal_enabled && limit_sync_valid) begin
+                    cal_started <= 1'b1;
+                    motion_count <= {CNT_W{1'b0}};
+                    setup_count <= 4'd0;
+                    allow_rise <= 1'b0;
+                    stop_after_budget <= 1'b0;
+                    step <= 1'b0;
+                    phase <= PH_DIR_SETUP;
+                    moving <= 1'b1;
+                    if (close_limit) begin
+                        dir_close <= 1'b0;
+                        status_state <= ST_CAL_MEASURE_OPEN;
+                    end else begin
+                        dir_close <= 1'b1;
+                        status_state <= ST_CAL_SEEK_CLOSE;
+                    end
+                end
+
+            // ----------------------------------------------------------
+            // 6) CAL_SEEK_CLOSE
+            // ----------------------------------------------------------
+            end else if (status_state == ST_CAL_SEEK_CLOSE) begin
+                if (close_limit) begin
+                    step <= 1'b0;
+                    allow_rise <= 1'b0;
+                    stop_after_budget <= 1'b0;
+                    motion_count <= {CNT_W{1'b0}};
+                    setup_count <= 4'd0;
+                    dir_close <= 1'b0;
+                    phase <= PH_DIR_SETUP;
+                    moving <= 1'b1;
+                    status_state <= ST_CAL_MEASURE_OPEN;
+                end else if (stop_after_budget && !gated_step && !step) begin
+                    status_state <= ST_FAULT;
+                    fault_code <= FC_CAL_CLOSE_TIMEOUT;
+                    moving <= 1'b0;
+                    phase <= PH_NONE;
+                end else begin
+                    // Use post-rise count: if count already at max, stop new rises
+                    if ((motion_count >= MAX_STEPS_W) ||
+                        (gated_step_rise && (motion_count + 1'b1 >= MAX_STEPS_W))) begin
+                        allow_rise <= 1'b0;
+                        stop_after_budget <= 1'b1;
+                    end
+                    if (phase == PH_DIR_SETUP) begin
+                        step <= 1'b0;
+                        if (tick_500us) begin
+                            if (setup_count + 1'b1 >= DIR_SETUP_TICKS[3:0]) begin
+                                phase <= PH_RUN;
+                                setup_count <= 4'd0;
+                                allow_rise <= !stop_after_budget && (motion_count < MAX_STEPS_W);
+                            end else begin
+                                setup_count <= setup_count + 1'b1;
+                            end
+                        end
+                    end else if (exec_toggle_pulse) begin
+                        step <= step_toggle(step, allow_rise && !stop_after_budget &&
+                                            (motion_count < MAX_STEPS_W));
+                    end
+                end
+
+            // ----------------------------------------------------------
+            // 7) CAL_MEASURE_OPEN
+            // ----------------------------------------------------------
+            end else if (status_state == ST_CAL_MEASURE_OPEN) begin
+                if (open_limit) begin
+                    // motion_count already includes this cycle's rise (NBA: see old+1)
+                    // Use effective count: if rise this cycle, +1 on current
+                    if (gated_step_rise) begin
+                        // effective = motion_count+1 (scheduled); compare with that
+                        if (((motion_count + 1'b1) >= MIN_TRAVEL_W) &&
+                            ((motion_count + 1'b1) <= MAX_STEPS_W)) begin
+                            travel_steps <= motion_count + 1'b1;
+                            current_position <= {CNT_W{1'b0}};
+                            target_position <= {CNT_W{1'b0}};
+                            requested_percent <= 8'd0;
+                            calibrated_r <= 1'b1;
+                            fault_code <= FC_NONE;
+                            target_valid <= 1'b1;
+                            endpoint_mode <= 1'b1;
+                            step <= 1'b0;
+                            phase <= PH_NONE;
+                            moving <= 1'b0;
+                            allow_rise <= 1'b0;
+                            stop_after_budget <= 1'b0;
+                            status_state <= ST_IDLE;
+                        end else begin
+                            status_state <= ST_FAULT;
+                            fault_code <= FC_TINY_TRAVEL;
+                            step <= 1'b0;
+                            moving <= 1'b0;
+                            phase <= PH_NONE;
+                        end
+                    end else begin
+                        if ((motion_count >= MIN_TRAVEL_W) &&
+                            (motion_count <= MAX_STEPS_W)) begin
+                            travel_steps <= motion_count;
+                            current_position <= {CNT_W{1'b0}};
+                            target_position <= {CNT_W{1'b0}};
+                            requested_percent <= 8'd0;
+                            calibrated_r <= 1'b1;
+                            fault_code <= FC_NONE;
+                            target_valid <= 1'b1;
+                            endpoint_mode <= 1'b1;
+                            step <= 1'b0;
+                            phase <= PH_NONE;
+                            moving <= 1'b0;
+                            allow_rise <= 1'b0;
+                            stop_after_budget <= 1'b0;
+                            status_state <= ST_IDLE;
+                        end else begin
+                            status_state <= ST_FAULT;
+                            fault_code <= FC_TINY_TRAVEL;
+                            step <= 1'b0;
+                            moving <= 1'b0;
+                            phase <= PH_NONE;
+                        end
+                    end
+                end else if (stop_after_budget && !gated_step && !step) begin
+                    status_state <= ST_FAULT;
+                    fault_code <= FC_CAL_OPEN_TIMEOUT;
+                    moving <= 1'b0;
+                    phase <= PH_NONE;
+                end else begin
+                    if ((motion_count >= MAX_STEPS_W) ||
+                        (gated_step_rise && (motion_count + 1'b1 >= MAX_STEPS_W))) begin
+                        allow_rise <= 1'b0;
+                        stop_after_budget <= 1'b1;
+                    end
+                    if (phase == PH_DIR_SETUP) begin
+                        step <= 1'b0;
+                        if (tick_500us) begin
+                            if (setup_count + 1'b1 >= DIR_SETUP_TICKS[3:0]) begin
+                                phase <= PH_RUN;
+                                allow_rise <= !stop_after_budget && (motion_count < MAX_STEPS_W);
+                            end else begin
+                                setup_count <= setup_count + 1'b1;
+                            end
+                        end
+                    end else if (exec_toggle_pulse) begin
+                        step <= step_toggle(step, allow_rise && !stop_after_budget &&
+                                            (motion_count < MAX_STEPS_W));
+                    end
+                end
+
+            // ----------------------------------------------------------
+            // 8) WAIT_REPLAN / drain / decide
+            // ----------------------------------------------------------
+            end else if (status_state == ST_WAIT_REPLAN) begin
+                if (phase == PH_DRAIN_HIGH) begin
+                    if (tick_500us)
+                        step <= 1'b0;
+                    if (!gated_step && (!step || tick_500us)) begin
+                        step <= 1'b0;
+                        phase <= PH_NONE;
+                        moving <= 1'b0;
+                        if (watchdog_stop) begin
+                            status_state <= ST_IDLE;
+                            wd_stopped <= 1'b1;
+                            replan_pending <= 1'b0;
+                        end else begin
+                            replan_pending <= 1'b1;
+                        end
+                    end
+                end else if (replan_pending) begin
+                    replan_pending <= 1'b0;
+                    if (is_open_endpoint) begin
+                        endpoint_mode <= 1'b1;
+                        target_position <= {CNT_W{1'b0}};
+                        target_valid <= 1'b1;
+                        need_planner <= 1'b0;
+                        planner_req <= 1'b0;
+                        if (open_limit) begin
+                            current_position <= {CNT_W{1'b0}};
+                            status_state <= ST_IDLE;
+                            moving <= 1'b0;
+                            step <= 1'b0;
+                            phase <= PH_NONE;
+                        end else begin
+                            motion_count <= {CNT_W{1'b0}};
+                            dir_close <= 1'b0;
+                            step <= 1'b0;
+                            setup_count <= 4'd0;
+                            allow_rise <= 1'b0;
+                            stop_after_budget <= 1'b0;
+                            phase <= PH_DIR_SETUP;
+                            moving <= 1'b1;
+                            status_state <= ST_MOVE_OPEN;
+                        end
+                    end else if (is_close_endpoint) begin
+                        endpoint_mode <= 1'b1;
+                        target_position <= travel_steps;
+                        target_valid <= 1'b1;
+                        need_planner <= 1'b0;
+                        planner_req <= 1'b0;
+                        if (close_limit) begin
+                            current_position <= travel_steps;
+                            status_state <= ST_IDLE;
+                            moving <= 1'b0;
+                            step <= 1'b0;
+                            phase <= PH_NONE;
+                        end else begin
+                            motion_count <= {CNT_W{1'b0}};
+                            dir_close <= 1'b1;
+                            step <= 1'b0;
+                            setup_count <= 4'd0;
+                            allow_rise <= 1'b0;
+                            stop_after_budget <= 1'b0;
+                            phase <= PH_DIR_SETUP;
+                            moving <= 1'b1;
+                            status_state <= ST_MOVE_CLOSE;
+                        end
+                    end else begin
+                        endpoint_mode <= 1'b0;
+                        need_planner <= 1'b1;
+                        planner_req <= 1'b1;
+                        moving <= 1'b0;
+                        step <= 1'b0;
+                        phase <= PH_NONE;
+                    end
+                end
+
+            // ----------------------------------------------------------
+            // 9) MOVE_OPEN / MOVE_CLOSE
+            // ----------------------------------------------------------
+            end else if ((status_state == ST_MOVE_OPEN) ||
+                         (status_state == ST_MOVE_CLOSE)) begin
+                if (endpoint_mode) begin
+                    if ((dir_close && close_limit) || (!dir_close && open_limit)) begin
+                        step <= 1'b0;
+                        allow_rise <= 1'b0;
+                        stop_after_budget <= 1'b0;
+                        phase <= PH_NONE;
+                        moving <= 1'b0;
+                        if (dir_close) begin
+                            current_position <= travel_steps;
+                            target_position <= travel_steps;
+                        end else begin
+                            current_position <= {CNT_W{1'b0}};
+                            target_position <= {CNT_W{1'b0}};
+                        end
+                        status_state <= ST_IDLE;
+                    end else if (stop_after_budget && !gated_step && !step) begin
+                        status_state <= ST_FAULT;
+                        fault_code <= FC_ENDPOINT_TIMEOUT;
+                        moving <= 1'b0;
+                        phase <= PH_NONE;
+                        step <= 1'b0;
+                    end else begin
+                        if ((motion_count >= guard_limit) ||
+                            (gated_step_rise && (motion_count + 1'b1 >= guard_limit))) begin
+                            allow_rise <= 1'b0;
+                            stop_after_budget <= 1'b1;
+                        end
+                        if (phase == PH_DIR_SETUP) begin
+                            step <= 1'b0;
+                            if (tick_500us) begin
+                                if (setup_count + 1'b1 >= DIR_SETUP_TICKS[3:0]) begin
+                                    phase <= PH_RUN;
+                                    allow_rise <= 1'b1;
+                                end else begin
+                                    setup_count <= setup_count + 1'b1;
+                                end
+                            end
+                        end else if (phase == PH_DRAIN_HIGH) begin
+                            if (tick_500us)
+                                step <= 1'b0;
+                        end else if (exec_toggle_pulse) begin
+                            step <= step_toggle(step, allow_rise && !stop_after_budget &&
+                                                (motion_count < guard_limit));
+                        end
+                    end
+                end else begin
+                    // Mid-percent motion
+                    if ((dir_close && close_limit) || (!dir_close && open_limit)) begin
+                        step <= 1'b0;
+                        allow_rise <= 1'b0;
+                        if (dir_close)
+                            current_position <= travel_steps;
+                        else
+                            current_position <= {CNT_W{1'b0}};
+                        replan_pending <= 1'b1;
+                        need_planner <= 1'b0;
+                        planner_req <= 1'b0;
+                        phase <= PH_NONE;
+                        moving <= 1'b0;
+                        status_state <= ST_WAIT_REPLAN;
+                    end else begin
+                        // Effective current after this cycle's rise
+                        // Completion: compare using updated position intent
+                        if ((current_position == target_position) ||
+                            (gated_step_rise && dir_close &&
+                             (current_position + 1'b1 == target_position)) ||
+                            (gated_step_rise && !dir_close &&
+                             (current_position - 1'b1 == target_position))) begin
+                            allow_rise <= 1'b0;
+                            if (step || gated_step) begin
+                                phase <= PH_DRAIN_HIGH;
+                                if (tick_500us)
+                                    step <= 1'b0;
+                            end else begin
+                                step <= 1'b0;
+                                phase <= PH_NONE;
+                                moving <= 1'b0;
+                                status_state <= ST_IDLE;
+                            end
+                        end else if (phase == PH_DIR_SETUP) begin
+                            step <= 1'b0;
+                            if (tick_500us) begin
+                                if (setup_count + 1'b1 >= DIR_SETUP_TICKS[3:0]) begin
+                                    phase <= PH_RUN;
+                                    allow_rise <= 1'b1;
+                                end else begin
+                                    setup_count <= setup_count + 1'b1;
+                                end
+                            end
+                        end else if (phase == PH_DRAIN_HIGH) begin
+                            if (tick_500us)
+                                step <= 1'b0;
+                            if (!step && !gated_step) begin
+                                moving <= 1'b0;
+                                status_state <= ST_IDLE;
+                                phase <= PH_NONE;
+                            end else if (tick_500us && step) begin
+                                // falling this tick; next cycle check idle
+                            end
+                        end else if (exec_toggle_pulse) begin
+                            step <= step_toggle(step, allow_rise);
+                        end
+                    end
+                end
+
+            // ----------------------------------------------------------
+            // 10) IDLE
+            // ----------------------------------------------------------
+            end else if (status_state == ST_IDLE) begin
+                step <= 1'b0;
+                moving <= 1'b0;
+                if (open_snap_accept)
+                    current_position <= {CNT_W{1'b0}};
+                if (close_snap_accept)
+                    current_position <= travel_steps;
+                if (replan_pending)
+                    status_state <= ST_WAIT_REPLAN;
+            end
+        end
+    end
+endmodule

+ 370 - 0
receipts/scheme-b-attempt/door_motion_controller.v

@@ -0,0 +1,370 @@
+`timescale 1ns/1ps
+
+// Three-axis door motion: shared percent planner, startup_complete, status snapshot.
+module door_motion_controller #(
+    parameter integer MAX_CAL_STEPS = 5000,
+    parameter integer MIN_TRAVEL = 2,
+    parameter integer ENDPOINT_GUARD_EXTRA = 500,
+    parameter integer DIR_SETUP_TICKS = 2,
+    parameter integer PERCENT_MAX = 100,
+    parameter integer STATUS_PAYLOAD_LENGTH = 31
+) (
+    input  wire        clk,
+    input  wire        rst_n,
+    input  wire        tick_500us,
+    input  wire        limit_sync_valid,
+    input  wire [2:0]  open_limit,
+    input  wire [2:0]  close_limit,
+    input  wire [2:0]  gated_step,
+    input  wire [2:0]  gated_step_rise,
+    input  wire        motor_request_valid,
+    input  wire [7:0]  percent_x,
+    input  wire [7:0]  percent_y,
+    input  wire [7:0]  percent_z,
+    input  wire        watchdog_stop,
+    input  wire        watchdog_tripped,
+    output wire [2:0]  step,
+    output wire [2:0]  dir_close,
+    output reg         startup_complete,
+    output wire [2:0]  calibrated_mask,
+    output wire [2:0]  fault_mask,
+    // Snapshot capture / read (31-byte MOTOR_STATUS_DATA)
+    // Combinational read matches frame_tx payload_data contract (0-cycle latency).
+    input  wire        status_capture,
+    input  wire [7:0]  status_rd_addr,
+    output wire [7:0]  status_rd_data
+);
+    wire        planner_start;
+    wire [1:0]  planner_axis_id;
+    wire [7:0]  planner_percent_i;
+    wire [12:0] planner_travel_i;
+    wire        planner_busy;
+    wire        planner_done;
+    wire [12:0] planner_result;
+    wire [1:0]  planner_done_axis;
+    wire [7:0]  planner_done_percent;
+
+    wire        req_x, req_y, req_z;
+    wire [7:0]  pct_req_x, pct_req_y, pct_req_z;
+    wire [12:0] trav_req_x, trav_req_y, trav_req_z;
+
+    wire [2:0]  st_state_x, st_state_y, st_state_z;
+    wire [7:0]  st_flags_x, st_flags_y, st_flags_z;
+    wire [7:0]  st_pct_x, st_pct_y, st_pct_z;
+    wire [12:0] st_cur_x, st_cur_y, st_cur_z;
+    wire [12:0] st_tgt_x, st_tgt_y, st_tgt_z;
+    wire [12:0] st_trav_x, st_trav_y, st_trav_z;
+    wire [7:0]  st_fault_x, st_fault_y, st_fault_z;
+    wire        cal_x, cal_y, cal_z;
+    wire        fault_x, fault_y, fault_z;
+    wire        term_x, term_y, term_z;
+
+    wire        dda_cal_x, dda_cal_y, dda_cal_z;
+    wire        dda_run_x, dda_run_y, dda_run_z;
+    wire        dda_allow_x, dda_allow_y, dda_allow_z;
+    wire        dda_crawl_x, dda_crawl_y, dda_crawl_z;
+    wire [12:0] dda_dist_x, dda_dist_y, dda_dist_z;
+    wire [12:0] dda_done_x, dda_done_y, dda_done_z;
+    wire [12:0] dda_ramp_x, dda_ramp_y, dda_ramp_z;
+    wire [12:0] trav_x, trav_y, trav_z;
+
+    wire [2:0]  exec_toggle;
+    wire        all_axes_overlap_seen;
+    wire        prof_build_busy;
+    wire        prof_build_done;
+    wire        prof_build_start;
+    wire [31:0] phase_threshold;
+
+    reg [2:0]   cal_seq;
+    reg         profile_ready;
+
+    wire cal_en_x = (cal_seq == 3'd0) && !term_x;
+    wire cal_en_y = (cal_seq == 3'd1) && !term_y;
+    wire cal_en_z = (cal_seq == 3'd2) && !term_z;
+
+    assign prof_build_start =
+        (cal_seq == 3'd3) && term_x && term_y && term_z &&
+        !profile_ready && !prof_build_busy && !prof_build_done;
+
+    assign calibrated_mask = {cal_z, cal_y, cal_x};
+    assign fault_mask = {fault_z, fault_y, fault_x};
+
+    door_percent_planner u_planner (
+        .clk(clk), .rst_n(rst_n),
+        .start(planner_start),
+        .axis_id(planner_axis_id),
+        .percent(planner_percent_i),
+        .travel(planner_travel_i),
+        .busy(planner_busy),
+        .done(planner_done),
+        .result(planner_result),
+        .done_axis_id(planner_done_axis),
+        .done_percent(planner_done_percent)
+    );
+
+    // X→Y→Z arbiter: one-shot grant per request. Hold until axis drops req
+    // so planner done+busy=0 cannot re-grant the same level request.
+    reg        grant_start;
+    reg [1:0]  grant_axis;
+    reg [7:0]  grant_percent;
+    reg [12:0] grant_travel;
+    reg [2:0]  grant_hold;
+
+    assign planner_start = grant_start;
+    assign planner_axis_id = grant_axis;
+    assign planner_percent_i = grant_percent;
+    assign planner_travel_i = grant_travel;
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            grant_start <= 1'b0;
+            grant_axis <= 2'd0;
+            grant_percent <= 8'd0;
+            grant_travel <= 13'd0;
+            grant_hold <= 3'b000;
+        end else begin
+            grant_start <= 1'b0;
+            if (!req_x)
+                grant_hold[0] <= 1'b0;
+            if (!req_y)
+                grant_hold[1] <= 1'b0;
+            if (!req_z)
+                grant_hold[2] <= 1'b0;
+            if (!planner_busy && !grant_start) begin
+                if (req_x && !grant_hold[0]) begin
+                    grant_start <= 1'b1;
+                    grant_hold[0] <= 1'b1;
+                    grant_axis <= 2'd0;
+                    grant_percent <= pct_req_x;
+                    grant_travel <= trav_req_x;
+                end else if (req_y && !grant_hold[1]) begin
+                    grant_start <= 1'b1;
+                    grant_hold[1] <= 1'b1;
+                    grant_axis <= 2'd1;
+                    grant_percent <= pct_req_y;
+                    grant_travel <= trav_req_y;
+                end else if (req_z && !grant_hold[2]) begin
+                    grant_start <= 1'b1;
+                    grant_hold[2] <= 1'b1;
+                    grant_axis <= 2'd2;
+                    grant_percent <= pct_req_z;
+                    grant_travel <= trav_req_z;
+                end
+            end
+        end
+    end
+
+  // Serial calibration X → Y → Z
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n)
+            cal_seq <= 3'd0;
+        else begin
+            if (cal_seq == 3'd0 && term_x)
+                cal_seq <= 3'd1;
+            else if (cal_seq == 3'd1 && term_y)
+                cal_seq <= 3'd2;
+            else if (cal_seq == 3'd2 && term_z)
+                cal_seq <= 3'd3;
+        end
+    end
+
+    door_speed_profile_builder u_profile_builder (
+        .clk(clk), .rst_n(rst_n),
+        .start(prof_build_start),
+        .travel_x(trav_x), .travel_y(trav_y), .travel_z(trav_z),
+        .cal_ok_x(cal_x), .cal_ok_y(cal_y), .cal_ok_z(cal_z),
+        .busy(prof_build_busy),
+        .done(prof_build_done),
+        .phase_threshold(phase_threshold)
+    );
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n)
+            profile_ready <= 1'b0;
+        else if (prof_build_done)
+            profile_ready <= 1'b1;
+    end
+
+    door_shared_dda_executor u_dda_exec (
+        .clk(clk), .rst_n(rst_n),
+        .cal_active({dda_cal_z, dda_cal_y, dda_cal_x}),
+        .run_active({dda_run_z, dda_run_y, dda_run_x}),
+        .allow_toggle({dda_allow_z, dda_allow_y, dda_allow_x}),
+        .endpoint_crawl({dda_crawl_z, dda_crawl_y, dda_crawl_x}),
+        .distance_0(dda_dist_x), .distance_1(dda_dist_y), .distance_2(dda_dist_z),
+        .done_steps_0(dda_done_x), .done_steps_1(dda_done_y), .done_steps_2(dda_done_z),
+        .ramp_unit_0(dda_ramp_x), .ramp_unit_1(dda_ramp_y), .ramp_unit_2(dda_ramp_z),
+        .travel_0(trav_x), .travel_1(trav_y), .travel_2(trav_z),
+        .phase_threshold(phase_threshold),
+        .exec_toggle_pulse(exec_toggle),
+        .all_axes_overlap_seen(all_axes_overlap_seen)
+    );
+
+    door_axis_controller #(
+        .AXIS_ID(0),
+        .MAX_CAL_STEPS(MAX_CAL_STEPS),
+        .MIN_TRAVEL(MIN_TRAVEL),
+        .ENDPOINT_GUARD_EXTRA(ENDPOINT_GUARD_EXTRA),
+        .DIR_SETUP_TICKS(DIR_SETUP_TICKS),
+        .PERCENT_MAX(PERCENT_MAX)
+    ) u_axis_x (
+        .clk(clk), .rst_n(rst_n),
+        .open_limit(open_limit[0]), .close_limit(close_limit[0]),
+        .limit_sync_valid(limit_sync_valid),
+        .gated_step(gated_step[0]), .gated_step_rise(gated_step_rise[0]),
+        .tick_500us(tick_500us),
+        .cal_enabled(cal_en_x),
+        .exec_toggle_pulse(exec_toggle[0]),
+        .request_valid(motor_request_valid),
+        .requested_percent_in(percent_x),
+        .watchdog_stop(watchdog_stop),
+        .planner_req(req_x),
+        .planner_percent(pct_req_x),
+        .planner_travel(trav_req_x),
+        .planner_done(planner_done),
+        .planner_done_axis(planner_done_axis),
+        .planner_done_percent(planner_done_percent),
+        .planner_result(planner_result),
+        .step(step[0]), .dir_close(dir_close[0]),
+        .status_state(st_state_x), .status_flags(st_flags_x),
+        .status_requested_percent(st_pct_x),
+        .status_current(st_cur_x), .status_target(st_tgt_x),
+        .status_travel(st_trav_x), .status_fault_code(st_fault_x),
+        .calibrated(cal_x), .faulted(fault_x), .terminal(term_x),
+        .dda_cal_active(dda_cal_x), .dda_run_active(dda_run_x),
+        .dda_allow_toggle(dda_allow_x), .dda_endpoint_crawl(dda_crawl_x),
+        .dda_distance(dda_dist_x), .dda_done_steps(dda_done_x),
+        .dda_ramp_unit(dda_ramp_x), .dda_travel_steps(trav_x)
+    );
+
+    door_axis_controller #(
+        .AXIS_ID(1),
+        .MAX_CAL_STEPS(MAX_CAL_STEPS),
+        .MIN_TRAVEL(MIN_TRAVEL),
+        .ENDPOINT_GUARD_EXTRA(ENDPOINT_GUARD_EXTRA),
+        .DIR_SETUP_TICKS(DIR_SETUP_TICKS),
+        .PERCENT_MAX(PERCENT_MAX)
+    ) u_axis_y (
+        .clk(clk), .rst_n(rst_n),
+        .open_limit(open_limit[1]), .close_limit(close_limit[1]),
+        .limit_sync_valid(limit_sync_valid),
+        .gated_step(gated_step[1]), .gated_step_rise(gated_step_rise[1]),
+        .tick_500us(tick_500us),
+        .cal_enabled(cal_en_y),
+        .exec_toggle_pulse(exec_toggle[1]),
+        .request_valid(motor_request_valid),
+        .requested_percent_in(percent_y),
+        .watchdog_stop(watchdog_stop),
+        .planner_req(req_y),
+        .planner_percent(pct_req_y),
+        .planner_travel(trav_req_y),
+        .planner_done(planner_done),
+        .planner_done_axis(planner_done_axis),
+        .planner_done_percent(planner_done_percent),
+        .planner_result(planner_result),
+        .step(step[1]), .dir_close(dir_close[1]),
+        .status_state(st_state_y), .status_flags(st_flags_y),
+        .status_requested_percent(st_pct_y),
+        .status_current(st_cur_y), .status_target(st_tgt_y),
+        .status_travel(st_trav_y), .status_fault_code(st_fault_y),
+        .calibrated(cal_y), .faulted(fault_y), .terminal(term_y),
+        .dda_cal_active(dda_cal_y), .dda_run_active(dda_run_y),
+        .dda_allow_toggle(dda_allow_y), .dda_endpoint_crawl(dda_crawl_y),
+        .dda_distance(dda_dist_y), .dda_done_steps(dda_done_y),
+        .dda_ramp_unit(dda_ramp_y), .dda_travel_steps(trav_y)
+    );
+
+    door_axis_controller #(
+        .AXIS_ID(2),
+        .MAX_CAL_STEPS(MAX_CAL_STEPS),
+        .MIN_TRAVEL(MIN_TRAVEL),
+        .ENDPOINT_GUARD_EXTRA(ENDPOINT_GUARD_EXTRA),
+        .DIR_SETUP_TICKS(DIR_SETUP_TICKS),
+        .PERCENT_MAX(PERCENT_MAX)
+    ) u_axis_z (
+        .clk(clk), .rst_n(rst_n),
+        .open_limit(open_limit[2]), .close_limit(close_limit[2]),
+        .limit_sync_valid(limit_sync_valid),
+        .gated_step(gated_step[2]), .gated_step_rise(gated_step_rise[2]),
+        .tick_500us(tick_500us),
+        .cal_enabled(cal_en_z),
+        .exec_toggle_pulse(exec_toggle[2]),
+        .request_valid(motor_request_valid),
+        .requested_percent_in(percent_z),
+        .watchdog_stop(watchdog_stop),
+        .planner_req(req_z),
+        .planner_percent(pct_req_z),
+        .planner_travel(trav_req_z),
+        .planner_done(planner_done),
+        .planner_done_axis(planner_done_axis),
+        .planner_done_percent(planner_done_percent),
+        .planner_result(planner_result),
+        .step(step[2]), .dir_close(dir_close[2]),
+        .status_state(st_state_z), .status_flags(st_flags_z),
+        .status_requested_percent(st_pct_z),
+        .status_current(st_cur_z), .status_target(st_tgt_z),
+        .status_travel(st_trav_z), .status_fault_code(st_fault_z),
+        .calibrated(cal_z), .faulted(fault_z), .terminal(term_z),
+        .dda_cal_active(dda_cal_z), .dda_run_active(dda_run_z),
+        .dda_allow_toggle(dda_allow_z), .dda_endpoint_crawl(dda_crawl_z),
+        .dda_distance(dda_dist_z), .dda_done_steps(dda_done_z),
+        .dda_ramp_unit(dda_ramp_z), .dda_travel_steps(trav_z)
+    );
+
+    // Sticky startup_complete after serial cal + profile build
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n)
+            startup_complete <= 1'b0;
+        else if (!startup_complete && profile_ready)
+            startup_complete <= 1'b1;
+    end
+
+    // -------- 31-byte atomic snapshot --------
+    reg [7:0] snap [0:30];
+    integer si;
+
+    // Combinational mux: same 0-cycle latency as temperature RAM → frame_tx.
+    assign status_rd_data = (status_rd_addr < STATUS_PAYLOAD_LENGTH[7:0]) ?
+                            snap[status_rd_addr] : 8'd0;
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            for (si = 0; si < STATUS_PAYLOAD_LENGTH; si = si + 1)
+                snap[si] <= 8'd0;
+        end else if (status_capture) begin
+            // byte0: cal[2:0], fault[2:0], startup, watchdog
+            snap[0] <= {watchdog_tripped, startup_complete, fault_mask, calibrated_mask};
+            // X @1, Y @11, Z @21
+            snap[1]  <= {5'd0, st_state_x};
+            snap[2]  <= st_flags_x;
+            snap[3]  <= st_pct_x;
+            snap[4]  <= st_cur_x[7:0];
+            snap[5]  <= {3'd0, st_cur_x[12:8]};
+            snap[6]  <= st_tgt_x[7:0];
+            snap[7]  <= {3'd0, st_tgt_x[12:8]};
+            snap[8]  <= st_trav_x[7:0];
+            snap[9]  <= {3'd0, st_trav_x[12:8]};
+            snap[10] <= st_fault_x;
+            snap[11] <= {5'd0, st_state_y};
+            snap[12] <= st_flags_y;
+            snap[13] <= st_pct_y;
+            snap[14] <= st_cur_y[7:0];
+            snap[15] <= {3'd0, st_cur_y[12:8]};
+            snap[16] <= st_tgt_y[7:0];
+            snap[17] <= {3'd0, st_tgt_y[12:8]};
+            snap[18] <= st_trav_y[7:0];
+            snap[19] <= {3'd0, st_trav_y[12:8]};
+            snap[20] <= st_fault_y;
+            snap[21] <= {5'd0, st_state_z};
+            snap[22] <= st_flags_z;
+            snap[23] <= st_pct_z;
+            snap[24] <= st_cur_z[7:0];
+            snap[25] <= {3'd0, st_cur_z[12:8]};
+            snap[26] <= st_tgt_z[7:0];
+            snap[27] <= {3'd0, st_tgt_z[12:8]};
+            snap[28] <= st_trav_z[7:0];
+            snap[29] <= {3'd0, st_trav_z[12:8]};
+            snap[30] <= st_fault_z;
+        end
+    end
+endmodule

+ 201 - 0
receipts/scheme-b-attempt/door_motion_three_axis_overlap_tb.v

@@ -0,0 +1,201 @@
+`timescale 1ns/1ps
+
+// MSE: after startup, SET_ALL three mid percents; assert sustained three-axis
+// overlap motion and >=2 gated external STEP rises per axis in overlap window.
+// Gated rises follow STEP 0→1 only (one rise per pulse), matching the position contract.
+module door_motion_three_axis_overlap_tb;
+    localparam integer CAL_TRAVEL = 32;
+    localparam integer MID_PCT = 50;
+
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg tick_500us = 1'b0;
+    reg limit_sync_valid = 1'b0;
+    reg [2:0] open_limit = 3'b000;
+    reg [2:0] close_limit = 3'b111;
+    reg [2:0] gated_step = 3'b000;
+    reg [2:0] gated_step_rise = 3'b000;
+    reg motor_request_valid = 1'b0;
+    reg [7:0] percent_x = 8'd0;
+    reg [7:0] percent_y = 8'd0;
+    reg [7:0] percent_z = 8'd0;
+    reg watchdog_stop = 1'b0;
+    wire [2:0] step;
+    wire [2:0] dir_close;
+    wire startup_complete;
+    wire [2:0] calibrated_mask;
+    wire [2:0] fault_mask;
+
+    wire x_moving = dut.u_axis_x.moving;
+    wire y_moving = dut.u_axis_y.moving;
+    wire z_moving = dut.u_axis_z.moving;
+
+    integer overlap_cycles;
+    integer overlap_rise_x;
+    integer overlap_rise_y;
+    integer overlap_rise_z;
+    integer sustained_overlap;
+    integer overlap_done;
+    integer ax;
+    integer i;
+    integer poll;
+
+    always #1 clk = ~clk;
+
+    door_motion_controller #(
+        .MAX_CAL_STEPS(64),
+        .MIN_TRAVEL(2),
+        .ENDPOINT_GUARD_EXTRA(8),
+        .DIR_SETUP_TICKS(1),
+        .PERCENT_MAX(100)
+    ) dut (
+        .clk(clk), .rst_n(rst_n),
+        .tick_500us(tick_500us),
+        .limit_sync_valid(limit_sync_valid),
+        .open_limit(open_limit), .close_limit(close_limit),
+        .gated_step(gated_step), .gated_step_rise(gated_step_rise),
+        .motor_request_valid(motor_request_valid),
+        .percent_x(percent_x), .percent_y(percent_y), .percent_z(percent_z),
+        .watchdog_stop(watchdog_stop),
+        .watchdog_tripped(1'b0),
+        .step(step), .dir_close(dir_close),
+        .startup_complete(startup_complete),
+        .calibrated_mask(calibrated_mask),
+        .fault_mask(fault_mask),
+        .status_capture(1'b0),
+        .status_rd_addr(8'd0),
+        .status_rd_data()
+    );
+
+    task pulse_tick;
+        begin
+            @(negedge clk); tick_500us = 1'b1;
+            @(negedge clk); tick_500us = 1'b0;
+        end
+    endtask
+
+    task force_rise_axis;
+        input integer axis;
+        input integer n;
+        integer k;
+        begin
+            for (k = 0; k < n; k = k + 1) begin
+                @(negedge clk);
+                gated_step[axis] = 1'b1;
+                gated_step_rise[axis] = 1'b1;
+                @(negedge clk);
+                gated_step[axis] = 1'b0;
+                gated_step_rise[axis] = 1'b0;
+                repeat (4) @(negedge clk);
+            end
+        end
+    endtask
+
+    task cal_one_axis;
+        input integer axis;
+        input integer travel;
+        begin
+            repeat (4) pulse_tick();
+            force_rise_axis(axis, travel);
+            @(negedge clk);
+            open_limit[axis] = 1'b1;
+            close_limit[axis] = 1'b0;
+            @(negedge clk);
+            open_limit[axis] = 1'b0;
+            close_limit[axis] = 1'b0;
+            repeat (8) @(negedge clk);
+        end
+    endtask
+
+    // STEP rising-edge detector (1 clk wide).
+    reg [2:0] step_d;
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n)
+            step_d <= 3'b000;
+        else
+            step_d <= step;
+    end
+    wire [2:0] step_rise = step & ~step_d;
+
+    initial begin
+        #8000000 $fatal(1, "door_motion_three_axis_overlap_tb timeout");
+    end
+
+    initial begin
+        overlap_cycles = 0;
+        overlap_rise_x = 0;
+        overlap_rise_y = 0;
+        overlap_rise_z = 0;
+        sustained_overlap = 0;
+        overlap_done = 0;
+        poll = 0;
+
+        repeat (2) @(posedge clk);
+        rst_n = 1'b1;
+        @(negedge clk);
+        limit_sync_valid = 1'b1;
+
+        cal_one_axis(0, CAL_TRAVEL);
+        cal_one_axis(1, CAL_TRAVEL);
+        cal_one_axis(2, CAL_TRAVEL);
+        repeat (300) @(negedge clk);
+        if (!startup_complete)
+            $fatal(1, "startup_complete missing after serial cal + profile");
+        if (calibrated_mask !== 3'b111)
+            $fatal(1, "calibrated_mask=%b", calibrated_mask);
+        if (fault_mask !== 3'b000)
+            $fatal(1, "fault_mask=%b", fault_mask);
+
+        open_limit = 3'b000;
+        close_limit = 3'b000;
+        @(negedge clk);
+        percent_x = MID_PCT;
+        percent_y = MID_PCT;
+        percent_z = MID_PCT;
+        motor_request_valid = 1'b1;
+        @(negedge clk);
+        motor_request_valid = 1'b0;
+
+        for (poll = 0; poll < 400000 && !overlap_done; poll = poll + 1) begin
+            @(posedge clk);
+            tick_500us = ((poll % 8) == 0);
+            if (x_moving && y_moving && z_moving) begin
+                overlap_cycles = overlap_cycles + 1;
+                if (overlap_cycles >= 8)
+                    sustained_overlap = 1;
+            end
+            for (ax = 0; ax < 3; ax = ax + 1) begin
+                if (step_rise[ax]) begin
+                    gated_step[ax] = 1'b1;
+                    gated_step_rise[ax] = 1'b1;
+                    if (x_moving && y_moving && z_moving) begin
+                        case (ax)
+                            0: overlap_rise_x = overlap_rise_x + 1;
+                            1: overlap_rise_y = overlap_rise_y + 1;
+                            default: overlap_rise_z = overlap_rise_z + 1;
+                        endcase
+                    end
+                end else begin
+                    gated_step[ax] = 1'b0;
+                    gated_step_rise[ax] = 1'b0;
+                end
+            end
+            if (sustained_overlap &&
+                overlap_rise_x >= 2 &&
+                overlap_rise_y >= 2 &&
+                overlap_rise_z >= 2)
+                overlap_done = 1;
+        end
+
+        if (!sustained_overlap)
+            $fatal(1, "no sustained x&&y&&z moving overlap (cycles=%0d x=%b y=%b z=%b)",
+                overlap_cycles, x_moving, y_moving, z_moving);
+        if (overlap_rise_x < 2 || overlap_rise_y < 2 || overlap_rise_z < 2)
+            $fatal(1, "overlap gated rises x=%0d y=%0d z=%0d",
+                overlap_rise_x, overlap_rise_y, overlap_rise_z);
+
+        $display("door_motion_three_axis_overlap_tb PASS overlap_cycles=%0d rises=%0d/%0d/%0d",
+            overlap_cycles, overlap_rise_x, overlap_rise_y, overlap_rise_z);
+        $finish;
+    end
+endmodule

+ 248 - 0
receipts/scheme-b-attempt/door_shared_dda_executor.v

@@ -0,0 +1,248 @@
+`timescale 1ns/1ps
+
+// Fixed 4-slot TDM shared DDA.
+// One shared phase add/compare; background FSM refreshes rates (one restoring div).
+module door_shared_dda_executor #(
+    parameter integer AXIS_COUNT = 3,
+    parameter integer TRAVEL_WIDTH = 13,
+    parameter integer VALUE_WIDTH = 22,
+    parameter integer PHASE_WIDTH = 33,
+    parameter integer CAL_PHASE_THRESHOLD = 800000
+) (
+    input  wire                         clk,
+    input  wire                         rst_n,
+    input  wire [AXIS_COUNT-1:0]        cal_active,
+    input  wire [AXIS_COUNT-1:0]        run_active,
+    input  wire [AXIS_COUNT-1:0]        allow_toggle,
+    input  wire [AXIS_COUNT-1:0]        endpoint_crawl,
+    input  wire [TRAVEL_WIDTH-1:0]       distance_0,
+    input  wire [TRAVEL_WIDTH-1:0]       distance_1,
+    input  wire [TRAVEL_WIDTH-1:0]       distance_2,
+    input  wire [TRAVEL_WIDTH-1:0]       done_steps_0,
+    input  wire [TRAVEL_WIDTH-1:0]       done_steps_1,
+    input  wire [TRAVEL_WIDTH-1:0]       done_steps_2,
+    input  wire [TRAVEL_WIDTH-1:0]       ramp_unit_0,
+    input  wire [TRAVEL_WIDTH-1:0]       ramp_unit_1,
+    input  wire [TRAVEL_WIDTH-1:0]       ramp_unit_2,
+    input  wire [TRAVEL_WIDTH-1:0]       travel_0,
+    input  wire [TRAVEL_WIDTH-1:0]       travel_1,
+    input  wire [TRAVEL_WIDTH-1:0]       travel_2,
+    input  wire [31:0]                  phase_threshold,
+    output reg  [AXIS_COUNT-1:0]        exec_toggle_pulse,
+    output reg                          all_axes_overlap_seen
+);
+    reg [PHASE_WIDTH-1:0] phase0, phase1, phase2;
+    reg [VALUE_WIDTH-1:0] rate0, rate1, rate2;
+    reg [1:0] slot;
+
+    wire svc_cal =
+        (slot == 2'd0) ? cal_active[0] :
+        (slot == 2'd1) ? cal_active[1] : cal_active[2];
+    wire svc_run =
+        (slot == 2'd0) ? run_active[0] :
+        (slot == 2'd1) ? run_active[1] : run_active[2];
+    wire svc_allow =
+        (slot == 2'd0) ? allow_toggle[0] :
+        (slot == 2'd1) ? allow_toggle[1] : allow_toggle[2];
+    wire svc_active = svc_run || svc_cal;
+    wire [PHASE_WIDTH-1:0] svc_phase =
+        (slot == 2'd0) ? phase0 :
+        (slot == 2'd1) ? phase1 : phase2;
+    wire [VALUE_WIDTH-1:0] svc_rate =
+        (slot == 2'd0) ? rate0 :
+        (slot == 2'd1) ? rate1 : rate2;
+    wire [31:0] svc_thresh = svc_cal ? CAL_PHASE_THRESHOLD[31:0] : phase_threshold;
+    wire [PHASE_WIDTH-1:0] svc_sum =
+        svc_phase + {{(PHASE_WIDTH-VALUE_WIDTH){1'b0}}, svc_rate};
+    wire [PHASE_WIDTH-1:0] svc_thr = {{(PHASE_WIDTH-32){1'b0}}, svc_thresh};
+    wire svc_fire = svc_active && svc_allow && (svc_sum >= svc_thr);
+    wire [PHASE_WIDTH-1:0] svc_next = svc_fire ? (svc_sum - svc_thr) : svc_sum;
+
+    localparam [3:0]
+        RS_LOAD    = 4'd0,
+        RS_PRELOAD = 4'd1,
+        RS_DIV3    = 4'd2,
+        RS_DIV2    = 4'd3,
+        RS_DIV1    = 4'd4,
+        RS_DIV0    = 4'd5,
+        RS_LEVEL   = 4'd6,
+        RS_MUL     = 4'd7,
+        RS_WRITE   = 4'd8;
+
+    reg [3:0] rs;
+    reg [1:0] rr_axis;
+    reg wr_cal, wr_crawl;
+    reg [TRAVEL_WIDTH-1:0] wr_dist, wr_done, wr_ramp, wr_travel;
+    reg [TRAVEL_WIDTH-1:0] div_rem;
+    reg [3:0] div_q, level_r;
+    reg [VALUE_WIDTH-1:0] rate_r;
+
+    function [7:0] f_profile_scale;
+        input [3:0] level;
+        begin
+            case (level)
+                0: f_profile_scale = 8'd64;
+                1: f_profile_scale = 8'd66;
+                2: f_profile_scale = 8'd73;
+                3: f_profile_scale = 8'd84;
+                4: f_profile_scale = 8'd98;
+                5: f_profile_scale = 8'd114;
+                6: f_profile_scale = 8'd132;
+                7: f_profile_scale = 8'd150;
+                8: f_profile_scale = 8'd170;
+                9: f_profile_scale = 8'd188;
+                10: f_profile_scale = 8'd206;
+                11: f_profile_scale = 8'd222;
+                12: f_profile_scale = 8'd236;
+                13: f_profile_scale = 8'd247;
+                14: f_profile_scale = 8'd254;
+                default: f_profile_scale = 8'd255;
+            endcase
+        end
+    endfunction
+
+    wire [16:0] den_ext = {4'b0, wr_ramp};
+    wire [16:0] rem_ext = {4'b0, div_rem};
+    wire [16:0] trial3 = den_ext << 3;
+    wire [16:0] trial2 = den_ext << 2;
+    wire [16:0] trial1 = den_ext << 1;
+    wire take3 = (wr_ramp != 0) && (rem_ext >= trial3);
+    wire take2 = (wr_ramp != 0) && (rem_ext >= trial2);
+    wire take1 = (wr_ramp != 0) && (rem_ext >= trial1);
+    wire take0 = (wr_ramp != 0) && (div_rem >= wr_ramp);
+
+    wire [TRAVEL_WIDTH-1:0] rem_steps =
+        (wr_dist > wr_done) ? (wr_dist - wr_done - 1'b1) : {TRAVEL_WIDTH{1'b0}};
+    wire [TRAVEL_WIDTH-1:0] min_prog =
+        (wr_done < rem_steps) ? wr_done : rem_steps;
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            slot <= 2'd0;
+            phase0 <= {PHASE_WIDTH{1'b0}};
+            phase1 <= {PHASE_WIDTH{1'b0}};
+            phase2 <= {PHASE_WIDTH{1'b0}};
+            rate0 <= {VALUE_WIDTH{1'b0}};
+            rate1 <= {VALUE_WIDTH{1'b0}};
+            rate2 <= {VALUE_WIDTH{1'b0}};
+            exec_toggle_pulse <= {AXIS_COUNT{1'b0}};
+            all_axes_overlap_seen <= 1'b0;
+            rs <= RS_LOAD;
+            rr_axis <= 2'd0;
+            wr_cal <= 1'b0;
+            wr_crawl <= 1'b0;
+            wr_dist <= {TRAVEL_WIDTH{1'b0}};
+            wr_done <= {TRAVEL_WIDTH{1'b0}};
+            wr_ramp <= {{(TRAVEL_WIDTH-1){1'b0}}, 1'b1};
+            wr_travel <= {TRAVEL_WIDTH{1'b0}};
+            div_rem <= {TRAVEL_WIDTH{1'b0}};
+            div_q <= 4'd0;
+            level_r <= 4'd0;
+            rate_r <= {VALUE_WIDTH{1'b0}};
+        end else begin
+            exec_toggle_pulse <= {AXIS_COUNT{1'b0}};
+            slot <= slot + 1'b1;
+
+            if (run_active[0] && run_active[1] && run_active[2])
+                all_axes_overlap_seen <= 1'b1;
+
+            if (slot != 2'd3) begin
+                if (svc_active && svc_allow) begin
+                    case (slot)
+                        2'd0: begin phase0 <= svc_next; exec_toggle_pulse[0] <= svc_fire; end
+                        2'd1: begin phase1 <= svc_next; exec_toggle_pulse[1] <= svc_fire; end
+                        default: begin phase2 <= svc_next; exec_toggle_pulse[2] <= svc_fire; end
+                    endcase
+                end else if (!svc_active) begin
+                    case (slot)
+                        2'd0: phase0 <= {PHASE_WIDTH{1'b0}};
+                        2'd1: phase1 <= {PHASE_WIDTH{1'b0}};
+                        default: phase2 <= {PHASE_WIDTH{1'b0}};
+                    endcase
+                end
+            end
+
+            case (rs)
+                RS_LOAD: begin
+                    case (rr_axis)
+                        2'd0: begin
+                            wr_cal <= cal_active[0]; wr_crawl <= endpoint_crawl[0];
+                            wr_dist <= distance_0; wr_done <= done_steps_0;
+                            wr_ramp <= (ramp_unit_0 == 0) ? {{(TRAVEL_WIDTH-1){1'b0}}, 1'b1} : ramp_unit_0;
+                            wr_travel <= travel_0;
+                        end
+                        2'd1: begin
+                            wr_cal <= cal_active[1]; wr_crawl <= endpoint_crawl[1];
+                            wr_dist <= distance_1; wr_done <= done_steps_1;
+                            wr_ramp <= (ramp_unit_1 == 0) ? {{(TRAVEL_WIDTH-1){1'b0}}, 1'b1} : ramp_unit_1;
+                            wr_travel <= travel_1;
+                        end
+                        default: begin
+                            wr_cal <= cal_active[2]; wr_crawl <= endpoint_crawl[2];
+                            wr_dist <= distance_2; wr_done <= done_steps_2;
+                            wr_ramp <= (ramp_unit_2 == 0) ? {{(TRAVEL_WIDTH-1){1'b0}}, 1'b1} : ramp_unit_2;
+                            wr_travel <= travel_2;
+                        end
+                    endcase
+                    div_q <= 4'd0;
+                    if (!((rr_axis == 2'd0) ? (run_active[0] || cal_active[0]) :
+                          (rr_axis == 2'd1) ? (run_active[1] || cal_active[1]) :
+                                              (run_active[2] || cal_active[2]))) begin
+                        rate_r <= {VALUE_WIDTH{1'b0}};
+                        rs <= RS_WRITE;
+                    end else
+                        rs <= RS_PRELOAD;
+                end
+                RS_PRELOAD: begin
+                    div_rem <= min_prog;
+                    div_q <= 4'd0;
+                    rs <= RS_DIV3;
+                end
+                RS_DIV3: begin
+                    if (take3) begin div_rem <= div_rem - trial3[TRAVEL_WIDTH-1:0]; div_q <= div_q | 4'h8; end
+                    rs <= RS_DIV2;
+                end
+                RS_DIV2: begin
+                    if (take2) begin div_rem <= div_rem - trial2[TRAVEL_WIDTH-1:0]; div_q <= div_q | 4'h4; end
+                    rs <= RS_DIV1;
+                end
+                RS_DIV1: begin
+                    if (take1) begin div_rem <= div_rem - trial1[TRAVEL_WIDTH-1:0]; div_q <= div_q | 4'h2; end
+                    rs <= RS_DIV0;
+                end
+                RS_DIV0: begin
+                    if (take0) begin div_rem <= div_rem - wr_ramp; div_q <= div_q | 4'h1; end
+                    rs <= RS_LEVEL;
+                end
+                RS_LEVEL: begin
+                    if (wr_crawl)
+                        level_r <= 4'd0;
+                    else if (wr_cal)
+                        level_r <= (wr_done[12:3] > 13'd15) ? 4'd15 : wr_done[6:3];
+                    else if (wr_dist == 0)
+                        level_r <= 4'd0;
+                    else
+                        level_r <= div_q;
+                    rs <= RS_MUL;
+                end
+                RS_MUL: begin
+                    if (wr_cal)
+                        rate_r <= {{(VALUE_WIDTH-8){1'b0}}, f_profile_scale(level_r)};
+                    else
+                        rate_r <= wr_travel * f_profile_scale(level_r);
+                    rs <= RS_WRITE;
+                end
+                RS_WRITE: begin
+                    case (rr_axis)
+                        2'd0: rate0 <= rate_r;
+                        2'd1: rate1 <= rate_r;
+                        default: rate2 <= rate_r;
+                    endcase
+                    rr_axis <= (rr_axis == 2'd2) ? 2'd0 : (rr_axis + 1'b1);
+                    rs <= RS_LOAD;
+                end
+                default: rs <= RS_LOAD;
+            endcase
+        end
+    end
+endmodule

+ 74 - 0
receipts/scheme-b-attempt/door_speed_profile_builder.v

@@ -0,0 +1,74 @@
+`timescale 1ns/1ps
+
+// Post-calibration: latch shared phase_threshold = max_travel * THRESHOLD_FACTOR
+// via shift-add. Runtime rate quanta computed in shared DDA.
+module door_speed_profile_builder #(
+    parameter integer TRAVEL_WIDTH = 13,
+    parameter integer THRESHOLD_FACTOR = 800000
+) (
+    input  wire                         clk,
+    input  wire                         rst_n,
+    input  wire                         start,
+    input  wire [TRAVEL_WIDTH-1:0]      travel_x,
+    input  wire [TRAVEL_WIDTH-1:0]      travel_y,
+    input  wire [TRAVEL_WIDTH-1:0]      travel_z,
+    input  wire                         cal_ok_x,
+    input  wire                         cal_ok_y,
+    input  wire                         cal_ok_z,
+    output reg                          busy,
+    output reg                          done,
+    output reg [31:0]                   phase_threshold
+);
+    reg [TRAVEL_WIDTH-1:0] mul_a;
+    reg [31:0] mul_b;
+    reg [31:0] mul_acc;
+    reg [3:0]  mul_bit;
+
+    function automatic [TRAVEL_WIDTH-1:0] f_max3;
+        input [TRAVEL_WIDTH-1:0] a, b, c;
+        reg [TRAVEL_WIDTH-1:0] m;
+        begin
+            m = a;
+            if (b > m) m = b;
+            if (c > m) m = c;
+            f_max3 = m;
+        end
+    endfunction
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            busy <= 1'b0;
+            done <= 1'b0;
+            phase_threshold <= 32'd0;
+            mul_a <= {TRAVEL_WIDTH{1'b0}};
+            mul_b <= 32'd0;
+            mul_acc <= 32'd0;
+            mul_bit <= 4'd0;
+        end else begin
+            done <= 1'b0;
+            if (start && !busy) begin
+                busy <= 1'b1;
+                mul_a <= f_max3(
+                    cal_ok_x ? travel_x : {TRAVEL_WIDTH{1'b0}},
+                    cal_ok_y ? travel_y : {TRAVEL_WIDTH{1'b0}},
+                    cal_ok_z ? travel_z : {TRAVEL_WIDTH{1'b0}}
+                );
+                mul_b <= THRESHOLD_FACTOR[31:0];
+                mul_acc <= 32'd0;
+                mul_bit <= 4'd0;
+            end else if (busy) begin
+                if (mul_bit == 4'd13) begin
+                    phase_threshold <= mul_acc;
+                    busy <= 1'b0;
+                    done <= 1'b1;
+                end else begin
+                    if (mul_a[0])
+                        mul_acc <= mul_acc + mul_b;
+                    mul_a <= {1'b0, mul_a[TRAVEL_WIDTH-1:1]};
+                    mul_b <= {mul_b[30:0], 1'b0};
+                    mul_bit <= mul_bit + 1'b1;
+                end
+            end
+        end
+    end
+endmodule

+ 21 - 0
receipts/scheme-b-attempt/mse-td-manual-phy.json

@@ -0,0 +1,21 @@
+{
+  "status": "pass",
+  "lut": {
+    "used": 4151,
+    "total": 4480,
+    "percent": 92.66
+  },
+  "reg": {
+    "used": 1562,
+    "total": 4480,
+    "percent": 34.87
+  },
+  "motor_lut": 2576,
+  "motor_le": 2937,
+  "fmax_mhz": 23.056,
+  "packing": {
+    "mslice": 1048,
+    "lslice": 1049,
+    "total_slices": 2097
+  }
+}

+ 13 - 0
receipts/scheme-b-attempt/mse-td-opt1-phy.json

@@ -0,0 +1,13 @@
+{
+  "status": "pass",
+  "lut": {
+    "used": 3950
+  },
+  "reg": {
+    "used": 1711
+  },
+  "le": 3950,
+  "fmax_mhz": 53.011,
+  "swns_ns": 21.136,
+  "td_root": "/data/prod2u/td-runs/mse-opt1-20260811T101907Z"
+}

+ 13 - 0
receipts/scheme-b-attempt/mse-td-opt2-phy.json

@@ -0,0 +1,13 @@
+{
+  "status": "pass",
+  "lut": 3984,
+  "reg": 1700,
+  "fmax_mhz": 61.709,
+  "swns_ns": 23.795,
+  "motor_le": 2773,
+  "motor_lut": 2555,
+  "dda_le": 567,
+  "dda_lut": 518,
+  "td_root": "/data/prod2u/td-runs/mse-opt2-20260811T102516Z",
+  "vs_r12_lut_delta": 1091
+}

+ 121 - 0
tests/sim/door_motion_three_axis_overlap_tb.v

@@ -0,0 +1,121 @@
+`timescale 1ns/1ps
+
+// Scheme A (R12 per-axis kernels): mid-percent overlap with >=2 gated rises/axis.
+module door_motion_three_axis_overlap_tb;
+    localparam integer CAL_TRAVEL = 32;
+    localparam integer MID_PCT = 50;
+
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg tick_500us = 1'b0;
+    reg limit_sync_valid = 1'b0;
+    reg [2:0] open_limit = 3'b000;
+    reg [2:0] close_limit = 3'b111;
+    reg [2:0] gated_step = 3'b000;
+    reg [2:0] gated_step_rise = 3'b000;
+    reg motor_request_valid = 1'b0;
+    reg [7:0] percent_x = 8'd0, percent_y = 8'd0, percent_z = 8'd0;
+    wire [2:0] step, dir_close;
+    wire startup_complete;
+    wire [2:0] calibrated_mask, fault_mask;
+    wire x_moving = dut.u_axis_x.moving;
+    wire y_moving = dut.u_axis_y.moving;
+    wire z_moving = dut.u_axis_z.moving;
+
+    integer overlap_cycles, overlap_rise_x, overlap_rise_y, overlap_rise_z;
+    integer sustained_overlap, overlap_done, ax, poll, k;
+
+    always #1 clk = ~clk;
+
+    door_motion_controller #(
+        .MAX_CAL_STEPS(64), .MIN_TRAVEL(2), .ENDPOINT_GUARD_EXTRA(8),
+        .DIR_SETUP_TICKS(1), .PERCENT_MAX(100)
+    ) dut (
+        .clk(clk), .rst_n(rst_n), .tick_500us(tick_500us),
+        .limit_sync_valid(limit_sync_valid),
+        .open_limit(open_limit), .close_limit(close_limit),
+        .gated_step(gated_step), .gated_step_rise(gated_step_rise),
+        .motor_request_valid(motor_request_valid),
+        .percent_x(percent_x), .percent_y(percent_y), .percent_z(percent_z),
+        .watchdog_stop(1'b0), .watchdog_tripped(1'b0),
+        .step(step), .dir_close(dir_close),
+        .startup_complete(startup_complete),
+        .calibrated_mask(calibrated_mask), .fault_mask(fault_mask),
+        .status_capture(1'b0), .status_rd_addr(8'd0), .status_rd_data()
+    );
+
+    task pulse_tick;
+        begin
+            @(negedge clk); tick_500us = 1'b1;
+            @(negedge clk); tick_500us = 1'b0;
+        end
+    endtask
+
+    reg [2:0] step_d;
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) step_d <= 3'b0; else step_d <= step;
+    end
+    wire [2:0] step_rise = step & ~step_d;
+
+    initial begin
+        #8000000 $fatal(1, "timeout");
+    end
+
+    initial begin
+        overlap_cycles = 0; overlap_rise_x = 0; overlap_rise_y = 0; overlap_rise_z = 0;
+        sustained_overlap = 0; overlap_done = 0;
+        repeat (2) @(posedge clk); rst_n = 1'b1;
+        @(negedge clk); limit_sync_valid = 1'b1;
+
+        // Concurrent cal: start with close_limit high → measure-open; count travel; hit open.
+        repeat (8) pulse_tick();
+        for (k = 0; k < CAL_TRAVEL; k = k + 1) begin
+            @(negedge clk);
+            gated_step = 3'b111; gated_step_rise = 3'b111;
+            @(negedge clk);
+            gated_step = 3'b000; gated_step_rise = 3'b000;
+            repeat (2) pulse_tick();
+        end
+        @(negedge clk);
+        open_limit = 3'b111; close_limit = 3'b000;
+        @(negedge clk);
+        open_limit = 3'b000; close_limit = 3'b000;
+        repeat (40) pulse_tick();
+
+        if (!startup_complete) $fatal(1, "no startup_complete cal=%b fault=%b", calibrated_mask, fault_mask);
+        if (calibrated_mask !== 3'b111) $fatal(1, "cal mask %b fault %b", calibrated_mask, fault_mask);
+
+        percent_x = MID_PCT; percent_y = MID_PCT; percent_z = MID_PCT;
+        @(negedge clk); motor_request_valid = 1'b1;
+        @(negedge clk); motor_request_valid = 1'b0;
+
+        for (poll = 0; poll < 200000 && !overlap_done; poll = poll + 1) begin
+            @(posedge clk);
+            tick_500us = (poll % 4) == 0;
+            if (x_moving && y_moving && z_moving) begin
+                overlap_cycles = overlap_cycles + 1;
+                if (overlap_cycles >= 8) sustained_overlap = 1;
+            end
+            for (ax = 0; ax < 3; ax = ax + 1) begin
+                if (step_rise[ax]) begin
+                    gated_step[ax] = 1'b1; gated_step_rise[ax] = 1'b1;
+                    if (x_moving && y_moving && z_moving) begin
+                        if (ax == 0) overlap_rise_x = overlap_rise_x + 1;
+                        else if (ax == 1) overlap_rise_y = overlap_rise_y + 1;
+                        else overlap_rise_z = overlap_rise_z + 1;
+                    end
+                end else begin
+                    gated_step[ax] = 1'b0; gated_step_rise[ax] = 1'b0;
+                end
+            end
+            if (sustained_overlap && overlap_rise_x >= 2 && overlap_rise_y >= 2 && overlap_rise_z >= 2)
+                overlap_done = 1;
+        end
+        if (!sustained_overlap) $fatal(1, "no overlap mov=%b%b%b", x_moving, y_moving, z_moving);
+        if (overlap_rise_x < 2 || overlap_rise_y < 2 || overlap_rise_z < 2)
+            $fatal(1, "rises %0d/%0d/%0d", overlap_rise_x, overlap_rise_y, overlap_rise_z);
+        $display("door_motion_three_axis_overlap_tb PASS schemeA overlap_cycles=%0d rises=%0d/%0d/%0d",
+            overlap_cycles, overlap_rise_x, overlap_rise_y, overlap_rise_z);
+        $finish;
+    end
+endmodule