Просмотр исходного кода

feat-identification-stimulus-atomic-bank

root 3 месяцев назад
Родитель
Сommit
8093e8e48c

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

@@ -21,6 +21,7 @@
     "src/acquisition/bmc_ascii_snapshot.v",
     "src/acquisition/bmc_ascii_snapshot.v",
     "src/acquisition/ct7428_snapshot.v",
     "src/acquisition/ct7428_snapshot.v",
     "src/control/thermal_output_banks.v",
     "src/control/thermal_output_banks.v",
+    "src/control/stimulus_atomic_bank.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_boot_safety_controller.v",

+ 89 - 0
src/control/stimulus_atomic_bank.v

@@ -0,0 +1,89 @@
+`timescale 1ns/1ps
+
+// Identification-only 32-channel stimulus storage. Host writes always stage
+// into the inactive bank; a commit changes the active vector only after every
+// address has received an in-range value.
+module stimulus_atomic_bank (
+    input  wire       clk,
+    input  wire       rst_n,
+    input  wire       write_enable,
+    input  wire [4:0] write_address,
+    input  wire [7:0] write_data,
+    input  wire       stimulus_commit,
+    output wire       commit_applied,
+    output reg        active_bank,
+    input  wire       read_bank,
+    input  wire [4:0] read_address,
+    output wire [7:0] read_data
+);
+    reg [7:0] bank0 [0:31];
+    reg [7:0] bank1 [0:31];
+    reg [31:0] inactive_written;
+
+    wire accepted_write = write_enable && write_data <= 100;
+    assign commit_applied = stimulus_commit && (&inactive_written);
+
+    assign read_data = read_bank ? bank1[read_address] : bank0[read_address];
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            active_bank <= 1'b0;
+            inactive_written <= 32'd0;
+        end else begin
+            if (accepted_write) begin
+                if (active_bank)
+                    bank0[write_address] <= write_data;
+                else
+                    bank1[write_address] <= write_data;
+                inactive_written[write_address] <= 1'b1;
+            end
+            if (commit_applied) begin
+                active_bank <= ~active_bank;
+                // The old active bank is now the new inactive staging bank.
+                // It must receive a fresh complete 32-byte vector before it
+                // can ever become active again.
+                inactive_written <= 32'd0;
+            end
+        end
+    end
+
+`ifdef FORMAL
+    (* anyconst *) reg [4:0] formal_address;
+    reg formal_past_valid;
+    reg formal_active_valid;
+    wire [7:0] formal_active_data = active_bank ?
+        bank1[formal_address] : bank0[formal_address];
+    wire [7:0] formal_inactive_data = active_bank ?
+        bank0[formal_address] : bank1[formal_address];
+    initial formal_past_valid = 1'b0;
+    initial formal_active_valid = 1'b0;
+    always @(posedge clk) begin
+        formal_past_valid <= 1'b1;
+        assume(formal_address < 32);
+        if (!rst_n)
+            formal_active_valid <= 1'b0;
+        else if (commit_applied)
+            formal_active_valid <= 1'b1;
+        if (inactive_written[formal_address])
+            assert(formal_inactive_data <= 100);
+        if (formal_active_valid)
+            assert(formal_active_data <= 100);
+        if (formal_past_valid && $past(rst_n) && rst_n) begin
+            if ($past(commit_applied))
+                assert(active_bank != $past(active_bank));
+            else begin
+                assert(active_bank == $past(active_bank));
+                // Inactive-bank writes are never visible through the active
+                // vector before an explicit atomic pointer commit.
+                assert(formal_active_data == $past(formal_active_data));
+            end
+            if ($past(stimulus_commit) && !$past(commit_applied))
+                assert(active_bank == $past(active_bank));
+            if (formal_active_valid && !$past(formal_active_valid)) begin
+                assert($past(commit_applied));
+                assert(formal_active_data <= 100);
+            end
+        end
+    end
+`endif
+endmodule

+ 64 - 13
src/control/thermal_control_core.v

@@ -90,9 +90,10 @@ module thermal_control_core #(
     reg [2:0] invalid_count2;
     reg [2:0] invalid_count2;
     reg [2:0] invalid_count3;
     reg [2:0] invalid_count3;
     reg [15:0] target_centi;
     reg [15:0] target_centi;
-    reg [7:0] stimulus_mem [0:31];
     reg stimulus_running;
     reg stimulus_running;
     reg [7:0] stimulus_remaining;
     reg [7:0] stimulus_remaining;
+    reg stimulus_pass_bank;
+    reg stimulus_pass_running;
     reg [7:0] safe_fan_target;
     reg [7:0] safe_fan_target;
     // safety_override_mask is Host telemetry for every per-channel safety
     // safety_override_mask is Host telemetry for every per-channel safety
     // action.  Keep shutdown and airflow intent separate so the 74 C soft
     // action.  Keep shutdown and airflow intent separate so the 74 C soft
@@ -105,9 +106,9 @@ module thermal_control_core #(
     reg signed [15:0] sample_temperature;
     reg signed [15:0] sample_temperature;
     reg signed [31:0] kp_product;
     reg signed [31:0] kp_product;
     reg signed [31:0] ki_product;
     reg signed [31:0] ki_product;
-    integer i;
 
 
 `ifdef FORMAL
 `ifdef FORMAL
+    integer i;
     // Proof-only mirrors preserve arbitrary-index invariants without adding
     // Proof-only mirrors preserve arbitrary-index invariants without adding
     // any storage to TD synthesis.
     // any storage to TD synthesis.
     reg [7:0] formal_req0 [0:31];
     reg [7:0] formal_req0 [0:31];
@@ -158,6 +159,30 @@ module thermal_control_core #(
     wire [7:0] clamped_duty = (clamped_output >= 16'sd25600) ? 8'd100 : q8_8_to_duty(clamped_output);
     wire [7:0] clamped_duty = (clamped_output >= 16'sd25600) ? 8'd100 : q8_8_to_duty(clamped_output);
     wire [7:0] reduced_duty = (pi_previous_output > 16'sd256) ? q8_8_to_duty(reduced_output) : 8'd0;
     wire [7:0] reduced_duty = (pi_previous_output > 16'sd256) ? q8_8_to_duty(reduced_output) : 8'd0;
     wire signed [15:0] recovery_threshold = $signed(target_centi) + RECOVERY_MARGIN;
     wire signed [15:0] recovery_threshold = $signed(target_centi) + RECOVERY_MARGIN;
+    wire stimulus_bank_active;
+    wire stimulus_commit_applied;
+    wire [7:0] stimulus_pass_data;
+
+    generate
+        if (ENABLE_STIMULUS != 0) begin : g_stimulus_bank
+            stimulus_atomic_bank u_stimulus_bank (
+                .clk(clk), .rst_n(rst_n),
+                .write_enable(stimulus_wr_en),
+                .write_address(stimulus_wr_addr),
+                .write_data(stimulus_wr_data),
+                .stimulus_commit(stimulus_commit),
+                .commit_applied(stimulus_commit_applied),
+                .active_bank(stimulus_bank_active),
+                .read_bank(stimulus_pass_bank),
+                .read_address(work_index),
+                .read_data(stimulus_pass_data)
+            );
+        end else begin : g_no_stimulus_bank
+            assign stimulus_bank_active = 1'b0;
+            assign stimulus_commit_applied = 1'b0;
+            assign stimulus_pass_data = 8'd0;
+        end
+    endgenerate
 
 
     assign stimulus_active = stimulus_running;
     assign stimulus_active = stimulus_running;
 
 
@@ -250,7 +275,7 @@ module thermal_control_core #(
     wire update_soft = work_state == W_UPDATE && sample_valid &&
     wire update_soft = work_state == W_UPDATE && sample_valid &&
         !update_fault_clear && (sample_temperature >= SOFT_LIMIT);
         !update_fault_clear && (sample_temperature >= SOFT_LIMIT);
     wire update_normal = work_state == W_UPDATE && sample_valid &&
     wire update_normal = work_state == W_UPDATE && sample_valid &&
-        !update_fault_clear && !update_soft && !stimulus_running;
+        !update_fault_clear && !update_soft && !stimulus_pass_running;
     wire pi_clear_write = (work_state == W_INIT || work_state == W_SAFE_FILL) &&
     wire pi_clear_write = (work_state == W_INIT || work_state == W_SAFE_FILL) &&
         (work_index < 24);
         (work_index < 24);
     wire pi_state_write = pi_clear_write || update_fault_clear || update_soft || update_normal;
     wire pi_state_write = pi_clear_write || update_fault_clear || update_soft || update_normal;
@@ -262,8 +287,8 @@ module thermal_control_core #(
         ((sample_temperature >= PRETRIP_LIMIT) || global_fault ||
         ((sample_temperature >= PRETRIP_LIMIT) || global_fault ||
          lane_fault_for_output(work_index)) ? 8'd0 :
          lane_fault_for_output(work_index)) ? 8'd0 :
         (sample_temperature >= SOFT_LIMIT) ? reduced_duty :
         (sample_temperature >= SOFT_LIMIT) ? reduced_duty :
-        stimulus_running ? stimulus_mem[work_index] : clamped_duty;
-    wire [7:0] fan_request_value = stimulus_running ? stimulus_mem[work_index] : 8'd30;
+        stimulus_pass_running ? stimulus_pass_data : clamped_duty;
+    wire [7:0] fan_request_value = stimulus_pass_running ? stimulus_pass_data : 8'd30;
     wire output_init_write = work_state == W_INIT;
     wire output_init_write = work_state == W_INIT;
     wire output_control_write = work_state == W_UPDATE || work_state == W_FANS ||
     wire output_control_write = work_state == W_UPDATE || work_state == W_FANS ||
         work_state == W_APPLY || work_state == W_SAFE_FILL;
         work_state == W_APPLY || work_state == W_SAFE_FILL;
@@ -344,21 +369,22 @@ module thermal_control_core #(
             invalid_count3 <= 0;
             invalid_count3 <= 0;
             stimulus_running <= 0;
             stimulus_running <= 0;
             stimulus_remaining <= 0;
             stimulus_remaining <= 0;
+            stimulus_pass_bank <= 0;
+            stimulus_pass_running <= 0;
             safe_fan_target <= 10;
             safe_fan_target <= 10;
             sample_valid <= 0;
             sample_valid <= 0;
             sample_error <= 0;
             sample_error <= 0;
             sample_temperature <= 0;
             sample_temperature <= 0;
             kp_product <= 0;
             kp_product <= 0;
             ki_product <= 0;
             ki_product <= 0;
-            for (i = 0; i < 32; i = i + 1) begin
-                stimulus_mem[i] <= 0;
 `ifdef FORMAL
 `ifdef FORMAL
+            for (i = 0; i < 32; i = i + 1) begin
                 formal_req0[i] <= (i < 24) ? 0 : 10;
                 formal_req0[i] <= (i < 24) ? 0 : 10;
                 formal_req1[i] <= (i < 24) ? 0 : 10;
                 formal_req1[i] <= (i < 24) ? 0 : 10;
                 formal_app0[i] <= (i < 24) ? 0 : 10;
                 formal_app0[i] <= (i < 24) ? 0 : 10;
                 formal_app1[i] <= (i < 24) ? 0 : 10;
                 formal_app1[i] <= (i < 24) ? 0 : 10;
-`endif
             end
             end
