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

Merge protocol tip into integrate worktree

Bring wt/protocol-20260804T155114Z (c1a79a6) into integrate for batch1 verification.
root 3 месяцев назад
Родитель
Сommit
98624ea9ec
3 измененных файлов с 10 добавлено и 6 удалено
  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
 `timescale 1ns/1ps
 
 
 module frame_rx #(
 module frame_rx #(
-    parameter integer MAX_PAYLOAD = 14,
+    parameter integer MAX_PAYLOAD = 11,
     parameter integer INTER_BYTE_TIMEOUT_CYCLES = 250000
     parameter integer INTER_BYTE_TIMEOUT_CYCLES = 250000
 ) (
 ) (
     input  wire       clk,
     input  wire       clk,
@@ -70,10 +70,12 @@ module frame_rx #(
                 state <= ST_WAIT_A5;
                 state <= ST_WAIT_A5;
             end
             end
         end else if (!accept_enable) begin
         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;
             payload_wr_en <= 1'b0;
             frame_valid <= 1'b0;
             frame_valid <= 1'b0;
             state <= ST_WAIT_A5;
             state <= ST_WAIT_A5;
-            gap_counter <= 32'd0;
+            gap_counter <= {GAP_BITS{1'b0}};
         end else begin
         end else begin
             payload_wr_en <= 1'b0;
             payload_wr_en <= 1'b0;
             if (state != ST_WAIT_A5 && state != ST_WAIT_5A && !byte_valid) begin
             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
 `timescale 1ns/1ps
 
 
 module payload_ram #(
 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
     parameter integer ADDR_WIDTH = 8
 ) (
 ) (
     input  wire                  clk,
     input  wire                  clk,

+ 4 - 2
src/project/command_controller.v

@@ -170,13 +170,15 @@ module command_controller #(
                     end
                     end
                 end
                 end
                 ST_WRITE_PTC: begin
                 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_en <= 1'b1;
                     target_wr_data <= ptc_values[write_index];
                     target_wr_data <= ptc_values[write_index];
                     if (ptc_write_phase == 2'd0) begin
                     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;
                         ptc_write_phase <= 2'd1;
                     end else begin
                     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;
                         ptc_write_phase <= 2'd0;
                         if (write_index == CHAMBER_PTC_COUNT - 1) begin
                         if (write_index == CHAMBER_PTC_COUNT - 1) begin
                             state <= ST_COMMIT;
                             state <= ST_COMMIT;