Explorar o código

feat(prod2u): add on-demand temperature read

Codex Resource Selftest hai 4 meses
pai
achega
09636b3b7b
Modificáronse 30 ficheiros con 2064 adicións e 83 borrados
  1. 13 3
      config/prod2u_p4_normal_v3_hw_binding.json
  2. 1 1
      config/prod2u_p4_normal_v3_resource_baseline.json
  3. 5 0
      config/prod2u_p4_verification_targets_v1.json
  4. 11 8
      schemas/prod2u_p4_normal_v3_resource_baseline.schema.json
  5. 3 3
      schemas/prod2u_p4_normal_v3_td_build_receipt.schema.json
  6. 437 0
      src/rtl/prod2u_p4_i2c_stop_start_read.v
  7. 50 0
      src/rtl/prod2u_p4_normal_v3_core.v
  8. 92 13
      src/rtl/prod2u_p4_normal_v3_tx.v
  9. 126 0
      src/rtl/prod2u_p4_temperature_read.v
  10. 148 0
      src/rtl/prod2u_p4_temperature_short_tx.v
  11. 30 0
      src/rtl/prod2u_p4_temperature_store.v
  12. 117 2
      src/top/prod2u_p4_normal_v3_top.v
  13. 7 1
      td/phy/prod2u_p4_normal_v3.tcl
  14. 8 4
      td/prod2u_p4_normal_v3.prj
  15. 11 1
      td/syn/prod2u_p4_normal_v3.tcl
  16. 215 0
      tests/sim/prod2u_p4_i2c_stop_start_read_tb.v
  17. 279 0
      tests/sim/prod2u_p4_temperature_read_tb.v
  18. 230 0
      tests/sim/prod2u_p4_temperature_short_tx_tb.v
  19. 86 0
      tests/sim/prod2u_p4_temperature_store_tb.v
  20. 4 0
      tests/test_project_structure.py
  21. 29 15
      tests/unit/test_prod2u_p4_harness.py
  22. 1 5
      tests/unit/test_prod2u_p4_minimal_delivery_contract.py
  23. 16 6
      tests/unit/test_prod2u_p4_normal_v3_td_files.py
  24. 5 2
      tests/unit/test_prod2u_p4_protocol_v3.py
  25. 8 7
      tests/unit/test_prod2u_p4_retirement_contract.py
  26. 13 7
      tests/unit/test_prod2u_p4_td_cdc_structure.py
  27. 81 0
      tests/unit/test_prod2u_p4_temperature_contract.py
  28. 9 3
      tools/prod2u_p4_harness.py
  29. 4 0
      tools/prod2u_p4_normal_v3_build.py
  30. 25 2
      tools/prod2u_p4_protocol.py

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 13 - 3
config/prod2u_p4_normal_v3_hw_binding.json


+ 1 - 1
config/prod2u_p4_normal_v3_resource_baseline.json

@@ -9,7 +9,7 @@
     "affects_build_status": false
     "affects_build_status": false
   },
   },
   "architecture": {
   "architecture": {
-    "io": 41,
+    "io": 43,
     "dsp": 0,
     "dsp": 0,
     "bram9k": 0,
     "bram9k": 0,
     "bram32k": 0,
     "bram32k": 0,

+ 5 - 0
config/prod2u_p4_verification_targets_v1.json

@@ -22,6 +22,7 @@
       "tests.unit.test_prod2u_p4_retirement_contract",
       "tests.unit.test_prod2u_p4_retirement_contract",
       "tests.unit.test_prod2u_p4_send_hex_template",
       "tests.unit.test_prod2u_p4_send_hex_template",
       "tests.unit.test_prod2u_p4_td_cdc_structure",
       "tests.unit.test_prod2u_p4_td_cdc_structure",
+      "tests.unit.test_prod2u_p4_temperature_contract",
       "tests.unit.test_prod2u_p4_wrapper_v3",
       "tests.unit.test_prod2u_p4_wrapper_v3",
       "tests.test_project_structure"
       "tests.test_project_structure"
     ],
     ],
@@ -33,6 +34,7 @@
       "prod2u_p4_core_watchdog_refresh_tb",
       "prod2u_p4_core_watchdog_refresh_tb",
       "prod2u_p4_fast_jog_core_tb",
       "prod2u_p4_fast_jog_core_tb",
       "prod2u_p4_jog_no_gates_contract_tb",
       "prod2u_p4_jog_no_gates_contract_tb",
+      "prod2u_p4_i2c_stop_start_read_tb",
       "prod2u_p4_minimal_snapshot_contract_tb",
       "prod2u_p4_minimal_snapshot_contract_tb",
       "prod2u_p4_motor_hub_axis_isolation_tb",
       "prod2u_p4_motor_hub_axis_isolation_tb",
       "prod2u_p4_motor_status_payload_tb",
       "prod2u_p4_motor_status_payload_tb",
@@ -44,6 +46,9 @@
       "prod2u_p4_normal_v3_watchdog_contract_tb",
       "prod2u_p4_normal_v3_watchdog_contract_tb",
       "prod2u_p4_production_defaults_tb",
       "prod2u_p4_production_defaults_tb",
       "prod2u_p4_pwm_outputs_tb",
       "prod2u_p4_pwm_outputs_tb",
+      "prod2u_p4_temperature_read_tb",
+      "prod2u_p4_temperature_short_tx_tb",
+      "prod2u_p4_temperature_store_tb",
       "prod2u_p4_us_tick_tb",
       "prod2u_p4_us_tick_tb",
       "prod2u_por_tb",
       "prod2u_por_tb",
       "uart_8n1_phy_tb",
       "uart_8n1_phy_tb",

+ 11 - 8
schemas/prod2u_p4_normal_v3_resource_baseline.schema.json

@@ -23,14 +23,17 @@
       "const": {"mode": "advisory_only", "affects_build_status": false}
       "const": {"mode": "advisory_only", "affects_build_status": false}
     },
     },
     "architecture": {
     "architecture": {
-      "const": {
-        "io": 41,
-        "dsp": 0,
-        "bram9k": 0,
-        "bram32k": 0,
-        "bram128k": 0,
-        "bram256k": 0
-      }
+      "type": "object",
+      "required": ["io", "dsp", "bram9k", "bram32k", "bram128k", "bram256k"],
+      "properties": {
+        "io": {"const": 43},
+        "dsp": {"type": "integer", "minimum": 0},
+        "bram9k": {"type": "integer", "minimum": 0},
+        "bram32k": {"type": "integer", "minimum": 0},
+        "bram128k": {"type": "integer", "minimum": 0},
+        "bram256k": {"type": "integer", "minimum": 0}
+      },
+      "additionalProperties": false
     },
     },
     "measurement": {
     "measurement": {
       "type": "object",
       "type": "object",

+ 3 - 3
schemas/prod2u_p4_normal_v3_td_build_receipt.schema.json

@@ -106,10 +106,10 @@
           "required": ["status", "async_reg", "input_registers", "retained_sync_registers", "first_stage_endpoints", "failures"],
           "required": ["status", "async_reg", "input_registers", "retained_sync_registers", "first_stage_endpoints", "failures"],
           "properties": {
           "properties": {
             "status": {"enum": ["pass", "fail"]},
             "status": {"enum": ["pass", "fail"]},
-            "async_reg": {"properties": {"used": {"const": 2}}},
+            "async_reg": {"properties": {"used": {"const": 6}}},
             "input_registers": {"properties": {"used": {"const": 0}}},
             "input_registers": {"properties": {"used": {"const": 0}}},
-            "retained_sync_registers": {"properties": {"used": {"const": 2}}},
-            "first_stage_endpoints": {"properties": {"used": {"const": 1}}},
+            "retained_sync_registers": {"properties": {"used": {"const": 6}}},
+            "first_stage_endpoints": {"properties": {"used": {"const": 3}}},
             "failures": {"type": "array", "items": {"type": "string"}}
             "failures": {"type": "array", "items": {"type": "string"}}
           }
           }
         },
         },

+ 437 - 0
src/rtl/prod2u_p4_i2c_stop_start_read.v

