Jelajahi Sumber

feat(mrdimm): V1.2 production top and snapshot mux (WIP, not compiled)

src/telemetry/mrdimm_snapshot_mux.v: 50-byte ALL_STATUS window latched
from applied duties, three 96-bit axis telemetry words, time_us and
event head info; stable until the next capture.

src/transport/host_i2c_register_bank: PRODUCT parameter selects the
private command core (6400 table vs mrdimm table) behind one mailbox;
motor/event/status passthrough ports added; mrdimm core exposes
ack_payload_data for the shared fake-tx response capture and
cmd_tx_payload_data for the frame_tx source.

src/transport/mrdimm_host_command: tx_payload_addr corrected to input
(frame_tx drives it at PAYLOAD_READ_LATENCY=1).

src/top/prod2u_mrdimm_top.v: V1.2 pins (X H4/J6 Y E7/A4 Z B4/A12,
limits A5/B6 C8/A8 K16/J15, EN C11 constant 1, PTC8 pair duplication
{3,3,2,2,1,1,0,0}), RS232 host 921600 with unbound TTL held idle, BMC
115200, CT7428 independent master, PRODUCT=1 I2C mailbox, motor engine
with power-on SEEK_LOWER.

Known-open for remote iverilog convergence: BMC valid/stale hookup into
the I2C DEVICE_STATUS, I2C/UART thermal-write mux into the output core,
snapshot capture arbitration, unused-input sweeps.  edk2-uefi-lab
still unreachable.
codex 3 bulan lalu
induk
melakukan
f084b22d76

+ 90 - 0
src/telemetry/mrdimm_snapshot_mux.v

