瀏覽代碼

feat: bind 6400 fan adapter and host ACKs

root 3 月之前
父節點
當前提交
a5ecae432b

+ 24 - 4
contracts/6400-wire.yaml

@@ -18,12 +18,32 @@ bmc_uart:
   response_data_bytes: 48
   response_data_bytes: 48
 commands:
 commands:
   SET_TARGET: {type: 0x01, payload_length: 1, response: SET_TARGET_ACK, valid: [0, 20-70]}
   SET_TARGET: {type: 0x01, payload_length: 1, response: SET_TARGET_ACK, valid: [0, 20-70]}
-  GET_SNAPSHOT: {type: 0x02, payload_length: 0, response: SNAPSHOT_DATA}
-  SET_STIMULUS: {type: 0x03, payload_length: 33, response: SET_STIMULUS_ACK, profiles: [identification, sim-debug]}
+  GET_SNAPSHOT: {type: 0x02, payload_length: 0, response: [GET_SNAPSHOT_ACK, SNAPSHOT_DATA]}
+  SET_STIMULUS:
+    type: 0x03
+    payload_length: 33
+    response: SET_STIMULUS_ACK
+    profiles: [6400-identification, 6400-sim-debug]
+    payload_fields:
+      - {name: duration_seconds, offset: 0, count: 1, minimum: 1, maximum: 255, unit: seconds}
+      - {name: ptc_duty_percent, offset: 1, count: 24, minimum: 0, maximum: 100, unit: percent}
+      - {name: front_fan_duty_percent, offset: 25, count: 4, minimum: 0, maximum: 100, unit: percent}
+      - {name: rear_fan_duty_percent, offset: 29, count: 4, minimum: 0, maximum: 100, unit: percent}
 responses:
 responses:
   SET_TARGET_ACK: {type: 0x81, payload_length: 0}
   SET_TARGET_ACK: {type: 0x81, payload_length: 0}
-  SNAPSHOT_DATA: {type: 0x82, payload_contract: 6400-snapshot.yaml}
-  SET_STIMULUS_ACK: {type: 0x83, payload_length: 0, profiles: [identification, sim-debug]}
+  GET_SNAPSHOT_ACK: {type: 0x82, payload_length: 0}
+  SNAPSHOT_DATA: {type: 0x42, payload_contract: 6400-snapshot.yaml}
+  SET_STIMULUS_ACK: {type: 0x83, payload_length: 0, profiles: [6400-identification, 6400-sim-debug]}
+type_classes:
+  request: 0x01-0x3F
+  data: request_type_or_0x40
+  ack: request_type_or_0x80
+  reserved: 0xC0-0xFF
+host_response_order:
+  SET_TARGET: [SET_TARGET_ACK]
+  GET_SNAPSHOT: [GET_SNAPSHOT_ACK, SNAPSHOT_DATA]
+  SET_STIMULUS: [SET_STIMULUS_ACK]
+ack_contract: {payload_length: 0, independent_frame: true, every_legal_command: true}
 invalid_behavior: silent_drop
 invalid_behavior: silent_drop
 outstanding_transactions: 1
 outstanding_transactions: 1
 forbidden_fields: [protocol_version, project_id, profile_id, capability, sequence, transaction_id, timestamp, tlv, nack]
 forbidden_fields: [protocol_version, project_id, profile_id, capability, sequence, transaction_id, timestamp, tlv, nack]

+ 10 - 0
contracts/channel-map.yaml

@@ -5,6 +5,16 @@ lanes:
   - {air_lane: 1, cpu: 0, cpu_slots: [6, 11], thermal_zone: 1, cohort: primary}
   - {air_lane: 1, cpu: 0, cpu_slots: [6, 11], thermal_zone: 1, cohort: primary}
   - {air_lane: 2, cpu: 1, cpu_slots: [0, 5], thermal_zone: 1, cohort: primary}
   - {air_lane: 2, cpu: 1, cpu_slots: [0, 5], thermal_zone: 1, cohort: primary}
   - {air_lane: 3, cpu: 1, cpu_slots: [6, 11], thermal_zone: 2, cohort: holdout}
   - {air_lane: 3, cpu: 1, cpu_slots: [6, 11], thermal_zone: 2, cohort: holdout}
+fan_output_vector_order: [front0, front1, front2, front3, rear0, rear1, rear2, rear3]
+fan_outputs:
+  - {output_index: 24, group: front, lane: 0, connector: CON25, pin: 7, net: FAN_PWM3, board_stage: Q101, fpga_ball: B1, board_inverts: true, ball_active_level: low, connector_active_level: high, evidence: confirmed_board_v1_1}
+  - {output_index: 25, group: front, lane: 1, connector: CON8, pin: 7, net: FAN_PWM1, board_stage: Q99, fpga_ball: C4, board_inverts: true, ball_active_level: low, connector_active_level: high, evidence: confirmed_board_v1_1}
+  - {output_index: 26, group: front, lane: 2, connector: CON24, pin: 7, net: FAN_PWM2, board_stage: Q100, fpga_ball: B5, board_inverts: true, ball_active_level: low, connector_active_level: high, evidence: confirmed_board_v1_1}
+  - {output_index: 27, group: front, lane: 3, connector: CON26, pin: 7, net: FAN_PWM4, board_stage: Q102, fpga_ball: A14, board_inverts: true, ball_active_level: low, connector_active_level: high, evidence: confirmed_board_v1_1}
+  - {output_index: 28, group: rear, lane: 0, connector: CON64, pin: 4, net: FAN_GPIO44, board_stage: R704_0R_DIRECT, fpga_ball: P15, board_inverts: false, ball_active_level: high, connector_active_level: high, evidence: confirmed_board_v1_1}
+  - {output_index: 29, group: rear, lane: 1, connector: CON66, pin: 4, net: FAN_GPIO46, board_stage: R706_0R_DIRECT, fpga_ball: N15, board_inverts: false, ball_active_level: high, connector_active_level: high, evidence: confirmed_board_v1_1}
+  - {output_index: 30, group: rear, lane: 2, connector: CON62, pin: 4, net: FAN_GPIO42, board_stage: R702_0R_DIRECT, fpga_ball: M14, board_inverts: false, ball_active_level: high, connector_active_level: high, evidence: confirmed_board_v1_1}
+  - {output_index: 31, group: rear, lane: 3, connector: CON60, pin: 4, net: FAN_GPIO40, board_stage: R700_0R_DIRECT, fpga_ball: P5, board_inverts: false, ball_active_level: high, connector_active_level: high, evidence: confirmed_board_v1_1}
 channels:
 channels:
   - {logical_dimm: 0, cpu: 0, cpu_slot: 0, air_lane: 0, thermal_zone: 0, ptc_channel: 0, bmc_temperature_index: 0, ct7428_channel: unknown, front_fan_channel: 0, rear_fan_channel: 0, primary_cohort: true, enabled: true, physical_label: CPU0_DIMM0, evidence: {source: active-task-contract, location: topology, confidence: confirmed}}
   - {logical_dimm: 0, cpu: 0, cpu_slot: 0, air_lane: 0, thermal_zone: 0, ptc_channel: 0, bmc_temperature_index: 0, ct7428_channel: unknown, front_fan_channel: 0, rear_fan_channel: 0, primary_cohort: true, enabled: true, physical_label: CPU0_DIMM0, evidence: {source: active-task-contract, location: topology, confidence: confirmed}}
   - {logical_dimm: 1, cpu: 0, cpu_slot: 1, air_lane: 0, thermal_zone: 0, ptc_channel: 1, bmc_temperature_index: 1, ct7428_channel: unknown, front_fan_channel: 0, rear_fan_channel: 0, primary_cohort: true, enabled: true, physical_label: CPU0_DIMM1, evidence: {source: active-task-contract, location: topology, confidence: confirmed}}
   - {logical_dimm: 1, cpu: 0, cpu_slot: 1, air_lane: 0, thermal_zone: 0, ptc_channel: 1, bmc_temperature_index: 1, ct7428_channel: unknown, front_fan_channel: 0, rear_fan_channel: 0, primary_cohort: true, enabled: true, physical_label: CPU0_DIMM1, evidence: {source: active-task-contract, location: topology, confidence: confirmed}}

+ 15 - 3
contracts/fan-control-parameters.yaml

@@ -1,6 +1,18 @@
-schema: prod2u-6400-fan-control-v1
-truth_label: SIMULATION_DEFAULT_NOT_HARDWARE_TUNED
-duty: {reset: 10, stopped: 30, nominal: 30, warm: 50, protection: 80, hard: 100}
+schema: prod2u-6400-fan-control-v2
+truth_label: EXPERIMENTAL_UNVERIFIED
+duty: {reset: 10, stopped: 10, nominal: 30, warm: 50, protection: 80, hard: 100}
 temperature_centi_degC: {warm_delta_from_target: -300, protection: 7400, hard: 7700}
 temperature_centi_degC: {warm_delta_from_target: -300, protection: 7400, hard: 7700}
 invalid_lane_threshold: 2
 invalid_lane_threshold: 2
 front_rear_independent: true
 front_rear_independent: true
+pwm:
+  ptc_hz: 500
+  fan_hz: 500
+  clock_hz: 25000000
+  phases: 100
+  ptc_phase_clks: 500
+  fan_phase_clks: 500
+  carrier_backend: shared_equal_frequency_v1
+  evidence: EXPERIMENTAL_CONFIGURATION_NOT_FAN_DATASHEET_VERIFIED
+pwm_high_level_status: PWM_HIGH_LEVEL_UNVERIFIED
+actual_rpm_status: NOT_RUN
+actual_airflow_status: NOT_RUN

+ 1 - 1
docs/generated/6400-channel-map.md

@@ -1,6 +1,6 @@
 # Generated 6400 channel map
 # Generated 6400 channel map
 
 
-Contract SHA-256: `06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1`.
+Contract SHA-256: `9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1`.
 
 
 | DIMM | CPU slot | Lane | Zone | PTC | BMC | CT | Cohort |
 | DIMM | CPU slot | Lane | Zone | PTC | BMC | CT | Cohort |
 | ---: | --- | ---: | ---: | ---: | ---: | --- | --- |
 | ---: | --- | ---: | ---: | ---: | ---: | --- | --- |

+ 125 - 1
generated/6400/channel-map.json

@@ -481,7 +481,131 @@
       "thermal_zone": 2
       "thermal_zone": 2
     }
     }
   ],
   ],
