Explorar o código

refactor(mrdimm): select only schema-defined snapshot header bytes

codex hai 3 meses
pai
achega
3fc3874a26
Modificáronse 1 ficheiros con 67 adicións e 1 borrados
  1. 67 1
      src/telemetry/mrdimm_snapshot_mux.v

+ 67 - 1
src/telemetry/mrdimm_snapshot_mux.v

@@ -49,9 +49,75 @@ module mrdimm_snapshot_mux #(
     wire copying_axes=index>=`MR_SNAPSHOT_AXIS_OFFSET;
     wire copying_axes=index>=`MR_SNAPSHOT_AXIS_OFFSET;
     assign bmc_rd_index=in_bmc ? bmc_relative[5:1] : 5'd0;
     assign bmc_rd_index=in_bmc ? bmc_relative[5:1] : 5'd0;
     assign ct_rd_index=in_ct ? ct_relative[5:1] : 5'd0;
     assign ct_rd_index=in_ct ? ct_relative[5:1] : 5'd0;
+    // Explicit schema-derived byte choices avoid a sparse160-byte barrel
+    // selector, including the sensor ranges that are not stored in this shadow.
+    reg [7:0] header_byte;
+    always @* begin
+        case(index[7:0])
+            `MR_SNAPSHOT_FAN_APPLIED_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_FAN_APPLIED_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_FAN_APPLIED_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_FAN_APPLIED_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_FAN_APPLIED_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_FAN_APPLIED_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_FAN_APPLIED_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_FAN_APPLIED_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_PTC_APPLIED_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_PTC_APPLIED_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_PTC_APPLIED_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_PTC_APPLIED_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_PTC_APPLIED_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_PTC_APPLIED_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_PTC_APPLIED_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_PTC_APPLIED_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_FAN_REQUESTED_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_FAN_REQUESTED_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_FAN_REQUESTED_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_FAN_REQUESTED_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_FAN_REQUESTED_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_FAN_REQUESTED_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_FAN_REQUESTED_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_FAN_REQUESTED_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_PTC_REQUESTED_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_PTC_REQUESTED_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_PTC_REQUESTED_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_PTC_REQUESTED_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_PTC_REQUESTED_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_PTC_REQUESTED_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_PTC_REQUESTED_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_PTC_REQUESTED_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_WATCHDOG_ACTIVE_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_WATCHDOG_ACTIVE_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_WATCHDOG_REMAINING_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_WATCHDOG_REMAINING_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_BMC_VALID_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_VALID_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_BMC_STALE_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_STALE_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_CT_VALID_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_CT_VALID_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_CT_STALE_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_CT_STALE_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_BMC_EPOCH_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_EPOCH_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_BMC_EPOCH_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_EPOCH_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_CT_EPOCH_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_CT_EPOCH_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_CT_EPOCH_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_CT_EPOCH_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_BMC_AGE_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_AGE_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_BMC_AGE_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_AGE_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_CT_AGE_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_CT_AGE_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_CT_AGE_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_CT_AGE_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_BMC_VALID_MASK_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_VALID_MASK_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_BMC_VALID_MASK_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_VALID_MASK_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_BMC_VALID_MASK_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_BMC_VALID_MASK_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_CT_VALID_MASK_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_CT_VALID_MASK_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_CT_VALID_MASK_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_CT_VALID_MASK_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_CT_VALID_MASK_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_CT_VALID_MASK_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_CT_VALID_MASK_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_CT_VALID_MASK_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_TIME_US_LOW_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_TIME_US_LOW_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_TIME_US_LOW_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_TIME_US_LOW_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_TIME_US_LOW_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_TIME_US_LOW_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_TIME_US_LOW_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_TIME_US_LOW_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_TIME_US_HIGH_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_TIME_US_HIGH_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_TIME_US_HIGH_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_TIME_US_HIGH_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_TIME_US_HIGH_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_TIME_US_HIGH_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_TIME_US_HIGH_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_TIME_US_HIGH_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_EVENT_COUNT_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_COUNT_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_EVENT_OVERFLOW_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_OVERFLOW_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_EVENT_OVERFLOW_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_OVERFLOW_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_EVENT_OVERFLOW_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_OVERFLOW_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_EVENT_OVERFLOW_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_OVERFLOW_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_EVENT_PENDING_OVERFLOW_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_PENDING_OVERFLOW_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_EVENT_PENDING_OVERFLOW_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_PENDING_OVERFLOW_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_EVENT_PENDING_OVERFLOW_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_PENDING_OVERFLOW_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_EVENT_PENDING_OVERFLOW_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_EVENT_PENDING_OVERFLOW_OFFSET+3)*8+:8];
+            `MR_SNAPSHOT_GLOBAL_FLAGS_OFFSET+0:header_byte=header_shadow[(`MR_SNAPSHOT_GLOBAL_FLAGS_OFFSET+0)*8+:8];
+            `MR_SNAPSHOT_GLOBAL_FLAGS_OFFSET+1:header_byte=header_shadow[(`MR_SNAPSHOT_GLOBAL_FLAGS_OFFSET+1)*8+:8];
+            `MR_SNAPSHOT_GLOBAL_FLAGS_OFFSET+2:header_byte=header_shadow[(`MR_SNAPSHOT_GLOBAL_FLAGS_OFFSET+2)*8+:8];
+            `MR_SNAPSHOT_GLOBAL_FLAGS_OFFSET+3:header_byte=header_shadow[(`MR_SNAPSHOT_GLOBAL_FLAGS_OFFSET+3)*8+:8];
+            default:header_byte=0;
+        endcase
+    end
     wire [7:0] copy_data=in_bmc ? (bmc_relative[0] ? bmc_rd_raw[15:8] : bmc_rd_raw[7:0]) :
     wire [7:0] copy_data=in_bmc ? (bmc_relative[0] ? bmc_rd_raw[15:8] : bmc_rd_raw[7:0]) :
         in_ct ? (ct_relative[0] ? ct_rd_raw[15:8] : ct_rd_raw[7:0]) :
         in_ct ? (ct_relative[0] ? ct_rd_raw[15:8] : ct_rd_raw[7:0]) :
-        header_shadow[{index[7:0],3'b000} +:8];
+        header_byte;
     wire scanner_match=scanner_axis==expected_axis;
     wire scanner_match=scanner_axis==expected_axis;
     wire axis_write=copying_axes && (!SCANNER_WORD_PORT || scanner_match);
     wire axis_write=copying_axes && (!SCANNER_WORD_PORT || scanner_match);
     wire memory_write=locked && (axis_write || (!copying_axes && phase==2 && index[0]));
     wire memory_write=locked && (axis_write || (!copying_axes && phase==2 && index[0]));