Explorar el Código

fix(mse): restore A2 production; record A1 TD provisional

Keep A2 as the functionally green soft-gate tip after A1 fair TD passed
routing/timing but still fails serial calibration. Capture A1/A2 TD
evidence without freezing a winner.

Co-authored-by: Cursor <cursoragent@cursor.com>
root hace 3 meses
padre
commit
760b2508dc

+ 3 - 3
receipts/mse-a1-a2-hierarchy-compare.json

@@ -1,8 +1,8 @@
 {
   "schema": "prod2u-mse-a1-a2-hierarchy-compare-v1",
-  "generated_utc": "2026-08-11T22:39:59Z",
+  "generated_utc": "2026-08-11T22:45:01Z",
   "method": "fullchip_td_plus_yosys_note",
-  "note": "A1 reconstructed. A2 active restored for functional green soft gates. Fair winner NOT frozen: A2 route congestion fail; A1 TD pass but serial_cal icarus fail.",
+  "note": "A2 restored from a978ff6 as active. A1 TD pass recorded but serial_cal icarus gap remains. Winner not frozen.",
   "A1": {
     "provenance": "reconstructed",
     "source": "receipts/scheme-a-a2-attempt/door_shared_dda_scheduler_a1.v",
@@ -16,7 +16,7 @@
   "A2": {
     "provenance": "active",
     "source": "src/modules/door_shared_dda_scheduler.v",
-    "sha256": "c8cfbcb78a95d104aa689601ad231bc8d8ba0911faa54bb70e4c3e7cdeccd454",
+    "sha256": "5330c708999b3be8a3e5315291e9bbd450dc9da0c0ce70f00af2b606b4013fec",
     "td": "receipts/mse-td-a2-dsp-a978ff6.json",
     "td_status": "fail_route_packing_fit",
     "mslice_pack": 1082,

+ 46 - 95
src/modules/door_shared_dda_scheduler.v

@@ -1,14 +1,12 @@
 `timescale 1ns/1ps
 
-// Scheme A1 (RECONSTRUCTED candidate for fair full-chip TD) sequential shared DDA (not exact byte-archive).
-// Provenance: recovered from agent transcript 7c830c69 (Round-2 A1 implementation)
-// matching yosys-a1-dda.stat signals (state/service_pending/f_fire/f_next).
-// Label: reconstructed — must pass same functional tests as A2 before fair TD.
-// Drain semantics (Round-3): phase always wraps when active && sum>=thr;
-// allow_toggle only gates the STEP toggle pulse (high-pulse drain).
-
+// Scheme A2: three parallel narrow DDA datapaths (one add/compare/sub each).
+// On each motion_service_ce, all active axes update in one clock.
+// Rise permission is enforced in the axis STEP toggle helper; this datapath
+// always wraps when active so high pulses can still drain (!allow_rise).
+// busy is always 0 after the single service cycle (1-cycle datapath).
+// service_overrun stays 0: next service cannot overlap a multi-cycle busy.
 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,
@@ -28,113 +26,66 @@ module door_shared_dda_scheduler #(
     output reg                          busy,
     output wire                         service_overrun
 );
-    localparam [1:0] ST_IDLE = 2'd0,
-                     ST_X    = 2'd1,
-                     ST_Y    = 2'd2,
-                     ST_Z    = 2'd3;
-
-    reg [1:0] state;
     reg [PHASE_WIDTH-1:0] phase0, phase1, phase2;
-    reg service_pending;
-    reg overrun_r;
-
-    assign service_overrun = overrun_r;
+    assign service_overrun = 1'b0;
+    wire _unused_allow = |allow_toggle;
 
     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];
 
-    // Phase always advances/wraps when enabled; allow only gates fire.
-    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;
-        input                   allow;
-        reg   [PHASE_WIDTH-1:0] sum;
-        begin
-            sum = ph + {{(PHASE_WIDTH-RATE_WIDTH){1'b0}}, rate};
-            f_fire = en && allow && (sum >= thr);
-        end
-    endfunction
-
     always @(posedge clk or negedge rst_n) begin
         if (!rst_n) begin
-            state <= ST_IDLE;
             phase0 <= {PHASE_WIDTH{1'b0}};
             phase1 <= {PHASE_WIDTH{1'b0}};
             phase2 <= {PHASE_WIDTH{1'b0}};
             toggle_pulse <= 3'b000;
             busy <= 1'b0;
-            service_pending <= 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;
-                else
-                    service_pending <= 1'b1;
-            end
-
-            case (state)
-                ST_IDLE: begin
-                    busy <= 1'b0;
-                    if (service_pending) begin
-                        service_pending <= 1'b0;
-                        busy <= 1'b1;
-                        state <= ST_X;
-                    end
-                end
-                ST_X: begin
-                    begin : ax0
-                        reg [PHASE_WIDTH-1:0] thr;
-                        thr = cal_mode[0] ? thr_cal : thr_run;
-                        toggle_pulse[0] <= f_fire(phase0, rate0, thr, active[0], allow_toggle[0]);
-                        phase0 <= f_next(phase0, rate0, thr, active[0]);
+                begin : par
+                    reg [PHASE_WIDTH-1:0] t0, t1, t2;
+                    reg [PHASE_WIDTH-1:0] s0, s1, s2;
+                    t0 = cal_mode[0] ? thr_cal : thr_run;
+                    t1 = cal_mode[1] ? thr_cal : thr_run;
+                    t2 = cal_mode[2] ? thr_cal : thr_run;
+                    if (active[0]) begin
+                        s0 = phase0 + {{(PHASE_WIDTH-RATE_WIDTH){1'b0}}, rate0};
+                        if (s0 >= t0) begin
+                            toggle_pulse[0] <= 1'b1;
+                            phase0 <= s0 - t0;
+                        end else begin
+                            phase0 <= s0;
+                        end
+                    end else begin
+                        phase0 <= {PHASE_WIDTH{1'b0}};
                     end
-                    state <= ST_Y;
-                end
-                ST_Y: begin
-                    begin : ax1
-                        reg [PHASE_WIDTH-1:0] thr;
-                        thr = cal_mode[1] ? thr_cal : thr_run;
-                        toggle_pulse[1] <= f_fire(phase1, rate1, thr, active[1], allow_toggle[1]);
-                        phase1 <= f_next(phase1, rate1, thr, active[1]);
+                    if (active[1]) begin
+                        s1 = phase1 + {{(PHASE_WIDTH-RATE_WIDTH){1'b0}}, rate1};
+                        if (s1 >= t1) begin
+                            toggle_pulse[1] <= 1'b1;
+                            phase1 <= s1 - t1;
+                        end else begin
+                            phase1 <= s1;
+                        end
+                    end else begin
+                        phase1 <= {PHASE_WIDTH{1'b0}};
                     end
-                    state <= ST_Z;
-                end
-                default: begin
-                    begin : ax2
-                        reg [PHASE_WIDTH-1:0] thr;
-                        thr = cal_mode[2] ? thr_cal : thr_run;
-                        toggle_pulse[2] <= f_fire(phase2, rate2, thr, active[2], allow_toggle[2]);
-                        phase2 <= f_next(phase2, rate2, thr, active[2]);
+                    if (active[2]) begin
+                        s2 = phase2 + {{(PHASE_WIDTH-RATE_WIDTH){1'b0}}, rate2};
+                        if (s2 >= t2) begin
+                            toggle_pulse[2] <= 1'b1;
+                            phase2 <= s2 - t2;
+                        end else begin
+                            phase2 <= s2;
+                        end
+                    end else begin
+                        phase2 <= {PHASE_WIDTH{1'b0}};
                     end
-                    busy <= 1'b0;
-                    state <= ST_IDLE;
                 end
-            endcase
+            end
         end
     end
 endmodule