-  "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+  "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
+  "fan_output_vector_order": [
+    "front0",
+    "front1",
+    "front2",
+    "front3",
+    "rear0",
+    "rear1",
+    "rear2",
+    "rear3"
+  ],
+  "fan_outputs": [
+    {
+      "ball_active_level": "low",
+      "board_inverts": true,
+      "board_stage": "Q101",
+      "connector": "CON25",
+      "connector_active_level": "high",
+      "evidence": "confirmed_board_v1_1",
+      "fpga_ball": "B1",
+      "group": "front",
+      "lane": 0,
+      "net": "FAN_PWM3",
+      "output_index": 24,
+      "pin": 7
+    },
+    {
+      "ball_active_level": "low",
+      "board_inverts": true,
+      "board_stage": "Q99",
+      "connector": "CON8",
+      "connector_active_level": "high",
+      "evidence": "confirmed_board_v1_1",
+      "fpga_ball": "C4",
+      "group": "front",
+      "lane": 1,
+      "net": "FAN_PWM1",
+      "output_index": 25,
+      "pin": 7
+    },
+    {
+      "ball_active_level": "low",
+      "board_inverts": true,
+      "board_stage": "Q100",
+      "connector": "CON24",
+      "connector_active_level": "high",
+      "evidence": "confirmed_board_v1_1",
+      "fpga_ball": "B5",
+      "group": "front",
+      "lane": 2,
+      "net": "FAN_PWM2",
+      "output_index": 26,
+      "pin": 7
+    },
+    {
+      "ball_active_level": "low",
+      "board_inverts": true,
+      "board_stage": "Q102",
+      "connector": "CON26",
+      "connector_active_level": "high",
+      "evidence": "confirmed_board_v1_1",
+      "fpga_ball": "A14",
+      "group": "front",
+      "lane": 3,
+      "net": "FAN_PWM4",
+      "output_index": 27,
+      "pin": 7
+    },
+    {
+      "ball_active_level": "high",
+      "board_inverts": false,
+      "board_stage": "R704_0R_DIRECT",
+      "connector": "CON64",
+      "connector_active_level": "high",
+      "evidence": "confirmed_board_v1_1",
+      "fpga_ball": "P15",
+      "group": "rear",
+      "lane": 0,
+      "net": "FAN_GPIO44",
+      "output_index": 28,
+      "pin": 4
+    },
+    {
+      "ball_active_level": "high",
+      "board_inverts": false,
+      "board_stage": "R706_0R_DIRECT",
+      "connector": "CON66",
+      "connector_active_level": "high",
+      "evidence": "confirmed_board_v1_1",
+      "fpga_ball": "N15",
+      "group": "rear",
+      "lane": 1,
+      "net": "FAN_GPIO46",
+      "output_index": 29,
+      "pin": 4
+    },
+    {
+      "ball_active_level": "high",
+      "board_inverts": false,
+      "board_stage": "R702_0R_DIRECT",
+      "connector": "CON62",
+      "connector_active_level": "high",
+      "evidence": "confirmed_board_v1_1",
+      "fpga_ball": "M14",
+      "group": "rear",
+      "lane": 2,
+      "net": "FAN_GPIO42",
+      "output_index": 30,
+      "pin": 4
+    },
+    {
+      "ball_active_level": "high",
+      "board_inverts": false,
+      "board_stage": "R700_0R_DIRECT",
+      "connector": "CON60",
+      "connector_active_level": "high",
+      "evidence": "confirmed_board_v1_1",
+      "fpga_ball": "P5",
+      "group": "rear",
+      "lane": 3,
+      "net": "FAN_GPIO40",
+      "output_index": 31,
+      "pin": 4
+    }
+  ],
   "lanes": [
   "lanes": [
     {
     {
       "air_lane": 0,
       "air_lane": 0,

+ 1 - 1
generated/6400/contract-sha256.txt

@@ -1 +1 @@
-06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1
+9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1

+ 1 - 1
generated/6400/controller-coefficients.json

@@ -17,7 +17,7 @@
       ]
       ]
     }
     }
   },
   },
-  "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+  "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
   "limits_centi_degC": {
   "limits_centi_degC": {
     "hard": 7700,
     "hard": 7700,
     "pretrip": 7600,
     "pretrip": 7600,

+ 17 - 4
generated/6400/fan-control-parameters.json

@@ -1,20 +1,33 @@
 {
 {
-  "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+  "actual_airflow_status": "NOT_RUN",
+  "actual_rpm_status": "NOT_RUN",
+  "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
   "duty": {
   "duty": {
     "hard": 100,
     "hard": 100,
     "nominal": 30,
     "nominal": 30,
     "protection": 80,
     "protection": 80,
     "reset": 10,
     "reset": 10,
-    "stopped": 30,
+    "stopped": 10,
     "warm": 50
     "warm": 50
   },
   },
   "front_rear_independent": true,
   "front_rear_independent": true,
   "invalid_lane_threshold": 2,
   "invalid_lane_threshold": 2,
-  "schema": "prod2u-6400-fan-control-v1",
+  "pwm": {
+    "carrier_backend": "shared_equal_frequency_v1",
+    "clock_hz": 25000000,
+    "evidence": "EXPERIMENTAL_CONFIGURATION_NOT_FAN_DATASHEET_VERIFIED",
+    "fan_hz": 500,
+    "fan_phase_clks": 500,
+    "phases": 100,
+    "ptc_hz": 500,
+    "ptc_phase_clks": 500
+  },
+  "pwm_high_level_status": "PWM_HIGH_LEVEL_UNVERIFIED",
+  "schema": "prod2u-6400-fan-control-v2",
   "temperature_centi_degC": {
   "temperature_centi_degC": {
     "hard": 7700,
     "hard": 7700,
     "protection": 7400,
     "protection": 7400,
     "warm_delta_from_target": -300
     "warm_delta_from_target": -300
   },
   },
-  "truth_label": "SIMULATION_DEFAULT_NOT_HARDWARE_TUNED"
+  "truth_label": "EXPERIMENTAL_UNVERIFIED"
 }
 }

+ 1 - 1
generated/6400/fixed-point.json

@@ -6,7 +6,7 @@
     "integer_bits": 4,
     "integer_bits": 4,
     "signed_bits": 16
     "signed_bits": 16
   },
   },
