|
|
@@ -58,7 +58,7 @@ module thermal_control_core #(
|
|
|
localparam [3:0] W_INIT = 0, W_IDLE = 1, W_MANUAL_COPY = 2,
|
|
|
W_SAFE_FILL = 3, W_APPLY_PREFETCH = 4, W_APPLY_WRITE = 5,
|
|
|
W_SAFETY_PREFETCH = 6, W_SAFETY_CHECK = 7, W_COMMIT_WAIT = 8;
|
|
|
- localparam [1:0] COMMIT_NONE = 0, COMMIT_MANUAL = 1, COMMIT_SAFE = 2;
|
|
|
+ localparam [1:0] COMMIT_NONE = 0, COMMIT_MANUAL = 1, COMMIT_SAFE = 2, COMMIT_PROTECTION=3;
|
|
|
localparam [7:0] WATCHDOG_LOAD = WATCHDOG_TICKS_OVERRIDE != 0 ?
|
|
|
WATCHDOG_TICKS_OVERRIDE[7:0] : WATCHDOG_SECONDS;
|
|
|
|
|
|
@@ -108,6 +108,7 @@ module thermal_control_core #(
|
|
|
.clk(clk), .active_bank(active_output_bank),
|
|
|
.init_write(output_init_write), .init_addr(output_init_addr), .init_data(output_init_data),
|
|
|
.control_bank(~active_output_bank), .control_read_addr(output_control_read_addr),
|
|
|
+ .copy_read_active(!snapshot_lock && (work_state==W_APPLY_PREFETCH || work_state==W_APPLY_WRITE)),
|
|
|
.control_write(output_control_write), .control_write_addr(output_control_addr),
|
|
|
.control_write_data(output_control_data), .pwm_addr(pwm_rd_addr), .pwm_applied(pwm_rd_data),
|
|
|
.snapshot_bank(snapshot_output_bank), .snapshot_addr(snapshot_rd_addr),
|
|
|
@@ -154,13 +155,12 @@ module thermal_control_core #(
|
|
|
output_control_write <= 1'b0;
|
|
|
if (manual_commit_applied) begin
|
|
|
manual_pending <= 1'b1;
|
|
|
- safe_pending <= 1'b0;
|
|
|
end
|
|
|
if (watchdog_keepalive && watchdog_active) begin
|
|
|
// A keepalive reload on the same tick as a would-be timeout
|
|
|
// wins, mirroring the SET_ALL commit priority.
|
|
|
watchdog_remaining <= WATCHDOG_LOAD;
|
|
|
- end else if (watchdog_active && tick_1s && !manual_pending && commit_kind != COMMIT_MANUAL) begin
|
|
|
+ end else if (watchdog_active && tick_1s) begin
|
|
|
if (watchdog_remaining > 1) watchdog_remaining <= watchdog_remaining - 1'b1;
|
|
|
else begin watchdog_remaining <= 0; safe_pending <= 1'b1; end
|
|
|
end
|
|
|
@@ -176,7 +176,7 @@ module thermal_control_core #(
|
|
|
W_IDLE: begin
|
|
|
if (!bmc_stale && (bmc_epoch != last_bmc_epoch)) begin
|
|
|
last_bmc_epoch <= bmc_epoch;
|
|
|
- work_index <= 0; epoch_hard_mask <= 0; scan_lane_mask <= 0;
|
|
|
+ work_index <= 0; epoch_hard_mask <= lane_fault_mask; scan_lane_mask <= 0;
|
|
|
work_state <= W_SAFETY_PREFETCH;
|
|
|
end else if (manual_pending) begin
|
|
|
manual_pending <= 0; work_index <= 0; commit_kind <= COMMIT_MANUAL;
|
|
|
@@ -219,6 +219,8 @@ module thermal_control_core #(
|
|
|
if (scan_over77) epoch_hard_mask <= epoch_hard_mask | scan_lane_bit;
|
|
|
if (work_index == 23) begin
|
|
|
lane_fault_mask <= scan_hard_final;
|
|
|
+ safety_override_mask<=safety_override_mask | (scan_over76 ? (24'd1<<work_index) : 24'd0) |
|
|
|
+ {{6{scan_hard_final[3]}},{6{scan_hard_final[2]}},{6{scan_hard_final[1]}},{6{scan_hard_final[0]}};
|
|
|
work_index <= 0;
|
|
|
output_control_read_addr <= 0;
|
|
|
work_state <= W_APPLY_PREFETCH;
|
|
|
@@ -229,9 +231,11 @@ module thermal_control_core #(
|
|
|
end
|
|
|
W_APPLY_PREFETCH: begin
|
|
|
output_control_read_addr <= work_index;
|
|
|
- work_state <= W_APPLY_WRITE;
|
|
|
+ if(!snapshot_lock) work_state <= W_APPLY_WRITE;
|
|
|
end
|
|
|
W_APPLY_WRITE: begin
|
|
|
+ if(snapshot_lock) work_state<=W_APPLY_PREFETCH;
|
|
|
+ else begin
|
|
|
output_control_write <= 1'b1;
|
|
|
output_control_addr <= work_index;
|
|
|
if (work_index < 24)
|
|
|
@@ -241,15 +245,19 @@ module thermal_control_core #(
|
|
|
output_control_data <= {output_control_requested,
|
|
|
lane_fault_mask[work_index[1:0]] ? 8'd100 : output_control_requested};
|
|
|
if (work_index == 31) begin
|
|
|
- work_index <= 0; commit_kind <= COMMIT_SAFE; work_state <= W_COMMIT_WAIT;
|
|
|
+ work_index <= 0; commit_kind <= COMMIT_PROTECTION; work_state <= W_COMMIT_WAIT;
|
|
|
end else begin
|
|
|
work_index <= work_index + 1'b1;
|
|
|
output_control_read_addr <= work_index + 1'b1;
|
|
|
work_state <= W_APPLY_PREFETCH;
|
|
|
end
|
|
|
+ end
|
|
|
end
|
|
|
W_COMMIT_WAIT: begin
|
|
|
- if (pwm_phase_boundary && pwm_scan_idle && !snapshot_lock) begin
|
|
|
+ if(commit_kind==COMMIT_MANUAL && !bmc_stale && bmc_epoch!=last_bmc_epoch) begin
|
|
|
+ manual_pending<=1;commit_kind<=COMMIT_NONE;last_bmc_epoch<=bmc_epoch;
|
|
|
+ work_index<=0;epoch_hard_mask<=lane_fault_mask;work_state<=W_SAFETY_PREFETCH;
|
|
|
+ end else if (pwm_phase_boundary && pwm_scan_idle && !snapshot_lock) begin
|
|
|
active_output_bank <= ~active_output_bank;
|
|
|
output_commit <= 1'b1;
|
|
|
control_epoch <= control_epoch + 1'b1;
|
|
|
@@ -257,9 +265,12 @@ module thermal_control_core #(
|
|
|
manual_commit_done <= 1'b1; manual_commit_ok <= 1'b1;
|
|
|
control_state <= OWNER_MANUAL; watchdog_remaining <= WATCHDOG_LOAD;
|
|
|
global_fault <= 1'b0;
|
|
|
- end else begin
|
|
|
+ safe_pending<=0;
|
|
|
+ end else if(commit_kind==COMMIT_SAFE) begin
|
|
|
control_state <= OWNER_SAFE; watchdog_remaining <= 0;
|
|
|
global_fault <= |lane_fault_mask;
|
|
|
+ end else begin
|
|
|
+ global_fault<=|lane_fault_mask;
|
|
|
end
|
|
|
commit_kind <= COMMIT_NONE; work_state <= W_IDLE;
|
|
|
end
|