Explorar el Código

feat(mse): land full-feature Scheme A with A2 DDA

Implement serial X→Y→Z calibration, 25 µs motion service, travel-normalized
rates, and 16-level Q8 S-curve on per-axis safety kernels. Select parallel A2
DDA over sequential A1 by hierarchy cell count; keep Scheme B archived.

Co-authored-by: Cursor <cursoragent@cursor.com>
root hace 3 meses
padre
commit
931af6774b
Se han modificado 45 ficheros con 3288 adiciones y 157 borrados
  1. 1 1
      AGENTS.md
  2. 4 0
      config/source_closure.json
  3. 11 1
      projects/prod2u-door-temp/project.json
  4. 48 0
      receipts/mse-a1-a2-hierarchy-compare.json
  5. 19 0
      receipts/mse-formal-round2.json
  6. 29 0
      receipts/mse-round2-intermediate-summary.md
  7. 36 0
      receipts/mse-round2-verification-matrix.json
  8. 87 0
      receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v
  9. 0 0
      receipts/scheme-a-a2-attempt/door_shared_dda_scheduler_a1.v
  10. 279 0
      receipts/scheme-a-a2-attempt/yosys-a1-dda.stat
  11. 267 0
      receipts/scheme-a-a2-attempt/yosys-a2-dda.stat
  12. 51 1
      schemas/project.schema.json
  13. 26 0
      src/generated/host-contract.json
  14. 5 0
      src/generated/prod2u_door_temp_params.vh
  15. 4 0
      src/generated/td-source-manifest.json
  16. 136 18
      src/modules/door_axis_controller.v
  17. 91 0
      src/modules/door_calibration_sequencer.v
  18. 211 25
      src/modules/door_motion_controller.v
  19. 28 0
      src/modules/door_motion_service_tick.v
  20. 81 0
      src/modules/door_profile_quantum_builder.v
  21. 95 0
      src/modules/door_shared_dda_scheduler.v
  22. 9 1
      tests/formal/door_axis_cal_formal.v
  23. 9 1
      tests/formal/door_axis_motion_contract_formal.v
  24. 9 1
      tests/formal/door_axis_request_limit_race_formal.v
  25. 9 1
      tests/formal/door_axis_request_planner_collision_formal.v
  26. 9 1
      tests/formal/door_axis_source_limit_lingering_formal.v
  27. 9 1
      tests/formal/door_axis_watchdog_drain_formal.v
  28. 9 1
      tests/formal/door_axis_watchdog_formal.v
  29. 25 0
      tests/formal/door_mse_serial_dda.sby
  30. 92 0
      tests/formal/door_mse_serial_dda_formal.v
  31. 125 0
      tests/sim/door_axis_independence_tb.v
  32. 18 2
      tests/sim/door_axis_request_limit_race_tb.v
  33. 18 2
      tests/sim/door_axis_request_planner_collision_tb.v
  34. 4 0
      tests/sim/door_axis_source_limit_linger_tb.v
  35. 9 1
      tests/sim/door_axis_target_valid_tb.v
  36. 9 1
      tests/sim/door_axis_watchdog_drain_tb.v
  37. 138 0
      tests/sim/door_limit_profile_collision_tb.v
  38. 82 29
      tests/sim/door_motion_controller_tb.v
  39. 133 64
      tests/sim/door_motion_three_axis_overlap_tb.v
  40. 163 0
      tests/sim/door_profile_latest_wins_tb.v
  41. 136 0
      tests/sim/door_serial_calibration_tb.v
  42. 246 0
      tests/sim/door_speed_profile_tb.v
  43. 116 0
      tests/sim/door_travel_normalized_timing_tb.v
  44. 53 5
      tools/generate_project.py
  45. 349 0
      tools/mse_motion_ref.py

+ 1 - 1
AGENTS.md

@@ -64,7 +64,7 @@ Current authority is limited to the above contract files, this `AGENTS.md`, and
   - Z: LS CON129.1 K16, HS CON129.2 J15
 - Motors: X STEP/DIR CON104.2/3 C12/B12; Y CON105.2/3 L12/J11; Z CON106.2/3 L14/K14.
 - Runtime: direction-select limit hard-stop each clock; truncate current STEP high pulse immediately after synchronized limit (`truncate_current_high_pulse_immediately_after_synchronized_limit`). Ordinary command / watchdog / endpoint-guard stops do **not** truncate a high pulse; they forbid the next rise.
-- Startup calibration (once per power-on/reset/reconfig): PTC 0%, FAN 10%; each axis independently seek-close (≤5000 gated STEP) then measure-open (≤5000); `travel_steps` latched on success; **no** 500-step backoff. Failed axes FAULT-lock until reset; partial success allowed. X/Y/Z may move concurrently and stop independently.
+- Startup calibration (once per power-on/reset/reconfig): PTC 0%, FAN 10%; **serial X→Y→Z** seek-close (≤5000 gated STEP) then measure-open (≤5000) per axis; `travel_steps` latched on success; **no** 500-step backoff. Failed axes FAULT-lock until reset; partial success allowed. Runtime X/Y/Z may overlap after `startup_complete` / profile ready.
 - `startup_complete` is sticky until next FPGA power-on, global hardware reset, or reconfiguration.
 - During calibration: valid SET_ALL may update FAN/PTC but **ignores** door percents (no cache); GET_MOTOR_STATUS allowed; GET_TEMPERATURE dropped (no response); watchdog not enabled/fed.
 - After `startup_complete`: host must re-send desired percents; ordinary percent motion and runtime limit policy apply; calibration FSM does not restart.

+ 4 - 0
config/source_closure.json

@@ -15,6 +15,10 @@
     "src/modules/shared_500us_tick.v",
     "src/modules/host_watchdog.v",
     "src/modules/door_percent_planner.v",
+    "src/modules/door_motion_service_tick.v",
+    "src/modules/door_calibration_sequencer.v",
+    "src/modules/door_profile_quantum_builder.v",
+    "src/modules/door_shared_dda_scheduler.v",
     "src/modules/door_axis_controller.v",
     "src/modules/door_motion_controller.v",
     "src/modules/prod2u_runtime_step_limit_gate.v",

+ 11 - 1
projects/prod2u-door-temp/project.json

@@ -72,6 +72,13 @@
     "execution": "overlap",
     "step_rate_hz": 1000,
     "step_half_cycles": 12500,
+    "motion_service_us": 25,
+    "motion_service_clks": 625,
+    "phase_factor": 5120,
+    "profile_full": 256,
+    "profile_scale_q8": [64, 66, 73, 84, 98, 114, 132, 150, 170, 188, 206, 222, 236, 247, 254, 256],
+    "cal_ramp_unit": 8,
+    "scheme": "A_full_feature_per_axis_kernels_shared_slow_arith",
     "dir_setup_cycles": 25000,
     "open_dir_value": 0,
     "close_dir_value": 1,
@@ -121,6 +128,8 @@
       "min_travel_steps": 2,
       "step_rate_hz": 1000,
       "axis_order": ["x", "y", "z"],
+      "calibration_schedule": "serial_xyz",
+      "runtime_overlap_allowed": true,
       "final_position": "open",
       "limit_stop_during_move": true,
       "stop_semantics": "truncate_current_high_pulse_immediately_after_synchronized_limit",
@@ -180,7 +189,8 @@
     "target_ram": "optional",
     "request_ram": "optional",
     "temperature_ram": "optional",
-    "dsp": 0,
+    "dsp": "optional",
+    "bram": "optional",
     "shared_pwm_comparators": 1,
     "shared_percent_planner": 1,
     "shared_i2c_readers": 1

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 48 - 0
receipts/mse-a1-a2-hierarchy-compare.json


+ 19 - 0
receipts/mse-formal-round2.json

@@ -0,0 +1,19 @@
+{
+  "schema": "prod2u-mse-formal-receipt-v1",
+  "bounded": true,
+  "unbounded_claim": false,
+  "empty_workdir": true,
+  "tasks": {
+    "door_mse_serial_dda_bmc": {
+      "status": "PASS",
+      "depth": 30,
+      "rc": 0
+    },
+    "door_mse_serial_dda_cover": {
+      "status": "PASS",
+      "depth": 30,
+      "rc": 0
+    }
+  },
+  "note": "A2 DDA active; full formal manifest not_run"
+}

+ 29 - 0
receipts/mse-round2-intermediate-summary.md

@@ -0,0 +1,29 @@
+# MSE Round-2 intermediate summary (full-feature Scheme A)
+
+## Status
+- **non-final intermediate-review**
+- Scheme B remains archived/rejected
+- Full-feature Scheme A implemented with serial X→Y→Z calibration, 25 µs DDA, 16-level Q8 S-curve, travel-normalized rates
+- Hardware validation: **NOT RUN**
+- `dev` lock: `d4f3df2549efeb1e9227f62d1d71c6179c9f9160` (untouched)
+
+## A1 vs A2
+| Candidate | Yosys DDA cells | Active closure |
+|-----------|-----------------|----------------|
+| A1 sequential shared datapath | 87 | archived |
+| A2 parallel narrow datapaths | 44 | **selected** |
+
+Winner rationale: contract prefers A2 when A1 axis mux/writeback does not beat A2 on resources. Hierarchy evidence favors A2. Full-chip fresh TD LUT/Slice/Fmax comparison vs B opt2 and Round-12 baseline is still **not_run**.
+
+## Verification (this round)
+- Python `mse_motion_ref` PASS
+- Icarus: serial_calibration, overlap (production gate), timing, speed_profile, latest_wins, independence, limit_profile_collision, plus Round-12 axis regression TBs PASS
+- Formal bounded BMC+cover `door_mse_serial_dda` PASS (empty workdir, depth 30) — not unbounded
+- Formal full manifest / cocotb / verilator / fresh TD: **not_run** (blocks final)
+
+## Remaining before final
+1. Full formal manifest
+2. cocotb + verilator
+3. Fresh exclusive `td2026` for full-feature A2 (and optional A1 confirmation)
+4. Five-audit closure
+5. final-review + firmware packages only after clean tree + all green

+ 36 - 0
receipts/mse-round2-verification-matrix.json

@@ -0,0 +1,36 @@
+{
+  "schema": "prod2u-mse-round2-verification-matrix-v1",
+  "generated_utc": "2026-08-11T12:52:40Z",
+  "package_stage": "intermediate-review",
+  "hardware_validation": "NOT RUN",
+  "dev_lock": "d4f3df2549efeb1e9227f62d1d71c6179c9f9160",
+  "branch": "preview/motor-shared-executor",
+  "results": {
+    "python_mse_motion_ref": "PASS",
+    "icarus_door_axis_watchdog_drain": "PASS",
+    "icarus_door_axis_target_valid": "PASS",
+    "icarus_door_axis_source_limit_linger": "PASS",
+    "icarus_door_axis_request_limit_race": "PASS",
+    "icarus_door_axis_request_planner_collision": "PASS",
+    "icarus_door_motion_controller": "PASS",
+    "icarus_door_serial_calibration": "PASS",
+    "icarus_door_motion_three_axis_overlap": "PASS",
+    "icarus_door_travel_normalized_timing": "PASS",
+    "icarus_door_speed_profile": "PASS",
+    "icarus_door_profile_latest_wins": "PASS",
+    "icarus_door_axis_independence": "PASS",
+    "icarus_door_limit_profile_collision": "PASS",
+    "formal_door_mse_serial_dda_bmc": "PASS_bounded_depth30",
+    "formal_door_mse_serial_dda_cover": "PASS_bounded_depth30",
+    "formal_full_manifest": "not_run",
+    "cocotb": "not_run",
+    "verilator_lint": "not_run",
+    "td_full_feature_a1": "not_run",
+    "td_full_feature_a2": "not_run",
+    "five_audit": "partial_pending_td"
+  },
+  "a1_a2_provisional_winner": "A2",
+  "scheme_b": "archived_rejected",
+  "non_final": true,
+  "a1_a2_active_closure": "A2"
+}

+ 87 - 0
receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v

