Jelajahi Sumber

fix(6400): prove atomic boot-safe fan release

root 3 bulan lalu
induk
melakukan
570074a6da

+ 1 - 0
products/6400-control/source-closure.json

@@ -23,6 +23,7 @@
     "src/control/thermal_output_banks.v",
     "src/control/thermal_output_banks.v",
     "src/control/thermal_control_core.v",
     "src/control/thermal_control_core.v",
     "src/actuator/pwm_bitmap_engine.v",
     "src/actuator/pwm_bitmap_engine.v",
+    "src/actuator/fan_boot_safety_controller.v",
     "src/actuator/fan_board_output_adapter.v",
     "src/actuator/fan_board_output_adapter.v",
     "src/telemetry/thermal_snapshot_mux.v",
     "src/telemetry/thermal_snapshot_mux.v",
     "src/top/prod2u_6400_v1_top.v",
     "src/top/prod2u_6400_v1_top.v",

+ 25 - 0
src/actuator/fan_boot_safety_controller.v

@@ -0,0 +1,25 @@
+`timescale 1ns/1ps
+
+// Samples boot completion and fault state only on the common PWM boundary.
+// Reset keeps the board adapter in its full-speed request state.
+module fan_boot_safety_controller (
+    input  wire clk,
+    input  wire rst_n,
+    input  wire pwm_boundary_advance,
+    input  wire boot_init_complete,
+    input  wire bmc_stale,
+    input  wire global_fault,
+    output reg  boot_release,
+    output reg  force_full_speed
+);
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            boot_release <= 1'b0;
+            force_full_speed <= 1'b1;
+        end else if (pwm_boundary_advance) begin
+            if (boot_init_complete)
+                boot_release <= 1'b1;
+            force_full_speed <= bmc_stale || global_fault;
+        end
+    end
+endmodule

+ 90 - 1
src/control/thermal_control_core.v

@@ -624,6 +624,8 @@ module thermal_control_core #(
         formal_app1[formal_duty_index] : formal_app0[formal_duty_index];
         formal_app1[formal_duty_index] : formal_app0[formal_duty_index];
     wire [7:0] formal_inactive_applied = active_output_bank ?
     wire [7:0] formal_inactive_applied = active_output_bank ?
         formal_app0[formal_duty_index] : formal_app1[formal_duty_index];
         formal_app0[formal_duty_index] : formal_app1[formal_duty_index];
+    wire [7:0] formal_boot_output = (formal_duty_index < 24) ?
+        8'd0 : FAN_STANDBY_DUTY;
     wire [7:0] formal_safe_fill_value = (formal_duty_index < 24) ? 8'd0 :
     wire [7:0] formal_safe_fill_value = (formal_duty_index < 24) ? 8'd0 :
         ((global_fault || lane_fault_for_output(formal_duty_index) ||
         ((global_fault || lane_fault_for_output(formal_duty_index) ||
           lane_invalid(lane_for_output(formal_duty_index))) ?
           lane_invalid(lane_for_output(formal_duty_index))) ?
@@ -712,7 +714,9 @@ module thermal_control_core #(
             // the deterministic RAM scrub inductive even when the solver
             // the deterministic RAM scrub inductive even when the solver
             // starts an induction window in the middle of that sweep.
             // starts an induction window in the middle of that sweep.
             if (work_state == W_INIT) begin
             if (work_state == W_INIT) begin
+                assert(active_output_bank == 0);
                 assert(control_state == RESET_SAFE);
                 assert(control_state == RESET_SAFE);
+                assert(!boot_init_complete);
                 assert(safety_override_mask == 0);
                 assert(safety_override_mask == 0);
                 assert(ptc_shutdown_mask == 0);
                 assert(ptc_shutdown_mask == 0);
                 assert(thermal_protection_mask == 0);
                 assert(thermal_protection_mask == 0);
@@ -738,6 +742,33 @@ module thermal_control_core #(
                     end
                     end
                 end
                 end
             end
             end
+            // W_BOOT_WAIT is reachable only after W_INIT has scrubbed every
+            // address in both output banks and every PI-state address.  State
+            // induction may otherwise invent a half-initialized boot state,
+            // so record the complete state established by that sweep.
+            if (work_state == W_BOOT_WAIT) begin
+                assert(work_index == 0);
+                assert(active_output_bank == 0);
+                assert(control_state == RESET_SAFE);
+                assert(!boot_init_complete);
+                assert(safety_override_mask == 0);
+                assert(ptc_shutdown_mask == 0);
+                assert(thermal_protection_mask == 0);
+                assert(lane_fault_mask == 0);
+                assert(!global_fault);
+                assert(invalid_count0 == 0);
+                assert(invalid_count1 == 0);
+                assert(invalid_count2 == 0);
+                assert(invalid_count3 == 0);
+                assert(formal_req0[formal_duty_index] == formal_boot_output);
+                assert(formal_req1[formal_duty_index] == formal_boot_output);
+                assert(formal_app0[formal_duty_index] == formal_boot_output);
+                assert(formal_app1[formal_duty_index] == formal_boot_output);
+                if (formal_duty_index < 24) begin
+                    assert(formal_previous_error[formal_duty_index] == 0);
+                    assert(formal_previous_output[formal_duty_index] == 0);
+                end
+            end
             // Reset-age stale must not bypass CT/preheat startup sequencing.
             // Reset-age stale must not bypass CT/preheat startup sequencing.
             if (bmc_stale && (control_state == RESET_SAFE ||
             if (bmc_stale && (control_state == RESET_SAFE ||
                               control_state == WAIT_CT_VALID ||
                               control_state == WAIT_CT_VALID ||
@@ -779,6 +810,29 @@ module thermal_control_core #(
                     assert(formal_inactive_applied == 80);
                     assert(formal_inactive_applied == 80);
             end
             end
 
 
+            // The complete inactive bank remains safe while waiting for the
+            // PWM scanner to become idle. This is the inductive bridge from
+            // the fill/apply sweep to the atomic active-bank pointer flip.
+            if (work_state == W_COMMIT_WAIT) begin
+                if (formal_duty_index < 24 &&
+                    (global_fault || control_state == STOPPED ||
+                     ptc_shutdown_mask[formal_duty_index] ||
+                     lane_fault_mask[lane_for_channel(formal_duty_index)] ||
+                     lane_invalid(lane_for_channel(formal_duty_index))))
+                    assert(formal_inactive_applied == 0);
+                if (formal_duty_index >= 24 &&
+                    (global_fault ||
+                     lane_fault_for_output(formal_duty_index) ||
+                     lane_invalid(lane_for_output(formal_duty_index))))
+                    assert(formal_inactive_applied == 100);
+                if (formal_duty_index >= 24 &&
+                    !global_fault &&
+                    !lane_fault_for_output(formal_duty_index) &&
+                    !lane_invalid(lane_for_output(formal_duty_index)) &&
+                    lane_thermal_protection(lane_for_output(formal_duty_index)))
+                    assert(formal_inactive_applied == 80);
+            end
+
             // Once a safety pass has committed, the active bank itself (not
             // Once a safety pass has committed, the active bank itself (not
             // merely the combinational apply value) is safe.  W_IDLE is the
             // merely the combinational apply value) is safe.  W_IDLE is the
             // post-commit quiescent point, so these assertions compose the
             // post-commit quiescent point, so these assertions compose the
@@ -804,9 +858,44 @@ module thermal_control_core #(
             end
             end
             if (formal_past_valid && $past(rst_n)) begin
             if (formal_past_valid && $past(rst_n)) begin
                 if ($past(formal_scheduler_rank) != 0 &&
                 if ($past(formal_scheduler_rank) != 0 &&
-                    !$past(target_commit) && !$past(formal_stale_preempt))
+                    !$past(target_commit) && !$past(formal_stale_preempt) &&
+                    !($past(work_state) == W_COMMIT_WAIT &&
+                      !$past(pwm_scan_idle)) &&
+                    !($past(work_state) == W_BOOT_WAIT &&
+                      !$past(pwm_phase_boundary)))
                     assert(formal_scheduler_rank < $past(formal_scheduler_rank));
                     assert(formal_scheduler_rank < $past(formal_scheduler_rank));
 
 
+                // The applied-output bank is a single atomic pointer commit.
+                // It cannot move while the PWM scan owns the active bank.
+                if (active_output_bank != $past(active_output_bank)) begin
+                    assert(output_commit);
+                    assert($past(work_state) == W_COMMIT_WAIT);
+                    assert($past(pwm_scan_idle));
+                end
+                if (output_commit) begin
+                    assert(active_output_bank != $past(active_output_bank));
+                    assert($past(work_state) == W_COMMIT_WAIT);
+                    assert($past(pwm_scan_idle));
+                end else begin
+                    assert(active_output_bank == $past(active_output_bank));
+                end
+                if ($past(work_state) == W_COMMIT_WAIT &&
+                    !$past(pwm_scan_idle) && !$past(target_commit) &&
+                    !$past(formal_stale_preempt)) begin
+                    assert(work_state == W_COMMIT_WAIT);
+                    assert(!output_commit);
+                    assert(active_output_bank == $past(active_output_bank));
+                end
+
+                // Boot visibility follows the completed RAM fill and a full
+                // PWM boundary. Once visible it is sticky until reset.
+                if (boot_init_complete && !$past(boot_init_complete)) begin
+                    assert($past(work_state) == W_BOOT_WAIT);
+                    assert($past(pwm_phase_boundary));
+                end
+                if ($past(boot_init_complete))
+                    assert(boot_init_complete);
+
                 // P03: a newly observed stale source starts the bounded safe
                 // P03: a newly observed stale source starts the bounded safe
                 // fill at address zero and latches the global fault.  The rank
                 // fill at address zero and latches the global fault.  The rank
                 // invariant above forces that fill to reach the safe commit.
                 // invariant above forces that fill to reach the safe commit.

+ 12 - 15
src/top/prod2u_6400_v1_top.v

@@ -154,8 +154,8 @@ module prod2u_6400_v1_top #(
     wire output_commit;
     wire output_commit;
     wire stimulus_active;
     wire stimulus_active;
     wire boot_init_complete;
     wire boot_init_complete;
-    reg boot_fan_release;
-    reg fan_force_full_speed;
+    wire boot_fan_release;
+    wire fan_force_full_speed;
     wire [15:0] fault_flags = {8'd0, pwm_deadline_miss, bmc_parser_error, ct_stale,
     wire [15:0] fault_flags = {8'd0, pwm_deadline_miss, bmc_parser_error, ct_stale,
         bmc_stale, global_fault, |lane_fault_mask, host_rx_error, bmc_rx_error};
         bmc_stale, global_fault, |lane_fault_mask, host_rx_error, bmc_rx_error};
 
 
@@ -163,19 +163,16 @@ module prod2u_6400_v1_top #(
     assign temp_sda = ct_sda_drive_low ? 1'b0 : 1'bz;
     assign temp_sda = ct_sda_drive_low ? 1'b0 : 1'bz;
     assign ptc_pwm_out = logical_bitmap[23:0];
     assign ptc_pwm_out = logical_bitmap[23:0];
 
 
-    // Boot release and the asynchronous-looking stale flag are sampled only
-    // at the common PWM boundary so physical fan pins never acquire a narrow
-    // pulse. Reset requests full fan speed: front balls low, rear balls high.
-    always @(posedge sys_clk or negedge rst_n) begin
-        if (!rst_n) begin
-            boot_fan_release <= 1'b0;
-            fan_force_full_speed <= 1'b1;
-        end else if (pwm_boundary_advance) begin
-            if (boot_init_complete)
-                boot_fan_release <= 1'b1;
-            fan_force_full_speed <= bmc_stale || global_fault;
-        end
-    end
+    // Boot release and fault state are sampled only at the common PWM
+    // boundary so the physical fan pins never acquire a narrow pulse.
+    fan_boot_safety_controller u_fan_boot_safety (
+        .clk(sys_clk), .rst_n(rst_n),
+        .pwm_boundary_advance(pwm_boundary_advance),
+        .boot_init_complete(boot_init_complete),
+        .bmc_stale(bmc_stale), .global_fault(global_fault),
+        .boot_release(boot_fan_release),
+        .force_full_speed(fan_force_full_speed)
+    );
 
 
     fan_board_output_adapter #(.BOARD_INVERT_MASK(`FAN_BOARD_INVERT_MASK)) u_fan_board_adapter (
     fan_board_output_adapter #(.BOARD_INVERT_MASK(`FAN_BOARD_INVERT_MASK)) u_fan_board_adapter (
         .logical_fan_on(logical_bitmap[31:24]),
         .logical_fan_on(logical_bitmap[31:24]),

+ 1 - 0
td/syn/prod2u_6400_front_back.tcl

@@ -38,6 +38,7 @@ analyze_src {src/acquisition/ct7428_snapshot.v}
 analyze_src {src/control/thermal_output_banks.v}
 analyze_src {src/control/thermal_output_banks.v}
 analyze_src {src/control/thermal_control_core.v}
 analyze_src {src/control/thermal_control_core.v}
 analyze_src {src/actuator/pwm_bitmap_engine.v}
 analyze_src {src/actuator/pwm_bitmap_engine.v}
+analyze_src {src/actuator/fan_boot_safety_controller.v}
 analyze_src {src/actuator/fan_board_output_adapter.v}
 analyze_src {src/actuator/fan_board_output_adapter.v}
 analyze_src {src/telemetry/thermal_snapshot_mux.v}
 analyze_src {src/telemetry/thermal_snapshot_mux.v}
 analyze_src {src/top/prod2u_6400_v1_top.v}
 analyze_src {src/top/prod2u_6400_v1_top.v}

+ 1 - 0
td/syn/prod2u_6400_identification.tcl

@@ -39,6 +39,7 @@ analyze_src {src/acquisition/ct7428_snapshot.v}
 analyze_src {src/control/thermal_output_banks.v}
 analyze_src {src/control/thermal_output_banks.v}
 analyze_src {src/control/thermal_control_core.v}
 analyze_src {src/control/thermal_control_core.v}
 analyze_src {src/actuator/pwm_bitmap_engine.v}
 analyze_src {src/actuator/pwm_bitmap_engine.v}
+analyze_src {src/actuator/fan_boot_safety_controller.v}
 analyze_src {src/actuator/fan_board_output_adapter.v}
 analyze_src {src/actuator/fan_board_output_adapter.v}
 analyze_src {src/telemetry/thermal_snapshot_mux.v}
 analyze_src {src/telemetry/thermal_snapshot_mux.v}
 analyze_src {src/top/prod2u_6400_v1_top.v}
 analyze_src {src/top/prod2u_6400_v1_top.v}

+ 5 - 3
tests/formal/6400-properties.json

@@ -6,14 +6,16 @@
     {"name": "transport", "sby": "6400_transport_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 8},
     {"name": "transport", "sby": "6400_transport_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 8},
     {"name": "bmc_bank", "sby": "6400_bmc_bank_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 8},
     {"name": "bmc_bank", "sby": "6400_bmc_bank_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 8},
     {"name": "snapshot", "sby": "6400_snapshot_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 4},
     {"name": "snapshot", "sby": "6400_snapshot_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 4},
-    {"name": "pwm", "sby": "6400_pwm_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 8}
+    {"name": "pwm", "sby": "6400_pwm_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 8},
+    {"name": "boot_output", "sby": "6400_boot_output_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 8}
   ],
   ],
   "cover_targets": [
   "cover_targets": [
     {"name": "core_reachability", "sby": "6400_core_reachability.sby", "tasks": [], "mode": "cover", "depth": 220, "witnesses": ["P02", "P03", "P04", "P05", "P10", "P12", "P13", "P16"]},
     {"name": "core_reachability", "sby": "6400_core_reachability.sby", "tasks": [], "mode": "cover", "depth": 220, "witnesses": ["P02", "P03", "P04", "P05", "P10", "P12", "P13", "P16"]},
     {"name": "transport_reachability", "sby": "6400_transport_reachability.sby", "tasks": [], "mode": "cover", "depth": 128, "witnesses": ["P06", "P07", "P15"]},
     {"name": "transport_reachability", "sby": "6400_transport_reachability.sby", "tasks": [], "mode": "cover", "depth": 128, "witnesses": ["P06", "P07", "P15"]},
     {"name": "bmc_bank_reachability", "sby": "6400_bmc_bank_reachability.sby", "tasks": [], "mode": "cover", "depth": 128, "witnesses": ["P08", "P09"]},
     {"name": "bmc_bank_reachability", "sby": "6400_bmc_bank_reachability.sby", "tasks": [], "mode": "cover", "depth": 128, "witnesses": ["P08", "P09"]},
     {"name": "snapshot_reachability", "sby": "6400_snapshot_reachability.sby", "tasks": [], "mode": "cover", "depth": 8, "witnesses": ["P14"]},
     {"name": "snapshot_reachability", "sby": "6400_snapshot_reachability.sby", "tasks": [], "mode": "cover", "depth": 8, "witnesses": ["P14"]},
-    {"name": "pwm_reachability", "sby": "6400_pwm_reachability.sby", "tasks": [], "mode": "cover", "depth": 505, "witnesses": ["P11"]}
+    {"name": "pwm_reachability", "sby": "6400_pwm_reachability.sby", "tasks": [], "mode": "cover", "depth": 505, "witnesses": ["P11"]},
+    {"name": "boot_output_reachability", "sby": "6400_boot_output_reachability.sby", "tasks": [], "mode": "cover", "depth": 12, "witnesses": ["P17"]}
   ],
   ],
   "properties": [
   "properties": [
     {"id": "P01", "requirement": "Duty always remains in 0..100", "harness": "6400_core_properties.sby"},
     {"id": "P01", "requirement": "Duty always remains in 0..100", "harness": "6400_core_properties.sby"},
@@ -32,6 +34,6 @@
     {"id": "P14", "requirement": "Snapshot never mixes epochs or banks", "harness": "6400_snapshot_properties.sby"},
     {"id": "P14", "requirement": "Snapshot never mixes epochs or banks", "harness": "6400_snapshot_properties.sby"},
     {"id": "P15", "requirement": "Host port selection is stable for one lock", "harness": "6400_transport_properties.sby"},
     {"id": "P15", "requirement": "Host port selection is stable for one lock", "harness": "6400_transport_properties.sby"},
     {"id": "P16", "requirement": "STOPPED never heats after safe commit", "harness": "6400_core_properties.sby"},
     {"id": "P16", "requirement": "STOPPED never heats after safe commit", "harness": "6400_core_properties.sby"},
-    {"id": "P17", "requirement": "Reset outputs are safe", "harness": "6400_core_properties.sby"}
+    {"id": "P17", "requirement": "Reset and boot keep fan pins at full-speed request until an initialized PWM-boundary release", "harness": "6400_boot_output_properties.sby"}
   ]
   ]
 }
 }

+ 21 - 0
tests/formal/6400_boot_output_properties.sby

@@ -0,0 +1,21 @@
+[tasks]
+boolector
+z3
+
+[options]
+mode prove
+depth 8
+
+[engines]
+boolector: smtbmc boolector
+z3: smtbmc z3 -- --noincr
+
+[script]
+read_verilog -formal fan_boot_safety_controller.v fan_board_output_adapter.v
+read_verilog -formal 6400_boot_output_properties_formal.v
+prep -top thermal_6400_boot_output_properties_formal
+
+[files]
+../../src/actuator/fan_boot_safety_controller.v
+../../src/actuator/fan_board_output_adapter.v
+6400_boot_output_properties_formal.v

+ 70 - 0
tests/formal/6400_boot_output_properties_formal.v

@@ -0,0 +1,70 @@
+module thermal_6400_boot_output_properties_formal (
+    input wire clk,
+    input wire rst_n
+);
+    (* anyseq *) reg pwm_boundary_advance;
+    (* anyseq *) reg boot_init_complete;
+    (* anyseq *) reg bmc_stale;
+    (* anyseq *) reg global_fault;
+    (* anyseq *) reg [7:0] logical_fan_on;
+    wire boot_release;
+    wire force_full_speed;
+    wire [3:0] front_fan_ball;
+    wire [3:0] rear_fan_ball;
+
+    fan_boot_safety_controller dut (
+        .clk(clk), .rst_n(rst_n),
+        .pwm_boundary_advance(pwm_boundary_advance),
+        .boot_init_complete(boot_init_complete),
+        .bmc_stale(bmc_stale), .global_fault(global_fault),
+        .boot_release(boot_release), .force_full_speed(force_full_speed)
+    );
+    fan_board_output_adapter #(.BOARD_INVERT_MASK(8'h0F)) u_board (
+        .logical_fan_on(logical_fan_on),
+        .boot_release(boot_release), .force_full_speed(force_full_speed),
+        .front_fan_ball(front_fan_ball), .rear_fan_ball(rear_fan_ball)
+    );
+
+    reg [1:0] reset_cycles = 0;
+    reg past_valid = 0;
+    always @(posedge clk) begin
+        past_valid <= 1'b1;
+        if (reset_cycles < 2) begin
+            assume(!rst_n);
+            reset_cycles <= reset_cycles + 1'b1;
+        end else begin
+            assume(rst_n);
+        end
+        if (past_valid && $past(boot_init_complete))
+            assume(boot_init_complete);
+
+        if (!rst_n) begin
+            assert(!boot_release);
+            assert(force_full_speed);
+            assert(front_fan_ball == 4'h0);
+            assert(rear_fan_ball == 4'hF);
+        end else begin
+            if (!boot_release || force_full_speed) begin
+                assert(front_fan_ball == 4'h0);
+                assert(rear_fan_ball == 4'hF);
+            end
+            if (past_valid && $past(rst_n)) begin
+                if (boot_release != $past(boot_release)) begin
+                    assert(boot_release);
+                    assert($past(pwm_boundary_advance));
+                    assert($past(boot_init_complete));
+                end
+                if (force_full_speed != $past(force_full_speed))
+                    assert($past(pwm_boundary_advance));
+                if (!$past(pwm_boundary_advance)) begin
+                    assert(boot_release == $past(boot_release));
+                    assert(force_full_speed == $past(force_full_speed));
+                end
+                if ($past(boot_release))
+                    assert(boot_release);
+            end
+            cover(boot_init_complete && !boot_release);
+            cover(boot_release && !force_full_speed);
+        end
+    end
+endmodule

+ 16 - 0
tests/formal/6400_boot_output_reachability.sby

@@ -0,0 +1,16 @@
+[options]
+mode cover
+depth 12
+
+[engines]
+smtbmc boolector
+
+[script]
+read_verilog -formal fan_boot_safety_controller.v fan_board_output_adapter.v
+read_verilog -formal 6400_boot_output_properties_formal.v
+prep -top thermal_6400_boot_output_properties_formal
+
+[files]
+../../src/actuator/fan_boot_safety_controller.v
+../../src/actuator/fan_board_output_adapter.v
+6400_boot_output_properties_formal.v

+ 5 - 1
tests/formal/6400_core_properties_formal.v

@@ -23,6 +23,8 @@ module thermal_6400_core_properties_formal (
     (* anyseq *) reg [4:0] pwm_rd_addr;
     (* anyseq *) reg [4:0] pwm_rd_addr;
     (* anyseq *) reg snapshot_output_bank;
     (* anyseq *) reg snapshot_output_bank;
     (* anyseq *) reg [4:0] snapshot_rd_addr;
     (* anyseq *) reg [4:0] snapshot_rd_addr;
+    (* anyseq *) reg pwm_phase_boundary;
+    (* anyseq *) reg pwm_scan_idle;
     wire [4:0] bmc_rd_index;
     wire [4:0] bmc_rd_index;
     wire [7:0] pwm_rd_data;
     wire [7:0] pwm_rd_data;
     wire [7:0] snapshot_requested_data;
     wire [7:0] snapshot_requested_data;
@@ -56,7 +58,8 @@ module thermal_6400_core_properties_formal (
         .control_epoch(control_epoch), .safety_override_mask(safety_override_mask),
         .control_epoch(control_epoch), .safety_override_mask(safety_override_mask),
         .lane_fault_mask(lane_fault_mask), .global_fault(global_fault),
         .lane_fault_mask(lane_fault_mask), .global_fault(global_fault),
         .output_commit(output_commit), .stimulus_active(stimulus_active),
         .output_commit(output_commit), .stimulus_active(stimulus_active),
-        .pwm_phase_boundary(1'b1), .pwm_scan_idle(1'b1), .boot_init_complete()
+        .pwm_phase_boundary(pwm_phase_boundary), .pwm_scan_idle(pwm_scan_idle),
+        .boot_init_complete()
     );
     );
 
 
     reg [1:0] reset_cycles = 0;
     reg [1:0] reset_cycles = 0;
@@ -66,5 +69,6 @@ module thermal_6400_core_properties_formal (
             reset_cycles <= reset_cycles + 1'b1;
             reset_cycles <= reset_cycles + 1'b1;
         end else assume(rst_n);
         end else assume(rst_n);
         assume(stimulus_wr_addr < 32);
         assume(stimulus_wr_addr < 32);
+        cover(output_commit && active_output_bank != $past(active_output_bank));
     end
     end
 endmodule
 endmodule

+ 16 - 0
tests/formal/solver-map.yaml

@@ -0,0 +1,16 @@
+schema: prod2u-6400-formal-solver-map-v1
+policy:
+  exploratory_timeout_seconds: 90
+  acceptance_timeout_seconds: 600
+  max_concurrent_heavy_tasks: 1
+  timeout_kills_process_group: true
+targets:
+  core: {selected: boolector, boolector_seconds: 8.219, z3_seconds: 55.260, dual_solver: true}
+  transport: {selected: boolector, boolector_seconds: 0.771, z3_seconds: 2.030, dual_solver: true}
+  bmc_bank: {selected: boolector, boolector_seconds: 0.743, z3_seconds: 1.878, dual_solver: true}
+  snapshot: {selected: boolector, boolector_seconds: 0.686, z3_seconds: 0.809, dual_solver: true}
+  pwm: {selected: boolector, boolector_seconds: 0.302, z3_seconds: 0.749, dual_solver: true}
+  boot_output: {selected: z3, boolector_seconds: 2.179, z3_seconds: 1.163, dual_solver: true}
+notes:
+  calibration_source: prior_commit_bound_receipt_plus_current_boot_output_exploration
+  physical_scope: formal_only_hardware_not_run

+ 81 - 0
tests/unit/test_6400_formal_contract.py

@@ -6,9 +6,12 @@ from __future__ import annotations
 import json
 import json
 from pathlib import Path
 from pathlib import Path
 import re
 import re
+import signal
+import subprocess
 
 
 import pytest
 import pytest
 
 
+import tools.run_6400_formal as formal_runner
 from tools.run_6400_formal import compiled_property_ids, formal_run_base, property_cell_ids
 from tools.run_6400_formal import compiled_property_ids, formal_run_base, property_cell_ids
 
 
 
 
@@ -50,6 +53,18 @@ def test_pwm_proof_and_reachability_compile_board_adapter() -> None:
         assert "fan_board_output_adapter.v" in text
         assert "fan_board_output_adapter.v" in text
 
 
 
 
+def test_boot_output_proof_uses_production_controller_and_board_adapter() -> None:
+    for name in (
+        "6400_boot_output_properties.sby",
+        "6400_boot_output_reachability.sby",
+    ):
+        text = (FORMAL / name).read_text(encoding="utf-8")
+        assert "fan_boot_safety_controller.v" in text
+        assert "fan_board_output_adapter.v" in text
+    p17 = next(item for item in _manifest()["properties"] if item["id"] == "P17")
+    assert p17["harness"] == "6400_boot_output_properties.sby"
+
+
 def test_critical_safety_and_crc_properties_have_reachable_witnesses() -> None:
 def test_critical_safety_and_crc_properties_have_reachable_witnesses() -> None:
     witnesses = {
     witnesses = {
         property_id
         property_id
@@ -84,6 +99,19 @@ def test_runner_is_fail_closed_and_commit_bound() -> None:
     assert "PROD2U_CONTAINER_DIGEST" in runner
     assert "PROD2U_CONTAINER_DIGEST" in runner
     assert '"source_tree_sha256"' in runner
     assert '"source_tree_sha256"' in runner
     assert '"bitstream_sha256": None' in runner
     assert '"bitstream_sha256": None' in runner
+    assert "start_new_session=True" in runner
+    assert "os.killpg" in runner
+    assert "default=1" in runner
+    assert "solver_map" in runner
+
+
+def test_core_formal_does_not_assume_pwm_scan_is_always_idle() -> None:
+    harness = (FORMAL / "6400_core_properties_formal.v").read_text(encoding="utf-8")
+    core = (ROOT / "src/control/thermal_control_core.v").read_text(encoding="utf-8")
+    assert "(* anyseq *) reg pwm_scan_idle" in harness
+    assert ".pwm_scan_idle(pwm_scan_idle)" in harness
+    assert "active_output_bank != $past(active_output_bank)" in core
+    assert "$past(pwm_scan_idle)" in core
 
 
 
 
 def test_formal_run_base_is_external_and_rejects_git_worktree(
 def test_formal_run_base_is_external_and_rejects_git_worktree(
@@ -98,6 +126,59 @@ def test_formal_run_base_is_external_and_rejects_git_worktree(
         formal_run_base()
         formal_run_base()
 
 
 
 
+def test_runner_timeout_kills_process_group_and_keeps_task_log_name(
+    tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+    if formal_runner.os.name != "posix":
+        pytest.skip("process-group timeout policy is Linux authoritative")
+
+    class StubbornProcess:
+        pid = 4242
+        returncode: int | None = None
+
+        def __init__(self) -> None:
+            self.communicate_calls = 0
+
+        def communicate(self, timeout: int | None = None) -> tuple[str, None]:
+            self.communicate_calls += 1
+            if self.communicate_calls == 1:
+                raise subprocess.TimeoutExpired("sby", timeout, output="partial\n")
+            if self.communicate_calls == 2:
+                raise subprocess.TimeoutExpired("sby", timeout, output="partial\nterm\n")
+            self.returncode = -signal.SIGKILL
+            return "partial\nterm\nkilled\n", None
+
+    process = StubbornProcess()
+    signals: list[tuple[int, signal.Signals]] = []
+    monkeypatch.setattr(formal_runner.subprocess, "Popen", lambda *args, **kwargs: process)
+    monkeypatch.setattr(
+        formal_runner.os,
+        "killpg",
+        lambda pid, sent_signal: signals.append((pid, sent_signal)),
+    )
+
+    result = formal_runner.run_job(
+        {
+            "target": {
+                "name": "core",
+                "sby": "6400_core_properties.sby",
+                "mode": "prove",
+                "depth": 4,
+            },
+            "task": "boolector",
+        },
+        tmp_path,
+        timeout=1,
+    )
+
+    assert signals == [(4242, signal.SIGTERM), (4242, signal.SIGKILL)]
+    process_log = tmp_path / "work" / "core" / "boolector.process.log"
+    assert process_log.read_text(encoding="utf-8") == "partial\nterm\nkilled\n"
+    assert result["process_log"]["path"] == process_log.as_posix()
+    assert result["timed_out"] is True
+    assert "timeout" in result["evidence_failures"]
+
+
 def test_runner_reads_yosys_jny_property_cell_sorts(tmp_path: Path) -> None:
 def test_runner_reads_yosys_jny_property_cell_sorts(tmp_path: Path) -> None:
     model = tmp_path / "model"
     model = tmp_path / "model"
     model.mkdir()
     model.mkdir()

+ 1 - 0
tests/unit/test_6400_v1_source_closure.py

@@ -15,6 +15,7 @@ def test_production_closure_excludes_legacy_and_stimulus_wrapper() -> None:
         assert forbidden not in sources
         assert forbidden not in sources
     assert closure["top_module"] == "prod2u_6400_rs232_only_top"
     assert closure["top_module"] == "prod2u_6400_rs232_only_top"
     assert "src/top/prod2u_6400_rs232_only_top.v" in closure["sources"]
     assert "src/top/prod2u_6400_rs232_only_top.v" in closure["sources"]
+    assert "src/actuator/fan_boot_safety_controller.v" in closure["sources"]
 
 
 
 
 def test_known_pins_are_unique_and_ttl_is_disabled_in_rs232_only_hardware() -> None:
 def test_known_pins_are_unique_and_ttl_is_disabled_in_rs232_only_hardware() -> None:

+ 39 - 13
tools/run_6400_formal.py

@@ -12,6 +12,7 @@ import os
 from pathlib import Path
 from pathlib import Path
 import re
 import re
 import shutil
 import shutil
+import signal
 import subprocess
 import subprocess
 import sys
 import sys
 import time
 import time
@@ -21,6 +22,7 @@ from typing import Any, Iterable
 ROOT = Path(__file__).resolve().parents[1]
 ROOT = Path(__file__).resolve().parents[1]
 FORMAL_DIR = ROOT / "tests" / "formal"
 FORMAL_DIR = ROOT / "tests" / "formal"
 MANIFEST = FORMAL_DIR / "6400-properties.json"
 MANIFEST = FORMAL_DIR / "6400-properties.json"
+SOLVER_MAP = FORMAL_DIR / "solver-map.yaml"
 ENVIRONMENT_RECEIPT = ROOT / "receipts" / "environment" / "container-image.json"
 ENVIRONMENT_RECEIPT = ROOT / "receipts" / "environment" / "container-image.json"
 PROJECT_CONTRACT = ROOT / "projects" / "prod2u-6400-front-back" / "project.json"
 PROJECT_CONTRACT = ROOT / "projects" / "prod2u-6400-front-back" / "project.json"
 PROFILE_CONTRACT = ROOT / "products" / "6400-control" / "project.json"
 PROFILE_CONTRACT = ROOT / "products" / "6400-control" / "project.json"
@@ -97,6 +99,7 @@ def contract_binding() -> dict[str, Any]:
         "source_manifest": SOURCE_MANIFEST,
         "source_manifest": SOURCE_MANIFEST,
         "design_lock": DESIGN_LOCK,
         "design_lock": DESIGN_LOCK,
         "formal_manifest": MANIFEST,
         "formal_manifest": MANIFEST,
+        "solver_map": SOLVER_MAP,
     }
     }
     return {
     return {
         name: {"path": path.relative_to(ROOT).as_posix(), "sha256": sha256_file(path)}
         name: {"path": path.relative_to(ROOT).as_posix(), "sha256": sha256_file(path)}
@@ -281,22 +284,43 @@ def run_job(job: dict[str, Any], run_root: Path, timeout: int) -> dict[str, Any]
         command.append(task)
         command.append(task)
     started = time.monotonic()
     started = time.monotonic()
     timed_out = False
     timed_out = False
+    process = subprocess.Popen(
+        command,
+        cwd=FORMAL_DIR,
+        text=True,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.STDOUT,
+        start_new_session=True,
+    )
     try:
     try:
-        process = subprocess.run(
-            command,
-            cwd=FORMAL_DIR,
-            check=False,
-            text=True,
-            stdout=subprocess.PIPE,
-            stderr=subprocess.STDOUT,
-            timeout=timeout,
-        )
+        output, _ = process.communicate(timeout=timeout)
         returncode: int | None = process.returncode
         returncode: int | None = process.returncode
-        output = process.stdout
     except subprocess.TimeoutExpired as exc:
     except subprocess.TimeoutExpired as exc:
         timed_out = True
         timed_out = True
-        returncode = None
-        output = exc.stdout.decode(errors="replace") if isinstance(exc.stdout, bytes) else (exc.stdout or "")
+        partial_output = exc.stdout.decode(errors="replace") if isinstance(exc.stdout, bytes) else (exc.stdout or "")
+        if os.name == "posix":
+            try:
+                os.killpg(process.pid, signal.SIGTERM)
+            except ProcessLookupError:
+                pass
+        else:
+            process.terminate()
+        try:
+            final_output, _ = process.communicate(timeout=5)
+        except subprocess.TimeoutExpired:
+            if os.name == "posix":
+                try:
+                    os.killpg(process.pid, signal.SIGKILL)
+                except ProcessLookupError:
+                    pass
+            else:
+                process.kill()
+            final_output, _ = process.communicate()
+        # A retry of communicate() returns all captured output, including the
+        # bytes reported by TimeoutExpired. Do not prepend partial_output and
+        # duplicate the solver log.
+        output = final_output if final_output is not None else partial_output
+        returncode = process.returncode
     duration = time.monotonic() - started
     duration = time.monotonic() - started
     process_log = workdir.parent / f"{suffix}.process.log"
     process_log = workdir.parent / f"{suffix}.process.log"
     process_log.write_text(output, encoding="utf-8")
     process_log.write_text(output, encoding="utf-8")
@@ -385,9 +409,11 @@ def validate_manifest(manifest: dict[str, Any]) -> None:
 def main(argv: list[str] | None = None) -> int:
 def main(argv: list[str] | None = None) -> int:
     parser = argparse.ArgumentParser()
     parser = argparse.ArgumentParser()
     parser.add_argument("--run-id")
     parser.add_argument("--run-id")
-    parser.add_argument("--jobs", type=int, default=4)
+    parser.add_argument("--jobs", type=int, default=1)
     parser.add_argument("--timeout-seconds", type=int, default=600)
     parser.add_argument("--timeout-seconds", type=int, default=600)
     args = parser.parse_args(argv)
     args = parser.parse_args(argv)
+    if args.jobs != 1:
+        parser.error("6400 formal permits exactly one heavy solver task at a time")
     timestamp = datetime.now(timezone.utc)
     timestamp = datetime.now(timezone.utc)
     run_id = args.run_id or timestamp.strftime("6400-formal-%Y%m%dT%H%M%SZ")
     run_id = args.run_id or timestamp.strftime("6400-formal-%Y%m%dT%H%M%SZ")
     if not re.fullmatch(r"[A-Za-z0-9._-]+", run_id):
     if not re.fullmatch(r"[A-Za-z0-9._-]+", run_id):