|
@@ -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
|