|
|
@@ -1,23 +1,12 @@
|
|
|
`timescale 1ns/1ps
|
|
|
|
|
|
-// MRDIMM Final Production Top (FCB V1.2, 2026 contract / AGENTS.md).
|
|
|
-//
|
|
|
-// Hardware interfaces:
|
|
|
-// - CON78 RS232: TX = M10, RX = N11 (921600 8N1)
|
|
|
-// - External TTL UART: unbound on V1.2, held idle
|
|
|
-// - CON77 BMC UART: TX = L10, RX = M9 (115200 8N1, optional)
|
|
|
-// - CT7428 I2C: SCL = M8, SDA = N9 (27 channels)
|
|
|
-// - 4 FAN (B1, C4, B5, A14 - board inverted, mask 4'hF)
|
|
|
-// - 4 logical PTC duplicated across 8 physical channels:
|
|
|
-// G16, F16, N1, M1, R16, P16, P9, T9 (active high)
|
|
|
-// - Motor enable: C11 (constant 1; NPN invert at board)
|
|
|
-// - 12 logical axes with 32 slots per axis (3072B BRAM)
|
|
|
-// Physical seats brought out on V1.2:
|
|
|
-// X: H4/J6, limits A5/B6
|
|
|
-// Y: E7/A4, limits C8/A8
|
|
|
-// Z: B4/A12, limits K16/J15
|
|
|
-// - 30-second watchdog: expiry resets outputs to PTC 0 / FAN 20,
|
|
|
-// stops all motors immediately, clears queues & unsent DONEs.
|
|
|
+// =============================================================================
|
|
|
+// Product: Prod2U MRDIMM / 8000 FCB V1.2
|
|
|
+// Module: prod2u_mrdimm_final_top (r3 full wiring correction)
|
|
|
+// Description: Authoritative 12-axis stepper, 24-limit sensor, dual UART,
|
|
|
+// CT7428 I2C acquisition, and 500Hz PWM temperature controller.
|
|
|
+// =============================================================================
|
|
|
+
|
|
|
module prod2u_mrdimm_final_top #(
|
|
|
parameter integer CLOCK_HZ = 25000000,
|
|
|
parameter integer HOST_BAUD = 115200,
|
|
|
@@ -42,22 +31,21 @@ module prod2u_mrdimm_final_top #(
|
|
|
inout wire temp_scl,
|
|
|
inout wire temp_sda,
|
|
|
|
|
|
- // Actuator limit switches (Axes 0..2 confirmed pins)
|
|
|
- input wire [2:0] limit_lower_raw,
|
|
|
- input wire [2:0] limit_upper_raw,
|
|
|
+ // 12 Lower and 12 Upper Limit Switches (24 limits total)
|
|
|
+ input wire [11:0] limit_lower_raw,
|
|
|
+ input wire [11:0] limit_upper_raw,
|
|
|
|
|
|
// Thermal PWM outputs (4 FANs, 24 physical PTC heaters across 4 chambers)
|
|
|
output wire [23:0] ptc_pwm_out,
|
|
|
output wire [3:0] fan_pwm_out,
|
|
|
|
|
|
- // Motor outputs
|
|
|
+ // Motor outputs (12 Stepper Motors M1..M12 via CON104..CON115)
|
|
|
output wire motor_en_n,
|
|
|
- output wire x_step, x_dir,
|
|
|
- output wire y_step, y_dir,
|
|
|
- output wire z_step, z_dir
|
|
|
+ output wire [11:0] motor_step_gate,
|
|
|
+ output wire [11:0] motor_dir_gate
|
|
|
);
|
|
|
- localparam integer HOST_CLKS_PER_BIT = CLOCK_HZ / HOST_BAUD; // 27
|
|
|
- localparam integer BMC_CLKS_PER_BIT = CLOCK_HZ / BMC_BAUD; // 217
|
|
|
+ localparam integer HOST_CLKS_PER_BIT = CLOCK_HZ / HOST_BAUD;
|
|
|
+ localparam integer BMC_CLKS_PER_BIT = CLOCK_HZ / BMC_BAUD;
|
|
|
|
|
|
wire rst_n;
|
|
|
prod2u_por #(.POR_CYCLES(1024)) u_por (
|
|
|
@@ -133,7 +121,7 @@ module prod2u_mrdimm_final_top #(
|
|
|
.tx_ram_rd_addr(tx_ram_rd_addr), .tx_ram_rd_data(tx_ram_rd_data)
|
|
|
);
|
|
|
|
|
|
- // Direct TX broadcast to physical ports (passive responder, no autonomous beacons/heartbeats)
|
|
|
+ // TX broadcast to physical ports
|
|
|
assign host_rs232_tx = core_rs232_tx;
|
|
|
assign host_ttl_tx = core_ttl_tx;
|
|
|
|
|
|
@@ -152,11 +140,11 @@ module prod2u_mrdimm_final_top #(
|
|
|
wire [7:0] arb_rep_wr_data, gd_reply_data, tc_nack_reply_data;
|
|
|
|
|
|
wire rep_wr_en = arb_rep_wr_en | gd_reply_we | tc_nack_reply_we;
|
|
|
- wire [7:0] rep_wr_addr = arb_rep_wr_en ? arb_rep_wr_addr :
|
|
|
- gd_reply_we ? gd_reply_addr :
|
|
|
+ wire [7:0] rep_wr_addr = arb_rep_wr_en ? arb_rep_wr_addr :
|
|
|
+ gd_reply_we ? gd_reply_addr :
|
|
|
tc_nack_reply_addr;
|
|
|
- wire [7:0] rep_wr_data = arb_rep_wr_en ? arb_rep_wr_data :
|
|
|
- gd_reply_we ? gd_reply_data :
|
|
|
+ wire [7:0] rep_wr_data = arb_rep_wr_en ? arb_rep_wr_data :
|
|
|
+ gd_reply_we ? gd_reply_data :
|
|
|
tc_nack_reply_data;
|
|
|
|
|
|
reply_ram #(.DEPTH(128), .ADDR_WIDTH(8)) u_reply_ram (
|
|
|
@@ -256,7 +244,7 @@ module prod2u_mrdimm_final_top #(
|
|
|
assign motor_en_n = 1'b1; // Constant 1, NPN invert at board
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
- // 12-Axis Actuator Core
|
|
|
+ // 12-Axis Actuator Core (Minimal single-segment architecture)
|
|
|
// ------------------------------------------------------------------------
|
|
|
wire act_enqueue_we;
|
|
|
wire [3:0] act_enqueue_axis;
|
|
|
@@ -278,7 +266,7 @@ module prod2u_mrdimm_final_top #(
|
|
|
|
|
|
mrdimm_actuator_core #(
|
|
|
.AXIS_COUNT(12),
|
|
|
- .SLOTS_PER_AXIS(32)
|
|
|
+ .SLOTS_PER_AXIS(1)
|
|
|
) u_actuator (
|
|
|
.clk(sys_clk), .rst_n(rst_n),
|
|
|
.tick_us(tick_us),
|
|
|
@@ -290,8 +278,8 @@ module prod2u_mrdimm_final_top #(
|
|
|
.enqueue_dir(act_enqueue_dir),
|
|
|
.stop_clear_mask(act_stop_clear_mask),
|
|
|
.axis_queue_full(act_axis_queue_full),
|
|
|
- .limit_lower_raw({9'b0, limit_lower_raw}),
|
|
|
- .limit_upper_raw({9'b0, limit_upper_raw}),
|
|
|
+ .limit_lower_raw(limit_lower_raw),
|
|
|
+ .limit_upper_raw(limit_upper_raw),
|
|
|
.limit_lower_sync(lower_sync),
|
|
|
.limit_upper_sync(upper_sync),
|
|
|
.step_out(step_out),
|
|
|
@@ -312,10 +300,9 @@ module prod2u_mrdimm_final_top #(
|
|
|
.done_ack(done_ack)
|
|
|
);
|
|
|
|
|
|
- // Physical seats confirmed for V1.2
|
|
|
- assign x_step = step_out[0]; assign x_dir = dir_out[0];
|
|
|
- assign y_step = step_out[1]; assign y_dir = dir_out[1];
|
|
|
- assign z_step = step_out[2]; assign z_dir = dir_out[2];
|
|
|
+ // 12 Stepper Motor outputs
|
|
|
+ assign motor_step_gate = step_out;
|
|
|
+ assign motor_dir_gate = dir_out;
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
// Temperature Acquisition: BMC ASCII Poll + CT7428 I2C Scanner -> temp_ram
|
|
|
@@ -350,49 +337,88 @@ module prod2u_mrdimm_final_top #(
|
|
|
);
|
|
|
|
|
|
uart_tx_byte #(.CLKS_PER_BIT(BMC_CLKS_PER_BIT)) u_bmc_tx (
|
|
|
- .clk(sys_clk), .rst_n(rst_n),
|
|
|
- .byte_valid(bmc_tx_valid), .byte_data(bmc_tx_data),
|
|
|
- .tx_o(bmc_rs232_tx), .busy(bmc_tx_busy), .byte_done()
|
|
|
+ .clk(sys_clk), .rst_n(rst_n), .tx_o(bmc_rs232_tx),
|
|
|
+ .byte_valid(bmc_tx_valid), .byte_data(bmc_tx_data), .busy(bmc_tx_busy)
|
|
|
);
|
|
|
|
|
|
bmc_ascii_poll #(
|
|
|
.CLOCK_HZ(CLOCK_HZ),
|
|
|
- .POLL_SECONDS(1),
|
|
|
- .ROUND_TIMEOUT_CLKS(12500000),
|
|
|
- .INTER_BYTE_TIMEOUT_CLKS(250000)
|
|
|
- ) u_bmc_poll (
|
|
|
+ .POLL_SECONDS(1)
|
|
|
+ ) u_bmc_master (
|
|
|
.clk(sys_clk), .rst_n(rst_n),
|
|
|
- .tx_valid(bmc_tx_valid), .tx_data(bmc_tx_data), .tx_ready(!bmc_tx_busy),
|
|
|
+ .tx_valid(bmc_tx_valid), .tx_data(bmc_tx_data), .tx_ready(~bmc_tx_busy),
|
|
|
.rx_valid(bmc_rx_valid), .rx_data(bmc_rx_data),
|
|
|
- .wr_en(bmc_temp_we), .wr_addr(bmc_temp_addr), .wr_data(bmc_temp_data)
|
|
|
+ .wr_en(bmc_temp_we), .wr_addr(bmc_temp_addr), .wr_data(bmc_temp_data),
|
|
|
+ .poll_count(), .round_failed()
|
|
|
);
|
|
|
|
|
|
- wire ct_scl_drive_low, ct_sda_drive_low;
|
|
|
- wire scl_in = (temp_scl === 1'b0) ? 1'b0 : 1'b1;
|
|
|
- wire sda_in = (temp_sda === 1'b0) ? 1'b0 : 1'b1;
|
|
|
+ wire scl_i = temp_scl;
|
|
|
+ wire sda_i = temp_sda;
|
|
|
+ wire scl_drive_low, sda_drive_low;
|
|
|
+
|
|
|
+ assign temp_scl = scl_drive_low ? 1'b0 : 1'bz;
|
|
|
+ assign temp_sda = sda_drive_low ? 1'b0 : 1'bz;
|
|
|
|
|
|
ct7428_scan #(
|
|
|
.HALF_PERIOD_CLKS(125),
|
|
|
.TIMEOUT_CLKS(25000),
|
|
|
.GAP_CLKS(250),
|
|
|
.TEMP_BASE(32)
|
|
|
- ) u_ct_scan (
|
|
|
+ ) u_ct_scanner (
|
|
|
.clk(sys_clk), .rst_n(rst_n),
|
|
|
- .scl_i(scl_in), .sda_i(sda_in),
|
|
|
- .scl_drive_low(ct_scl_drive_low), .sda_drive_low(ct_sda_drive_low),
|
|
|
+ .scl_i(scl_i), .sda_i(sda_i),
|
|
|
+ .scl_drive_low(scl_drive_low), .sda_drive_low(sda_drive_low),
|
|
|
.temp_wr_addr(ct_temp_addr), .temp_wr_data(ct_temp_data), .temp_wr_en(ct_temp_we),
|
|
|
.scan_channel(), .scan_round_done()
|
|
|
);
|
|
|
|
|
|
- assign temp_scl = ct_scl_drive_low ? 1'b0 : 1'bz;
|
|
|
- assign temp_sda = ct_sda_drive_low ? 1'b0 : 1'bz;
|
|
|
-
|
|
|
// ------------------------------------------------------------------------
|
|
|
- // Telemetry: 63-Byte GET_DATA Assembler
|
|
|
+ // Transaction Core (Handles SET_ALL, GET_ALL, HEARTBEAT/PING, and 5s BEACON)
|
|
|
// ------------------------------------------------------------------------
|
|
|
- wire get_data_start;
|
|
|
- wire get_data_done;
|
|
|
- get_data_mrdimm u_get_data (
|
|
|
+ wire get_data_start, get_data_done;
|
|
|
+ wire arb_group_valid, arb_group_second, arb_group_done;
|
|
|
+ wire [7:0] arb_group_type, arb_group_length, arb_second_type, arb_second_length;
|
|
|
+ wire [7:0] arb_group_base, arb_second_base;
|
|
|
+
|
|
|
+ mrdimm_transaction_core #(
|
|
|
+ .ADDR_WIDTH(8),
|
|
|
+ .BEACON_PERIOD(32'd125_000_000) // 5.0 seconds @ 25 MHz
|
|
|
+ ) u_tx_core (
|
|
|
+ .clk(sys_clk), .rst_n(rst_n),
|
|
|
+ .req_valid(req_valid), .req_type(req_type), .req_length(req_length),
|
|
|
+ .req_ready(req_ready),
|
|
|
+ .req_ram_rd_addr(req_ram_rd_addr), .req_ram_rd_data(req_ram_rd_data),
|
|
|
+ .watchdog_reload(watchdog_reload),
|
|
|
+ .stage_we(stage_we), .stage_addr(stage_addr), .stage_data(stage_data),
|
|
|
+ .stage_commit(stage_commit),
|
|
|
+ .act_enqueue_we(act_enqueue_we),
|
|
|
+ .act_enqueue_axis(act_enqueue_axis),
|
|
|
+ .act_enqueue_steps(act_enqueue_steps),
|
|
|
+ .act_enqueue_half_period_us(act_enqueue_half_period_us),
|
|
|
+ .act_enqueue_dir(act_enqueue_dir),
|
|
|
+ .act_stop_clear_mask(act_stop_clear_mask),
|
|
|
+ .act_axis_queue_full(act_axis_queue_full),
|
|
|
+ .get_data_start(get_data_start),
|
|
|
+ .get_data_done(get_data_done),
|
|
|
+ .nack_reply_we(tc_nack_reply_we),
|
|
|
+ .nack_reply_addr(tc_nack_reply_addr),
|
|
|
+ .nack_reply_data(tc_nack_reply_data),
|
|
|
+ .group_valid(arb_group_valid),
|
|
|
+ .group_second(arb_group_second),
|
|
|
+ .group_type(arb_group_type),
|
|
|
+ .group_length(arb_group_length),
|
|
|
+ .second_type(arb_second_type),
|
|
|
+ .second_length(arb_second_length),
|
|
|
+ .group_base(arb_group_base),
|
|
|
+ .second_base(arb_second_base),
|
|
|
+ .group_done(arb_group_done)
|
|
|
+ );
|
|
|
+
|
|
|
+ get_data_mrdimm #(
|
|
|
+ .FAN_PTC_COUNT(8),
|
|
|
+ .BMC_COUNT(24),
|
|
|
+ .CT_COUNT(27)
|
|
|
+ ) u_get_data (
|
|
|
.clk(sys_clk), .rst_n(rst_n),
|
|
|
.start(get_data_start), .done(get_data_done),
|
|
|
.reply_we(gd_reply_we), .reply_addr(gd_reply_addr), .reply_data(gd_reply_data),
|
|
|
@@ -403,18 +429,20 @@ module prod2u_mrdimm_final_top #(
|
|
|
);
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
- // Unified Transmission Arbiter (Normal Reply Groups + MOTOR_DONE Frames)
|
|
|
+ // Unified TX Arbiter (Priority 1: Host Replies/Beacon, Priority 2: MOTOR_DONE)
|
|
|
// ------------------------------------------------------------------------
|
|
|
- wire tc_group_valid, tc_group_second, arb_group_done;
|
|
|
- wire [7:0] tc_group_type, tc_group_length, tc_second_type, tc_second_length;
|
|
|
- wire [7:0] tc_group_base, tc_second_base;
|
|
|
-
|
|
|
- unified_tx_arbiter #(.ADDR_WIDTH(8)) u_tx_arbiter (
|
|
|
+ unified_tx_arbiter #(
|
|
|
+ .ADDR_WIDTH(8)
|
|
|
+ ) u_arbiter (
|
|
|
.clk(sys_clk), .rst_n(rst_n),
|
|
|
- .group_valid(tc_group_valid), .group_second(tc_group_second),
|
|
|
- .group_type(tc_group_type), .group_length(tc_group_length),
|
|
|
- .second_type(tc_second_type), .second_length(tc_second_length),
|
|
|
- .group_base(tc_group_base), .second_base(tc_second_base),
|
|
|
+ .group_valid(arb_group_valid),
|
|
|
+ .group_second(arb_group_second),
|
|
|
+ .group_type(arb_group_type),
|
|
|
+ .group_length(arb_group_length),
|
|
|
+ .second_type(arb_second_type),
|
|
|
+ .second_length(arb_second_length),
|
|
|
+ .group_base(arb_group_base),
|
|
|
+ .second_base(arb_second_base),
|
|
|
.group_done(arb_group_done),
|
|
|
.done_pending(done_pending),
|
|
|
.done_reason_0(done_reason_0), .done_reason_1(done_reason_1),
|
|
|
@@ -430,37 +458,15 @@ module prod2u_mrdimm_final_top #(
|
|
|
.done_steps_8(done_steps_8), .done_steps_9(done_steps_9),
|
|
|
.done_steps_10(done_steps_10), .done_steps_11(done_steps_11),
|
|
|
.done_ack(done_ack),
|
|
|
- .rep_wr_en(arb_rep_wr_en), .rep_wr_addr(arb_rep_wr_addr), .rep_wr_data(arb_rep_wr_data),
|
|
|
- .tx_start(arb_tx_start), .tx_type(arb_tx_type), .tx_length(arb_tx_length),
|
|
|
- .tx_base(arb_tx_base), .tx_busy(arb_tx_busy), .tx_done(arb_tx_done)
|
|
|
- );
|
|
|
-
|
|
|
- // ------------------------------------------------------------------------
|
|
|
- // Transaction Core (Atomic SET_ALL / GET_ALL / NACK)
|
|
|
- // ------------------------------------------------------------------------
|
|
|
- mrdimm_transaction_core #(.ADDR_WIDTH(8)) u_core (
|
|
|
- .clk(sys_clk), .rst_n(rst_n),
|
|
|
- .req_valid(req_valid), .req_ready(req_ready),
|
|
|
- .req_type(req_type), .req_length(req_length),
|
|
|
- .req_ram_rd_addr(req_ram_rd_addr), .req_ram_rd_data(req_ram_rd_data),
|
|
|
- .watchdog_reload(watchdog_reload),
|
|
|
- .stage_we(stage_we), .stage_addr(stage_addr), .stage_data(stage_data),
|
|
|
- .stage_commit(stage_commit),
|
|
|
- .act_enqueue_we(act_enqueue_we),
|
|
|
- .act_enqueue_axis(act_enqueue_axis),
|
|
|
- .act_enqueue_steps(act_enqueue_steps),
|
|
|
- .act_enqueue_half_period_us(act_enqueue_half_period_us),
|
|
|
- .act_enqueue_dir(act_enqueue_dir),
|
|
|
- .act_stop_clear_mask(act_stop_clear_mask),
|
|
|
- .act_axis_queue_full(act_axis_queue_full),
|
|
|
- .get_data_start(get_data_start), .get_data_done(get_data_done),
|
|
|
- .nack_reply_we(tc_nack_reply_we), .nack_reply_addr(tc_nack_reply_addr),
|
|
|
- .nack_reply_data(tc_nack_reply_data),
|
|
|
- .group_valid(tc_group_valid), .group_second(tc_group_second),
|
|
|
- .group_type(tc_group_type), .group_length(tc_group_length),
|
|
|
- .second_type(tc_second_type), .second_length(tc_second_length),
|
|
|
- .group_base(tc_group_base), .second_base(tc_second_base),
|
|
|
- .group_done(arb_group_done)
|
|
|
+ .rep_wr_en(arb_rep_wr_en),
|
|
|
+ .rep_wr_addr(arb_rep_wr_addr),
|
|
|
+ .rep_wr_data(arb_rep_wr_data),
|
|
|
+ .tx_start(arb_tx_start),
|
|
|
+ .tx_type(arb_tx_type),
|
|
|
+ .tx_length(arb_tx_length),
|
|
|
+ .tx_base(arb_tx_base),
|
|
|
+ .tx_busy(arb_tx_busy),
|
|
|
+ .tx_done(arb_tx_done)
|
|
|
);
|
|
|
|
|
|
endmodule
|