-  "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+  "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
   "error": {
   "error": {
     "signed_bits": 16,
     "signed_bits": 16,
     "unit": "centi_degC"
     "unit": "centi_degC"

+ 2 - 1
generated/6400/golden-vectors.json

@@ -1,7 +1,8 @@
 {
 {
-  "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+  "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
   "frames": {
   "frames": {
     "get_snapshot": "A55A02006D7B",
     "get_snapshot": "A55A02006D7B",
+    "get_snapshot_ack": "A55A8200F560",
     "set_target_20": "A55A010114289A",
     "set_target_20": "A55A010114289A",
     "set_target_70": "A55A0101469FE0",
     "set_target_70": "A55A0101469FE0",
     "set_target_ack": "A55A8100A635",
     "set_target_ack": "A55A8100A635",

+ 247 - 14
generated/6400/host-contract.json

@@ -1,4 +1,35 @@
 {
 {
+  "canonical_profiles": {
+    "6400-control": {
+      "allowed_commands": [
+        "SET_TARGET",
+        "GET_SNAPSHOT"
+      ],
+      "production": true,
+      "simulation_only": false,
+      "stimulus": false
+    },
+    "6400-identification": {
+      "allowed_commands": [
+        "SET_TARGET",
+        "GET_SNAPSHOT",
+        "SET_STIMULUS"
+      ],
+      "production": false,
+      "simulation_only": false,
+      "stimulus": true
+    },
+    "6400-sim-debug": {
+      "allowed_commands": [
+        "SET_TARGET",
+        "GET_SNAPSHOT",
+        "SET_STIMULUS"
+      ],
+      "production": false,
+      "simulation_only": true,
+      "stimulus": true
+    }
+  },
   "channel_map": {
   "channel_map": {
     "channels": [
     "channels": [
       {
       {
@@ -482,6 +513,130 @@
         "thermal_zone": 2
         "thermal_zone": 2
       }
       }
     ],
     ],
+    "fan_output_vector_order": [
+      "front0",
+      "front1",
+      "front2",
+      "front3",
+      "rear0",
+      "rear1",
+      "rear2",
+      "rear3"
+    ],
+    "fan_outputs": [
+      {
+        "ball_active_level": "low",
+        "board_inverts": true,
+        "board_stage": "Q101",
+        "connector": "CON25",
+        "connector_active_level": "high",
+        "evidence": "confirmed_board_v1_1",
+        "fpga_ball": "B1",
+        "group": "front",
+        "lane": 0,
+        "net": "FAN_PWM3",
+        "output_index": 24,
+        "pin": 7
+      },
+      {
+        "ball_active_level": "low",
+        "board_inverts": true,
+        "board_stage": "Q99",
+        "connector": "CON8",
+        "connector_active_level": "high",
+        "evidence": "confirmed_board_v1_1",
+        "fpga_ball": "C4",
+        "group": "front",
+        "lane": 1,
+        "net": "FAN_PWM1",
+        "output_index": 25,
+        "pin": 7
+      },
+      {
+        "ball_active_level": "low",
+        "board_inverts": true,
+        "board_stage": "Q100",
+        "connector": "CON24",
+        "connector_active_level": "high",
+        "evidence": "confirmed_board_v1_1",
+        "fpga_ball": "B5",
+        "group": "front",
+        "lane": 2,
+        "net": "FAN_PWM2",
+        "output_index": 26,
+        "pin": 7
+      },
+      {
+        "ball_active_level": "low",
+        "board_inverts": true,
+        "board_stage": "Q102",
+        "connector": "CON26",
+        "connector_active_level": "high",
+        "evidence": "confirmed_board_v1_1",
+        "fpga_ball": "A14",
+        "group": "front",
+        "lane": 3,
+        "net": "FAN_PWM4",
+        "output_index": 27,
+        "pin": 7
+      },
+      {
+        "ball_active_level": "high",
+        "board_inverts": false,
+        "board_stage": "R704_0R_DIRECT",
+        "connector": "CON64",
+        "connector_active_level": "high",
+        "evidence": "confirmed_board_v1_1",
+        "fpga_ball": "P15",
+        "group": "rear",
+        "lane": 0,
+        "net": "FAN_GPIO44",
+        "output_index": 28,
+        "pin": 4
+      },
+      {
+        "ball_active_level": "high",
+        "board_inverts": false,
+        "board_stage": "R706_0R_DIRECT",
+        "connector": "CON66",
+        "connector_active_level": "high",
+        "evidence": "confirmed_board_v1_1",
+        "fpga_ball": "N15",
+        "group": "rear",
+        "lane": 1,
+        "net": "FAN_GPIO46",
+        "output_index": 29,
+        "pin": 4
+      },
+      {
+        "ball_active_level": "high",
+        "board_inverts": false,
+        "board_stage": "R702_0R_DIRECT",
+        "connector": "CON62",
+        "connector_active_level": "high",
+        "evidence": "confirmed_board_v1_1",
+        "fpga_ball": "M14",
+        "group": "rear",
+        "lane": 2,
+        "net": "FAN_GPIO42",
+        "output_index": 30,
+        "pin": 4
+      },
+      {
+        "ball_active_level": "high",
+        "board_inverts": false,
+        "board_stage": "R700_0R_DIRECT",
+        "connector": "CON60",
+        "connector_active_level": "high",
+        "evidence": "confirmed_board_v1_1",
+        "fpga_ball": "P5",
+        "group": "rear",
+        "lane": 3,
+        "net": "FAN_GPIO40",
+        "output_index": 31,
+        "pin": 4
+      }
+    ],
     "lanes": [
     "lanes": [
       {
       {
         "air_lane": 0,
         "air_lane": 0,
@@ -527,7 +682,7 @@
     "product": "6400-front-rear-v1",
     "product": "6400-front-rear-v1",
     "schema": "prod2u-6400-channel-map-v1"
     "schema": "prod2u-6400-channel-map-v1"
   },
   },
-  "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+  "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
   "controller_coefficients": {
   "controller_coefficients": {
     "classes": {
     "classes": {
       "CENTER": {
       "CENTER": {
@@ -564,23 +719,36 @@
     "truth_label": "SIMULATION_DEFAULT_NOT_HARDWARE_TUNED"
     "truth_label": "SIMULATION_DEFAULT_NOT_HARDWARE_TUNED"
   },
   },
   "fan_control": {
   "fan_control": {
+    "actual_airflow_status": "NOT_RUN",
+    "actual_rpm_status": "NOT_RUN",
     "duty": {
     "duty": {
       "hard": 100,
       "hard": 100,
       "nominal": 30,
       "nominal": 30,
       "protection": 80,
       "protection": 80,
       "reset": 10,
       "reset": 10,
-      "stopped": 30,
+      "stopped": 10,
       "warm": 50
       "warm": 50
     },
     },
     "front_rear_independent": true,
     "front_rear_independent": true,
     "invalid_lane_threshold": 2,
     "invalid_lane_threshold": 2,
-    "schema": "prod2u-6400-fan-control-v1",
+    "pwm": {
+      "carrier_backend": "shared_equal_frequency_v1",
+      "clock_hz": 25000000,
+      "evidence": "EXPERIMENTAL_CONFIGURATION_NOT_FAN_DATASHEET_VERIFIED",
+      "fan_hz": 500,
+      "fan_phase_clks": 500,
+      "phases": 100,
+      "ptc_hz": 500,
+      "ptc_phase_clks": 500
+    },
+    "pwm_high_level_status": "PWM_HIGH_LEVEL_UNVERIFIED",
+    "schema": "prod2u-6400-fan-control-v2",
     "temperature_centi_degC": {
     "temperature_centi_degC": {
       "hard": 7700,
       "hard": 7700,
       "protection": 7400,
       "protection": 7400,
       "warm_delta_from_target": -300
       "warm_delta_from_target": -300
     },
     },
-    "truth_label": "SIMULATION_DEFAULT_NOT_HARDWARE_TUNED"
+    "truth_label": "EXPERIMENTAL_UNVERIFIED"
   },
   },
   "fixed_point": {
   "fixed_point": {
     "algorithm": "incremental_pi",
     "algorithm": "incremental_pi",
@@ -617,9 +785,10 @@
     }
     }
   },
   },
   "golden_vectors": {
   "golden_vectors": {
-    "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+    "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
     "frames": {
     "frames": {
       "get_snapshot": "A55A02006D7B",
       "get_snapshot": "A55A02006D7B",
+      "get_snapshot_ack": "A55A8200F560",
       "set_target_20": "A55A010114289A",
       "set_target_20": "A55A010114289A",
       "set_target_70": "A55A0101469FE0",
       "set_target_70": "A55A0101469FE0",
       "set_target_ack": "A55A8100A635",
       "set_target_ack": "A55A8100A635",
@@ -629,10 +798,10 @@
     },
     },
     "schema": "prod2u-6400-golden-vectors-v1"
     "schema": "prod2u-6400-golden-vectors-v1"
   },
   },
-  "schema": "prod2u-6400-host-contract-v1",
+  "schema": "prod2u-6400-host-contract-v2",
   "snapshot": {
   "snapshot": {
     "byte_order": "little",
     "byte_order": "little",
-    "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+    "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
     "fields": [
     "fields": [
       {
       {
         "name": "control_state",
         "name": "control_state",
@@ -785,6 +954,11 @@
     "schema": "prod2u-6400-snapshot-v1"
     "schema": "prod2u-6400-snapshot-v1"
   },
   },
   "wire": {
   "wire": {
+    "ack_contract": {
+      "every_legal_command": true,
+      "independent_frame": true,
+      "payload_length": 0
+    },
     "bmc_uart": {
     "bmc_uart": {
       "baud": 115200,
       "baud": 115200,
       "clks_per_bit": 217,
       "clks_per_bit": 217,
@@ -802,14 +976,51 @@
     "commands": {
     "commands": {
       "GET_SNAPSHOT": {
       "GET_SNAPSHOT": {
         "payload_length": 0,
         "payload_length": 0,
-        "response": "SNAPSHOT_DATA",
+        "response": [
+          "GET_SNAPSHOT_ACK",
+          "SNAPSHOT_DATA"
+        ],
         "type": 2
         "type": 2
       },
       },
       "SET_STIMULUS": {
       "SET_STIMULUS": {
+        "payload_fields": [
+          {
+            "count": 1,
+            "maximum": 255,
+            "minimum": 1,
+            "name": "duration_seconds",
+            "offset": 0,
+            "unit": "seconds"
+          },
+          {
+            "count": 24,
+            "maximum": 100,
+            "minimum": 0,
+            "name": "ptc_duty_percent",
+            "offset": 1,
+            "unit": "percent"
+          },
+          {
+            "count": 4,
+            "maximum": 100,
+            "minimum": 0,
+            "name": "front_fan_duty_percent",
+            "offset": 25,
+            "unit": "percent"
+          },
+          {
+            "count": 4,
+            "maximum": 100,
+            "minimum": 0,
+            "name": "rear_fan_duty_percent",
+            "offset": 29,
+            "unit": "percent"
+          }
+        ],
         "payload_length": 33,
         "payload_length": 33,
         "profiles": [
         "profiles": [
-          "identification",
-          "sim-debug"
+          "6400-identification",
+          "6400-sim-debug"
         ],
         ],
         "response": "SET_STIMULUS_ACK",
         "response": "SET_STIMULUS_ACK",
         "type": 3
         "type": 3
@@ -850,6 +1061,18 @@
       165,
       165,
       90
       90
     ],
     ],
+    "host_response_order": {
+      "GET_SNAPSHOT": [
+        "GET_SNAPSHOT_ACK",
+        "SNAPSHOT_DATA"
+      ],
+      "SET_STIMULUS": [
+        "SET_STIMULUS_ACK"
+      ],
+      "SET_TARGET": [
+        "SET_TARGET_ACK"
+      ]
+    },
     "host_uart": {
     "host_uart": {
       "baud": 921600,
       "baud": 921600,
       "fixed_candidate_clks_per_bit": 27,
       "fixed_candidate_clks_per_bit": 27,
@@ -871,11 +1094,15 @@
     "invalid_behavior": "silent_drop",
     "invalid_behavior": "silent_drop",
     "outstanding_transactions": 1,
     "outstanding_transactions": 1,
     "responses": {
     "responses": {
+      "GET_SNAPSHOT_ACK": {
+        "payload_length": 0,
+        "type": 130
+      },
       "SET_STIMULUS_ACK": {
       "SET_STIMULUS_ACK": {
         "payload_length": 0,
         "payload_length": 0,
         "profiles": [
         "profiles": [
-          "identification",
-          "sim-debug"
+          "6400-identification",
+          "6400-sim-debug"
         ],
         ],
         "type": 131
         "type": 131
       },
       },
@@ -885,9 +1112,15 @@
       },
       },
       "SNAPSHOT_DATA": {
       "SNAPSHOT_DATA": {
         "payload_contract": "6400-snapshot.yaml",
         "payload_contract": "6400-snapshot.yaml",
-        "type": 130
+        "type": 66
       }
       }
     },
     },
-    "schema": "prod2u-6400-wire-v1"
+    "schema": "prod2u-6400-wire-v1",
+    "type_classes": {
+      "ack": "request_type_or_0x80",
+      "data": "request_type_or_0x40",
+      "request": "0x01-0x3F",
+      "reserved": "0xC0-0xFF"
+    }
   }
   }
 }
 }

+ 14 - 4
generated/6400/prod2u_6400_v1_params.vh

@@ -1,6 +1,6 @@
 `ifndef PROD2U_6400_V1_PARAMS_VH
 `ifndef PROD2U_6400_V1_PARAMS_VH
 `define PROD2U_6400_V1_PARAMS_VH
 `define PROD2U_6400_V1_PARAMS_VH
-// Generated contract SHA-256: 06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1
+// Generated contract SHA-256: 9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1
 `define FB_CLOCK_HZ 25000000
 `define FB_CLOCK_HZ 25000000
 `define FB_PTC_COUNT 24
 `define FB_PTC_COUNT 24
 `define FB_FRONT_FAN_COUNT 4
 `define FB_FRONT_FAN_COUNT 4
@@ -15,13 +15,23 @@
 `define FB_HOST_FIXED_CLKS_PER_BIT 27
 `define FB_HOST_FIXED_CLKS_PER_BIT 27
 `define FB_BMC_CLKS_PER_BIT 217
 `define FB_BMC_CLKS_PER_BIT 217
 `define FB_PWM_PHASES 100
 `define FB_PWM_PHASES 100
-`define FB_PWM_PHASE_CLKS 500
-`define FB_PWM_PERIOD_CLKS 50000
+`define FB_PTC_PWM_HZ 500
+`define FB_FAN_PWM_HZ 500
+`define FB_PTC_PWM_PHASE_CLKS 500
+`define FB_FAN_PWM_PHASE_CLKS 500
+`define FB_PTC_PWM_PERIOD_CLKS 50000
+`define FB_FAN_PWM_PERIOD_CLKS 50000
+`define FAN_BOARD_INVERT_MASK 8'h0F
+`define FRONT_FAN_CONNECTOR_MAP "CON25.7,CON8.7,CON24.7,CON26.7"
+`define FRONT_FAN_FPGA_BALL_MAP "B1,C4,B5,A14"
+`define REAR_FAN_CONNECTOR_MAP "CON64.4,CON66.4,CON62.4,CON60.4"
+`define REAR_FAN_FPGA_BALL_MAP "P15,N15,M14,P5"
 `define FB_CMD_SET_TARGET 8'h01
 `define FB_CMD_SET_TARGET 8'h01
 `define FB_CMD_GET_SNAPSHOT 8'h02
 `define FB_CMD_GET_SNAPSHOT 8'h02
 `define FB_CMD_SET_STIMULUS 8'h03
 `define FB_CMD_SET_STIMULUS 8'h03
 `define FB_RSP_SET_TARGET_ACK 8'h81
 `define FB_RSP_SET_TARGET_ACK 8'h81
-`define FB_RSP_SNAPSHOT 8'h82
+`define FB_RSP_GET_SNAPSHOT_ACK 8'h82
+`define FB_RSP_SNAPSHOT_DATA 8'h42
 `define FB_RSP_STIMULUS_ACK 8'h83
 `define FB_RSP_STIMULUS_ACK 8'h83
 `define FB_SNAPSHOT_LENGTH 193
 `define FB_SNAPSHOT_LENGTH 193
 `define FB_TEMP_SOFT 7400
 `define FB_TEMP_SOFT 7400

+ 1 - 1
generated/6400/snapshot-layout.json

@@ -1,6 +1,6 @@
 {
 {
   "byte_order": "little",
   "byte_order": "little",
-  "contract_sha256": "06c18dee5c27c4830398c8bc348d7fe868cde72aebe4c3be68b562f00e9b0fc1",
+  "contract_sha256": "9f1be59b6fe6f65fafe1f09a2c5d97076ac3e94996faa5834110066cc5714bd1",
   "fields": [
   "fields": [
     {
     {
       "name": "control_state",
       "name": "control_state",

+ 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_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"
   ],
   ],

+ 31 - 0
src/actuator/fan_board_output_adapter.v

@@ -0,0 +1,31 @@
+`timescale 1ns/1ps
+`include "generated/6400/prod2u_6400_v1_params.vh"
+
+// The only logical-to-board fan polarity adapter.
+// Vector order is {rear3..rear0, front3..front0}; bit 0..3 are the four
+// transistor-inverted front outputs, while bit 4..7 are direct rear outputs.
+module fan_board_output_adapter (
+    input  wire [7:0] logical_fan_on,
+    input  wire       boot_release,
+    input  wire       force_full_speed,
+    output wire [3:0] front_fan_ball,
+    output wire [3:0] rear_fan_ball
+);
+    wire [7:0] requested_fan_on = (!boot_release || force_full_speed) ?
+        8'hFF : logical_fan_on;
+    wire [7:0] fan_pwm_sink_enable = requested_fan_on ^ `FAN_BOARD_INVERT_MASK;
+
+    assign front_fan_ball = fan_pwm_sink_enable[3:0];
+    assign rear_fan_ball = fan_pwm_sink_enable[7:4];
+
+`ifdef FORMAL
+    always @* begin
+        if (!boot_release || force_full_speed) begin
+            assert(front_fan_ball == 4'h0);
+            assert(rear_fan_ball == 4'hF);
+        end
+        assert(front_fan_ball == ~requested_fan_on[3:0]);
+        assert(rear_fan_ball == requested_fan_on[7:4]);
+    end
+`endif
+endmodule

+ 14 - 3
src/actuator/pwm_bitmap_engine.v

@@ -5,7 +5,8 @@
 module pwm_bitmap_engine #(
 module pwm_bitmap_engine #(
     parameter integer CHANNEL_COUNT = 32,
     parameter integer CHANNEL_COUNT = 32,
     parameter integer PHASE_COUNT = 100,
     parameter integer PHASE_COUNT = 100,
-    parameter integer PHASE_CLKS = 500,
+    parameter integer PTC_PHASE_CLKS = 500,
+    parameter integer FAN_PHASE_CLKS = 500,
     parameter integer ADDR_WIDTH = 5,
     parameter integer ADDR_WIDTH = 5,
     parameter [31:0] RESET_LOGICAL_BITMAP = 32'hFF000000
     parameter [31:0] RESET_LOGICAL_BITMAP = 32'hFF000000
 ) (
 ) (
@@ -20,10 +21,15 @@ module pwm_bitmap_engine #(
     output wire                     scan_idle
     output wire                     scan_idle
 );
 );
     localparam integer PHASE_BITS = (PHASE_COUNT <= 1) ? 1 : $clog2(PHASE_COUNT);
     localparam integer PHASE_BITS = (PHASE_COUNT <= 1) ? 1 : $clog2(PHASE_COUNT);
-    localparam integer SLOT_BITS = (PHASE_CLKS <= 1) ? 1 : $clog2(PHASE_CLKS);
+    // V1 preserves one comparator and one scan because the independently
+    // generated PTC and FAN carrier parameters are equal in this closure.
+    // Unequal future contracts fail this backend explicitly and must select a
+    // dual-carrier scheduler; they cannot silently inherit the PTC frequency.
+    localparam integer SHARED_PHASE_CLKS = PTC_PHASE_CLKS;
+    localparam integer SLOT_BITS = (SHARED_PHASE_CLKS <= 1) ? 1 : $clog2(SHARED_PHASE_CLKS);
     /* verilator lint_off WIDTH */
     /* verilator lint_off WIDTH */
     localparam [PHASE_BITS-1:0] LAST_PHASE = PHASE_COUNT - 1;
     localparam [PHASE_BITS-1:0] LAST_PHASE = PHASE_COUNT - 1;
-    localparam [SLOT_BITS-1:0] LAST_SLOT = PHASE_CLKS - 1;
+    localparam [SLOT_BITS-1:0] LAST_SLOT = SHARED_PHASE_CLKS - 1;
     localparam [ADDR_WIDTH-1:0] LAST_CHANNEL = CHANNEL_COUNT - 1;
     localparam [ADDR_WIDTH-1:0] LAST_CHANNEL = CHANNEL_COUNT - 1;
     /* verilator lint_on WIDTH */
     /* verilator lint_on WIDTH */
 
 
@@ -35,6 +41,11 @@ module pwm_bitmap_engine #(
     reg capture_valid;
     reg capture_valid;
     reg [CHANNEL_COUNT-1:0] next_bitmap;
     reg [CHANNEL_COUNT-1:0] next_bitmap;
 
 
+    initial begin
+        if (PTC_PHASE_CLKS != FAN_PHASE_CLKS)
+            $error("shared_equal_frequency_v1 requires equal independently generated PTC/FAN phase clocks");
+    end
+
     wire [PHASE_BITS-1:0] build_phase =
     wire [PHASE_BITS-1:0] build_phase =
         (phase == LAST_PHASE) ? {PHASE_BITS{1'b0}} : phase + 1'b1;
         (phase == LAST_PHASE) ? {PHASE_BITS{1'b0}} : phase + 1'b1;
     wire [7:0] build_phase_8 = {{(8-PHASE_BITS){1'b0}}, build_phase};
     wire [7:0] build_phase_8 = {{(8-PHASE_BITS){1'b0}}, build_phase};

+ 33 - 11
src/control/thermal_control_core.v

@@ -52,7 +52,10 @@ module thermal_control_core #(
     output reg [3:0]    lane_fault_mask,
     output reg [3:0]    lane_fault_mask,
     output reg          global_fault,
     output reg          global_fault,
     output reg          output_commit,
     output reg          output_commit,
-    output wire         stimulus_active
+    output wire         stimulus_active,
+    input  wire         pwm_phase_boundary,
+    input  wire         pwm_scan_idle,
+    output reg          boot_init_complete
 );
 );
     localparam [2:0] RESET_SAFE = 3'd0;
     localparam [2:0] RESET_SAFE = 3'd0;
     localparam [2:0] WAIT_CT_VALID = 3'd1;
     localparam [2:0] WAIT_CT_VALID = 3'd1;
@@ -72,6 +75,8 @@ module thermal_control_core #(
     localparam [3:0] W_SAFE_FILL = 4'd7;
     localparam [3:0] W_SAFE_FILL = 4'd7;
     localparam [3:0] W_APPLY_PREFETCH = 4'd8;
     localparam [3:0] W_APPLY_PREFETCH = 4'd8;
     localparam [3:0] W_INIT = 4'd9;
     localparam [3:0] W_INIT = 4'd9;
+    localparam [3:0] W_COMMIT_WAIT = 4'd10;
+    localparam [3:0] W_BOOT_WAIT = 4'd11;
 
 
     reg [3:0] work_state;
     reg [3:0] work_state;
     reg [4:0] work_index;
     reg [4:0] work_index;
@@ -325,6 +330,7 @@ module thermal_control_core #(
             lane_fault_mask <= 0;
             lane_fault_mask <= 0;
             global_fault <= 0;
             global_fault <= 0;
             output_commit <= 0;
             output_commit <= 0;
+            boot_init_complete <= 0;
             work_state <= W_INIT;
             work_state <= W_INIT;
             work_index <= 0;
             work_index <= 0;
             last_bmc_epoch <= 0;
             last_bmc_epoch <= 0;
@@ -403,7 +409,7 @@ module thermal_control_core #(
                 work_index <= 0;
                 work_index <= 0;
                 work_state <= W_SAFE_FILL;
                 work_state <= W_SAFE_FILL;
                 safe_fan_target <= (global_fault || bmc_stale_runtime) ? 8'd100 :
                 safe_fan_target <= (global_fault || bmc_stale_runtime) ? 8'd100 :
-                    ((target_celsius == 0) ? 8'd30 : 8'd10);
+                    8'd10;
                 global_fault <= global_fault || bmc_stale_runtime;
                 global_fault <= global_fault || bmc_stale_runtime;
                 if (target_celsius == 0)
                 if (target_celsius == 0)
                     control_state <= STOPPED;
                     control_state <= STOPPED;
@@ -424,11 +430,20 @@ module thermal_control_core #(
                     W_INIT: begin
                     W_INIT: begin
                         if (work_index == 31) begin
                         if (work_index == 31) begin
                             work_index <= 0;
                             work_index <= 0;
-                            work_state <= W_IDLE;
+                            work_state <= W_BOOT_WAIT;
                         end else begin
                         end else begin
                             work_index <= work_index + 1'b1;
                             work_index <= work_index + 1'b1;
                         end
                         end
                     end
                     end
+                    W_BOOT_WAIT: begin
+                        // Both banks now contain PTC=0/FAN=standby. Keep the
+                        // external full-speed boot request through one whole
+                        // completed PWM boundary before normal state entry.
+                        if (pwm_phase_boundary) begin
+                            boot_init_complete <= 1'b1;
+                            work_state <= W_IDLE;
+                        end
+                    end
                     W_IDLE: begin
                     W_IDLE: begin
                         if (control_state == RESET_SAFE) begin
                         if (control_state == RESET_SAFE) begin
                             control_state <= WAIT_CT_VALID;
                             control_state <= WAIT_CT_VALID;
@@ -572,21 +587,26 @@ module thermal_control_core #(
                     W_APPLY_PREFETCH: work_state <= W_APPLY;
                     W_APPLY_PREFETCH: work_state <= W_APPLY;
                     W_APPLY: begin
                     W_APPLY: begin
                         if (work_index == 31) begin
                         if (work_index == 31) begin
-                            active_output_bank <= ~active_output_bank;
-                            control_epoch <= control_epoch + 1'b1;
-                            output_commit <= 1;
                             work_index <= 0;
                             work_index <= 0;
-                            work_state <= W_IDLE;
+                            work_state <= W_COMMIT_WAIT;
                         end else work_index <= work_index + 1'b1;
                         end else work_index <= work_index + 1'b1;
                     end
                     end
                     W_SAFE_FILL: begin
                     W_SAFE_FILL: begin
                         if (work_index == 31) begin
                         if (work_index == 31) begin
+                            work_index <= 0;
+                            work_state <= W_COMMIT_WAIT;
+                        end else work_index <= work_index + 1'b1;
+                    end
+                    W_COMMIT_WAIT: begin
+                        // Never change the bank selected by a running
+                        // 32-channel PWM scan. The next scan sees one complete
+                        // bank and the following phase updates atomically.
+                        if (pwm_scan_idle) begin
                             active_output_bank <= ~active_output_bank;
                             active_output_bank <= ~active_output_bank;
                             control_epoch <= control_epoch + 1'b1;
                             control_epoch <= control_epoch + 1'b1;
                             output_commit <= 1;
                             output_commit <= 1;
-                            work_index <= 0;
                             work_state <= W_IDLE;
                             work_state <= W_IDLE;
-                        end else work_index <= work_index + 1'b1;
+                        end
                     end
                     end
                     default: work_state <= W_IDLE;
                     default: work_state <= W_IDLE;
                 endcase
                 endcase
@@ -624,7 +644,9 @@ module thermal_control_core #(
                 W_APPLY_PREFETCH: formal_work_rank = 8'd32;
                 W_APPLY_PREFETCH: formal_work_rank = 8'd32;
                 W_APPLY:     formal_work_rank = 8'd31 - index_value;
                 W_APPLY:     formal_work_rank = 8'd31 - index_value;
                 W_SAFE_FILL: formal_work_rank = 8'd64 - index_value;
                 W_SAFE_FILL: formal_work_rank = 8'd64 - index_value;
-                W_INIT:      formal_work_rank = 8'd32 - index_value;
+                W_INIT:      formal_work_rank = 8'd33 - index_value;
+                W_COMMIT_WAIT: formal_work_rank = 8'd1;
+                W_BOOT_WAIT: formal_work_rank = 8'd1;
                 default:     formal_work_rank = 8'd0;
                 default:     formal_work_rank = 8'd0;
             endcase
             endcase
         end
         end
@@ -677,7 +699,7 @@ module thermal_control_core #(
             // P10: an admitted scheduler pass has a finite rank that strictly
             // P10: an admitted scheduler pass has a finite rank that strictly
             // decreases every clock unless target/stale safety preempts it.
             // decreases every clock unless target/stale safety preempts it.
             assert(formal_scheduler_rank <= 136);
             assert(formal_scheduler_rank <= 136);
-            assert(work_state <= W_INIT);
+            assert(work_state <= W_BOOT_WAIT);
             if (work_state == W_PREP || work_state == W_KP ||
             if (work_state == W_PREP || work_state == W_KP ||
                 work_state == W_KI || work_state == W_UPDATE)
                 work_state == W_KI || work_state == W_UPDATE)
                 assert(work_index < 24);
                 assert(work_index < 24);

+ 35 - 6
src/top/prod2u_6400_v1_top.v

@@ -151,14 +151,37 @@ module prod2u_6400_v1_top #(
     wire global_fault;
     wire global_fault;
     wire output_commit;
     wire output_commit;
     wire stimulus_active;
     wire stimulus_active;
+    wire boot_init_complete;
+    reg boot_fan_release;
+    reg 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};
 
 
     assign temp_scl = ct_scl_drive_low ? 1'b0 : 1'bz;
     assign temp_scl = ct_scl_drive_low ? 1'b0 : 1'bz;
     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];
-    assign front_fan_pwm_out = ~logical_bitmap[27:24];
-    assign rear_fan_pwm_out = ~logical_bitmap[31:28];
+
+    // 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) begin
+            if (boot_init_complete)
+                boot_fan_release <= 1'b1;
+            fan_force_full_speed <= bmc_stale || global_fault;
+        end
+    end
+
+    fan_board_output_adapter u_fan_board_adapter (
+        .logical_fan_on(logical_bitmap[31:24]),
+        .boot_release(boot_fan_release),
+        .force_full_speed(fan_force_full_speed),
+        .front_fan_ball(front_fan_pwm_out),
+        .rear_fan_ball(rear_fan_pwm_out)
+    );
 
 
     prod2u_por #(.POR_CYCLES(1024)) u_por (.sys_clk(sys_clk), .sys_rst_n(rst_n));
     prod2u_por #(.POR_CYCLES(1024)) u_por (.sys_clk(sys_clk), .sys_rst_n(rst_n));
     shared_500us_tick #(.CLOCK_HZ(`FB_CLOCK_HZ), .TICK_US(1000000)) u_tick_1s (
     shared_500us_tick #(.CLOCK_HZ(`FB_CLOCK_HZ), .TICK_US(1000000)) u_tick_1s (
@@ -289,9 +312,14 @@ module prod2u_6400_v1_top #(
         .control_state(control_state), .current_target_celsius(current_target),
         .control_state(control_state), .current_target_celsius(current_target),
         .host_target_seen(host_target_seen), .control_epoch(control_epoch),
         .host_target_seen(host_target_seen), .control_epoch(control_epoch),
         .safety_override_mask(safety_mask), .lane_fault_mask(lane_fault_mask),
         .safety_override_mask(safety_mask), .lane_fault_mask(lane_fault_mask),
-        .global_fault(global_fault), .output_commit(output_commit), .stimulus_active(stimulus_active)
+        .global_fault(global_fault), .output_commit(output_commit), .stimulus_active(stimulus_active),
+        .pwm_phase_boundary(pwm_boundary), .pwm_scan_idle(pwm_scan_idle),
+        .boot_init_complete(boot_init_complete)
     );
     );
-    pwm_bitmap_engine u_pwm (
+    pwm_bitmap_engine #(
+        .PTC_PHASE_CLKS(`FB_PTC_PWM_PHASE_CLKS),
+        .FAN_PHASE_CLKS(`FB_FAN_PWM_PHASE_CLKS)
+    ) u_pwm (
         .clk(sys_clk), .rst_n(rst_n), .duty_rd_addr(pwm_duty_addr),
         .clk(sys_clk), .rst_n(rst_n), .duty_rd_addr(pwm_duty_addr),
         .duty_rd_data(pwm_duty_data), .logical_bitmap(logical_bitmap),
         .duty_rd_data(pwm_duty_data), .logical_bitmap(logical_bitmap),
         .phase_boundary(pwm_boundary), .deadline_miss(pwm_deadline_miss),
         .phase_boundary(pwm_boundary), .deadline_miss(pwm_deadline_miss),
@@ -307,7 +335,7 @@ module prod2u_6400_v1_top #(
         .control_epoch(control_epoch), .bmc_age(bmc_age), .ct_age(ct_age),
         .control_epoch(control_epoch), .bmc_age(bmc_age), .ct_age(ct_age),
         .bmc_valid_mask(bmc_valid_mask), .ct_valid_mask(ct_valid_mask),
         .bmc_valid_mask(bmc_valid_mask), .ct_valid_mask(ct_valid_mask),
         .safety_override_mask(safety_mask), .lane_fault_mask(lane_fault_mask),
         .safety_override_mask(safety_mask), .lane_fault_mask(lane_fault_mask),
-        .global_fault(global_fault), .unlock(host_response_done), .payload_addr(frame_tx_payload_addr),
+        .global_fault(global_fault), .unlock(host_transaction_done), .payload_addr(frame_tx_payload_addr),
         .payload_data(frame_tx_payload_data), .bmc_rd_index(bmc_snapshot_index),
         .payload_data(frame_tx_payload_data), .bmc_rd_index(bmc_snapshot_index),
         .bmc_rd_raw(bmc_snapshot_raw), .ct_rd_index(ct_snapshot_index),
         .bmc_rd_raw(bmc_snapshot_raw), .ct_rd_index(ct_snapshot_index),
         .ct_rd_raw(ct_snapshot_raw), .output_rd_addr(snapshot_output_addr),
         .ct_rd_raw(ct_snapshot_raw), .output_rd_addr(snapshot_output_addr),
@@ -318,7 +346,8 @@ module prod2u_6400_v1_top #(
         host_rs232_rx_sync, host_ttl_rx_sync, host_command_busy, frame_tx_done, bmc_tx_done,
         host_rs232_rx_sync, host_ttl_rx_sync, host_command_busy, frame_tx_done, bmc_tx_done,
         bmc_poll_count, bmc_snapshot_commit, ct_snapshot_commit, ct_i2c_busy, ct_control_raw,
         bmc_poll_count, bmc_snapshot_commit, ct_snapshot_commit, ct_i2c_busy, ct_control_raw,
         ct_control_valid, bmc_snapshot_valid, ct_snapshot_valid, output_commit,
         ct_control_valid, bmc_snapshot_valid, ct_snapshot_valid, output_commit,
-        stimulus_active, pwm_boundary, pwm_phase, pwm_scan_idle, host_crc_request_conflict};
+        stimulus_active, pwm_boundary, pwm_phase, pwm_scan_idle, host_crc_request_conflict,
+        boot_init_complete, boot_fan_release, fan_force_full_speed};
 
 
 `ifdef FORMAL
 `ifdef FORMAL
     always @(posedge sys_clk) begin
     always @(posedge sys_clk) begin

+ 30 - 7
src/transport/thermal_host_command.v

@@ -35,8 +35,10 @@ module thermal_host_command #(
     localparam [3:0] ST_STIM_DURATION = 4'd3;
     localparam [3:0] ST_STIM_DURATION = 4'd3;
     localparam [3:0] ST_STIM_DATA = 4'd4;
     localparam [3:0] ST_STIM_DATA = 4'd4;
     localparam [3:0] ST_STIM_COMMIT = 4'd5;
     localparam [3:0] ST_STIM_COMMIT = 4'd5;
-    localparam [3:0] ST_TX = 4'd6;
+    localparam [3:0] ST_FINAL_TX = 4'd6;
     localparam [3:0] ST_DROP = 4'd7;
     localparam [3:0] ST_DROP = 4'd7;
+    localparam [3:0] ST_SNAPSHOT_ACK_TX = 4'd8;
+    localparam [3:0] ST_SNAPSHOT_DATA_TX = 4'd9;
     reg [3:0] state;
     reg [3:0] state;
     reg [5:0] index;
     reg [5:0] index;
     reg stimulus_bad;
     reg stimulus_bad;
@@ -95,7 +97,7 @@ module thermal_host_command #(
                         tx_frame_type <= 8'h81;
                         tx_frame_type <= 8'h81;
                         tx_payload_length <= 0;
                         tx_payload_length <= 0;
                         tx_start <= 1;
                         tx_start <= 1;
-                        state <= ST_TX;
+                        state <= ST_FINAL_TX;
                     end else begin
                     end else begin
                         transaction_done <= 1;
                         transaction_done <= 1;
                         state <= ST_DROP;
                         state <= ST_DROP;
@@ -103,9 +105,9 @@ module thermal_host_command #(
                 end
                 end
                 ST_SNAPSHOT_WAIT: if (snapshot_ready) begin
                 ST_SNAPSHOT_WAIT: if (snapshot_ready) begin
                     tx_frame_type <= 8'h82;
                     tx_frame_type <= 8'h82;
-                    tx_payload_length <= SNAPSHOT_LENGTH[7:0];
+                    tx_payload_length <= 0;
                     tx_start <= 1;
                     tx_start <= 1;
-                    state <= ST_TX;
+                    state <= ST_SNAPSHOT_ACK_TX;
                 end
                 end
                 ST_STIM_DURATION: begin
                 ST_STIM_DURATION: begin
                     stimulus_duration_seconds <= payload_read_data;
                     stimulus_duration_seconds <= payload_read_data;
@@ -135,13 +137,26 @@ module thermal_host_command #(
                         tx_frame_type <= 8'h83;
                         tx_frame_type <= 8'h83;
                         tx_payload_length <= 0;
                         tx_payload_length <= 0;
                         tx_start <= 1;
                         tx_start <= 1;
-                        state <= ST_TX;
+                        state <= ST_FINAL_TX;
                     end else begin
                     end else begin
                         transaction_done <= 1;
                         transaction_done <= 1;
                         state <= ST_DROP;
                         state <= ST_DROP;
                     end
                     end
                 end
                 end
-                ST_TX: if (tx_done) begin
+                ST_FINAL_TX: if (tx_done) begin
+                    transaction_done <= 1;
+                    state <= ST_DROP;
+                end
+                ST_SNAPSHOT_ACK_TX: if (tx_done) begin
+                    // GET keeps the selected Host port and snapshot banks
+                    // locked across two independent frames. DATA never
+                    // substitutes for this ACK.
+                    tx_frame_type <= 8'h42;
+                    tx_payload_length <= SNAPSHOT_LENGTH[7:0];
+                    tx_start <= 1;
+                    state <= ST_SNAPSHOT_DATA_TX;
+                end
+                ST_SNAPSHOT_DATA_TX: if (tx_done) begin
                     transaction_done <= 1;
                     transaction_done <= 1;
                     state <= ST_DROP;
                     state <= ST_DROP;
                 end
                 end
@@ -157,7 +172,7 @@ module thermal_host_command #(
     always @(posedge clk) begin
     always @(posedge clk) begin
         formal_past_valid <= 1;
         formal_past_valid <= 1;
         if (rst_n) begin
         if (rst_n) begin
-            assert(state <= ST_DROP);
+            assert(state <= ST_SNAPSHOT_DATA_TX);
             // P07: ACK exists only on the same atomic legal target commit.
             // P07: ACK exists only on the same atomic legal target commit.
             if (tx_start && tx_frame_type == 8'h81) begin
             if (tx_start && tx_frame_type == 8'h81) begin
                 assert(target_commit);
                 assert(target_commit);
@@ -169,6 +184,14 @@ module thermal_host_command #(
                 if (formal_past_valid && $past(rst_n))
                 if (formal_past_valid && $past(rst_n))
                     assert($past(state) == ST_TARGET);
                     assert($past(state) == ST_TARGET);
             end
             end
+            if (tx_start && tx_frame_type == 8'h82) begin
+                assert(tx_payload_length == 0);
+                assert(state == ST_SNAPSHOT_ACK_TX);
+            end
+            if (tx_start && tx_frame_type == 8'h42) begin
+                assert(tx_payload_length == SNAPSHOT_LENGTH[7:0]);
+                assert(state == ST_SNAPSHOT_DATA_TX);
+            end
             if (formal_past_valid && $past(rst_n) &&
             if (formal_past_valid && $past(rst_n) &&
                 target_celsius != $past(target_celsius))
                 target_celsius != $past(target_celsius))
                 assert(target_commit);
                 assert(target_commit);

+ 17 - 4
tests/cocotb/thermal_6400_uart.py

@@ -18,7 +18,8 @@ SET_TARGET = 0x01
 GET_SNAPSHOT = 0x02
 GET_SNAPSHOT = 0x02
 SET_STIMULUS = 0x03
 SET_STIMULUS = 0x03
 SET_TARGET_ACK = 0x81
 SET_TARGET_ACK = 0x81
-SNAPSHOT_DATA = 0x82
+GET_SNAPSHOT_ACK = 0x82
+SNAPSHOT_DATA = 0x42
 SET_STIMULUS_ACK = 0x83
 SET_STIMULUS_ACK = 0x83
 
 
 _LAYOUT = json.loads(
 _LAYOUT = json.loads(
@@ -163,7 +164,7 @@ async def initialize(dut) -> None:
     await wait_for(
     await wait_for(
         dut,
         dut,
         lambda: int(dut.control_state_mon.value) == 2,
         lambda: int(dut.control_state_mon.value) == 2,
-        cycles=100,
+        cycles=1000,
         label="PREHEAT_CT",
         label="PREHEAT_CT",
     )
     )
     assert int(dut.global_fault_mon.value) == 0
     assert int(dut.global_fault_mon.value) == 0
@@ -207,8 +208,20 @@ def decode_snapshot(payload: bytes) -> dict[str, object]:
 
 
 
 
 async def get_snapshot(dut, port: str = "ttl") -> dict[str, object]:
 async def get_snapshot(dut, port: str = "ttl") -> dict[str, object]:
-    kind, payload = await host_transaction(dut, port, GET_SNAPSHOT)
-    assert kind == SNAPSHOT_DATA
+    rx = getattr(dut, f"host_{port}_rx")
+    tx = getattr(dut, f"host_{port}_tx")
+
+    async def receive_ack_then_data() -> bytes:
+        ack_kind, ack_payload = await receive_frame(tx)
+        assert (ack_kind, ack_payload) == (GET_SNAPSHOT_ACK, b"")
+        data_kind, data_payload = await receive_frame(tx)
+        assert data_kind == SNAPSHOT_DATA
+        return data_payload
+
+    response = cocotb.start_soon(receive_ack_then_data())
+    await send_uart(rx, encode_frame(GET_SNAPSHOT), HOST_CLKS_PER_BIT)
+    payload = await with_timeout(response, 40, "ms")
+    await Timer(HOST_CLKS_PER_BIT * CLOCK_NS * 2, units="ns")
     return decode_snapshot(payload)
     return decode_snapshot(payload)
 
 
 
 

+ 4 - 1
tests/cocotb/thermal_control_core_cocotb_top.v

@@ -98,7 +98,10 @@ module thermal_control_core_cocotb_top (
         .lane_fault_mask(lane_fault_mask),
         .lane_fault_mask(lane_fault_mask),
         .global_fault(global_fault),
         .global_fault(global_fault),
         .output_commit(output_commit),
         .output_commit(output_commit),
-        .stimulus_active(stimulus_active)
+        .stimulus_active(stimulus_active),
+        .pwm_phase_boundary(1'b1),
+        .pwm_scan_idle(1'b1),
+        .boot_init_complete()
     );
     );
 
 
     assign work_state_mon = u_dut.work_state;
     assign work_state_mon = u_dut.work_state;

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

@@ -55,7 +55,8 @@ module thermal_6400_core_properties_formal (
         .current_target_celsius(current_target), .host_target_seen(host_target_seen),
         .current_target_celsius(current_target), .host_target_seen(host_target_seen),
         .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()
     );
     );
 
 
     reg [1:0] reset_cycles = 0;
     reg [1:0] reset_cycles = 0;

+ 44 - 17
tests/sim/pwm_bitmap_engine_tb.v

@@ -12,7 +12,10 @@ module pwm_bitmap_engine_tb;
     wire [6:0] phase;
     wire [6:0] phase;
     wire idle;
     wire idle;
     wire [23:0] ptc_pins = bitmap[23:0];
     wire [23:0] ptc_pins = bitmap[23:0];
-    wire [7:0] fan_pins = ~bitmap[31:24];
+    wire [3:0] front_fan_balls;
+    wire [3:0] rear_fan_balls;
+    wire [7:0] fan_balls = {rear_fan_balls, front_fan_balls};
+    wire [7:0] fan_connector_pwm = {rear_fan_balls, ~front_fan_balls};
     reg [7:0] duty [0:31];
     reg [7:0] duty [0:31];
     reg [31:0] previous_bitmap;
     reg [31:0] previous_bitmap;
     integer high_count [0:31];
     integer high_count [0:31];
@@ -34,6 +37,11 @@ module pwm_bitmap_engine_tb;
         .logical_bitmap(bitmap), .phase_boundary(boundary), .deadline_miss(miss),
         .logical_bitmap(bitmap), .phase_boundary(boundary), .deadline_miss(miss),
         .phase_value(phase), .scan_idle(idle)
         .phase_value(phase), .scan_idle(idle)
     );
     );
+    fan_board_output_adapter board_adapter (
+        .logical_fan_on(bitmap[31:24]), .boot_release(rst_n),
+        .force_full_speed(1'b0), .front_fan_ball(front_fan_balls),
+        .rear_fan_ball(rear_fan_balls)
+    );
 
 
     // Outputs may change only on the common phase boundary.  Therefore every
     // Outputs may change only on the common phase boundary.  Therefore every
     // physical pulse is an integer multiple of the 500-clock phase and no
     // physical pulse is an integer multiple of the 500-clock phase and no
@@ -99,14 +107,27 @@ module pwm_bitmap_engine_tb;
         boundary_count = 0;
         boundary_count = 0;
         idle_seen = 0;
         idle_seen = 0;
         for (channel = 0; channel < 32; channel = channel + 1) begin
         for (channel = 0; channel < 32; channel = channel + 1) begin
-            case (channel % 6)
-                0: duty[channel] = 0;
-                1: duty[channel] = 1;
-                2: duty[channel] = 2;
-                3: duty[channel] = 50;
-                4: duty[channel] = 99;
-                default: duty[channel] = 100;
-            endcase
+            if (channel < 24) begin
+                case (channel % 6)
+                    0: duty[channel] = 0;
+                    1: duty[channel] = 1;
+                    2: duty[channel] = 2;
+                    3: duty[channel] = 50;
+                    4: duty[channel] = 99;
+                    default: duty[channel] = 100;
+                endcase
+            end else begin
+                case (channel)
+                    24: duty[channel] = 10;
+                    25: duty[channel] = 50;
+                    26: duty[channel] = 100;
+                    27: duty[channel] = 0;
+                    28: duty[channel] = 50;
+                    29: duty[channel] = 10;
+                    30: duty[channel] = 0;
+                    default: duty[channel] = 100;
+                endcase
+            end
             high_count[channel] = 0;
             high_count[channel] = 0;
             last_edge_cycle[channel] = -1;
             last_edge_cycle[channel] = -1;
         end
         end
@@ -114,9 +135,10 @@ module pwm_bitmap_engine_tb;
             fan_active_count[channel] = 0;
             fan_active_count[channel] = 0;
 
 
         repeat (4) @(negedge clk);
         repeat (4) @(negedge clk);
-        if (bitmap !== 32'hff000000 || ptc_pins !== 24'd0 || fan_pins !== 8'd0)
-            $fatal(1, "reset polarity mismatch bitmap=%h ptc=%h fan=%h",
-                bitmap, ptc_pins, fan_pins);
+        if (bitmap !== 32'hff000000 || ptc_pins !== 24'd0 || fan_balls !== 8'hf0 ||
+            fan_connector_pwm !== 8'hff)
+            $fatal(1, "reset polarity mismatch bitmap=%h ptc=%h balls=%h connector=%h",
+                bitmap, ptc_pins, fan_balls, fan_connector_pwm);
         rst_n = 1;
         rst_n = 1;
 
 
         // Start at phase zero and count one exact 2 ms / 50,000-clock carrier.
         // Start at phase zero and count one exact 2 ms / 50,000-clock carrier.
@@ -126,10 +148,14 @@ module pwm_bitmap_engine_tb;
             for (channel = 0; channel < 32; channel = channel + 1)
             for (channel = 0; channel < 32; channel = channel + 1)
                 if (bitmap[channel]) high_count[channel] = high_count[channel] + 1;
                 if (bitmap[channel]) high_count[channel] = high_count[channel] + 1;
             for (channel = 0; channel < 8; channel = channel + 1) begin
             for (channel = 0; channel < 8; channel = channel + 1) begin
-                if (!fan_pins[channel])
+                if (fan_connector_pwm[channel])
                     fan_active_count[channel] = fan_active_count[channel] + 1;
                     fan_active_count[channel] = fan_active_count[channel] + 1;
-                if (fan_pins[channel] !== ~bitmap[channel + 24])
-                    $fatal(1, "fan polarity mismatch channel=%0d", channel);
+                if (fan_connector_pwm[channel] !== bitmap[channel + 24])
+                    $fatal(1, "fan connector polarity mismatch channel=%0d", channel);
+                if (channel < 4 && fan_balls[channel] !== ~bitmap[channel + 24])
+                    $fatal(1, "front fan board inversion mismatch channel=%0d", channel);
+                if (channel >= 4 && fan_balls[channel] !== bitmap[channel + 24])
+                    $fatal(1, "rear fan direct path mismatch channel=%0d", channel);
             end
             end
             if (ptc_pins !== bitmap[23:0])
             if (ptc_pins !== bitmap[23:0])
                 $fatal(1, "PTC polarity mismatch");
                 $fatal(1, "PTC polarity mismatch");
@@ -159,8 +185,9 @@ module pwm_bitmap_engine_tb;
         wait_for_boundary();
         wait_for_boundary();
         if (bitmap !== 32'hff000000)
         if (bitmap !== 32'hff000000)
             $fatal(1, "atomic safety bitmap mismatch: %h", bitmap);
             $fatal(1, "atomic safety bitmap mismatch: %h", bitmap);
-        if (ptc_pins !== 24'd0 || fan_pins !== 8'd0)
-            $fatal(1, "safe physical polarity mismatch ptc=%h fan=%h", ptc_pins, fan_pins);
+        if (ptc_pins !== 24'd0 || fan_balls !== 8'hf0 || fan_connector_pwm !== 8'hff)
+            $fatal(1, "safe physical polarity mismatch ptc=%h balls=%h connector=%h",
+                ptc_pins, fan_balls, fan_connector_pwm);
         if (miss) $fatal(1, "scan deadline miss after safety transition");
         if (miss) $fatal(1, "scan deadline miss after safety transition");
 
 
         $display("PASS: L6 PWM 32ch 500Hz duties=0,1,2,50,99,100 atomic safety polarity");
         $display("PASS: L6 PWM 32ch 500Hz duties=0,1,2,50,99,100 atomic safety polarity");

+ 2 - 1
tests/sim/thermal_control_core_tb.v

@@ -51,7 +51,8 @@ module thermal_control_core_tb;
         .control_state(state), .current_target_celsius(current_target),
         .control_state(state), .current_target_celsius(current_target),
         .host_target_seen(host_seen), .control_epoch(control_epoch),
         .host_target_seen(host_seen), .control_epoch(control_epoch),
         .safety_override_mask(safety), .lane_fault_mask(lane_fault),
         .safety_override_mask(safety), .lane_fault_mask(lane_fault),
-        .global_fault(global_fault), .output_commit(output_commit), .stimulus_active(stimulus_active)
+        .global_fault(global_fault), .output_commit(output_commit), .stimulus_active(stimulus_active),
+        .pwm_phase_boundary(1'b1), .pwm_scan_idle(1'b1), .boot_init_complete()
     );
     );
 
 
     task next_bmc_epoch;
     task next_bmc_epoch;

+ 98 - 7
tools/generate_6400_v1.py

@@ -106,6 +106,19 @@ def validate_wire(wire: dict[str, Any], snapshot_size: int) -> None:
         raise ValueError("UART baud drift")
         raise ValueError("UART baud drift")
     if wire["commands"]["SET_TARGET"]["payload_length"] != 1:
     if wire["commands"]["SET_TARGET"]["payload_length"] != 1:
         raise ValueError("SET_TARGET length drift")
         raise ValueError("SET_TARGET length drift")
+    stimulus_fields = wire["commands"]["SET_STIMULUS"].get("payload_fields", [])
+    expected_stimulus_fields = [
+        {"name": "duration_seconds", "offset": 0, "count": 1, "minimum": 1, "maximum": 255, "unit": "seconds"},
+        {"name": "ptc_duty_percent", "offset": 1, "count": 24, "minimum": 0, "maximum": 100, "unit": "percent"},
+        {"name": "front_fan_duty_percent", "offset": 25, "count": 4, "minimum": 0, "maximum": 100, "unit": "percent"},
+        {"name": "rear_fan_duty_percent", "offset": 29, "count": 4, "minimum": 0, "maximum": 100, "unit": "percent"},
+    ]
+    if stimulus_fields != expected_stimulus_fields:
+        raise ValueError("SET_STIMULUS payload layout drift")
+    if wire["responses"]["GET_SNAPSHOT_ACK"] != {"type": 0x82, "payload_length": 0}:
+        raise ValueError("GET_SNAPSHOT independent ACK drift")
+    if wire["responses"]["SNAPSHOT_DATA"].get("type") != 0x42:
+        raise ValueError("SNAPSHOT_DATA must be request type OR 0x40")
     if wire["responses"]["SNAPSHOT_DATA"].get("payload_length", snapshot_size) != snapshot_size:
     if wire["responses"]["SNAPSHOT_DATA"].get("payload_length", snapshot_size) != snapshot_size:
         raise ValueError("snapshot length drift")
         raise ValueError("snapshot length drift")
     forbidden = set(wire.get("forbidden_fields", []))
     forbidden = set(wire.get("forbidden_fields", []))
@@ -113,6 +126,47 @@ def validate_wire(wire: dict[str, Any], snapshot_size: int) -> None:
         raise ValueError("forbidden field list incomplete")
         raise ValueError("forbidden field list incomplete")
 
 
 
 
+def validate_fans(mapping: dict[str, Any], fan: dict[str, Any]) -> None:
+    if mapping.get("fan_output_vector_order") != [
+        "front0", "front1", "front2", "front3",
+        "rear0", "rear1", "rear2", "rear3",
+    ]:
+        raise ValueError("fan physical vector order drift")
+    expected_front = (
+        (24, 0, "CON25", 7, "FAN_PWM3", "Q101", "B1", True),
+        (25, 1, "CON8", 7, "FAN_PWM1", "Q99", "C4", True),
+        (26, 2, "CON24", 7, "FAN_PWM2", "Q100", "B5", True),
+        (27, 3, "CON26", 7, "FAN_PWM4", "Q102", "A14", True),
+    )
+    expected_rear = (
+        (28, 0, "CON64", 4, "FAN_GPIO44", "R704_0R_DIRECT", "P15", False),
+        (29, 1, "CON66", 4, "FAN_GPIO46", "R706_0R_DIRECT", "N15", False),
+        (30, 2, "CON62", 4, "FAN_GPIO42", "R702_0R_DIRECT", "M14", False),
+        (31, 3, "CON60", 4, "FAN_GPIO40", "R700_0R_DIRECT", "P5", False),
+    )
+    rows = mapping.get("fan_outputs", [])
+    for name, expected in (("front", expected_front), ("rear", expected_rear)):
+        actual = tuple(
+            (int(row["output_index"]), int(row["lane"]), row["connector"], int(row["pin"]),
+             row["net"], row["board_stage"], row["fpga_ball"], bool(row["board_inverts"]))
+            for row in rows if row.get("group") == name
+        )
+        if actual != expected:
+            raise ValueError(f"{name} fan physical mapping drift")
+    invert_mask = sum(1 << (int(row["output_index"]) - 24) for row in rows if row["board_inverts"])
+    if invert_mask != 0x0F:
+        raise ValueError("fan board invert mask must be 0x0F for grouped front/rear vector")
+    pwm = fan.get("pwm", {})
+    if pwm.get("ptc_hz") != 500 or pwm.get("fan_hz") != 500:
+        raise ValueError("current PTC/FAN PWM frequencies must independently equal 500 Hz")
+    if pwm.get("ptc_phase_clks") != 500 or pwm.get("fan_phase_clks") != 500:
+        raise ValueError("current PTC/FAN phase clocks must independently equal 500")
+    if pwm.get("carrier_backend") != "shared_equal_frequency_v1":
+        raise ValueError("current equal-frequency carrier backend drift")
+    if fan["duty"].get("reset") != 10 or fan["duty"].get("stopped") != 10:
+        raise ValueError("reset and STOPPED fan standby duty must remain 10")
+
+
 def crc16(data: bytes) -> int:
 def crc16(data: bytes) -> int:
     crc = 0xFFFF
     crc = 0xFFFF
     for value in data:
     for value in data:
@@ -132,12 +186,16 @@ def json_bytes(value: Any) -> bytes:
     return (json.dumps(value, indent=2, sort_keys=True, ensure_ascii=False) + "\n").encode()
     return (json.dumps(value, indent=2, sort_keys=True, ensure_ascii=False) + "\n").encode()
 
 
 
 
-def verilog_header(layout_rows: list[dict[str, Any]], snapshot_size: int, wire: dict[str, Any], coeff: dict[str, Any], fan: dict[str, Any], contract_sha: str) -> bytes:
+def verilog_header(layout_rows: list[dict[str, Any]], snapshot_size: int, wire: dict[str, Any], coeff: dict[str, Any], fan: dict[str, Any], mapping: dict[str, Any], contract_sha: str) -> bytes:
     command = wire["commands"]
     command = wire["commands"]
     response = wire["responses"]
     response = wire["responses"]
     limits = coeff["limits_centi_degC"]
     limits = coeff["limits_centi_degC"]
     target = coeff["targets_centi_degC"]
     target = coeff["targets_centi_degC"]
     classes = coeff["classes"]
     classes = coeff["classes"]
+    fan_invert_mask = sum(
+        1 << (int(row["output_index"]) - 24)
+        for row in mapping["fan_outputs"] if row["board_inverts"]
+    )
     lines = [
     lines = [
         "`ifndef PROD2U_6400_V1_PARAMS_VH",
         "`ifndef PROD2U_6400_V1_PARAMS_VH",
         "`define PROD2U_6400_V1_PARAMS_VH",
         "`define PROD2U_6400_V1_PARAMS_VH",
@@ -155,14 +213,24 @@ def verilog_header(layout_rows: list[dict[str, Any]], snapshot_size: int, wire:
         "`define FB_BMC_BAUD 115200",
         "`define FB_BMC_BAUD 115200",
         "`define FB_HOST_FIXED_CLKS_PER_BIT 27",
         "`define FB_HOST_FIXED_CLKS_PER_BIT 27",
         "`define FB_BMC_CLKS_PER_BIT 217",
         "`define FB_BMC_CLKS_PER_BIT 217",
-        "`define FB_PWM_PHASES 100",
-        "`define FB_PWM_PHASE_CLKS 500",
-        "`define FB_PWM_PERIOD_CLKS 50000",
+        f"`define FB_PWM_PHASES {int(fan['pwm']['phases'])}",
+        f"`define FB_PTC_PWM_HZ {int(fan['pwm']['ptc_hz'])}",
+        f"`define FB_FAN_PWM_HZ {int(fan['pwm']['fan_hz'])}",
+        f"`define FB_PTC_PWM_PHASE_CLKS {int(fan['pwm']['ptc_phase_clks'])}",
+        f"`define FB_FAN_PWM_PHASE_CLKS {int(fan['pwm']['fan_phase_clks'])}",
+        f"`define FB_PTC_PWM_PERIOD_CLKS {int(fan['pwm']['ptc_phase_clks']) * int(fan['pwm']['phases'])}",
+        f"`define FB_FAN_PWM_PERIOD_CLKS {int(fan['pwm']['fan_phase_clks']) * int(fan['pwm']['phases'])}",
+        f"`define FAN_BOARD_INVERT_MASK 8'h{fan_invert_mask:02X}",
+        "`define FRONT_FAN_CONNECTOR_MAP \"CON25.7,CON8.7,CON24.7,CON26.7\"",
+        "`define FRONT_FAN_FPGA_BALL_MAP \"B1,C4,B5,A14\"",
+        "`define REAR_FAN_CONNECTOR_MAP \"CON64.4,CON66.4,CON62.4,CON60.4\"",
+        "`define REAR_FAN_FPGA_BALL_MAP \"P15,N15,M14,P5\"",
         f"`define FB_CMD_SET_TARGET 8'h{int(command['SET_TARGET']['type']):02X}",
         f"`define FB_CMD_SET_TARGET 8'h{int(command['SET_TARGET']['type']):02X}",
         f"`define FB_CMD_GET_SNAPSHOT 8'h{int(command['GET_SNAPSHOT']['type']):02X}",
         f"`define FB_CMD_GET_SNAPSHOT 8'h{int(command['GET_SNAPSHOT']['type']):02X}",
         f"`define FB_CMD_SET_STIMULUS 8'h{int(command['SET_STIMULUS']['type']):02X}",
         f"`define FB_CMD_SET_STIMULUS 8'h{int(command['SET_STIMULUS']['type']):02X}",
         f"`define FB_RSP_SET_TARGET_ACK 8'h{int(response['SET_TARGET_ACK']['type']):02X}",
         f"`define FB_RSP_SET_TARGET_ACK 8'h{int(response['SET_TARGET_ACK']['type']):02X}",
-        f"`define FB_RSP_SNAPSHOT 8'h{int(response['SNAPSHOT_DATA']['type']):02X}",
+        f"`define FB_RSP_GET_SNAPSHOT_ACK 8'h{int(response['GET_SNAPSHOT_ACK']['type']):02X}",
+        f"`define FB_RSP_SNAPSHOT_DATA 8'h{int(response['SNAPSHOT_DATA']['type']):02X}",
         f"`define FB_RSP_STIMULUS_ACK 8'h{int(response['SET_STIMULUS_ACK']['type']):02X}",
         f"`define FB_RSP_STIMULUS_ACK 8'h{int(response['SET_STIMULUS_ACK']['type']):02X}",
         f"`define FB_SNAPSHOT_LENGTH {snapshot_size}",
         f"`define FB_SNAPSHOT_LENGTH {snapshot_size}",
         f"`define FB_TEMP_SOFT {int(limits['soft'])}",
         f"`define FB_TEMP_SOFT {int(limits['soft'])}",
@@ -211,6 +279,7 @@ def generate(output: Path) -> dict[Path, bytes]:
     coeff = load_yaml("controller-coefficients.yaml")
     coeff = load_yaml("controller-coefficients.yaml")
     fan = load_yaml("fan-control-parameters.yaml")
     fan = load_yaml("fan-control-parameters.yaml")
     validate_channels(mapping)
     validate_channels(mapping)
+    validate_fans(mapping, fan)
     layout_rows, snapshot_size = layout(snapshot)
     layout_rows, snapshot_size = layout(snapshot)
     validate_wire(wire, snapshot_size)
     validate_wire(wire, snapshot_size)
     contract_sha = source_hash()
     contract_sha = source_hash()
@@ -224,13 +293,35 @@ def generate(output: Path) -> dict[Path, bytes]:
             "set_target_70": frame(0x01, bytes((70,))),
             "set_target_70": frame(0x01, bytes((70,))),
             "get_snapshot": frame(0x02, b""),
             "get_snapshot": frame(0x02, b""),
             "set_target_ack": frame(0x81, b""),
             "set_target_ack": frame(0x81, b""),
+            "get_snapshot_ack": frame(0x82, b""),
             "stimulus_all_zero_one_second": frame(0x03, bytes((1,)) + bytes(32)),
             "stimulus_all_zero_one_second": frame(0x03, bytes((1,)) + bytes(32)),
             "stimulus_ack": frame(0x83, b""),
             "stimulus_ack": frame(0x83, b""),
         },
         },
     }
     }
+    canonical_profiles = {
+        "6400-control": {
+            "allowed_commands": ["SET_TARGET", "GET_SNAPSHOT"],
+            "production": True,
+            "stimulus": False,
+            "simulation_only": False,
+        },
+        "6400-identification": {
+            "allowed_commands": ["SET_TARGET", "GET_SNAPSHOT", "SET_STIMULUS"],
+            "production": False,
+            "stimulus": True,
+            "simulation_only": False,
+        },
+        "6400-sim-debug": {
+            "allowed_commands": ["SET_TARGET", "GET_SNAPSHOT", "SET_STIMULUS"],
+            "production": False,
+            "stimulus": True,
+            "simulation_only": True,
+        },
+    }
     host = {
     host = {
-        "schema": "prod2u-6400-host-contract-v1",
+        "schema": "prod2u-6400-host-contract-v2",
         "contract_sha256": contract_sha,
         "contract_sha256": contract_sha,
+        "canonical_profiles": canonical_profiles,
         "wire": wire,
         "wire": wire,
         "snapshot": snapshot_layout,
         "snapshot": snapshot_layout,
         "channel_map": mapping,
         "channel_map": mapping,
@@ -247,7 +338,7 @@ def generate(output: Path) -> dict[Path, bytes]:
         output / "fan-control-parameters.json": json_bytes({**fan, "contract_sha256": contract_sha}),
         output / "fan-control-parameters.json": json_bytes({**fan, "contract_sha256": contract_sha}),
         output / "golden-vectors.json": json_bytes(golden),
         output / "golden-vectors.json": json_bytes(golden),
         output / "host-contract.json": json_bytes(host),
         output / "host-contract.json": json_bytes(host),
-        output / "prod2u_6400_v1_params.vh": verilog_header(layout_rows, snapshot_size, wire, coeff, fan, contract_sha),
+        output / "prod2u_6400_v1_params.vh": verilog_header(layout_rows, snapshot_size, wire, coeff, fan, mapping, contract_sha),
         output / "contract-sha256.txt": (contract_sha + "\n").encode(),
         output / "contract-sha256.txt": (contract_sha + "\n").encode(),
         ROOT / "docs/generated/6400-channel-map.md": channel_markdown(mapping, contract_sha),
         ROOT / "docs/generated/6400-channel-map.md": channel_markdown(mapping, contract_sha),
     }
     }