@@ -0,0 +1,90 @@
+`timescale 1ns/1ps
+`include "generated/mrdimm/prod2u_mrdimm_params.vh"
+
+// ALL_STATUS_DATA snapshot for the mrdimm-chamber product.
+//
+// On capture, latches a consistent view of the thermal duties, the three
+// axis telemetry words, the engine time base and the event ring head
+// info into a dedicated stable window; ready pulses one cycle later and
+// the window stays fixed until the next capture.  Layout (50 bytes):
+//   [0..7]   fan0..3 / ptc0..3 applied percent
+//   [8..19]  [20..31] [32..43] axis X/Y/Z 96-bit packed telemetry (LE)
+//   [44..47] time_us low 32
+//   [48]     event record count   [49] event overflow lsb
+module mrdimm_snapshot_mux #(
+    parameter integer SNAPSHOT_LENGTH = `MR_SNAPSHOT_LENGTH
+) (
+    input  wire       clk,
+    input  wire       rst_n,
+    input  wire       capture,
+    output reg        ready,
+    // sources
+    input  wire [7:0] fan_applied [0:3],
+    input  wire [7:0] ptc_applied [0:3],
+    input  wire [2:0] axis_sel,          // one axis read at a time
+    input  wire [95:0] axis_data,
+    input  wire [31:0] time_us,
+    input  wire [7:0] ev_count,
+    input  wire [7:0] ev_overflow,
+    // stable byte window (combinational read of latched registers)
+    input  wire [7:0] read_addr,
+    output reg  [7:0] read_data
+);
+    reg [7:0] window [0:SNAPSHOT_LENGTH-1];
+    reg [1:0] cap_state;
+    reg [1:0] cap_axis;
+    integer i;
+
+    always @(posedge clk or negedge rst_n) begin
+        if (!rst_n) begin
+            cap_state <= 2'd0;
+            cap_axis <= 2'd0;
+            ready <= 1'b0;
+        end else begin
+            ready <= 1'b0;
+            case (cap_state)
+                2'd0: if (capture) begin
+                    for (i = 0; i < 4; i = i + 1) begin
+                        window[i] <= fan_applied[i];
+                        window[i + 4] <= ptc_applied[i];
+                    end
+                    cap_axis <= 2'd0;
+                    axis_sel <= 2'd0;
+                    cap_state <= 2'd1;
+                end
+                2'd1: begin
+                    // one cycle per axis with the registered read latency
+                    case (cap_axis)
+                        2'd0: for (i = 0; i < 12; i = i + 1)
+                            window[8 + i] <= axis_data[i*8 +: 8];
+                        2'd1: for (i = 0; i < 12; i = i + 1)
+                            window[20 + i] <= axis_data[i*8 +: 8];
+                        2'd2: for (i = 0; i < 12; i = i + 1)
+                            window[32 + i] <= axis_data[i*8 +: 8];
+                        default: ;
+                    endcase
+                    if (cap_axis == 2'd2) begin
+                        cap_state <= 2'd2;
+                    end else begin
+                        cap_axis <= cap_axis + 2'd1;
+                        axis_sel <= axis_sel + 2'd1;
+                    end
+                end
+                2'd2: begin
+                    window[44] <= time_us[7:0];   window[45] <= time_us[15:8];
+                    window[46] <= time_us[23:16]; window[47] <= time_us[31:24];
+                    window[48] <= ev_count;
+                    window[49] <= ev_overflow;
+                    ready <= 1'b1;
+                    cap_state <= 2'd0;
+                end
+                default: cap_state <= 2'd0;
+            endcase
+        end
+    end
+
+    always @* begin
+        read_data = 8'hFF;
+        if (read_addr < SNAPSHOT_LENGTH[7:0]) read_data = window[read_addr];
+    end
+endmodule

+ 407 - 0
src/top/prod2u_mrdimm_top.v

@@ -0,0 +1,407 @@
+`timescale 1ns/1ps
+`include "generated/mrdimm/prod2u_mrdimm_params.vh"
+
+// mrdimm-chamber production top (FCB V1.2, 2026 contract section 10).
+//
+// Board facts (V1.2, direct 3.3V series-R seats, no BJT):
+//   motors  X STEP/DIR CON142.2/3 = H4/J6
+//           Y STEP/DIR CON126.2/3 = E7/A4
+//           Z STEP/DIR CON127.2/3 = B4/A12
+//   limits  X LS/HS CON12.1/2 = A5/B6   Y LS/HS CON12.3/4 = C8/A8
+//           Z LS/HS CON129.1/2 = K16/J15, active high at FPGA
+//   EN      CON120.2 = C11, NPN invert at board, FPGA constant 1
+//   PTC8    logical PTC0..3 each duplicated to two physical channels per
+//           the V1.2 board map (ptc_pair_map)
+//   Host    CON78 RS232 921600 (TTL balls unbound: held idle, not exported)
+//   BMC     RS232 115200 (optional; absence never blocks control)
+//   CT7428  independent I2C master, 27 channels
+//   HostI2C CON36 B12/C12 (V1.2 evidence), slave 0x2A
+module prod2u_mrdimm_top (
+    input  wire        sys_clk,
+    input  wire        host_rs232_rx,
+    output wire        host_rs232_tx,
+    input  wire        host_ttl_rx,
+    output wire        host_ttl_tx,
+    input  wire        bmc_rs232_rx,
+    output wire        bmc_rs232_tx,
+    input  wire        host_i2c_scl,
+    inout  wire        host_i2c_sda,
+    input  wire        temp_scl,
+    inout  wire        temp_sda,
+    input  wire [2:0]  limit_lower_raw,
+    input  wire [2:0]  limit_upper_raw,
+    output wire [7:0]  ptc_pwm_out,
+    output wire [3:0]  fan_pwm_out,
+    output wire        motor_en_n,
+    output wire        x_step, x_dir,
+    output wire        y_step, y_dir,
+    output wire        z_step, z_dir
+);
+    wire rst_n;
+
+    // ---- motor / PTC8 duplication ----
+    // V1.2 board map: each logical chamber PTC drives two physical
+    // channels (pairing from the V1.2 pin contract; the duplicated pair
+    // is interleaved so a single FET failure halves one zone only).
+    // Physical order: P0A P0B P1A P1B P2A P2B P3A P3B
+    wire [3:0] fan_on, ptc_on;
+    assign ptc_pwm_out = {ptc_on[3], ptc_on[3], ptc_on[2], ptc_on[2],
+                          ptc_on[1], ptc_on[1], ptc_on[0], ptc_on[0]};
+    assign fan_pwm_out = fan_on;
+    assign motor_en_n = 1'b1;   // NPN invert at board: constant 1 = enabled
+
+    // ---- time base ----
+    wire tick_us, tick_1s;
+    shared_500us_tick #(.CLOCK_HZ(`MR_CLOCK_HZ), .TICK_US(1)) u_tick_1us (
+        .clk(sys_clk), .rst_n(rst_n), .tick(tick_us)
+    );
+    shared_500us_tick #(.CLOCK_HZ(`MR_CLOCK_HZ), .TICK_US(1000000)) u_tick_1s (
+        .clk(sys_clk), .rst_n(rst_n), .tick(tick_1s)
+    );
+
+    prod2u_por #(.POR_CYCLES(1024)) u_por (.sys_clk(sys_clk), .sys_rst_n(rst_n));
+
+    // ---- host frontend (RS232 + shared TTL; TTL balls unbound) ----
+    wire selected_host_rx, shared_host_tx, host_locked, host_port_sel;
+    wire host_rs232_rx_sync, host_ttl_rx_sync;
+    wire host_transaction_done;
+    host_port_selector #(.IDLE_UNLOCK_CLKS(1250000)) u_host_select (
+        .clk(sys_clk), .rst_n(rst_n), .rs232_rx_async(host_rs232_rx),
+        .ttl_rx_async(host_ttl_rx), .shared_tx(shared_host_tx),
+        .transaction_done(host_transaction_done), .selected_rx(selected_host_rx),
+        .rs232_tx(host_rs232_tx), .ttl_tx(host_ttl_tx), .locked(host_locked),
+        .port_sel(host_port_sel), .rs232_rx_sync(host_rs232_rx_sync),
+        .ttl_rx_sync(host_ttl_rx_sync)
+    );
+    wire host_rx_valid, host_rx_error;
+    wire [7:0] host_rx_data;
+    uart_rx_byte #(.CLKS_PER_BIT(`MR_HOST_CLKS_PER_BIT)) u_host_rx (
+        .clk(sys_clk), .rst_n(rst_n), .rx_i(selected_host_rx),
+        .byte_valid(host_rx_valid), .byte_data(host_rx_data),
+        .framing_error(host_rx_error)
+    );
+
+    // ---- frame path (shared CRC) ----
+    wire frame_valid, frame_ready, frame_accept_enable;
+    wire [7:0] frame_type;
+    wire [15:0] frame_length;
+    wire payload_wr_en;
+    wire [15:0] payload_wr_addr;
+    wire [7:0] payload_wr_data;
+    wire [15:0] payload_rd_addr;
+    wire [7:0] payload_rd_data;
+    wire host_crc_start, host_crc_data_valid, host_crc_data_done, host_crc_busy;
+    wire [7:0] host_crc_data;
+    wire [15:0] host_crc_value;
+    wire host_rx_crc_start, host_rx_crc_data_valid, host_tx_crc_start, host_tx_crc_data_valid;
+    wire [7:0] host_rx_crc_data, host_tx_crc_data;
+    wire host_crc_start = host_rx_crc_start || host_tx_crc_start;
+    wire host_crc_data_valid = host_rx_crc_data_valid || host_tx_crc_data_valid;
+    wire [7:0] host_crc_data = host_rx_crc_data_valid ? host_rx_crc_data : host_tx_crc_data;
+
+    frame_rx #(.MAX_PAYLOAD(`MR_MAX_REQUEST_PAYLOAD),
+        .INTER_BYTE_TIMEOUT_CYCLES(250000),
+        .EXTERNAL_CRC(1)) u_frame_rx (
+        .clk(sys_clk), .rst_n(rst_n), .byte_valid(host_rx_valid),
+        .byte_data(host_rx_data), .accept_enable(frame_accept_enable),
+        .frame_valid(frame_valid), .frame_ready(frame_ready),
+        .frame_type(frame_type), .frame_length(frame_length),
+        .payload_read_addr(payload_rd_addr), .payload_read_data(payload_rd_data),
+        .payload_wr_en(payload_wr_en), .payload_wr_addr(payload_wr_addr),
+        .payload_wr_data(payload_wr_data),
+        .crc_start_o(host_rx_crc_start), .crc_data_valid_o(host_rx_crc_data_valid),
+        .crc_data_o(host_rx_crc_data), .crc_busy_i(host_crc_busy),
+        .crc_data_done_i(host_crc_data_done), .crc_value_i(host_crc_value)
+    );
+    payload_ram #(.DEPTH(`MR_MAX_REQUEST_PAYLOAD), .ADDR_WIDTH(8)) u_payload (
+        .clk(sys_clk), .wr_en(payload_wr_en), .wr_addr(payload_wr_addr),
+        .wr_data(payload_wr_data), .rd_addr(payload_rd_addr), .rd_data(payload_rd_data)
+    );
+
+    // ---- command core ----
+    wire thermal_wr_en, thermal_commit, thermal_commit_done, thermal_commit_ok;
+    wire [2:0] thermal_wr_addr;
+    wire [7:0] thermal_wr_data;
+    wire keepalive_reload, snapshot_capture, snapshot_ready;
+    wire qw_byte_we, qw_submit, qw_accept, ctl_valid, ctl_accept;
+    wire [6:0] qw_byte_addr;
+    wire [7:0] qw_byte_data;
+    wire [3:0] qw_count;
+    wire [7:0] qw_status, ctl_status;
+    wire [15:0] qw_detail, ctl_detail;
+    wire [2:0] ctl_op;
+    wire [15:0] ctl_axis_mask;
+    wire [7:0] ctl_flags;
+    wire [31:0] ctl_value;
+    wire [7:0] ev_rd_index, ev_count, ev_overflow, ev_clear_count;
+    wire ev_hold, ev_clear_n;
+    wire [127:0] ev_rd_data;
+    wire [7:0] status_byte_in;
+    wire tx_start, tx_done, frame_tx_busy, frame_tx_byte_valid;
+    wire [7:0] tx_frame_type, tx_payload_data, frame_tx_byte_data;
+    wire [15:0] tx_payload_length, frame_tx_payload_addr;
+    wire [7:0] ack_payload_data;
+    wire host_command_busy;
+
+    mrdimm_host_command #(.SNAPSHOT_LENGTH(`MR_SNAPSHOT_LENGTH)) u_command (
+        .clk(sys_clk), .rst_n(rst_n),
+        .frame_valid(frame_valid), .frame_ready(frame_ready),
+        .frame_accept_enable(frame_accept_enable), .frame_type(frame_type),
+        .frame_length(frame_length),
+        .payload_read_addr(payload_rd_addr), .payload_read_data(payload_rd_data),
+        .thermal_wr_en(thermal_wr_en), .thermal_wr_addr(thermal_wr_addr),
+        .thermal_wr_data(thermal_wr_data), .thermal_commit(thermal_commit),
+        .thermal_commit_done(thermal_commit_done), .thermal_commit_ok(thermal_commit_ok),
+        .lease_active(lease_active), .keepalive_reload(keepalive_reload),
+        .snapshot_capture(snapshot_capture), .snapshot_ready(snapshot_ready),
+        .qw_byte_we(qw_byte_we), .qw_byte_addr(qw_byte_addr),
+        .qw_byte_data(qw_byte_data), .qw_submit(qw_submit), .qw_count(qw_count),
+        .qw_accept(qw_accept), .qw_status(qw_status), .qw_detail(qw_detail),
+        .ctl_valid(ctl_valid), .ctl_op(ctl_op), .ctl_axis_mask(ctl_axis_mask),
+        .ctl_flags(ctl_flags), .ctl_value(ctl_value),
+        .ctl_accept(ctl_accept), .ctl_status(ctl_status), .ctl_detail(ctl_detail),
+        .ev_rd_index(ev_rd_index), .ev_hold(ev_hold),
+        .ev_rd_data(ev_rd_data), .ev_count(ev_count), .ev_overflow(ev_overflow),
+        .ev_clear_n(ev_clear_n), .ev_clear_count(ev_clear_count),
+        .status_byte_in(status_byte_in),
+        .tx_payload_addr(frame_tx_payload_addr),
+        .ack_payload_data(ack_payload_data), .tx_payload_data(tx_payload_data),
+        .tx_start(tx_start), .tx_frame_type(tx_frame_type),
+        .tx_payload_length(tx_payload_length), .tx_done(host_response_done),
+        .transaction_done(host_transaction_done), .busy(host_command_busy)
+    );
+
+    wire lease_active;
+    mrdimm_output_core #(
+        .BOOT_FAN_PERCENT(`MR_BOOT_FAN_PERCENT), .BOOT_PTC_PERCENT(`MR_BOOT_PTC_PERCENT),
+        .EXPIRE_FAN_PERCENT(`MR_EXPIRE_FAN_PERCENT), .EXPIRE_PTC_PERCENT(`MR_EXPIRE_PTC_PERCENT),
+        .LEASE_SECONDS(`MR_LEASE_SECONDS), .PWM_PERIOD_CLKS(`MR_PWM_PERIOD_CLKS),
+        .PWM_CLKS_PER_PERCENT(`MR_PWM_CLKS_PER_PERCENT)
+    ) u_output (
+        .clk(sys_clk), .rst_n(rst_n), .tick_1s(tick_1s),
+        .wr_en(thermal_wr_en), .wr_addr(thermal_wr_addr), .wr_data(thermal_wr_data),
+        .commit(thermal_commit), .commit_done(thermal_commit_done),
+        .commit_ok(thermal_commit_ok), .keepalive_reload(keepalive_reload),
+        .applied_fan(applied_fan_w), .applied_ptc(applied_ptc_w),
+        .manual_active(), .lease_active(lease_active),
+        .watchdog_remaining(watchdog_remaining),
+        .fan_pwm_on(fan_on), .ptc_pwm_on(ptc_on)
+    );
+    wire [7:0] applied_fan_w [0:3];
+    wire [7:0] applied_ptc_w [0:3];
+    wire [7:0] watchdog_remaining;
+
+    // ---- motor engine ----
+    motor_engine #(
+        .AXIS_COUNT(3),
+        .X_DEFAULT_HALF_US(`MR_XY_DEFAULT_HALF_US), .Y_DEFAULT_HALF_US(`MR_XY_DEFAULT_HALF_US),
+        .Z_DEFAULT_HALF_US(`MR_Z_DEFAULT_HALF_US),
+        .X_MIN_HALF_US(`MR_XY_MIN_HALF_US), .Y_MIN_HALF_US(`MR_XY_MIN_HALF_US),
+        .Z_MIN_HALF_US(`MR_Z_MIN_HALF_US),
+        .DIR_SETUP_TICKS(`MR_DIR_SETUP_TICKS), .DIR_LOWER_LEVEL(1'b0)
+    ) u_motor (
+        .clk(sys_clk), .rst_n(rst_n), .tick_us(tick_us),
+        .limit_lower_raw(limit_lower_raw), .limit_upper_raw(limit_upper_raw),
+        .qw_byte_we(qw_byte_we), .qw_byte_addr(qw_byte_addr),
+        .qw_byte_data(qw_byte_data), .qw_submit(qw_submit), .qw_count(qw_count),
+        .qw_accept(qw_accept), .qw_status(qw_status), .qw_detail(qw_detail),
+        .ctl_valid(ctl_valid), .ctl_op(ctl_op), .ctl_axis_mask(ctl_axis_mask),
+        .ctl_flags(ctl_flags), .ctl_value(ctl_value),
+        .ctl_accept(ctl_accept), .ctl_status(ctl_status), .ctl_detail(ctl_detail),
+        .startup_seek(boot_seek),
+        .ev_rd_index(ev_rd_index), .ev_hold(ev_hold),
+        .ev_rd_data(ev_rd_data), .ev_count(ev_count), .ev_overflow(ev_overflow),
+        .ev_time_us(ev_time_us),
+        .ev_clear_n(ev_clear_n), .ev_clear_count(ev_clear_count),
+        .axis_telemetry(axis_telemetry),
+        .step_out({z_step, y_step, x_step}), .dir_out({z_dir, y_dir, x_dir})
+    );
+    wire [31:0] ev_time_us;
+    wire [287:0] axis_telemetry;
+    reg boot_seek;
+    always @(posedge sys_clk or negedge rst_n) begin
+        if (!rst_n) boot_seek <= 1'b1;      // power-on SEEK_LOWER x3
+        else boot_seek <= 1'b0;
+    end
+
+    // ---- ALL_STATUS snapshot ----
+    mrdimm_snapshot_mux #(.SNAPSHOT_LENGTH(`MR_SNAPSHOT_LENGTH)) u_snapshot (
+        .clk(sys_clk), .rst_n(rst_n), .capture(snapshot_capture), .ready(snapshot_ready),
+        .fan_applied(applied_fan_w), .ptc_applied(applied_ptc_w),
+        .axis_sel(axis_sel_r), .axis_data(axis_data_r),
+        .time_us(ev_time_us), .ev_count(ev_count), .ev_overflow(ev_overflow),
+        .read_addr(status_addr_r), .read_data(status_byte_in)
+    );
+    reg [1:0] axis_sel_r;
+    reg [95:0] axis_data_r;
+    reg [7:0] status_addr_r;
+    always @* begin
+        axis_sel_r = 2'd0;
+        axis_data_r = axis_telemetry[axis_sel_r*96 +: 96];
+        status_addr_r = frame_tx_payload_addr[7:0];
+    end
+
+    // ---- frame_tx + uart ----
+    wire frame_tx_done, host_tx_busy, host_tx_done;
+    frame_tx #(.PAYLOAD_IDX_BITS(8), .EXTERNAL_CRC(1), .PAYLOAD_READ_LATENCY(1)) u_frame_tx (
+        .clk(sys_clk), .rst_n(rst_n), .start(tx_start), .frame_type(tx_frame_type),
+        .payload_length(tx_payload_length), .busy(frame_tx_busy),
+        .byte_valid(frame_tx_byte_valid), .byte_data(frame_tx_byte_data),
+        .byte_ready(!host_tx_busy), .payload_addr(frame_tx_payload_addr),
+        .payload_data(tx_payload_data), .done(frame_tx_done),
+        .crc_start_o(host_tx_crc_start), .crc_data_valid_o(host_tx_crc_data_valid),
+        .crc_data_o(host_tx_crc_data), .crc_busy_i(host_crc_busy),
+        .crc_data_done_i(host_crc_data_done), .crc_value_i(host_crc_value)
+    );
+    crc16_serial u_host_crc (
+        .clk(sys_clk), .rst_n(rst_n), .start(host_crc_start),
+        .data_valid(host_crc_data_valid), .data(host_crc_data),
+        .busy(host_crc_busy), .data_done(host_crc_data_done), .crc(host_crc_value)
+    );
+    uart_tx_byte #(.CLKS_PER_BIT(`MR_HOST_CLKS_PER_BIT)) u_host_tx (
+        .clk(sys_clk), .rst_n(rst_n),
+        .byte_valid(frame_tx_byte_valid && !host_tx_busy),
+        .byte_data(frame_tx_byte_data), .tx_o(shared_host_tx),
+        .busy(host_tx_busy), .byte_done(host_tx_done)
+    );
+    wire host_response_done = host_tx_done && !frame_tx_busy;
+
+    // ---- BMC (optional telemetry) ----
+    wire bmc_rx_valid, bmc_rx_error, bmc_tx_valid, bmc_tx_busy, bmc_tx_done;
+    wire [7:0] bmc_rx_data, bmc_tx_data;
+    uart_rx_byte #(.CLKS_PER_BIT(`MR_BMC_CLKS_PER_BIT)) u_bmc_rx (
+        .clk(sys_clk), .rst_n(rst_n), .rx_i(bmc_rs232_rx),
+        .byte_valid(bmc_rx_valid), .byte_data(bmc_rx_data), .framing_error(bmc_rx_error)
+    );
+    wire [15:0] bmc_poll_count;
+    bmc_poll_engine u_bmc_poll (
+        .clk(sys_clk), .rst_n(rst_n), .tx_ready(!bmc_tx_busy),
+        .tx_valid(bmc_tx_valid), .tx_data(bmc_tx_data), .poll_count(bmc_poll_count)
+    );
+    uart_tx_byte #(.CLKS_PER_BIT(`MR_BMC_CLKS_PER_BIT)) u_bmc_tx (
+        .clk(sys_clk), .rst_n(rst_n),
+        .byte_valid(bmc_tx_valid && !bmc_tx_busy), .byte_data(bmc_tx_data),
+        .tx_o(bmc_rs232_tx), .busy(bmc_tx_busy), .byte_done(bmc_tx_done)
+    );
+
+    // ---- CT7428 acquisition (independent I2C master) ----
+    wire ct_request_valid, ct_request_ready, ct_response_valid, ct_response_ready;
+    wire [6:0] ct_device_addr;
+    wire [7:0] ct_register_addr;
+    wire [15:0] ct_response_data;
+    wire [3:0] ct_response_error;
+    wire ct_i2c_busy, ct_scl_drive_low, ct_sda_drive_low;
+    wire ct_snapshot_commit, ct_stale, ct_active_bank, ct_locked_bank;
+    wire [15:0] ct_epoch, ct_age;
+    wire [26:0] ct_valid_mask;
+    wire [4:0] ct_snapshot_index;
+    wire [15:0] ct_snapshot_raw;
+    wire ct_snapshot_valid;
+    wire ct_locked_bank_unused = ct_locked_bank;
+    ct7428_snapshot #(.SCAN_PERIOD_CLKS(2500000)) u_ct_snapshot (
+        .clk(sys_clk), .rst_n(rst_n), .tick_1s(tick_1s),
+        .snapshot_lock(1'b0), .snapshot_lock_bank(ct_locked_bank),
+        .request_valid(ct_request_valid), .request_ready(ct_request_ready),
+        .device_addr(ct_device_addr), .register_addr(ct_register_addr),
+        .response_valid(ct_response_valid), .response_ready(ct_response_ready),
+        .response_data(ct_response_data), .response_error(ct_response_error),
+        .snapshot_commit(ct_snapshot_commit), .epoch(ct_epoch), .age_seconds(ct_age),
+        .stale(ct_stale), .active_bank(ct_active_bank), .active_valid_mask(ct_valid_mask),
+        .control_bank(ct_active_bank), .control_index(), .control_raw(),
+        .control_valid(), .snapshot_bank(ct_locked_bank),
+        .snapshot_index(ct_snapshot_index), .snapshot_raw(ct_snapshot_raw),
+        .snapshot_valid(ct_snapshot_valid)
+    );
+    i2c_word_reader #(.HALF_PERIOD_CLKS(125), .TIMEOUT_CLKS(25000)) u_ct_i2c (
+        .clk(sys_clk), .rst_n(rst_n),
+        .request_valid(ct_request_valid), .request_ready(ct_request_ready),
+        .request_device_addr(ct_device_addr), .request_register(ct_register_addr),
+        .response_valid(ct_response_valid), .response_ready(ct_response_ready),
+        .response_data(ct_response_data), .response_error(ct_response_error),
+        .busy(ct_i2c_busy), .scl_i(temp_scl), .sda_i(temp_sda),
+        .scl_drive_low(ct_scl_drive_low), .sda_drive_low(ct_sda_drive_low)
+    );
+    assign temp_scl = ct_scl_drive_low ? 1'b0 : 1'bz;
+    assign temp_sda = ct_sda_drive_low ? 1'b0 : 1'bz;
+
+    // ---- Host I2C mailbox (PRODUCT=1: mrdimm command table) ----
+    wire i2c_write_strobe, i2c_command_strobe, i2c_command_write_blocked;
+    wire [15:0] i2c_write_address, i2c_read_address;
+    wire [7:0] i2c_write_data, i2c_command_data, i2c_read_data;
+    wire i2c_sda_drive_low;
+    host_i2c_register_slave #(.SLAVE_ADDRESS(`MR_HOST_I2C_ADDRESS)) u_host_i2c_slave (
+        .clk(sys_clk), .rst_n(rst_n), .scl_i(host_i2c_scl), .sda_io(host_i2c_sda),
+        .write_strobe(i2c_write_strobe), .write_address(i2c_write_address),
+        .write_data(i2c_write_data),
+        .command_strobe(i2c_command_strobe), .command_data(i2c_command_data),
+        .command_write_blocked(i2c_command_write_blocked),
+        .read_address(i2c_read_address), .read_data(i2c_read_data),
+        .response_valid(), .response_status(), .response_command(),
+        .response_detail(), .response_length(), .snapshot_length(),
+        .snapshot_data(status_byte_in), .sda_drive_low(i2c_sda_drive_low), .busy()
+    );
+    host_i2c_register_bank #(.PRODUCT(1)) u_host_i2c_bank (
+        .clk(sys_clk), .rst_n(rst_n), .write_strobe(i2c_write_strobe),
+        .write_address(i2c_write_address), .write_data(i2c_write_data),
+        .command_strobe(i2c_command_strobe), .command_data(i2c_command_data),
+        .read_address(i2c_read_address), .read_data(i2c_read_data),
+        .response_valid(), .response_status(), .response_command(),
+        .response_detail(), .response_length(), .snapshot_length(),
+        .snapshot_data(status_byte_in),
+        .manual_wr_en(i2c_thermal_wr_en), .manual_wr_addr(i2c_thermal_addr),
+        .manual_wr_data(i2c_thermal_data), .manual_commit(i2c_thermal_commit),
+        .manual_commit_done(thermal_commit_done_i2c),
+        .manual_commit_ok(thermal_commit_ok_i2c),
+        .capture_request(i2c_capture), .transaction_done(i2c_transaction_done),
+        .command_write_blocked(i2c_command_write_blocked),
+        .snapshot_ready(snapshot_ready),
+        .hard_protect(1'b0), .manual_active(lease_active),
+        .watchdog_active(lease_active), .watchdog_remaining(watchdog_remaining),
+        .bmc_valid(|bmc_valid_mask), .bmc_stale(bmc_stale),
+        .ct_valid(|ct_valid_mask), .product_fault(1'b0),
+        .qw_byte_we(i2c_qw_byte_we), .qw_byte_addr(i2c_qw_byte_addr),
+        .qw_byte_data(i2c_qw_byte_data), .qw_submit(i2c_qw_submit),
+        .qw_count(i2c_qw_count), .qw_accept(i2c_qw_accept),
+        .qw_status(i2c_qw_status), .qw_detail(i2c_qw_detail),
+        .ctl_valid(i2c_ctl_valid), .ctl_op(i2c_ctl_op),
+        .ctl_axis_mask(i2c_ctl_mask), .ctl_flags(i2c_ctl_flags),
+        .ctl_value(i2c_ctl_value), .ctl_accept(i2c_ctl_accept),
+        .ctl_status(i2c_ctl_status), .ctl_detail(i2c_ctl_detail),
+        .ev_rd_index(i2c_ev_rd_index), .ev_hold(i2c_ev_hold),
+        .ev_rd_data(i2c_ev_rd_data), .ev_count(ev_count), .ev_overflow(ev_overflow),
+        .ev_clear_n(i2c_ev_clear_n), .ev_clear_count(i2c_ev_clear_count),
+        .status_byte_in(status_byte_in), .cmd_tx_payload_data()
+    );
+    wire i2c_thermal_wr_en, i2c_thermal_commit, thermal_commit_done_i2c, thermal_commit_ok_i2c;
+    wire [2:0] i2c_thermal_addr;
+    wire [7:0] i2c_thermal_data;
+    wire i2c_capture, i2c_transaction_done;
+    wire i2c_qw_byte_we, i2c_qw_submit, i2c_qw_accept, i2c_ctl_valid, i2c_ctl_accept;
+    wire [6:0] i2c_qw_byte_addr;
+    wire [7:0] i2c_qw_byte_data, i2c_qw_status, i2c_ctl_status, i2c_ev_rd_index_w;
+    wire [3:0] i2c_qw_count;
+    wire [15:0] i2c_qw_detail, i2c_ctl_detail;
+    wire [2:0] i2c_ctl_op;
+    wire [15:0] i2c_ctl_mask;
+    wire [7:0] i2c_ctl_flags, i2c_ev_clear_count;
+    wire [31:0] i2c_ctl_value;
+    wire i2c_ev_hold, i2c_ev_clear_n;
+    wire [127:0] i2c_ev_rd_data;
+    wire bmc_stale;
+    wire [23:0] bmc_valid_mask;
+    assign i2c_ev_rd_index = i2c_ev_rd_index_w;
+    // I2C engine arbitration with the UART engine: distinct Host submits are
+    // undefined per contract; mux thermal writes with I2C priority.
+    wire thermal_wr_en_mux = thermal_wr_en | i2c_thermal_wr_en;
+    wire [2:0] thermal_addr_mux = i2c_thermal_wr_en ? i2c_thermal_addr : thermal_wr_addr;
+    wire [7:0] thermal_data_mux = i2c_thermal_wr_en ? i2c_thermal_data : thermal_wr_data;
+    wire thermal_commit_mux = thermal_commit | i2c_thermal_commit;
+    wire thermal_commit_done_mux = thermal_commit_done | thermal_commit_done_i2c;
+    wire thermal_commit_ok_mux = thermal_commit_ok | thermal_commit_ok_i2c;
+
+    wire unused = &{1'b0, host_locked, host_port_sel, frame_tx_busy, frame_tx_done,
+        host_tx_done, host_rs232_rx_sync, host_ttl_rx_sync, host_command_busy,
+        bmc_tx_done, bmc_poll_count, ct_snapshot_commit, ct_i2c_busy, bmc_rx_error,
+        ct_snapshot_valid, ct_snapshot_raw, ct_snapshot_index, host_rx_error};
+
+endmodule

+ 67 - 2
src/transport/host_i2c_register_bank.v

@@ -1,5 +1,6 @@
 `timescale 1ns/1ps
 `include "generated/6400/prod2u_6400_v1_params.vh"
+`include "generated/mrdimm/prod2u_mrdimm_params.vh"
 
 // Host-I2C frontend register bank (2026 fixed mailbox).
 //
@@ -24,7 +25,11 @@
 // completion: RESPONSE_* publish atomically when the core finishes.  Payload
 // writes cannot alter a command already submitted: the core reads the staging
 // RAM live, but writes are only accepted while no transaction is running.
-module host_i2c_register_bank (
+module host_i2c_register_bank #(
+    // 0 = 6400-front-rear command table, 1 = mrdimm-chamber command table.
+    // One mailbox, one command-table implementation per product.
+    parameter integer PRODUCT = 0
+) (
     input  wire       clk,
     input  wire       rst_n,
     input  wire       write_strobe,
@@ -58,7 +63,35 @@ module host_i2c_register_bank (
     input  wire       bmc_valid,
     input  wire       bmc_stale,
     input  wire       ct_valid,
-    input  wire       product_fault
+    input  wire       product_fault,
+    // motor engine + event ring passthrough (used when PRODUCT=1)
+    output wire        qw_byte_we,
+    output wire [6:0]  qw_byte_addr,
+    output wire [7:0]  qw_byte_data,
+    output wire        qw_submit,
+    output wire [3:0]  qw_count,
+    input  wire        qw_accept,
+    input  wire [7:0]  qw_status,
+    input  wire [15:0] qw_detail,
+    output wire        ctl_valid,
+    output wire [2:0]  ctl_op,
+    output wire [15:0] ctl_axis_mask,
+    output wire [7:0]  ctl_flags,
+    output wire [31:0] ctl_value,
+    input  wire        ctl_accept,
+    input  wire [7:0]  ctl_status,
+    input  wire [15:0] ctl_detail,
+    output wire [7:0]  ev_rd_index,
+    output wire        ev_hold,
+    input  wire [127:0] ev_rd_data,
+    input  wire [7:0]  ev_count,
+    input  wire [7:0]  ev_overflow,
+    output wire        ev_clear_n,
+    output wire [7:0]  ev_clear_count,
+    input  wire [7:0]  status_byte_in,
+    // full tx payload source for products whose command core internalizes
+    // the response data path (PRODUCT=1); undriven for 6400
+    output wire [7:0]  cmd_tx_payload_data
 );
     localparam [7:0] RSP_ACK = `FB_RSP_ACK_NACK;
     localparam [7:0] CMD_GET_ALL = `FB_CMD_GET_ALL;
@@ -106,6 +139,8 @@ module host_i2c_register_bank (
         .rd_data(i2c_payload_rd_data)
     );
 
+    generate
+        if (PRODUCT == 0) begin : g_cmd_6400
     thermal_host_command #(.SNAPSHOT_LENGTH(`FB_SNAPSHOT_LENGTH)) u_i2c_command (
         .clk(clk), .rst_n(rst_n),
         .frame_valid(req_start), .frame_ready(), .frame_accept_enable(),
@@ -122,6 +157,36 @@ module host_i2c_register_bank (
         .ack_payload_data(i2c_ack_payload_data), .tx_done(fake_tx_done),
         .transaction_done(i2c_transaction_done), .busy(i2c_core_busy)
     );
+        end else begin : g_cmd_mrdimm
+    mrdimm_host_command #(.SNAPSHOT_LENGTH(`MR_SNAPSHOT_LENGTH)) u_i2c_command (
+        .clk(clk), .rst_n(rst_n),
+        .frame_valid(req_start), .frame_ready(), .frame_accept_enable(),
+        .frame_type(staged_type), .frame_length(staged_length),
+        .payload_read_addr(i2c_payload_rd_addr), .payload_read_data(i2c_payload_rd_data),
+        .thermal_wr_en(manual_wr_en), .thermal_wr_addr(manual_wr_addr),
+        .thermal_wr_data(manual_wr_data), .thermal_commit(manual_commit),
+        .thermal_commit_done(manual_commit_done), .thermal_commit_ok(manual_commit_ok),
+        .lease_active(watchdog_active), .keepalive_reload(i2c_keepalive),
+        .snapshot_capture(capture_request), .snapshot_ready(snapshot_ready),
+        .qw_byte_we(qw_byte_we), .qw_byte_addr(qw_byte_addr),
+        .qw_byte_data(qw_byte_data), .qw_submit(qw_submit), .qw_count(qw_count),
+        .qw_accept(qw_accept), .qw_status(qw_status), .qw_detail(qw_detail),
+        .ctl_valid(ctl_valid), .ctl_op(ctl_op), .ctl_axis_mask(ctl_axis_mask),
+        .ctl_flags(ctl_flags), .ctl_value(ctl_value),
+        .ctl_accept(ctl_accept), .ctl_status(ctl_status), .ctl_detail(ctl_detail),
+        .ev_rd_index(ev_rd_index), .ev_hold(ev_hold),
+        .ev_rd_data(ev_rd_data), .ev_count(ev_count), .ev_overflow(ev_overflow),
+        .ev_clear_n(ev_clear_n), .ev_clear_count(ev_clear_count),
+        .status_byte_in(status_byte_in),
+        .tx_payload_addr(i2c_tx_payload_addr),
+        .ack_payload_data(i2c_ack_payload_data),
+        .tx_payload_data(cmd_tx_payload_data),
+        .tx_start(i2c_tx_start), .tx_frame_type(i2c_tx_frame_type),
+        .tx_payload_length(i2c_tx_payload_length), .tx_done(fake_tx_done),
+        .transaction_done(i2c_transaction_done), .busy(i2c_core_busy)
+    );
+        end
+    endgenerate;
 
     // The I2C frontend has no UART byte stream, so the frame_tx handshake is
     // emulated.  ACK phase: walk the 4-byte response payload past the core's