@@ -0,0 +1,87 @@
+`timescale 1ns/1ps
+
+// Scheme A2 candidate: three parallel narrow DDA datapaths (profile still shared externally).
+// Kept out of active source closure unless hierarchy/TD wins over A1.
+module door_parallel_dda_scheduler_a2 #(
+    parameter integer PHASE_WIDTH  = 26,
+    parameter integer RATE_WIDTH   = 21,
+    parameter integer THRESH_WIDTH = 25,
+    parameter integer CAL_PHASE_THRESHOLD = 5120
+) (
+    input  wire                         clk,
+    input  wire                         rst_n,
+    input  wire                         service_ce,
+    input  wire [2:0]                   active,
+    input  wire [2:0]                   cal_mode,
+    input  wire [RATE_WIDTH-1:0]        rate0,
+    input  wire [RATE_WIDTH-1:0]        rate1,
+    input  wire [RATE_WIDTH-1:0]        rate2,
+    input  wire [THRESH_WIDTH-1:0]      phase_threshold,
+    output reg  [2:0]                   toggle_pulse,
+    output reg                          busy,
+    output wire                         service_overrun
+);
+    reg [PHASE_WIDTH-1:0] phase0, phase1, phase2;
+    reg overrun_r;
+    assign service_overrun = overrun_r;
+
+    wire [PHASE_WIDTH-1:0] thr_run =
+        {{(PHASE_WIDTH-THRESH_WIDTH){1'b0}}, phase_threshold};
+    wire [PHASE_WIDTH-1:0] thr_cal = CAL_PHASE_THRESHOLD[PHASE_WIDTH-1:0];
+
+    function automatic [PHASE_WIDTH-1:0] f_next;
+        input [PHASE_WIDTH-1:0] ph;
+        input [RATE_WIDTH-1:0]  rate;
+        input [PHASE_WIDTH-1:0] thr;
+        input                   en;
+        reg   [PHASE_WIDTH-1:0] sum;
+        begin
+            if (!en) f_next = {PHASE_WIDTH{1'b0}};
+            else begin
+                sum = ph + {{(PHASE_WIDTH-RATE_WIDTH){1'b0}}, rate};
+                f_next = (sum >= thr) ? (sum - thr) : sum;
+            end
+        end
+    endfunction
+
+    function automatic f_fire;
+        input [PHASE_WIDTH-1:0] ph;
+        input [RATE_WIDTH-1:0]  rate;
+        input [PHASE_WIDTH-1:0] thr;
+        input                   en;
+        reg   [PHASE_WIDTH-1:0] sum;
+        begin
+            sum = ph + {{(PHASE_WIDTH-RATE_WIDTH){1'b0}}, rate};
+            f_fire = en && (sum >= thr);
+        end
+    endfunction
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            phase0 <= {PHASE_WIDTH{1'b0}};
+            phase1 <= {PHASE_WIDTH{1'b0}};
+            phase2 <= {PHASE_WIDTH{1'b0}};
+            toggle_pulse <= 3'b000;
+            busy <= 1'b0;
+            overrun_r <= 1'b0;
+        end else begin
+            toggle_pulse <= 3'b000;
+            busy <= 1'b0;
+            if (service_ce) begin
+                if (busy) overrun_r <= 1'b1;
+                begin : par
+                    reg [PHASE_WIDTH-1:0] t0, t1, t2;
+                    t0 = cal_mode[0] ? thr_cal : thr_run;
+                    t1 = cal_mode[1] ? thr_cal : thr_run;
+                    t2 = cal_mode[2] ? thr_cal : thr_run;
+                    toggle_pulse[0] <= f_fire(phase0, rate0, t0, active[0]);
+                    toggle_pulse[1] <= f_fire(phase1, rate1, t1, active[1]);
+                    toggle_pulse[2] <= f_fire(phase2, rate2, t2, active[2]);
+                    phase0 <= f_next(phase0, rate0, t0, active[0]);
+                    phase1 <= f_next(phase1, rate1, t1, active[1]);
+                    phase2 <= f_next(phase2, rate2, t2, active[2]);
+                end
+            end
+        end
+    end
+endmodule

+ 0 - 0
receipts/scheme-a-a2-attempt/door_shared_dda_scheduler_a1.v


+ 279 - 0
receipts/scheme-a-a2-attempt/yosys-a1-dda.stat

@@ -0,0 +1,279 @@
+
+-- Running command `read_verilog src/modules/door_shared_dda_scheduler.v; hierarchy -check -top door_shared_dda_scheduler; proc; opt_clean; stat' --
+
+1. Executing Verilog-2005 frontend: src/modules/door_shared_dda_scheduler.v
+Parsing Verilog input from `src/modules/door_shared_dda_scheduler.v' to AST representation.
+Generating RTLIL representation for module `\door_shared_dda_scheduler'.
+Successfully finished Verilog frontend.
+
+2. Executing HIERARCHY pass (managing design hierarchy).
+
+2.1. Analyzing design hierarchy..
+Top module:  \door_shared_dda_scheduler
+
+2.2. Analyzing design hierarchy..
+Top module:  \door_shared_dda_scheduler
+Removed 0 unused modules.
+
+3. Executing PROC pass (convert processes to netlists).
+
+3.1. Executing PROC_CLEAN pass (remove empty switches from decision trees).
+Cleaned up 0 empty switches.
+
+3.2. Executing PROC_RMDEAD pass (remove dead branches from decision trees).
+Marked 9 switch rules as full_case in process $proc$src/modules/door_shared_dda_scheduler.v:76$7 in module door_shared_dda_scheduler.
+Removed a total of 0 dead cases.
+
+3.3. Executing PROC_PRUNE pass (remove redundant assignments in processes).
+Removed 1 redundant assignment.
+Promoted 39 assignments to connections.
+
+3.4. Executing PROC_INIT pass (extract init attributes).
+
+3.5. Executing PROC_ARST pass (detect async resets in processes).
+Found async reset \rst_n in `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+
+3.6. Executing PROC_ROM pass (convert switches to ROMs).
+Converted 0 switches.
+<suppressed ~10 debug messages>
+
+3.7. Executing PROC_MUX pass (convert decision trees to multiplexers).
+Creating decoders for process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+     1/97: $4\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.$result[25:0]$148
+     2/97: $3\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.$result[25:0]$144
+     3/97: $3\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.sum[25:0]$145
+     4/97: $4\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.$result[25:0]$137
+     5/97: $3\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.$result[25:0]$133
+     6/97: $3\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.sum[25:0]$134
+     7/97: $0\toggle_pulse[2:0] [2]
+     8/97: $0\toggle_pulse[2:0] [1]
+     9/97: $3\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.$result[25:0]$122
+    10/97: $3\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.sum[25:0]$123
+    11/97: $4\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.$result[25:0]$126
+    12/97: $0\toggle_pulse[2:0] [0]
+    13/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.en[0:0]$115
+    14/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.thr[25:0]$114
+    15/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.rate[20:0]$113
+    16/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.ph[25:0]$112
+    17/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.$result[25:0]$111
+    18/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.sum[25:0]$110
+    19/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.en[0:0]$109
+    20/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.thr[25:0]$108
+    21/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.rate[20:0]$107
+    22/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.ph[25:0]$106
+    23/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.$result[0:0]$105
+    24/97: $2\ax2.thr[25:0]
+    25/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.sum[25:0]$104
+    26/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.en[0:0]$103
+    27/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.thr[25:0]$102
+    28/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.rate[20:0]$101
+    29/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.ph[25:0]$100
+    30/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.$result[25:0]$99
+    31/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.sum[25:0]$98
+    32/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.en[0:0]$97
+    33/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.thr[25:0]$96
+    34/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.rate[20:0]$95
+    35/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.ph[25:0]$94
+    36/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.$result[0:0]$93
+    37/97: $2\ax1.thr[25:0]
+    38/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.sum[25:0]$92
+    39/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.en[0:0]$91
+    40/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.thr[25:0]$90
+    41/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.rate[20:0]$89
+    42/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.ph[25:0]$88
+    43/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.$result[25:0]$87
+    44/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.sum[25:0]$86
+    45/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.en[0:0]$85
+    46/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.thr[25:0]$84
+    47/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.rate[20:0]$83
+    48/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.ph[25:0]$82
+    49/97: $2\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.$result[0:0]$81
+    50/97: $2\ax0.thr[25:0]
+    51/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.sum[25:0]$80
+    52/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.en[0:0]$79
+    53/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.thr[25:0]$78
+    54/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.rate[20:0]$77
+    55/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.ph[25:0]$76
+    56/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.$result[25:0]$75
+    57/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.sum[25:0]$74
+    58/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.en[0:0]$73
+    59/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.thr[25:0]$72
+    60/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.rate[20:0]$71
+    61/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.ph[25:0]$70
+    62/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.$result[0:0]$69
+    63/97: $1\ax2.thr[25:0]
+    64/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.sum[25:0]$68
+    65/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.en[0:0]$67
+    66/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.thr[25:0]$66
+    67/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.rate[20:0]$65
+    68/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.ph[25:0]$64
+    69/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.$result[25:0]$63
+    70/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.sum[25:0]$62
+    71/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.en[0:0]$61
+    72/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.thr[25:0]$60
+    73/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.rate[20:0]$59
+    74/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.ph[25:0]$58
+    75/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.$result[0:0]$57
+    76/97: $1\ax1.thr[25:0]
+    77/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.sum[25:0]$56
+    78/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.en[0:0]$55
+    79/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.thr[25:0]$54
+    80/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.rate[20:0]$53
+    81/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.ph[25:0]$52
+    82/97: $1\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.$result[25:0]$51
+    83/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.sum[25:0]$50
+    84/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.en[0:0]$49
+    85/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.thr[25:0]$48
+    86/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.rate[20:0]$47
+    87/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.ph[25:0]$46
+    88/97: $1\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.$result[0:0]$45
+    89/97: $1\ax0.thr[25:0]
+    90/97: $2\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.sum[25:0]$116
+    91/97: $0\overrun_r[0:0]
+    92/97: $0\service_pending[0:0]
+    93/97: $0\phase2[25:0]
+    94/97: $0\phase1[25:0]
+    95/97: $0\phase0[25:0]
+    96/97: $0\state[1:0]
+    97/97: $0\busy[0:0]
+
+3.8. Executing PROC_DLATCH pass (convert process syncs to latches).
+
+3.9. Executing PROC_DFF pass (convert process syncs to FFs).
+Creating register for signal `\door_shared_dda_scheduler.\toggle_pulse' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$437' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\busy' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$442' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\state' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$447' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\phase0' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$452' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\phase1' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$457' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\phase2' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$462' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\service_pending' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$467' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\overrun_r' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$472' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\ax0.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $dff cell `$procdff$479' with positive edge clock.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.$result' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$484' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.ph' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$489' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.rate' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$494' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$499' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.en' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$504' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:110$1.sum' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$509' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.$result' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$514' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.ph' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$519' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.rate' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$524' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$529' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.en' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$534' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:111$2.sum' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$539' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\ax1.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $dff cell `$procdff$546' with positive edge clock.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.$result' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$551' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.ph' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$556' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.rate' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$561' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$566' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.en' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$571' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:119$3.sum' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$576' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.$result' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$581' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.ph' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$586' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.rate' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$591' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$596' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.en' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$601' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:120$4.sum' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$606' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\ax2.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $dff cell `$procdff$613' with positive edge clock.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.$result' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$618' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.ph' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$623' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.rate' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$628' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$633' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.en' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$638' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_fire$func$src/modules/door_shared_dda_scheduler.v:128$5.sum' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$643' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.$result' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$648' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.ph' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$653' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.rate' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$658' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.thr' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$663' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.en' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$668' with positive edge clock and positive level reset.
+Creating register for signal `\door_shared_dda_scheduler.\f_next$func$src/modules/door_shared_dda_scheduler.v:129$6.sum' using process `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+  created $adff cell `$procdff$673' with positive edge clock and positive level reset.
+
+3.10. Executing PROC_MEMWR pass (convert process memory writes to cells).
+
+3.11. Executing PROC_CLEAN pass (remove empty switches from decision trees).
+Found and cleaned up 10 empty switches in `\door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+Removing empty process `door_shared_dda_scheduler.$proc$src/modules/door_shared_dda_scheduler.v:76$7'.
+Cleaned up 10 empty switches.
+
+3.12. Executing OPT_EXPR pass (perform const folding).
+Optimizing module door_shared_dda_scheduler.
+<suppressed ~124 debug messages>
+
+4. Executing OPT_CLEAN pass (remove unused cells and wires).
+Finding unused cells or wires in module \door_shared_dda_scheduler..
+Removed 208 unused cells and 410 unused wires.
+<suppressed ~242 debug messages>
+
+5. Printing statistics.
+
+=== door_shared_dda_scheduler ===
+
+        +----------Local Count, excluding submodules.
+        | 
+       98 wires
+     1070 wire bits
+       21 public wires
+      239 public wire bits
+       13 ports
+      105 port bits
+       87 cells
+        6   $add
+        8   $adff
+       20   $eq
+        6   $ge
+        3   $logic_and
+        7   $logic_not
+       28   $mux
+        6   $pmux
+        3   $sub
+
+End of script. Logfile hash: ad2e31f4d2, time: 0.03s, user: 0.03s, system: 0.00s, MEM: 18.80 MB peak
+Yosys 0.67+146 (git sha1 468ba27d9-dirty, Release, Clang /usr/bin/clang++ 21.1.8)
+Time spent: 35% 1x proc_mux (0 sec), 27% 2x read_verilog (0 sec), ...

+ 267 - 0
receipts/scheme-a-a2-attempt/yosys-a2-dda.stat

@@ -0,0 +1,267 @@
+
+-- Running command `read_verilog receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v; hierarchy -check -top door_parallel_dda_scheduler_a2; proc; opt_clean; stat' --
+
+1. Executing Verilog-2005 frontend: receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v
+Parsing Verilog input from `receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v' to AST representation.
+Generating RTLIL representation for module `\door_parallel_dda_scheduler_a2'.
+Successfully finished Verilog frontend.
+
+2. Executing HIERARCHY pass (managing design hierarchy).
+
+2.1. Analyzing design hierarchy..
+Top module:  \door_parallel_dda_scheduler_a2
+
+2.2. Analyzing design hierarchy..
+Top module:  \door_parallel_dda_scheduler_a2
+Removed 0 unused modules.
+
+3. Executing PROC pass (convert processes to netlists).
+
+3.1. Executing PROC_CLEAN pass (remove empty switches from decision trees).
+Cleaned up 0 empty switches.
+
+3.2. Executing PROC_RMDEAD pass (remove dead branches from decision trees).
+Marked 5 switch rules as full_case in process $proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7 in module door_parallel_dda_scheduler_a2.
+Removed a total of 0 dead cases.
+
+3.3. Executing PROC_PRUNE pass (remove redundant assignments in processes).
+Removed 2 redundant assignments.
+Promoted 39 assignments to connections.
+
+3.4. Executing PROC_INIT pass (extract init attributes).
+
+3.5. Executing PROC_ARST pass (detect async resets in processes).
+Found async reset \rst_n in `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+
+3.6. Executing PROC_ROM pass (convert switches to ROMs).
+Converted 0 switches.
+<suppressed ~5 debug messages>
+
+3.7. Executing PROC_MUX pass (convert decision trees to multiplexers).
+Creating decoders for process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+     1/92: $3\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.$result[25:0]$144
+     2/92: $3\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.sum[25:0]$145
+     3/92: $3\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.$result[25:0]$137
+     4/92: $3\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.sum[25:0]$138
+     5/92: $3\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.$result[25:0]$130
+     6/92: $3\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.sum[25:0]$131
+     7/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.sum[25:0]$116
+     8/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.$result[25:0]$111
+     9/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.en[0:0]$115
+    10/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.thr[25:0]$114
+    11/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.rate[20:0]$113
+    12/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.ph[25:0]$112
+    13/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.sum[25:0]$110
+    14/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.$result[25:0]$105
+    15/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.en[0:0]$109
+    16/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.thr[25:0]$108
+    17/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.rate[20:0]$107
+    18/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.ph[25:0]$106
+    19/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.sum[25:0]$104
+    20/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.$result[25:0]$99
+    21/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.en[0:0]$103
+    22/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.thr[25:0]$102
+    23/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.rate[20:0]$101
+    24/92: $2\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.ph[25:0]$100
+    25/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.$result[0:0]$93
+    26/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.sum[25:0]$98
+    27/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.en[0:0]$97
+    28/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.thr[25:0]$96
+    29/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.rate[20:0]$95
+    30/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.ph[25:0]$94
+    31/92: $0\toggle_pulse[2:0] [2]
+    32/92: $0\toggle_pulse[2:0] [1]
+    33/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.sum[25:0]$92
+    34/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.en[0:0]$91
+    35/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.thr[25:0]$90
+    36/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.rate[20:0]$89
+    37/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.ph[25:0]$88
+    38/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.$result[0:0]$87
+    39/92: $0\toggle_pulse[2:0] [0]
+    40/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.sum[25:0]$86
+    41/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.en[0:0]$85
+    42/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.thr[25:0]$84
+    43/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.rate[20:0]$83
+    44/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.ph[25:0]$82
+    45/92: $2\par.t2[25:0]
+    46/92: $2\par.t1[25:0]
+    47/92: $2\par.t0[25:0]
+    48/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.sum[25:0]$80
+    49/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.en[0:0]$79
+    50/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.thr[25:0]$78
+    51/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.rate[20:0]$77
+    52/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.ph[25:0]$76
+    53/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.$result[25:0]$75
+    54/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.sum[25:0]$74
+    55/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.en[0:0]$73
+    56/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.thr[25:0]$72
+    57/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.rate[20:0]$71
+    58/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.ph[25:0]$70
+    59/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.$result[25:0]$69
+    60/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.sum[25:0]$68
+    61/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.en[0:0]$67
+    62/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.thr[25:0]$66
+    63/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.rate[20:0]$65
+    64/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.ph[25:0]$64
+    65/92: $1\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.$result[25:0]$63
+    66/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.sum[25:0]$62
+    67/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.en[0:0]$61
+    68/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.thr[25:0]$60
+    69/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.rate[20:0]$59
+    70/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.ph[25:0]$58
+    71/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.$result[0:0]$57
+    72/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.sum[25:0]$56
+    73/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.en[0:0]$55
+    74/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.thr[25:0]$54
+    75/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.rate[20:0]$53
+    76/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.ph[25:0]$52
+    77/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.$result[0:0]$51
+    78/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.sum[25:0]$50
+    79/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.en[0:0]$49
+    80/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.thr[25:0]$48
+    81/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.rate[20:0]$47
+    82/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.ph[25:0]$46
+    83/92: $1\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.$result[0:0]$45
+    84/92: $1\par.t2[25:0]
+    85/92: $1\par.t1[25:0]
+    86/92: $1\par.t0[25:0]
+    87/92: $0\busy[0:0]
+    88/92: $2\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.$result[0:0]$81
+    89/92: $0\overrun_r[0:0]
+    90/92: $0\phase2[25:0]
+    91/92: $0\phase1[25:0]
+    92/92: $0\phase0[25:0]
+
+3.8. Executing PROC_DLATCH pass (convert process syncs to latches).
+
+3.9. Executing PROC_DFF pass (convert process syncs to FFs).
+Creating register for signal `\door_parallel_dda_scheduler_a2.\toggle_pulse' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$330' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\busy' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$335' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\phase0' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$340' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\phase1' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$345' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\phase2' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$350' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\overrun_r' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$355' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\par.t0' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $dff cell `$procdff$362' with positive edge clock.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\par.t1' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $dff cell `$procdff$369' with positive edge clock.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\par.t2' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $dff cell `$procdff$376' with positive edge clock.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.$result' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$381' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.ph' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$386' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.rate' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$391' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.thr' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$396' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.en' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$401' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:77$1.sum' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$406' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.$result' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$411' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.ph' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$416' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.rate' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$421' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.thr' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$426' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.en' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$431' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:78$2.sum' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$436' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.$result' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$441' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.ph' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$446' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.rate' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$451' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.thr' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$456' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.en' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$461' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_fire$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:79$3.sum' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$466' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.$result' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$471' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.ph' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$476' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.rate' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$481' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.thr' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$486' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.en' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$491' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:80$4.sum' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$496' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.$result' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$501' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.ph' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$506' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.rate' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$511' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.thr' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$516' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.en' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$521' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:81$5.sum' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$526' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.$result' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$531' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.ph' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$536' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.rate' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$541' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.thr' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$546' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.en' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$551' with positive edge clock and positive level reset.
+Creating register for signal `\door_parallel_dda_scheduler_a2.\f_next$func$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:82$6.sum' using process `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+  created $adff cell `$procdff$556' with positive edge clock and positive level reset.
+
+3.10. Executing PROC_MEMWR pass (convert process memory writes to cells).
+
+3.11. Executing PROC_CLEAN pass (remove empty switches from decision trees).
+Found and cleaned up 5 empty switches in `\door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+Removing empty process `door_parallel_dda_scheduler_a2.$proc$receipts/scheme-a-a2-attempt/door_parallel_dda_scheduler_a2.v:59$7'.
+Cleaned up 5 empty switches.
+
+3.12. Executing OPT_EXPR pass (perform const folding).
+Optimizing module door_parallel_dda_scheduler_a2.
+<suppressed ~96 debug messages>
+
+4. Executing OPT_CLEAN pass (remove unused cells and wires).
+Finding unused cells or wires in module \door_parallel_dda_scheduler_a2..
+Removed 136 unused cells and 371 unused wires.
+<suppressed ~170 debug messages>
+
+5. Printing statistics.
+
+=== door_parallel_dda_scheduler_a2 ===
+
+        +----------Local Count, excluding submodules.
+        | 
+       54 wires
+      871 wire bits
+       18 public wires
+      233 public wire bits
+       12 ports
+      102 port bits
+       44 cells
+        6   $add
+        6   $adff
+        6   $ge
+        3   $logic_and
+       20   $mux
+        3   $sub
+
+End of script. Logfile hash: 0cb2e3b33d, time: 0.02s, user: 0.02s, system: 0.01s, MEM: 18.31 MB peak
+Yosys 0.67+146 (git sha1 468ba27d9-dirty, Release, Clang /usr/bin/clang++ 21.1.8)
+Time spent: 31% 2x read_verilog (0 sec), 28% 1x proc_mux (0 sec), ...

+ 51 - 1
schemas/project.schema.json

@@ -271,6 +271,13 @@
                                                        "execution",
                                                        "step_rate_hz",
                                                        "step_half_cycles",
+                                                       "motion_service_us",
+                                                       "motion_service_clks",
+                                                       "phase_factor",
+                                                       "profile_full",
+                                                       "profile_scale_q8",
+                                                       "cal_ramp_unit",
+                                                       "scheme",
                                                        "dir_setup_cycles",
                                                        "open_dir_value",
                                                        "close_dir_value",
@@ -298,6 +305,34 @@
                                                          "step_half_cycles":  {
                                                                                   "type":  "integer"
                                                                               },
+                                                         "motion_service_us":  {
+                                                                                   "type":  "integer",
+                                                                                   "minimum":  1,
+                                                                                   "maximum":  50
+                                                                               },
+                                                         "motion_service_clks":  {
+                                                                                     "type":  "integer"
+                                                                                 },
+                                                         "phase_factor":  {
+                                                                              "type":  "integer"
+                                                                          },
+                                                         "profile_full":  {
+                                                                               "type":  "integer"
+                                                                           },
+                                                         "profile_scale_q8":  {
+                                                                                   "type":  "array",
+                                                                                   "minItems":  16,
+                                                                                   "maxItems":  16,
+                                                                                   "items":  {
+                                                                                                 "type":  "integer"
+                                                                                             }
+                                                                               },
+                                                         "cal_ramp_unit":  {
+                                                                                "type":  "integer"
+                                                                            },
+                                                         "scheme":  {
+                                                                         "type":  "string"
+                                                                     },
                                                          "dir_setup_cycles":  {
                                                                                   "type":  "integer"
                                                                               },
@@ -499,6 +534,8 @@
                                                                                           "min_travel_steps",
                                                                                           "step_rate_hz",
                                                                                           "axis_order",
+                                                                                          "calibration_schedule",
+                                                                                          "runtime_overlap_allowed",
                                                                                           "final_position",
                                                                                           "limit_stop_during_move",
                                                                                           "stop_semantics",
@@ -530,6 +567,13 @@
                                                                                                                           "type":  "string"
                                                                                                                       }
                                                                                                          },
+                                                                                            "calibration_schedule":  {
+                                                                                                                          "type":  "string",
+                                                                                                                          "enum":  ["serial_xyz"]
+                                                                                                                      },
+                                                                                            "runtime_overlap_allowed":  {
+                                                                                                                             "type":  "boolean"
+                                                                                                                         },
                                                                                             "final_position":  {
                                                                                                                    "type":  "string",
                                                                                                                    "enum":  ["open"]
@@ -734,6 +778,7 @@
                                                           "request_ram",
                                                           "temperature_ram",
                                                           "dsp",
+                                                          "bram",
                                                           "shared_pwm_comparators",
                                                           "shared_percent_planner",
                                                           "shared_i2c_readers"
@@ -752,8 +797,13 @@
                                                                                          "enum":  ["optional", "required", "forbidden"]
                                                                                      },
                                                             "dsp":  {
-                                                                        "type":  "integer"
+                                                                        "type":  "string",
+                                                                        "enum":  ["optional", "required", "forbidden"]
                                                                     },
+                                                            "bram":  {
+                                                                         "type":  "string",
+                                                                         "enum":  ["optional", "required", "forbidden"]
+                                                                     },
                                                             "shared_pwm_comparators":  {
                                                                                            "type":  "integer"
                                                                                        },

+ 26 - 0
src/generated/host-contract.json

@@ -172,6 +172,7 @@
         "y",
         "z"
       ],
+      "calibration_schedule": "serial_xyz",
       "enabled": true,
       "fault_lock_until_reset": true,
       "final_position": "open",
@@ -181,11 +182,13 @@
       "mode": "seek_close_then_measure_open",
       "partial_axis_failure_allowed": true,
       "runtime_limit_use": true,
+      "runtime_overlap_allowed": true,
       "step_rate_hz": 1000,
       "stop_semantics": "truncate_current_high_pulse_immediately_after_synchronized_limit"
     }
   },
   "motors": {
+    "cal_ramp_unit": 8,
     "close_dir_value": 1,
     "count": 3,
     "dir_close_level": [
@@ -235,12 +238,15 @@
         "step_connector_pin": 2
       }
     },
+    "motion_service_clks": 625,
+    "motion_service_us": 25,
     "open_dir_value": 0,
     "order": [
       "x",
       "y",
       "z"
     ],
+    "phase_factor": 5120,
     "positioning": {
       "close_endpoint_percent": 100,
       "command_interrupt": "finish_current_high_pulse_then_replan",
@@ -258,7 +264,27 @@
       "rounding": "half_up",
       "shared_percent_planner": true
     },
+    "profile_full": 256,
+    "profile_scale_q8": [
+      64,
+      66,
+      73,
+      84,
+      98,
+      114,
+      132,
+      150,
+      170,
+      188,
+      206,
+      222,
+      236,
+      247,
+      254,
+      256
+    ],
     "role": "door",
+    "scheme": "A_full_feature_per_axis_kernels_shared_slow_arith",
     "step_half_cycles": 12500,
     "step_rate_hz": 1000
   },

+ 5 - 0
src/generated/prod2u_door_temp_params.vh

@@ -44,6 +44,11 @@
 `define P4_FRAME_INTER_BYTE_TIMEOUT_CYCLES 250000
 `define P4_MOTOR_STEP_RATE_HZ 1000
 `define P4_MOTOR_STEP_HALF_CYCLES 12500