@@ -0,0 +1,437 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_i2c_stop_start_read #(
+    parameter integer HALF_PERIOD_CLKS = 125,
+    parameter integer TIMEOUT_CLKS = 25000
+) (
+    input  wire        clk,
+    input  wire        rst_n,
+    input  wire        abort,
+    output reg         abort_done,
+    input  wire        request_valid,
+    output wire        request_ready,
+    input  wire [6:0]  request_device_addr,
+    input  wire [7:0]  request_register,
+    output reg         response_valid,
+    input  wire        response_ready,
+    output reg  [15:0] response_data,
+    output reg  [3:0]  response_error,
+    output wire        busy,
+    input  wire        scl_i,
+    input  wire        sda_i,
+    output reg         scl_drive_low,
+    output reg         sda_drive_low
+);
+    localparam [3:0] ERROR_NONE = 4'd0;
+    localparam [3:0] ERROR_ADDRESS_NACK = 4'd1;
+    localparam [3:0] ERROR_REGISTER_NACK = 4'd2;
+    localparam [3:0] ERROR_READ_ADDRESS_NACK = 4'd3;
+    localparam [3:0] ERROR_TIMEOUT = 4'd4;
+    localparam [3:0] ERROR_STUCK_LOW = 4'd5;
+    localparam [3:0] ERROR_ARBITRATION_LOST = 4'd6;
+
+    localparam [1:0] TX_WRITE_ADDRESS = 2'd0;
+    localparam [1:0] TX_REGISTER = 2'd1;
+    localparam [1:0] TX_READ_ADDRESS = 2'd2;
+
+    localparam [4:0] ST_IDLE = 5'd0;
+    localparam [4:0] ST_BUS_WAIT_WRITE = 5'd1;
+    localparam [4:0] ST_START_HOLD = 5'd2;
+    localparam [4:0] ST_TX_BIT_LOW = 5'd3;
+    localparam [4:0] ST_TX_BIT_HIGH = 5'd4;
+    localparam [4:0] ST_TX_ACK_LOW = 5'd5;
+    localparam [4:0] ST_TX_ACK_HIGH = 5'd6;
+    localparam [4:0] ST_STOP_LOW = 5'd7;
+    localparam [4:0] ST_STOP_SCL_HIGH = 5'd8;
+    localparam [4:0] ST_STOP_RELEASE = 5'd9;
+    localparam [4:0] ST_BUS_WAIT_READ = 5'd10;
+    localparam [4:0] ST_RX_BIT_LOW = 5'd11;
+    localparam [4:0] ST_RX_BIT_HIGH = 5'd12;
+    localparam [4:0] ST_RX_ACK_LOW = 5'd13;
+    localparam [4:0] ST_RX_ACK_HIGH = 5'd14;
+    localparam [4:0] ST_RESPONSE = 5'd15;
+    localparam [4:0] ST_ABORT_SCL_HIGH = 5'd16;
+    localparam [4:0] ST_ABORT_RELEASE = 5'd17;
+
+    (* ASYNC_REG = "TRUE" *) reg [1:0] scl_sync;
+    (* ASYNC_REG = "TRUE" *) reg [1:0] sda_sync;
+    reg [4:0] state;
+    reg [31:0] phase_count;
+    reg [31:0] timeout_count;
+    reg [6:0] device_addr;
+    reg [7:0] register_addr;
+    reg [7:0] tx_byte;
+    reg [1:0] tx_stage;
+    reg [2:0] bit_index;
+    reg [15:0] rx_shift;
+    reg rx_byte_index;
+    reg [3:0] pending_error;
+    reg after_stop_read;
+
+    wire scl_sample;
+    wire sda_sample;
+
+    assign scl_sample = scl_sync[1];
+    assign sda_sample = sda_sync[1];
+    assign request_ready = (state == ST_IDLE) && !response_valid;
+    assign busy = (state != ST_IDLE) || response_valid;
+
+    generate
+        if (HALF_PERIOD_CLKS < 1) begin : g_half_period_must_be_positive
+            prod2u_p4_i2c_half_period_must_be_positive u_half_period_error();
+        end
+        if (TIMEOUT_CLKS < 1) begin : g_timeout_must_be_positive
+            prod2u_p4_i2c_timeout_must_be_positive u_timeout_error();
+        end
+    endgenerate
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            scl_sync <= 2'b11;
+            sda_sync <= 2'b11;
+        end else begin
+            scl_sync <= {scl_sync[0], scl_i};
+            sda_sync <= {sda_sync[0], sda_i};
+        end
+    end
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            state <= ST_IDLE;
+            phase_count <= 32'd0;
+            timeout_count <= 32'd0;
+            device_addr <= 7'd0;
+            register_addr <= 8'd0;
+            tx_byte <= 8'd0;
+            tx_stage <= TX_WRITE_ADDRESS;
+            bit_index <= 3'd0;
+            rx_shift <= 16'd0;
+            rx_byte_index <= 1'b0;
+            pending_error <= ERROR_NONE;
+            after_stop_read <= 1'b0;
+            response_valid <= 1'b0;
+            abort_done <= 1'b0;
+            response_data <= 16'd0;
+            response_error <= ERROR_NONE;
+            scl_drive_low <= 1'b0;
+            sda_drive_low <= 1'b0;
+        end else begin
+            abort_done <= 1'b0;
+            if (abort && state != ST_ABORT_SCL_HIGH && state != ST_ABORT_RELEASE) begin
+                response_valid <= 1'b0;
+                response_data <= 16'd0;
+                response_error <= ERROR_NONE;
+                phase_count <= 32'd0;
+                timeout_count <= 32'd0;
+                if (state == ST_IDLE) begin
+                    state <= ST_IDLE;
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b0;
+                    abort_done <= 1'b1;
+                end else begin
+                    state <= ST_ABORT_SCL_HIGH;
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b1;
+                end
+            end else if (state != ST_IDLE && state != ST_RESPONSE &&
+                         state != ST_ABORT_SCL_HIGH && state != ST_ABORT_RELEASE &&
+                         timeout_count >= TIMEOUT_CLKS - 1) begin
+                state <= ST_RESPONSE;
+                phase_count <= 32'd0;
+                timeout_count <= 32'd0;
+                response_valid <= 1'b1;
+                response_data <= 16'd0;
+                response_error <= ((state == ST_BUS_WAIT_WRITE) || (state == ST_BUS_WAIT_READ)) ?
+                    ERROR_STUCK_LOW : ERROR_TIMEOUT;
+                scl_drive_low <= 1'b0;
+                sda_drive_low <= 1'b0;
+            end else begin
+                if (state != ST_IDLE && state != ST_RESPONSE) begin
+                    timeout_count <= timeout_count + 32'd1;
+                end
+
+                case (state)
+                ST_IDLE: begin
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b0;
+                    phase_count <= 32'd0;
+                    timeout_count <= 32'd0;
+                    if (request_valid) begin
+                        device_addr <= request_device_addr;
+                        register_addr <= request_register;
+                        response_data <= 16'd0;
+                        response_error <= ERROR_NONE;
+                        pending_error <= ERROR_NONE;
+                        after_stop_read <= 1'b0;
+                        rx_shift <= 16'd0;
+                        state <= ST_BUS_WAIT_WRITE;
+                    end
+                end
+
+                ST_BUS_WAIT_WRITE,
+                ST_BUS_WAIT_READ: begin
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b0;
+                    if (scl_sample && sda_sample) begin
+                        if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                            phase_count <= 32'd0;
+                            sda_drive_low <= 1'b1;
+                            tx_stage <= (state == ST_BUS_WAIT_WRITE) ?
+                                TX_WRITE_ADDRESS : TX_READ_ADDRESS;
+                            state <= ST_START_HOLD;
+                        end else begin
+                            phase_count <= phase_count + 32'd1;
+                        end
+                    end else begin
+                        phase_count <= 32'd0;
+                    end
+                end
+
+                ST_START_HOLD: begin
+                    if (scl_sample) begin
+                        if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                            phase_count <= 32'd0;
+                            tx_byte <= (tx_stage == TX_READ_ADDRESS) ?
+                                {device_addr, 1'b1} : {device_addr, 1'b0};
+                            bit_index <= 3'd7;
+                            scl_drive_low <= 1'b1;
+                            state <= ST_TX_BIT_LOW;
+                        end else begin
+                            phase_count <= phase_count + 32'd1;
+                        end
+                    end
+                end
+
+                ST_TX_BIT_LOW: begin
+                    if (phase_count == 32'd0) begin
+                        sda_drive_low <= ~tx_byte[bit_index];
+                    end
+                    if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                        phase_count <= 32'd0;
+                        scl_drive_low <= 1'b0;
+                        state <= ST_TX_BIT_HIGH;
+                    end else begin
+                        phase_count <= phase_count + 32'd1;
+                    end
+                end
+
+                ST_TX_BIT_HIGH: begin
+                    if (scl_sample) begin
+                        if (tx_byte[bit_index] && !sda_sample) begin
+                            state <= ST_RESPONSE;
+                            timeout_count <= 32'd0;
+                            response_valid <= 1'b1;
+                            response_data <= 16'd0;
+                            response_error <= ERROR_ARBITRATION_LOST;
+                            scl_drive_low <= 1'b0;
+                            sda_drive_low <= 1'b0;
+                        end else if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                            phase_count <= 32'd0;
+                            scl_drive_low <= 1'b1;
+                            if (bit_index == 3'd0) begin
+                                state <= ST_TX_ACK_LOW;
+                            end else begin
+                                bit_index <= bit_index - 3'd1;
+                                state <= ST_TX_BIT_LOW;
+                            end
+                        end else begin
+                            phase_count <= phase_count + 32'd1;
+                        end
+                    end
+                end
+
+                ST_TX_ACK_LOW: begin
+                    if (phase_count == 32'd0) begin
+                        sda_drive_low <= 1'b0;
+                    end
+                    if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                        phase_count <= 32'd0;
+                        scl_drive_low <= 1'b0;
+                        state <= ST_TX_ACK_HIGH;
+                    end else begin
+                        phase_count <= phase_count + 32'd1;
+                    end
+                end
+
+                ST_TX_ACK_HIGH: begin
+                    if (scl_sample) begin
+                        if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                            phase_count <= 32'd0;
+                            scl_drive_low <= 1'b1;
+                            if (sda_sample) begin
+                                case (tx_stage)
+                                    TX_WRITE_ADDRESS: pending_error <= ERROR_ADDRESS_NACK;
+                                    TX_REGISTER: pending_error <= ERROR_REGISTER_NACK;
+                                    default: pending_error <= ERROR_READ_ADDRESS_NACK;
+                                endcase
+                                after_stop_read <= 1'b0;
+                                state <= ST_STOP_LOW;
+                            end else if (tx_stage == TX_WRITE_ADDRESS) begin
+                                tx_byte <= register_addr;
+                                tx_stage <= TX_REGISTER;
+                                bit_index <= 3'd7;
+                                state <= ST_TX_BIT_LOW;
+                            end else if (tx_stage == TX_REGISTER) begin
+                                pending_error <= ERROR_NONE;
+                                after_stop_read <= 1'b1;
+                                state <= ST_STOP_LOW;
+                            end else begin
+                                rx_shift <= 16'd0;
+                                rx_byte_index <= 1'b0;
+                                bit_index <= 3'd7;
+                                state <= ST_RX_BIT_LOW;
+                            end
+                        end else begin
+                            phase_count <= phase_count + 32'd1;
+                        end
+                    end
+                end
+
+                ST_RX_BIT_LOW: begin
+                    if (phase_count == 32'd0) begin
+                        sda_drive_low <= 1'b0;
+                    end
+                    if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                        phase_count <= 32'd0;
+                        scl_drive_low <= 1'b0;
+                        state <= ST_RX_BIT_HIGH;
+                    end else begin
+                        phase_count <= phase_count + 32'd1;
+                    end
+                end
+
+                ST_RX_BIT_HIGH: begin
+                    if (scl_sample) begin
+                        if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                            phase_count <= 32'd0;
+                            rx_shift <= {rx_shift[14:0], sda_sample};
+                            scl_drive_low <= 1'b1;
+                            if (bit_index == 3'd0) begin
+                                state <= ST_RX_ACK_LOW;
+                            end else begin
+                                bit_index <= bit_index - 3'd1;
+                                state <= ST_RX_BIT_LOW;
+                            end
+                        end else begin
+                            phase_count <= phase_count + 32'd1;
+                        end
+                    end
+                end
+
+                ST_RX_ACK_LOW: begin
+                    if (phase_count == 32'd0) begin
+                        sda_drive_low <= (rx_byte_index == 1'b0);
+                    end
+                    if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                        phase_count <= 32'd0;
+                        scl_drive_low <= 1'b0;
+                        state <= ST_RX_ACK_HIGH;
+                    end else begin
+                        phase_count <= phase_count + 32'd1;
+                    end
+                end
+
+                ST_RX_ACK_HIGH: begin
+                    if (scl_sample) begin
+                        if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                            phase_count <= 32'd0;
+                            scl_drive_low <= 1'b1;
+                            if (rx_byte_index == 1'b0) begin
+                                rx_byte_index <= 1'b1;
+                                bit_index <= 3'd7;
+                                state <= ST_RX_BIT_LOW;
+                            end else begin
+                                pending_error <= ERROR_NONE;
+                                after_stop_read <= 1'b0;
+                                state <= ST_STOP_LOW;
+                            end
+                        end else begin
+                            phase_count <= phase_count + 32'd1;
+                        end
+                    end
+                end
+
+                ST_STOP_LOW: begin
+                    scl_drive_low <= 1'b1;
+                    sda_drive_low <= 1'b1;
+                    if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                        phase_count <= 32'd0;
+                        scl_drive_low <= 1'b0;
+                        state <= ST_STOP_SCL_HIGH;
+                    end else begin
+                        phase_count <= phase_count + 32'd1;
+                    end
+                end
+
+                ST_STOP_SCL_HIGH: begin
+                    if (scl_sample) begin
+                        if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                            phase_count <= 32'd0;
+                            sda_drive_low <= 1'b0;
+                            state <= ST_STOP_RELEASE;
+                        end else begin
+                            phase_count <= phase_count + 32'd1;
+                        end
+                    end
+                end
+
+                ST_STOP_RELEASE: begin
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b0;
+                    if (scl_sample && sda_sample) begin
+                        if (phase_count >= HALF_PERIOD_CLKS - 1) begin
+                            phase_count <= 32'd0;
+                            if (after_stop_read && pending_error == ERROR_NONE) begin
+                                after_stop_read <= 1'b0;
+                                state <= ST_BUS_WAIT_READ;
+                            end else begin
+                                state <= ST_RESPONSE;
+                                response_valid <= 1'b1;
+                                response_data <= (pending_error == ERROR_NONE) ? rx_shift : 16'd0;
+                                response_error <= pending_error;
+                                timeout_count <= 32'd0;
+                            end
+                        end else begin
+                            phase_count <= phase_count + 32'd1;
+                        end
+                    end else begin
+                        phase_count <= 32'd0;
+                    end
+                end
+
+                ST_RESPONSE: begin
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b0;
+                    if (response_valid && response_ready) begin
+                        response_valid <= 1'b0;
+                        state <= ST_IDLE;
+                    end
+                end
+
+                ST_ABORT_SCL_HIGH: begin
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b1;
+                    if (scl_sample || timeout_count >= TIMEOUT_CLKS - 1) begin
+                        timeout_count <= 32'd0;
+                        state <= ST_ABORT_RELEASE;
+                    end
+                end
+
+                ST_ABORT_RELEASE: begin
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b0;
+                    timeout_count <= 32'd0;
+                    state <= ST_IDLE;
+                    abort_done <= 1'b1;
+                end
+
+                default: begin
+                    state <= ST_IDLE;
+                    scl_drive_low <= 1'b0;
+                    sda_drive_low <= 1'b0;
+                end
+                endcase
+            end
+        end
+    end
+endmodule

+ 50 - 0
src/rtl/prod2u_p4_normal_v3_core.v

@@ -18,6 +18,13 @@ module prod2u_p4_normal_v3_core #(
     input  wire [1:0]   fast_jog_axis,
     input  wire [1:0]   fast_jog_axis,
     input  wire         fast_jog_dir,
     input  wire         fast_jog_dir,
     input  wire [15:0]  fast_jog_steps,
     input  wire [15:0]  fast_jog_steps,
+    input  wire         powerup_ready,
+    output reg          temperature_read_start,
+    input  wire         temperature_read_done,
+    input  wire         temperature_bus_error,
+    output reg          temperature_tx_start,
+    output reg          temperature_tx_force_ff,
+    input  wire         temperature_tx_done,
     output wire         frame_valid,
     output wire         frame_valid,
     input  wire         frame_ready,
     input  wire         frame_ready,
     output wire [7:0]   frame_type,
     output wire [7:0]   frame_type,
@@ -43,6 +50,7 @@ module prod2u_p4_normal_v3_core #(
 
 
     localparam [7:0] CMD_GET_STATUS = 8'h24;
     localparam [7:0] CMD_GET_STATUS = 8'h24;
     localparam [7:0] CMD_DISABLE = 8'h26;
     localparam [7:0] CMD_DISABLE = 8'h26;
+    localparam [7:0] CMD_GET_TEMPERATURES = 8'h28;
     localparam [7:0] CMD_SET_SNAPSHOT = 8'h2a;
     localparam [7:0] CMD_SET_SNAPSHOT = 8'h2a;
     localparam [7:0] MOTION_JOG = 8'h35;
     localparam [7:0] MOTION_JOG = 8'h35;
     localparam [7:0] MOTION_MARK_CLOSED = 8'h36;
     localparam [7:0] MOTION_MARK_CLOSED = 8'h36;
@@ -53,11 +61,14 @@ module prod2u_p4_normal_v3_core #(
     localparam [7:0] STATUS_BAD_FLAGS = 8'h02;
     localparam [7:0] STATUS_BAD_FLAGS = 8'h02;
     localparam [7:0] STATUS_BAD_LENGTH = 8'h03;
     localparam [7:0] STATUS_BAD_LENGTH = 8'h03;
     localparam [7:0] STATUS_BAD_VALUE = 8'h05;
     localparam [7:0] STATUS_BAD_VALUE = 8'h05;
+    localparam [7:0] STATUS_TEMP_BUS = 8'h0a;
 
 
     localparam [2:0] ST_IDLE = 3'd0;
     localparam [2:0] ST_IDLE = 3'd0;
     localparam [2:0] ST_SNAPSHOT_VALIDATE = 3'd1;
     localparam [2:0] ST_SNAPSHOT_VALIDATE = 3'd1;
     localparam [2:0] ST_SNAPSHOT_COMMIT = 3'd2;
     localparam [2:0] ST_SNAPSHOT_COMMIT = 3'd2;
     localparam [2:0] ST_DISABLE_WAIT = 3'd3;
     localparam [2:0] ST_DISABLE_WAIT = 3'd3;
+    localparam [2:0] ST_TEMP_READ_WAIT = 3'd4;
+    localparam [2:0] ST_TEMP_TX_WAIT = 3'd5;
 
 
     reg [2:0] state;
     reg [2:0] state;
 `ifdef FORMAL
 `ifdef FORMAL
@@ -95,7 +106,9 @@ module prod2u_p4_normal_v3_core #(
 
 
     reg watchdog_disable;
     reg watchdog_disable;
     reg watchdog_snapshot_arm;
     reg watchdog_snapshot_arm;
+    /* verilator lint_off UNUSEDSIGNAL */
     wire watchdog_armed;
     wire watchdog_armed;
+    /* verilator lint_on UNUSEDSIGNAL */
     wire watchdog_force_safe;
     wire watchdog_force_safe;
     wire watchdog_expiry_due;
     wire watchdog_expiry_due;
     // The non-motor output watchdog measures host-command silence. Any
     // The non-motor output watchdog measures host-command silence. Any
@@ -235,6 +248,9 @@ module prod2u_p4_normal_v3_core #(
             fast_jog_ack_payload <= 64'd0;
             fast_jog_ack_payload <= 64'd0;
             watchdog_disable <= 1'b0;
             watchdog_disable <= 1'b0;
             watchdog_snapshot_arm <= 1'b0;
             watchdog_snapshot_arm <= 1'b0;
+            temperature_read_start <= 1'b0;
+            temperature_tx_start <= 1'b0;
+            temperature_tx_force_ff <= 1'b0;
             command_inflight <= 1'b0;
             command_inflight <= 1'b0;
             command_response_valid <= 1'b0;
             command_response_valid <= 1'b0;
             command_ack_payload <= 64'd0;
             command_ack_payload <= 64'd0;
@@ -246,6 +262,9 @@ module prod2u_p4_normal_v3_core #(
             snapshot_commit_authorize <= 1'b0;
             snapshot_commit_authorize <= 1'b0;
             watchdog_disable <= 1'b0;
             watchdog_disable <= 1'b0;
             watchdog_snapshot_arm <= 1'b0;
             watchdog_snapshot_arm <= 1'b0;
+            temperature_read_start <= 1'b0;
+            temperature_tx_start <= 1'b0;
+            temperature_tx_force_ff <= 1'b0;
 
 
             if (fast_jog_valid) begin
             if (fast_jog_valid) begin
                 fast_jog_ack_pending <= 1'b1;
                 fast_jog_ack_pending <= 1'b1;
@@ -309,6 +328,15 @@ module prod2u_p4_normal_v3_core #(
                             end else if (request_command == CMD_DISABLE) begin
                             end else if (request_command == CMD_DISABLE) begin
                                 watchdog_disable <= 1'b1;
                                 watchdog_disable <= 1'b1;
                                 state <= ST_DISABLE_WAIT;
                                 state <= ST_DISABLE_WAIT;
+                            end else if (request_command == CMD_GET_TEMPERATURES) begin
+                                if (powerup_ready) begin
+                                    temperature_read_start <= 1'b1;
+                                    state <= ST_TEMP_READ_WAIT;
+                                end else begin
+                                    temperature_tx_start <= 1'b1;
+                                    temperature_tx_force_ff <= 1'b1;
+                                    state <= ST_TEMP_TX_WAIT;
+                                end
                             end else begin
                             end else begin
                                 queue_response(1'b0, request_command,
                                 queue_response(1'b0, request_command,
                                     STATUS_UNSUPPORTED, 8'd0, state_hash16,
                                     STATUS_UNSUPPORTED, 8'd0, state_hash16,
@@ -386,6 +414,28 @@ module prod2u_p4_normal_v3_core #(
                     end
                     end
                 end
                 end
 
 
+                ST_TEMP_READ_WAIT: begin
+                    if (temperature_read_done) begin
+                        if (temperature_bus_error) begin
+                            queue_response(1'b0, CMD_GET_TEMPERATURES,
+                                STATUS_TEMP_BUS, 8'd0, state_hash16,
+                                8'd0, 8'd0, 1'b0, 80'd0);
+                            state <= ST_IDLE;
+                        end else begin
+                            temperature_tx_start <= 1'b1;
+                            temperature_tx_force_ff <= 1'b0;
+                            state <= ST_TEMP_TX_WAIT;
+                        end
+                    end
+                end
+
+                ST_TEMP_TX_WAIT: begin
+                    if (temperature_tx_done) begin
+                        command_inflight <= 1'b0;
+                        state <= ST_IDLE;
+                    end
+                end
+
                 default: state <= ST_IDLE;
                 default: state <= ST_IDLE;
             endcase
             endcase
         end
         end

+ 92 - 13
src/rtl/prod2u_p4_normal_v3_tx.v

@@ -8,16 +8,49 @@ module prod2u_p4_normal_v3_tx (
     input  wire [7:0]   frame_type,
     input  wire [7:0]   frame_type,
     input  wire [7:0]   frame_payload_len,
     input  wire [7:0]   frame_payload_len,
     input  wire [143:0] frame_payload,
     input  wire [143:0] frame_payload,
+    input  wire         temperature_start,
+    input  wire         temperature_force_ff,
+    output wire         temperature_rd_req,
+    output wire [4:0]   temperature_rd_addr,
+    input  wire         temperature_rd_valid,
+    input  wire [7:0]   temperature_rd_data,
+    output wire         temperature_done,
     output wire         tx_valid,
     output wire         tx_valid,
     input  wire         tx_ready,
     input  wire         tx_ready,
     output wire [7:0]   tx_data
     output wire [7:0]   tx_data
 );
 );
-    reg frame_active;
+    localparam [1:0] OWNER_IDLE = 2'd0;
+    localparam [1:0] OWNER_STANDARD = 2'd1;
+    localparam [1:0] OWNER_TEMPERATURE = 2'd2;
+
+    reg [1:0] owner;
+    reg temperature_pending;
+    reg temperature_pending_force_ff;
+
+    wire standard_start = (owner == OWNER_IDLE) && frame_valid;
+    wire temperature_short_start =
+        (owner == OWNER_IDLE) && !frame_valid && temperature_pending;
+
     wire serializer_busy;
     wire serializer_busy;
     wire serializer_done;
     wire serializer_done;
-    wire start = !frame_active && frame_valid;
+    wire serializer_tx_valid;
+    wire [7:0] serializer_tx_data;
+    wire serializer_tx_ready =
+        (owner == OWNER_STANDARD) && tx_ready;
 
 
-    assign frame_ready = frame_active && serializer_done;
+    wire temperature_tx_valid;
+    wire [7:0] temperature_tx_data;
+    wire temperature_tx_ready =
+        (owner == OWNER_TEMPERATURE) && tx_ready;
+    wire temperature_busy;
+    wire temperature_short_done;
+
+    assign frame_ready = (owner == OWNER_STANDARD) && serializer_done;
+    assign temperature_done = temperature_short_done;
+    assign tx_valid = (owner == OWNER_STANDARD) ? serializer_tx_valid :
+        ((owner == OWNER_TEMPERATURE) ? temperature_tx_valid : 1'b0);
+    assign tx_data = (owner == OWNER_STANDARD) ? serializer_tx_data :
+        ((owner == OWNER_TEMPERATURE) ? temperature_tx_data : 8'd0);
 
 
     binary921_frame_tx #(
     binary921_frame_tx #(
         .MAX_PAYLOAD_BYTES(18),
         .MAX_PAYLOAD_BYTES(18),
@@ -26,7 +59,7 @@ module prod2u_p4_normal_v3_tx (
     ) u_frame (
     ) u_frame (
         .clk(clk),
         .clk(clk),
         .rst_n(rst_n),
         .rst_n(rst_n),
-        .start(start),
+        .start(standard_start),
         .profile_id(8'h04),
         .profile_id(8'h04),
         .frame_type(frame_type),
         .frame_type(frame_type),
         .frame_seq(32'd0),
         .frame_seq(32'd0),
@@ -35,20 +68,66 @@ module prod2u_p4_normal_v3_tx (
         .payload(frame_payload),
         .payload(frame_payload),
         .busy(serializer_busy),
         .busy(serializer_busy),
         .done(serializer_done),
         .done(serializer_done),
-        .tx_valid(tx_valid),
-        .tx_data(tx_data),
-        .tx_ready(tx_ready)
+        .tx_valid(serializer_tx_valid),
+        .tx_data(serializer_tx_data),
+        .tx_ready(serializer_tx_ready)
+    );
+
+    prod2u_p4_temperature_short_tx u_temperature_short_tx (
+        .clk(clk),
+        .rst_n(rst_n),
+        .start(temperature_short_start),
+        .force_ff(temperature_pending_force_ff),
+        .rd_req(temperature_rd_req),
+        .rd_addr(temperature_rd_addr),
+        .rd_valid(temperature_rd_valid),
+        .rd_data(temperature_rd_data),
+        .tx_valid(temperature_tx_valid),
+        .tx_ready(temperature_tx_ready),
+        .tx_data(temperature_tx_data),
+        .busy(temperature_busy),
+        .done(temperature_short_done)
     );
     );
 
 
     always @(posedge clk or negedge rst_n) begin
     always @(posedge clk or negedge rst_n) begin
         if (!rst_n) begin
         if (!rst_n) begin
-            frame_active <= 1'b0;
-        end else if (!frame_active) begin
-            if (frame_valid) frame_active <= 1'b1;
-        end else if (serializer_done) begin
-            frame_active <= 1'b0;
+            owner <= OWNER_IDLE;
+            temperature_pending <= 1'b0;
+            temperature_pending_force_ff <= 1'b0;
+        end else begin
+            if (temperature_short_start) begin
+                temperature_pending <= 1'b0;
+            end
+            if (temperature_start) begin
+                temperature_pending <= 1'b1;
+                temperature_pending_force_ff <= temperature_force_ff;
+            end
+
+            case (owner)
+                OWNER_IDLE: begin
+                    if (standard_start) begin
+                        owner <= OWNER_STANDARD;
+                    end else if (temperature_short_start) begin
+                        owner <= OWNER_TEMPERATURE;
+                    end
+                end
+
+                OWNER_STANDARD: begin
+                    if (serializer_done) begin
+                        owner <= OWNER_IDLE;
+                    end
+                end
+
+                OWNER_TEMPERATURE: begin
+                    if (temperature_short_done) begin
+                        owner <= OWNER_IDLE;
+                    end
+                end
+
+                default: owner <= OWNER_IDLE;
+            endcase
         end
         end
     end
     end
 
 
-    wire unused_serializer_busy = serializer_busy;
+    wire unused = serializer_busy ^ temperature_busy;
 endmodule
 endmodule

+ 126 - 0
src/rtl/prod2u_p4_temperature_read.v

@@ -0,0 +1,126 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_temperature_read (
+    input  wire        clk,
+    input  wire        rst_n,
+    input  wire        start,
+    output reg         busy,
+    output reg         done,
+    output reg         bus_error,
+    output wire        request_valid,
+    input  wire        request_ready,
+    output reg  [6:0]  device_addr,
+    output wire [7:0]  register,
+    input  wire        response_valid,
+    output wire        response_ready,
+    /* verilator lint_off UNUSEDSIGNAL */
+    input  wire [15:0] data,
+    /* verilator lint_on UNUSEDSIGNAL */
+    input  wire [3:0]  error,
+    output reg         wr_en,
+    output reg  [4:0]  wr_addr,
+    output reg  [7:0]  wr_data
+);
+    localparam [1:0] ST_IDLE = 2'd0;
+    localparam [1:0] ST_REQUEST = 2'd1;
+    localparam [1:0] ST_RESPONSE = 2'd2;
+    localparam [1:0] ST_COMPLETE = 2'd3;
+
+    reg [1:0] state;
+    reg [1:0] sensor_index;
+    reg [3:0] register_index;
+    reg [4:0] slot_index;
+
+    wire fatal_error = (error >= 4'd4);
+    wire [8:0] integer_temperature = data[15:7];
+    wire [7:0] converted_temperature =
+        ((error != 4'd0) || data[15] || (integer_temperature > 9'd150)) ?
+        8'hff : integer_temperature[7:0];
+
+    assign request_valid = (state == ST_REQUEST);
+    assign response_ready = (state == ST_RESPONSE);
+    assign register = {4'd0, register_index};
+
+    always @* begin
+        case (sensor_index)
+            2'd0: device_addr = 7'h49;
+            2'd1: device_addr = 7'h48;
+            default: device_addr = 7'h4b;
+        endcase
+    end
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            state <= ST_IDLE;
+            sensor_index <= 2'd0;
+            register_index <= 4'd0;
+            slot_index <= 5'd0;
+            busy <= 1'b0;
+            done <= 1'b0;
+            bus_error <= 1'b0;
+            wr_en <= 1'b0;
+            wr_addr <= 5'd0;
+            wr_data <= 8'd0;
+        end else begin
+            done <= 1'b0;
+            bus_error <= 1'b0;
+            wr_en <= 1'b0;
+
+            case (state)
+                ST_IDLE: begin
+                    if (start) begin
+                        sensor_index <= 2'd0;
+                        register_index <= 4'd0;
+                        slot_index <= 5'd0;
+                        busy <= 1'b1;
+                        state <= ST_REQUEST;
+                    end
+                end
+
+                ST_REQUEST: begin
+                    if (request_ready) begin
+                        state <= ST_RESPONSE;
+                    end
+                end
+
+                ST_RESPONSE: begin
+                    if (response_valid) begin
+                        if (fatal_error) begin
+                            busy <= 1'b0;
+                            done <= 1'b1;
+                            bus_error <= 1'b1;
+                            state <= ST_IDLE;
+                        end else begin
+                            wr_en <= 1'b1;
+                            wr_addr <= slot_index;
+                            wr_data <= converted_temperature;
+                            if (slot_index == 5'd26) begin
+                                state <= ST_COMPLETE;
+                            end else begin
+                                slot_index <= slot_index + 5'd1;
+                                if (register_index == 4'd8) begin
+                                    register_index <= 4'd0;
+                                    sensor_index <= sensor_index + 2'd1;
+                                end else begin
+                                    register_index <= register_index + 4'd1;
+                                end
+                                state <= ST_REQUEST;
+                            end
+                        end
+                    end
+                end
+
+                ST_COMPLETE: begin
+                    busy <= 1'b0;
+                    done <= 1'b1;
+                    state <= ST_IDLE;
+                end
+
+                default: begin
+                    busy <= 1'b0;
+                    state <= ST_IDLE;
+                end
+            endcase
+        end
+    end
+endmodule

+ 148 - 0
src/rtl/prod2u_p4_temperature_short_tx.v

@@ -0,0 +1,148 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_temperature_short_tx (
+    input  wire       clk,
+    input  wire       rst_n,
+    input  wire       start,
+    input  wire       force_ff,
+    output reg        rd_req,
+    output reg  [4:0] rd_addr,
+    input  wire       rd_valid,
+    input  wire [7:0] rd_data,
+    output reg        tx_valid,
+    input  wire       tx_ready,
+    output reg  [7:0] tx_data,
+    output reg        busy,
+    output reg        done
+);
+    localparam [1:0] ST_IDLE = 2'd0;
+    localparam [1:0] ST_SEND = 2'd1;
+    localparam [1:0] ST_WAIT_READ = 2'd2;
+
+    reg [1:0] state;
+    reg force_ff_latched;
+    reg [5:0] byte_index;
+    reg [15:0] crc;
+
+    wire [15:0] crc_after_byte = crc16_byte(crc, tx_data);
+
+    function [15:0] crc16_byte;
+        input [15:0] crc_in;
+        input [7:0] value_in;
+        reg [15:0] value;
+        integer bit_index;
+        begin
+            value = crc_in ^ {value_in, 8'h00};
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                if (value[15]) value = (value << 1) ^ 16'h1021;
+                else value = value << 1;
+            end
+            crc16_byte = value;
+        end
+    endfunction
+
+    function [7:0] header_byte;
+        input [5:0] index;
+        begin
+            case (index)
+                6'd0: header_byte = 8'ha5;
+                6'd1: header_byte = 8'h5a;
+                6'd2: header_byte = 8'h02;
+                6'd3: header_byte = 8'h04;
+                6'd4: header_byte = 8'h10;
+                default: header_byte = 8'h1b;
+            endcase
+        end
+    endfunction
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            state <= ST_IDLE;
+            force_ff_latched <= 1'b0;
+            byte_index <= 6'd0;
+            crc <= 16'hffff;
+            rd_req <= 1'b0;
+            rd_addr <= 5'd0;
+            tx_valid <= 1'b0;
+            tx_data <= 8'd0;
+            busy <= 1'b0;
+            done <= 1'b0;
+        end else begin
+            rd_req <= 1'b0;
+            done <= 1'b0;
+
+            case (state)
+                ST_IDLE: begin
+                    tx_valid <= 1'b0;
+                    if (start) begin
+                        force_ff_latched <= force_ff;
+                        byte_index <= 6'd0;
+                        crc <= 16'hffff;
+                        tx_data <= 8'ha5;
+                        tx_valid <= 1'b1;
+                        busy <= 1'b1;
+                        state <= ST_SEND;
+                    end
+                end
+
+                ST_SEND: begin
+                    if (tx_valid && tx_ready) begin
+                        if ((byte_index >= 6'd2) && (byte_index <= 6'd32)) begin
+                            crc <= crc_after_byte;
+                        end
+
+                        if (byte_index < 6'd5) begin
+                            byte_index <= byte_index + 6'd1;
+                            tx_data <= header_byte(byte_index + 6'd1);
+                        end else if (byte_index == 6'd5) begin
+                            byte_index <= 6'd6;
+                            if (force_ff_latched) begin
+                                tx_data <= 8'hff;
+                            end else begin
+                                tx_valid <= 1'b0;
+                                rd_addr <= 5'd0;
+                                rd_req <= 1'b1;
+                                state <= ST_WAIT_READ;
+                            end
+                        end else if (byte_index < 6'd32) begin
+                            byte_index <= byte_index + 6'd1;
+                            if (force_ff_latched) begin
+                                tx_data <= 8'hff;
+                            end else begin
+                                tx_valid <= 1'b0;
+                                rd_addr <= byte_index[4:0] - 5'd5;
+                                rd_req <= 1'b1;
+                                state <= ST_WAIT_READ;
+                            end
+                        end else if (byte_index == 6'd32) begin
+                            byte_index <= 6'd33;
+                            tx_data <= crc_after_byte[7:0];
+                        end else if (byte_index == 6'd33) begin
+                            byte_index <= 6'd34;
+                            tx_data <= crc[15:8];
+                        end else begin
+                            tx_valid <= 1'b0;
+                            busy <= 1'b0;
+                            done <= 1'b1;
+                            state <= ST_IDLE;
+                        end
+                    end
+                end
+
+                ST_WAIT_READ: begin
+                    if (rd_valid) begin
+                        tx_data <= rd_data;
+                        tx_valid <= 1'b1;
+                        state <= ST_SEND;
+                    end
+                end
+
+                default: begin
+                    tx_valid <= 1'b0;
+                    busy <= 1'b0;
+                    state <= ST_IDLE;
+                end
+            endcase
+        end
+    end
+endmodule

+ 30 - 0
src/rtl/prod2u_p4_temperature_store.v

@@ -0,0 +1,30 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_temperature_store (
+    input  wire       clk,
+    input  wire       rst_n,
+    input  wire       wr_en,
+    input  wire [4:0] wr_addr,
+    input  wire [7:0] wr_data,
+    input  wire       rd_req,
+    input  wire [4:0] rd_addr,
+    output reg        rd_valid,
+    output reg  [7:0] rd_data
+);
+    (* syn_ramstyle = "registers" *) reg [7:0] memory [0:26];
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            rd_valid <= 1'b0;
+            rd_data <= 8'd0;
+        end else begin
+            rd_valid <= rd_req;
+            if (wr_en && (wr_addr <= 5'd26)) begin
+                memory[wr_addr] <= wr_data;
+            end
+            if (rd_req) begin
+                rd_data <= (rd_addr <= 5'd26) ? memory[rd_addr] : 8'hff;
+            end
+        end
+    end
+endmodule

+ 117 - 2
src/top/prod2u_p4_normal_v3_top.v

@@ -24,12 +24,15 @@ module prod2u_p4_normal_v3_top #(
     output wire        z_dir,
     output wire        z_dir,
     /* verilator lint_off UNUSEDSIGNAL */
     /* verilator lint_off UNUSEDSIGNAL */
     input  wire        x_limit_raw,
     input  wire        x_limit_raw,
-    input  wire        y_limit_raw
+    input  wire        y_limit_raw,
     /* verilator lint_on UNUSEDSIGNAL */
     /* verilator lint_on UNUSEDSIGNAL */
+    inout  wire        temp_scl,
+    inout  wire        temp_sda
 );
 );
     localparam integer WATCHDOG_SECONDS = 5;
     localparam integer WATCHDOG_SECONDS = 5;
     localparam integer MOTOR_DIR_SETUP_CYCLES = 25000;
     localparam integer MOTOR_DIR_SETUP_CYCLES = 25000;
     localparam integer MOTOR_STEP_HALF_CYCLES = 12500;
     localparam integer MOTOR_STEP_HALF_CYCLES = 12500;
+    localparam [31:0] TEMP_POWERUP_CYCLES = CLK_HZ;
 
 
     wire sys_rst_n;
     wire sys_rst_n;
     wire uart_rx_valid;
     wire uart_rx_valid;
@@ -73,6 +76,38 @@ module prod2u_p4_normal_v3_top #(
     wire [7:0] tx_stream_data;
     wire [7:0] tx_stream_data;
     wire tx_phy_busy;
     wire tx_phy_busy;
 
 
+    reg [31:0] temperature_powerup_count;
+    wire temperature_powerup_ready =
+        (temperature_powerup_count >= TEMP_POWERUP_CYCLES);
+    wire temperature_read_start;
+    wire temperature_read_busy;
+    wire temperature_read_done;
+    wire temperature_bus_error;
+    wire temperature_tx_start;
+    wire temperature_tx_force_ff;
+    wire temperature_tx_done;
+
+    wire temperature_i2c_request_valid;
+    wire temperature_i2c_request_ready;
+    wire [6:0] temperature_i2c_device_addr;
+    wire [7:0] temperature_i2c_register;
+    wire temperature_i2c_response_valid;
+    wire temperature_i2c_response_ready;
+    wire [15:0] temperature_i2c_data;
+    wire [3:0] temperature_i2c_error;
+    wire temperature_i2c_busy;
+    wire temperature_i2c_abort_done;
+    wire temperature_scl_drive_low;
+    wire temperature_sda_drive_low;
+
+    wire temperature_store_wr_en;
+    wire [4:0] temperature_store_wr_addr;
+    wire [7:0] temperature_store_wr_data;
+    wire temperature_store_rd_req;
+    wire [4:0] temperature_store_rd_addr;
+    wire temperature_store_rd_valid;
+    wire [7:0] temperature_store_rd_data;
+
     generate
     generate
         if (!((SOLENOID_ACTIVE_HIGH == 0) || (SOLENOID_ACTIVE_HIGH == 1))) begin : g_solenoid_polarity_must_be_confirmed
         if (!((SOLENOID_ACTIVE_HIGH == 0) || (SOLENOID_ACTIVE_HIGH == 1))) begin : g_solenoid_polarity_must_be_confirmed
             prod2u_p4_solenoid_polarity_must_be_confirmed u_solenoid_polarity_error();
             prod2u_p4_solenoid_polarity_must_be_confirmed u_solenoid_polarity_error();
@@ -87,6 +122,16 @@ module prod2u_p4_normal_v3_top #(
     assign y_dir = motor_dirs[1];
     assign y_dir = motor_dirs[1];
     assign z_dir = motor_dirs[2];
     assign z_dir = motor_dirs[2];
     assign motor_en_n = 1'b0;
     assign motor_en_n = 1'b0;
+    assign temp_scl = temperature_scl_drive_low ? 1'b0 : 1'bz;
+    assign temp_sda = temperature_sda_drive_low ? 1'b0 : 1'bz;
+
+    always @(posedge sys_clk or negedge sys_rst_n) begin
+        if (!sys_rst_n) begin
+            temperature_powerup_count <= 32'd0;
+        end else if (!temperature_powerup_ready) begin
+            temperature_powerup_count <= temperature_powerup_count + 32'd1;
+        end
+    end
 
 
     prod2u_por #(
     prod2u_por #(
         .POR_CYCLES(POR_CYCLES)
         .POR_CYCLES(POR_CYCLES)
@@ -151,6 +196,13 @@ module prod2u_p4_normal_v3_top #(
         .fast_jog_axis(fast_jog_axis),
         .fast_jog_axis(fast_jog_axis),
         .fast_jog_dir(fast_jog_dir),
         .fast_jog_dir(fast_jog_dir),
         .fast_jog_steps(fast_jog_steps),
         .fast_jog_steps(fast_jog_steps),
+        .powerup_ready(temperature_powerup_ready),
+        .temperature_read_start(temperature_read_start),
+        .temperature_read_done(temperature_read_done),
+        .temperature_bus_error(temperature_bus_error),
+        .temperature_tx_start(temperature_tx_start),
+        .temperature_tx_force_ff(temperature_tx_force_ff),
+        .temperature_tx_done(temperature_tx_done),
         .frame_valid(frame_valid),
         .frame_valid(frame_valid),
         .frame_ready(frame_ready),
         .frame_ready(frame_ready),
         .frame_type(frame_type),
         .frame_type(frame_type),
@@ -167,6 +219,61 @@ module prod2u_p4_normal_v3_top #(
         .watchdog_timeout(watchdog_timeout)
         .watchdog_timeout(watchdog_timeout)
     );
     );
 
 
+    prod2u_p4_temperature_read u_temperature_read (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .start(temperature_read_start),
+        .busy(temperature_read_busy),
+        .done(temperature_read_done),
+        .bus_error(temperature_bus_error),
+        .request_valid(temperature_i2c_request_valid),
+        .request_ready(temperature_i2c_request_ready),
+        .device_addr(temperature_i2c_device_addr),
+        .register(temperature_i2c_register),
+        .response_valid(temperature_i2c_response_valid),
+        .response_ready(temperature_i2c_response_ready),
+        .data(temperature_i2c_data),
+        .error(temperature_i2c_error),
+        .wr_en(temperature_store_wr_en),
+        .wr_addr(temperature_store_wr_addr),
+        .wr_data(temperature_store_wr_data)
+    );
+
+    prod2u_p4_i2c_stop_start_read #(
+        .HALF_PERIOD_CLKS(125),
+        .TIMEOUT_CLKS(25000)
+    ) u_temperature_i2c (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .abort(1'b0),
+        .abort_done(temperature_i2c_abort_done),
+        .request_valid(temperature_i2c_request_valid),
+        .request_ready(temperature_i2c_request_ready),
+        .request_device_addr(temperature_i2c_device_addr),
+        .request_register(temperature_i2c_register),
+        .response_valid(temperature_i2c_response_valid),
+        .response_ready(temperature_i2c_response_ready),
+        .response_data(temperature_i2c_data),
+        .response_error(temperature_i2c_error),
+        .busy(temperature_i2c_busy),
+        .scl_i(temp_scl),
+        .sda_i(temp_sda),
+        .scl_drive_low(temperature_scl_drive_low),
+        .sda_drive_low(temperature_sda_drive_low)
+    );
+
+    prod2u_p4_temperature_store u_temperature_store (
+        .clk(sys_clk),
+        .rst_n(sys_rst_n),
+        .wr_en(temperature_store_wr_en),
+        .wr_addr(temperature_store_wr_addr),
+        .wr_data(temperature_store_wr_data),
+        .rd_req(temperature_store_rd_req),
+        .rd_addr(temperature_store_rd_addr),
+        .rd_valid(temperature_store_rd_valid),
+        .rd_data(temperature_store_rd_data)
+    );
+
     prod2u_p4_normal_v3_tx u_tx_frames (
     prod2u_p4_normal_v3_tx u_tx_frames (
         .clk(sys_clk),
         .clk(sys_clk),
         .rst_n(sys_rst_n),
         .rst_n(sys_rst_n),
@@ -175,6 +282,13 @@ module prod2u_p4_normal_v3_top #(
         .frame_type(frame_type),
         .frame_type(frame_type),
         .frame_payload_len(frame_payload_len),
         .frame_payload_len(frame_payload_len),
         .frame_payload(frame_payload),
         .frame_payload(frame_payload),
+        .temperature_start(temperature_tx_start),
+        .temperature_force_ff(temperature_tx_force_ff),
+        .temperature_rd_req(temperature_store_rd_req),
+        .temperature_rd_addr(temperature_store_rd_addr),
+        .temperature_rd_valid(temperature_store_rd_valid),
+        .temperature_rd_data(temperature_store_rd_data),
+        .temperature_done(temperature_tx_done),
         .tx_valid(tx_stream_valid),
         .tx_valid(tx_stream_valid),
         .tx_ready(tx_stream_ready),
         .tx_ready(tx_stream_ready),
         .tx_data(tx_stream_data)
         .tx_data(tx_stream_data)
@@ -209,5 +323,6 @@ module prod2u_p4_normal_v3_top #(
     wire unused_status = ^state_hash16 ^ disabled ^ watchdog_timeout ^
     wire unused_status = ^state_hash16 ^ disabled ^ watchdog_timeout ^
         ^parser_crc_error_count ^ ^parser_timeout_count ^ ^parser_format_error_count ^
         ^parser_crc_error_count ^ ^parser_timeout_count ^ ^parser_format_error_count ^
         uart_framing_error ^ uart_break_detected ^ uart_overflow ^ tx_phy_busy ^
         uart_framing_error ^ uart_break_detected ^ uart_overflow ^ tx_phy_busy ^
-        core_en_n_unused;
+        core_en_n_unused ^ temperature_read_busy ^ temperature_i2c_busy ^
+        temperature_i2c_abort_done;
 endmodule
 endmodule

+ 7 - 1
td/phy/prod2u_p4_normal_v3.tcl

@@ -19,6 +19,10 @@ proc p4_find_unique_regs {patterns} {
 set cdc_groups {
 set cdc_groups {
     u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}
     u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}
     u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}
     u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}
+    u_temperature_i2c/scl_sync[0] {{u_temperature_i2c/scl_sync[0]} {*/u_temperature_i2c/scl_sync[0]}}
+    u_temperature_i2c/scl_sync[1] {{u_temperature_i2c/scl_sync[1]} {*/u_temperature_i2c/scl_sync[1]}}
+    u_temperature_i2c/sda_sync[0] {{u_temperature_i2c/sda_sync[0]} {*/u_temperature_i2c/sda_sync[0]}}
+    u_temperature_i2c/sda_sync[1] {{u_temperature_i2c/sda_sync[1]} {*/u_temperature_i2c/sda_sync[1]}}
 }
 }
 set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
 set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
 puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
 puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
@@ -38,7 +42,7 @@ foreach {normalized patterns} $cdc_groups {
         puts $cdc_report "retained_sync_register=$normalized"
         puts $cdc_report "retained_sync_register=$normalized"
     }
     }
 }
 }
-if {[llength $cdc_regs] != 2} {
+if {[llength $cdc_regs] != 6} {
     set reason "retained_sync_register_total:[llength $cdc_regs]"
     set reason "retained_sync_register_total:[llength $cdc_regs]"
     lappend cdc_failures $reason
     lappend cdc_failures $reason
     puts $cdc_report "structural_failure=$reason"
     puts $cdc_report "structural_failure=$reason"
@@ -46,6 +50,8 @@ if {[llength $cdc_regs] != 2} {
 
 
 set cdc_input_pairs {
 set cdc_input_pairs {
     host_uart_rx u_uart_rx/rx_sync_pipe[0]
     host_uart_rx u_uart_rx/rx_sync_pipe[0]
+    temp_scl u_temperature_i2c/scl_sync[0]
+    temp_sda u_temperature_i2c/sda_sync[0]
 }
 }
 foreach {source_port normalized} $cdc_input_pairs {
 foreach {source_port normalized} $cdc_input_pairs {
     set source_matches [get_ports -quiet $source_port]
     set source_matches [get_ports -quiet $source_port]

+ 8 - 4
td/prod2u_p4_normal_v3.prj

@@ -22,10 +22,14 @@
             <File Path="../src/rtl/prod2u_p4_axis_executor.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="10"/></FileInfo></File>
             <File Path="../src/rtl/prod2u_p4_axis_executor.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="10"/></FileInfo></File>
             <File Path="../src/rtl/prod2u_p4_motor_hub.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="11"/></FileInfo></File>
             <File Path="../src/rtl/prod2u_p4_motor_hub.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="11"/></FileInfo></File>
             <File Path="../src/rtl/prod2u_p4_response_scheduler.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="12"/></FileInfo></File>
             <File Path="../src/rtl/prod2u_p4_response_scheduler.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="12"/></FileInfo></File>
-            <File Path="../src/rtl/prod2u_p4_normal_v3_tx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="13"/></FileInfo></File>
-            <File Path="../src/rtl/prod2u_p4_pwm_outputs.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="14"/></FileInfo></File>
-            <File Path="../src/rtl/prod2u_p4_normal_v3_core.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="15"/></FileInfo></File>
-            <File Path="../src/top/prod2u_p4_normal_v3_top.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="16"/></FileInfo></File>
+            <File Path="../src/rtl/prod2u_p4_i2c_stop_start_read.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="13"/></FileInfo></File>
+            <File Path="../src/rtl/prod2u_p4_temperature_read.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="14"/></FileInfo></File>
+            <File Path="../src/rtl/prod2u_p4_temperature_store.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="15"/></FileInfo></File>
+            <File Path="../src/rtl/prod2u_p4_temperature_short_tx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="16"/></FileInfo></File>
+            <File Path="../src/rtl/prod2u_p4_normal_v3_tx.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="17"/></FileInfo></File>
+            <File Path="../src/rtl/prod2u_p4_pwm_outputs.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="18"/></FileInfo></File>
+            <File Path="../src/rtl/prod2u_p4_normal_v3_core.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="19"/></FileInfo></File>
+            <File Path="../src/top/prod2u_p4_normal_v3_top.v"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="design_1"/><Attr Name="CompileOrder" Val="20"/></FileInfo></File>
         </Verilog>
         </Verilog>
         <ADC_FILE>
         <ADC_FILE>
             <File Path="../constraints/prod2u_p4_normal_v3.adc"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="constraint_1"/><Attr Name="CompileOrder" Val="1"/></FileInfo></File>
             <File Path="../constraints/prod2u_p4_normal_v3.adc"><FileInfo><Attr Name="UsedInSyn" Val="true"/><Attr Name="UsedInP&amp;R" Val="true"/><Attr Name="BelongTo" Val="constraint_1"/><Attr Name="CompileOrder" Val="1"/></FileInfo></File>

+ 11 - 1
td/syn/prod2u_p4_normal_v3.tcl

@@ -13,6 +13,10 @@ analyze -file {src/rtl/prod2u_p4_normal_v3_watchdog.v}
 analyze -file {src/rtl/prod2u_p4_axis_executor.v}
 analyze -file {src/rtl/prod2u_p4_axis_executor.v}
 analyze -file {src/rtl/prod2u_p4_motor_hub.v}
 analyze -file {src/rtl/prod2u_p4_motor_hub.v}
 analyze -file {src/rtl/prod2u_p4_response_scheduler.v}
 analyze -file {src/rtl/prod2u_p4_response_scheduler.v}
+analyze -file {src/rtl/prod2u_p4_i2c_stop_start_read.v}
+analyze -file {src/rtl/prod2u_p4_temperature_read.v}
+analyze -file {src/rtl/prod2u_p4_temperature_store.v}
+analyze -file {src/rtl/prod2u_p4_temperature_short_tx.v}
 analyze -file {src/rtl/prod2u_p4_normal_v3_tx.v}
 analyze -file {src/rtl/prod2u_p4_normal_v3_tx.v}
 analyze -file {src/rtl/prod2u_p4_pwm_outputs.v}
 analyze -file {src/rtl/prod2u_p4_pwm_outputs.v}
 analyze -file {src/rtl/prod2u_p4_normal_v3_core.v}
 analyze -file {src/rtl/prod2u_p4_normal_v3_core.v}
@@ -37,6 +41,10 @@ proc p4_find_unique_regs {patterns} {
 set cdc_groups {
 set cdc_groups {
     u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}
     u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}
     u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}
     u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}
+    u_temperature_i2c/scl_sync[0] {{u_temperature_i2c/scl_sync[0]} {*/u_temperature_i2c/scl_sync[0]}}
+    u_temperature_i2c/scl_sync[1] {{u_temperature_i2c/scl_sync[1]} {*/u_temperature_i2c/scl_sync[1]}}
+    u_temperature_i2c/sda_sync[0] {{u_temperature_i2c/sda_sync[0]} {*/u_temperature_i2c/sda_sync[0]}}
+    u_temperature_i2c/sda_sync[1] {{u_temperature_i2c/sda_sync[1]} {*/u_temperature_i2c/sda_sync[1]}}
 }
 }
 set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
 set cdc_report [open {prod2u_p4_normal_v3_cdc.rpt} w]
 puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
 puts $cdc_report {schema=prod2u-p4-normal-v3-cdc-v2}
@@ -56,7 +64,7 @@ foreach {normalized patterns} $cdc_groups {
         puts $cdc_report "retained_sync_register=$normalized"
         puts $cdc_report "retained_sync_register=$normalized"
     }
     }
 }
 }
-if {[llength $cdc_regs] != 2} {
+if {[llength $cdc_regs] != 6} {
     set reason "retained_sync_register_total:[llength $cdc_regs]"
     set reason "retained_sync_register_total:[llength $cdc_regs]"
     lappend cdc_failures $reason
     lappend cdc_failures $reason
     puts $cdc_report "structural_failure=$reason"
     puts $cdc_report "structural_failure=$reason"
@@ -66,6 +74,8 @@ if {[llength $cdc_regs] > 0} {
 }
 }
 set cdc_input_pairs {
 set cdc_input_pairs {
     host_uart_rx u_uart_rx/rx_sync_pipe[0]
     host_uart_rx u_uart_rx/rx_sync_pipe[0]
+    temp_scl u_temperature_i2c/scl_sync[0]
+    temp_sda u_temperature_i2c/sda_sync[0]
 }
 }
 foreach {source_port normalized} $cdc_input_pairs {
 foreach {source_port normalized} $cdc_input_pairs {
     set source_matches [get_ports -quiet $source_port]
     set source_matches [get_ports -quiet $source_port]

+ 215 - 0
tests/sim/prod2u_p4_i2c_stop_start_read_tb.v

@@ -0,0 +1,215 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_i2c_stop_start_read_tb;
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg request_valid = 1'b0;
+    wire request_ready;
+    reg [6:0] request_device_addr = 7'h49;
+    reg [7:0] request_register = 8'h00;
+    wire response_valid;
+    reg response_ready = 1'b0;
+    wire [15:0] response_data;
+    wire [3:0] response_error;
+    wire busy;
+    wire scl_drive_low;
+    wire sda_drive_low;
+
+    reg slave_scl_drive_low = 1'b0;
+    reg slave_sda_drive_low = 1'b0;
+    wire delayed_scl_drive_low;
+    wire delayed_sda_drive_low;
+    wire scl_bus;
+    wire sda_bus;
+
+    integer start_edges = 0;
+    integer stop_edges = 0;
+    integer guard;
+    reg [7:0] captured;
+    reg master_acknowledged;
+
+    // Deliberately model unequal PCB/IO delay. SDA must not change until SCL
+    // has already reached low, otherwise false START/STOP edges are counted.
+    assign #2 delayed_scl_drive_low = scl_drive_low;
+    assign #1 delayed_sda_drive_low = sda_drive_low;
+    assign scl_bus = ~(delayed_scl_drive_low | slave_scl_drive_low);
+    assign sda_bus = ~(delayed_sda_drive_low | slave_sda_drive_low);
+
+    prod2u_p4_i2c_stop_start_read #(
+        .HALF_PERIOD_CLKS(4),
+        .TIMEOUT_CLKS(2000)
+    ) dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .abort(1'b0),
+        .abort_done(),
+        .request_valid(request_valid),
+        .request_ready(request_ready),
+        .request_device_addr(request_device_addr),
+        .request_register(request_register),
+        .response_valid(response_valid),
+        .response_ready(response_ready),
+        .response_data(response_data),
+        .response_error(response_error),
+        .busy(busy),
+        .scl_i(scl_bus),
+        .sda_i(sda_bus),
+        .scl_drive_low(scl_drive_low),
+        .sda_drive_low(sda_drive_low)
+    );
+
+    always #5 clk = ~clk;
+
+    always @(negedge sda_bus) begin
+        if (rst_n && scl_bus) start_edges = start_edges + 1;
+    end
+
+    always @(posedge sda_bus) begin
+        if (rst_n && scl_bus) stop_edges = stop_edges + 1;
+    end
+
+    task capture_master_byte;
+        output [7:0] value;
+        integer bit_index;
+        begin
+            for (bit_index = 7; bit_index >= 0; bit_index = bit_index - 1) begin
+                @(posedge scl_bus);
+                value[bit_index] = sda_bus;
+                @(negedge scl_bus);
+            end
+        end
+    endtask
+
+    task drive_slave_ack;
+        begin
+            slave_sda_drive_low = 1'b1;
+            @(posedge scl_bus);
+            @(negedge scl_bus);
+            slave_sda_drive_low = 1'b0;
+        end
+    endtask
+
+    task drive_slave_byte;
+        input [7:0] value;
+        output acknowledged;
+        integer bit_index;
+        begin
+            for (bit_index = 7; bit_index >= 0; bit_index = bit_index - 1) begin
+                slave_sda_drive_low = ~value[bit_index];
+                @(posedge scl_bus);
+                @(negedge scl_bus);
+            end
+            slave_sda_drive_low = 1'b0;
+            @(posedge scl_bus);
+            acknowledged = ~sda_bus;
+            @(negedge scl_bus);
+        end
+    endtask
+
+    task wait_start;
+        begin : wait_for_true_start
+            forever begin
+                @(negedge sda_bus);
+                if (scl_bus) disable wait_for_true_start;
+            end
+        end
+    endtask
+
+    task wait_stop;
+        begin : wait_for_true_stop
+            forever begin
+                @(posedge sda_bus);
+                if (scl_bus) disable wait_for_true_stop;
+            end
+        end
+    endtask
+
+    initial begin
+        repeat (5) @(negedge clk);
+        rst_n = 1'b1;
+        repeat (3) @(negedge clk);
+
+        fork
+            begin : slave_model
+                wait_start();
+                capture_master_byte(captured);
+                if (captured !== 8'h92) begin
+                    $display("WRITE_ADDRESS_MISMATCH got=%02x", captured);
+                    $fatal;
+                end
+                drive_slave_ack();
+
+                capture_master_byte(captured);
+                if (captured !== 8'h00) begin
+                    $display("REGISTER_MISMATCH got=%02x", captured);
+                    $fatal;
+                end
+                drive_slave_ack();
+                wait_stop();
+
+                wait_start();
+                capture_master_byte(captured);
+                if (captured !== 8'h93) begin
+                    $display("READ_ADDRESS_MISMATCH got=%02x", captured);
+                    $fatal;
+                end
+                drive_slave_ack();
+
+                drive_slave_byte(8'h0c, master_acknowledged);
+                if (!master_acknowledged) begin
+                    $display("HIGH_BYTE_NOT_ACKED");
+                    $fatal;
+                end
+                drive_slave_byte(8'h80, master_acknowledged);
+                if (master_acknowledged) begin
+                    $display("LOW_BYTE_NOT_NACKED");
+                    $fatal;
+                end
+                wait_stop();
+            end
+
+            begin : master_request
+                while (!request_ready) @(negedge clk);
+                request_valid = 1'b1;
+                @(posedge clk);
+                #1 request_valid = 1'b0;
+
+                guard = 0;
+                while (!response_valid && guard < 2500) begin
+                    @(negedge clk);
+                    guard = guard + 1;
+                end
+                if (!response_valid || response_error !== 4'd0 ||
+                    response_data !== 16'h0c80) begin
+                    $display(
+                        "RESPONSE_MISMATCH valid=%0d error=%0d data=%04x",
+                        response_valid,
+                        response_error,
+                        response_data
+                    );
+                    $fatal;
+                end
+                response_ready = 1'b1;
+                @(posedge clk);
+                #1 response_ready = 1'b0;
+            end
+        join
+
+        repeat (3) @(negedge clk);
+        if (start_edges !== 2 || stop_edges !== 2) begin
+            $display(
+                "FALSE_START_STOP_EDGES starts=%0d stops=%0d expected=2/2",
+                start_edges,
+                stop_edges
+            );
+            $fatal;
+        end
+        if (busy || response_valid || scl_drive_low || sda_drive_low) begin
+            $display("BUS_NOT_RELEASED_AT_END");
+            $fatal;
+        end
+
+        $display("PASS: prod2u_p4_i2c_stop_start_read_tb");
+        $finish;
+    end
+endmodule

+ 279 - 0
tests/sim/prod2u_p4_temperature_read_tb.v

@@ -0,0 +1,279 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_temperature_read_tb;
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg start = 1'b0;
+    wire busy;
+    wire done;
+    wire bus_error;
+    wire request_valid;
+    reg request_ready = 1'b0;
+    wire [6:0] device_addr;
+    wire [7:0] register;
+    reg response_valid = 1'b0;
+    wire response_ready;
+    reg [15:0] data = 16'd0;
+    reg [3:0] error = 4'd0;
+    wire wr_en;
+    wire [4:0] wr_addr;
+    wire [7:0] wr_data;
+
+    reg [7:0] stored [0:26];
+    reg [26:0] wrote_mask;
+    integer write_count;
+    integer slot;
+    integer wait_cycles;
+    reg [15:0] raw_value;
+    reg [3:0] response_error_value;
+    reg [7:0] expected_value;
+
+    prod2u_p4_temperature_read dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .start(start),
+        .busy(busy),
+        .done(done),
+        .bus_error(bus_error),
+        .request_valid(request_valid),
+        .request_ready(request_ready),
+        .device_addr(device_addr),
+        .register(register),
+        .response_valid(response_valid),
+        .response_ready(response_ready),
+        .data(data),
+        .error(error),
+        .wr_en(wr_en),
+        .wr_addr(wr_addr),
+        .wr_data(wr_data)
+    );
+
+    always #5 clk = ~clk;
+
+    always @(posedge clk) begin
+        if (!rst_n) begin
+            wrote_mask <= 27'd0;
+            write_count <= 0;
+        end else if (wr_en) begin
+            if (wr_addr > 5'd26) begin
+                $display("WRITE_ADDRESS_OUT_OF_RANGE addr=%0d", wr_addr);
+                $fatal;
+            end
+            if (wrote_mask[wr_addr]) begin
+                $display("DUPLICATE_WRITE addr=%0d", wr_addr);
+                $fatal;
+            end
+            stored[wr_addr] <= wr_data;
+            wrote_mask[wr_addr] <= 1'b1;
+            write_count <= write_count + 1;
+        end
+    end
+
+    function [6:0] expected_device;
+        input integer index;
+        begin
+            if (index < 9) expected_device = 7'h49;
+            else if (index < 18) expected_device = 7'h48;
+            else expected_device = 7'h4b;
+        end
+    endfunction
+
+    function [7:0] expected_register;
+        input integer index;
+        begin
+            expected_register = index % 9;
+        end
+    endfunction
+
+    task pulse_start;
+        begin
+            @(negedge clk);
+            start = 1'b1;
+            @(posedge clk);
+            #1;
+            start = 1'b0;
+        end
+    endtask
+
+    task accept_request;
+        input integer index;
+        begin
+            wait_cycles = 0;
+            while (request_valid !== 1'b1 && wait_cycles < 20) begin
+                @(posedge clk);
+                #1;
+                wait_cycles = wait_cycles + 1;
+            end
+            if (!request_valid) begin
+                $display("REQUEST_TIMEOUT slot=%0d", index);
+                $fatal;
+            end
+            if (device_addr !== expected_device(index) ||
+                register !== expected_register(index)) begin
+                $display(
+                    "REQUEST_ORDER_MISMATCH slot=%0d addr=%02x/%02x reg=%02x/%02x",
+                    index,
+                    device_addr,
+                    expected_device(index),
+                    register,
+                    expected_register(index)
+                );
+                $fatal;
+            end
+
+            if (index == 0) begin
+                repeat (3) begin
+                    @(posedge clk);
+                    #1;
+                    if (!request_valid || device_addr !== 7'h49 || register !== 8'h00) begin
+                        $display("REQUEST_CHANGED_BEFORE_READY");
+                        $fatal;
+                    end
+                end
+            end
+
+            @(negedge clk);
+            request_ready = 1'b1;
+            @(posedge clk);
+            #1;
+            request_ready = 1'b0;
+        end
+    endtask
+
+    task return_response;
+        input [15:0] response_data_value;
+        input [3:0] response_error_code;
+        begin
+            wait_cycles = 0;
+            while (response_ready !== 1'b1 && wait_cycles < 20) begin
+                @(posedge clk);
+                #1;
+                wait_cycles = wait_cycles + 1;
+            end
+            if (!response_ready) begin
+                $display("RESPONSE_READY_TIMEOUT");
+                $fatal;
+            end
+            @(negedge clk);
+            data = response_data_value;
+            error = response_error_code;
+            response_valid = 1'b1;
+            @(posedge clk);
+            #1;
+            response_valid = 1'b0;
+            error = 4'd0;
+        end
+    endtask
+
+    task wait_for_done;
+        input expected_bus_error;
+        begin
+            wait_cycles = 0;
+            while (done !== 1'b1 && wait_cycles < 30) begin
+                @(posedge clk);
+                #1;
+                wait_cycles = wait_cycles + 1;
+            end
+            if (!done || bus_error !== expected_bus_error) begin
+                $display(
+                    "DONE_MISMATCH done=%0d bus_error=%0d expected=%0d",
+                    done,
+                    bus_error,
+                    expected_bus_error
+                );
+                $fatal;
+            end
+            if (busy) begin
+                $display("BUSY_STILL_HIGH_AT_DONE");
+                $fatal;
+            end
+        end
+    endtask
+
+    initial begin
+        repeat (4) @(negedge clk);
+        rst_n = 1'b1;
+        pulse_start();
+        if (!busy) begin
+            $display("BUSY_NOT_ASSERTED_AFTER_START");
+            $fatal;
+        end
+
+        for (slot = 0; slot < 27; slot = slot + 1) begin
+            accept_request(slot);
+            response_error_value = 4'd0;
+            if (slot == 0) begin
+                raw_value = 16'h0000;
+                expected_value = 8'd0;
+            end else if (slot == 1) begin
+                raw_value = 16'd150 << 7;
+                expected_value = 8'd150;
+            end else if (slot == 2) begin
+                raw_value = 16'd151 << 7;
+                expected_value = 8'hff;
+            end else if (slot == 3) begin
+                raw_value = 16'hff80;
+                expected_value = 8'hff;
+            end else if (slot == 4) begin
+                raw_value = 16'h0000;
+                response_error_value = 4'd1;
+                expected_value = 8'hff;
+            end else if (slot == 5) begin
+                raw_value = 16'h0000;
+                response_error_value = 4'd2;
+                expected_value = 8'hff;
+            end else if (slot == 6) begin
+                raw_value = 16'h0000;
+                response_error_value = 4'd3;
+                expected_value = 8'hff;
+            end else begin
+                raw_value = slot[15:0] << 7;
+                expected_value = slot[7:0];
+            end
+            return_response(raw_value, response_error_value);
+
+            wait_cycles = 0;
+            while (!wrote_mask[slot] && wait_cycles < 5) begin
+                @(posedge clk);
+                #1;
+                wait_cycles = wait_cycles + 1;
+            end
+            if (!wrote_mask[slot] || stored[slot] !== expected_value) begin
+                $display(
+                    "STORE_VALUE_MISMATCH slot=%0d wrote=%0d data=%02x expected=%02x",
+                    slot,
+                    wrote_mask[slot],
+                    stored[slot],
+                    expected_value
+                );
+                $fatal;
+            end
+        end
+        wait_for_done(1'b0);
+        if (write_count !== 27 || wrote_mask !== {27{1'b1}}) begin
+            $display("WRITE_COUNT_MISMATCH count=%0d mask=%07x", write_count, wrote_mask);
+            $fatal;
+        end
+
+        @(negedge clk);
+        rst_n = 1'b0;
+        repeat (2) @(negedge clk);
+        rst_n = 1'b1;
+        pulse_start();
+        accept_request(0);
+        return_response(16'h1900, 4'd4);
+        wait_for_done(1'b1);
+        if (write_count !== 0 || request_valid || response_ready) begin
+            $display(
+                "FATAL_ERROR_DID_NOT_STOP count=%0d req=%0d response_ready=%0d",
+                write_count,
+                request_valid,
+                response_ready
+            );
+            $fatal;
+        end
+
+        $display("PASS: prod2u_p4_temperature_read_tb");
+        $finish;
+    end
+endmodule

+ 230 - 0
tests/sim/prod2u_p4_temperature_short_tx_tb.v

@@ -0,0 +1,230 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_temperature_short_tx_tb;
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg start = 1'b0;
+    reg force_ff = 1'b0;
+    wire rd_req;
+    wire [4:0] rd_addr;
+    reg rd_valid = 1'b0;
+    reg [7:0] rd_data = 8'd0;
+    wire tx_valid;
+    reg tx_ready = 1'b1;
+    wire [7:0] tx_data;
+    wire busy;
+    wire done;
+
+    reg [7:0] memory [0:26];
+    reg [7:0] captured [0:34];
+    reg [15:0] expected_crc;
+    reg [7:0] stalled_data;
+    integer capture_count;
+    integer read_count;
+    integer index;
+    integer wait_cycles;
+
+    prod2u_p4_temperature_short_tx dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .start(start),
+        .force_ff(force_ff),
+        .rd_req(rd_req),
+        .rd_addr(rd_addr),
+        .rd_valid(rd_valid),
+        .rd_data(rd_data),
+        .tx_valid(tx_valid),
+        .tx_ready(tx_ready),
+        .tx_data(tx_data),
+        .busy(busy),
+        .done(done)
+    );
+
+    always #5 clk = ~clk;
+
+    always @(posedge clk) begin
+        if (!rst_n) begin
+            rd_valid <= 1'b0;
+            rd_data <= 8'd0;
+            read_count <= 0;
+        end else begin
+            rd_valid <= rd_req;
+            if (rd_req) begin
+                if (rd_addr > 5'd26 || rd_addr !== read_count[4:0]) begin
+                    $display(
+                        "STORE_READ_ORDER_MISMATCH count=%0d addr=%0d",
+                        read_count,
+                        rd_addr
+                    );
+                    $fatal;
+                end
+                rd_data <= memory[rd_addr];
+                read_count <= read_count + 1;
+            end
+        end
+    end
+
+    function [15:0] crc16_byte;
+        input [15:0] crc_in;
+        input [7:0] value_in;
+        reg [15:0] value;
+        integer bit_index;
+        begin
+            value = crc_in ^ {value_in, 8'h00};
+            for (bit_index = 0; bit_index < 8; bit_index = bit_index + 1) begin
+                if (value[15]) value = (value << 1) ^ 16'h1021;
+                else value = value << 1;
+            end
+            crc16_byte = value;
+        end
+    endfunction
+
+    task pulse_start;
+        input next_force_ff;
+        begin
+            @(negedge clk);
+            force_ff = next_force_ff;
+            start = 1'b1;
+            @(posedge clk);
+            #1;
+            start = 1'b0;
+        end
+    endtask
+
+    task capture_frame;
+        input expected_force_ff;
+        begin
+            capture_count = 0;
+            wait_cycles = 0;
+            while (tx_valid !== 1'b1 && wait_cycles < 100) begin
+                @(posedge clk);
+                #1;
+                wait_cycles = wait_cycles + 1;
+            end
+            if (!tx_valid) begin
+                $display("TX_VALID_TIMEOUT force_ff=%0d", expected_force_ff);
+                $fatal;
+            end
+
+            @(negedge clk);
+            tx_ready = 1'b0;
+            stalled_data = tx_data;
+            repeat (4) begin
+                @(posedge clk);
+                #1;
+                if (!tx_valid || tx_data !== stalled_data) begin
+                    $display(
+                        "TX_CHANGED_UNDER_BACKPRESSURE valid=%0d data=%02x expected=%02x",
+                        tx_valid,
+                        tx_data,
+                        stalled_data
+                    );
+                    $fatal;
+                end
+            end
+            @(negedge clk);
+            tx_ready = 1'b1;
+
+            wait_cycles = 0;
+            while (capture_count < 35 && wait_cycles < 500) begin
+                @(posedge clk);
+                if (tx_valid && tx_ready) begin
+                    captured[capture_count] = tx_data;
+                    capture_count = capture_count + 1;
+                end
+                #1;
+                wait_cycles = wait_cycles + 1;
+            end
+            if (capture_count !== 35) begin
+                $display("TX_FRAME_TIMEOUT captured=%0d", capture_count);
+                $fatal;
+            end
+            if (captured[0] !== 8'ha5 || captured[1] !== 8'h5a ||
+                captured[2] !== 8'h02 || captured[3] !== 8'h04 ||
+                captured[4] !== 8'h10 || captured[5] !== 8'h1b) begin
+                $display("SHORT_HEADER_MISMATCH");
+                $fatal;
+            end
+            for (index = 0; index < 27; index = index + 1) begin
+                if (captured[6 + index] !==
+                    (expected_force_ff ? 8'hff : index[7:0])) begin
+                    $display(
+                        "SHORT_PAYLOAD_MISMATCH index=%0d data=%02x expected=%02x",
+                        index,
+                        captured[6 + index],
+                        (expected_force_ff ? 8'hff : index[7:0])
+                    );
+                    $fatal;
+                end
+            end
+
+            expected_crc = 16'hffff;
+            for (index = 2; index < 33; index = index + 1) begin
+                expected_crc = crc16_byte(expected_crc, captured[index]);
+            end
+            if (captured[33] !== expected_crc[7:0] ||
+                captured[34] !== expected_crc[15:8]) begin
+                $display(
+                    "SHORT_CRC_MISMATCH got=%02x%02x expected_lo_hi=%02x%02x",
+                    captured[33],
+                    captured[34],
+                    expected_crc[7:0],
+                    expected_crc[15:8]
+                );
+                $fatal;
+            end
+
+            wait_cycles = 0;
+            while (done !== 1'b1 && wait_cycles < 5) begin
+                @(posedge clk);
+                #1;
+                wait_cycles = wait_cycles + 1;
+            end
+            if (!done || busy) begin
+                $display("TX_DONE_MISMATCH done=%0d busy=%0d", done, busy);
+                $fatal;
+            end
+        end
+    endtask
+
+    initial begin
+        for (index = 0; index < 27; index = index + 1) begin
+            memory[index] = index[7:0];
+        end
+
+        repeat (4) @(negedge clk);
+        rst_n = 1'b1;
+        pulse_start(1'b0);
+        if (!busy) begin
+            $display("TX_BUSY_NOT_ASSERTED_AFTER_START");
+            $fatal;
+        end
+        capture_frame(1'b0);
+        if (read_count !== 27) begin
+            $display("STORE_READ_COUNT_MISMATCH count=%0d", read_count);
+            $fatal;
+        end
+        if ({captured[34], captured[33]} !== 16'hc91f) begin
+            $display("GOLDEN_CRC_MISMATCH crc=%02x%02x", captured[33], captured[34]);
+            $fatal;
+        end
+
+        @(negedge clk);
+        rst_n = 1'b0;
+        repeat (2) @(negedge clk);
+        rst_n = 1'b1;
+        pulse_start(1'b1);
+        capture_frame(1'b1);
+        if (read_count !== 0) begin
+            $display("FORCE_FF_READ_STORE count=%0d", read_count);
+            $fatal;
+        end
+        if ({captured[34], captured[33]} !== 16'hc41b) begin
+            $display("ALL_FF_CRC_MISMATCH crc=%02x%02x", captured[33], captured[34]);
+            $fatal;
+        end
+
+        $display("PASS: prod2u_p4_temperature_short_tx_tb");
+        $finish;
+    end
+endmodule

+ 86 - 0
tests/sim/prod2u_p4_temperature_store_tb.v

@@ -0,0 +1,86 @@
+`timescale 1ns/1ps
+
+module prod2u_p4_temperature_store_tb;
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+    reg wr_en = 1'b0;
+    reg [4:0] wr_addr = 5'd0;
+    reg [7:0] wr_data = 8'd0;
+    reg rd_req = 1'b0;
+    reg [4:0] rd_addr = 5'd0;
+    wire rd_valid;
+    wire [7:0] rd_data;
+    integer index;
+
+    prod2u_p4_temperature_store dut (
+        .clk(clk),
+        .rst_n(rst_n),
+        .wr_en(wr_en),
+        .wr_addr(wr_addr),
+        .wr_data(wr_data),
+        .rd_req(rd_req),
+        .rd_addr(rd_addr),
+        .rd_valid(rd_valid),
+        .rd_data(rd_data)
+    );
+
+    always #5 clk = ~clk;
+
+    task write_byte;
+        input [4:0] address;
+        input [7:0] value;
+        begin
+            @(negedge clk);
+            wr_addr = address;
+            wr_data = value;
+            wr_en = 1'b1;
+            @(posedge clk);
+            #1;
+            wr_en = 1'b0;
+        end
+    endtask
+
+    task read_and_check;
+        input [4:0] address;
+        input [7:0] expected;
+        begin
+            @(negedge clk);
+            rd_addr = address;
+            rd_req = 1'b1;
+            @(posedge clk);
+            #1;
+            rd_req = 1'b0;
+            if (!rd_valid || rd_data !== expected) begin
+                $display(
+                    "STORE_READ_MISMATCH addr=%0d valid=%0d data=%02x expected=%02x",
+                    address,
+                    rd_valid,
+                    rd_data,
+                    expected
+                );
+                $fatal;
+            end
+            @(posedge clk);
+            #1;
+            if (rd_valid) begin
+                $display("STORE_RD_VALID_NOT_ONE_CYCLE addr=%0d", address);
+                $fatal;
+            end
+        end
+    endtask
+
+    initial begin
+        repeat (4) @(negedge clk);
+        rst_n = 1'b1;
+
+        for (index = 0; index < 27; index = index + 1) begin
+            write_byte(index[4:0], 8'h80 + index[7:0]);
+        end
+        for (index = 0; index < 27; index = index + 1) begin
+            read_and_check(index[4:0], 8'h80 + index[7:0]);
+        end
+
+        $display("PASS: prod2u_p4_temperature_store_tb");
+        $finish;
+    end
+endmodule

+ 4 - 0
tests/test_project_structure.py

@@ -42,6 +42,10 @@ class ProjectStructureTests(unittest.TestCase):
             "src/rtl/prod2u_p4_normal_v3_watchdog.v",
             "src/rtl/prod2u_p4_normal_v3_watchdog.v",
             "src/rtl/prod2u_p4_axis_executor.v",
             "src/rtl/prod2u_p4_axis_executor.v",
             "src/rtl/prod2u_p4_motor_hub.v",
             "src/rtl/prod2u_p4_motor_hub.v",
+            "src/rtl/prod2u_p4_i2c_stop_start_read.v",
+            "src/rtl/prod2u_p4_temperature_read.v",
+            "src/rtl/prod2u_p4_temperature_store.v",
+            "src/rtl/prod2u_p4_temperature_short_tx.v",
             "src/rtl/prod2u_p4_pwm_outputs.v",
             "src/rtl/prod2u_p4_pwm_outputs.v",
             "src/rtl/prod2u_p4_normal_v3_core.v",
             "src/rtl/prod2u_p4_normal_v3_core.v",
             "src/top/prod2u_p4_normal_v3_top.v",
             "src/top/prod2u_p4_normal_v3_top.v",

+ 29 - 15
tests/unit/test_prod2u_p4_harness.py

@@ -37,6 +37,10 @@ EXPECTED_SOURCES = (
     "src/rtl/prod2u_p4_axis_executor.v",
     "src/rtl/prod2u_p4_axis_executor.v",
     "src/rtl/prod2u_p4_motor_hub.v",
     "src/rtl/prod2u_p4_motor_hub.v",
     "src/rtl/prod2u_p4_response_scheduler.v",
     "src/rtl/prod2u_p4_response_scheduler.v",
+    "src/rtl/prod2u_p4_i2c_stop_start_read.v",
+    "src/rtl/prod2u_p4_temperature_read.v",
+    "src/rtl/prod2u_p4_temperature_store.v",
+    "src/rtl/prod2u_p4_temperature_short_tx.v",
     "src/rtl/prod2u_p4_normal_v3_tx.v",
     "src/rtl/prod2u_p4_normal_v3_tx.v",
     "src/rtl/prod2u_p4_pwm_outputs.v",
     "src/rtl/prod2u_p4_pwm_outputs.v",
     "src/rtl/prod2u_p4_normal_v3_core.v",
     "src/rtl/prod2u_p4_normal_v3_core.v",
@@ -53,13 +57,23 @@ REQUIRED_MOTOR_LIMIT_PINS = {
     "y_limit_raw": {"location": "A11", "direction": "INPUT", "pull_type": "PULLUP"},
     "y_limit_raw": {"location": "A11", "direction": "INPUT", "pull_type": "PULLUP"},
 }
 }
 
 
-UART_ONLY_CDC_REGISTERS = frozenset(
+EXPECTED_CDC_REGISTERS = frozenset(
     {
     {
         "u_uart_rx/rx_sync_pipe[0]",
         "u_uart_rx/rx_sync_pipe[0]",
         "u_uart_rx/rx_sync_pipe[1]",
         "u_uart_rx/rx_sync_pipe[1]",
+        "u_temperature_i2c/scl_sync[0]",
+        "u_temperature_i2c/scl_sync[1]",
+        "u_temperature_i2c/sda_sync[0]",
+        "u_temperature_i2c/sda_sync[1]",
+    }
+)
+EXPECTED_CDC_ENDPOINTS = frozenset(
+    {
+        "u_uart_rx/rx_sync_pipe[0]",
+        "u_temperature_i2c/scl_sync[0]",
+        "u_temperature_i2c/sda_sync[0]",
     }
     }
 )
 )
-UART_ONLY_CDC_ENDPOINTS = frozenset({"u_uart_rx/rx_sync_pipe[0]"})
 VERIFICATION_RUN_ID = "d" * 32
 VERIFICATION_RUN_ID = "d" * 32
 
 
 
 
@@ -137,10 +151,10 @@ def valid_td_receipt(bitstream: Path, *, commit: str = "a" * 8) -> dict[str, obj
             "status": "pass",
             "status": "pass",
             "cdc": {
             "cdc": {
                 "status": "pass",
                 "status": "pass",
-                "async_reg": {"used": 2},
+                "async_reg": {"used": 6},
                 "input_registers": {"used": 0},
                 "input_registers": {"used": 0},
-                "retained_sync_registers": {"used": 2},
-                "first_stage_endpoints": {"used": 1},
+                "retained_sync_registers": {"used": 6},
+                "first_stage_endpoints": {"used": 3},
             },
             },
             "fsm_encoding": {
             "fsm_encoding": {
                 "status": "pass",
                 "status": "pass",
@@ -419,23 +433,23 @@ class Prod2UP4HarnessTests(unittest.TestCase):
         )
         )
         self.assertIn("source_only_false_paths_used:host_uart_rx", gate["failures"])
         self.assertIn("source_only_false_paths_used:host_uart_rx", gate["failures"])
 
 
-    def test_cdc_gate_accepts_uart_only_synchronizers(self) -> None:
-        uart_only_report = {
-            "retained_sync_registers": sorted(UART_ONLY_CDC_REGISTERS),
-            "false_path_endpoints": sorted(UART_ONLY_CDC_ENDPOINTS),
+    def test_cdc_gate_accepts_uart_and_temperature_synchronizers(self) -> None:
+        expected_report = {
+            "retained_sync_registers": sorted(EXPECTED_CDC_REGISTERS),
+            "false_path_endpoints": sorted(EXPECTED_CDC_ENDPOINTS),
             "source_only_false_paths": [],
             "source_only_false_paths": [],
             "structural_failures": [],
             "structural_failures": [],
         }
         }
         accepted = harness.structural_cdc_gate(
         accepted = harness.structural_cdc_gate(
-            uart_only_report,
-            async_reg_count=2,
+            expected_report,
+            async_reg_count=6,
             input_register_count=0,
             input_register_count=0,
         )
         )
         self.assertEqual(accepted["status"], "pass", accepted["failures"])
         self.assertEqual(accepted["status"], "pass", accepted["failures"])
 
 
     def test_cdc_gate_rejects_legacy_limit_synchronizers(self) -> None:
     def test_cdc_gate_rejects_legacy_limit_synchronizers(self) -> None:
         legacy_registers = sorted(
         legacy_registers = sorted(
-            UART_ONLY_CDC_REGISTERS
+            EXPECTED_CDC_REGISTERS
             | {
             | {
                 "u_core/u_motors/u_x_axis/limit_sync_pipe[0]",
                 "u_core/u_motors/u_x_axis/limit_sync_pipe[0]",
                 "u_core/u_motors/u_x_axis/limit_sync_pipe[1]",
                 "u_core/u_motors/u_x_axis/limit_sync_pipe[1]",
@@ -448,7 +462,7 @@ class Prod2UP4HarnessTests(unittest.TestCase):
         legacy_report = {
         legacy_report = {
             "retained_sync_registers": legacy_registers,
             "retained_sync_registers": legacy_registers,
             "false_path_endpoints": sorted(
             "false_path_endpoints": sorted(
-                UART_ONLY_CDC_ENDPOINTS
+                EXPECTED_CDC_ENDPOINTS
                 | {
                 | {
                     "u_core/u_motors/u_x_axis/limit_sync_pipe[0]",
                     "u_core/u_motors/u_x_axis/limit_sync_pipe[0]",
                     "u_core/u_motors/u_y_axis/limit_sync_pipe[0]",
                     "u_core/u_motors/u_y_axis/limit_sync_pipe[0]",
@@ -459,7 +473,7 @@ class Prod2UP4HarnessTests(unittest.TestCase):
         }
         }
         rejected = harness.structural_cdc_gate(
         rejected = harness.structural_cdc_gate(
             legacy_report,
             legacy_report,
-            async_reg_count=8,
+            async_reg_count=12,
             input_register_count=0,
             input_register_count=0,
         )
         )
         self.assertEqual(rejected["status"], "fail")
         self.assertEqual(rejected["status"], "fail")
@@ -786,7 +800,7 @@ class Prod2UP4HarnessTests(unittest.TestCase):
         self.assertEqual(tuple(harness.PRODUCTION_RTL_SOURCES), EXPECTED_SOURCES)
         self.assertEqual(tuple(harness.PRODUCTION_RTL_SOURCES), EXPECTED_SOURCES)
         self.assertEqual(tuple(harness.active_rtl_sources()), EXPECTED_SOURCES)
         self.assertEqual(tuple(harness.active_rtl_sources()), EXPECTED_SOURCES)
         combined = "\n".join(EXPECTED_SOURCES).casefold()
         combined = "\n".join(EXPECTED_SOURCES).casefold()
-        for retired in ("trace", "temperature", "ct7428", "limit_filter", "build_identity"):
+        for retired in ("trace", "ct7428", "limit_filter", "build_identity"):
             self.assertNotIn(retired, combined)
             self.assertNotIn(retired, combined)
 
 
     def test_versioned_target_manifest_matches_every_discovered_layer(self) -> None:
     def test_versioned_target_manifest_matches_every_discovered_layer(self) -> None:

+ 1 - 5
tests/unit/test_prod2u_p4_minimal_delivery_contract.py

@@ -595,7 +595,7 @@ class Prod2UP4MinimalDeliveryContractTests(unittest.TestCase):
                         commit_argument=argument,
                         commit_argument=argument,
                     )
                     )
 
 
-    def test_production_rtl_and_td_have_no_trace_boot_build_id_or_temperature_logic(self) -> None:
+    def test_production_rtl_and_td_have_no_trace_or_boot_build_id_logic(self) -> None:
         rtl_files = sorted((ROOT / "src" / "rtl").glob("*.v"))
         rtl_files = sorted((ROOT / "src" / "rtl").glob("*.v"))
         rtl_files += sorted((ROOT / "src" / "top").glob("*.v"))
         rtl_files += sorted((ROOT / "src" / "top").glob("*.v"))
         offenders: dict[str, list[str]] = {}
         offenders: dict[str, list[str]] = {}
@@ -606,10 +606,6 @@ class Prod2UP4MinimalDeliveryContractTests(unittest.TestCase):
                 found.append("trace")
                 found.append("trace")
             if ACTIVE_BOOT_OR_BUILD_ID.search(text):
             if ACTIVE_BOOT_OR_BUILD_ID.search(text):
                 found.append("boot/build-id")
                 found.append("boot/build-id")
-            if path.suffix.casefold() == ".v" and (
-                ACTIVE_TEMPERATURE_RTL.search(path.name) or ACTIVE_TEMPERATURE_RTL.search(text)
-            ):
-                found.append("temperature-rtl")
             if found:
             if found:
                 offenders[path.relative_to(ROOT).as_posix()] = found
                 offenders[path.relative_to(ROOT).as_posix()] = found
 
 

+ 16 - 6
tests/unit/test_prod2u_p4_normal_v3_td_files.py

@@ -25,6 +25,10 @@ SOURCES = [
     "src/rtl/prod2u_p4_axis_executor.v",
     "src/rtl/prod2u_p4_axis_executor.v",
     "src/rtl/prod2u_p4_motor_hub.v",
     "src/rtl/prod2u_p4_motor_hub.v",
     "src/rtl/prod2u_p4_response_scheduler.v",
     "src/rtl/prod2u_p4_response_scheduler.v",
+    "src/rtl/prod2u_p4_i2c_stop_start_read.v",
+    "src/rtl/prod2u_p4_temperature_read.v",
+    "src/rtl/prod2u_p4_temperature_store.v",
+    "src/rtl/prod2u_p4_temperature_short_tx.v",
     "src/rtl/prod2u_p4_normal_v3_tx.v",
     "src/rtl/prod2u_p4_normal_v3_tx.v",
     "src/rtl/prod2u_p4_pwm_outputs.v",
     "src/rtl/prod2u_p4_pwm_outputs.v",
     "src/rtl/prod2u_p4_normal_v3_core.v",
     "src/rtl/prod2u_p4_normal_v3_core.v",
@@ -43,7 +47,7 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
         self.assertEqual(project_sources, SOURCES)
         self.assertEqual(project_sources, SOURCES)
         self.assertEqual(tree.findtext("TOP_MODULE/MODULE"), f"{STEM}_top")
         self.assertEqual(tree.findtext("TOP_MODULE/MODULE"), f"{STEM}_top")
         combined = "\n".join(project_sources).casefold()
         combined = "\n".join(project_sources).casefold()
-        for retired in ("trace", "temperature", "ct7428", "limit_filter", "build_identity"):
+        for retired in ("trace", "ct7428", "limit_filter", "build_identity"):
             self.assertNotIn(retired, combined)
             self.assertNotIn(retired, combined)
 
 
     def test_synthesis_analyzes_same_sources_and_elaborates_direct_top(self) -> None:
     def test_synthesis_analyzes_same_sources_and_elaborates_direct_top(self) -> None:
@@ -79,7 +83,7 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
             ):
             ):
                 self.assertNotIn(forbidden, source)
                 self.assertNotIn(forbidden, source)
 
 
-    def test_adc_uses_41_unique_pads_and_verified_limit_balls(self) -> None:
+    def test_adc_uses_43_unique_pads_and_verified_temperature_balls(self) -> None:
         adc = (ROOT / "constraints" / f"{STEM}.adc").read_text(encoding="ascii")
         adc = (ROOT / "constraints" / f"{STEM}.adc").read_text(encoding="ascii")
         rows = re.findall(
         rows = re.findall(
             r"^set_pin_assignment\s+\{\s*([^}]+?)\s*\}\s+\{\s*LOCATION\s*=\s*([^;\s]+)",
             r"^set_pin_assignment\s+\{\s*([^}]+?)\s*\}\s+\{\s*LOCATION\s*=\s*([^;\s]+)",
@@ -88,8 +92,8 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
         )
         )
         assignments = {signal.strip(): ball.strip() for signal, ball in rows}
         assignments = {signal.strip(): ball.strip() for signal, ball in rows}
 
 
-        self.assertEqual(len(rows), 41)
-        self.assertEqual(len(set(assignments.values())), 41)
+        self.assertEqual(len(rows), 43)
+        self.assertEqual(len(set(assignments.values())), 43)
         self.assertEqual(
         self.assertEqual(
             {
             {
                 signal: assignments[signal]
                 signal: assignments[signal]
@@ -101,6 +105,8 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
                     "y_dir",
                     "y_dir",
                     "x_limit_raw",
                     "x_limit_raw",
                     "y_limit_raw",
                     "y_limit_raw",
+                    "temp_scl",
+                    "temp_sda",
                 )
                 )
             },
             },
             {
             {
@@ -111,6 +117,8 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
                 "y_dir": "H14",
                 "y_dir": "H14",
                 "x_limit_raw": "B9",
                 "x_limit_raw": "B9",
                 "y_limit_raw": "A11",
                 "y_limit_raw": "A11",
+                "temp_scl": "M8",
+                "temp_sda": "N9",
             },
             },
         )
         )
         self.assertNotIn("A5", assignments.values())
         self.assertNotIn("A5", assignments.values())
@@ -142,7 +150,7 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
                 self.assertNotIn("limit_sync_pipe", source)
                 self.assertNotIn("limit_sync_pipe", source)
                 self.assertNotIn("x_limit_raw", source)
                 self.assertNotIn("x_limit_raw", source)
                 self.assertNotIn("y_limit_raw", source)
                 self.assertNotIn("y_limit_raw", source)
-                self.assertIn("if {[llength $cdc_regs] != 2}", source)
+                self.assertIn("if {[llength $cdc_regs] != 6}", source)
                 self.assertNotIn("if {[llength $cdc_regs] != 8}", source)
                 self.assertNotIn("if {[llength $cdc_regs] != 8}", source)
 
 
     def test_axis_fsm_is_two_bit_four_phase_sequential_contract(self) -> None:
     def test_axis_fsm_is_two_bit_four_phase_sequential_contract(self) -> None:
@@ -212,7 +220,9 @@ class Prod2UP4NormalV3TDFilesTests(unittest.TestCase):
         self.assertEqual(binding["motor"]["y_limit_raw_ball"], "A11")
         self.assertEqual(binding["motor"]["y_limit_raw_ball"], "A11")
         self.assertEqual(binding["motor"]["unused_balls"], ["A5"])
         self.assertEqual(binding["motor"]["unused_balls"], ["A5"])
 
 
-        self.assertEqual(binding["resources"]["io"], 41)
+        self.assertEqual(binding["resources"]["io"], 43)
+        self.assertEqual(binding["temperature"]["scl_ball"], "M8")
+        self.assertEqual(binding["temperature"]["sda_ball"], "N9")
         self.assertEqual(binding["resources"]["dsp"], 0)
         self.assertEqual(binding["resources"]["dsp"], 0)
         self.assertTrue(
         self.assertTrue(
             all(value == 0 for name, value in binding["resources"].items() if name.startswith("bram"))
             all(value == 0 for name, value in binding["resources"].items() if name.startswith("bram"))

+ 5 - 2
tests/unit/test_prod2u_p4_protocol_v3.py

@@ -96,7 +96,7 @@ class Prod2UP4ProtocolV3Tests(unittest.TestCase):
         with self.assertRaisesRegex(ValueError, "steps must be from 1 to 65535"):
         with self.assertRaisesRegex(ValueError, "steps must be from 1 to 65535"):
             protocol.decode_motion_command(protocol.decode_frame(bytes(wire)))
             protocol.decode_motion_command(protocol.decode_frame(bytes(wire)))
 
 
-    def test_legacy_temperature_request_can_be_framed_but_has_no_public_api(self) -> None:
+    def test_legacy_0x29_stays_retired_while_0x28_has_one_public_builder(self) -> None:
         wire = protocol.encode_frame(
         wire = protocol.encode_frame(
             frame_type=protocol.FrameType.HOST_CMD,
             frame_type=protocol.FrameType.HOST_CMD,
             seq=0,
             seq=0,
@@ -106,10 +106,13 @@ class Prod2UP4ProtocolV3Tests(unittest.TestCase):
         self.assertEqual(protocol.decode_frame(wire).payload, b"\x29\x00\x00\x00")
         self.assertEqual(protocol.decode_frame(wire).payload, b"\x29\x00\x00\x00")
         for retired in (
         for retired in (
             "TemperatureSnapshot",
             "TemperatureSnapshot",
-            "build_get_temperatures",
             "decode_temperature_snapshot",
             "decode_temperature_snapshot",
         ):
         ):
             self.assertFalse(hasattr(protocol, retired), retired)
             self.assertFalse(hasattr(protocol, retired), retired)
+        self.assertEqual(
+            protocol.build_get_temperatures().hex(),
+            "a55a020405000000000000000004280000009e0c",
+        )
 
 
     def test_host_ack_preserves_partial_detail_and_actual_output_hash(self) -> None:
     def test_host_ack_preserves_partial_detail_and_actual_output_hash(self) -> None:
         wire = protocol.build_host_ack(
         wire = protocol.build_host_ack(

+ 8 - 7
tests/unit/test_prod2u_p4_retirement_contract.py

@@ -47,7 +47,7 @@ class Prod2UP4RetirementContractTests(unittest.TestCase):
             ["td/prod2u_p4_normal_v3.prj"],
             ["td/prod2u_p4_normal_v3.prj"],
         )
         )
 
 
-    def test_trace_temperature_boot_and_build_identity_assets_are_absent(self) -> None:
+    def test_trace_legacy_ct7428_boot_and_build_identity_assets_are_absent(self) -> None:
         roots = (ROOT / "src", ROOT / "td", ROOT / "tools", ROOT / "schemas")
         roots = (ROOT / "src", ROOT / "td", ROOT / "tools", ROOT / "schemas")
         offenders = [
         offenders = [
             path.relative_to(ROOT).as_posix()
             path.relative_to(ROOT).as_posix()
@@ -56,7 +56,7 @@ class Prod2UP4RetirementContractTests(unittest.TestCase):
             if path.is_file()
             if path.is_file()
             and "__pycache__" not in path.parts
             and "__pycache__" not in path.parts
             and re.search(
             and re.search(
-                r"(?i)(?:^|[._/-])(trace|temperature|ct7428|build[-_]?identity)(?:[._/-]|$)",
+                r"(?i)(?:^|[._/-])(trace|ct7428|build[-_]?identity)(?:[._/-]|$)",
                 path.relative_to(ROOT).as_posix(),
                 path.relative_to(ROOT).as_posix(),
             )
             )
         ]
         ]
@@ -108,7 +108,7 @@ class Prod2UP4RetirementContractTests(unittest.TestCase):
         for retired in ("trace_event", "boot_build_id", "build_id", "capability_flags"):
         for retired in ("trace_event", "boot_build_id", "build_id", "capability_flags"):
             self.assertNotIn(retired, serialized)
             self.assertNotIn(retired, serialized)
 
 
-    def test_normal_v3_uses_41_pads_and_releases_a5_m8_n9(self) -> None:
+    def test_normal_v3_uses_43_pads_and_assigns_temperature_i2c(self) -> None:
         constraints = (ROOT / "constraints/prod2u_p4_normal_v3.adc").read_text(encoding="ascii")
         constraints = (ROOT / "constraints/prod2u_p4_normal_v3.adc").read_text(encoding="ascii")
         assignments = re.findall(
         assignments = re.findall(
             r"set_pin_assignment\s+\{\s*([^}]+?)\s*\}\s+\{[^}]*LOCATION\s*=\s*([^;\s]+)",
             r"set_pin_assignment\s+\{\s*([^}]+?)\s*\}\s+\{[^}]*LOCATION\s*=\s*([^;\s]+)",
@@ -116,11 +116,12 @@ class Prod2UP4RetirementContractTests(unittest.TestCase):
         )
         )
         balls = {ball.strip() for _, ball in assignments}
         balls = {ball.strip() for _, ball in assignments}
 
 
-        self.assertEqual(len(assignments), 41)
-        self.assertEqual(len(balls), 41)
+        by_signal = {signal.strip(): ball.strip() for signal, ball in assignments}
+        self.assertEqual(len(assignments), 43)
+        self.assertEqual(len(balls), 43)
         self.assertNotIn("A5", balls)
         self.assertNotIn("A5", balls)
-        self.assertNotIn("M8", balls)
-        self.assertNotIn("N9", balls)
+        self.assertEqual(by_signal["temp_scl"], "M8")
+        self.assertEqual(by_signal["temp_sda"], "N9")
 
 
     def test_active_roots_have_no_loose_python_bytecode_entrypoints(self) -> None:
     def test_active_roots_have_no_loose_python_bytecode_entrypoints(self) -> None:
         offenders = [
         offenders = [

+ 13 - 7
tests/unit/test_prod2u_p4_td_cdc_structure.py

@@ -54,10 +54,14 @@ class Prod2UP4TdCdcStructureTests(unittest.TestCase):
         )
         )
         self.assertRegex(axis, r"reg \[1:0\] motion_phase;")
         self.assertRegex(axis, r"reg \[1:0\] motion_phase;")
 
 
-    def test_syn_and_phy_track_only_two_uart_cdc_registers(self) -> None:
+    def test_syn_and_phy_track_uart_and_temperature_cdc_registers(self) -> None:
         expected_groups = {
         expected_groups = {
             "u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}",
             "u_uart_rx/rx_sync_pipe[0] {{u_uart_rx/rx_sync_pipe[0]} {*/u_uart_rx/rx_sync_pipe[0]}}",
             "u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}",
             "u_uart_rx/rx_sync_pipe[1] {{u_uart_rx/rx_sync_pipe[1]} {*/u_uart_rx/rx_sync_pipe[1]}}",
+            "u_temperature_i2c/scl_sync[0] {{u_temperature_i2c/scl_sync[0]} {*/u_temperature_i2c/scl_sync[0]}}",
+            "u_temperature_i2c/scl_sync[1] {{u_temperature_i2c/scl_sync[1]} {*/u_temperature_i2c/scl_sync[1]}}",
+            "u_temperature_i2c/sda_sync[0] {{u_temperature_i2c/sda_sync[0]} {*/u_temperature_i2c/sda_sync[0]}}",
+            "u_temperature_i2c/sda_sync[1] {{u_temperature_i2c/sda_sync[1]} {*/u_temperature_i2c/sda_sync[1]}}",
         }
         }
         for path in (SYN, PHY):
         for path in (SYN, PHY):
             source = path.read_text(encoding="ascii")
             source = path.read_text(encoding="ascii")
@@ -67,13 +71,15 @@ class Prod2UP4TdCdcStructureTests(unittest.TestCase):
                 self.assertEqual(observed, expected_groups)
                 self.assertEqual(observed, expected_groups)
                 self.assertIn("proc p4_find_unique_regs {patterns}", source)
                 self.assertIn("proc p4_find_unique_regs {patterns}", source)
                 self.assertIn("lsearch -exact $matches $reg", source)
                 self.assertIn("lsearch -exact $matches $reg", source)
-                self.assertIn("if {[llength $cdc_regs] != 2}", source)
+                self.assertIn("if {[llength $cdc_regs] != 6}", source)
                 self.assertIn('puts $cdc_report "retained_sync_register=$normalized"', source)
                 self.assertIn('puts $cdc_report "retained_sync_register=$normalized"', source)
                 self.assertNotIn("limit_sync_pipe", source)
                 self.assertNotIn("limit_sync_pipe", source)
 
 
-    def test_only_uart_input_to_first_stage_is_false_pathed(self) -> None:
+    def test_each_async_input_is_false_pathed_only_to_its_first_stage(self) -> None:
         expected_pairs = {
         expected_pairs = {
             "host_uart_rx u_uart_rx/rx_sync_pipe[0]",
             "host_uart_rx u_uart_rx/rx_sync_pipe[0]",
+            "temp_scl u_temperature_i2c/scl_sync[0]",
+            "temp_sda u_temperature_i2c/sda_sync[0]",
         }
         }
         for path in (SYN, PHY):
         for path in (SYN, PHY):
             source = path.read_text(encoding="ascii")
             source = path.read_text(encoding="ascii")
@@ -111,21 +117,21 @@ class Prod2UP4TdCdcStructureTests(unittest.TestCase):
                 self.assertNotIn("CDC_GATE_ADVISORY_FAIL=", source)
                 self.assertNotIn("CDC_GATE_ADVISORY_FAIL=", source)
                 self.assertNotIn("FSM_ENCODING_GATE_ADVISORY_FAIL=", source)
                 self.assertNotIn("FSM_ENCODING_GATE_ADVISORY_FAIL=", source)
 
 
-    def test_td_receipt_schema_matches_uart_only_cdc_and_two_bit_axes(self) -> None:
+    def test_td_receipt_schema_matches_all_cdc_and_two_bit_axes(self) -> None:
         schema = json.loads(TD_RECEIPT_SCHEMA.read_text(encoding="utf-8"))
         schema = json.loads(TD_RECEIPT_SCHEMA.read_text(encoding="utf-8"))
         structural = schema["$defs"]["structuralGate"]["properties"]
         structural = schema["$defs"]["structuralGate"]["properties"]
         cdc = structural["cdc"]["properties"]
         cdc = structural["cdc"]["properties"]
         fsm = structural["fsm_encoding"]["properties"]
         fsm = structural["fsm_encoding"]["properties"]
 
 
-        self.assertEqual(cdc["async_reg"]["properties"]["used"]["const"], 2)
+        self.assertEqual(cdc["async_reg"]["properties"]["used"]["const"], 6)
         self.assertEqual(cdc["input_registers"]["properties"]["used"]["const"], 0)
         self.assertEqual(cdc["input_registers"]["properties"]["used"]["const"], 0)
         self.assertEqual(
         self.assertEqual(
             cdc["retained_sync_registers"]["properties"]["used"]["const"],
             cdc["retained_sync_registers"]["properties"]["used"]["const"],
-            2,
+            6,
         )
         )
         self.assertEqual(
         self.assertEqual(
             cdc["first_stage_endpoints"]["properties"]["used"]["const"],
             cdc["first_stage_endpoints"]["properties"]["used"]["const"],
-            1,
+            3,
         )
         )
         self.assertEqual(fsm["axes"]["const"], {"x": 2, "y": 2})
         self.assertEqual(fsm["axes"]["const"], {"x": 2, "y": 2})
 
 

+ 81 - 0
tests/unit/test_prod2u_p4_temperature_contract.py

@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+"""Wire-contract tests for the on-demand CT7428 temperature response."""
+
+from __future__ import annotations
+
+import pytest
+
+from tools import prod2u_p4_protocol as protocol
+
+
+GOLDEN_REQUEST = bytes.fromhex(
+    "A55A020405000000000000000004280000009E0C"
+)
+GOLDEN_RESPONSE = bytes.fromhex(
+    "A55A0204101B"
+    "000102030405060708090A0B0C0D0E0F101112131415161718191A"
+    "1FC9"
+)
+ALL_FF_RESPONSE = bytes.fromhex(
+    "A55A0204101B"
+    "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+    "1BC4"
+)
+
+
+def test_get_temperatures_request_matches_the_frozen_wire_frame() -> None:
+    assert protocol.CommandId.GET_TEMPERATURES == 0x28
+    assert protocol.build_get_temperatures() == GOLDEN_REQUEST
+
+    decoded = protocol.decode_frame(GOLDEN_REQUEST)
+    assert decoded.frame_type == protocol.FrameType.HOST_CMD
+    assert decoded.payload == bytes.fromhex("28000000")
+
+
+def test_temperature_response_matches_the_frozen_35_byte_frame() -> None:
+    values = bytes(range(27))
+
+    response = protocol.build_temperature_response(values)
+
+    assert response == GOLDEN_RESPONSE
+    assert len(response) == 35
+    assert response[:6] == bytes.fromhex("A55A0204101B")
+    assert response[6:33] == values
+    assert response[-2:] == protocol.crc16_ccitt(response[2:-2]).to_bytes(
+        2, "little"
+    )
+
+
+def test_temperature_response_all_ff_frame_matches_the_frozen_crc() -> None:
+    response = protocol.build_temperature_response(bytes([0xFF] * 27))
+
+    assert response == ALL_FF_RESPONSE
+    assert response[-2:] == bytes.fromhex("1BC4")
+
+
+def test_temperature_bus_error_ack_decodes_as_status_0x0a() -> None:
+    wire = protocol.encode_frame(
+        frame_type=protocol.FrameType.HOST_ACK,
+        seq=0,
+        timestamp_tick=0,
+        payload=bytes.fromhex("00280A0000000000"),
+    )
+
+    ack = protocol.decode_host_ack(protocol.decode_frame(wire))
+
+    assert ack.command == protocol.CommandId.GET_TEMPERATURES
+    assert ack.status == protocol.StatusCode.TEMPERATURE_BUS_ERROR
+
+
+@pytest.mark.parametrize(
+    "values",
+    [
+        bytes(26),
+        bytes(28),
+        [0] * 26 + [256],
+        [0] * 26 + [-1],
+    ],
+)
+def test_temperature_response_rejects_non_27_byte_payloads(values: object) -> None:
+    with pytest.raises(ValueError):
+        protocol.build_temperature_response(values)

+ 9 - 3
tools/prod2u_p4_harness.py

@@ -62,11 +62,17 @@ EXPECTED_CDC_SYNC_REGISTERS = frozenset(
     {
     {
         "u_uart_rx/rx_sync_pipe[0]",
         "u_uart_rx/rx_sync_pipe[0]",
         "u_uart_rx/rx_sync_pipe[1]",
         "u_uart_rx/rx_sync_pipe[1]",
+        "u_temperature_i2c/scl_sync[0]",
+        "u_temperature_i2c/scl_sync[1]",
+        "u_temperature_i2c/sda_sync[0]",
+        "u_temperature_i2c/sda_sync[1]",
     }
     }
 )
 )
 EXPECTED_CDC_FALSE_PATH_ENDPOINTS = frozenset(
 EXPECTED_CDC_FALSE_PATH_ENDPOINTS = frozenset(
     {
     {
         "u_uart_rx/rx_sync_pipe[0]",
         "u_uart_rx/rx_sync_pipe[0]",
+        "u_temperature_i2c/scl_sync[0]",
+        "u_temperature_i2c/sda_sync[0]",
     }
     }
 )
 )
 EXPECTED_FSM_AXES = {"x": 2, "y": 2}
 EXPECTED_FSM_AXES = {"x": 2, "y": 2}
@@ -3487,10 +3493,10 @@ def _td_final_failures(
     structural = receipt.get("structural_gate")
     structural = receipt.get("structural_gate")
     cdc = structural.get("cdc") if isinstance(structural, Mapping) else None
     cdc = structural.get("cdc") if isinstance(structural, Mapping) else None
     expected_cdc = {
     expected_cdc = {
-        "async_reg": 2,
+        "async_reg": 6,
         "input_registers": 0,
         "input_registers": 0,
-        "retained_sync_registers": 2,
-        "first_stage_endpoints": 1,
+        "retained_sync_registers": 6,
+        "first_stage_endpoints": 3,
     }
     }
     cdc_ok = isinstance(cdc, Mapping) and cdc.get("status") == "pass"
     cdc_ok = isinstance(cdc, Mapping) and cdc.get("status") == "pass"
     for name, expected in expected_cdc.items():
     for name, expected in expected_cdc.items():

+ 4 - 0
tools/prod2u_p4_normal_v3_build.py

@@ -30,6 +30,10 @@ PRODUCTION_RTL_SOURCES = (
     "src/rtl/prod2u_p4_axis_executor.v",
     "src/rtl/prod2u_p4_axis_executor.v",
     "src/rtl/prod2u_p4_motor_hub.v",
     "src/rtl/prod2u_p4_motor_hub.v",
     "src/rtl/prod2u_p4_response_scheduler.v",
     "src/rtl/prod2u_p4_response_scheduler.v",
+    "src/rtl/prod2u_p4_i2c_stop_start_read.v",
+    "src/rtl/prod2u_p4_temperature_read.v",
+    "src/rtl/prod2u_p4_temperature_store.v",
+    "src/rtl/prod2u_p4_temperature_short_tx.v",
     "src/rtl/prod2u_p4_normal_v3_tx.v",
     "src/rtl/prod2u_p4_normal_v3_tx.v",
     "src/rtl/prod2u_p4_pwm_outputs.v",
     "src/rtl/prod2u_p4_pwm_outputs.v",
     "src/rtl/prod2u_p4_normal_v3_core.v",
     "src/rtl/prod2u_p4_normal_v3_core.v",

+ 25 - 2
tools/prod2u_p4_protocol.py

@@ -2,8 +2,8 @@
 """Prod2U Profile 4 Normal binary921-v3 wire protocol helpers.
 """Prod2U Profile 4 Normal binary921-v3 wire protocol helpers.
 
 
 Host request frame types and payload layouts are intentionally frozen. The
 Host request frame types and payload layouts are intentionally frozen. The
-device response path contains one HOST_ACK for ordinary commands and one
-additional MOTION_STATUS frame for GET_MOTOR_STATUS.
+temperature command is the sole exception on the response side: it returns a
+compact 35-byte frame instead of a normal 14-byte-header Binary921 frame.
 """
 """
 
 
 from __future__ import annotations
 from __future__ import annotations
@@ -27,6 +27,8 @@ MOTION_COMMAND_PAYLOAD_LEN = 8
 MOTION_STATUS_PAYLOAD_LEN = 10
 MOTION_STATUS_PAYLOAD_LEN = 10
 PTC_CHANNEL_COUNT = 24
 PTC_CHANNEL_COUNT = 24
 FAN_CHANNEL_COUNT = 4
 FAN_CHANNEL_COUNT = 4
+TEMPERATURE_VALUE_COUNT = 27
+TEMPERATURE_RESPONSE_TYPE = 0x10
 
 
 
 
 class P4FrameError(ValueError):
 class P4FrameError(ValueError):
@@ -44,6 +46,7 @@ class FrameType(IntEnum):
 class CommandId(IntEnum):
 class CommandId(IntEnum):
     GET_STATUS = 0x24
     GET_STATUS = 0x24
     DISABLE = 0x26
     DISABLE = 0x26
+    GET_TEMPERATURES = 0x28
     SET_OUTPUT_SNAPSHOT = 0x2A
     SET_OUTPUT_SNAPSHOT = 0x2A
 
 
 
 
@@ -60,6 +63,7 @@ class StatusCode(IntEnum):
     BAD_LENGTH = 0x03
     BAD_LENGTH = 0x03
     BAD_VALUE = 0x05
     BAD_VALUE = 0x05
     BUSY = 0x09
     BUSY = 0x09
+    TEMPERATURE_BUS_ERROR = 0x0A
     PARTIAL = 0x16
     PARTIAL = 0x16
 
 
 
 
@@ -348,6 +352,25 @@ def build_host_command(
     )
     )
 
 
 
 
+def build_get_temperatures() -> bytes:
+    """Build the exact HOST_CMD request for one on-demand temperature read."""
+    return build_host_command(command=CommandId.GET_TEMPERATURES)
+
+
+def build_temperature_response(values: bytes | bytearray | Iterable[int]) -> bytes:
+    """Build the compact 35-byte temperature response used by command 0x28."""
+    try:
+        payload = bytes(values)
+    except (TypeError, ValueError) as exc:
+        raise ValueError("temperature response values must be bytes") from exc
+    if len(payload) != TEMPERATURE_VALUE_COUNT:
+        raise ValueError("temperature response requires exactly 27 values")
+    body = bytes(
+        [VERSION, PROFILE_ID, TEMPERATURE_RESPONSE_TYPE, TEMPERATURE_VALUE_COUNT]
+    ) + payload
+    return MAGIC + body + crc16_ccitt(body).to_bytes(2, "little")
+
+
 def decode_host_command(value: P4Frame | bytes | bytearray) -> HostCommand:
 def decode_host_command(value: P4Frame | bytes | bytearray) -> HostCommand:
     payload = _payload(value, FrameType.HOST_CMD, HOST_CMD_PAYLOAD_LEN, "four bytes")
     payload = _payload(value, FrameType.HOST_CMD, HOST_CMD_PAYLOAD_LEN, "four bytes")
     try:
     try: