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

feat(motor): bypass DSP delay chains in motor_axis_words when USE_DSP=0 (freeing 8 DSPs)

codex 2 месяцев назад
Родитель
Сommit
1c822b18d0
2 измененных файлов с 4 добавлено и 8 удалено
  1. 4 5
      src/motor/motor_axis_core.v
  2. 0 3
      tests/sim/motor_engine_12_tb.v

+ 4 - 5
src/motor/motor_axis_core.v

@@ -440,7 +440,7 @@ endmodule
 // The head is the current scan axis. Both the core axis index and this bank
 // advance every active clock; the updated word returns at the tail. This
 // removes the wide dynamic read selector and per-axis write selection.
-module motor_axis_words #(parameter integer AXIS_COUNT=3)
+module motor_axis_words #(parameter integer AXIS_COUNT=3, parameter integer USE_DSP=0)
 (input wire clk,rst_n,
  input wire [321:0] write_data,output wire [321:0] read_data);
  reg [321:0] words [0:AXIS_COUNT-1];
@@ -453,10 +453,8 @@ module motor_axis_words #(parameter integer AXIS_COUNT=3)
   end
  end
  // Eight documented two-register DSP pipelines carry144 zero-initialized
- // state bits. Remaining clocks stay in fabric registers, so the complete
- // delay is still exactly AXIS_COUNT clocks. The half-period reset bit is
- // outside this range. One-axis verification keeps the original bank.
- generate if(AXIS_COUNT>=2)begin:dsp_storage
+ // state bits. When USE_DSP=0, state is stored in clean fabric registers without wasting DSPs.
+ generate if(USE_DSP && AXIS_COUNT>=2)begin:dsp_storage
   wire [143:0] dsp_delayed;
   genvar d;
   for(d=0;d<8;d=d+1)begin:lanes
@@ -480,6 +478,7 @@ module motor_axis_words #(parameter integer AXIS_COUNT=3)
   end
   assign read_data={words[0][321:176],complete_delay,words[0][31:0]};
  end else begin:fabric_storage
+  wire [143:0] dsp_delayed = words[0][175:32];
   assign read_data=words[0];
  end endgenerate
 endmodule

+ 0 - 3
tests/sim/motor_engine_12_tb.v

@@ -56,7 +56,6 @@ module motor_engine_12_tb;
   if(xy_steps==12'h6DB && (prev_steps & 12'h6DB)==0)xy_rises=xy_rises+1;
   if(z_steps==12'h924 && (prev_steps & 12'h924)==0)z_rises=z_rises+1;
  end prev_steps=steps;end
- always @(posedge tick) if (cycles % 100000 == 0 && cycles > 0) $display("Cycles: %0d xy_rises=%0d z_rises=%0d ax_active=%h ax_load_ready=%h", cycles, xy_rises, z_rises, dut.ax_active, dut.ax_load_ready);
  initial begin
   repeat(4)@(negedge clk);rst_n=1;repeat(40)@(negedge clk);
   startup=1;@(negedge clk);startup=0;start_cycle=cycles;
@@ -78,9 +77,7 @@ module motor_engine_12_tb;
   if(cycles-start_cycle>12*(10+12+12+5)+2*12+4)
    $fatal(1,"12-axis START preparation exceeded descriptor service bound");
   if(detail!=16'hFFFF)$fatal(1,"prepared START detail");
-  $display("Waiting line 80: ax_load_ready=%h ax_active=%h ax_armed=%h xy_rises=%0d z_rises=%0d", dut.ax_load_ready, dut.ax_active, dut.ax_armed, xy_rises, z_rises);
   wait(&dut.ax_load_ready);repeat(30)@(negedge clk);
-  $display("Finished wait line 80: xy_rises=%0d z_rises=%0d", xy_rises, z_rises);
   if(xy_rises!=2 || z_rises!=2 || scan_miss)$fatal(1,"12-axis queue execution/count/deadline (xy=%0d, z=%0d)",xy_rises,z_rises);
   for(i=0;i<12;i=i+1)if(dut.ax_total[i]!=2 || dut.depth_r[i]!=0)$fatal(1,"axis %0d lost queue segment",i);
   check_group=0;