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

fix(motor): legal per-axis depth fold; TB binds existing active signal

Icarus rejects the unpacked-array reduction |depth_r; fold with a
parameterized always block.  motor_engine_tb referenced nonexistent
hierarchical r_active; the published output is active.
codex 2 месяцев назад
Родитель
Сommit
f80f104792
2 измененных файлов с 9 добавлено и 2 удалено
  1. 8 1
      src/motor/motor_engine.v
  2. 1 1
      tests/sim/motor_engine_tb.v

+ 8 - 1
src/motor/motor_engine.v

@@ -324,7 +324,14 @@ module motor_engine #(
 
     // ---- queue commit helper wires ----
     wire [5:0] ax_depth_0 = depth_r[0];
-    wire unused_depth = |depth_r;
+    // Unpacked-array reduction (|depth_r) is not legal Verilog; fold per axis.
+    reg unused_depth;
+    integer ud_i;
+    always @* begin
+        unused_depth = 1'b0;
+        for (ud_i = 0; ud_i < AXIS_COUNT; ud_i = ud_i + 1)
+            unused_depth = unused_depth | (depth_r[ud_i] != 6'd0);
+    end
 
     // ---- main sequencer: batch validate/commit + fetch + control ----
     always @(posedge clk or negedge rst_n) begin

+ 1 - 1
tests/sim/motor_engine_tb.v

@@ -160,7 +160,7 @@ module motor_engine_tb;
         send_seg(2'd1, 3'd0, 4'd0, 32'd0, 32'd3, 16'h0002, 1);  // invalid: rel count 0
         submit(4'd2);
         check(qw_status == 8'd3, "bad batch rejected BAD_VALUE");
-        check(dut.g_axis[1].u_axis.r_active == 1'b0 || dut.depth_r[1] == 6'd0,
+        check(dut.g_axis[1].u_axis.active == 1'b0 || dut.depth_r[1] == 6'd0,
               "rejected batch changed nothing");
         // valid hold alone completes after 3 us with no STEP
         send_seg(2'd1, 3'd4, 4'd0, 32'd3, 32'd0, 16'h0003, 0);