Ver Fonte

Align protocol defaults to 11-byte SET_ALL atomic path.

Reject legacy 14-byte payload depths by default, flush RX when accept is gated, and make chamber PTC pair addressing explicit.

Co-authored-by: Cursor <cursoragent@cursor.com>
root há 3 meses atrás
pai
commit
c1a79a6723
3 ficheiros alterados com 10 adições e 6 exclusões
  1. 4 2
      src/common/frame_rx.v
  2. 2 2
      src/common/payload_ram.v
  3. 4 2
      src/project/command_controller.v

+ 4 - 2
src/common/frame_rx.v

@@ -1,7 +1,7 @@
 `timescale 1ns/1ps
 
 module frame_rx #(
-    parameter integer MAX_PAYLOAD = 14,
+    parameter integer MAX_PAYLOAD = 11,
     parameter integer INTER_BYTE_TIMEOUT_CYCLES = 250000
 ) (
     input  wire       clk,
@@ -70,10 +70,12 @@ module frame_rx #(
                 state <= ST_WAIT_A5;
             end
         end else if (!accept_enable) begin
+            // Drop/flush parser while host is busy or startup_done==0 so a
+            // partial byte stream cannot become a later valid command.
             payload_wr_en <= 1'b0;
             frame_valid <= 1'b0;
             state <= ST_WAIT_A5;
-            gap_counter <= 32'd0;
+            gap_counter <= {GAP_BITS{1'b0}};
         end else begin
             payload_wr_en <= 1'b0;
             if (state != ST_WAIT_A5 && state != ST_WAIT_5A && !byte_valid) begin

+ 2 - 2
src/common/payload_ram.v

@@ -1,8 +1,8 @@
 `timescale 1ns/1ps
 
 module payload_ram #(
-    // The active Prod2U contract uses an 11-byte SET_ALL payload.
-    parameter integer DEPTH = 14,
+    // Active Prod2U SET_ALL payload is 11 bytes; reject larger defaults.
+    parameter integer DEPTH = 11,
     parameter integer ADDR_WIDTH = 8
 ) (
     input  wire                  clk,

+ 4 - 2
src/project/command_controller.v

@@ -170,13 +170,15 @@ module command_controller #(
                     end
                 end
                 ST_WRITE_PTC: begin
+                    // Each chamber PTC duty is duplicated to a physical pair:
+                    // chamber i -> channels {2*i, 2*i+1}.
                     target_wr_en <= 1'b1;
                     target_wr_data <= ptc_values[write_index];
                     if (ptc_write_phase == 2'd0) begin
-                        target_wr_addr <= {1'b0, write_index, 1'b0};
+                        target_wr_addr <= {1'b0, write_index[1:0], 1'b0};
                         ptc_write_phase <= 2'd1;
                     end else begin
-                        target_wr_addr <= {1'b0, write_index, 1'b1};
+                        target_wr_addr <= {1'b0, write_index[1:0], 1'b1};
                         ptc_write_phase <= 2'd0;
                         if (write_index == CHAMBER_PTC_COUNT - 1) begin
                             state <= ST_COMMIT;