Sfoglia il codice sorgente

fix(rtl): wait for physical host response completion

root 3 mesi fa
parent
commit
67226b7ee9
1 ha cambiato i file con 9 aggiunte e 7 eliminazioni
  1. 9 7
      src/top/prod2u_6400_v1_top.v

+ 9 - 7
src/top/prod2u_6400_v1_top.v

@@ -2,7 +2,8 @@
 `include "generated/6400/prod2u_6400_v1_params.vh"
 
 module prod2u_6400_v1_top #(
-    parameter integer ENABLE_STIMULUS = 0
+    parameter integer ENABLE_STIMULUS = 0,
+    parameter integer CT_SCAN_PERIOD_CLKS = 2500000
 ) (
     input  wire        sys_clk,
     input  wire        host_rs232_rx,
@@ -53,7 +54,7 @@ module prod2u_6400_v1_top #(
     wire tx_start;
     wire [7:0] tx_frame_type;
     wire [7:0] tx_payload_length;
-    wire tx_done;
+    wire frame_tx_done;
     wire frame_tx_busy;
     wire frame_tx_byte_valid;
     wire [7:0] frame_tx_byte_data;
@@ -61,6 +62,7 @@ module prod2u_6400_v1_top #(
     wire [7:0] frame_tx_payload_data;
     wire host_tx_busy;
     wire host_tx_done;
+    wire host_response_done = host_tx_done && !frame_tx_busy;
 
     wire bmc_rx_valid;
     wire [7:0] bmc_rx_data;
@@ -177,14 +179,14 @@ module prod2u_6400_v1_top #(
         .stimulus_wr_data(stimulus_wr_data), .stimulus_commit(stimulus_commit),
         .stimulus_duration_seconds(stimulus_duration), .snapshot_capture(snapshot_capture),
         .snapshot_ready(snapshot_ready), .tx_start(tx_start), .tx_frame_type(tx_frame_type),
-        .tx_payload_length(tx_payload_length), .tx_done(tx_done),
+        .tx_payload_length(tx_payload_length), .tx_done(host_response_done),
         .transaction_done(host_transaction_done), .busy(host_command_busy)
     );
     frame_tx #(.PAYLOAD_IDX_BITS(8)) u_frame_tx (
         .clk(sys_clk), .rst_n(rst_n), .start(tx_start), .frame_type(tx_frame_type),
         .payload_length(tx_payload_length), .busy(frame_tx_busy), .byte_valid(frame_tx_byte_valid),
         .byte_data(frame_tx_byte_data), .byte_ready(!host_tx_busy),
-        .payload_addr(frame_tx_payload_addr), .payload_data(frame_tx_payload_data), .done(tx_done)
+        .payload_addr(frame_tx_payload_addr), .payload_data(frame_tx_payload_data), .done(frame_tx_done)
     );
     uart_tx_byte #(.CLKS_PER_BIT(`FB_HOST_FIXED_CLKS_PER_BIT)) u_host_tx (
         .clk(sys_clk), .rst_n(rst_n), .byte_valid(frame_tx_byte_valid && !host_tx_busy),
@@ -217,7 +219,7 @@ module prod2u_6400_v1_top #(
         .snapshot_raw(bmc_snapshot_raw), .snapshot_valid(bmc_snapshot_valid)
     );
 
-    ct7428_snapshot u_ct_snapshot (
+    ct7428_snapshot #(.SCAN_PERIOD_CLKS(CT_SCAN_PERIOD_CLKS)) u_ct_snapshot (
         .clk(sys_clk), .rst_n(rst_n), .tick_1s(tick_1s),
         .snapshot_lock(snapshot_locked), .snapshot_lock_bank(ct_locked_bank),
         .request_valid(ct_request_valid), .request_ready(ct_request_ready),
@@ -274,7 +276,7 @@ module prod2u_6400_v1_top #(
         .control_epoch(control_epoch), .bmc_age(bmc_age), .ct_age(ct_age),
         .bmc_valid_mask(bmc_valid_mask), .ct_valid_mask(ct_valid_mask),
         .safety_override_mask(safety_mask), .lane_fault_mask(lane_fault_mask),
-        .global_fault(global_fault), .unlock(tx_done), .payload_addr(frame_tx_payload_addr),
+        .global_fault(global_fault), .unlock(host_response_done), .payload_addr(frame_tx_payload_addr),
         .payload_data(frame_tx_payload_data), .bmc_rd_index(bmc_snapshot_index),
         .bmc_rd_raw(bmc_snapshot_raw), .ct_rd_index(ct_snapshot_index),
         .ct_rd_raw(ct_snapshot_raw), .output_rd_addr(snapshot_output_addr),
@@ -282,7 +284,7 @@ module prod2u_6400_v1_top #(
     );
 
     wire unused = &{1'b0, host_locked, host_port_sel, frame_tx_busy, host_tx_done,
-        host_rs232_rx_sync, host_ttl_rx_sync, host_command_busy, bmc_tx_done,
+        host_rs232_rx_sync, host_ttl_rx_sync, host_command_busy, frame_tx_done, bmc_tx_done,
         bmc_poll_count, bmc_snapshot_commit, ct_snapshot_commit, ct_i2c_busy, ct_control_raw,
         ct_control_valid, bmc_snapshot_valid, ct_snapshot_valid, output_commit,
         stimulus_active, pwm_boundary, pwm_phase, pwm_scan_idle};