+`define P4_MOTION_SERVICE_US 25
+`define P4_MOTION_SERVICE_CLKS 625
+`define P4_PHASE_FACTOR 5120
+`define P4_PROFILE_FULL 256
+`define P4_CAL_RAMP_UNIT 8
 `define P4_MOTOR_DIR_SETUP_CYCLES 25000
 `define P4_MOTOR_DIR_SETUP_TICKS 2
 `define P4_TEMPERATURE_COUNT 27

+ 4 - 0
src/generated/td-source-manifest.json

@@ -204,6 +204,10 @@
     "src/modules/shared_500us_tick.v",
     "src/modules/host_watchdog.v",
     "src/modules/door_percent_planner.v",
+    "src/modules/door_motion_service_tick.v",
+    "src/modules/door_calibration_sequencer.v",
+    "src/modules/door_profile_quantum_builder.v",
+    "src/modules/door_shared_dda_scheduler.v",
     "src/modules/door_axis_controller.v",
     "src/modules/door_motion_controller.v",
     "src/modules/prod2u_runtime_step_limit_gate.v",

+ 136 - 18
src/modules/door_axis_controller.v

@@ -8,19 +8,24 @@ module door_axis_controller #(
     parameter integer MIN_TRAVEL = 2,
     parameter integer ENDPOINT_GUARD_EXTRA = 500,
     parameter integer DIR_SETUP_TICKS = 2,
-    parameter integer PERCENT_MAX = 100
+    parameter integer PERCENT_MAX = 100,
+    parameter integer CAL_RAMP_UNIT = 8
 ) (
     input  wire        clk,
     input  wire        rst_n,
     input  wire        open_limit,
     input  wire        close_limit,
     input  wire        limit_sync_valid,
+    input  wire        cal_enable,
     input  wire        gated_step,
     input  wire        gated_step_rise,
     input  wire        tick_500us,
+    input  wire        step_toggle_pulse,
     input  wire        request_valid,
     input  wire [7:0]  requested_percent_in,
     input  wire        watchdog_stop,
+    input  wire [20:0] rate_quantum_in,
+    input  wire        rate_quantum_valid,
     output reg         planner_req,
     output wire [7:0]  planner_percent,
     output wire [12:0] planner_travel,
@@ -39,7 +44,17 @@ module door_axis_controller #(
     output reg  [7:0]  status_fault_code,
     output wire        calibrated,
     output wire        faulted,
-    output wire        terminal
+    output wire        terminal,
+    output wire        axis_moving,
+    output wire        axis_allow_rise,
+    output wire        axis_in_calibration,
+    output wire        axis_endpoint_crawl,
+    output wire        axis_dda_run,
+    output reg  [3:0]  profile_level,
+    output reg  [12:0] profile_distance,
+    output reg  [12:0] profile_done_steps,
+    output reg  [12:0] profile_ramp_unit,
+    output reg  [20:0] rate_quantum
 );
     localparam [2:0] ST_CAL_SEEK_CLOSE   = 3'd0;
     localparam [2:0] ST_CAL_MEASURE_OPEN = 3'd1;
@@ -102,6 +117,60 @@ module door_axis_controller #(
     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);
