|
@@ -1,11 +1,13 @@
|
|
|
`timescale 1ns/1ps
|
|
`timescale 1ns/1ps
|
|
|
`include "generated/6400/prod2u_6400_v1_params.vh"
|
|
`include "generated/6400/prod2u_6400_v1_params.vh"
|
|
|
|
|
|
|
|
-// Deterministic five-mode controller. Host and PID values are connector-side
|
|
|
|
|
-// duties. The only physical fan polarity conversion is outside this module.
|
|
|
|
|
|
|
+// Single-owner controller. Host and PID values are connector-side duties.
|
|
|
|
|
+// Safety is an independent applied-output layer; board polarity is external.
|
|
|
module thermal_control_core #(
|
|
module thermal_control_core #(
|
|
|
parameter integer ENABLE_STIMULUS = 0,
|
|
parameter integer ENABLE_STIMULUS = 0,
|
|
|
- parameter signed [15:0] HARD_LIMIT = 16'sd7700,
|
|
|
|
|
|
|
+ parameter integer WATCHDOG_TICKS_OVERRIDE = 0,
|
|
|
|
|
+ parameter signed [15:0] CHANNEL_LIMIT = `FB_TEMP_CHANNEL_CLAMP,
|
|
|
|
|
+ parameter signed [15:0] HARD_LIMIT = `FB_TEMP_LANE_HARD,
|
|
|
parameter [7:0] FAN_SAFE_DUTY = `FAN_SAFE_DUTY,
|
|
parameter [7:0] FAN_SAFE_DUTY = `FAN_SAFE_DUTY,
|
|
|
parameter [7:0] WATCHDOG_SECONDS = `SET_ALL_WATCHDOG_SECONDS
|
|
parameter [7:0] WATCHDOG_SECONDS = `SET_ALL_WATCHDOG_SECONDS
|
|
|
) (
|
|
) (
|
|
@@ -59,16 +61,17 @@ module thermal_control_core #(
|
|
|
input wire pwm_scan_idle,
|
|
input wire pwm_scan_idle,
|
|
|
output reg boot_init_complete
|
|
output reg boot_init_complete
|
|
|
);
|
|
);
|
|
|
- localparam [2:0] BOOT_WAIT = `FB_MODE_BOOT_WAIT;
|
|
|
|
|
- localparam [2:0] MANUAL_SET_ALL = `FB_MODE_MANUAL_SET_ALL;
|
|
|
|
|
- localparam [2:0] PID_WAIT_SENSOR = `FB_MODE_PID_WAIT_SENSOR;
|
|
|
|
|
- localparam [2:0] PID_AUTO = `FB_MODE_PID_AUTO;
|
|
|
|
|
- localparam [2:0] HARD_PROTECT = `FB_MODE_HARD_PROTECT;
|
|
|
|
|
|
|
+ localparam [2:0] OWNER_SAFE = `FB_OWNER_SAFE;
|
|
|
|
|
+ localparam [2:0] OWNER_MANUAL = `FB_OWNER_MANUAL;
|
|
|
|
|
+ localparam [2:0] OWNER_PID = `FB_OWNER_PID;
|
|
|
|
|
+ localparam [7:0] WATCHDOG_LOAD = WATCHDOG_TICKS_OVERRIDE != 0 ?
|
|
|
|
|
+ WATCHDOG_TICKS_OVERRIDE[7:0] : WATCHDOG_SECONDS;
|
|
|
|
|
|
|
|
localparam [3:0] W_INIT = 0, W_IDLE = 1, W_MANUAL_COPY = 2,
|
|
localparam [3:0] W_INIT = 0, W_IDLE = 1, W_MANUAL_COPY = 2,
|
|
|
W_PID_PREFETCH = 3, W_PID_WRITE = 4, W_FAN_WRITE = 5,
|
|
W_PID_PREFETCH = 3, W_PID_WRITE = 4, W_FAN_WRITE = 5,
|
|
|
W_APPLY_PREFETCH = 6, W_APPLY_WRITE = 7, W_SAFE_FILL = 8,
|
|
W_APPLY_PREFETCH = 6, W_APPLY_WRITE = 7, W_SAFE_FILL = 8,
|
|
|
- W_COMMIT_WAIT = 9, W_STIM_COPY = 10;
|
|
|
|
|
|
|
+ W_COMMIT_WAIT = 9, W_STIM_COPY = 10,
|
|
|
|
|
+ W_SAFETY_PREFETCH = 11, W_SAFETY_CHECK = 12;
|
|
|
localparam [1:0] COMMIT_NONE = 0, COMMIT_MANUAL = 1,
|
|
localparam [1:0] COMMIT_NONE = 0, COMMIT_MANUAL = 1,
|
|
|
COMMIT_SAFE = 2, COMMIT_PID = 3;
|
|
COMMIT_SAFE = 2, COMMIT_PID = 3;
|
|
|
|
|
|
|
@@ -76,6 +79,9 @@ module thermal_control_core #(
|
|
|
reg [1:0] commit_kind;
|
|
reg [1:0] commit_kind;
|
|
|
reg [4:0] work_index;
|
|
reg [4:0] work_index;
|
|
|
reg [15:0] last_bmc_epoch;
|
|
reg [15:0] last_bmc_epoch;
|
|
|
|
|
+ reg [3:0] epoch_hard_mask;
|
|
|
|
|
+ reg [3:0] epoch_above_release_mask;
|
|
|
|
|
+ reg [1:0] lane_release_count [0:3];
|
|
|
reg manual_pending;
|
|
reg manual_pending;
|
|
|
reg safe_pending;
|
|
reg safe_pending;
|
|
|
reg stimulus_running;
|
|
reg stimulus_running;
|
|
@@ -109,13 +115,18 @@ module thermal_control_core #(
|
|
|
(work_index < 18) ? 2 : 3;
|
|
(work_index < 18) ? 2 : 3;
|
|
|
wire [1:0] output_lane = work_index[1:0];
|
|
wire [1:0] output_lane = work_index[1:0];
|
|
|
wire complete_valid_bmc = !bmc_stale && (&bmc_valid_mask);
|
|
wire complete_valid_bmc = !bmc_stale && (&bmc_valid_mask);
|
|
|
|
|
+ wire any_valid_bmc = !bmc_stale && (|bmc_valid_mask);
|
|
|
wire new_bmc_epoch = bmc_epoch != last_bmc_epoch;
|
|
wire new_bmc_epoch = bmc_epoch != last_bmc_epoch;
|
|
|
|
|
+ wire channel_over_76 = bmc_rd_valid && bmc_temperature >= CHANNEL_LIMIT;
|
|
|
|
|
+ wire channel_over_77 = bmc_rd_valid && bmc_temperature >= HARD_LIMIT;
|
|
|
|
|
+ wire channel_above_release = bmc_rd_valid && bmc_temperature > `FB_TEMP_LANE_RELEASE;
|
|
|
|
|
+ wire [3:0] channel_lane_bit = 4'b0001 << channel_lane;
|
|
|
|
|
|
|
|
assign bmc_rd_index = work_index;
|
|
assign bmc_rd_index = work_index;
|
|
|
assign stimulus_active = stimulus_running;
|
|
assign stimulus_active = stimulus_running;
|
|
|
- assign watchdog_active = control_state == BOOT_WAIT || control_state == MANUAL_SET_ALL;
|
|
|
|
|
- assign pid_running = control_state == PID_AUTO || control_state == HARD_PROTECT;
|
|
|
|
|
- assign manual_mode = control_state == MANUAL_SET_ALL;
|
|
|
|
|
|
|
+ assign watchdog_active = control_state == OWNER_SAFE || control_state == OWNER_MANUAL;
|
|
|
|
|
+ assign pid_running = control_state == OWNER_PID && complete_valid_bmc;
|
|
|
|
|
+ assign manual_mode = control_state == OWNER_MANUAL;
|
|
|
assign hard_protect = |lane_fault_mask;
|
|
assign hard_protect = |lane_fault_mask;
|
|
|
|
|
|
|
|
manual_set_all_bank u_manual_bank (
|
|
manual_set_all_bank u_manual_bank (
|
|
@@ -155,7 +166,7 @@ module thermal_control_core #(
|
|
|
always @(posedge clk or negedge rst_n) begin
|
|
always @(posedge clk or negedge rst_n) begin
|
|
|
if (!rst_n) begin
|
|
if (!rst_n) begin
|
|
|
active_output_bank <= 0;
|
|
active_output_bank <= 0;
|
|
|
- control_state <= BOOT_WAIT;
|
|
|
|
|
|
|
+ control_state <= OWNER_SAFE;
|
|
|
current_target_celsius <= `DEFAULT_PID_TARGET_C;
|
|
current_target_celsius <= `DEFAULT_PID_TARGET_C;
|
|
|
control_epoch <= 0;
|
|
control_epoch <= 0;
|
|
|
safety_override_mask <= 0;
|
|
safety_override_mask <= 0;
|
|
@@ -163,12 +174,14 @@ module thermal_control_core #(
|
|
|
global_fault <= 0;
|
|
global_fault <= 0;
|
|
|
output_commit <= 0;
|
|
output_commit <= 0;
|
|
|
manual_commit_done <= 0;
|
|
manual_commit_done <= 0;
|
|
|
- watchdog_remaining <= WATCHDOG_SECONDS;
|
|
|
|
|
|
|
+ watchdog_remaining <= WATCHDOG_LOAD;
|
|
|
boot_init_complete <= 0;
|
|
boot_init_complete <= 0;
|
|
|
work_state <= W_INIT;
|
|
work_state <= W_INIT;
|
|
|
commit_kind <= COMMIT_NONE;
|
|
commit_kind <= COMMIT_NONE;
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
last_bmc_epoch <= 0;
|
|
last_bmc_epoch <= 0;
|
|
|
|
|
+ epoch_hard_mask <= 0;
|
|
|
|
|
+ epoch_above_release_mask <= 0;
|
|
|
manual_pending <= 0;
|
|
manual_pending <= 0;
|
|
|
safe_pending <= 0;
|
|
safe_pending <= 0;
|
|
|
stimulus_running <= 0;
|
|
stimulus_running <= 0;
|
|
@@ -182,6 +195,7 @@ module thermal_control_core #(
|
|
|
output_control_data <= 0;
|
|
output_control_data <= 0;
|
|
|
output_control_read_addr <= 0;
|
|
output_control_read_addr <= 0;
|
|
|
for (i = 0; i < 24; i = i + 1) pi_integral[i] <= 0;
|
|
for (i = 0; i < 24; i = i + 1) pi_integral[i] <= 0;
|
|
|
|
|
+ for (i = 0; i < 4; i = i + 1) lane_release_count[i] <= 0;
|
|
|
end else begin
|
|
end else begin
|
|
|
output_commit <= 0;
|
|
output_commit <= 0;
|
|
|
manual_commit_done <= 0;
|
|
manual_commit_done <= 0;
|
|
@@ -207,7 +221,7 @@ module thermal_control_core #(
|
|
|
|
|
|
|
|
// SET_ALL acceptance dominates a simultaneous final watchdog tick.
|
|
// SET_ALL acceptance dominates a simultaneous final watchdog tick.
|
|
|
if (manual_commit_applied) begin
|
|
if (manual_commit_applied) begin
|
|
|
- watchdog_remaining <= WATCHDOG_SECONDS;
|
|
|
|
|
|
|
+ watchdog_remaining <= WATCHDOG_LOAD;
|
|
|
end else if (watchdog_active && tick_1s && !manual_pending) begin
|
|
end else if (watchdog_active && tick_1s && !manual_pending) begin
|
|
|
if (watchdog_remaining > 1)
|
|
if (watchdog_remaining > 1)
|
|
|
watchdog_remaining <= watchdog_remaining - 1'b1;
|
|
watchdog_remaining <= watchdog_remaining - 1'b1;
|
|
@@ -222,7 +236,6 @@ module thermal_control_core #(
|
|
|
output_init_write <= 1;
|
|
output_init_write <= 1;
|
|
|
output_init_addr <= work_index;
|
|
output_init_addr <= work_index;
|
|
|
output_init_data <= (work_index < 24) ? 16'h0000 : {FAN_SAFE_DUTY, FAN_SAFE_DUTY};
|
|
output_init_data <= (work_index < 24) ? 16'h0000 : {FAN_SAFE_DUTY, FAN_SAFE_DUTY};
|
|
|
- if (work_index < 24) pi_integral[work_index] <= 0;
|
|
|
|
|
if (work_index == 31) begin
|
|
if (work_index == 31) begin
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
work_state <= W_IDLE;
|
|
work_state <= W_IDLE;
|
|
@@ -233,8 +246,6 @@ module thermal_control_core #(
|
|
|
if (manual_pending) begin
|
|
if (manual_pending) begin
|
|
|
manual_pending <= 0;
|
|
manual_pending <= 0;
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
- control_state <= MANUAL_SET_ALL;
|
|
|
|
|
- safety_override_mask <= 0;
|
|
|
|
|
global_fault <= 0;
|
|
global_fault <= 0;
|
|
|
commit_kind <= COMMIT_MANUAL;
|
|
commit_kind <= COMMIT_MANUAL;
|
|
|
work_state <= W_MANUAL_COPY;
|
|
work_state <= W_MANUAL_COPY;
|
|
@@ -247,32 +258,89 @@ module thermal_control_core #(
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
commit_kind <= COMMIT_MANUAL;
|
|
commit_kind <= COMMIT_MANUAL;
|
|
|
work_state <= W_STIM_COPY;
|
|
work_state <= W_STIM_COPY;
|
|
|
- end else if ((control_state == PID_AUTO || control_state == HARD_PROTECT) && bmc_stale) begin
|
|
|
|
|
|
|
+ end else if (control_state == OWNER_PID && bmc_stale) begin
|
|
|
global_fault <= 1;
|
|
global_fault <= 1;
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
commit_kind <= COMMIT_SAFE;
|
|
commit_kind <= COMMIT_SAFE;
|
|
|
work_state <= W_SAFE_FILL;
|
|
work_state <= W_SAFE_FILL;
|
|
|
- end else if (control_state == PID_WAIT_SENSOR && complete_valid_bmc && new_bmc_epoch) begin
|
|
|
|
|
|
|
+ end else if (any_valid_bmc && new_bmc_epoch) begin
|
|
|
last_bmc_epoch <= bmc_epoch;
|
|
last_bmc_epoch <= bmc_epoch;
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
safety_override_mask <= 0;
|
|
safety_override_mask <= 0;
|
|
|
|
|
+ epoch_hard_mask <= 0;
|
|
|
|
|
+ epoch_above_release_mask <= 0;
|
|
|
global_fault <= 0;
|
|
global_fault <= 0;
|
|
|
- work_state <= W_PID_PREFETCH;
|
|
|
|
|
- end else if ((control_state == PID_AUTO || control_state == HARD_PROTECT) &&
|
|
|
|
|
- complete_valid_bmc && new_bmc_epoch) begin
|
|
|
|
|
- last_bmc_epoch <= bmc_epoch;
|
|
|
|
|
|
|
+ work_state <= W_SAFETY_PREFETCH;
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+ W_SAFETY_PREFETCH: begin
|
|
|
|
|
+ work_state <= W_SAFETY_CHECK;
|
|
|
|
|
+ end
|
|
|
|
|
+ W_SAFETY_CHECK: begin
|
|
|
|
|
+ if (channel_over_76)
|
|
|
|
|
+ safety_override_mask[work_index] <= 1;
|
|
|
|
|
+ if (channel_over_77)
|
|
|
|
|
+ epoch_hard_mask <= epoch_hard_mask | channel_lane_bit;
|
|
|
|
|
+ if (channel_above_release)
|
|
|
|
|
+ epoch_above_release_mask <= epoch_above_release_mask | channel_lane_bit;
|
|
|
|
|
+ if (work_index == 23) begin
|
|
|
|
|
+ for (i = 0; i < 4; i = i + 1) begin
|
|
|
|
|
+ if ((((epoch_hard_mask |
|
|
|
|
|
+ (channel_over_77 ? channel_lane_bit : 4'd0)) >> i) & 4'd1) != 0) begin
|
|
|
|
|
+ lane_fault_mask[i] <= 1;
|
|
|
|
|
+ lane_release_count[i] <= 0;
|
|
|
|
|
+ safety_override_mask[i*6 +: 6] <= 6'h3F;
|
|
|
|
|
+ end else if (lane_fault_mask[i]) begin
|
|
|
|
|
+ if (!complete_valid_bmc ||
|
|
|
|
|
+ ((((epoch_above_release_mask |
|
|
|
|
|
+ (channel_above_release ? channel_lane_bit : 4'd0)) >> i) & 4'd1) != 0)) begin
|
|
|
|
|
+ lane_release_count[i] <= 0;
|
|
|
|
|
+ safety_override_mask[i*6 +: 6] <= 6'h3F;
|
|
|
|
|
+ end else if (lane_release_count[i] == 2) begin
|
|
|
|
|
+ lane_fault_mask[i] <= 0;
|
|
|
|
|
+ lane_release_count[i] <= 0;
|
|
|
|
|
+ end else begin
|
|
|
|
|
+ lane_release_count[i] <= lane_release_count[i] + 1'b1;
|
|
|
|
|
+ safety_override_mask[i*6 +: 6] <= 6'h3F;
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
- safety_override_mask <= 0;
|
|
|
|
|
- global_fault <= 0;
|
|
|
|
|
- work_state <= W_PID_PREFETCH;
|
|
|
|
|
|
|
+ if (|lane_fault_mask || |epoch_hard_mask || channel_over_77) begin
|
|
|
|
|
+ control_state <= OWNER_PID;
|
|
|
|
|
+ commit_kind <= COMMIT_SAFE;
|
|
|
|
|
+ work_state <= W_SAFE_FILL;
|
|
|
|
|
+ end else if (control_state == OWNER_PID && complete_valid_bmc) begin
|
|
|
|
|
+ work_state <= W_PID_PREFETCH;
|
|
|
|
|
+ end else if (control_state == OWNER_PID) begin
|
|
|
|
|
+ commit_kind <= COMMIT_SAFE;
|
|
|
|
|
+ work_state <= W_SAFE_FILL;
|
|
|
|
|
+ end else if (control_state == OWNER_MANUAL) begin
|
|
|
|
|
+ commit_kind <= COMMIT_NONE;
|
|
|
|
|
+ output_control_read_addr <= 0;
|
|
|
|
|
+ work_state <= W_APPLY_PREFETCH;
|
|
|
|
|
+ end else begin
|
|
|
|
|
+ work_state <= W_IDLE;
|
|
|
|
|
+ end
|
|
|
|
|
+ end else begin
|
|
|
|
|
+ work_index <= work_index + 1'b1;
|
|
|
|
|
+ work_state <= W_SAFETY_PREFETCH;
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
W_MANUAL_COPY, W_STIM_COPY: begin
|
|
W_MANUAL_COPY, W_STIM_COPY: begin
|
|
|
output_control_write <= 1;
|
|
output_control_write <= 1;
|
|
|
output_control_addr <= work_index;
|
|
output_control_addr <= work_index;
|
|
|
- output_control_data <= {(work_state == W_MANUAL_COPY) ? manual_data : stimulus_data,
|
|
|
|
|
- (work_state == W_MANUAL_COPY) ? manual_data : stimulus_data};
|
|
|
|
|
- if (work_index < 24) pi_integral[work_index] <= 0;
|
|
|
|
|
|
|
+ if (work_index < 24)
|
|
|
|
|
+ output_control_data <= {
|
|
|
|
|
+ (work_state == W_MANUAL_COPY) ? manual_data : stimulus_data,
|
|
|
|
|
+ (lane_fault_mask[channel_lane] ||
|
|
|
|
|
+ (!bmc_stale && safety_override_mask[work_index])) ? 8'd0 :
|
|
|
|
|
+ ((work_state == W_MANUAL_COPY) ? manual_data : stimulus_data)};
|
|
|
|
|
+ else
|
|
|
|
|
+ output_control_data <= {
|
|
|
|
|
+ (work_state == W_MANUAL_COPY) ? manual_data : stimulus_data,
|
|
|
|
|
+ lane_fault_mask[output_lane] ? 8'd100 :
|
|
|
|
|
+ ((work_state == W_MANUAL_COPY) ? manual_data : stimulus_data)};
|
|
|
if (work_index == 31) begin
|
|
if (work_index == 31) begin
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
work_state <= W_COMMIT_WAIT;
|
|
work_state <= W_COMMIT_WAIT;
|
|
@@ -281,7 +349,8 @@ module thermal_control_core #(
|
|
|
W_SAFE_FILL: begin
|
|
W_SAFE_FILL: begin
|
|
|
output_control_write <= 1;
|
|
output_control_write <= 1;
|
|
|
output_control_addr <= work_index;
|
|
output_control_addr <= work_index;
|
|
|
- output_control_data <= (work_index < 24) ? 16'h0000 : {FAN_SAFE_DUTY, FAN_SAFE_DUTY};
|
|
|
|
|
|
|
+ output_control_data <= (work_index < 24) ? 16'h0000 :
|
|
|
|
|
+ {FAN_SAFE_DUTY, lane_fault_mask[output_lane] ? 8'd100 : FAN_SAFE_DUTY};
|
|
|
if (work_index < 24) pi_integral[work_index] <= 0;
|
|
if (work_index < 24) pi_integral[work_index] <= 0;
|
|
|
if (work_index == 31) begin
|
|
if (work_index == 31) begin
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
@@ -298,11 +367,6 @@ module thermal_control_core #(
|
|
|
output_control_data <= 16'h0000;
|
|
output_control_data <= 16'h0000;
|
|
|
safety_override_mask[work_index] <= 1;
|
|
safety_override_mask[work_index] <= 1;
|
|
|
pi_integral[work_index] <= 0;
|
|
pi_integral[work_index] <= 0;
|
|
|
- end else if (bmc_temperature >= HARD_LIMIT) begin
|
|
|
|
|
- output_control_data <= 16'h0000;
|
|
|
|
|
- safety_override_mask[work_index] <= 1;
|
|
|
|
|
- lane_fault_mask[channel_lane] <= 1;
|
|
|
|
|
- pi_integral[work_index] <= 0;
|
|
|
|
|
end else begin
|
|
end else begin
|
|
|
output_control_data <= {pid_duty, pid_duty};
|
|
output_control_data <= {pid_duty, pid_duty};
|
|
|
pi_integral[work_index] <= (pid_sum <= 0) ? 0 : (pid_sum >= 100) ? 100 : pid_sum[15:0];
|
|
pi_integral[work_index] <= (pid_sum <= 0) ? 0 : (pid_sum >= 100) ? 100 : pid_sum[15:0];
|
|
@@ -318,7 +382,8 @@ module thermal_control_core #(
|
|
|
W_FAN_WRITE: begin
|
|
W_FAN_WRITE: begin
|
|
|
output_control_write <= 1;
|
|
output_control_write <= 1;
|
|
|
output_control_addr <= work_index;
|
|
output_control_addr <= work_index;
|
|
|
- output_control_data <= {8'd30, lane_fault_mask[output_lane] ? 8'd100 : 8'd30};
|
|
|
|
|
|
|
+ output_control_data <= {FAN_SAFE_DUTY,
|
|
|
|
|
+ lane_fault_mask[output_lane] ? 8'd100 : FAN_SAFE_DUTY};
|
|
|
if (work_index == 31) begin
|
|
if (work_index == 31) begin
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
output_control_read_addr <= 0;
|
|
output_control_read_addr <= 0;
|
|
@@ -332,15 +397,23 @@ module thermal_control_core #(
|
|
|
W_APPLY_WRITE: begin
|
|
W_APPLY_WRITE: begin
|
|
|
output_control_write <= 1;
|
|
output_control_write <= 1;
|
|
|
output_control_addr <= work_index;
|
|
output_control_addr <= work_index;
|
|
|
- if (work_index < 24)
|
|
|
|
|
|
|
+ if (work_index < 24 && control_state == OWNER_MANUAL)
|
|
|
|
|
+ output_control_data <= {manual_data,
|
|
|
|
|
+ (lane_fault_mask[channel_lane] || safety_override_mask[work_index]) ?
|
|
|
|
|
+ 8'd0 : manual_data};
|
|
|
|
|
+ else if (work_index < 24)
|
|
|
output_control_data <= {output_control_requested,
|
|
output_control_data <= {output_control_requested,
|
|
|
- lane_fault_mask[channel_lane] ? 8'd0 : output_control_requested};
|
|
|
|
|
|
|
+ (lane_fault_mask[channel_lane] || safety_override_mask[work_index]) ?
|
|
|
|
|
+ 8'd0 : output_control_requested};
|
|
|
|
|
+ else if (control_state == OWNER_MANUAL)
|
|
|
|
|
+ output_control_data <= {manual_data,
|
|
|
|
|
+ lane_fault_mask[output_lane] ? 8'd100 : manual_data};
|
|
|
else
|
|
else
|
|
|
output_control_data <= {output_control_requested,
|
|
output_control_data <= {output_control_requested,
|
|
|
lane_fault_mask[output_lane] ? 8'd100 : output_control_requested};
|
|
lane_fault_mask[output_lane] ? 8'd100 : output_control_requested};
|
|
|
if (work_index == 31) begin
|
|
if (work_index == 31) begin
|
|
|
work_index <= 0;
|
|
work_index <= 0;
|
|
|
- commit_kind <= COMMIT_PID;
|
|
|
|
|
|
|
+ commit_kind <= (control_state == OWNER_PID) ? COMMIT_PID : COMMIT_NONE;
|
|
|
work_state <= W_COMMIT_WAIT;
|
|
work_state <= W_COMMIT_WAIT;
|
|
|
end else begin
|
|
end else begin
|
|
|
work_index <= work_index + 1'b1;
|
|
work_index <= work_index + 1'b1;
|
|
@@ -354,13 +427,13 @@ module thermal_control_core #(
|
|
|
control_epoch <= control_epoch + 1'b1;
|
|
control_epoch <= control_epoch + 1'b1;
|
|
|
if (commit_kind == COMMIT_MANUAL) begin
|
|
if (commit_kind == COMMIT_MANUAL) begin
|
|
|
manual_commit_done <= 1;
|
|
manual_commit_done <= 1;
|
|
|
- control_state <= MANUAL_SET_ALL;
|
|
|
|
|
- watchdog_remaining <= WATCHDOG_SECONDS;
|
|
|
|
|
|
|
+ control_state <= OWNER_MANUAL;
|
|
|
|
|
+ watchdog_remaining <= WATCHDOG_LOAD;
|
|
|
end else if (commit_kind == COMMIT_SAFE) begin
|
|
end else if (commit_kind == COMMIT_SAFE) begin
|
|
|
- control_state <= PID_WAIT_SENSOR;
|
|
|
|
|
|
|
+ control_state <= OWNER_PID;
|
|
|
watchdog_remaining <= 0;
|
|
watchdog_remaining <= 0;
|
|
|
- end else begin
|
|
|
|
|
- control_state <= (|lane_fault_mask) ? HARD_PROTECT : PID_AUTO;
|
|
|
|
|
|
|
+ end else if (commit_kind == COMMIT_PID) begin
|
|
|
|
|
+ control_state <= OWNER_PID;
|
|
|
end
|
|
end
|
|
|
commit_kind <= COMMIT_NONE;
|
|
commit_kind <= COMMIT_NONE;
|
|
|
work_state <= W_IDLE;
|
|
work_state <= W_IDLE;
|