Explorar el Código

feat(mrdimm): wire host TTL UART to CON140 and add full E2E test suite

Prod2U Recovery hace 2 meses
padre
commit
bcbed7b643

+ 1 - 0
.gitignore

@@ -74,6 +74,7 @@ tools/board-viewer/generated-v1_1/**
 reference/original/board/FCB_FPGA_MCU_V1.1_20260625/*.brd
 reference/original/board/FCB_FPGA_MCU_V1.2_20260717/*.brd
 reference/original/board/FCB_FPGA_MCU_V2.0_20260914/*.brd
+reference/original/schematics/8000高温罩电气图V1.2.pdf
 reference/original/schematics/8000高温罩电气图V2.0.pdf
 reference/original/schematics/6400高温罩电气图V2.0.pdf
 # Local run / probe residue (never re-track at repo root)

+ 2 - 1
config/current-product-tests.json

@@ -59,7 +59,8 @@
         "frame_rx_boundaries_tb",
         "frame_tx_tb",
         "prod2u_mrdimm_uart_e2e_tb",
-        "prod2u_mrdimm_final_e2e_tb"
+        "prod2u_mrdimm_final_e2e_tb",
+        "prod2u_mrdimm_ttl_e2e_tb"
       ],
       "unit_tests": [
         "tests/unit/test_mrdimm_full_status_schema.py"

+ 3 - 3
constraints/prod2u_mrdimm.adc

@@ -2,12 +2,12 @@
 # config/pin_inventory.prod2u_door_temp_v1_2.json fcb_fpga_mcu_v1_2_20260717,
 # status evidence_matrix_v1_2_e2e).  Motor seats overridden to the current
 # direct 3.3V CON142/126/127 wiring per the active board authority;
-# the superseded NPN-buffered seats appear in comments.
-# NOT BOUND on this product (no V1.2 evidence; wrapper holds idle):
-#   host_ttl_rx/tx. The retired Host I2C is absent from this product.
+# Host RS232 (CON78) and Host TTL (CON140):
 set_pin_assignment { sys_clk } { LOCATION = J1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }
 set_pin_assignment { host_rs232_tx } { LOCATION = M10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }  # CON78.1
 set_pin_assignment { host_rs232_rx } { LOCATION = N11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }  # CON78.2
+set_pin_assignment { host_ttl_tx } { LOCATION = T11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }  # CON140.1 (EX_GPIO29)
+set_pin_assignment { host_ttl_rx } { LOCATION = P13; IOSTANDARD = LVCMOS33; PULLTYPE = PULLUP; }  # CON140.2 (EX_GPIO30)
 set_pin_assignment { temp_scl } { LOCATION = M8; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }  # CT7428 bus
 set_pin_assignment { temp_sda } { LOCATION = N9; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }  # CT7428 bus
 set_pin_assignment { ptc_pwm_out[0] } { LOCATION = G16; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }  # chamber1 physical A

+ 3 - 4
projects/registry.json

@@ -92,11 +92,10 @@
       "release_pin_policy": "confirmed_exported_pads_only",
       "production_bitstream": "requires_qualified_receipt",
       "hardware_host_interfaces": [
-        "CON78_RS232_921600_8N1"
-      ],
-      "unbound_interfaces": [
-        "host_ttl"
+        "CON78_RS232_921600_8N1",
+        "CON140_TTL_921600_8N1"
       ],
+      "unbound_interfaces": [],
       "frame_protocol": "A5 5A | TYPE:u8 | LENGTH:u8 | PAYLOAD | CRC_L | CRC_H (CRC-16/CCITT-FALSE)"
     },
     "6400-v2": {

+ 1 - 0
reference/original/schematics/8000高温罩电气图V1.2.pdf.sha256

@@ -0,0 +1 @@
+7ebd0dced194338ceb97ff5a0abcee2d9790e7f6e7a90d9d4be7de593dca7eb5  8000高温罩电气图V1.2.pdf

+ 11 - 11
src/top/prod2u_mrdimm_rs232_only_top.v

@@ -1,18 +1,19 @@
 `timescale 1ns/1ps
 
-// RS-232-only physical wrapper for the mrdimm-chamber product (FCB V1.2).
+// Physical top wrapper for the mrdimm-chamber product (FCB V1.2).
 //
-// The V1.2 pin inventory (fcb_fpga_mcu_v1_2_20260717) provides no evidence
-// for BMC UART or Host I2C pads, so per the pad contract those interfaces
-// are held at logic idle inside this wrapper and are NOT exported to
-// package ports - TD cannot auto-place them onto unrelated board signals.
-// They remain LOGIC_TESTED, not PAD_BOUND; this is not a third product.
-// The Host TTL interface is likewise unproven on V1.2.
+// Host interfaces:
+//   - CON78 RS232: TX = M10, RX = N11 (921600 8N1)
+//   - CON140 TTL:   TX = T11, RX = P13 (921600 8N1)
+// BMC UART and Host I2C remain unproven and held idle.
 module prod2u_mrdimm_rs232_only_top (
     input  wire        sys_clk,
     input  wire        host_rs232_rx,
     output wire        host_rs232_tx,
-    inout wire temp_scl,temp_sda,
+    input  wire        host_ttl_rx,
+    output wire        host_ttl_tx,
+    inout  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,
@@ -22,15 +23,14 @@ module prod2u_mrdimm_rs232_only_top (
     output wire        y_step, y_dir,
     output wire        z_step, z_dir
 );
-    wire host_ttl_tx_unused;
     wire bmc_rs232_tx_unused;
 
     prod2u_mrdimm_final_top core (
         .sys_clk(sys_clk),
         .host_rs232_rx(host_rs232_rx),
         .host_rs232_tx(host_rs232_tx),
-        .host_ttl_rx(1'b1),                 // absent TTL input: UART idle
-        .host_ttl_tx(host_ttl_tx_unused),   // not exported
+        .host_ttl_rx(host_ttl_rx),
+        .host_ttl_tx(host_ttl_tx),
         .bmc_rs232_rx(1'b1),                // absent BMC: UART idle
         .bmc_rs232_tx(bmc_rs232_tx_unused), // not exported
         .temp_scl(temp_scl),

+ 532 - 0
tests/sim/prod2u_mrdimm_ttl_e2e_tb.v

@@ -0,0 +1,532 @@
+`timescale 1ns/1ps
+
+// Full E2E bit-level simulation testbench for MRDIMM Host TTL Interface (CON140: T11=TX, P13=RX).
+//
+// This testbench verifies:
+// 1. Bit-level UART communication at 921600 baud (25 MHz clock) through host_ttl_rx.
+// 2. Broadcast reply transmission through host_ttl_tx (and mirrored on host_rs232_tx).
+// 3. Complete GET_ALL / GET_ACK / GET_DATA cycle initiated over TTL.
+// 4. SET_ALL cycle over TTL with motor movement (Axis 0) and thermal PWM duty changes.
+// 5. Limit detection and clean MOTOR_DONE reporting over TTL.
+// 6. STOP_CLEAR abort over TTL.
+// 7. Interleaved dual-port operation: TTL and RS232 taking turns seamlessly.
+// 8. Corrupted / Bad CRC frame recovery over TTL.
+module prod2u_mrdimm_ttl_e2e_tb;
+    localparam integer BIT_CLKS = 27; // 921600 baud @ 25 MHz
+    reg clk = 1'b0;
+    reg rst_n = 1'b0;
+
+    // Both UART lines
+    reg rs232_rx = 1'b1;
+    wire rs232_tx;
+    reg ttl_rx = 1'b1;
+    wire ttl_tx;
+
+    reg [2:0] limit_lower_raw = 3'd0;
+    reg [2:0] limit_upper_raw = 3'd0;
+
+    wire [7:0] ptc_pwm_out;
+    wire [3:0] fan_pwm_out;
+    wire motor_en_n;
+    wire x_step, x_dir;
+    wire y_step, y_dir;
+    wire z_step, z_dir;
+
+    always #20 clk = ~clk; // 25 MHz (40ns period)
+
+    prod2u_mrdimm_final_top #(
+        .CLOCK_HZ(25000000),
+        .HOST_BAUD(921600),
+        .BMC_BAUD(115200),
+        .PWM_PERIOD_CLKS(5000),
+        .PWM_CLKS_PER_PERCENT(50),
+        .HOST_TIMEOUT_CYCLES(2500)
+    ) dut (
+        .sys_clk(clk),
+        .host_rs232_rx(rs232_rx),
+        .host_rs232_tx(rs232_tx),
+        .host_ttl_rx(ttl_rx),
+        .host_ttl_tx(ttl_tx),
+        .bmc_rs232_rx(1'b1),
+        .bmc_rs232_tx(),
+        .temp_scl(),
+        .temp_sda(),
+        .limit_lower_raw(limit_lower_raw),
+        .limit_upper_raw(limit_upper_raw),
+        .ptc_pwm_out(ptc_pwm_out),
+        .fan_pwm_out(fan_pwm_out),
+        .motor_en_n(motor_en_n),
+        .x_step(x_step), .x_dir(x_dir),
+        .y_step(y_step), .y_dir(y_dir),
+        .z_step(z_step), .z_dir(z_dir)
+    );
+
+    // Byte-wise CRC over TYPE, LENGTH and PAYLOAD (excludes header A5 5A)
+    reg [7:0] frame_bytes [0:255];
+    function [15:0] crc_over_frame;
+        input integer count;
+        integer i;
+        integer b;
+        reg [15:0] c;
+        reg [7:0]  d;
+        begin
+            c = 16'hFFFF;
+            for (i = 2; i < count; i = i + 1) begin
+                d = frame_bytes[i];
+                for (b = 7; b >= 0; b = b - 1)
+                    c = (c[15] ^ d[b]) ? ({c[14:0], 1'b0} ^ 16'h1021)
+                                       : {c[14:0], 1'b0};
+            end
+            crc_over_frame = c;
+        end
+    endfunction
+
+    // UART TX byte task to TTL RX
+    task ttl_send_byte;
+        input [7:0] value;
+        integer b;
+        begin
+            ttl_rx = 1'b0;
+            repeat (BIT_CLKS) @(posedge clk);
+            for (b = 0; b < 8; b = b + 1) begin
+                ttl_rx = value[b];
+                repeat (BIT_CLKS) @(posedge clk);
+            end
+            ttl_rx = 1'b1;
+            repeat (BIT_CLKS) @(posedge clk);
+        end
+    endtask
+
+    // UART TX frame task to TTL RX
+    task ttl_send_frame;
+        input integer n;
+        integer i;
+        reg [15:0] c;
+        begin
+            c = crc_over_frame(n);
+            for (i = 0; i < n; i = i + 1)
+                ttl_send_byte(frame_bytes[i]);
+            ttl_send_byte(c[7:0]);
+            ttl_send_byte(c[15:8]);
+        end
+    endtask
+
+    // UART TX frame task to RS232 RX (for dual-port tests)
+    task rs232_send_byte;
+        input [7:0] value;
+        integer b;
+        begin
+            rs232_rx = 1'b0;
+            repeat (BIT_CLKS) @(posedge clk);
+            for (b = 0; b < 8; b = b + 1) begin
+                rs232_rx = value[b];
+                repeat (BIT_CLKS) @(posedge clk);
+            end
+            rs232_rx = 1'b1;
+            repeat (BIT_CLKS) @(posedge clk);
+        end
+    endtask
+
+    task rs232_send_frame;
+        input integer n;
+        integer i;
+        reg [15:0] c;
+        begin
+            c = crc_over_frame(n);
+            for (i = 0; i < n; i = i + 1)
+                rs232_send_byte(frame_bytes[i]);
+            rs232_send_byte(c[7:0]);
+            rs232_send_byte(c[15:8]);
+        end
+    endtask
+
+    // UART RX monitor from TTL TX
+    reg [7:0] ttl_rx_bytes [0:511];
+    integer   ttl_rx_count = 0;
+    reg [3:0] ttl_rx_bit = 0;
+    reg [7:0] ttl_rx_shift = 0;
+    integer   ttl_rx_clk_cnt = 0;
+    reg       ttl_rx_busy = 0;
+
+    initial begin
+        forever begin
+            @(posedge clk);
+            if (!ttl_rx_busy && ttl_tx === 1'b0) begin
+                ttl_rx_busy = 1'b1;
+                ttl_rx_clk_cnt = BIT_CLKS + (BIT_CLKS / 2) - 1;
+                ttl_rx_bit = 0;
+            end else if (ttl_rx_busy) begin
+                if (ttl_rx_clk_cnt == 0) begin
+                    if (ttl_rx_bit < 8) begin
+                        ttl_rx_shift[ttl_rx_bit] = ttl_tx;
+                        ttl_rx_bit = ttl_rx_bit + 1;
+                        ttl_rx_clk_cnt = BIT_CLKS - 1;
+                    end else begin
+                        ttl_rx_bytes[ttl_rx_count] = ttl_rx_shift;
+                        ttl_rx_count = ttl_rx_count + 1;
+                        ttl_rx_busy = 1'b0;
+                    end
+                end else begin
+                    ttl_rx_clk_cnt = ttl_rx_clk_cnt - 1;
+                end
+            end
+        end
+    end
+
+    // UART RX monitor from RS232 TX (to verify TX broadcast)
+    reg [7:0] rs232_rx_bytes [0:511];
+    integer   rs232_rx_count = 0;
+    reg [3:0] rs232_rx_bit = 0;
+    reg [7:0] rs232_rx_shift = 0;
+    integer   rs232_rx_clk_cnt = 0;
+    reg       rs232_rx_busy = 0;
+
+    initial begin
+        forever begin
+            @(posedge clk);
+            if (!rs232_rx_busy && rs232_tx === 1'b0) begin
+                rs232_rx_busy = 1'b1;
+                rs232_rx_clk_cnt = BIT_CLKS + (BIT_CLKS / 2) - 1;
+                rs232_rx_bit = 0;
+            end else if (rs232_rx_busy) begin
+                if (rs232_rx_clk_cnt == 0) begin
+                    if (rs232_rx_bit < 8) begin
+                        rs232_rx_shift[rs232_rx_bit] = rs232_tx;
+                        rs232_rx_bit = rs232_rx_bit + 1;
+                        rs232_rx_clk_cnt = BIT_CLKS - 1;
+                    end else begin
+                        rs232_rx_bytes[rs232_rx_count] = rs232_rx_shift;
+                        rs232_rx_count = rs232_rx_count + 1;
+                        rs232_rx_busy = 1'b0;
+                    end
+                end else begin
+                    rs232_rx_clk_cnt = rs232_rx_clk_cnt - 1;
+                end
+            end
+        end
+    end
+
+    // Step edge counters
+    integer x_steps_count = 0;
+    integer y_steps_count = 0;
+    integer z_steps_count = 0;
+    always @(posedge x_step) x_steps_count = x_steps_count + 1;
+    always @(posedge y_step) y_steps_count = y_steps_count + 1;
+    always @(posedge z_step) z_steps_count = z_steps_count + 1;
+
+    // Timeout guard
+    initial begin
+        #40000000; // 40ms simulation time
+        $display("FATAL: Simulation timeout!");
+        $fflush;
+        $finish;
+    end
+
+    integer start_idx;
+    integer i;
+
+    initial begin
+        $display("==================================================");
+        $display("=== STARTING MRDIMM HOST TTL E2E TESTBENCH     ===");
+        $display("=== Port: CON140 (T11=TX, P13=RX) @ 921600 8N1 ===");
+        $display("==================================================");
+        $fflush;
+
+        rst_n = 1'b0;
+        limit_lower_raw = 3'b000;
+        limit_upper_raw = 3'b000;
+        repeat (100) @(posedge clk);
+        rst_n = 1'b1;
+        repeat (2000) @(posedge clk);
+
+        // --------------------------------------------------------------------
+        // TEST 1: Legal GET_ALL sent over host_ttl_rx
+        // --------------------------------------------------------------------
+        $display("[TEST 1] Sending GET_ALL over host_ttl_rx...");
+        $fflush;
+        frame_bytes[0] = 8'hA5;
+        frame_bytes[1] = 8'h5A;
+        frame_bytes[2] = 8'h02; // GET_ALL
+        frame_bytes[3] = 8'h00; // LEN 0
+        start_idx = ttl_rx_count;
+        ttl_send_frame(4);
+
+        // Expect GET_ACK (6 bytes: A5 5A 82 00 F5 60) + GET_DATA (69 bytes: A5 5A 42 3F ... CRC)
+        // Total bytes = 75 bytes
+        wait(ttl_rx_count >= start_idx + 75);
+        $display("  -> Received 75 bytes from GET_ALL on host_ttl_tx");
+        $fflush;
+
+        // Verify GET_ACK on TTL TX
+        if (ttl_rx_bytes[start_idx] !== 8'hA5 || ttl_rx_bytes[start_idx+1] !== 8'h5A ||
+            ttl_rx_bytes[start_idx+2] !== 8'h82 || ttl_rx_bytes[start_idx+3] !== 8'h00) begin
+            $fatal(1, "FAIL 1: GET_ACK mismatch on ttl_tx: %02h %02h %02h %02h",
+                   ttl_rx_bytes[start_idx], ttl_rx_bytes[start_idx+1],
+                   ttl_rx_bytes[start_idx+2], ttl_rx_bytes[start_idx+3]);
+        end
+        $display("  -> Verified GET_ACK (82 00) on host_ttl_tx");
+
+        // Verify GET_DATA header on TTL TX
+        start_idx = start_idx + 6;
+        if (ttl_rx_bytes[start_idx] !== 8'hA5 || ttl_rx_bytes[start_idx+1] !== 8'h5A ||
+            ttl_rx_bytes[start_idx+2] !== 8'h42 || ttl_rx_bytes[start_idx+3] !== 8'h3F) begin
+            $fatal(1, "FAIL 1: GET_DATA header mismatch on ttl_tx: %02h %02h %02h %02h",
+                   ttl_rx_bytes[start_idx], ttl_rx_bytes[start_idx+1],
+                   ttl_rx_bytes[start_idx+2], ttl_rx_bytes[start_idx+3]);
+        end
+
+        // Verify FAN default = 20% on all 4 channels
+        if (ttl_rx_bytes[start_idx+4] !== 8'd20 || ttl_rx_bytes[start_idx+5] !== 8'd20 ||
+            ttl_rx_bytes[start_idx+6] !== 8'd20 || ttl_rx_bytes[start_idx+7] !== 8'd20) begin
+            $fatal(1, "FAIL 1: default fan duty wrong on ttl_tx");
+        end
+
+        // Verify PTC default = 0% on all 4 channels
+        if (ttl_rx_bytes[start_idx+8] !== 8'd0 || ttl_rx_bytes[start_idx+9] !== 8'd0 ||
+            ttl_rx_bytes[start_idx+10] !== 8'd0 || ttl_rx_bytes[start_idx+11] !== 8'd0) begin
+            $fatal(1, "FAIL 1: default ptc duty wrong on ttl_tx");
+        end
+
+        // Verify TX broadcast: rs232_tx must receive the exact same 75 bytes!
+        wait(rs232_rx_count >= 75);
+        for (i = 0; i < 75; i = i + 1) begin
+            if (rs232_rx_bytes[i] !== ttl_rx_bytes[i]) begin
+                $fatal(1, "FAIL 1: Broadcast mismatch at byte %0d: ttl=%02h, rs232=%02h",
+                       i, ttl_rx_bytes[i], rs232_rx_bytes[i]);
+            end
+        end
+        $display("  -> Verified TX Broadcast: rs232_tx perfectly matches ttl_tx (75 bytes)!");
+        $display("  -> TEST 1 PASSED!");
+        $fflush;
+
+        // --------------------------------------------------------------------
+        // TEST 2: SET_ALL sent over host_ttl_rx (FAN 50%, PTC 30%, Axis 0 6 steps)
+        // --------------------------------------------------------------------
+        $display("[TEST 2] Sending SET_ALL over host_ttl_rx: FAN 50%%, PTC 30%%, Axis 0 PUSH_DOWN 6 steps...");
+        $fflush;
+        frame_bytes[0] = 8'hA5;
+        frame_bytes[1] = 8'h5A;
+        frame_bytes[2] = 8'h01; // SET_ALL
+        frame_bytes[3] = 8'd68; // LEN 68
+        // Payload 0..3: FAN 50%
+        frame_bytes[4] = 8'd50; frame_bytes[5] = 8'd50; frame_bytes[6] = 8'd50; frame_bytes[7] = 8'd50;
+        // Payload 4..7: PTC 30%
+        frame_bytes[8] = 8'd30; frame_bytes[9] = 8'd30; frame_bytes[10] = 8'd30; frame_bytes[11] = 8'd30;
+        // Axis 0: payload 8..12
+        frame_bytes[12] = 8'h01; // action PUSH_DOWN
+        frame_bytes[13] = 8'd6;  // steps low = 6
+        frame_bytes[14] = 8'd0;  // steps high
+        frame_bytes[15] = 8'd20; // half_period low = 20 us
+        frame_bytes[16] = 8'd0;  // half_period high
+        // Axis 1..11: NOTHING
+        for (i = 17; i < 4 + 68; i = i + 1) frame_bytes[i] = 8'd0;
+
+        start_idx = ttl_rx_count;
+        x_steps_count = 0;
+        ttl_send_frame(72);
+
+        // Expect SET_ACK (6 bytes: A5 5A 81 00 A6 35) on TTL TX
+        wait(ttl_rx_count >= start_idx + 6);
+        if (ttl_rx_bytes[start_idx+2] !== 8'h81 || ttl_rx_bytes[start_idx+3] !== 8'h00) begin
+            $fatal(1, "FAIL 2: expected SET_ACK (81 00), got %02h %02h",
+                   ttl_rx_bytes[start_idx+2], ttl_rx_bytes[start_idx+3]);
+        end
+        $display("  -> Verified SET_ACK (81 00) on host_ttl_tx");
+        $fflush;
+
+        // Expect MOTOR_DONE (10 bytes) on TTL TX
+        wait(ttl_rx_count >= start_idx + 6 + 10);
+        start_idx = start_idx + 6;
+        if (ttl_rx_bytes[start_idx+2] !== 8'h50 || ttl_rx_bytes[start_idx+3] !== 8'h04) begin
+            $fatal(1, "FAIL 2: expected MOTOR_DONE (50 04), got %02h %02h",
+                   ttl_rx_bytes[start_idx+2], ttl_rx_bytes[start_idx+3]);
+        end
+        $display("  -> Got MOTOR_DONE: axis=%0d, reason=%0d, steps_done=%0d",
+                 ttl_rx_bytes[start_idx+4], ttl_rx_bytes[start_idx+5],
+                 {ttl_rx_bytes[start_idx+7], ttl_rx_bytes[start_idx+6]});
+        $fflush;
+
+        if (ttl_rx_bytes[start_idx+4] !== 8'd0) $fatal(1, "FAIL 2: wrong axis, expected 0");
+        if (ttl_rx_bytes[start_idx+5] !== 8'd0) $fatal(1, "FAIL 2: wrong reason, expected 0 (complete)");
+        if ({ttl_rx_bytes[start_idx+7], ttl_rx_bytes[start_idx+6]} !== 16'd6)
+            $fatal(1, "FAIL 2: wrong steps_done in MOTOR_DONE, expected 6");
+        if (x_steps_count !== 6)
+            $fatal(1, "FAIL 2: physical pulse count mismatch on x_step pin: expected 6, got %0d", x_steps_count);
+
+        $display("  -> Exactly 6 pulses emitted on x_step and completed normally!");
+        $display("  -> TEST 2 PASSED!");
+        $fflush;
+
+        // --------------------------------------------------------------------
+        // TEST 3: Interleaved commands between host_rs232_rx and host_ttl_rx
+        // --------------------------------------------------------------------
+        $display("[TEST 3] Interleaved communication test...");
+        // 3A: Send GET_ALL via RS232 RX
+        $display("  -> 3A: Sending GET_ALL via host_rs232_rx...");
+        frame_bytes[0] = 8'hA5;
+        frame_bytes[1] = 8'h5A;
+        frame_bytes[2] = 8'h02;
+        frame_bytes[3] = 8'h00;
+        start_idx = ttl_rx_count;
+        rs232_send_frame(4);
+
+        wait(ttl_rx_count >= start_idx + 75);
+        if (ttl_rx_bytes[start_idx+2] !== 8'h82) $fatal(1, "FAIL 3A: RS232 request didn't yield GET_ACK");
+        $display("  -> 3A OK: RS232 request answered and broadcast on ttl_tx");
+
+        // 3B: Send GET_ALL via TTL RX immediately afterwards
+        $display("  -> 3B: Sending GET_ALL via host_ttl_rx...");
+        start_idx = ttl_rx_count;
+        ttl_send_frame(4);
+
+        wait(ttl_rx_count >= start_idx + 75);
+        if (ttl_rx_bytes[start_idx+2] !== 8'h82) $fatal(1, "FAIL 3B: TTL request didn't yield GET_ACK");
+        $display("  -> 3B OK: TTL request answered and broadcast on ttl_tx");
+        $display("  -> TEST 3 PASSED! Dual ports switch and operate seamlessly.");
+        $fflush;
+
+        // --------------------------------------------------------------------
+        // TEST 4: Limit switch trip during move sent via host_ttl_rx
+        // --------------------------------------------------------------------
+        $display("[TEST 4] Limit trip test over TTL: Axis 1 moving, limit trips at step 3...");
+        $fflush;
+        frame_bytes[0] = 8'hA5;
+        frame_bytes[1] = 8'h5A;
+        frame_bytes[2] = 8'h01; // SET_ALL
+        frame_bytes[3] = 8'd68; // LEN 68
+        for (i = 4; i < 4 + 68; i = i + 1) frame_bytes[i] = 8'd0;
+        frame_bytes[4] = 8'd20; frame_bytes[5] = 8'd20; frame_bytes[6] = 8'd20; frame_bytes[7] = 8'd20;
+        // Axis 1: payload 13..17 (frame_bytes 17..21)
+        frame_bytes[17] = 8'h01; // PUSH_DOWN
+        frame_bytes[18] = 8'd40; // 40 steps
+        frame_bytes[19] = 8'd0;
+        frame_bytes[20] = 8'd25; // half_period = 25 us
+        frame_bytes[21] = 8'd0;
+
+        start_idx = ttl_rx_count;
+        y_steps_count = 0;
+        ttl_send_frame(72);
+
+        // Wait for SET_ACK
+        wait(ttl_rx_count >= start_idx + 6);
+        $display("  -> SET_ACK received, motor Y running...");
+
+        // Trip lower limit when y_steps_count reaches 3
+        wait(y_steps_count == 3);
+        @(negedge y_step);
+        limit_lower_raw[1] = 1'b1; // assert lower limit on Axis 1
+        $display("  -> Asserted Axis 1 lower limit at y_steps_count=3");
+
+        // Expect MOTOR_DONE with reason=1 (lower limit)
+        wait(ttl_rx_count >= start_idx + 6 + 10);
+        start_idx = start_idx + 6;
+        if (ttl_rx_bytes[start_idx+2] !== 8'h50 || ttl_rx_bytes[start_idx+4] !== 8'd1) begin
+            $fatal(1, "FAIL 4: expected MOTOR_DONE for axis 1");
+        end
+        if (ttl_rx_bytes[start_idx+5] !== 8'd1) begin
+            $fatal(1, "FAIL 4: expected reason=1 (lower limit), got %0d", ttl_rx_bytes[start_idx+5]);
+        end
+        $display("  -> Got MOTOR_DONE: axis=1, reason=1 (lower limit), steps_done=%0d",
+                 {ttl_rx_bytes[start_idx+7], ttl_rx_bytes[start_idx+6]});
+        limit_lower_raw[1] = 1'b0; // release limit
+        $display("  -> TEST 4 PASSED!");
+        $fflush;
+
+        // --------------------------------------------------------------------
+        // TEST 5: STOP_CLEAR abort sent over host_ttl_rx
+        // --------------------------------------------------------------------
+        $display("[TEST 5] STOP_CLEAR test over TTL: start long move on Axis 0, then abort...");
+        $fflush;
+        frame_bytes[0] = 8'hA5;
+        frame_bytes[1] = 8'h5A;
+        frame_bytes[2] = 8'h01; // SET_ALL
+        frame_bytes[3] = 8'd68; // LEN 68
+        for (i = 4; i < 4 + 68; i = i + 1) frame_bytes[i] = 8'd0;
+        frame_bytes[4] = 8'd20; frame_bytes[5] = 8'd20; frame_bytes[6] = 8'd20; frame_bytes[7] = 8'd20;
+        // Axis 0: 500 steps
+        frame_bytes[12] = 8'h01;
+        frame_bytes[13] = 8'd244;
+        frame_bytes[14] = 8'd1;
+        frame_bytes[15] = 8'd30;
+        frame_bytes[16] = 8'd0;
+
+        start_idx = ttl_rx_count;
+        x_steps_count = 0;
+        ttl_send_frame(72);
+
+        wait(ttl_rx_count >= start_idx + 6);
+        $display("  -> Long move started on Axis 0...");
+
+        // Wait until motor has made 5 steps
+        wait(x_steps_count >= 5);
+        $display("  -> Emitted %0d steps, issuing STOP_CLEAR (action=0xFF)...", x_steps_count);
+
+        // Send STOP_CLEAR
+        frame_bytes[0] = 8'hA5;
+        frame_bytes[1] = 8'h5A;
+        frame_bytes[2] = 8'h01;
+        frame_bytes[3] = 8'd68;
+        for (i = 4; i < 4 + 68; i = i + 1) frame_bytes[i] = 8'd0;
+        frame_bytes[4] = 8'd20; frame_bytes[5] = 8'd20; frame_bytes[6] = 8'd20; frame_bytes[7] = 8'd20;
+        frame_bytes[12] = 8'hFF; // STOP_CLEAR
+
+        start_idx = ttl_rx_count;
+        ttl_send_frame(72);
+
+        wait(ttl_rx_count >= start_idx + 6);
+        if (ttl_rx_bytes[start_idx+2] !== 8'h81) $fatal(1, "FAIL 5: expected SET_ACK for STOP_CLEAR");
+        $display("  -> Received SET_ACK for STOP_CLEAR");
+
+        // Verify motor stops and no more step pulses are produced
+        i = x_steps_count;
+        repeat (1000) @(posedge clk);
+        if (x_steps_count !== i) $fatal(1, "FAIL 5: motor continued stepping after STOP_CLEAR!");
+        $display("  -> Motor step pulses halted immediately at count %0d", x_steps_count);
+        $display("  -> TEST 5 PASSED!");
+        $fflush;
+
+        // --------------------------------------------------------------------
+        // TEST 6: Bad CRC corruption over host_ttl_rx
+        // --------------------------------------------------------------------
+        $display("[TEST 6] Bad CRC rejection & recovery test over TTL...");
+        $fflush;
+        start_idx = ttl_rx_count;
+        // Send a frame with bad CRC
+        ttl_send_byte(8'hA5);
+        ttl_send_byte(8'h5A);
+        ttl_send_byte(8'h02); // GET_ALL
+        ttl_send_byte(8'h00);
+        ttl_send_byte(8'hDE); // corrupted CRC
+        ttl_send_byte(8'hAD);
+
+        // Wait a timeout period
+        repeat (3000) @(posedge clk);
+        if (ttl_rx_count !== start_idx) begin
+            $fatal(1, "FAIL 6: Corrupted frame should NOT produce any reply or ACK!");
+        end
+        $display("  -> Corrupted CRC frame correctly ignored (0 replies produced)");
+
+        // Now send a valid GET_ALL to verify recovery
+        start_idx = ttl_rx_count;
+        frame_bytes[0] = 8'hA5;
+        frame_bytes[1] = 8'h5A;
+        frame_bytes[2] = 8'h02;
+        frame_bytes[3] = 8'h00;
+        ttl_send_frame(4);
+
+        wait(ttl_rx_count >= start_idx + 75);
+        if (ttl_rx_bytes[start_idx+2] !== 8'h82) begin
+            $fatal(1, "FAIL 6: Link failed to recover after bad CRC frame!");
+        end
+        $display("  -> Subsequent valid GET_ALL succeeded with GET_ACK (82 00)");
+        $display("  -> TEST 6 PASSED!");
+        $fflush;
+
+        $display("==================================================");
+        $display("=== ALL 6 HOST TTL TESTS PASSED SUCCESSFULLY! ===");
+        $display("prod2u_mrdimm_ttl_e2e_tb PASS");
+        $display("==================================================");
+        $fflush;
+        $finish;
+    end
+endmodule

+ 1 - 1
tests/unit/test_6400_closure_separation.py

@@ -7,7 +7,7 @@ def test_production_and_analysis_closures_are_complete_and_separate() -> None:
     receipt = build_receipt()
     production = receipt["production_source_closure"]["files"]
     analysis = receipt["analysis_replay_closure"]["files"]
-    assert "src/top/prod2u_6400_rs232_only_top.v" in production
+    assert "src/top/prod2u_6400_final_top.v" in production
     assert "tools/target_registry.py" in analysis
     assert "tools/package_target.py" in analysis
     assert "tools/target_registry.py" not in production

+ 3 - 3
tools/generate_mrdimm_adc.py

@@ -51,9 +51,7 @@ def generate(root: Path | None = None) -> dict[Path, bytes]:
     lines.append(f"# config/pin_inventory.prod2u_door_temp_v1_2.json {inv['board_id']},")
     lines.append(f"# status {inv['status']}).  Motor seats overridden to the current")
     lines.append("# direct 3.3V CON142/126/127 wiring per the active board authority;")
-    lines.append("# the superseded NPN-buffered seats appear in comments.")
-    lines.append("# NOT BOUND on this product (no V1.2 evidence; wrapper holds idle):")
-    lines.append("#   host_ttl_rx/tx. The retired Host I2C is absent from this product.")
+    lines.append("# Host RS232 (CON78) and Host TTL (CON140):")
     lv = "IOSTANDARD = LVCMOS33; PULLTYPE = NONE;"
 
     def emit(signal: str, ball: str, note: str = "") -> None:
@@ -63,6 +61,8 @@ def generate(root: Path | None = None) -> dict[Path, bytes]:
     emit("sys_clk", rows["sys_clk"]["fpga_ball"])
     emit("host_rs232_tx", rows["host_uart_tx"]["fpga_ball"], "CON78.1")
     emit("host_rs232_rx", rows["host_uart_rx"]["fpga_ball"], "CON78.2")
+    emit("host_ttl_tx", "T11", "CON140.1 (EX_GPIO29)")
+    lines.append("set_pin_assignment { host_ttl_rx } { LOCATION = P13; IOSTANDARD = LVCMOS33; PULLTYPE = PULLUP; }  # CON140.2 (EX_GPIO30)")
     emit("temp_scl", rows["temp_scl"]["fpga_ball"], "CT7428 bus")
     emit("temp_sda", rows["temp_sda"]["fpga_ball"], "CT7428 bus")
     for i in range(8):