+`endif
 `ifdef FORMAL
 `ifdef FORMAL
             for (i = 0; i < 24; i = i + 1) begin
             for (i = 0; i < 24; i = i + 1) begin
                 formal_previous_error[i] <= 0;
                 formal_previous_error[i] <= 0;
@@ -387,9 +413,7 @@ module thermal_control_core #(
                 formal_previous_output[work_index] <= pi_state_write_data[15:0];
                 formal_previous_output[work_index] <= pi_state_write_data[15:0];
             end
             end
 `endif
 `endif
-            if (stimulus_wr_en && (ENABLE_STIMULUS != 0))
-                stimulus_mem[stimulus_wr_addr] <= stimulus_wr_data;
-            if (stimulus_commit && (ENABLE_STIMULUS != 0) && stimulus_duration_seconds != 0) begin
+            if (stimulus_commit_applied && stimulus_duration_seconds != 0) begin
                 stimulus_running <= 1;
                 stimulus_running <= 1;
                 stimulus_remaining <= stimulus_duration_seconds;
                 stimulus_remaining <= stimulus_duration_seconds;
             end
             end
@@ -481,6 +505,12 @@ module thermal_control_core #(
                     end
                     end
                     W_PREP: begin
                     W_PREP: begin
                         if (work_index == 0) begin
                         if (work_index == 0) begin
+                            // A complete 32-channel control pass observes one
+                            // immutable stimulus vector and running decision.
+                            // A Host commit in the middle of this pass is
+                            // therefore visible only to the following pass.
+                            stimulus_pass_bank <= stimulus_bank_active;
+                            stimulus_pass_running <= stimulus_running;
                             epoch_safe <= 1;
                             epoch_safe <= 1;
                             invalid_count0 <= 0;
                             invalid_count0 <= 0;
                             invalid_count1 <= 0;
                             invalid_count1 <= 0;
@@ -549,7 +579,7 @@ module thermal_control_core #(
                                 safety_override_mask[work_index] <= 1;
                                 safety_override_mask[work_index] <= 1;
                                 ptc_shutdown_mask[work_index] <= 0;
                                 ptc_shutdown_mask[work_index] <= 0;
                                 thermal_protection_mask[work_index] <= 1;
                                 thermal_protection_mask[work_index] <= 1;
-                            end else if (stimulus_running) begin
+                            end else if (stimulus_pass_running) begin
                                 safety_override_mask[work_index] <= 0;
                                 safety_override_mask[work_index] <= 0;
                                 ptc_shutdown_mask[work_index] <= 0;
                                 ptc_shutdown_mask[work_index] <= 0;
                                 thermal_protection_mask[work_index] <= 0;
                                 thermal_protection_mask[work_index] <= 0;
@@ -671,7 +701,8 @@ module thermal_control_core #(
         assert(formal_req1[formal_duty_index] <= 100);
         assert(formal_req1[formal_duty_index] <= 100);
         assert(formal_app0[formal_duty_index] <= 100);
         assert(formal_app0[formal_duty_index] <= 100);
         assert(formal_app1[formal_duty_index] <= 100);
         assert(formal_app1[formal_duty_index] <= 100);
-        assert(stimulus_mem[formal_duty_index] <= 100);
+        if (stimulus_pass_running)
+            assert(stimulus_pass_data <= 100);
         assert(safe_fan_target <= 100);
         assert(safe_fan_target <= 100);
         assert(control_state <= STOPPED);
         assert(control_state <= STOPPED);
         assert(current_target_celsius == 0 ||
         assert(current_target_celsius == 0 ||
@@ -879,6 +910,26 @@ module thermal_control_core #(
                 end else begin
                 end else begin
                     assert(active_output_bank == $past(active_output_bank));
                     assert(active_output_bank == $past(active_output_bank));
                 end
                 end
+
+                // Identification stimulus is latched once at the first PREP
+                // state of a complete 32-channel control pass. Neither a
+                // later Host commit nor the duration timer can change the
+                // selected vector/running decision inside that pass.
+                if (stimulus_pass_bank != $past(stimulus_pass_bank) ||
+                    stimulus_pass_running != $past(stimulus_pass_running))
+                    assert($past(work_state) == W_PREP &&
+                           $past(work_index) == 0);
+                if ($past(work_state) == W_PREP && $past(work_index) == 0) begin
+                    assert(stimulus_pass_bank == $past(stimulus_bank_active));
+                    assert(stimulus_pass_running == $past(stimulus_running));
+                end
+                if ($past(stimulus_commit_applied)) begin
+                    assert($past(stimulus_commit));
+                    assert(stimulus_bank_active != $past(stimulus_bank_active));
+                end
+                if ($past(stimulus_commit) &&
+                    !$past(stimulus_commit_applied))
+                    assert(stimulus_bank_active == $past(stimulus_bank_active));
                 if ($past(work_state) == W_COMMIT_WAIT &&
                 if ($past(work_state) == W_COMMIT_WAIT &&
                     !$past(pwm_scan_idle) && !$past(target_commit) &&
                     !$past(pwm_scan_idle) && !$past(target_commit) &&
                     !$past(formal_stale_preempt)) begin
                     !$past(formal_stale_preempt)) begin

+ 9 - 0
src/transport/thermal_host_command.v

@@ -28,6 +28,11 @@ module thermal_host_command #(
     input  wire       tx_done,
     input  wire       tx_done,
     output reg        transaction_done,
     output reg        transaction_done,
     output wire       busy
     output wire       busy
+`ifdef FORMAL
+    , output wire [3:0] formal_state_o
+    , output wire [5:0] formal_index_o
+    , output wire       formal_stimulus_bad_o
+`endif
 );
 );
     localparam [3:0] ST_IDLE = 4'd0;
     localparam [3:0] ST_IDLE = 4'd0;
     localparam [3:0] ST_TARGET = 4'd1;
     localparam [3:0] ST_TARGET = 4'd1;
@@ -167,6 +172,10 @@ module thermal_host_command #(
     end
     end
 
 
 `ifdef FORMAL
 `ifdef FORMAL
+    assign formal_state_o = state;
+    assign formal_index_o = index;
+    assign formal_stimulus_bad_o = stimulus_bad;
+
     reg formal_past_valid;
     reg formal_past_valid;
     initial formal_past_valid = 0;
     initial formal_past_valid = 0;
     always @(posedge clk) begin
     always @(posedge clk) begin

+ 1 - 0
td/syn/prod2u_6400_front_back.tcl

@@ -36,6 +36,7 @@ analyze_src {src/acquisition/bmc_poll_engine.v}
 analyze_src {src/acquisition/bmc_ascii_snapshot.v}
 analyze_src {src/acquisition/bmc_ascii_snapshot.v}
 analyze_src {src/acquisition/ct7428_snapshot.v}
 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/stimulus_atomic_bank.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_boot_safety_controller.v}

+ 1 - 0
td/syn/prod2u_6400_identification.tcl

@@ -37,6 +37,7 @@ analyze_src {src/acquisition/bmc_poll_engine.v}
 analyze_src {src/acquisition/bmc_ascii_snapshot.v}
 analyze_src {src/acquisition/bmc_ascii_snapshot.v}
 analyze_src {src/acquisition/ct7428_snapshot.v}
 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/stimulus_atomic_bank.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_boot_safety_controller.v}

+ 12 - 0
tests/cocotb/prod2u_6400_v1_cocotb_top.v

@@ -15,6 +15,8 @@ module prod2u_6400_v1_cocotb_top #(
     output wire        bmc_rs232_tx,
     output wire        bmc_rs232_tx,
     input  wire        tick_1s_test,
     input  wire        tick_1s_test,
     input  wire        reset_test,
     input  wire        reset_test,
+    input  wire        bmc_epoch_override_enable,
+    input  wire [15:0] bmc_epoch_override_value,
     output wire [23:0] ptc_pwm_out,
     output wire [23:0] ptc_pwm_out,
     output wire [3:0]  front_fan_pwm_out,
     output wire [3:0]  front_fan_pwm_out,
     output wire [3:0]  rear_fan_pwm_out,
     output wire [3:0]  rear_fan_pwm_out,
@@ -88,6 +90,16 @@ module prod2u_6400_v1_cocotb_top #(
             release u_dut.rst_n;
             release u_dut.rst_n;
     end
     end
 
 
+    // Simulation-only epoch admission hook. BMC data still comes from the
+    // real parser/banks; this only schedules a deterministic control pass so
+    // a legal Host commit can be placed in the middle of that pass.
+    always @(bmc_epoch_override_enable or bmc_epoch_override_value) begin
+        if (bmc_epoch_override_enable === 1'b1)
+            force u_dut.u_control.bmc_epoch = bmc_epoch_override_value;
+        else
+            release u_dut.u_control.bmc_epoch;
+    end
+
     assign rst_n_mon = u_dut.rst_n;
     assign rst_n_mon = u_dut.rst_n;
     assign control_state_mon = u_dut.control_state;
     assign control_state_mon = u_dut.control_state;
     assign bmc_epoch_mon = u_dut.bmc_epoch;
     assign bmc_epoch_mon = u_dut.bmc_epoch;

+ 1 - 0
tests/cocotb/run_6400_pi_differential.py

@@ -30,6 +30,7 @@ def main() -> int:
             sources=[
             sources=[
                 ROOT / "src/common/ef2_bram_dp.v",
                 ROOT / "src/common/ef2_bram_dp.v",
                 ROOT / "src/control/thermal_output_banks.v",
                 ROOT / "src/control/thermal_output_banks.v",
+                ROOT / "src/control/stimulus_atomic_bank.v",
                 ROOT / "src/control/thermal_control_core.v",
                 ROOT / "src/control/thermal_control_core.v",
                 TEST_DIR / "thermal_control_core_cocotb_top.v",
                 TEST_DIR / "thermal_control_core_cocotb_top.v",
             ],
             ],

+ 29 - 9
tests/cocotb/test_6400_v1_control_integration.py

@@ -39,6 +39,17 @@ async def test_control_dual_host_sensor_safety_and_snapshot(dut):
     pwm_timing = cocotb.start_soon(check_pwm_timing(dut))
     pwm_timing = cocotb.start_soon(check_pwm_timing(dut))
     await bring_auto(dut, verify_boot=True)
     await bring_auto(dut, verify_boot=True)
 
 
+    # Identical legal GET requests are independent transactions. Each one
+    # must start a fresh zero-length 0x82 ACK followed by a fresh 193-byte
+    # 0x42 DATA frame; no equality-based response suppression is permitted.
+    responses_before_repeated_get = int(dut.host_response_count_mon.value)
+    for transaction_index in (1, 2):
+        repeated = await get_snapshot(dut, "rs232")
+        assert repeated["control_state"] == 4
+        assert int(dut.host_response_count_mon.value) == (
+            responses_before_repeated_get + (2 * transaction_index)
+        )
+
     # GET is one locked two-frame transaction. Traffic on the alternate Host
     # GET is one locked two-frame transaction. Traffic on the alternate Host
     # after ACK must not change port_sel, unlock snapshot banks, or commit a
     # after ACK must not change port_sel, unlock snapshot banks, or commit a
     # command before the 0x42 DATA frame's final physical stop bit retires.
     # command before the 0x42 DATA frame's final physical stop bit retires.
@@ -87,15 +98,24 @@ async def test_control_dual_host_sensor_safety_and_snapshot(dut):
 
 
     # Production must silently reject the identification-only command.
     # Production must silently reject the identification-only command.
     rejected_payload = bytes([2, *([20] * 32)])
     rejected_payload = bytes([2, *([20] * 32)])
-    await send_uart(
-        dut.host_rs232_rx,
-        encode_frame(SET_STIMULUS, rejected_payload),
-        HOST_CLKS_PER_BIT,
-    )
-    await Timer(HOST_CLKS_PER_BIT * CLOCK_NS * 20, units="ns")
-    assert int(dut.host_rs232_tx.value) == 1
-    assert int(dut.host_ttl_tx.value) == 1
-    assert int(dut.stimulus_active_mon.value) == 0
+    responses_before_rejected_stimulus = int(dut.host_response_count_mon.value)
+    for _ in range(2):
+        await send_uart(
+            dut.host_rs232_rx,
+            encode_frame(SET_STIMULUS, rejected_payload),
+            HOST_CLKS_PER_BIT,
+        )
+        await Timer(HOST_CLKS_PER_BIT * CLOCK_NS * 20, units="ns")
+        await wait_for(
+            dut,
+            lambda: int(dut.host_locked_mon.value) == 0,
+            cycles=100,
+            label="Production repeated stimulus silent-drop unlock",
+        )
+        assert int(dut.host_response_count_mon.value) == responses_before_rejected_stimulus
+        assert int(dut.host_rs232_tx.value) == 1
+        assert int(dut.host_ttl_tx.value) == 1
+        assert int(dut.stimulus_active_mon.value) == 0
 
 
     # Exercise simultaneous Host and BMC receive frontends.  ACK is routed
     # Exercise simultaneous Host and BMC receive frontends.  ACK is routed
     # only to RS-232 while the BMC commits a complete fifth snapshot.
     # only to RS-232 while the BMC commits a complete fifth snapshot.

+ 135 - 3
tests/cocotb/test_6400_v1_identification_integration.py

@@ -3,14 +3,18 @@
 from __future__ import annotations
 from __future__ import annotations
 
 
 import cocotb
 import cocotb
+from cocotb.triggers import ReadOnly, RisingEdge
 
 
 from thermal_6400_uart import (
 from thermal_6400_uart import (
     SET_STIMULUS,
     SET_STIMULUS,
     SET_STIMULUS_ACK,
     SET_STIMULUS_ACK,
+    HOST_CLKS_PER_BIT,
     bring_auto,
     bring_auto,
+    encode_frame,
     get_snapshot,
     get_snapshot,
     host_transaction,
     host_transaction,
     pulse_tick_1s,
     pulse_tick_1s,
+    send_uart,
     send_bmc_snapshot,
     send_bmc_snapshot,
     wait_for,
     wait_for,
 )
 )
@@ -22,6 +26,27 @@ def array(snapshot: dict[str, object], name: str) -> list[int]:
     return [int(item) for item in value]
     return [int(item) for item in value]
 
 
 
 
+async def send_silent_invalid_stimulus(dut, port: str, payload: bytes) -> None:
+    responses_before = int(dut.host_response_count_mon.value)
+    active_bank_before = int(dut.u_dut.u_control.stimulus_bank_active.value)
+    await send_uart(
+        getattr(dut, f"host_{port}_rx"),
+        encode_frame(SET_STIMULUS, payload),
+        HOST_CLKS_PER_BIT,
+    )
+    await wait_for(
+        dut,
+        lambda: int(dut.host_locked_mon.value) == 0
+        and int(dut.u_dut.u_command.busy.value) == 0,
+        cycles=200,
+        label=f"invalid stimulus silent retirement on {port}",
+    )
+    assert int(dut.host_response_count_mon.value) == responses_before
+    assert int(dut.u_dut.u_control.stimulus_bank_active.value) == active_bank_before
+    assert int(dut.stimulus_active_mon.value) == 1
+    assert int(getattr(dut, f"host_{port}_tx").value) == 1
+
+
 @cocotb.test()
 @cocotb.test()
 async def test_identification_stimulus_expires_and_safety_preempts(dut):
 async def test_identification_stimulus_expires_and_safety_preempts(dut):
     await bring_auto(dut)
     await bring_auto(dut)
@@ -30,9 +55,14 @@ async def test_identification_stimulus_expires_and_safety_preempts(dut):
     front = [20, 30, 40, 50]
     front = [20, 30, 40, 50]
     rear = [50, 40, 30, 20]
     rear = [50, 40, 30, 20]
     stimulus = bytes([2, *ptc, *front, *rear])
     stimulus = bytes([2, *ptc, *front, *rear])
-    kind, payload = await host_transaction(dut, "rs232", SET_STIMULUS, stimulus)
-    assert (kind, payload) == (SET_STIMULUS_ACK, b"")
-    assert int(dut.stimulus_active_mon.value) == 1
+    responses_before_repeated_stimulus = int(dut.host_response_count_mon.value)
+    for transaction_index in (1, 2):
+        kind, payload = await host_transaction(dut, "rs232", SET_STIMULUS, stimulus)
+        assert (kind, payload) == (SET_STIMULUS_ACK, b"")
+        assert int(dut.host_response_count_mon.value) == (
+            responses_before_repeated_stimulus + transaction_index
+        )
+        assert int(dut.stimulus_active_mon.value) == 1
 
 
     old_control_epoch = int(dut.control_epoch_mon.value)
     old_control_epoch = int(dut.control_epoch_mon.value)
     await send_bmc_snapshot(dut, [60] * 24)
     await send_bmc_snapshot(dut, [60] * 24)
@@ -50,6 +80,108 @@ async def test_identification_stimulus_expires_and_safety_preempts(dut):
     assert array(active, "rear_requested") == rear
     assert array(active, "rear_requested") == rear
     assert array(active, "rear_applied") == rear
     assert array(active, "rear_applied") == rear
 
 
+    # Duration zero and one out-of-range duty both dirty only the inactive
+    # staging bank. They are silently rejected: no ACK, no active pointer
+    # flip, and the already-running A vector remains intact.
+    await send_silent_invalid_stimulus(
+        dut, "rs232", bytes([0, *([83] * 32)])
+    )
+    invalid_duty = [67] * 32
+    invalid_duty[15] = 101
+    await send_silent_invalid_stimulus(
+        dut, "ttl", bytes([2, *invalid_duty])
+    )
+    still_a = await get_snapshot(dut, "rs232")
+    assert array(still_a, "ptc_applied") == ptc
+    assert array(still_a, "front_applied") == front
+    assert array(still_a, "rear_applied") == rear
+
+    # Launch a different legal B vector, then admit a new BMC epoch while the
+    # command is still staging its bytes. The running control pass must lock
+    # A. The 0x83 ACK is fresh and the pointer flips mid-pass, but every read
+    # in that pass remains A; the following pass is wholly B.
+    ptc_b = [41 + (index % 5) for index in range(24)]
+    front_b = [61, 62, 63, 64]
+    rear_b = [71, 72, 73, 74]
+    stimulus_b = bytes([2, *ptc_b, *front_b, *rear_b])
+    responses_before_b = int(dut.host_response_count_mon.value)
+    old_active_bank = int(dut.u_dut.u_control.stimulus_bank_active.value)
+    old_control_epoch = int(dut.control_epoch_mon.value)
+    b_transaction = cocotb.start_soon(
+        host_transaction(dut, "rs232", SET_STIMULUS, stimulus_b)
+    )
+    await wait_for(
+        dut,
+        lambda: int(dut.u_dut.u_command.state.value) == 4
+        and 4 <= int(dut.u_dut.u_command.index.value) <= 12,
+        cycles=15000,
+        label="B stimulus staging window",
+    )
+    forced_epoch = (int(dut.bmc_epoch_mon.value) + 1) & 0xFFFF
+    dut.bmc_epoch_override_value.value = forced_epoch
+    dut.bmc_epoch_override_enable.value = 1
+    await wait_for(
+        dut,
+        lambda: int(dut.u_dut.u_control.work_state.value) == 2
+        and int(dut.u_dut.u_control.work_index.value) == 0,
+        cycles=200,
+        label="A-locked control pass",
+    )
+    assert int(dut.u_dut.u_control.stimulus_pass_bank.value) == old_active_bank
+    assert int(dut.u_dut.u_control.stimulus_pass_running.value) == 1
+
+    vector_a = [*ptc, *front, *rear]
+    saw_b_commit_mid_pass = False
+    for _ in range(500):
+        await RisingEdge(dut.sys_clk)
+        await ReadOnly()
+        if int(dut.control_epoch_mon.value) != old_control_epoch:
+            break
+        work_state = int(dut.u_dut.u_control.work_state.value)
+        work_index = int(dut.u_dut.u_control.work_index.value)
+        assert int(dut.u_dut.u_control.stimulus_pass_bank.value) == old_active_bank
+        assert int(dut.u_dut.u_control.stimulus_pass_running.value) == 1
+        if work_state in (1, 2, 3, 4, 5, 6, 8, 10):
+            assert int(dut.u_dut.u_control.stimulus_pass_data.value) == vector_a[work_index]
+        if int(dut.u_dut.u_control.stimulus_bank_active.value) != old_active_bank:
+            saw_b_commit_mid_pass = True
+            assert work_state != 0
+    else:
+        raise AssertionError("A-locked pass did not commit")
+    assert saw_b_commit_mid_pass
+
+    kind, payload = await b_transaction
+    assert (kind, payload) == (SET_STIMULUS_ACK, b"")
+    assert int(dut.host_response_count_mon.value) == responses_before_b + 1
+    first_after_b_commit = await get_snapshot(dut, "ttl")
+    assert array(first_after_b_commit, "ptc_applied") == ptc
+    assert array(first_after_b_commit, "front_applied") == front
+    assert array(first_after_b_commit, "rear_applied") == rear
+
+    old_control_epoch = int(dut.control_epoch_mon.value)
+    forced_epoch = (forced_epoch + 1) & 0xFFFF
+    dut.bmc_epoch_override_value.value = forced_epoch
+    await wait_for(
+        dut,
+        lambda: int(dut.control_epoch_mon.value) > old_control_epoch,
+        cycles=1000,
+        label="first wholly-B control pass",
+    )
+    active_b = await get_snapshot(dut, "rs232")
+    assert array(active_b, "ptc_requested") == ptc_b
+    assert array(active_b, "ptc_applied") == ptc_b
+    assert array(active_b, "front_applied") == front_b
+    assert array(active_b, "rear_applied") == rear_b
+    ptc, front, rear = ptc_b, front_b, rear_b
+    release_control_epoch = int(dut.control_epoch_mon.value)
+    dut.bmc_epoch_override_enable.value = 0
+    await wait_for(
+        dut,
+        lambda: int(dut.control_epoch_mon.value) > release_control_epoch,
+        cycles=1000,
+        label="epoch-hook release pass",
+    )
+
     await pulse_tick_1s(dut)
     await pulse_tick_1s(dut)
     assert int(dut.stimulus_active_mon.value) == 1
     assert int(dut.stimulus_active_mon.value) == 1
     await pulse_tick_1s(dut)
     await pulse_tick_1s(dut)

+ 2 - 0
tests/cocotb/thermal_6400_uart.py

@@ -218,6 +218,8 @@ async def initialize(dut, *, verify_boot: bool = False) -> None:
     dut.host_ttl_rx.value = 1
     dut.host_ttl_rx.value = 1
     dut.bmc_rs232_rx.value = 1
     dut.bmc_rs232_rx.value = 1
     dut.tick_1s_test.value = 0
     dut.tick_1s_test.value = 0
+    dut.bmc_epoch_override_enable.value = 0
+    dut.bmc_epoch_override_value.value = 0
     if verify_boot:
     if verify_boot:
         await verify_boot_full_speed_then_standby(dut)
         await verify_boot_full_speed_then_standby(dut)
     else:
     else:

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

@@ -4,6 +4,7 @@
   "proof_targets": [
   "proof_targets": [
     {"name": "core", "sby": "6400_core_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 4},
     {"name": "core", "sby": "6400_core_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 4},
     {"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": "transport_identification", "sby": "6400_transport_identification_properties.sby", "tasks": ["boolector", "z3"], "mode": "prove", "depth": 40},
     {"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},
@@ -12,6 +13,7 @@
   "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": "transport_identification_reachability", "sby": "6400_transport_identification_reachability.sby", "tasks": [], "mode": "cover", "depth": 100, "witnesses": ["P18"]},
     {"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"]},
@@ -24,7 +26,7 @@
     {"id": "P04", "requirement": "Invalid channels cannot heat", "harness": "6400_core_properties.sby"},
     {"id": "P04", "requirement": "Invalid channels cannot heat", "harness": "6400_core_properties.sby"},
     {"id": "P05", "requirement": "77 C lane fault overrides all lane PTC", "harness": "6400_core_properties.sby"},
     {"id": "P05", "requirement": "77 C lane fault overrides all lane PTC", "harness": "6400_core_properties.sby"},
     {"id": "P06", "requirement": "Bad CRC cannot change target", "harness": "6400_transport_properties.sby"},
     {"id": "P06", "requirement": "Bad CRC cannot change target", "harness": "6400_transport_properties.sby"},
-    {"id": "P07", "requirement": "ACK occurs only after legal atomic commit", "harness": "6400_transport_properties.sby"},
+    {"id": "P07", "requirement": "SET_TARGET ACK occurs only after legal atomic target commit", "harness": "6400_transport_properties.sby"},
     {"id": "P08", "requirement": "Inactive bank cannot affect active bank", "harness": "6400_bmc_bank_properties.sby"},
     {"id": "P08", "requirement": "Inactive bank cannot affect active bank", "harness": "6400_bmc_bank_properties.sby"},
     {"id": "P09", "requirement": "Bank swap is atomic", "harness": "6400_bmc_bank_properties.sby"},
     {"id": "P09", "requirement": "Bank swap is atomic", "harness": "6400_bmc_bank_properties.sby"},
     {"id": "P10", "requirement": "Scheduler has no permanent starvation", "harness": "6400_core_properties.sby"},
     {"id": "P10", "requirement": "Scheduler has no permanent starvation", "harness": "6400_core_properties.sby"},
@@ -34,6 +36,7 @@
     {"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 and boot keep fan pins at full-speed request until an initialized PWM-boundary release", "harness": "6400_boot_output_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"},
+    {"id": "P18", "requirement": "Identification stimulus stages 32 valid duties in an inactive bank, atomically flips once, and emits a fresh zero-length 0x83 ACK", "harness": "6400_transport_identification_properties.sby"}
   ]
   ]
 }
 }

+ 2 - 1
tests/formal/6400_core_properties.sby

@@ -11,12 +11,13 @@ boolector: smtbmc boolector
 z3: smtbmc z3 -- --noincr
 z3: smtbmc z3 -- --noincr
 
 
 [script]
 [script]
-read_verilog -formal -D FORMAL ef2_bram_dp.v thermal_output_banks.v thermal_control_core.v
+read_verilog -formal -D FORMAL ef2_bram_dp.v thermal_output_banks.v stimulus_atomic_bank.v thermal_control_core.v
 read_verilog -formal 6400_core_properties_formal.v
 read_verilog -formal 6400_core_properties_formal.v
 prep -top thermal_6400_core_properties_formal
 prep -top thermal_6400_core_properties_formal
 
 
 [files]
 [files]
 ../../src/common/ef2_bram_dp.v
 ../../src/common/ef2_bram_dp.v
 ../../src/control/thermal_output_banks.v
 ../../src/control/thermal_output_banks.v
+../../src/control/stimulus_atomic_bank.v
 ../../src/control/thermal_control_core.v
 ../../src/control/thermal_control_core.v
 6400_core_properties_formal.v
 6400_core_properties_formal.v

+ 2 - 1
tests/formal/6400_core_reachability.sby

@@ -6,12 +6,13 @@ depth 220
 smtbmc boolector
 smtbmc boolector
 
 
 [script]
 [script]
-read_verilog -formal -D FORMAL ef2_bram_dp.v thermal_output_banks.v thermal_control_core.v
+read_verilog -formal -D FORMAL ef2_bram_dp.v thermal_output_banks.v stimulus_atomic_bank.v thermal_control_core.v
 read_verilog -formal 6400_core_properties_formal.v
 read_verilog -formal 6400_core_properties_formal.v
 prep -top thermal_6400_core_properties_formal
 prep -top thermal_6400_core_properties_formal
 
 
 [files]
 [files]
 ../../src/common/ef2_bram_dp.v
 ../../src/common/ef2_bram_dp.v
 ../../src/control/thermal_output_banks.v
 ../../src/control/thermal_output_banks.v
+../../src/control/stimulus_atomic_bank.v
 ../../src/control/thermal_control_core.v
 ../../src/control/thermal_control_core.v
 6400_core_properties_formal.v
 6400_core_properties_formal.v

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

@@ -0,0 +1,21 @@
+[tasks]
+boolector
+z3
+
+[options]
+mode prove
+depth 40
+
+[engines]
+boolector: smtbmc boolector
+z3: smtbmc z3 -- --noincr
+
+[script]
+read_verilog -formal -D FORMAL thermal_host_command.v stimulus_atomic_bank.v
+read_verilog -formal 6400_transport_identification_properties_formal.v
+prep -top thermal_6400_transport_identification_properties_formal
+
+[files]
+../../src/transport/thermal_host_command.v
+../../src/control/stimulus_atomic_bank.v
+6400_transport_identification_properties_formal.v

+ 251 - 0
tests/formal/6400_transport_identification_properties_formal.v

@@ -0,0 +1,251 @@
+// Command-level Identification proof. Physical UART serialization and its
+// final Stop Bit remain covered by source inspection and full-UART Cocotb;
+// this harness proves command admission, atomic stimulus commit, ACK metadata,
+// repeat handling, and silent invalid-command retirement.
+module thermal_6400_transport_identification_properties_formal (
+    input wire clk,
+    input wire rst_n
+);
+    (* anyseq *) reg frame_valid;
+    (* anyseq *) reg [7:0] frame_type;
+    (* anyseq *) reg [7:0] frame_length;
+    (* anyseq *) reg snapshot_ready;
+    (* anyseq *) reg tx_done;
+    // Every request in one proof trace uses the same payload case. Case zero
+    // is valid duration=2 / duty=50, case one has duration zero, and cases two
+    // and three contain a duty of 101. All four anyconst values therefore have
+    // an explicit semantic class without an extra proof assumption.
+    (* anyconst *) reg [1:0] payload_case;
+
+    wire frame_ready;
+    wire frame_accept_enable;
+    wire [7:0] payload_read_addr;
+    reg [7:0] payload_read_data;
+    wire target_commit;
+    wire [7:0] target_celsius;
+    wire stimulus_wr_en;
+    wire [4:0] stimulus_wr_addr;
+    wire [7:0] stimulus_wr_data;
+    wire stimulus_commit;
+    wire [7:0] stimulus_duration_seconds;
+    wire snapshot_capture;
+    wire tx_start;
+    wire [7:0] tx_frame_type;
+    wire [7:0] tx_payload_length;
+    wire transaction_done;
+    wire command_busy;
+    wire [3:0] formal_state;
+    wire [5:0] formal_index;
+    wire formal_stimulus_bad;
+    wire bank_commit_applied;
+    wire stimulus_bank_active;
+    (* anyconst *) reg [4:0] formal_bank_address;
+    wire [7:0] formal_active_stimulus_data;
+
+    always @* begin
+        if (payload_read_addr == 0)
+            payload_read_data = (payload_case == 1) ? 8'd0 : 8'd2;
+        else if (payload_case[1] && payload_read_addr == 17)
+            payload_read_data = 8'd101;
+        else
+            payload_read_data = 8'd50;
+    end
+
+    thermal_host_command #(.ENABLE_STIMULUS(1), .SNAPSHOT_LENGTH(193)) u_command (
+        .clk(clk), .rst_n(rst_n), .frame_valid(frame_valid), .frame_ready(frame_ready),
+        .frame_accept_enable(frame_accept_enable), .frame_type(frame_type),
+        .frame_length(frame_length), .payload_read_addr(payload_read_addr),
+        .payload_read_data(payload_read_data), .target_commit(target_commit),
+        .target_celsius(target_celsius), .stimulus_wr_en(stimulus_wr_en),
+        .stimulus_wr_addr(stimulus_wr_addr), .stimulus_wr_data(stimulus_wr_data),
+        .stimulus_commit(stimulus_commit),
+        .stimulus_duration_seconds(stimulus_duration_seconds),
+        .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),
+        .transaction_done(transaction_done), .busy(command_busy),
+        .formal_state_o(formal_state), .formal_index_o(formal_index),
+        .formal_stimulus_bad_o(formal_stimulus_bad)
+    );
+
+    // Real Identification command-to-storage wiring. Physical UART
+    // serialization and its final Stop Bit are deliberately outside this
+    // command-level proof and remain covered by full-UART Cocotb.
+    stimulus_atomic_bank u_stimulus_bank (
+        .clk(clk), .rst_n(rst_n),
+        .write_enable(stimulus_wr_en),
+        .write_address(stimulus_wr_addr),
+        .write_data(stimulus_wr_data),
+        .stimulus_commit(stimulus_commit),
+        .commit_applied(bank_commit_applied),
+        .active_bank(stimulus_bank_active),
+        .read_bank(stimulus_bank_active),
+        .read_address(formal_bank_address),
+        .read_data(formal_active_stimulus_data)
+    );
+
+    wire command_accept = frame_valid && frame_ready && frame_accept_enable;
+    wire stimulus_shape = frame_type == 8'h03 && frame_length == 8'd33;
+    wire legal_stimulus_accept = command_accept && stimulus_shape && payload_case == 0;
+    wire invalid_payload_accept = command_accept && stimulus_shape && payload_case != 0;
+    wire supported_shape =
+        (frame_type == 8'h01 && frame_length == 8'd1) ||
+        (frame_type == 8'h02 && frame_length == 8'd0) || stimulus_shape;
+    wire invalid_shape_accept = command_accept && !supported_shape;
+    wire invalid_stimulus_length_accept = command_accept &&
+        frame_type == 8'h03 && frame_length != 8'd33;
+    wire unknown_type_accept = command_accept &&
+        frame_type != 8'h01 && frame_type != 8'h02 && frame_type != 8'h03;
+
+    reg [1:0] reset_cycles = 0;
+    reg formal_past_valid = 0;
+    reg legal_pending;
+    reg invalid_pending;
+    reg [5:0] pending_age;
+    reg [31:0] writes_seen;
+    reg completed_legal;
+    reg repeat_pending;
+    reg repeated_ack_seen;
+    reg invalid_duration_silent_seen;
+    reg invalid_duty_silent_seen;
+    reg invalid_entry_bank;
+
+    always @(posedge clk) begin
+        formal_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 (!rst_n) begin
+            legal_pending <= 1'b0;
+            invalid_pending <= 1'b0;
+            pending_age <= 0;
+            writes_seen <= 0;
+            completed_legal <= 1'b0;
+            repeat_pending <= 1'b0;
+            repeated_ack_seen <= 1'b0;
+            invalid_duration_silent_seen <= 1'b0;
+            invalid_duty_silent_seen <= 1'b0;
+            invalid_entry_bank <= 1'b0;
+        end else begin
+            assume(formal_bank_address < 32);
+            if (legal_stimulus_accept || invalid_payload_accept) begin
+                assert(!legal_pending && !invalid_pending);
+                legal_pending <= legal_stimulus_accept;
+                invalid_pending <= invalid_payload_accept;
+                pending_age <= 0;
+                writes_seen <= 0;
+                repeat_pending <= legal_stimulus_accept && completed_legal;
+                if (invalid_payload_accept)
+                    invalid_entry_bank <= stimulus_bank_active;
+            end else if (legal_pending || invalid_pending) begin
+                pending_age <= pending_age + 1'b1;
+            end
+
+            if (stimulus_wr_en) begin
+                assert(legal_pending || invalid_pending);
+                assert(stimulus_wr_data <= 100);
+                writes_seen[stimulus_wr_addr] <= 1'b1;
+                assert(!stimulus_commit);
+            end
+
+            // The monitor age is an exact image of the deterministic command
+            // pipeline. These invariants turn the bounded completion claim
+            // into an inductive proof rather than a simulation-like timeout.
+            if (legal_pending || invalid_pending) begin
+                assert(pending_age <= 34);
+                if (formal_state == 4'd3)
+                    assert(pending_age == 0);
+                if (formal_state == 4'd4)
+                    assert(pending_age == formal_index);
+                if (formal_state == 4'd5)
+                    assert(pending_age == 33);
+            end
+            if (legal_pending) begin
+                assert(!formal_stimulus_bad);
+                assert(formal_state == 4'd3 || formal_state == 4'd4 ||
+                       formal_state == 4'd5 || formal_state == 4'd6);
+                if (formal_state == 4'd6) begin
+                    assert(pending_age == 34);
+                    assert(stimulus_commit);
+                    assert(tx_start && tx_frame_type == 8'h83 && tx_payload_length == 0);
+                end
+            end
+            if (invalid_pending) begin
+                assert(formal_state == 4'd3 || formal_state == 4'd4 ||
+                       formal_state == 4'd5 || formal_state == 4'd7);
+                assert(!stimulus_commit);
+                assert(!(tx_start && tx_frame_type == 8'h83));
+                assert(stimulus_bank_active == invalid_entry_bank);
+                if (formal_state == 4'd7) begin
+                    assert(pending_age == 34);
+                    assert(transaction_done);
+                end
+            end
+
+            // A legal request becomes visible atomically only after all 32
+            // duty bytes have been admitted. The independent ACK starts from
+            // that same commit edge and always has zero payload length.
+            if (stimulus_commit || (tx_start && tx_frame_type == 8'h83)) begin
+                assert(legal_pending);
+                assert(writes_seen == 32'hFFFF_FFFF);
+                assert(stimulus_duration_seconds == 2);
+                assert(stimulus_commit);
+                assert(bank_commit_applied);
+                assert(tx_start && tx_frame_type == 8'h83 && tx_payload_length == 0);
+                legal_pending <= 1'b0;
+                completed_legal <= 1'b1;
+                if (repeat_pending)
+                    repeated_ack_seen <= 1'b1;
+                repeat_pending <= 1'b0;
+            end
+            if (repeat_pending)
+                assert(legal_pending);
+
+            if (formal_past_valid && $past(rst_n)) begin
+                if ($past(stimulus_wr_en)) begin
+                    assert(stimulus_bank_active == $past(stimulus_bank_active));
+                    assert(formal_active_stimulus_data ==
+                           $past(formal_active_stimulus_data));
+                end
+                if ($past(bank_commit_applied)) begin
+                    assert(stimulus_bank_active != $past(stimulus_bank_active));
+                end
+                if (!$past(bank_commit_applied))
+                    assert(stimulus_bank_active == $past(stimulus_bank_active));
+            end
+
+            if (invalid_pending && transaction_done) begin
+                invalid_pending <= 1'b0;
+                if (payload_case == 1)
+                    invalid_duration_silent_seen <= 1'b1;
+                if (payload_case[1])
+                    invalid_duty_silent_seen <= 1'b1;
+            end
+
+            // Wrong lengths and unknown request types retire immediately and
+            // silently. Bad CRC remains proved through frame_rx in the
+            // unchanged Production transport harness.
+            if (formal_past_valid && $past(rst_n) &&
+                $past(invalid_shape_accept)) begin
+                assert(transaction_done);
+                assert(!tx_start);
+                assert(!stimulus_commit);
+            end
+
+            cover(repeated_ack_seen);
+            cover(formal_past_valid && $past(bank_commit_applied) &&
+                  stimulus_bank_active != $past(stimulus_bank_active) &&
+                  formal_active_stimulus_data == 8'd50);
+            cover(invalid_duration_silent_seen);
+            cover(invalid_duty_silent_seen);
+            cover(formal_past_valid && $past(invalid_stimulus_length_accept) &&
+                  transaction_done && !tx_start);
+            cover(formal_past_valid && $past(unknown_type_accept) &&
+                  transaction_done && !tx_start);
+        end
+    end
+endmodule

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

@@ -0,0 +1,16 @@
+[options]
+mode cover
+depth 100
+
+[engines]
+smtbmc boolector
+
+[script]
+read_verilog -formal -D FORMAL thermal_host_command.v stimulus_atomic_bank.v
+read_verilog -formal 6400_transport_identification_properties_formal.v
+prep -top thermal_6400_transport_identification_properties_formal
+
+[files]
+../../src/transport/thermal_host_command.v
+../../src/control/stimulus_atomic_bank.v
+6400_transport_identification_properties_formal.v

+ 14 - 0
tests/formal/6400_transport_properties_formal.v

@@ -34,6 +34,8 @@ module thermal_6400_transport_properties_formal (
     wire ttl_tx;
     wire ttl_tx;
     wire host_locked;
     wire host_locked;
     wire host_port_sel;
     wire host_port_sel;
+    wire production_stimulus_accept = frame_valid && frame_ready &&
+        frame_accept_enable && frame_type == 8'h03 && frame_length == 8'd33;
 
 
     frame_rx #(.MAX_PAYLOAD(33), .INTER_BYTE_TIMEOUT_CYCLES(8)) u_frame_rx (
     frame_rx #(.MAX_PAYLOAD(33), .INTER_BYTE_TIMEOUT_CYCLES(8)) u_frame_rx (
         .clk(clk), .rst_n(rst_n), .byte_valid(byte_valid), .byte_data(byte_data),
         .clk(clk), .rst_n(rst_n), .byte_valid(byte_valid), .byte_data(byte_data),
@@ -104,10 +106,22 @@ module thermal_6400_transport_properties_formal (
             if (target_commit)
             if (target_commit)
                 assert(accepted_crc_good);
                 assert(accepted_crc_good);
 
 
+            // Production has no stimulus capability. A CRC-valid stimulus
+            // frame is still an unsupported command and therefore retires
+            // silently without an ACK or a hidden stimulus commit.
+            if (formal_past_valid && $past(rst_n) &&
+                $past(production_stimulus_accept)) begin
+                assert(transaction_done);
+                assert(!tx_start);
+                assert(!stimulus_commit);
+            end
+
             cover(bad_crc_quarantine && !target_commit &&
             cover(bad_crc_quarantine && !target_commit &&
                   target_celsius == bad_crc_target);
                   target_celsius == bad_crc_target);
             cover(target_commit && accepted_crc_good && tx_start &&
             cover(target_commit && accepted_crc_good && tx_start &&
                   tx_frame_type == 8'h81);
                   tx_frame_type == 8'h81);
+            cover(formal_past_valid && $past(production_stimulus_accept) &&
+                  transaction_done && !tx_start && !stimulus_commit);
         end
         end
     end
     end
 endmodule
 endmodule

+ 98 - 0
tests/sim/stimulus_atomic_bank_tb.v

@@ -0,0 +1,98 @@
+`timescale 1ns/1ps
+
+module stimulus_atomic_bank_tb;
+    reg clk = 0;
+    reg rst_n = 0;
+    reg write_enable = 0;
+    reg [4:0] write_address = 0;
+    reg [7:0] write_data = 0;
+    reg stimulus_commit = 0;
+    wire commit_applied;
+    wire active_bank;
+    reg read_bank = 0;
+    reg [4:0] read_address = 0;
+    wire [7:0] read_data;
+    integer i;
+
+    always #5 clk = ~clk;
+
+    stimulus_atomic_bank dut (
+        .clk(clk), .rst_n(rst_n), .write_enable(write_enable),
+        .write_address(write_address), .write_data(write_data),
+        .stimulus_commit(stimulus_commit), .commit_applied(commit_applied),
+        .active_bank(active_bank),
+        .read_bank(read_bank), .read_address(read_address), .read_data(read_data)
+    );
+
+    task write_inactive;
+        input [4:0] address;
+        input [7:0] data;
+        begin
+            @(negedge clk);
+            write_enable = 1;
+            write_address = address;
+            write_data = data;
+            @(negedge clk);
+            write_enable = 0;
+        end
+    endtask
+
+    task commit_bank;
+        begin
+            @(negedge clk);
+            stimulus_commit = 1;
+            @(negedge clk);
+            stimulus_commit = 0;
+        end
+    endtask
+
+    task expect_active;
+        input [7:0] base;
+        begin
+            read_bank = active_bank;
+            for (i = 0; i < 32; i = i + 1) begin
+                read_address = i[4:0];
+                #1;
+                if (read_data !== base + i[7:0]) begin
+                    $display("FAIL: active[%0d]=%0d expected=%0d", i, read_data, base + i);
+                    $fatal(1);
+                end
+            end
+        end
+    endtask
+
+    initial begin
+        repeat (2) @(negedge clk);
+        rst_n = 1;
+
+        // A complete legal command stages vector A without exposing a byte.
+        for (i = 0; i < 32; i = i + 1)
+            write_inactive(i[4:0], 8'd10 + i[7:0]);
+        if (active_bank !== 0)
+            $fatal(1, "inactive staging changed pointer before commit");
+        commit_bank();
+        if (active_bank !== 1) $fatal(1, "first commit did not flip pointer");
+        expect_active(8'd10);
+
+        // An invalid/partial command may dirty the inactive bank, but without
+        // stimulus_commit it cannot alter either the pointer or active data.
+        for (i = 0; i < 12; i = i + 1)
+            write_inactive(i[4:0], 8'd80 + i[7:0]);
+        // A raw commit after a partial command is rejected inside the bank.
+        commit_bank();
+        if (active_bank !== 1) $fatal(1, "partial command changed pointer");
+        expect_active(8'd10);
+
+        // The next complete legal command overwrites all 32 inactive bytes;
+        // one commit exposes the entire B vector atomically.
+        for (i = 0; i < 32; i = i + 1)
+            write_inactive(i[4:0], 8'd40 + i[7:0]);
+        expect_active(8'd10);
+        commit_bank();
+        if (active_bank !== 0) $fatal(1, "second commit did not flip pointer");
+        expect_active(8'd40);
+
+        $display("PASS: stimulus atomic bank inactive staging and pointer commit");
+        $finish;
+    end
+endmodule

+ 48 - 3
tests/unit/test_6400_formal_contract.py

@@ -23,12 +23,12 @@ def _manifest() -> dict:
     return json.loads((FORMAL / "6400-properties.json").read_text(encoding="utf-8"))
     return json.loads((FORMAL / "6400-properties.json").read_text(encoding="utf-8"))
 
 
 
 
-def test_exact_p01_p17_manifest() -> None:
+def test_exact_p01_p18_manifest() -> None:
     manifest = _manifest()
     manifest = _manifest()
     assert [item["id"] for item in manifest["properties"]] == [
     assert [item["id"] for item in manifest["properties"]] == [
-        f"P{index:02d}" for index in range(1, 18)
+        f"P{index:02d}" for index in range(1, 19)
     ]
     ]
-    assert len({item["id"] for item in manifest["properties"]}) == 17
+    assert len({item["id"] for item in manifest["properties"]}) == 18
 
 
 
 
 def test_every_proof_runs_boolector_and_z3() -> None:
 def test_every_proof_runs_boolector_and_z3() -> None:
@@ -65,6 +65,51 @@ def test_boot_output_proof_uses_production_controller_and_board_adapter() -> Non
     assert p17["harness"] == "6400_boot_output_properties.sby"
     assert p17["harness"] == "6400_boot_output_properties.sby"
 
 
 
 
+def test_identification_transport_proves_fresh_ack_without_claiming_uart_stop_bit() -> None:
+    manifest = _manifest()
+    target = next(
+        item for item in manifest["proof_targets"]
+        if item["name"] == "transport_identification"
+    )
+    reachability = next(
+        item for item in manifest["cover_targets"]
+        if item["name"] == "transport_identification_reachability"
+    )
+    assert target["sby"] == "6400_transport_identification_properties.sby"
+    assert reachability["sby"] == "6400_transport_identification_reachability.sby"
+    assert reachability["witnesses"] == ["P18"]
+
+    proof = (FORMAL / target["sby"]).read_text(encoding="utf-8")
+    harness = (
+        FORMAL / "6400_transport_identification_properties_formal.v"
+    ).read_text(encoding="utf-8")
+    assert "thermal_host_command.v" in proof
+    assert "stimulus_atomic_bank.v" in proof
+    assert "uart_tx_byte.v" not in proof
+    assert "repeated_ack_seen" in harness
+    assert "writes_seen == 32'hFFFF_FFFF" in harness
+    assert "tx_frame_type == 8'h83 && tx_payload_length == 0" in harness
+    assert "invalid_duration_silent_seen" in harness
+    assert "invalid_duty_silent_seen" in harness
+    assert "Physical UART serialization" in harness
+    assert "u_command.state" not in harness
+    assert ".formal_state_o(formal_state)" in harness
+    assert "bank_commit_applied" in harness
+    assert "formal_active_stimulus_data == 8'd50" in harness
+
+    command = (ROOT / "src/transport/thermal_host_command.v").read_text(
+        encoding="utf-8"
+    )
+    assert "`ifdef FORMAL\n    , output wire [3:0] formal_state_o" in command
+
+    p07 = next(item for item in manifest["properties"] if item["id"] == "P07")
+    assert p07["harness"] == "6400_transport_properties.sby"
+    assert p07["requirement"].startswith("SET_TARGET ACK")
+    p18 = next(item for item in manifest["properties"] if item["id"] == "P18")
+    assert p18["harness"] == "6400_transport_identification_properties.sby"
+    assert p18["requirement"].startswith("Identification stimulus stages 32")
+
+
 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

+ 4 - 0
tests/unit/test_6400_v1_source_closure.py

@@ -16,6 +16,10 @@ def test_production_closure_excludes_legacy_and_stimulus_wrapper() -> None:
     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"]
     assert "src/actuator/fan_boot_safety_controller.v" in closure["sources"]
+    assert "src/control/stimulus_atomic_bank.v" in closure["sources"]
+
+    runner = (ROOT / "tools/run_6400_v1.py").read_text(encoding="utf-8")
+    assert "select -assert-none t:stimulus_atomic_bank" in runner
 
 
 
 
 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:

+ 3 - 3
tools/run_6400_formal.py

@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
 #!/usr/bin/env python3
-"""Run and bind the complete 6400 P01-P17 formal acceptance suite."""
+"""Run and bind the complete 6400 P01-P18 formal acceptance suite."""
 
 
 from __future__ import annotations
 from __future__ import annotations
 
 
@@ -386,7 +386,7 @@ def run_job(job: dict[str, Any], run_root: Path, timeout: int) -> dict[str, Any]
 def validate_manifest(manifest: dict[str, Any]) -> None:
 def validate_manifest(manifest: dict[str, Any]) -> None:
     properties = manifest.get("properties", [])
     properties = manifest.get("properties", [])
     ids = [entry.get("id") for entry in properties]
     ids = [entry.get("id") for entry in properties]
-    expected = [f"P{index:02d}" for index in range(1, 18)]
+    expected = [f"P{index:02d}" for index in range(1, 19)]
     if ids != expected:
     if ids != expected:
         raise ValueError(f"formal property IDs must be exactly {expected}, got {ids}")
         raise ValueError(f"formal property IDs must be exactly {expected}, got {ids}")
     proof_targets = manifest.get("proof_targets", [])
     proof_targets = manifest.get("proof_targets", [])
@@ -394,7 +394,7 @@ def validate_manifest(manifest: dict[str, Any]) -> None:
         raise ValueError("proof_targets is empty")
         raise ValueError("proof_targets is empty")
     harnesses = {entry["sby"] for entry in proof_targets}
     harnesses = {entry["sby"] for entry in proof_targets}
     if any(entry.get("harness") not in harnesses for entry in properties):
     if any(entry.get("harness") not in harnesses for entry in properties):
-        raise ValueError("a P01-P17 property references a non-proof harness")
+        raise ValueError("a P01-P18 property references a non-proof harness")
     for target in [*proof_targets, *manifest.get("cover_targets", [])]:
     for target in [*proof_targets, *manifest.get("cover_targets", [])]:
         sby_path = FORMAL_DIR / target["sby"]
         sby_path = FORMAL_DIR / target["sby"]
         if not sby_path.is_file():
         if not sby_path.is_file():

+ 4 - 1
tools/run_6400_v1.py

@@ -17,6 +17,7 @@ CLOSURE = ROOT / "products/6400-control/source-closure.json"
 TESTBENCHES = (
 TESTBENCHES = (
     "host_port_selector_tb",
     "host_port_selector_tb",
     "bmc_ascii_snapshot_tb",
     "bmc_ascii_snapshot_tb",
+    "stimulus_atomic_bank_tb",
     "thermal_control_core_tb",
     "thermal_control_core_tb",
 )
 )
 PWM_TESTBENCH = "pwm_bitmap_engine_tb"
 PWM_TESTBENCH = "pwm_bitmap_engine_tb"
@@ -67,7 +68,9 @@ def lint() -> None:
     ])
     ])
     script = (
     script = (
         "read_verilog -I. " + " ".join(sources())
         "read_verilog -I. " + " ".join(sources())
-        + f"; hierarchy -check -top {top}; proc; check"
+        + f"; hierarchy -check -top {top}; "
+          "select -assert-none t:stimulus_atomic_bank; "
+          "flatten; proc; opt_clean -purge; check"
     )
     )
     run(["yosys", "-q", "-p", script])
     run(["yosys", "-q", "-p", script])