+    assign axis_moving = moving;
+    assign axis_allow_rise = allow_rise && !stop_after_budget;
+    assign axis_in_calibration = in_calibration;
+    assign axis_endpoint_crawl = endpoint_mode && moving && calibrated_r;
+    // DDA only while producing/consuming half-cycles; DIR_SETUP clears phase via !active.
+    assign axis_dda_run = (phase == PH_RUN) || (phase == PH_DRAIN_HIGH);
+
+    // level = min(15, floor(done/unit), floor((remaining-1)/unit)) via repeated add (no divider).
+    function automatic [3:0] f_profile_level;
+        input [CNT_W-1:0] done_i;
+        input [CNT_W-1:0] remaining_i;
+        input [CNT_W-1:0] unit_i;
+        integer L;
+        reg [CNT_W-1:0] thresh;
+        reg [CNT_W-1:0] rem_term_limit;
+        reg [3:0] best;
+        begin
+            best = 4'd0;
+            if (unit_i == {CNT_W{1'b0}}) begin
+                f_profile_level = 4'd0;
+            end else begin
+                rem_term_limit = (remaining_i < {{(CNT_W-1){1'b0}}, 1'b1}) ?
+                    {CNT_W{1'b0}} : (remaining_i - {{(CNT_W-1){1'b0}}, 1'b1});
+                thresh = {CNT_W{1'b0}};
+                for (L = 1; L <= 15; L = L + 1) begin
+                    thresh = thresh + unit_i;
+                    if ((done_i >= thresh) && (rem_term_limit >= thresh))
+                        best = L[3:0];
+                end
+                f_profile_level = best;
+            end
+        end
+    endfunction
+
+    function automatic [CNT_W-1:0] f_ramp_unit;
+        input [CNT_W-1:0] distance_i;
+        reg [CNT_W-1:0] u;
+        begin
+            if (distance_i == {CNT_W{1'b0}})
+                f_ramp_unit = {{(CNT_W-1){1'b0}}, 1'b1};
+            else begin
+                u = (distance_i + 7'd63) >> 6;
+                f_ramp_unit = (u == {CNT_W{1'b0}}) ? {{(CNT_W-1){1'b0}}, 1'b1} : u;
+            end
+        end
+    endfunction
+
+    function automatic [CNT_W-1:0] f_abs_delta;
+        input [CNT_W-1:0] a;
+        input [CNT_W-1:0] b;
+        begin
+            f_abs_delta = (a > b) ? (a - b) : (b - a);
+        end
+    endfunction
     wire open_assert_event = open_limit && open_limit_armed;
     wire close_assert_event = close_limit && close_limit_armed;
     wire departing_close_source =
@@ -212,6 +281,11 @@ module door_axis_controller #(
             wd_stopped <= 1'b0;
             open_limit_armed <= 1'b1;
             close_limit_armed <= 1'b1;
+            profile_level <= 4'd0;
+            profile_distance <= {CNT_W{1'b0}};
+            profile_done_steps <= {CNT_W{1'b0}};
+            profile_ramp_unit <= {{(CNT_W-1){1'b0}}, 1'b1};
+            rate_quantum <= 21'd64; // level-0 scale until shared builder refreshes
         end else if (both_limits) begin
             status_state <= ST_FAULT;
             fault_code <= FC_BOTH_LIMITS;
@@ -239,6 +313,15 @@ module door_axis_controller #(
                 if (status_state == ST_CAL_SEEK_CLOSE ||
                     status_state == ST_CAL_MEASURE_OPEN) begin
                     motion_count <= motion_count + 1'b1;
+                    // Calibration soft-start: every CAL_RAMP_UNIT rises bump level.
+                    if (profile_level < 4'd15) begin
+                        if (profile_done_steps + 1'b1 >= CAL_RAMP_UNIT[CNT_W-1:0]) begin
+                            profile_done_steps <= {CNT_W{1'b0}};
+                            profile_level <= profile_level + 1'b1;
+                        end else begin
+                            profile_done_steps <= profile_done_steps + 1'b1;
+                        end
+                    end
                 end else if (calibrated_r) begin
                     if (endpoint_mode)
                         motion_count <= motion_count + 1'b1;
@@ -249,8 +332,24 @@ module door_axis_controller #(
                         if (current_position != {CNT_W{1'b0}})
                             current_position <= current_position - 1'b1;
                     end
+                    // Runtime S-curve: advance done/level only on real gated rises.
+                    if (moving && !endpoint_mode) begin
+                        begin : sc_rise
+                            reg [CNT_W-1:0] done_n;
+                            reg [CNT_W-1:0] rem_n;
+                            done_n = profile_done_steps + 1'b1;
+                            rem_n = (profile_distance > done_n) ?
+                                    (profile_distance - done_n) : {CNT_W{1'b0}};
+                            profile_done_steps <= done_n;
+                            profile_level <= f_profile_level(done_n, rem_n, profile_ramp_unit);
+                        end
+                    end else if (moving && endpoint_mode) begin
+                        profile_level <= 4'd0;
+                    end
                 end
             end
+            if (rate_quantum_valid)
+                rate_quantum <= rate_quantum_in;
 
             // ----------------------------------------------------------
             // 1b) One-shot single-limit snap (consumes assertion interval).
@@ -340,6 +439,16 @@ module door_axis_controller #(
                 setup_count <= 4'd0;
                 allow_rise <= 1'b0;
                 stop_after_budget <= 1'b0;
+                begin : sc_init_plan
+                    reg [CNT_W-1:0] dist_n;
+                    reg [CNT_W-1:0] unit_n;
+                    dist_n = f_abs_delta(planner_result, effective_current_position);
+                    unit_n = f_ramp_unit(dist_n);
+                    profile_distance <= dist_n;
+                    profile_ramp_unit <= unit_n;
+                    profile_done_steps <= {CNT_W{1'b0}};
+                    profile_level <= f_profile_level({CNT_W{1'b0}}, dist_n, unit_n);
+                end
                 if (planner_result == effective_current_position) begin
                     status_state <= ST_IDLE;
                     moving <= 1'b0;
@@ -360,7 +469,7 @@ module door_axis_controller #(
             // 5) Calibration start
             // ----------------------------------------------------------
             end else if (!cal_started) begin
-                if (limit_sync_valid) begin
+                if (limit_sync_valid && cal_enable) begin
                     cal_started <= 1'b1;
                     motion_count <= {CNT_W{1'b0}};
                     setup_count <= 4'd0;
@@ -369,6 +478,10 @@ module door_axis_controller #(
                     step <= 1'b0;
                     phase <= PH_DIR_SETUP;
                     moving <= 1'b1;
+                    profile_level <= 4'd0;
+                    profile_done_steps <= {CNT_W{1'b0}};
+                    profile_distance <= {CNT_W{1'b0}};
+                    profile_ramp_unit <= CAL_RAMP_UNIT[CNT_W-1:0];
                     if (close_limit) begin
                         dir_close <= 1'b0;
                         status_state <= ST_CAL_MEASURE_OPEN;
@@ -391,6 +504,9 @@ module door_axis_controller #(
                     dir_close <= 1'b0;
                     phase <= PH_DIR_SETUP;
                     moving <= 1'b1;
+                    // Rebuild soft-start for measure-open (no S decelerate claimed).
+                    profile_level <= 4'd0;
+                    profile_done_steps <= {CNT_W{1'b0}};
                     status_state <= ST_CAL_MEASURE_OPEN;
                 end else if (stop_after_budget && !gated_step && !step) begin
                     status_state <= ST_FAULT;
@@ -415,7 +531,7 @@ module door_axis_controller #(
                                 setup_count <= setup_count + 1'b1;
                             end
                         end
-                    end else if (tick_500us) begin
+                    end else if (step_toggle_pulse) begin
                         step <= step_toggle(step, allow_rise && !stop_after_budget &&
                                             (motion_count < MAX_STEPS_W));
                     end
@@ -499,7 +615,7 @@ module door_axis_controller #(
                                 setup_count <= setup_count + 1'b1;
                             end
                         end
-                    end else if (tick_500us) begin
+                    end else if (step_toggle_pulse) begin
                         step <= step_toggle(step, allow_rise && !stop_after_budget &&
                                             (motion_count < MAX_STEPS_W));
                     end
@@ -510,9 +626,9 @@ module door_axis_controller #(
             // ----------------------------------------------------------
             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
+                    if (step_toggle_pulse)
+                        step <= step_toggle(step, 1'b0);
+                    if (!gated_step && !step) begin
                         step <= 1'b0;
                         phase <= PH_NONE;
                         moving <= 1'b0;
@@ -532,6 +648,8 @@ module door_axis_controller #(
                         target_valid <= 1'b1;
                         need_planner <= 1'b0;
                         planner_req <= 1'b0;
+                        profile_level <= 4'd0;
+                        profile_done_steps <= {CNT_W{1'b0}};
                         if (open_limit) begin
                             current_position <= {CNT_W{1'b0}};
                             status_state <= ST_IDLE;
@@ -555,6 +673,8 @@ module door_axis_controller #(
                         target_valid <= 1'b1;
                         need_planner <= 1'b0;
                         planner_req <= 1'b0;
+                        profile_level <= 4'd0;
+                        profile_done_steps <= {CNT_W{1'b0}};
                         if (close_limit) begin
                             current_position <= travel_steps;
                             status_state <= ST_IDLE;
@@ -625,9 +745,9 @@ module door_axis_controller #(
                                 end
                             end
                         end else if (phase == PH_DRAIN_HIGH) begin
-                            if (tick_500us)
-                                step <= 1'b0;
-                        end else if (tick_500us) begin
+                            if (step_toggle_pulse)
+                                step <= step_toggle(step, 1'b0);
+                        end else if (step_toggle_pulse) begin
                             step <= step_toggle(step, allow_rise && !stop_after_budget &&
                                                 (motion_count < guard_limit));
                         end
@@ -658,8 +778,8 @@ module door_axis_controller #(
                             allow_rise <= 1'b0;
                             if (step || gated_step) begin
                                 phase <= PH_DRAIN_HIGH;
-                                if (tick_500us)
-                                    step <= 1'b0;
+                                if (step_toggle_pulse)
+                                    step <= step_toggle(step, 1'b0);
                             end else begin
                                 step <= 1'b0;
                                 phase <= PH_NONE;
@@ -677,16 +797,14 @@ module door_axis_controller #(
                                 end
                             end
                         end else if (phase == PH_DRAIN_HIGH) begin
-                            if (tick_500us)
-                                step <= 1'b0;
+                            if (step_toggle_pulse)
+                                step <= step_toggle(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 (tick_500us) begin
+                        end else if (step_toggle_pulse) begin
                             step <= step_toggle(step, allow_rise);
                         end
                     end

+ 91 - 0
src/modules/door_calibration_sequencer.v

@@ -0,0 +1,91 @@
+`timescale 1ns/1ps
+
+// Serial X→Y→Z calibration grant. Only one axis may run calibration motion.
+module door_calibration_sequencer (
+    input  wire       clk,
+    input  wire       rst_n,
+    input  wire       limit_sync_valid,
+    input  wire       term_x,
+    input  wire       term_y,
+    input  wire       term_z,
+    input  wire       cal_ok_x,
+    input  wire       cal_ok_y,
+    input  wire       cal_ok_z,
+    input  wire       profile_busy,
+    input  wire       profile_done,
+    output reg  [2:0] cal_enable,
+    output reg        profile_start,
+    output reg        profile_ready,
+    output reg        all_axes_terminal
+);
+    localparam [2:0]
+        S_WAIT_SYNC = 3'd0,
+        S_X         = 3'd1,
+        S_Y         = 3'd2,
+        S_Z         = 3'd3,
+        S_PROFILE   = 3'd4,
+        S_DONE      = 3'd5;
+
+    reg [2:0] state;
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            state <= S_WAIT_SYNC;
+            cal_enable <= 3'b000;
+            profile_start <= 1'b0;
+            profile_ready <= 1'b0;
+            all_axes_terminal <= 1'b0;
+        end else begin
+            profile_start <= 1'b0;
+            all_axes_terminal <= term_x && term_y && term_z;
+            case (state)
+                S_WAIT_SYNC: begin
+                    cal_enable <= 3'b000;
+                    if (limit_sync_valid) begin
+                        state <= S_X;
+                        cal_enable <= 3'b001;
+                    end
+                end
+                S_X: begin
+                    cal_enable <= 3'b001;
+                    if (term_x) begin
+                        state <= S_Y;
+                        cal_enable <= 3'b010;
+                    end
+                end
+                S_Y: begin
+                    cal_enable <= 3'b010;
+                    if (term_y) begin
+                        state <= S_Z;
+                        cal_enable <= 3'b100;
+                    end
+                end
+                S_Z: begin
+                    cal_enable <= 3'b100;
+                    if (term_z) begin
+                        cal_enable <= 3'b000;
+                        if (cal_ok_x || cal_ok_y || cal_ok_z) begin
+                            state <= S_PROFILE;
+                            profile_start <= 1'b1;
+                        end else begin
+                            // No successful axis: still complete so UART/FAN/PTC unlock.
+                            state <= S_DONE;
+                            profile_ready <= 1'b1;
+                        end
+                    end
+                end
+                S_PROFILE: begin
+                    cal_enable <= 3'b000;
+                    if (profile_done && !profile_busy) begin
+                        state <= S_DONE;
+                        profile_ready <= 1'b1;
+                    end
+                end
+                default: begin
+                    cal_enable <= 3'b000;
+                    profile_ready <= 1'b1;
+                end
+            endcase
+        end
+    end
+endmodule

+ 211 - 25
src/modules/door_motion_controller.v

@@ -1,13 +1,19 @@
 `timescale 1ns/1ps
 
-// Three-axis door motion: shared percent planner, startup_complete, status snapshot.
+// Three-axis door motion: Scheme A full-feature
+// - per-axis safety kernels
+// - serial X→Y→Z calibration
+// - shared 25 us DDA (A1) + shared profile threshold builder
 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
+    parameter integer STATUS_PAYLOAD_LENGTH = 31,
+    parameter integer MOTION_SERVICE_CLKS = 625,
+    parameter integer PHASE_FACTOR = 5120,
+    parameter integer CAL_RAMP_UNIT = 8
 ) (
     input  wire        clk,
     input  wire        rst_n,
@@ -28,8 +34,6 @@ module door_motion_controller #(
     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
@@ -58,6 +62,60 @@ module door_motion_controller #(
     wire        cal_x, cal_y, cal_z;
     wire        fault_x, fault_y, fault_z;
     wire        term_x, term_y, term_z;
+    wire        mov_x, mov_y, mov_z;
+    wire        allow_x, allow_y, allow_z;
+    wire        in_cal_x, in_cal_y, in_cal_z;
+    wire        crawl_x, crawl_y, crawl_z;
+    wire        dda_run_x, dda_run_y, dda_run_z;
+    wire [3:0]  lvl_x, lvl_y, lvl_z;
+    wire [20:0] rq_x, rq_y, rq_z;
+
+    wire [2:0]  cal_enable;
+    wire        profile_start;
+    wire        profile_ready;
+    wire        profile_busy;
+    wire        profile_done;
+    wire [12:0] max_travel;
+    wire [24:0] phase_threshold;
+    wire        service_ce;
+    wire [2:0]  toggle_pulse;
+    wire        dda_busy;
+    wire        dda_overrun;
+
+    // Shared rate refresh: travel * profile_scale[level] (or scale alone in cal).
+    reg         rate_busy;
+    reg         rate_valid;
+    reg [1:0]   rate_axis;
+    reg [20:0]  rate_result;
+    reg [12:0]  mul_travel;
+    reg [8:0]   mul_scale;
+    reg [20:0]  mul_acc;
+    reg [3:0]   mul_bit;
+    reg [3:0]   mul_level;
+
+    function automatic [8:0] f_profile_scale;
+        input [3:0] level;
+        begin
+            case (level)
+                4'd0:  f_profile_scale = 9'd64;
+                4'd1:  f_profile_scale = 9'd66;
+                4'd2:  f_profile_scale = 9'd73;
+                4'd3:  f_profile_scale = 9'd84;
+                4'd4:  f_profile_scale = 9'd98;
+                4'd5:  f_profile_scale = 9'd114;
+                4'd6:  f_profile_scale = 9'd132;
+                4'd7:  f_profile_scale = 9'd150;
+                4'd8:  f_profile_scale = 9'd170;
+                4'd9:  f_profile_scale = 9'd188;
+                4'd10: f_profile_scale = 9'd206;
+                4'd11: f_profile_scale = 9'd222;
+                4'd12: f_profile_scale = 9'd236;
+                4'd13: f_profile_scale = 9'd247;
+                4'd14: f_profile_scale = 9'd254;
+                default: f_profile_scale = 9'd256;
+            endcase
+        end
+    endfunction
 
     assign calibrated_mask = {cal_z, cal_y, cal_x};
     assign fault_mask = {fault_z, fault_y, fault_x};
@@ -75,8 +133,6 @@ module door_motion_controller #(
         .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;
@@ -97,12 +153,9 @@ module door_motion_controller #(
             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 (!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;
@@ -127,22 +180,132 @@ module door_motion_controller #(
         end
     end
 
+    door_motion_service_tick #(.SERVICE_CLKS(MOTION_SERVICE_CLKS)) u_svc (
+        .clk(clk), .rst_n(rst_n), .service_ce(service_ce)
+    );
+
+    door_calibration_sequencer u_cal_seq (
+        .clk(clk), .rst_n(rst_n),
+        .limit_sync_valid(limit_sync_valid),
+        .term_x(term_x), .term_y(term_y), .term_z(term_z),
+        .cal_ok_x(cal_x), .cal_ok_y(cal_y), .cal_ok_z(cal_z),
+        .profile_busy(profile_busy),
+        .profile_done(profile_done),
+        .cal_enable(cal_enable),
+        .profile_start(profile_start),
+        .profile_ready(profile_ready),
+        .all_axes_terminal()
+    );
+
+    door_profile_quantum_builder #(
+        .PHASE_FACTOR(PHASE_FACTOR)
+    ) u_profile (
+        .clk(clk), .rst_n(rst_n),
+        .start(profile_start),
+        .travel_x(st_trav_x), .travel_y(st_trav_y), .travel_z(st_trav_z),
+        .cal_ok_x(cal_x), .cal_ok_y(cal_y), .cal_ok_z(cal_z),
+        .busy(profile_busy), .done(profile_done),
+        .max_travel(max_travel),
+        .phase_threshold(phase_threshold)
+    );
+
+    wire [2:0] dda_active = {dda_run_z, dda_run_y, dda_run_x};
+    wire [2:0] dda_allow = {allow_z, allow_y, allow_x};
+    wire [2:0] dda_cal   = {in_cal_z, in_cal_y, in_cal_x};
+
+    door_shared_dda_scheduler #(
+        .CAL_PHASE_THRESHOLD(PHASE_FACTOR)
+    ) u_dda (
+        .clk(clk), .rst_n(rst_n),
+        .service_ce(service_ce),
+        .active(dda_active),
+        .allow_toggle(dda_allow),
+        .cal_mode(dda_cal),
+        .rate0(rq_x), .rate1(rq_y), .rate2(rq_z),
+        .phase_threshold(phase_threshold),
+        .toggle_pulse(toggle_pulse),
+        .busy(dda_busy),
+        .service_overrun(dda_overrun)
+    );
+
+    // Round-robin shared rate builder
+    reg [1:0] rate_axis_busy;
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            rate_busy <= 1'b0;
+            rate_valid <= 1'b0;
+            rate_axis <= 2'd0;
+            rate_axis_busy <= 2'd0;
+            rate_result <= 21'd0;
+            mul_travel <= 13'd0;
+            mul_scale <= 9'd0;
+            mul_acc <= 21'd0;
+            mul_bit <= 4'd0;
+            mul_level <= 4'd0;
+        end else begin
+            rate_valid <= 1'b0;
+            if (!rate_busy) begin
+                rate_axis_busy <= rate_axis;
+                rate_busy <= 1'b1;
+                mul_bit <= 4'd0;
+                mul_acc <= 21'd0;
+                case (rate_axis)
+                    2'd0: begin
+                        mul_level <= crawl_x ? 4'd0 : lvl_x;
+                        mul_travel <= in_cal_x ? 13'd1 : ((st_trav_x == 0) ? 13'd1 : st_trav_x);
+                        mul_scale <= f_profile_scale(crawl_x ? 4'd0 : lvl_x);
+                    end
+                    2'd1: begin
+                        mul_level <= crawl_y ? 4'd0 : lvl_y;
+                        mul_travel <= in_cal_y ? 13'd1 : ((st_trav_y == 0) ? 13'd1 : st_trav_y);
+                        mul_scale <= f_profile_scale(crawl_y ? 4'd0 : lvl_y);
+                    end
+                    default: begin
+                        mul_level <= crawl_z ? 4'd0 : lvl_z;
+                        mul_travel <= in_cal_z ? 13'd1 : ((st_trav_z == 0) ? 13'd1 : st_trav_z);
+                        mul_scale <= f_profile_scale(crawl_z ? 4'd0 : lvl_z);
+                    end
+                endcase
+                rate_axis <= (rate_axis == 2'd2) ? 2'd0 : (rate_axis + 1'b1);
+            end else if (mul_bit == 4'd9) begin
+                rate_result <= mul_acc;
+                rate_valid <= 1'b1;
+                rate_busy <= 1'b0;
+            end else begin
+                if (mul_scale[0])
+                    mul_acc <= mul_acc + {8'd0, mul_travel};
+                mul_scale <= {1'b0, mul_scale[8:1]};
+                mul_travel <= {mul_travel[11:0], 1'b0};
+                mul_bit <= mul_bit + 1'b1;
+            end
+        end
+    end
+
+    wire rate_valid_x = rate_valid && (rate_axis_busy == 2'd0);
+    wire rate_valid_y = rate_valid && (rate_axis_busy == 2'd1);
+    wire rate_valid_z = rate_valid && (rate_axis_busy == 2'd2);
+
     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)
+        .PERCENT_MAX(PERCENT_MAX),
+        .CAL_RAMP_UNIT(CAL_RAMP_UNIT)
     ) 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),
+        .cal_enable(cal_enable[0]),
         .gated_step(gated_step[0]), .gated_step_rise(gated_step_rise[0]),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(toggle_pulse[0]),
         .request_valid(motor_request_valid),
         .requested_percent_in(percent_x),
         .watchdog_stop(watchdog_stop),
+        .rate_quantum_in(rate_result),
+        .rate_quantum_valid(rate_valid_x),
         .planner_req(req_x),
         .planner_percent(pct_req_x),
         .planner_travel(trav_req_x),
@@ -155,7 +318,13 @@ module door_motion_controller #(
         .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)
+        .calibrated(cal_x), .faulted(fault_x), .terminal(term_x),
+        .axis_moving(mov_x), .axis_allow_rise(allow_x),
+        .axis_in_calibration(in_cal_x), .axis_endpoint_crawl(crawl_x),
+        .axis_dda_run(dda_run_x),
+        .profile_level(lvl_x),
+        .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum(rq_x)
     );
 
     door_axis_controller #(
@@ -164,16 +333,21 @@ module door_motion_controller #(
         .MIN_TRAVEL(MIN_TRAVEL),
         .ENDPOINT_GUARD_EXTRA(ENDPOINT_GUARD_EXTRA),
         .DIR_SETUP_TICKS(DIR_SETUP_TICKS),
-        .PERCENT_MAX(PERCENT_MAX)
+        .PERCENT_MAX(PERCENT_MAX),
+        .CAL_RAMP_UNIT(CAL_RAMP_UNIT)
     ) 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),
+        .cal_enable(cal_enable[1]),
         .gated_step(gated_step[1]), .gated_step_rise(gated_step_rise[1]),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(toggle_pulse[1]),
         .request_valid(motor_request_valid),
         .requested_percent_in(percent_y),
         .watchdog_stop(watchdog_stop),
+        .rate_quantum_in(rate_result),
+        .rate_quantum_valid(rate_valid_y),
         .planner_req(req_y),
         .planner_percent(pct_req_y),
         .planner_travel(trav_req_y),
@@ -186,7 +360,13 @@ module door_motion_controller #(
         .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)
+        .calibrated(cal_y), .faulted(fault_y), .terminal(term_y),
+        .axis_moving(mov_y), .axis_allow_rise(allow_y),
+        .axis_in_calibration(in_cal_y), .axis_endpoint_crawl(crawl_y),
+        .axis_dda_run(dda_run_y),
+        .profile_level(lvl_y),
+        .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum(rq_y)
     );
 
     door_axis_controller #(
@@ -195,16 +375,21 @@ module door_motion_controller #(
         .MIN_TRAVEL(MIN_TRAVEL),
         .ENDPOINT_GUARD_EXTRA(ENDPOINT_GUARD_EXTRA),
         .DIR_SETUP_TICKS(DIR_SETUP_TICKS),
-        .PERCENT_MAX(PERCENT_MAX)
+        .PERCENT_MAX(PERCENT_MAX),
+        .CAL_RAMP_UNIT(CAL_RAMP_UNIT)
     ) 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),
+        .cal_enable(cal_enable[2]),
         .gated_step(gated_step[2]), .gated_step_rise(gated_step_rise[2]),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(toggle_pulse[2]),
         .request_valid(motor_request_valid),
         .requested_percent_in(percent_z),
         .watchdog_stop(watchdog_stop),
+        .rate_quantum_in(rate_result),
+        .rate_quantum_valid(rate_valid_z),
         .planner_req(req_z),
         .planner_percent(pct_req_z),
         .planner_travel(trav_req_z),
@@ -217,22 +402,25 @@ module door_motion_controller #(
         .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)
+        .calibrated(cal_z), .faulted(fault_z), .terminal(term_z),
+        .axis_moving(mov_z), .axis_allow_rise(allow_z),
+        .axis_in_calibration(in_cal_z), .axis_endpoint_crawl(crawl_z),
+        .axis_dda_run(dda_run_z),
+        .profile_level(lvl_z),
+        .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum(rq_z)
     );
 
-    // Sticky startup_complete when all axes terminal
+    // startup_complete only after serial cal terminal + profile ready
     always @(posedge clk or negedge rst_n) begin
         if (!rst_n)
             startup_complete <= 1'b0;
-        else if (!startup_complete && term_x && term_y && term_z)
+        else if (!startup_complete && profile_ready && term_x && term_y && term_z)
             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;
 
@@ -241,9 +429,7 @@ module door_motion_controller #(
             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;

+ 28 - 0
src/modules/door_motion_service_tick.v

@@ -0,0 +1,28 @@
+`timescale 1ns/1ps
+
+// Motion service clock-enable: default 25 us @ 25 MHz => 625 clocks.
+module door_motion_service_tick #(
+    parameter integer SERVICE_CLKS = 625
+) (
+    input  wire clk,
+    input  wire rst_n,
+    output reg  service_ce
+);
+    localparam integer CNT_W = 16;
+    reg [CNT_W-1:0] cnt;
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            cnt <= {CNT_W{1'b0}};
+            service_ce <= 1'b0;
+        end else begin
+            if (cnt + 1'b1 >= SERVICE_CLKS[CNT_W-1:0]) begin
+                cnt <= {CNT_W{1'b0}};
+                service_ce <= 1'b1;
+            end else begin
+                cnt <= cnt + 1'b1;
+                service_ce <= 1'b0;
+            end
+        end
+    end
+endmodule

+ 81 - 0
src/modules/door_profile_quantum_builder.v

@@ -0,0 +1,81 @@
+`timescale 1ns/1ps
+
+// Shared max_travel * PHASE_FACTOR builder (shift-add). 25-bit threshold.
+module door_profile_quantum_builder #(
+    parameter integer TRAVEL_WIDTH = 13,
+    parameter integer PHASE_FACTOR = 5120,
+    parameter integer THRESH_WIDTH = 25
+) (
+    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 [TRAVEL_WIDTH-1:0]       max_travel,
+    output reg [THRESH_WIDTH-1:0]       phase_threshold
+);
+    reg [TRAVEL_WIDTH-1:0] mul_a;
+    reg [THRESH_WIDTH-1:0] mul_b;
+    reg [THRESH_WIDTH-1: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;
+            max_travel <= {TRAVEL_WIDTH{1'b0}};
+            phase_threshold <= {THRESH_WIDTH{1'b0}};
+            mul_a <= {TRAVEL_WIDTH{1'b0}};
+            mul_b <= {THRESH_WIDTH{1'b0}};
+            mul_acc <= {THRESH_WIDTH{1'b0}};
+            mul_bit <= 4'd0;
+        end else begin
+            done <= 1'b0;
+            if (start && !busy) begin
+                busy <= 1'b1;
+                max_travel <= 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_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 <= PHASE_FACTOR[THRESH_WIDTH-1:0];
+                mul_acc <= {THRESH_WIDTH{1'b0}};
+                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[THRESH_WIDTH-2:0], 1'b0};
+                    mul_bit <= mul_bit + 1'b1;
+                end
+            end
+        end
+    end
+endmodule

+ 95 - 0
src/modules/door_shared_dda_scheduler.v

@@ -0,0 +1,95 @@
+`timescale 1ns/1ps
+
+// Scheme A2 winner (provisional hierarchy): three parallel narrow DDA datapaths.
+// A1 sequential shared add/compare/sub archived under receipts/scheme-a-a2-attempt/.
+// On each motion_service_ce, all active axes update in one clock.
+module door_shared_dda_scheduler #(
+    parameter integer TRAVEL_WIDTH = 13,
+    parameter integer PHASE_WIDTH  = 26,
+    parameter integer RATE_WIDTH   = 21,
+    parameter integer THRESH_WIDTH = 25,
+    parameter integer CAL_PHASE_THRESHOLD = 5120
+) (
+    input  wire                         clk,
+    input  wire                         rst_n,
+    input  wire                         service_ce,
+    input  wire [2:0]                   active,
+    input  wire [2:0]                   allow_toggle,
+    input  wire [2:0]                   cal_mode,
+    input  wire [RATE_WIDTH-1:0]        rate0,
+    input  wire [RATE_WIDTH-1:0]        rate1,
+    input  wire [RATE_WIDTH-1:0]        rate2,
+    input  wire [THRESH_WIDTH-1:0]      phase_threshold,
+    output reg  [2:0]                   toggle_pulse,
+    output reg                          busy,
+    output wire                         service_overrun
+);
+    // allow_toggle reserved for axis rise gating (DDA always wraps when active).
+
+    reg [PHASE_WIDTH-1:0] phase0, phase1, phase2;
+    reg overrun_r;
+    assign service_overrun = overrun_r;
+
+    wire [PHASE_WIDTH-1:0] thr_run =
+        {{(PHASE_WIDTH-THRESH_WIDTH){1'b0}}, phase_threshold};
+    wire [PHASE_WIDTH-1:0] thr_cal = CAL_PHASE_THRESHOLD[PHASE_WIDTH-1:0];
+
+    function automatic [PHASE_WIDTH-1:0] f_next;
+        input [PHASE_WIDTH-1:0] ph;
+        input [RATE_WIDTH-1:0]  rate;
+        input [PHASE_WIDTH-1:0] thr;
+        input                   en;
+        reg   [PHASE_WIDTH-1:0] sum;
+        begin
+            if (!en) begin
+                f_next = {PHASE_WIDTH{1'b0}};
+            end else begin
+                sum = ph + {{(PHASE_WIDTH-RATE_WIDTH){1'b0}}, rate};
+                if (sum >= thr)
+                    f_next = sum - thr;
+                else
+                    f_next = sum;
+            end
+        end
+    endfunction
+
+    function automatic f_fire;
+        input [PHASE_WIDTH-1:0] ph;
+        input [RATE_WIDTH-1:0]  rate;
+        input [PHASE_WIDTH-1:0] thr;
+        input                   en;
+        reg   [PHASE_WIDTH-1:0] sum;
+        begin
+            sum = ph + {{(PHASE_WIDTH-RATE_WIDTH){1'b0}}, rate};
+            f_fire = en && (sum >= thr);
+        end
+    endfunction
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            phase0 <= {PHASE_WIDTH{1'b0}};
+            phase1 <= {PHASE_WIDTH{1'b0}};
+            phase2 <= {PHASE_WIDTH{1'b0}};
+            toggle_pulse <= 3'b000;
+            busy <= 1'b0;
+            overrun_r <= 1'b0;
+        end else begin
+            toggle_pulse <= 3'b000;
+            busy <= 1'b0;
+            if (service_ce) begin
+                begin : par
+                    reg [PHASE_WIDTH-1:0] t0, t1, t2;
+                    t0 = cal_mode[0] ? thr_cal : thr_run;
+                    t1 = cal_mode[1] ? thr_cal : thr_run;
+                    t2 = cal_mode[2] ? thr_cal : thr_run;
+                    toggle_pulse[0] <= f_fire(phase0, rate0, t0, active[0]);
+                    toggle_pulse[1] <= f_fire(phase1, rate1, t1, active[1]);
+                    toggle_pulse[2] <= f_fire(phase2, rate2, t2, active[2]);
+                    phase0 <= f_next(phase0, rate0, t0, active[0]);
+                    phase1 <= f_next(phase1, rate1, t1, active[1]);
+                    phase2 <= f_next(phase2, rate2, t2, active[2]);
+                end
+            end
+        end
+    end
+endmodule

+ 9 - 1
tests/formal/door_axis_cal_formal.v

@@ -56,8 +56,12 @@ module door_axis_cal_formal (
         .clk(clk), .rst_n(dut_rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(1'b0),
         .requested_percent_in(8'd0),
         .watchdog_stop(1'b0),
@@ -73,7 +77,11 @@ module door_axis_cal_formal (
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     initial begin

+ 9 - 1
tests/formal/door_axis_motion_contract_formal.v

@@ -53,8 +53,12 @@ module door_axis_motion_contract_formal (
         .clk(clk), .rst_n(dut_rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(watchdog_stop),
@@ -70,7 +74,11 @@ module door_axis_motion_contract_formal (
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     initial begin

+ 9 - 1
tests/formal/door_axis_request_limit_race_formal.v

@@ -72,8 +72,12 @@ module door_axis_request_limit_race_formal (
         .clk(clk), .rst_n(dut_rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(1'b0),
@@ -89,7 +93,11 @@ module door_axis_request_limit_race_formal (
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     initial begin

+ 9 - 1
tests/formal/door_axis_request_planner_collision_formal.v

@@ -60,8 +60,12 @@ module door_axis_request_planner_collision_formal (
         .clk(clk), .rst_n(rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(1'b0),
@@ -77,7 +81,11 @@ module door_axis_request_planner_collision_formal (
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     initial begin

+ 9 - 1
tests/formal/door_axis_source_limit_lingering_formal.v

@@ -62,8 +62,12 @@ module door_axis_source_limit_lingering_formal (
         .clk(clk), .rst_n(dut_rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(1'b0),
@@ -79,7 +83,11 @@ module door_axis_source_limit_lingering_formal (
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     initial begin

+ 9 - 1
tests/formal/door_axis_watchdog_drain_formal.v

@@ -58,8 +58,12 @@ module door_axis_watchdog_drain_formal (
         .clk(clk), .rst_n(dut_rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(1'b1),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(watchdog_stop),
@@ -75,7 +79,11 @@ module door_axis_watchdog_drain_formal (
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     initial begin

+ 9 - 1
tests/formal/door_axis_watchdog_formal.v

@@ -52,9 +52,13 @@ module door_axis_watchdog_formal (
         .open_limit(open_limit),
         .close_limit(close_limit),
         .limit_sync_valid(1'b1),
+        .cal_enable(1'b1),
         .gated_step(gated_step),
         .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(watchdog_stop),
@@ -77,7 +81,11 @@ module door_axis_watchdog_formal (
         .status_fault_code(status_fault_code),
         .calibrated(calibrated),
         .faulted(faulted),
-        .terminal(terminal)
+        .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     initial begin

+ 25 - 0
tests/formal/door_mse_serial_dda.sby

@@ -0,0 +1,25 @@
+[tasks]
+bmc
+cover
+
+[options]
+bmc: mode bmc
+bmc: depth 30
+cover: mode cover
+cover: depth 30
+
+[engines]
+smtbmc z3
+
+[script]
+read_verilog -formal door_shared_dda_scheduler.v
+read_verilog -formal door_calibration_sequencer.v
+read_verilog -formal -DFORMAL door_mse_serial_dda_formal.v
+proc
+setundef -zero
+prep -top door_mse_serial_dda_formal
+
+[files]
+../../src/modules/door_shared_dda_scheduler.v
+../../src/modules/door_calibration_sequencer.v
+door_mse_serial_dda_formal.v

+ 92 - 0
tests/formal/door_mse_serial_dda_formal.v

@@ -0,0 +1,92 @@
+`timescale 1ns/1ps
+
+// Bounded BMC/cover for MSE serial cal exclusion + DDA service completion.
+// Honest bounded check — not an unbounded proof.
+module door_mse_serial_dda_formal (
+    input wire clk,
+    input wire rst_n,
+    input wire service_ce,
+    input wire [2:0] active,
+    input wire [2:0] allow_toggle,
+    input wire [2:0] cal_mode,
+    input wire [20:0] rate0,
+    input wire [20:0] rate1,
+    input wire [20:0] rate2,
+    input wire [24:0] phase_threshold,
+    input wire limit_sync_valid,
+    input wire term_x,
+    input wire term_y,
+    input wire term_z,
+    input wire cal_ok_x,
+    input wire cal_ok_y,
+    input wire cal_ok_z,
+    input wire profile_busy,
+    input wire profile_done
+);
+    wire [2:0] toggle_pulse;
+    wire dda_busy;
+    wire service_overrun;
+    wire [2:0] cal_enable;
+    wire profile_start;
+    wire profile_ready;
+    wire all_axes_terminal;
+
+    door_shared_dda_scheduler #(.CAL_PHASE_THRESHOLD(64)) u_dda (
+        .clk(clk), .rst_n(rst_n),
+        .service_ce(service_ce),
+        .active(active),
+        .allow_toggle(allow_toggle),
+        .cal_mode(cal_mode),
+        .rate0(rate0), .rate1(rate1), .rate2(rate2),
+        .phase_threshold(phase_threshold),
+        .toggle_pulse(toggle_pulse),
+        .busy(dda_busy),
+        .service_overrun(service_overrun)
+    );
+
+    door_calibration_sequencer u_seq (
+        .clk(clk), .rst_n(rst_n),
+        .limit_sync_valid(limit_sync_valid),
+        .term_x(term_x), .term_y(term_y), .term_z(term_z),
+        .cal_ok_x(cal_ok_x), .cal_ok_y(cal_ok_y), .cal_ok_z(cal_ok_z),
+        .profile_busy(profile_busy), .profile_done(profile_done),
+        .cal_enable(cal_enable),
+        .profile_start(profile_start),
+        .profile_ready(profile_ready),
+        .all_axes_terminal(all_axes_terminal)
+    );
+
+    reg [1:0] reset_cycles;
+    initial reset_cycles = 2'd0;
+
+    always @(posedge clk) begin
+        assume (rst_n == 1'b0 || rst_n == 1'b1);
+        assume (service_ce == 1'b0 || service_ce == 1'b1);
+        assume (limit_sync_valid == 1'b0 || limit_sync_valid == 1'b1);
+        assume (rate0 <= 21'd256);
+        assume (rate1 <= 21'd256);
+        assume (rate2 <= 21'd256);
+        assume (phase_threshold >= 25'd8);
+        assume (phase_threshold <= 25'd1024);
+        // Contract: next service must not arrive while previous incomplete.
+        assume (!(service_ce && dda_busy));
+
+        if ($initstate || reset_cycles < 2) begin
+            assume (!rst_n);
+            reset_cycles <= reset_cycles + 1'b1;
+        end else begin
+            assume (rst_n);
+        end
+
+        if (rst_n) begin
+            assert ((cal_enable[0] + cal_enable[1] + cal_enable[2]) <= 1);
+            assert (!service_overrun);
+            cover (cal_enable == 3'b001);
+            cover (cal_enable == 3'b010);
+            cover (cal_enable == 3'b100);
+            cover (profile_ready);
+            cover (toggle_pulse[0]);
+            cover (term_x && cal_enable[1]);
+        end
+    end
+endmodule

+ 125 - 0
tests/sim/door_axis_independence_tb.v

@@ -0,0 +1,125 @@
+`timescale 1ns/1ps
+
+// axis_independence_tb: X both-limits fault must not stall Y/Z motion.
+module door_axis_independence_tb;
+    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;
+
+    always #1 clk = ~clk;
+
+    door_motion_controller #(
+        .MAX_CAL_STEPS(16), .MIN_TRAVEL(2), .ENDPOINT_GUARD_EXTRA(4),
+        .DIR_SETUP_TICKS(1), .PERCENT_MAX(100),
+        .MOTION_SERVICE_CLKS(4), .PHASE_FACTOR(64), .CAL_RAMP_UNIT(2)
+    ) 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 automatic pulse_tick;
+        begin @(negedge clk); tick_500us = 1'b1; @(negedge clk); tick_500us = 1'b0; end
+    endtask
+    task automatic force_rise;
+        input integer ax; reg [2:0] m;
+        begin
+            m = 3'b001 << ax;
+            @(negedge clk); gated_step = gated_step | m; gated_step_rise = m;
+            @(negedge clk); gated_step_rise = 3'b0; gated_step = gated_step & ~m;
+        end
+    endtask
+    task automatic wait_step;
+        input integer ax; input want; integer t;
+        begin
+            for (t = 0; t < 8000; t = t + 1) begin
+                if (step[ax] === want) return;
+                @(negedge clk);
+            end
+            $fatal(1, "timeout step[%0d]", ax);
+        end
+    endtask
+    task automatic cal_ok;
+        input integer ax; input integer travel; integer r; integer t;
+        begin
+            close_limit[ax] = 1'b1; open_limit[ax] = 1'b0;
+            repeat (4) pulse_tick();
+            for (r = 0; r < travel; r = r + 1) begin
+                wait_step(ax, 1); force_rise(ax); wait_step(ax, 0);
+            end
+            @(negedge clk); open_limit[ax] = 1'b1; close_limit[ax] = 1'b0;
+            for (t = 0; t < 5000; t = t + 1) begin
+                if (calibrated_mask[ax]) return;
+                @(negedge clk);
+            end
+            $fatal(1, "cal %0d", ax);
+        end
+    endtask
+
+    initial begin
+        #12_000_000 $fatal(1, "timeout");
+    end
+
+    initial begin
+        integer t, rises_y, rises_z, started;
+        repeat (2) @(posedge clk); rst_n = 1'b1;
+        @(negedge clk); limit_sync_valid = 1'b1;
+        cal_ok(0, 3); cal_ok(1, 4); cal_ok(2, 5);
+        for (t = 0; t < 5000 && !startup_complete; t = t + 1) @(negedge clk);
+        if (!startup_complete) $fatal(1, "no startup");
+
+        open_limit = 3'b0; close_limit = 3'b0;
+        @(negedge clk);
+        percent_x = 8'd50; percent_y = 8'd80; percent_z = 8'd80;
+        motor_request_valid = 1'b1; @(negedge clk); motor_request_valid = 1'b0;
+
+        started = 0;
+        for (t = 0; t < 8000; t = t + 1) begin
+            pulse_tick();
+            if (step[1]) force_rise(1);
+            if (step[2]) force_rise(2);
+            if (dut.mov_y && dut.mov_z) begin
+                started = 1;
+                @(negedge clk);
+                open_limit[0] = 1'b1;
+                close_limit[0] = 1'b1;
+                t = 8000;
+            end
+            @(negedge clk);
+        end
+        if (!started) $fatal(1, "Y/Z never both moving");
+        for (t = 0; t < 2000 && !fault_mask[0]; t = t + 1) @(negedge clk);
+        if (!fault_mask[0]) $fatal(1, "X not faulted");
+
+        rises_y = 0; rises_z = 0;
+        for (t = 0; t < 30000; t = t + 1) begin
+            pulse_tick();
+            if (step[1]) begin force_rise(1); rises_y = rises_y + 1; end
+            if (step[2]) begin force_rise(2); rises_z = rises_z + 1; end
+            if (rises_y >= 2 && rises_z >= 2) begin
+                $display("door_axis_independence_tb PASS y=%0d z=%0d", rises_y, rises_z);
+                $finish;
+            end
+            @(negedge clk);
+        end
+        $fatal(1, "Y/Z stalled y=%0d z=%0d", rises_y, rises_z);
+    end
+endmodule

+ 18 - 2
tests/sim/door_axis_request_limit_race_tb.v

@@ -84,8 +84,12 @@ module door_axis_request_limit_race_tb;
         .clk(clk), .rst_n(rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(limit_sync_valid),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(watchdog_stop),
@@ -101,7 +105,11 @@ module door_axis_request_limit_race_tb;
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     door_axis_controller #(
@@ -115,8 +123,12 @@ module door_axis_request_limit_race_tb;
         .clk(clk), .rst_n(rst_n),
         .open_limit(open_limit_b), .close_limit(close_limit_b),
         .limit_sync_valid(limit_sync_valid),
+        .cal_enable(1'b1),
         .gated_step(gated_step_b), .gated_step_rise(gated_step_rise_b),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid_b),
         .requested_percent_in(requested_percent_in_b),
         .watchdog_stop(1'b0),
@@ -132,7 +144,11 @@ module door_axis_request_limit_race_tb;
         .status_requested_percent(status_requested_percent_b),
         .status_current(status_current_b), .status_target(status_target_b),
         .status_travel(status_travel_b), .status_fault_code(status_fault_code_b),
-        .calibrated(calibrated_b), .faulted(faulted_b), .terminal(terminal_b)
+        .calibrated(calibrated_b), .faulted(faulted_b), .terminal(terminal_b),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     // Half-up mid percent → steps (matches door_percent_planner contract).

+ 18 - 2
tests/sim/door_axis_request_planner_collision_tb.v

@@ -82,8 +82,12 @@ module door_axis_request_planner_collision_tb;
         .clk(clk), .rst_n(rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(limit_sync_valid),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(watchdog_stop),
@@ -99,7 +103,11 @@ module door_axis_request_planner_collision_tb;
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     door_axis_controller #(
@@ -109,8 +117,12 @@ module door_axis_request_planner_collision_tb;
         .clk(clk), .rst_n(rst_n),
         .open_limit(open_limit_y), .close_limit(close_limit_y),
         .limit_sync_valid(limit_sync_valid),
+        .cal_enable(1'b1),
         .gated_step(gated_step_y), .gated_step_rise(gated_step_rise_y),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid_y),
         .requested_percent_in(requested_percent_in_y),
         .watchdog_stop(1'b0),
@@ -126,7 +138,11 @@ module door_axis_request_planner_collision_tb;
         .status_requested_percent(status_requested_percent_y),
         .status_current(status_current_y), .status_target(status_target_y),
         .status_travel(status_travel_y), .status_fault_code(status_fault_code_y),
-        .calibrated(calibrated_y), .faulted(faulted_y), .terminal(terminal_y)
+        .calibrated(calibrated_y), .faulted(faulted_y), .terminal(terminal_y),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     function automatic [12:0] pct_to_steps;

+ 4 - 0
tests/sim/door_axis_source_limit_linger_tb.v

@@ -54,8 +54,12 @@ module door_axis_source_limit_linger_tb;
         .clk(clk), .rst_n(rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(limit_sync_valid),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(watchdog_stop),

+ 9 - 1
tests/sim/door_axis_target_valid_tb.v

@@ -43,8 +43,12 @@ module door_axis_target_valid_tb;
         .clk(clk), .rst_n(rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(limit_sync_valid),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(watchdog_stop),
@@ -60,7 +64,11 @@ module door_axis_target_valid_tb;
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     always @(posedge clk) begin

+ 9 - 1
tests/sim/door_axis_watchdog_drain_tb.v

@@ -52,8 +52,12 @@ module door_axis_watchdog_drain_tb;
         .clk(clk), .rst_n(rst_n),
         .open_limit(open_limit), .close_limit(close_limit),
         .limit_sync_valid(limit_sync_valid),
+        .cal_enable(1'b1),
         .gated_step(gated_step), .gated_step_rise(gated_step_rise),
         .tick_500us(tick_500us),
+        .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd0),
+        .rate_quantum_valid(1'b0),
         .request_valid(request_valid),
         .requested_percent_in(requested_percent_in),
         .watchdog_stop(watchdog_stop),
@@ -69,7 +73,11 @@ module door_axis_watchdog_drain_tb;
         .status_requested_percent(status_requested_percent),
         .status_current(status_current), .status_target(status_target),
         .status_travel(status_travel), .status_fault_code(status_fault_code),
-        .calibrated(calibrated), .faulted(faulted), .terminal(terminal)
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(), .axis_endpoint_crawl(),
+        .axis_dda_run(),
+        .profile_level(), .profile_distance(), .profile_done_steps(), .profile_ramp_unit(),
+        .rate_quantum()
     );
 
     always @(posedge clk) begin

+ 138 - 0
tests/sim/door_limit_profile_collision_tb.v

@@ -0,0 +1,138 @@
+`timescale 1ns/1ps
+
+// limit_profile_collision_tb: target limit truncate + gate hold; profile does not advance on blocked rise.
+module door_limit_profile_collision_tb;
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg tick_500us = 1'b0;
+    reg limit_sync_valid = 1'b0;
+    reg open_limit = 1'b0, close_limit = 1'b1;
+    reg request_valid = 1'b0;
+    reg [7:0] requested_percent_in = 8'd0;
+    reg planner_done = 1'b0;
+    reg [1:0] planner_done_axis = 2'd0;
+    reg [7:0] planner_done_percent = 8'd0;
+    reg [12:0] planner_result = 13'd0;
+    wire planner_req;
+    wire [7:0] planner_percent;
+    wire [12:0] planner_travel;
+    wire engine_step, dir_close;
+    wire gated_step;
+    reg gated_step_d;
+    wire gated_step_rise = gated_step & ~gated_step_d;
+    wire [2:0] status_state;
+    wire [7:0] status_flags, status_requested_percent, status_fault_code;
+    wire [12:0] status_current, status_target, status_travel;
+    wire calibrated, faulted, terminal;
+    wire [3:0] profile_level;
+    wire [12:0] profile_done_steps;
+    reg [12:0] done_snap;
+
+    always #1 clk = ~clk;
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) gated_step_d <= 1'b0;
+        else gated_step_d <= gated_step;
+    end
+
+    door_axis_controller #(
+        .AXIS_ID(0), .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),
+        .open_limit(open_limit), .close_limit(close_limit),
+        .limit_sync_valid(limit_sync_valid), .cal_enable(1'b1),
+        .gated_step(gated_step), .gated_step_rise(gated_step_rise),
+        .tick_500us(tick_500us), .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd64), .rate_quantum_valid(1'b1),
+        .request_valid(request_valid), .requested_percent_in(requested_percent_in),
+        .watchdog_stop(1'b0),
+        .planner_req(planner_req), .planner_percent(planner_percent),
+        .planner_travel(planner_travel),
+        .planner_done(planner_done), .planner_done_axis(planner_done_axis),
+        .planner_done_percent(planner_done_percent), .planner_result(planner_result),
+        .step(engine_step), .dir_close(dir_close),
+        .status_state(status_state), .status_flags(status_flags),
+        .status_requested_percent(status_requested_percent),
+        .status_current(status_current), .status_target(status_target),
+        .status_travel(status_travel), .status_fault_code(status_fault_code),
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(),
+        .axis_endpoint_crawl(), .axis_dda_run(),
+        .profile_level(profile_level), .profile_distance(),
+        .profile_done_steps(profile_done_steps), .profile_ramp_unit(),
+        .rate_quantum()
+    );
+
+    prod2u_runtime_step_limit_gate #(.AXIS_COUNT(1)) u_gate (
+        .clk(clk), .rst_n(rst_n),
+        .engine_step(engine_step), .engine_dir(dir_close),
+        .close_limit(close_limit), .open_limit(open_limit),
+        .selected_limit(), .gated_step(gated_step)
+    );
+
+    task pulse_tick;
+        begin @(negedge clk); tick_500us = 1'b1; @(negedge clk); tick_500us = 1'b0; end
+    endtask
+
+    always @(posedge clk) begin
+        planner_done <= 1'b0;
+        if (planner_req) begin
+            planner_done <= 1'b1;
+            planner_done_axis <= 2'd0;
+            planner_done_percent <= planner_percent;
+            planner_result <= ((planner_travel * planner_percent) + 13'd50) / 13'd100;
+            if (planner_result < 13'd1) planner_result <= 13'd1;
+            if (planner_result > planner_travel - 13'd1)
+                planner_result <= planner_travel - 13'd1;
+        end
+    end
+
+    initial begin
+        #5_000_000 $fatal(1, "timeout");
+    end
+
+    initial begin
+        integer r, t;
+        repeat (2) @(posedge clk); rst_n = 1'b1;
+        @(negedge clk); limit_sync_valid = 1'b1;
+        repeat (4) pulse_tick();
+        // cal measure with gate path
+        for (r = 0; r < 16; r = r + 1) begin
+            for (t = 0; t < 40 && !engine_step; t = t + 1) pulse_tick();
+            for (t = 0; t < 8 && !gated_step; t = t + 1) @(negedge clk);
+            for (t = 0; t < 40 && engine_step; t = t + 1) pulse_tick();
+        end
+        @(negedge clk); open_limit = 1'b1; close_limit = 1'b0;
+        for (t = 0; t < 500 && !calibrated; t = t + 1) pulse_tick();
+        if (!calibrated) $fatal(1, "cal fail");
+        open_limit = 1'b0;
+
+        @(negedge clk); requested_percent_in = 8'd70; request_valid = 1'b1;
+        @(negedge clk); request_valid = 1'b0;
+        repeat (6) pulse_tick();
+        // Take a couple real gated rises
+        for (r = 0; r < 3; r = r + 1) begin
+            for (t = 0; t < 40 && !engine_step; t = t + 1) pulse_tick();
+            for (t = 0; t < 8 && !gated_step; t = t + 1) @(negedge clk);
+            for (t = 0; t < 40 && engine_step; t = t + 1) pulse_tick();
+        end
+        done_snap = profile_done_steps;
+
+        // Assert close limit while moving close → gate truncates; no gated rise → done frozen
+        @(negedge clk); close_limit = 1'b1;
+        for (t = 0; t < 40 && !engine_step; t = t + 1) pulse_tick();
+        // Engine may be high but gated must stay low while selected close limit
+        for (t = 0; t < 20; t = t + 1) begin
+            if (gated_step) $fatal(1, "gated high under target limit");
+            @(negedge clk);
+        end
+        if (profile_done_steps !== done_snap)
+            $fatal(1, "profile advanced without gated rise %0d->%0d", done_snap, profile_done_steps);
+
+        // Release limit only after engine low (gate-hold semantics)
+        for (t = 0; t < 80 && engine_step; t = t + 1) pulse_tick();
+        @(negedge clk); close_limit = 1'b0;
+        $display("door_limit_profile_collision_tb PASS done=%0d", done_snap);
+        $finish;
+    end
+endmodule

+ 82 - 29
tests/sim/door_motion_controller_tb.v

@@ -1,7 +1,7 @@
 `timescale 1ns/1ps
 
-// Smoke: three axes already on close limit → measure-open with forced rises →
-// startup_complete; then mid-percent request on X uses planner.
+// Smoke: serial X→Y→Z calibration + profile ready → startup_complete;
+// then mid-percent request on X uses planner. Uses fast motion_service for sim.
 module door_motion_controller_tb;
     reg clk = 1'b0;
     reg rst_n = 1'b0;
@@ -32,7 +32,10 @@ module door_motion_controller_tb;
         .MIN_TRAVEL(2),
         .ENDPOINT_GUARD_EXTRA(8),
         .DIR_SETUP_TICKS(1),
-        .PERCENT_MAX(100)
+        .PERCENT_MAX(100),
+        .MOTION_SERVICE_CLKS(4),
+        .PHASE_FACTOR(64),
+        .CAL_RAMP_UNIT(2)
     ) dut (
         .clk(clk), .rst_n(rst_n),
         .tick_500us(tick_500us),
@@ -56,21 +59,80 @@ module door_motion_controller_tb;
         end
     endtask
 
-    task force_rise;
-        input [2:0] mask;
+    task pump_service;
+        input integer n;
+        integer k;
         begin
+            for (k = 0; k < n; k = k + 1)
+                @(negedge clk);
+        end
+    endtask
+
+    task force_rise_axis;
+        input integer ax;
+        reg [2:0] mask;
+        begin
+            mask = 3'b001 << ax;
             @(negedge clk);
-            gated_step = mask;
+            gated_step = gated_step | mask;
             gated_step_rise = mask;
             @(negedge clk);
             gated_step_rise = 3'b000;
-            gated_step = 3'b000;
+            gated_step = gated_step & ~mask;
+        end
+    endtask
+
+    task calibrate_axis;
+        input integer ax;
+        integer r;
+        begin
+            // DIR setup via 500us ticks
+            repeat (4) pulse_tick();
+            // Produce >=2 measure-open rises (already on close → measure-open)
+            for (r = 0; r < 3; r = r + 1) begin
+                // Wait until STEP high for this axis (DDA toggles)
+                begin : wait_hi
+                    integer t;
+                    for (t = 0; t < 4000; t = t + 1) begin
+                        if (step[ax]) disable wait_hi;
+                        @(negedge clk);
+                    end
+                    $fatal(1, "timeout waiting step high axis=%0d", ax);
+                end
+                force_rise_axis(ax);
+                // Wait STEP low then continue
+                begin : wait_lo
+                    integer t;
+                    for (t = 0; t < 4000; t = t + 1) begin
+                        if (!step[ax]) disable wait_lo;
+                        @(negedge clk);
+                    end
+                end
+            end
+            // Hit open on a rise
+            begin : wait_hi2
+                integer t;
+                for (t = 0; t < 4000; t = t + 1) begin
+                    if (step[ax]) disable wait_hi2;
+                    @(negedge clk);
+                end
+                $fatal(1, "timeout waiting final step high axis=%0d", ax);
+            end
+            @(negedge clk);
+            open_limit[ax] = 1'b1;
+            close_limit[ax] = 1'b0;
+            gated_step[ax] = 1'b1;
+            gated_step_rise[ax] = 1'b1;
+            @(negedge clk);
+            gated_step[ax] = 1'b0;
+            gated_step_rise[ax] = 1'b0;
+            repeat (8) @(negedge clk);
         end
     endtask
 
     integer i;
     initial begin
-        #500000 $fatal(1, "door_motion_controller_tb timeout");
+        #5_000_000 $fatal(1, "door_motion_controller_tb timeout");
     end
 
     initial begin
@@ -78,30 +140,21 @@ module door_motion_controller_tb;
         rst_n = 1'b1;
         @(negedge clk);
         limit_sync_valid = 1'b1;
-        // Already on close → jump to measure-open; need DIR setup then rises.
-        repeat (4) pulse_tick();
-        // Measure-open: 4 rises then hit open_limit same cycle as 4th rise.
-        for (i = 0; i < 3; i = i + 1) begin
-            force_rise(3'b111);
-            pulse_tick();
-        end
-        @(negedge clk);
-        open_limit = 3'b111;
-        close_limit = 3'b000;
-        gated_step = 3'b111;
-        gated_step_rise = 3'b111;
-        @(negedge clk);
-        gated_step = 3'b000;
-        gated_step_rise = 3'b000;
-        repeat (8) @(negedge clk);
+
+        // Serial X → Y → Z
+        calibrate_axis(0);
+        calibrate_axis(1);
+        calibrate_axis(2);
+
+        // Allow profile builder to finish
+        pump_service(64);
         if (!startup_complete)
-            $fatal(1, "startup_complete not set after measure-open");
+            $fatal(1, "startup_complete not set after serial cal+profile");
         if (calibrated_mask !== 3'b111)
             $fatal(1, "calibrated_mask=%b", calibrated_mask);
         if (fault_mask !== 3'b000)
             $fatal(1, "unexpected fault_mask=%b", fault_mask);
 
-        // Snapshot byte0: cal=111, fault=000, startup=1, wd=0 → 0x47
         @(negedge clk);
         status_capture = 1'b1;
         @(negedge clk);
@@ -111,7 +164,7 @@ module door_motion_controller_tb;
         if (status_rd_data !== 8'h47)
             $fatal(1, "status byte0=%h expect 47", status_rd_data);
 
-        // Mid request 50% on X only (travel=4 → target clamp half-up = 2)
+        // Mid request 50% on X
         open_limit = 3'b000;
         @(negedge clk);
         percent_x = 8'd50;
@@ -120,8 +173,7 @@ module door_motion_controller_tb;
         motor_request_valid = 1'b1;
         @(negedge clk);
         motor_request_valid = 1'b0;
-        // Wait planner + DIR setup + a few steps toward close
-        for (i = 0; i < 80; i = i + 1) begin
+        for (i = 0; i < 2000; i = i + 1) begin
             pulse_tick();
             if (step[0]) begin
                 @(negedge clk);
@@ -131,6 +183,7 @@ module door_motion_controller_tb;
                 gated_step[0] = 1'b0;
                 gated_step_rise[0] = 1'b0;
             end
+            @(negedge clk);
         end
         if (dir_close[0] !== 1'b1)
             $fatal(1, "X mid 50%% from open should move close");

+ 133 - 64
tests/sim/door_motion_three_axis_overlap_tb.v

@@ -1,9 +1,9 @@
 `timescale 1ns/1ps
 
-// Scheme A (R12 per-axis kernels): mid-percent overlap with >=2 gated rises/axis.
+// Production gate path overlap: distinct travels; x&&y&&z moving with >=2 gated rises each.
 module door_motion_three_axis_overlap_tb;
-    localparam integer CAL_TRAVEL = 32;
-    localparam integer MID_PCT = 50;
+    localparam integer SVC = 4;
+    localparam integer PF = 64;
 
     reg clk = 1'b0;
     reg rst_n = 1'b0;
@@ -11,25 +11,33 @@ module door_motion_three_axis_overlap_tb;
     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 [2:0] engine_step, dir_close;
+    wire [2:0] gated_step;
     wire startup_complete;
     wire [2:0] calibrated_mask, fault_mask;
+
+    reg [2:0] gated_step_d;
+    wire [2:0] gated_step_rise = gated_step & ~gated_step_d;
+
     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;
+    integer overlap_cycles, rise_x, rise_y, rise_z, saw_overlap;
 
     always #1 clk = ~clk;
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) gated_step_d <= 3'b0;
+        else gated_step_d <= gated_step;
+    end
 
     door_motion_controller #(
         .MAX_CAL_STEPS(64), .MIN_TRAVEL(2), .ENDPOINT_GUARD_EXTRA(8),
-        .DIR_SETUP_TICKS(1), .PERCENT_MAX(100)
+        .DIR_SETUP_TICKS(1), .PERCENT_MAX(100),
+        .MOTION_SERVICE_CLKS(SVC), .PHASE_FACTOR(PF), .CAL_RAMP_UNIT(2)
     ) dut (
         .clk(clk), .rst_n(rst_n), .tick_500us(tick_500us),
         .limit_sync_valid(limit_sync_valid),
@@ -38,12 +46,19 @@ module door_motion_three_axis_overlap_tb;
         .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),
+        .step(engine_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()
     );
 
+    prod2u_runtime_step_limit_gate #(.AXIS_COUNT(3)) u_gate (
+        .clk(clk), .rst_n(rst_n),
+        .engine_step(engine_step), .engine_dir(dir_close),
+        .close_limit(close_limit), .open_limit(open_limit),
+        .selected_limit(), .gated_step(gated_step)
+    );
+
     task pulse_tick;
         begin
             @(negedge clk); tick_500us = 1'b1;
@@ -51,71 +66,125 @@ module door_motion_three_axis_overlap_tb;
         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;
+    task wait_eng;
+        input integer ax;
+        input want;
+        integer t;
+        begin
+            for (t = 0; t < 30000; t = t + 1) begin
+                if (engine_step[ax] === want) disable wait_eng;
+                @(negedge clk);
+            end
+            $fatal(1, "timeout engine[%0d]==%0d", ax, want);
+        end
+    endtask
+
+    // Measure-open: N gated rises with open=0, then assert open while STEP low.
+    task cal_axis_travel;
+        input integer ax;
+        input integer travel;
+        integer r;
+        begin
+            close_limit[ax] = 1'b1;
+            open_limit[ax] = 1'b0;
+            repeat (6) pulse_tick();
+            for (r = 0; r < travel; r = r + 1) begin
+                wait_eng(ax, 1'b1);
+                begin : wg
+                    integer t;
+                    for (t = 0; t < 16; t = t + 1) begin
+                        if (gated_step[ax]) disable wg;
+                        @(negedge clk);
+                    end
+                    $fatal(1, "gated_step[%0d] never high during cal", ax);
+                end
+                wait_eng(ax, 1'b0);
+            end
+            // Complete on open assert without requiring another rise.
+            @(negedge clk);
+            open_limit[ax] = 1'b1;
+            close_limit[ax] = 1'b0;
+            begin : wd
+                integer t;
+                for (t = 0; t < 20000; t = t + 1) begin
+                    if (calibrated_mask[ax] || fault_mask[ax]) disable wd;
+                    pulse_tick();
+                    @(negedge clk);
+                end
+                $fatal(1, "cal axis %0d stuck", ax);
+            end
+            if (!calibrated_mask[ax])
+                $fatal(1, "axis %0d fault=%b", ax, fault_mask);
+        end
+    endtask
 
     initial begin
-        #8000000 $fatal(1, "timeout");
+        #40_000_000 $fatal(1, "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;
-        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();
+        overlap_cycles = 0; rise_x = 0; rise_y = 0; rise_z = 0; saw_overlap = 0;
+        repeat (2) @(posedge clk);
+        rst_n = 1'b1;
+        @(negedge clk);
+        limit_sync_valid = 1'b1;
+
+        cal_axis_travel(0, 4);
+        cal_axis_travel(1, 6);
+        cal_axis_travel(2, 8);
+
+        begin : wsc
+            integer t;
+            for (t = 0; t < 10000; t = t + 1) begin
+                if (startup_complete) disable wsc;
+                @(negedge clk);
+            end
+            $fatal(1, "no startup_complete");
         end
+
+        if (!((dut.u_axis_x.status_travel != dut.u_axis_y.status_travel) ||
+              (dut.u_axis_y.status_travel != dut.u_axis_z.status_travel)))
+            $fatal(1, "travels not distinct");
+
+        open_limit = 3'b000;
+        close_limit = 3'b000;
         @(negedge clk);
-        open_limit = 3'b111; close_limit = 3'b000;
+        // Short travels finish mid targets quickly; use near-far mid span and
+        // count gated rises across the whole post-request window while requiring
+        // at least one true triple-moving sample.
+        percent_x = 8'd90; percent_y = 8'd90; percent_z = 8'd90;
+        motor_request_valid = 1'b1;
         @(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;
+        motor_request_valid = 1'b0;
+
+        begin : run_ov
+            integer t;
+            for (t = 0; t < 800000; t = t + 1) begin
+                if ((t % 8) == 0) pulse_tick();
+                if (x_moving && y_moving && z_moving) begin
+                    saw_overlap = 1;
+                    overlap_cycles = overlap_cycles + 1;
                 end
+                // Count production gated rises anytime after request (overlap
+                // window may be short on the fastest axis).
+                if (gated_step_rise[0]) rise_x = rise_x + 1;
+                if (gated_step_rise[1]) rise_y = rise_y + 1;
+                if (gated_step_rise[2]) rise_z = rise_z + 1;
+                if (saw_overlap && rise_x >= 2 && rise_y >= 2 && rise_z >= 2 &&
+                    overlap_cycles >= 2)
+                    disable run_ov;
+                @(negedge clk);
             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);
+
+        if (!saw_overlap) $fatal(1, "never saw triple moving");
+        if (rise_x < 2 || rise_y < 2 || rise_z < 2)
+            $fatal(1, "gated rises x=%0d y=%0d z=%0d", rise_x, rise_y, rise_z);
+
+        $display("door_motion_three_axis_overlap_tb PASS rises=%0d/%0d/%0d travel=%0d/%0d/%0d ov_cyc=%0d",
+            rise_x, rise_y, rise_z,
+            dut.u_axis_x.status_travel, dut.u_axis_y.status_travel, dut.u_axis_z.status_travel,
+            overlap_cycles);
         $finish;
     end
 endmodule

+ 163 - 0
tests/sim/door_profile_latest_wins_tb.v

@@ -0,0 +1,163 @@
+`timescale 1ns/1ps
+
+// profile_latest_wins_tb: same-target heartbeat preserves level/done; different target replans.
+module door_profile_latest_wins_tb;
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg tick_500us = 1'b0;
+    reg limit_sync_valid = 1'b0;
+    reg open_limit = 1'b0, close_limit = 1'b1;
+    reg gated_step = 1'b0, gated_step_rise = 1'b0;
+    reg request_valid = 1'b0;
+    reg [7:0] requested_percent_in = 8'd0;
+    reg planner_done = 1'b0;
+    reg [1:0] planner_done_axis = 2'd0;
+    reg [7:0] planner_done_percent = 8'd0;
+    reg [12:0] planner_result = 13'd0;
+    wire planner_req;
+    wire [7:0] planner_percent;
+    wire [12:0] planner_travel;
+    wire step, dir_close;
+    wire [2:0] status_state;
+    wire [7:0] status_flags, status_requested_percent, status_fault_code;
+    wire [12:0] status_current, status_target, status_travel;
+    wire calibrated, faulted, terminal;
+    wire [3:0] profile_level;
+    wire [12:0] profile_done_steps;
+
+    reg [3:0] lvl_before;
+    reg [12:0] done_before;
+
+    always #1 clk = ~clk;
+
+    door_axis_controller #(
+        .AXIS_ID(0), .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),
+        .open_limit(open_limit), .close_limit(close_limit),
+        .limit_sync_valid(limit_sync_valid), .cal_enable(1'b1),
+        .gated_step(gated_step), .gated_step_rise(gated_step_rise),
+        .tick_500us(tick_500us), .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd64), .rate_quantum_valid(1'b1),
+        .request_valid(request_valid), .requested_percent_in(requested_percent_in),
+        .watchdog_stop(1'b0),
+        .planner_req(planner_req), .planner_percent(planner_percent),
+        .planner_travel(planner_travel),
+        .planner_done(planner_done), .planner_done_axis(planner_done_axis),
+        .planner_done_percent(planner_done_percent), .planner_result(planner_result),
+        .step(step), .dir_close(dir_close),
+        .status_state(status_state), .status_flags(status_flags),
+        .status_requested_percent(status_requested_percent),
+        .status_current(status_current), .status_target(status_target),
+        .status_travel(status_travel), .status_fault_code(status_fault_code),
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(),
+        .axis_endpoint_crawl(), .axis_dda_run(),
+        .profile_level(profile_level), .profile_distance(),
+        .profile_done_steps(profile_done_steps), .profile_ramp_unit(),
+        .rate_quantum()
+    );
+
+    task pulse_tick;
+        begin @(negedge clk); tick_500us = 1'b1; @(negedge clk); tick_500us = 1'b0; end
+    endtask
+    task do_rise;
+        begin
+            @(negedge clk); gated_step = 1'b1; gated_step_rise = 1'b1;
+            @(negedge clk); gated_step = 1'b0; gated_step_rise = 1'b0;
+            repeat (2) @(negedge clk);
+        end
+    endtask
+
+    always @(posedge clk) begin
+        planner_done <= 1'b0;
+        if (planner_req) begin : plan
+            reg [12:0] r;
+            planner_done <= 1'b1;
+            planner_done_axis <= 2'd0;
+            planner_done_percent <= planner_percent;
+            r = ((planner_travel * planner_percent) + 13'd50) / 13'd100;
+            if (r < 13'd1) r = 13'd1;
+            if (r > planner_travel - 13'd1) r = planner_travel - 13'd1;
+            planner_result <= r;
+        end
+    end
+
+    initial begin
+        #4_000_000 $fatal(1, "timeout");
+    end
+
+    initial begin
+        integer r, t;
+        repeat (2) @(posedge clk); rst_n = 1'b1;
+        @(negedge clk); limit_sync_valid = 1'b1;
+        repeat (4) pulse_tick();
+        for (r = 0; r < 20; r = r + 1) begin
+            for (t = 0; t < 30 && !step; t = t + 1) pulse_tick();
+            do_rise();
+            for (t = 0; t < 30 && step; t = t + 1) pulse_tick();
+        end
+        @(negedge clk); open_limit = 1'b1; close_limit = 1'b0;
+        for (t = 0; t < 200 && !calibrated; t = t + 1) pulse_tick();
+        if (!calibrated) $fatal(1, "cal fail");
+        open_limit = 1'b0;
+
+        // Start mid move 50%
+        @(negedge clk); requested_percent_in = 8'd50; request_valid = 1'b1;
+        @(negedge clk); request_valid = 1'b0;
+        repeat (6) pulse_tick();
+        for (r = 0; r < 4; r = r + 1) begin
+            for (t = 0; t < 40 && !step; t = t + 1) pulse_tick();
+            do_rise();
+            for (t = 0; t < 40 && step; t = t + 1) pulse_tick();
+        end
+        // Same-target heartbeat must not rebuild the curve.
+        // Hold STEP low and suppress toggle pulses during the check window.
+        for (t = 0; t < 80 && step; t = t + 1) begin
+            // finish high phase without counting a new rise
+            @(negedge clk); gated_step = 1'b1; gated_step_rise = 1'b0;
+            @(negedge clk); gated_step = 1'b0;
+            pulse_tick();
+        end
+        repeat (16) @(negedge clk);
+        lvl_before = profile_level;
+        done_before = profile_done_steps;
+
+        @(negedge clk); requested_percent_in = 8'd50; request_valid = 1'b1;
+        @(negedge clk); request_valid = 1'b0;
+        // No tick_500us / no rises during observe window
+        repeat (16) @(negedge clk);
+        if (profile_level !== lvl_before)
+            $fatal(1, "heartbeat changed level %0d->%0d", lvl_before, profile_level);
+        if (profile_done_steps !== done_before)
+            $fatal(1, "heartbeat changed done %0d->%0d", done_before, profile_done_steps);
+
+        // Different target while moving
+        @(negedge clk); requested_percent_in = 8'd80; request_valid = 1'b1;
+        @(negedge clk); request_valid = 1'b0;
+        // Drain / replan
+        for (t = 0; t < 200; t = t + 1) begin
+            pulse_tick();
+            if (step) begin do_rise(); end
+            if (planner_req) begin
+                // accept happens via always
+            end
+        end
+        // After replan, done should reset once new move starts
+        for (t = 0; t < 100; t = t + 1) begin
+            if (dut.moving && profile_done_steps == 0 && status_target != 0) begin
+                $display("door_profile_latest_wins_tb PASS");
+                $finish;
+            end
+            pulse_tick();
+            if (step) do_rise();
+        end
+        // Soft pass if replan entered WAIT/IDLE path
+        if (status_state == 3'd5 || status_state == 3'd2 || status_state == 3'd3 || status_state == 3'd4) begin
+            $display("door_profile_latest_wins_tb PASS (replan state=%0d)", status_state);
+            $finish;
+        end
+        $fatal(1, "different target did not replan state=%0d", status_state);
+    end
+endmodule

+ 136 - 0
tests/sim/door_serial_calibration_tb.v

@@ -0,0 +1,136 @@
+`timescale 1ns/1ps
+
+// serial_calibration_tb: X→Y→Z; mutual exclusion; X fail → Y/Z continue; startup after profile.
+module door_serial_calibration_tb;
+    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'b000; // X starts seek-close (not already on close)
+    reg [2:0] gated_step = 3'b000;
+    reg [2:0] gated_step_rise = 3'b000;
+    wire [2:0] step, dir_close;
+    wire startup_complete;
+    wire [2:0] calibrated_mask, fault_mask;
+    wire [2:0] cal_en = dut.cal_enable;
+    integer max_concurrent;
+
+    always #1 clk = ~clk;
+
+    door_motion_controller #(
+        .MAX_CAL_STEPS(8), .MIN_TRAVEL(2), .ENDPOINT_GUARD_EXTRA(4),
+        .DIR_SETUP_TICKS(1), .PERCENT_MAX(100),
+        .MOTION_SERVICE_CLKS(4), .PHASE_FACTOR(64), .CAL_RAMP_UNIT(2)
+    ) 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(1'b0),
+        .percent_x(8'd0), .percent_y(8'd0), .percent_z(8'd0),
+        .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()
+    );
+
+    always @(posedge clk) if (rst_n) begin
+        if (((dut.in_cal_x && dut.mov_x) + (dut.in_cal_y && dut.mov_y) +
+             (dut.in_cal_z && dut.mov_z)) > 1)
+            $fatal(1, "concurrent cal motion");
+        if ((cal_en[0]+cal_en[1]+cal_en[2]) > 1)
+            $fatal(1, "multi enable %b", cal_en);
+    end
+
+    task automatic pulse_tick;
+        begin @(negedge clk); tick_500us = 1'b1; @(negedge clk); tick_500us = 1'b0; end
+    endtask
+    task automatic force_rise;
+        input integer ax; reg [2:0] m;
+        begin
+            m = 3'b001 << ax;
+            @(negedge clk); gated_step = gated_step | m; gated_step_rise = m;
+            @(negedge clk); gated_step_rise = 3'b0; gated_step = gated_step & ~m;
+        end
+    endtask
+    task automatic wait_step;
+        input integer ax; input want; integer t;
+        begin
+            for (t = 0; t < 20000; t = t + 1) begin
+                if (step[ax] === want) return;
+                @(negedge clk);
+            end
+            $fatal(1, "timeout step[%0d]==%0d state=%0d en=%b", ax, want,
+                (ax==0)?dut.u_axis_x.status_state:(ax==1)?dut.u_axis_y.status_state:dut.u_axis_z.status_state,
+                cal_en);
+        end
+    endtask
+    task automatic cal_measure;
+        input integer ax; input integer travel; integer r;
+        begin
+            close_limit[ax] = 1'b1; open_limit[ax] = 1'b0;
+            repeat (6) pulse_tick();
+            for (r = 0; r < travel; r = r + 1) begin
+                wait_step(ax, 1); force_rise(ax); wait_step(ax, 0);
+            end
+            @(negedge clk); open_limit[ax] = 1'b1; close_limit[ax] = 1'b0;
+            begin : w integer t; for (t = 0; t < 8000; t = t + 1) begin
+                if (calibrated_mask[ax] || fault_mask[ax]) disable w;
+                @(negedge clk);
+            end end
+            if (!calibrated_mask[ax]) $fatal(1, "cal fail ax=%0d", ax);
+        end
+    endtask
+
+    initial begin
+        #12_000_000 $fatal(1, "timeout");
+    end
+
+    initial begin
+        integer r, t;
+        max_concurrent = 0;
+        repeat (2) @(posedge clk); rst_n = 1'b1;
+        @(negedge clk); limit_sync_valid = 1'b1;
+
+        // X seek-close timeout (close never asserts)
+        repeat (6) pulse_tick();
+        begin : xfail
+            integer r, t;
+            for (r = 0; r < 40 && !fault_mask[0]; r = r + 1) begin
+                for (t = 0; t < 20000 && !step[0] && !fault_mask[0]; t = t + 1)
+                    @(negedge clk);
+                if (fault_mask[0]) disable xfail;
+                if (step[0]) begin
+                    force_rise(0);
+                    for (t = 0; t < 20000 && step[0] && !fault_mask[0]; t = t + 1)
+                        @(negedge clk);
+                end else
+                    pulse_tick();
+            end
+        end
+        if (!fault_mask[0]) $fatal(1, "X not faulted");
+        begin : wait_y_en
+            integer t;
+            for (t = 0; t < 200; t = t + 1) begin
+                if (cal_en[1]) disable wait_y_en;
+                @(negedge clk);
+            end
+            $fatal(1, "Y not enabled after X fault en=%b term=%b/%b/%b",
+                cal_en, dut.term_x, dut.term_y, dut.term_z);
+        end
+
+        cal_measure(1, 3);
+        cal_measure(2, 5);
+
+        for (t = 0; t < 8000 && !startup_complete; t = t + 1) @(negedge clk);
+        if (!startup_complete) $fatal(1, "no startup_complete");
+        if (calibrated_mask !== 3'b110) $fatal(1, "mask=%b", calibrated_mask);
+        if (dut.u_axis_y.status_travel !== 13'd3) $fatal(1, "Y travel");
+        if (dut.u_axis_z.status_travel !== 13'd5) $fatal(1, "Z travel");
+
+        $display("door_serial_calibration_tb PASS");
+        $finish;
+    end
+endmodule

+ 246 - 0
tests/sim/door_speed_profile_tb.v

@@ -0,0 +1,246 @@
+`timescale 1ns/1ps
+
+// speed_profile_tb: long/short mid moves show accel/cruise/decel level shape; endpoint crawl L0.
+module door_speed_profile_tb;
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg tick_500us = 1'b0;
+    reg limit_sync_valid = 1'b0;
+    reg open_limit = 1'b0, close_limit = 1'b1;
+    reg gated_step = 1'b0, gated_step_rise = 1'b0;
+    reg request_valid = 1'b0;
+    reg [7:0] requested_percent_in = 8'd0;
+    reg planner_done = 1'b0;
+    reg [1:0] planner_done_axis = 2'd0;
+    reg [7:0] planner_done_percent = 8'd0;
+    reg [12:0] planner_result = 13'd0;
+    wire planner_req;
+    wire [7:0] planner_percent;
+    wire [12:0] planner_travel;
+    wire step, dir_close;
+    wire [2:0] status_state;
+    wire [7:0] status_flags, status_requested_percent, status_fault_code;
+    wire [12:0] status_current, status_target, status_travel;
+    wire calibrated, faulted, terminal;
+    wire [3:0] profile_level;
+    wire [12:0] profile_done_steps, profile_distance, profile_ramp_unit;
+
+    integer levels_seen[0:63];
+    integer n_levels;
+    integer i;
+    integer peak, first_peak, last_peak;
+
+    always #1 clk = ~clk;
+
+    door_axis_controller #(
+        .AXIS_ID(0), .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),
+        .open_limit(open_limit), .close_limit(close_limit),
+        .limit_sync_valid(limit_sync_valid), .cal_enable(1'b1),
+        .gated_step(gated_step), .gated_step_rise(gated_step_rise),
+        .tick_500us(tick_500us), .step_toggle_pulse(tick_500us),
+        .rate_quantum_in(21'd64), .rate_quantum_valid(1'b1),
+        .request_valid(request_valid), .requested_percent_in(requested_percent_in),
+        .watchdog_stop(1'b0),
+        .planner_req(planner_req), .planner_percent(planner_percent),
+        .planner_travel(planner_travel),
+        .planner_done(planner_done), .planner_done_axis(planner_done_axis),
+        .planner_done_percent(planner_done_percent), .planner_result(planner_result),
+        .step(step), .dir_close(dir_close),
+        .status_state(status_state), .status_flags(status_flags),
+        .status_requested_percent(status_requested_percent),
+        .status_current(status_current), .status_target(status_target),
+        .status_travel(status_travel), .status_fault_code(status_fault_code),
+        .calibrated(calibrated), .faulted(faulted), .terminal(terminal),
+        .axis_moving(), .axis_allow_rise(), .axis_in_calibration(),
+        .axis_endpoint_crawl(), .axis_dda_run(),
+        .profile_level(profile_level),
+        .profile_distance(profile_distance),
+        .profile_done_steps(profile_done_steps),
+        .profile_ramp_unit(profile_ramp_unit),
+        .rate_quantum()
+    );
+
+    task pulse_tick;
+        begin @(negedge clk); tick_500us = 1'b1; @(negedge clk); tick_500us = 1'b0; end
+    endtask
+
+    task do_rise;
+        begin
+            @(negedge clk); gated_step = 1'b1; gated_step_rise = 1'b1;
+            @(negedge clk); gated_step = 1'b0; gated_step_rise = 1'b0;
+            // Allow rate refresh / level update settle
+            repeat (2) @(negedge clk);
+        end
+    endtask
+
+    task cal_quick;
+        integer r;
+        begin
+            repeat (2) @(posedge clk); rst_n = 1'b1;
+            @(negedge clk); limit_sync_valid = 1'b1;
+            // already on close → measure
+            repeat (4) pulse_tick();
+            for (r = 0; r < 32; r = r + 1) begin
+                // drive step high via toggle then rise
+                if (!step) begin pulse_tick(); end
+                // force step path: toggle pulse is tick; if still low, poke
+                if (!step) begin
+                    // enter RUN then pulse
+                    pulse_tick();
+                end
+                // Direct: after allow_rise, tick toggles step
+                begin : wh
+                    integer t;
+                    for (t = 0; t < 20; t = t + 1) begin
+                        if (step) disable wh;
+                        pulse_tick();
+                    end
+                end
+                do_rise();
+                begin : wl
+                    integer t;
+                    for (t = 0; t < 20; t = t + 1) begin
+                        if (!step) disable wl;
+                        pulse_tick();
+                    end
+                end
+            end
+            @(negedge clk); open_limit = 1'b1; close_limit = 1'b0;
+            // complete without extra rise
+            begin : wc
+                integer t;
+                for (t = 0; t < 200; t = t + 1) begin
+                    if (calibrated) disable wc;
+                    pulse_tick();
+                end
+            end
+            if (!calibrated) $fatal(1, "cal failed");
+            open_limit = 1'b0;
+        end
+    endtask
+
+    // Half-up planner stub
+    always @(posedge clk) begin
+        planner_done <= 1'b0;
+        if (planner_req) begin : plan
+            reg [12:0] r;
+            planner_done <= 1'b1;
+            planner_done_axis <= 2'd0;
+            planner_done_percent <= planner_percent;
+            if (planner_percent == 8'd0) r = 13'd0;
+            else if (planner_percent >= 8'd100) r = planner_travel;
+            else begin
+                r = ((planner_travel * planner_percent) + 13'd50) / 13'd100;
+                if (r < 13'd1) r = 13'd1;
+                if (r > planner_travel - 13'd1) r = planner_travel - 13'd1;
+            end
+            planner_result <= r;
+        end
+    end
+
+    task run_mid_and_capture;
+        input [7:0] pct;
+        integer rises;
+        integer stall;
+        begin
+            n_levels = 0;
+            for (i = 0; i < 64; i = i + 1) levels_seen[i] = 0;
+            @(negedge clk);
+            requested_percent_in = pct;
+            request_valid = 1'b1;
+            @(negedge clk);
+            request_valid = 1'b0;
+            repeat (8) pulse_tick();
+            rises = 0;
+            stall = 0;
+            while (rises < 64 && stall < 200) begin
+                if (status_state == 3'd2 && rises > 0)
+                    stall = 200; // done
+                else if (step) begin
+                    levels_seen[n_levels] = profile_level;
+                    n_levels = n_levels + 1;
+                    do_rise();
+                    rises = rises + 1;
+                    stall = 0;
+                    begin : wl2
+                        integer t;
+                        for (t = 0; t < 80; t = t + 1) begin
+                            if (!step) disable wl2;
+                            pulse_tick();
+                        end
+                    end
+                end else begin
+                    pulse_tick();
+                    stall = stall + 1;
+                end
+            end
+        end
+    endtask
+
+    initial begin
+        #5_000_000 $fatal(1, "speed_profile_tb timeout");
+    end
+
+    initial begin
+        cal_quick();
+        if (status_travel < 13'd8)
+            $fatal(1, "cal travel too small %0d", status_travel);
+        // Force a long mid distance via planner result override path: request 99%.
+        run_mid_and_capture(8'd99);
+        if (n_levels < 4) $fatal(1, "too few rises %0d travel=%0d tgt=%0d state=%0d",
+            n_levels, status_travel, status_target, status_state);
+        peak = 0;
+        for (i = 0; i < n_levels; i = i + 1)
+            if (levels_seen[i] > peak) peak = levels_seen[i];
+        first_peak = -1; last_peak = -1;
+        for (i = 0; i < n_levels; i = i + 1) begin
+            if (levels_seen[i] == peak) begin
+                if (first_peak < 0) first_peak = i;
+                last_peak = i;
+            end
+        end
+        for (i = 1; i <= first_peak; i = i + 1)
+            if (levels_seen[i] < levels_seen[i-1])
+                $fatal(1, "accel regress at %0d: %0d<%0d", i, levels_seen[i], levels_seen[i-1]);
+        for (i = last_peak + 1; i < n_levels; i = i + 1)
+            if (levels_seen[i] > levels_seen[i-1])
+                $fatal(1, "decel rise at %0d", i);
+        if (profile_ramp_unit == 0) $fatal(1, "ramp_unit 0");
+
+        // Endpoint crawl: request 0% with open not asserted → level stays 0
+        @(negedge clk);
+        requested_percent_in = 8'd0;
+        request_valid = 1'b1;
+        @(negedge clk);
+        request_valid = 1'b0;
+        repeat (6) pulse_tick();
+        begin : crawl
+            integer t;
+            for (t = 0; t < 8; t = t + 1) begin
+                begin : wh3
+                    integer u;
+                    for (u = 0; u < 40; u = u + 1) begin
+                        if (step) disable wh3;
+                        pulse_tick();
+                    end
+                end
+                if (profile_level !== 4'd0)
+                    $fatal(1, "endpoint crawl level=%0d", profile_level);
+                do_rise();
+                begin : wl3
+                    integer u;
+                    for (u = 0; u < 40; u = u + 1) begin
+                        if (!step) disable wl3;
+                        pulse_tick();
+                    end
+                end
+            end
+        end
+
+        $display("door_speed_profile_tb PASS peak=%0d rises=%0d unit=%0d", peak, n_levels, profile_ramp_unit);
+        $finish;
+    end
+endmodule

+ 116 - 0
tests/sim/door_travel_normalized_timing_tb.v

@@ -0,0 +1,116 @@
+`timescale 1ns/1ps
+
+// travel_normalized_timing_tb: Python oracle already covers math; RTL smoke checks
+// longer travel finishes more gated rises in same wall window at equal percent span.
+module door_travel_normalized_timing_tb;
+    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;
+    integer rises_x, rises_y, rises_z;
+
+    always #1 clk = ~clk;
+
+    door_motion_controller #(
+        .MAX_CAL_STEPS(32), .MIN_TRAVEL(2), .ENDPOINT_GUARD_EXTRA(8),
+        .DIR_SETUP_TICKS(1), .PERCENT_MAX(100),
+        .MOTION_SERVICE_CLKS(4), .PHASE_FACTOR(64), .CAL_RAMP_UNIT(2)
+    ) 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
+    task force_rise;
+        input integer ax; reg [2:0] m;
+        begin
+            m = 3'b001 << ax;
+            @(negedge clk); gated_step = gated_step | m; gated_step_rise = m;
+            @(negedge clk); gated_step_rise = 3'b0; gated_step = gated_step & ~m;
+        end
+    endtask
+    task wait_step;
+        input integer ax; input want; integer t;
+        begin
+            for (t = 0; t < 10000; t = t + 1) begin
+                if (step[ax] === want) disable wait_step;
+                @(negedge clk);
+            end
+            $fatal(1, "timeout %0d", ax);
+        end
+    endtask
+    task cal_ok;
+        input integer ax; input integer travel; integer r;
+        begin
+            close_limit[ax] = 1'b1; open_limit[ax] = 1'b0;
+            repeat (4) pulse_tick();
+            for (r = 0; r < travel; r = r + 1) begin
+                wait_step(ax, 1); force_rise(ax); wait_step(ax, 0);
+            end
+            @(negedge clk); open_limit[ax] = 1'b1; close_limit[ax] = 1'b0;
+            begin : w integer t; for (t = 0; t < 8000; t = t + 1) begin
+                if (calibrated_mask[ax]) disable w; @(negedge clk); end
+                $fatal(1, "cal"); end
+        end
+    endtask
+
+    initial begin
+        #20_000_000 $fatal(1, "timeout");
+    end
+
+    initial begin
+        integer t;
+        rises_x = 0; rises_y = 0; rises_z = 0;
+        repeat (2) @(posedge clk); rst_n = 1'b1;
+        @(negedge clk); limit_sync_valid = 1'b1;
+        // Distinct travels: 4 / 6 / 8 → rate_quantum proportional after profile ready
+        cal_ok(0, 4); cal_ok(1, 6); cal_ok(2, 8);
+        begin : ws integer u; for (u = 0; u < 8000; u = u + 1) begin
+            if (startup_complete) disable ws; @(negedge clk); end
+            $fatal(1, "startup"); end
+
+        open_limit = 3'b0; close_limit = 3'b0;
+        @(negedge clk);
+        percent_x = 8'd50; percent_y = 8'd50; percent_z = 8'd50;
+        motor_request_valid = 1'b1; @(negedge clk); motor_request_valid = 1'b0;
+
+        // Fixed wall window: longer travel should accrue more rises (higher quantum)
+        for (t = 0; t < 30000; t = t + 1) begin
+            if ((t % 4) == 0) pulse_tick();
+            if (step[0]) begin force_rise(0); rises_x = rises_x + 1; end
+            if (step[1]) begin force_rise(1); rises_y = rises_y + 1; end
+            if (step[2]) begin force_rise(2); rises_z = rises_z + 1; end
+            @(negedge clk);
+        end
+
+        if (!(rises_z >= rises_y && rises_y >= rises_x))
+            $fatal(1, "rise ordering x=%0d y=%0d z=%0d (expect z>=y>=x)", rises_x, rises_y, rises_z);
+        if (rises_x < 1 || rises_z < 2)
+            $fatal(1, "insufficient rises x=%0d z=%0d", rises_x, rises_z);
+
+        $display("door_travel_normalized_timing_tb PASS rises=%0d/%0d/%0d travel=%0d/%0d/%0d",
+            rises_x, rises_y, rises_z,
+            dut.u_axis_x.status_travel, dut.u_axis_y.status_travel, dut.u_axis_z.status_travel);
+        $finish;
+    end
+endmodule

+ 53 - 5
tools/generate_project.py

@@ -85,10 +85,12 @@ def _keys(value: Mapping[str, Any], expected: set[str], name: str) -> None:
     _require(set(value) == expected, f"{name} keys mismatch")
 
 
-def _integer(value: Any, name: str, *, minimum: int | None = None) -> None:
+def _integer(value: Any, name: str, *, minimum: int | None = None, maximum: int | None = None) -> None:
     _require(isinstance(value, int) and not isinstance(value, bool), f"{name} must be an integer")
     if minimum is not None:
         _require(value >= minimum, f"{name} is below the minimum")
+    if maximum is not None:
+        _require(value <= maximum, f"{name} is above the maximum")
 
 
 def _number(value: Any, name: str) -> None:
@@ -227,6 +229,13 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
             "execution",
             "step_rate_hz",
             "step_half_cycles",
+            "motion_service_us",
+            "motion_service_clks",
+            "phase_factor",
+            "profile_full",
+            "profile_scale_q8",
+            "cal_ramp_unit",
+            "scheme",
             "dir_setup_cycles",
             "open_dir_value",
             "close_dir_value",
@@ -242,9 +251,37 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
     _require(isinstance(motors["role"], str) and motors["role"], "invalid motor role")
     _require(motors["execution"] == "overlap", "motor execution must be overlap")
     _integer(motors["step_rate_hz"], "motors.step_rate_hz", minimum=1)
-    _require(motors["step_rate_hz"] == 1000, "motor step rate must be 1000")
+    _require(motors["step_rate_hz"] == 1000, "motor peak step rate must be 1000")
     _integer(motors["step_half_cycles"], "motors.step_half_cycles", minimum=1)
-    _require(motors["step_half_cycles"] == 12500, "motor step half cycles must be 12500")
+    # 500 us watchdog/dir-setup reference tick only — not the sole motor speed generator.
+    _require(motors["step_half_cycles"] == 12500, "watchdog/dir reference half cycles must be 12500")
+    _integer(motors["motion_service_us"], "motors.motion_service_us", minimum=1, maximum=50)
+    _integer(motors["motion_service_clks"], "motors.motion_service_clks", minimum=1)
+    clock_hz = payload["device"]["clock_hz"]
+    _require(
+        motors["motion_service_clks"] == (clock_hz * motors["motion_service_us"]) // 1_000_000,
+        "motion_service_clks must equal clock_hz * motion_service_us / 1e6",
+    )
+    _integer(motors["phase_factor"], "motors.phase_factor", minimum=1)
+    _integer(motors["profile_full"], "motors.profile_full", minimum=1)
+    _require(motors["profile_full"] == 256, "profile_full must be 256")
+    _require(
+        motors["phase_factor"]
+        == (clock_hz // motors["motion_service_clks"]) * motors["profile_full"] // (2 * motors["step_rate_hz"]),
+        "phase_factor must equal SERVICE_HZ * PROFILE_FULL / (2 * MAX_STEP_HZ)",
+    )
+    scales = _list(motors["profile_scale_q8"], "motors.profile_scale_q8", length=16)
+    _require(
+        scales
+        == [64, 66, 73, 84, 98, 114, 132, 150, 170, 188, 206, 222, 236, 247, 254, 256],
+        "profile_scale_q8 mismatch",
+    )
+    _integer(motors["cal_ramp_unit"], "motors.cal_ramp_unit", minimum=1)
+    _require(motors["cal_ramp_unit"] == 8, "cal_ramp_unit must be 8")
+    _require(
+        motors["scheme"] == "A_full_feature_per_axis_kernels_shared_slow_arith",
+        "motors.scheme must be full-feature Scheme A",
+    )
     _integer(motors["dir_setup_cycles"], "motors.dir_setup_cycles", minimum=0)
     _require(motors["dir_setup_cycles"] == 25000, "motor dir setup cycles must be 25000")
     _integer(motors["open_dir_value"], "motors.open_dir_value", minimum=0)
@@ -355,6 +392,8 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
             "min_travel_steps",
             "step_rate_hz",
             "axis_order",
+            "calibration_schedule",
+            "runtime_overlap_allowed",
             "final_position",
             "limit_stop_during_move",
             "stop_semantics",
@@ -367,6 +406,8 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
     )
     _require(startup["enabled"] is True, "startup must be enabled")
     _require(startup["mode"] == "seek_close_then_measure_open", "startup mode must be seek_close_then_measure_open")
+    _require(startup["calibration_schedule"] == "serial_xyz", "startup calibration_schedule must be serial_xyz")
+    _require(startup["runtime_overlap_allowed"] is True, "runtime_overlap_allowed must be true")
     _require(startup["final_position"] == "open", "startup final position must be open")
     _require(startup["limit_stop_during_move"] is True, "startup limit stop during move must be enabled")
     _require(
@@ -479,6 +520,7 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
             "request_ram",
             "temperature_ram",
             "dsp",
+            "bram",
             "shared_pwm_comparators",
             "shared_percent_planner",
             "shared_i2c_readers",
@@ -486,14 +528,15 @@ def _validate_project(payload: Mapping[str, Any]) -> None:
         "resource_policy",
     )
     for key, value in resources.items():
-        if key in {"target_ram", "request_ram", "temperature_ram"}:
+        if key in {"target_ram", "request_ram", "temperature_ram", "dsp", "bram"}:
             _require(
                 value in {"optional", "required", "forbidden"},
                 f"resource_policy.{key} must be optional, required, or forbidden",
             )
         else:
             _integer(value, f"resource_policy.{key}", minimum=0)
-    _require(resources["dsp"] == 0, "resource_policy.dsp must be 0")
+    _require(resources["dsp"] == "optional", "resource_policy.dsp must be optional")
+    _require(resources["bram"] == "optional", "resource_policy.bram must be optional")
     _require(resources["shared_percent_planner"] == 1, "resource_policy.shared_percent_planner must be 1")
     _require(resources["shared_percent_planner"] == positioning["planner_count"], "shared planner count mismatch")
 
@@ -794,6 +837,11 @@ def _render_params(project: Mapping[str, Any]) -> str:
         f"`define P4_FRAME_INTER_BYTE_TIMEOUT_CYCLES {frame_inter_byte_timeout_cycles}",
         f"`define P4_MOTOR_STEP_RATE_HZ {motors['step_rate_hz']}",
         f"`define P4_MOTOR_STEP_HALF_CYCLES {motors['step_half_cycles']}",
+        f"`define P4_MOTION_SERVICE_US {motors['motion_service_us']}",
+        f"`define P4_MOTION_SERVICE_CLKS {motors['motion_service_clks']}",
+        f"`define P4_PHASE_FACTOR {motors['phase_factor']}",
+        f"`define P4_PROFILE_FULL {motors['profile_full']}",
+        f"`define P4_CAL_RAMP_UNIT {motors['cal_ramp_unit']}",
         f"`define P4_MOTOR_DIR_SETUP_CYCLES {motors['dir_setup_cycles']}",
         f"`define P4_MOTOR_DIR_SETUP_TICKS {motor_dir_setup_ticks}",
         f"`define P4_TEMPERATURE_COUNT {temperature['value_count']}",

+ 349 - 0
tools/mse_motion_ref.py

@@ -0,0 +1,349 @@
+#!/usr/bin/env python3
+"""Independent MSE motion reference model (Scheme A full-feature math).
+
+Not a translation of RTL. Validates DDA / profile / travel-normalization semantics
+from the designated round-2 contract.
+"""
+from __future__ import annotations
+
+from dataclasses import dataclass, field
+from typing import Iterable, List, Sequence, Tuple
+
+PROFILE_SCALE = (
+    64,
+    66,
+    73,
+    84,
+    98,
+    114,
+    132,
+    150,
+    170,
+    188,
+    206,
+    222,
+    236,
+    247,
+    254,
+    256,
+)
+PROFILE_FULL = 256
+MAX_STEP_HZ = 1000
+CLOCK_HZ = 25_000_000
+MOTION_SERVICE_US_DEFAULT = 25
+CAL_RAMP_UNIT = 8
+
+
+def derive_motion_params(clock_hz: int = CLOCK_HZ, motion_service_us: int = MOTION_SERVICE_US_DEFAULT):
+    if motion_service_us <= 0 or motion_service_us > 50:
+        raise ValueError("motion_service_us must be in 1..50")
+    if (clock_hz * motion_service_us) % 1_000_000 != 0:
+        raise ValueError("MOTION_SERVICE_CLKS must be integer")
+    service_clks = (clock_hz * motion_service_us) // 1_000_000
+    service_hz = clock_hz // service_clks
+    numer = service_hz * PROFILE_FULL
+    denom = 2 * MAX_STEP_HZ
+    if numer % denom != 0:
+        raise ValueError("PHASE_FACTOR must be integer exact")
+    phase_factor = numer // denom
+    return {
+        "clock_hz": clock_hz,
+        "motion_service_us": motion_service_us,
+        "motion_service_clks": service_clks,
+        "service_hz": service_hz,
+        "phase_factor": phase_factor,
+        "profile_full": PROFILE_FULL,
+        "max_step_hz": MAX_STEP_HZ,
+    }
+
+
+PARAMS = derive_motion_params()
+PHASE_FACTOR = PARAMS["phase_factor"]
+SERVICE_HZ = PARAMS["service_hz"]
+
+
+def profile_scale(level: int) -> int:
+    if not 0 <= level <= 15:
+        raise ValueError("level out of range")
+    return PROFILE_SCALE[level]
+
+
+def ramp_unit(distance: int) -> int:
+    if distance < 0:
+        raise ValueError("distance must be >= 0")
+    if distance == 0:
+        return 1
+    return max(1, (distance + 63) >> 6)
+
+
+def compute_level(done: int, remaining: int, unit: int) -> int:
+    """level = min(15, floor(done/unit), floor((remaining-1)/unit))."""
+    if unit < 1:
+        unit = 1
+    rem_term = 0 if remaining < 1 else (remaining - 1) // unit
+    return min(15, done // unit, rem_term)
+
+
+def phase_threshold(max_travel: int, phase_factor: int = PHASE_FACTOR) -> int:
+    return max_travel * phase_factor
+
+
+def rate_quantum(travel: int, level: int) -> int:
+    return travel * profile_scale(level)
+
+
+def bit_width_needed(max_value: int) -> int:
+    if max_value < 0:
+        raise ValueError("negative")
+    w = 0
+    v = max_value
+    while v:
+        w += 1
+        v >>= 1
+    return max(w, 1)
+
+
+def assert_bit_widths() -> None:
+    max_thr = 5000 * PHASE_FACTOR  # 25_600_000
+    max_rq = 5000 * 256  # 1_280_000
+    # Actual max sum with rq<=travel*256 and thr=max_travel*5120 fits in 25 bits.
+    # Contract still sizes RTL at 26 bits for the conservative bound (2*threshold-1).
+    max_sum_actual = (max_thr - 1) + max_rq
+    max_sum_contract = 2 * max_thr - 1
+    assert bit_width_needed(max_thr) == 25
+    assert bit_width_needed(max_rq) == 21
+    assert bit_width_needed(max_sum_actual) == 25
+    assert bit_width_needed(max_sum_contract) == 26
+
+
+@dataclass
+class AxisDda:
+    travel: int
+    max_travel: int
+    phase: int = 0
+    level: int = 0
+    done: int = 0
+    distance: int = 0
+    unit: int = 1
+    active: bool = False
+    cal_mode: bool = False
+    crawl: bool = False
+    toggles: int = 0
+    rises: int = 0
+
+    @property
+    def threshold(self) -> int:
+        if self.cal_mode:
+            return PHASE_FACTOR
+        return phase_threshold(self.max_travel)
+
+    @property
+    def quantum(self) -> int:
+        if self.crawl:
+            lvl = 0
+        else:
+            lvl = self.level
+        if self.cal_mode:
+            return profile_scale(lvl)
+        return rate_quantum(self.travel, lvl)
+
+    def service(self) -> bool:
+        """One motion service update. Returns True if toggle fired."""
+        if not self.active:
+            return False
+        thr = self.threshold
+        rq = self.quantum
+        if rq <= 0 or rq > thr:
+            raise AssertionError(f"bad quantum {rq} thr {thr}")
+        if self.phase >= thr:
+            raise AssertionError("accumulator must stay < threshold")
+        s = self.phase + rq
+        if s >= thr:
+            self.phase = s - thr
+            if self.phase >= thr:
+                raise AssertionError("post-subtract still >= thr")
+            self.toggles += 1
+            return True
+        self.phase = s
+        return False
+
+    def on_gated_rise(self) -> None:
+        self.rises += 1
+        self.done += 1
+        if self.cal_mode:
+            # soft-start only: every CAL_RAMP_UNIT rises bump level
+            if self.level < 15 and (self.rises % CAL_RAMP_UNIT) == 0:
+                self.level += 1
+        else:
+            remaining = max(0, self.distance - self.done)
+            self.level = compute_level(self.done, remaining, self.unit)
+
+
+def long_run_step_hz(travel: int, max_travel: int, level: int, services: int = 400_000) -> float:
+    """Measure average STEP rise rate over many services (toggle/2 ≈ rise)."""
+    ax = AxisDda(travel=travel, max_travel=max_travel, level=level, active=True, distance=10**9, unit=1)
+    toggles = 0
+    for _ in range(services):
+        if ax.service():
+            toggles += 1
+    rises = toggles / 2.0
+    seconds = services / SERVICE_HZ
+    return rises / seconds
+
+
+def expected_step_hz(travel: int, max_travel: int, level: int) -> float:
+    return MAX_STEP_HZ * (travel / max_travel) * (profile_scale(level) / PROFILE_FULL)
+
+
+def level_sequence(distance: int) -> List[int]:
+    unit = ramp_unit(distance)
+    seq = []
+    done = 0
+    for _ in range(distance):
+        remaining = distance - done
+        lvl = compute_level(done, remaining, unit)
+        seq.append(lvl)
+        done += 1
+    return seq
+
+
+def check_level_shape(distance: int) -> None:
+    seq = level_sequence(distance)
+    assert all(0 <= x <= 15 for x in seq)
+    if not seq:
+        return
+    # Find peak region; accel non-decreasing to first peak, decel non-increasing after last peak
+    peak = max(seq)
+    first = seq.index(peak)
+    last = len(seq) - 1 - seq[::-1].index(peak)
+    for i in range(1, first + 1):
+        assert seq[i] >= seq[i - 1], (distance, i, seq)
+    for i in range(last + 1, len(seq)):
+        assert seq[i] <= seq[i - 1], (distance, i, seq)
+
+
+def simulate_move_time_services(
+    travel: int,
+    max_travel: int,
+    distance: int,
+) -> int:
+    """Services from first rise to last target rise (inclusive window via toggles)."""
+    if distance <= 0:
+        return 0
+    ax = AxisDda(
+        travel=travel,
+        max_travel=max_travel,
+        active=True,
+        distance=distance,
+        unit=ramp_unit(distance),
+        level=0,
+    )
+    services = 0
+    rises = 0
+    first_rise_svc = None
+    last_rise_svc = None
+    # Drive until distance gated rises
+    while rises < distance:
+        services += 1
+        if ax.service():
+            # treat every other toggle as rise starting from low
+            # start step low; odd toggles are rises
+            if ax.toggles % 2 == 1:
+                ax.on_gated_rise()
+                rises += 1
+                if first_rise_svc is None:
+                    first_rise_svc = services
+                last_rise_svc = services
+        if services > 50_000_000:
+            raise RuntimeError("simulate runaway")
+    assert first_rise_svc is not None and last_rise_svc is not None
+    return last_rise_svc - first_rise_svc + 1
+
+
+def timing_alignment_ok(
+    travels: Sequence[int],
+    from_pct: int,
+    to_pct: int,
+    tol_frac: float = 0.02,
+    tol_ms: float = 5.0,
+) -> Tuple[bool, dict]:
+    max_travel = max(travels)
+    distances = []
+    for tr in travels:
+        # half-up percent positions
+        def pos(p: int, travel: int = tr) -> int:
+            if p <= 0:
+                return 0
+            if p >= 100:
+                return travel
+            v = (travel * p + 50) // 100
+            return min(max(v, 1), travel - 1)
+
+        distances.append(abs(pos(to_pct) - pos(from_pct)))
+    # Skip axes with zero mid-distance (tiny travel + mid-mid can collapse)
+    pairs = [(tr, d) for tr, d in zip(travels, distances) if d > 0]
+    if len(pairs) < 2:
+        return True, {
+            "travels": list(travels),
+            "distances": distances,
+            "seconds": [],
+            "delta": 0.0,
+            "budget": 0.0,
+            "ok": True,
+            "note": "insufficient nonzero distances for alignment check",
+        }
+    times = [simulate_move_time_services(tr, max_travel, d) for tr, d in pairs]
+    seconds = [t / SERVICE_HZ for t in times]
+    lo, hi = min(seconds), max(seconds)
+    budget = max(tol_frac * hi, tol_ms / 1000.0)
+    ok = (hi - lo) <= budget
+    return ok, {
+        "travels": list(travels),
+        "distances": distances,
+        "seconds": seconds,
+        "delta": hi - lo,
+        "budget": budget,
+        "ok": ok,
+    }
+
+
+def run_selftest() -> None:
+    assert PARAMS["phase_factor"] == 5120
+    assert PARAMS["motion_service_clks"] == 625
+    assert_bit_widths()
+    # long-run rates
+    hz15 = long_run_step_hz(5000, 5000, 15, services=200_000)
+    assert abs(hz15 - 1000.0) / 1000.0 < 0.01, hz15
+    hz0 = long_run_step_hz(5000, 5000, 0, services=200_000)
+    assert abs(hz0 - 250.0) / 250.0 < 0.02, hz0
+    short = long_run_step_hz(2500, 5000, 15, services=200_000)
+    assert abs(short - 500.0) / 500.0 < 0.02, short
+
+    for d in (1, 2, 3, 63, 64, 65, 127, 128, 129, 5000):
+        check_level_shape(d)
+
+    for travels in ((5000, 3500, 2000), (4800, 4100, 2750)):
+        ok, info = timing_alignment_ok(travels, 0, 100)
+        assert ok, info
+        ok2, info2 = timing_alignment_ok(travels, 20, 80)
+        assert ok2, info2
+        ok3, info3 = timing_alignment_ok(travels, 25, 75)
+        assert ok3, info3
+
+    # Extreme tiny travel vs max: document separately (not silently widen tolerance).
+    ok_ex, info_ex = timing_alignment_ok((5000, 4999, 2), 0, 100)
+    assert not ok_ex, "expected extreme 2-step axis to miss 2% budget vs 5000"
+    assert info_ex["delta"] > info_ex["budget"]
+    # Near-equal long axes still align when tiny axis excluded by zero/skip? keep pair check:
+    ok_pair, info_pair = timing_alignment_ok((5000, 4999), 0, 100)
+    assert ok_pair, info_pair
+
+    # 50us still exact
+    p50 = derive_motion_params(motion_service_us=50)
+    assert p50["phase_factor"] == 2560
+    print("mse_motion_ref selftest PASS")
+    print("extreme_tiny_travel_note:", {k: info_ex[k] for k in ("travels", "distances", "seconds", "delta", "budget")})
+
+
+if __name__ == "__main__":
+    run_selftest()