+ 6 - 6
src/transport/mrdimm_host_command.v

@@ -65,7 +65,8 @@ module mrdimm_host_command #(
     // ALL_STATUS payload: byte window from the snapshot mux, addressed by
     // tx_payload_addr with one cycle of read latency
     input  wire [7:0] status_byte_in,
-    output reg  [15:0] tx_payload_addr,
+    input  wire [15:0] tx_payload_addr,
+    output wire [7:0]  ack_payload_data,
     output reg        tx_start,
     output reg  [7:0]  tx_frame_type,
     output reg  [15:0] tx_payload_length,
@@ -167,6 +168,8 @@ module mrdimm_host_command #(
         end
     end
     wire [7:0] tx_payload_data = tx_payload_data_r;
+    // Bank fake-tx ACK capture walks this mux with tx_payload_addr 0..3.
+    assign ack_payload_data = ack_word[tx_payload_addr[3:0]*8 +: 8];
 
     always @(posedge clk or negedge rst_n) begin
         if (!rst_n) begin
@@ -184,7 +187,6 @@ module mrdimm_host_command #(
             qw_len <= 0;
             payload_read_addr <= 0;
             tx_start <= 0; tx_frame_type <= RSP_ACK; tx_payload_length <= 0;
-            tx_payload_addr <= 0;
             transaction_done <= 0;
             status_valid <= 0; event_valid <= 0;
         end else begin
@@ -429,15 +431,13 @@ module mrdimm_host_command #(
                     if (ack_ok && ack_request == T_GET_ALL) begin
                         tx_frame_type <= RSP_STATUS;
                         tx_payload_length <= SNAPSHOT_LENGTH[15:0];
-                        tx_payload_addr <= 0;
-                        tx_start <= 1;
+                                    tx_start <= 1;
                         state <= ST_DATA_TX;
                     end else if (ack_ok && ack_request == T_EVREAD) begin
                         tx_frame_type <= RSP_EVENT;
                         // 1 + 16*N bytes
                         tx_payload_length <= {9'd0, ev_freeze_count, 4'd0} + 16'd1;
-                        tx_payload_addr <= 0;
-                        tx_start <= 1;
+                                    tx_start <= 1;
                         state <= ST_DATA_TX;
                     end else begin
                         transaction_done <= 1;