ソースを参照

Use fetched descriptor directly through scanner consumption

codex 3 ヶ月 前
親
コミット
5320f3db8c
1 ファイル変更、10 行追加、19 行削除
  1. 10 19
      src/motor/motor_engine.v

+ 10 - 19
src/motor/motor_engine.v

@@ -261,12 +261,12 @@ module motor_engine #(
     wire [2:0] ax_seg_mode [0:AXIS_COUNT-1];
     wire [31:0] ax_seg_count [0:AXIS_COUNT-1],ax_seg_half [0:AXIS_COUNT-1];
     wire [15:0] ax_seg_tag [0:AXIS_COUNT-1];
-    // One descriptor register serves startup and queue execution. The
-    // consumer acknowledgment keeps it stable through any pending scan.
-    reg [2:0] load_mode;
-    reg load_upper,load_armed;
-    reg [31:0] load_count,load_half;
-    reg [15:0] load_tag;
+    // FX_CONSUME holds the fetched descriptor until the scanner accepts it.
+    // Startup uses the same owner; no second wide descriptor copy is needed.
+    wire [2:0] load_mode=fx_seg[10:8];
+    wire load_upper=fx_seg[16],load_armed=fx_seg[18];
+    wire [31:0] load_count=fx_seg[63:32],load_half=fx_seg[95:64];
+    wire [15:0] load_tag=fx_seg[111:96];
     reg [AXIS_COUNT-1:0] ax_start_armed, ax_abort, ax_preempt;
     reg [AXIS_COUNT-1:0] ax_pos_load, ax_ctr_clear, ax_pos_zero, ax_lat_clear;
 
@@ -713,13 +713,9 @@ module motor_engine #(
                 end
                 FX_LOAD: begin
                     ax_seg_load[fx_axis] <= 1'b1;
-                    load_mode <= f_mode(fx_seg);
-                    load_upper <= f_upper(fx_seg);
-                    load_armed <= cs_state==3 ? 1'b1 : (f_arm(fx_seg) && !start_credit[fx_axis]);
+                    // Resolve ARM once using the old credit, before clearing it.
+                    fx_seg[18] <= cs_state==3 ? 1'b1 : (f_arm(fx_seg) && !start_credit[fx_axis]);
                     start_credit[fx_axis] <= 0;
-                    load_count <= f_count(fx_seg);
-                    load_half <= f_half(fx_seg);
-                    load_tag <= f_tag(fx_seg);
                     if (fx_from_urgent) urgent_valid_r[fx_axis] <= 1'b0;
                     else begin
                         // pop head
@@ -802,13 +798,8 @@ module motor_engine #(
                 if(ax_seg_consumed[su_axis])begin su_wait<=0;su_axis<=su_axis+1'b1;end
               end else begin
                 ax_seg_load[su_axis] <= 1'b1;
-                load_mode <= M_SEEK_LOWER;
-                load_upper <= 1'b0;
-                load_armed <= 1'b0;
-                load_count <= 32'd0;    // unlimited until a limit
-                load_half <= (su_axis == 2'd0) ? X_DEFAULT_HALF_US :
-                    (su_axis == 2'd1) ? Y_DEFAULT_HALF_US : Z_DEFAULT_HALF_US;
-                load_tag <= 16'd0;
+                fx_seg <= {32'd0,((su_axis==0)?X_DEFAULT_HALF_US:((su_axis==1)?Y_DEFAULT_HALF_US:Z_DEFAULT_HALF_US)),
+                    32'd0,8'd0,8'd0,8'd1,8'd0}; // unlimited SEEK_LOWER, no ARM
                 su_wait<=1;
               end
             end