|
@@ -1,771 +0,0 @@
|
|
|
-`timescale 1ns/1ps
|
|
|
|
|
-
|
|
|
|
|
-module binary921_diag_core #(
|
|
|
|
|
- parameter integer BMC_UART_CLKS_PER_BIT = 217,
|
|
|
|
|
- parameter integer HOST_UART_CLKS_PER_BIT = 217,
|
|
|
|
|
- parameter integer DEBUG_UART_CLKS_PER_BIT = 27,
|
|
|
|
|
- parameter integer STARTUP_DELAY_TICKS = 250000,
|
|
|
|
|
- parameter integer COMMAND_GAP_TICKS = 25000000,
|
|
|
|
|
- parameter integer STATUS_PERIOD_TICKS = 25000000,
|
|
|
|
|
- parameter integer HOST_TIMEOUT_TICKS = 125000000,
|
|
|
|
|
- parameter integer PTC_PWM_PERIOD_TICKS = 2500000,
|
|
|
|
|
- parameter integer FAN_PWM_PERIOD_TICKS = 1000,
|
|
|
|
|
- parameter integer SNAPSHOT_PERIOD_TICKS = 25000000,
|
|
|
|
|
- parameter integer PIN_PROFILE = 0,
|
|
|
|
|
- parameter integer COMBINED_HOST_DEBUG_UART = 0,
|
|
|
|
|
- parameter integer READY_REPEAT_COUNT = 3,
|
|
|
|
|
- parameter [31:0] BUILD_ID = 32'h00000000
|
|
|
|
|
-) (
|
|
|
|
|
- input wire sys_clk,
|
|
|
|
|
- input wire sys_rst_n,
|
|
|
|
|
- input wire bmc_uart_rx,
|
|
|
|
|
- output wire bmc_uart_tx,
|
|
|
|
|
- input wire debug_uart_rx,
|
|
|
|
|
- output wire debug_uart_tx,
|
|
|
|
|
- input wire host_uart_rx,
|
|
|
|
|
- output wire host_uart_tx,
|
|
|
|
|
- output reg [23:0] ptc_pwm_out,
|
|
|
|
|
- output reg [3:0] fan_pwm_out,
|
|
|
|
|
- input wire [7:0] fan_fg_in,
|
|
|
|
|
- input wire [3:0] fan_install_in,
|
|
|
|
|
- output wire [7:0] led
|
|
|
|
|
-);
|
|
|
|
|
- localparam [7:0] PROFILE_DEBUG = 8'd1;
|
|
|
|
|
- localparam [7:0] PROFILE_FORMAL = 8'd2;
|
|
|
|
|
- localparam [7:0] PROFILE_PRODUCTION = 8'd3;
|
|
|
|
|
- localparam [7:0] PROFILE_ID = (PIN_PROFILE == 2) ? PROFILE_PRODUCTION : ((PIN_PROFILE == 0) ? PROFILE_DEBUG : PROFILE_FORMAL);
|
|
|
|
|
- localparam [7:0] POR_REASON_CONFIG = 8'h01;
|
|
|
|
|
- localparam [7:0] FT_READY = 8'h01;
|
|
|
|
|
- localparam [7:0] FT_BMC_PAYLOAD = 8'h03;
|
|
|
|
|
- localparam [7:0] FT_SENSOR_CACHE = 8'h04;
|
|
|
|
|
- localparam [7:0] FT_HOST_CMD = 8'h05;
|
|
|
|
|
- localparam [7:0] FT_HOST_ACK = 8'h06;
|
|
|
|
|
- localparam [7:0] FT_PWM_STATE = 8'h07;
|
|
|
|
|
- localparam [7:0] FT_PID_STATE = 8'h08;
|
|
|
|
|
- localparam [7:0] FT_TIMEOUT_STATE = 8'h09;
|
|
|
|
|
- localparam [7:0] FT_PIN_PROFILE = 8'h0a;
|
|
|
|
|
- localparam [7:0] FT_MODULE_SNAPSHOT = 8'h0b;
|
|
|
|
|
- localparam [7:0] FT_ERROR_COUNTERS = 8'h0c;
|
|
|
|
|
- localparam [7:0] CMD_SET_PTC = 8'h20;
|
|
|
|
|
- localparam [7:0] CMD_SET_FAN = 8'h21;
|
|
|
|
|
- localparam [7:0] CMD_GET_SENSOR = 8'h22;
|
|
|
|
|
- localparam [7:0] CMD_GET_MAP = 8'h23;
|
|
|
|
|
- localparam [7:0] CMD_GET_STATUS = 8'h24;
|
|
|
|
|
- localparam [7:0] CMD_SET_PID_REQUESTED = 8'h25;
|
|
|
|
|
- localparam [7:0] CMD_DISABLE = 8'h26;
|
|
|
|
|
- localparam [31:0] PTC_PWM_STEP_TICKS = (PTC_PWM_PERIOD_TICKS < 100) ? 32'd1 : (PTC_PWM_PERIOD_TICKS / 100);
|
|
|
|
|
- localparam [31:0] FAN_PWM_STEP_TICKS = (FAN_PWM_PERIOD_TICKS < 100) ? 32'd1 : (FAN_PWM_PERIOD_TICKS / 100);
|
|
|
|
|
-
|
|
|
|
|
- wire host_rx_valid;
|
|
|
|
|
- wire [7:0] host_rx_data;
|
|
|
|
|
- wire host_rx_ready;
|
|
|
|
|
- wire host_rx_framing_error;
|
|
|
|
|
- wire host_rx_break;
|
|
|
|
|
- wire host_rx_overflow;
|
|
|
|
|
- reg host_tx_valid;
|
|
|
|
|
- reg [7:0] host_tx_data;
|
|
|
|
|
- wire host_tx_ready;
|
|
|
|
|
- wire host_tx_busy;
|
|
|
|
|
-
|
|
|
|
|
- wire debug_phy_tx_ready;
|
|
|
|
|
- wire debug_tx_busy;
|
|
|
|
|
- wire debug_frame_tx_ready;
|
|
|
|
|
- wire ack_frame_tx_ready;
|
|
|
|
|
- wire debug_phy_tx_valid;
|
|
|
|
|
- wire diag_tx_valid;
|
|
|
|
|
- wire [7:0] diag_tx_data;
|
|
|
|
|
- reg diag_start;
|
|
|
|
|
- reg [7:0] diag_type;
|
|
|
|
|
- reg [31:0] diag_seq;
|
|
|
|
|
- reg [7:0] diag_payload_len;
|
|
|
|
|
- reg [511:0] diag_payload;
|
|
|
|
|
- wire diag_busy;
|
|
|
|
|
- wire diag_done;
|
|
|
|
|
-
|
|
|
|
|
- wire bmc_rx_valid;
|
|
|
|
|
- wire [7:0] bmc_rx_data;
|
|
|
|
|
- wire bmc_rx_ready;
|
|
|
|
|
- wire bmc_rx_framing_error;
|
|
|
|
|
- wire bmc_rx_break;
|
|
|
|
|
- wire bmc_rx_overflow;
|
|
|
|
|
- wire bmc_tx_ready;
|
|
|
|
|
- wire bmc_tx_busy;
|
|
|
|
|
- wire bmc_poll_tx_valid;
|
|
|
|
|
- wire [7:0] bmc_poll_tx_data;
|
|
|
|
|
- wire bmc_poll_ready;
|
|
|
|
|
- wire bmc_poll_accept;
|
|
|
|
|
- wire bmc_frame_valid;
|
|
|
|
|
- wire [7:0] bmc_frame_byte;
|
|
|
|
|
- wire [5:0] bmc_frame_index;
|
|
|
|
|
- wire [15:0] bmc_frame_seq;
|
|
|
|
|
- wire bmc_frame_done;
|
|
|
|
|
- wire bmc_parser_error;
|
|
|
|
|
- wire [2:0] bmc_parser_state;
|
|
|
|
|
- wire [15:0] bmc_token_count;
|
|
|
|
|
- wire [15:0] bmc_rejected_echo_windows;
|
|
|
|
|
- wire [15:0] bmc_startup_wake_sent_count;
|
|
|
|
|
- wire [15:0] bmc_poll_command_count;
|
|
|
|
|
- wire [15:0] bmc_tx_byte_count;
|
|
|
|
|
- wire [15:0] bmc_rx_byte_count;
|
|
|
|
|
-
|
|
|
|
|
- wire cmd_valid;
|
|
|
|
|
- wire [31:0] cmd_seq;
|
|
|
|
|
- wire [7:0] cmd_id;
|
|
|
|
|
- wire [7:0] cmd_ch;
|
|
|
|
|
- wire [7:0] cmd_pct;
|
|
|
|
|
- wire bad_host_frame;
|
|
|
|
|
- wire [15:0] bad_host_frame_count;
|
|
|
|
|
-
|
|
|
|
|
- reg [31:0] tick;
|
|
|
|
|
- reg [31:0] debug_frame_seq;
|
|
|
|
|
- reg [31:0] host_ack_seq;
|
|
|
|
|
- reg [6:0] ptc_level [0:23];
|
|
|
|
|
- reg [6:0] fan_level [0:3];
|
|
|
|
|
- reg [6:0] sensor_temp [0:23];
|
|
|
|
|
- reg [23:0] sensor_missing;
|
|
|
|
|
- reg [7:0] valid_count;
|
|
|
|
|
- reg [7:0] missing_count;
|
|
|
|
|
- reg [7:0] last_status_code;
|
|
|
|
|
- reg [7:0] last_cmd_id;
|
|
|
|
|
- reg [7:0] last_cmd_ch;
|
|
|
|
|
- reg [7:0] last_cmd_pct;
|
|
|
|
|
- reg pid_requested;
|
|
|
|
|
- reg timeout_active;
|
|
|
|
|
- reg [31:0] host_timeout_counter;
|
|
|
|
|
- reg [31:0] status_counter;
|
|
|
|
|
- reg [31:0] snapshot_counter;
|
|
|
|
|
- reg [31:0] startup_counter;
|
|
|
|
|
- reg ready_sent;
|
|
|
|
|
- reg [31:0] ready_repeat_count;
|
|
|
|
|
- reg [31:0] ready_timestamp_tick;
|
|
|
|
|
- reg [7:0] ready_announcement_seq;
|
|
|
|
|
- reg [4:0] sensor_index;
|
|
|
|
|
- reg [4:0] bmc_pair_index;
|
|
|
|
|
- reg [7:0] bmc_prev_byte;
|
|
|
|
|
- reg [15:0] bmc_payload_checksum;
|
|
|
|
|
- reg [7:0] bmc_payload_first;
|
|
|
|
|
- reg [7:0] bmc_payload_last;
|
|
|
|
|
- reg [7:0] bmc_payload_count;
|
|
|
|
|
- reg [15:0] command_count_seen;
|
|
|
|
|
- reg [7:0] host_err_count;
|
|
|
|
|
- reg [7:0] cmd_status_value;
|
|
|
|
|
- reg [15:0] cmd_hash_value;
|
|
|
|
|
- reg [6:0] dimm_temp_clamped;
|
|
|
|
|
- reg [15:0] bmc_next_checksum;
|
|
|
|
|
- reg [7:0] bmc_next_count;
|
|
|
|
|
- reg [7:0] bmc_next_first;
|
|
|
|
|
- reg [7:0] bmc_next_last;
|
|
|
|
|
- reg [7:0] next_valid_count;
|
|
|
|
|
- reg [7:0] next_missing_count;
|
|
|
|
|
- reg [23:0] next_sensor_missing;
|
|
|
|
|
- reg bmc_payload_pending;
|
|
|
|
|
- reg sensor_cache_pending;
|
|
|
|
|
- reg [31:0] ptc_pwm_counter;
|
|
|
|
|
- reg [31:0] fan_pwm_counter;
|
|
|
|
|
- reg bmc_tx_valid;
|
|
|
|
|
- reg [7:0] bmc_tx_data;
|
|
|
|
|
- reg bmc_tx_inflight;
|
|
|
|
|
- reg bmc_poll_hold_valid;
|
|
|
|
|
- reg [7:0] bmc_poll_hold_data;
|
|
|
|
|
- reg [1:0] combined_tx_owner;
|
|
|
|
|
- integer i;
|
|
|
|
|
-
|
|
|
|
|
- localparam [1:0] COMBINED_OWNER_NONE = 2'd0;
|
|
|
|
|
- localparam [1:0] COMBINED_OWNER_ACK = 2'd1;
|
|
|
|
|
- localparam [1:0] COMBINED_OWNER_DIAG = 2'd2;
|
|
|
|
|
- wire [31:0] diag_timestamp_tick = (diag_type == FT_READY) ? ready_timestamp_tick : tick;
|
|
|
|
|
-
|
|
|
|
|
- uart_rx_8n1 #(.CLKS_PER_BIT(HOST_UART_CLKS_PER_BIT)) u_host_rx (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .rx_i(host_uart_rx),
|
|
|
|
|
- .rx_valid(host_rx_valid),
|
|
|
|
|
- .rx_data(host_rx_data),
|
|
|
|
|
- .rx_ready(host_rx_ready),
|
|
|
|
|
- .framing_error(host_rx_framing_error),
|
|
|
|
|
- .break_detected(host_rx_break),
|
|
|
|
|
- .overflow(host_rx_overflow)
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- uart_tx_8n1 #(.CLKS_PER_BIT(HOST_UART_CLKS_PER_BIT)) u_host_tx (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .tx_valid(host_tx_valid),
|
|
|
|
|
- .tx_data(host_tx_data),
|
|
|
|
|
- .tx_ready(host_tx_ready),
|
|
|
|
|
- .tx_o(host_uart_tx),
|
|
|
|
|
- .busy(host_tx_busy)
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- uart_rx_8n1 #(.CLKS_PER_BIT(BMC_UART_CLKS_PER_BIT)) u_bmc_rx (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .rx_i(bmc_uart_rx),
|
|
|
|
|
- .rx_valid(bmc_rx_valid),
|
|
|
|
|
- .rx_data(bmc_rx_data),
|
|
|
|
|
- .rx_ready(bmc_rx_ready),
|
|
|
|
|
- .framing_error(bmc_rx_framing_error),
|
|
|
|
|
- .break_detected(bmc_rx_break),
|
|
|
|
|
- .overflow(bmc_rx_overflow)
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- uart_tx_8n1 #(.CLKS_PER_BIT(BMC_UART_CLKS_PER_BIT)) u_bmc_tx (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .tx_valid(bmc_tx_valid),
|
|
|
|
|
- .tx_data(bmc_tx_data),
|
|
|
|
|
- .tx_ready(bmc_tx_ready),
|
|
|
|
|
- .tx_o(bmc_uart_tx),
|
|
|
|
|
- .busy(bmc_tx_busy)
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- assign bmc_poll_ready = bmc_tx_ready && !bmc_tx_inflight && !bmc_poll_hold_valid && !bmc_poll_tx_valid;
|
|
|
|
|
- assign bmc_poll_accept = bmc_poll_tx_valid && bmc_tx_ready && !bmc_tx_inflight && !bmc_poll_hold_valid;
|
|
|
|
|
-
|
|
|
|
|
- assign debug_phy_tx_valid = (COMBINED_HOST_DEBUG_UART != 0) ? 1'b0 : diag_tx_valid;
|
|
|
|
|
-
|
|
|
|
|
- uart_tx_8n1 #(.CLKS_PER_BIT(DEBUG_UART_CLKS_PER_BIT)) u_debug_tx (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .tx_valid(debug_phy_tx_valid),
|
|
|
|
|
- .tx_data(diag_tx_data),
|
|
|
|
|
- .tx_ready(debug_phy_tx_ready),
|
|
|
|
|
- .tx_o(debug_uart_tx),
|
|
|
|
|
- .busy(debug_tx_busy)
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- binary921_host_rx u_host_binary_rx (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .expected_profile_id(PROFILE_ID),
|
|
|
|
|
- .rx_valid(host_rx_valid),
|
|
|
|
|
- .rx_data(host_rx_data),
|
|
|
|
|
- .rx_ready(host_rx_ready),
|
|
|
|
|
- .cmd_valid(cmd_valid),
|
|
|
|
|
- .cmd_seq(cmd_seq),
|
|
|
|
|
- .cmd_id(cmd_id),
|
|
|
|
|
- .cmd_ch(cmd_ch),
|
|
|
|
|
- .cmd_pct(cmd_pct),
|
|
|
|
|
- .bad_frame(bad_host_frame),
|
|
|
|
|
- .bad_frame_count(bad_host_frame_count)
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- bmc_uart_raw48_poll_lite #(
|
|
|
|
|
- .POLL_PERIOD_TICKS(COMMAND_GAP_TICKS),
|
|
|
|
|
- .STARTUP_WAKE_COUNT(3),
|
|
|
|
|
- .STARTUP_WAKE_GAP_TICKS(STARTUP_DELAY_TICKS),
|
|
|
|
|
- .STARTUP_POST_WAKE_DELAY_TICKS(STARTUP_DELAY_TICKS),
|
|
|
|
|
- .WAIT_FOR_FRAME_BEFORE_NEXT_POLL(1)
|
|
|
|
|
- ) u_bmc_poll (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .tx_ready(bmc_poll_ready),
|
|
|
|
|
- .tx_valid(bmc_poll_tx_valid),
|
|
|
|
|
- .tx_data(bmc_poll_tx_data),
|
|
|
|
|
- .rx_valid(bmc_rx_valid),
|
|
|
|
|
- .rx_data(bmc_rx_data),
|
|
|
|
|
- .frame_valid(bmc_frame_valid),
|
|
|
|
|
- .frame_byte(bmc_frame_byte),
|
|
|
|
|
- .frame_index(bmc_frame_index),
|
|
|
|
|
- .frame_seq(bmc_frame_seq),
|
|
|
|
|
- .frame_done(bmc_frame_done),
|
|
|
|
|
- .parser_error(bmc_parser_error),
|
|
|
|
|
- .stale(),
|
|
|
|
|
- .parser_state(bmc_parser_state),
|
|
|
|
|
- .token_count(bmc_token_count),
|
|
|
|
|
- .rejected_echo_windows(bmc_rejected_echo_windows),
|
|
|
|
|
- .startup_wake_sent_count(bmc_startup_wake_sent_count),
|
|
|
|
|
- .poll_command_count(bmc_poll_command_count),
|
|
|
|
|
- .tx_byte_count(bmc_tx_byte_count),
|
|
|
|
|
- .rx_byte_count(bmc_rx_byte_count)
|
|
|
|
|
- );
|
|
|
|
|
- assign bmc_rx_ready = 1'b1;
|
|
|
|
|
-
|
|
|
|
|
- binary921_frame_tx #(.MAX_PAYLOAD_BYTES(64)) u_diag_frame_tx (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .start(diag_start),
|
|
|
|
|
- .profile_id(PROFILE_ID),
|
|
|
|
|
- .frame_type(diag_type),
|
|
|
|
|
- .frame_seq(diag_seq),
|
|
|
|
|
- .timestamp_tick(diag_timestamp_tick),
|
|
|
|
|
- .payload_len(diag_payload_len),
|
|
|
|
|
- .payload(diag_payload),
|
|
|
|
|
- .busy(diag_busy),
|
|
|
|
|
- .done(diag_done),
|
|
|
|
|
- .tx_valid(diag_tx_valid),
|
|
|
|
|
- .tx_data(diag_tx_data),
|
|
|
|
|
- .tx_ready(debug_frame_tx_ready)
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- wire ack_tx_valid;
|
|
|
|
|
- wire [7:0] ack_tx_data;
|
|
|
|
|
- reg ack_start;
|
|
|
|
|
- reg [7:0] ack_payload_len;
|
|
|
|
|
- reg [511:0] ack_payload;
|
|
|
|
|
- wire ack_busy;
|
|
|
|
|
- wire ack_done;
|
|
|
|
|
-
|
|
|
|
|
- binary921_frame_tx #(.MAX_PAYLOAD_BYTES(64)) u_host_ack_tx (
|
|
|
|
|
- .clk(sys_clk),
|
|
|
|
|
- .rst_n(sys_rst_n),
|
|
|
|
|
- .start(ack_start),
|
|
|
|
|
- .profile_id(PROFILE_ID),
|
|
|
|
|
- .frame_type(FT_HOST_ACK),
|
|
|
|
|
- .frame_seq(host_ack_seq),
|
|
|
|
|
- .timestamp_tick(tick),
|
|
|
|
|
- .payload_len(ack_payload_len),
|
|
|
|
|
- .payload(ack_payload),
|
|
|
|
|
- .busy(ack_busy),
|
|
|
|
|
- .done(ack_done),
|
|
|
|
|
- .tx_valid(ack_tx_valid),
|
|
|
|
|
- .tx_data(ack_tx_data),
|
|
|
|
|
- .tx_ready(ack_frame_tx_ready)
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- assign ack_frame_tx_ready = (COMBINED_HOST_DEBUG_UART != 0) ? ((combined_tx_owner == COMBINED_OWNER_ACK) && host_tx_ready) : host_tx_ready;
|
|
|
|
|
- assign debug_frame_tx_ready = (COMBINED_HOST_DEBUG_UART != 0) ? ((combined_tx_owner == COMBINED_OWNER_DIAG) && host_tx_ready) : debug_phy_tx_ready;
|
|
|
|
|
-
|
|
|
|
|
- always @* begin
|
|
|
|
|
- if (COMBINED_HOST_DEBUG_UART != 0) begin
|
|
|
|
|
- if (combined_tx_owner == COMBINED_OWNER_ACK) begin
|
|
|
|
|
- host_tx_valid = ack_tx_valid;
|
|
|
|
|
- host_tx_data = ack_tx_data;
|
|
|
|
|
- end else if (combined_tx_owner == COMBINED_OWNER_DIAG) begin
|
|
|
|
|
- host_tx_valid = diag_tx_valid;
|
|
|
|
|
- host_tx_data = diag_tx_data;
|
|
|
|
|
- end else begin
|
|
|
|
|
- host_tx_valid = 1'b0;
|
|
|
|
|
- host_tx_data = 8'd0;
|
|
|
|
|
- end
|
|
|
|
|
- end else begin
|
|
|
|
|
- host_tx_valid = ack_tx_valid;
|
|
|
|
|
- host_tx_data = ack_tx_data;
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- function [7:0] dimm_temp_value;
|
|
|
|
|
- input [7:0] integer_part;
|
|
|
|
|
- input [7:0] fraction_part;
|
|
|
|
|
- begin
|
|
|
|
|
- if (integer_part > 8'd100) begin
|
|
|
|
|
- dimm_temp_value = 8'd100;
|
|
|
|
|
- end else begin
|
|
|
|
|
- dimm_temp_value = integer_part;
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
- endfunction
|
|
|
|
|
-
|
|
|
|
|
- function [15:0] state_hash16;
|
|
|
|
|
- input [7:0] status_code;
|
|
|
|
|
- begin
|
|
|
|
|
- state_hash16 = {8'd0, status_code} ^
|
|
|
|
|
- {9'd0, ptc_level[0]} ^
|
|
|
|
|
- {9'd0, ptc_level[23]} ^
|
|
|
|
|
- {9'd0, fan_level[0]} ^
|
|
|
|
|
- {9'd0, fan_level[3]} ^
|
|
|
|
|
- {15'd0, pid_requested} ^
|
|
|
|
|
- {15'd0, timeout_active};
|
|
|
|
|
- end
|
|
|
|
|
- endfunction
|
|
|
|
|
-
|
|
|
|
|
- function [15:0] command_hash16;
|
|
|
|
|
- input [7:0] status_code;
|
|
|
|
|
- input [7:0] command_value;
|
|
|
|
|
- input [7:0] channel_value;
|
|
|
|
|
- input [7:0] percent_value;
|
|
|
|
|
- begin
|
|
|
|
|
- command_hash16 = state_hash16(status_code) ^
|
|
|
|
|
- {command_value, channel_value} ^
|
|
|
|
|
- {8'd0, percent_value};
|
|
|
|
|
- end
|
|
|
|
|
- endfunction
|
|
|
|
|
-
|
|
|
|
|
- function [31:0] duty_threshold;
|
|
|
|
|
- input [31:0] step_ticks;
|
|
|
|
|
- input [6:0] percent_value;
|
|
|
|
|
- begin
|
|
|
|
|
- duty_threshold = step_ticks * {25'd0, percent_value};
|
|
|
|
|
- end
|
|
|
|
|
- endfunction
|
|
|
|
|
-
|
|
|
|
|
- task queue_diag_frame;
|
|
|
|
|
- input [7:0] frame_type;
|
|
|
|
|
- input [7:0] length;
|
|
|
|
|
- input [511:0] payload_value;
|
|
|
|
|
- begin
|
|
|
|
|
- if (!diag_busy && !diag_start) begin
|
|
|
|
|
- debug_frame_seq <= debug_frame_seq + 32'd1;
|
|
|
|
|
- diag_seq <= debug_frame_seq + 32'd1;
|
|
|
|
|
- diag_type <= frame_type;
|
|
|
|
|
- diag_payload_len <= length;
|
|
|
|
|
- diag_payload <= payload_value;
|
|
|
|
|
- diag_start <= 1'b1;
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
- endtask
|
|
|
|
|
-
|
|
|
|
|
- task queue_ack;
|
|
|
|
|
- input [31:0] seq_value;
|
|
|
|
|
- input [7:0] command_value;
|
|
|
|
|
- input [7:0] status_value;
|
|
|
|
|
- input [15:0] hash_value;
|
|
|
|
|
- begin
|
|
|
|
|
- if (!ack_busy && !ack_start) begin
|
|
|
|
|
- host_ack_seq <= seq_value;
|
|
|
|
|
- ack_payload_len <= 8'd6;
|
|
|
|
|
- ack_payload <= {464'd0, hash_value[15:8], hash_value[7:0], 8'd0, status_value, command_value, 8'd1};
|
|
|
|
|
- ack_start <= 1'b1;
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
- endtask
|
|
|
|
|
-
|
|
|
|
|
- always @(posedge sys_clk or negedge sys_rst_n) begin
|
|
|
|
|
- if (!sys_rst_n) begin
|
|
|
|
|
- tick <= 32'd0;
|
|
|
|
|
- debug_frame_seq <= 32'd0;
|
|
|
|
|
- host_ack_seq <= 32'd0;
|
|
|
|
|
- diag_start <= 1'b0;
|
|
|
|
|
- diag_type <= 8'd0;
|
|
|
|
|
- diag_seq <= 32'd0;
|
|
|
|
|
- diag_payload_len <= 8'd0;
|
|
|
|
|
- diag_payload <= 512'd0;
|
|
|
|
|
- bmc_tx_valid <= 1'b0;
|
|
|
|
|
- bmc_tx_data <= 8'd0;
|
|
|
|
|
- bmc_tx_inflight <= 1'b0;
|
|
|
|
|
- bmc_poll_hold_valid <= 1'b0;
|
|
|
|
|
- bmc_poll_hold_data <= 8'd0;
|
|
|
|
|
- combined_tx_owner <= COMBINED_OWNER_NONE;
|
|
|
|
|
- ack_start <= 1'b0;
|
|
|
|
|
- ack_payload_len <= 8'd0;
|
|
|
|
|
- ack_payload <= 512'd0;
|
|
|
|
|
- ready_sent <= 1'b0;
|
|
|
|
|
- ready_repeat_count <= 32'd0;
|
|
|
|
|
- ready_timestamp_tick <= 32'd0;
|
|
|
|
|
- ready_announcement_seq <= 8'd0;
|
|
|
|
|
- startup_counter <= 32'd0;
|
|
|
|
|
- status_counter <= 32'd0;
|
|
|
|
|
- snapshot_counter <= 32'd0;
|
|
|
|
|
- host_timeout_counter <= 32'd0;
|
|
|
|
|
- timeout_active <= 1'b0;
|
|
|
|
|
- pid_requested <= 1'b0;
|
|
|
|
|
- sensor_missing <= 24'hffffff;
|
|
|
|
|
- valid_count <= 8'd0;
|
|
|
|
|
- missing_count <= 8'd24;
|
|
|
|
|
- last_status_code <= 8'd0;
|
|
|
|
|
- last_cmd_id <= 8'd0;
|
|
|
|
|
- last_cmd_ch <= 8'd0;
|
|
|
|
|
- last_cmd_pct <= 8'd0;
|
|
|
|
|
- sensor_index <= 5'd0;
|
|
|
|
|
- bmc_pair_index <= 5'd0;
|
|
|
|
|
- bmc_prev_byte <= 8'd0;
|
|
|
|
|
- bmc_payload_checksum <= 16'd0;
|
|
|
|
|
- bmc_payload_first <= 8'd0;
|
|
|
|
|
- bmc_payload_last <= 8'd0;
|
|
|
|
|
- bmc_payload_count <= 8'd0;
|
|
|
|
|
- command_count_seen <= 16'd0;
|
|
|
|
|
- host_err_count <= 8'd0;
|
|
|
|
|
- cmd_status_value <= 8'd0;
|
|
|
|
|
- cmd_hash_value <= 16'd0;
|
|
|
|
|
- dimm_temp_clamped <= 7'd0;
|
|
|
|
|
- bmc_next_checksum <= 16'd0;
|
|
|
|
|
- bmc_next_count <= 8'd0;
|
|
|
|
|
- bmc_next_first <= 8'd0;
|
|
|
|
|
- bmc_next_last <= 8'd0;
|
|
|
|
|
- next_valid_count <= 8'd0;
|
|
|
|
|
- next_missing_count <= 8'd24;
|
|
|
|
|
- next_sensor_missing <= 24'hffffff;
|
|
|
|
|
- bmc_payload_pending <= 1'b0;
|
|
|
|
|
- sensor_cache_pending <= 1'b0;
|
|
|
|
|
- ptc_pwm_counter <= 32'd0;
|
|
|
|
|
- fan_pwm_counter <= 32'd0;
|
|
|
|
|
- ptc_pwm_out <= 24'd0;
|
|
|
|
|
- fan_pwm_out <= 4'd0;
|
|
|
|
|
- for (i = 0; i < 24; i = i + 1) begin
|
|
|
|
|
- ptc_level[i] <= 7'd0;
|
|
|
|
|
- sensor_temp[i] <= 7'd0;
|
|
|
|
|
- end
|
|
|
|
|
- for (i = 0; i < 4; i = i + 1) begin
|
|
|
|
|
- fan_level[i] <= 7'd30;
|
|
|
|
|
- end
|
|
|
|
|
- end else begin
|
|
|
|
|
- tick <= tick + 32'd1;
|
|
|
|
|
- diag_start <= 1'b0;
|
|
|
|
|
- ack_start <= 1'b0;
|
|
|
|
|
- bmc_tx_valid <= 1'b0;
|
|
|
|
|
- if (bmc_tx_inflight && bmc_tx_busy) begin
|
|
|
|
|
- bmc_tx_inflight <= 1'b0;
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (COMBINED_HOST_DEBUG_UART != 0) begin
|
|
|
|
|
- if (combined_tx_owner == COMBINED_OWNER_ACK) begin
|
|
|
|
|
- if (ack_done) begin
|
|
|
|
|
- combined_tx_owner <= COMBINED_OWNER_NONE;
|
|
|
|
|
- end
|
|
|
|
|
- end else if (combined_tx_owner == COMBINED_OWNER_DIAG) begin
|
|
|
|
|
- if (diag_done) begin
|
|
|
|
|
- combined_tx_owner <= COMBINED_OWNER_NONE;
|
|
|
|
|
- end
|
|
|
|
|
- end else if (ack_busy || ack_start || ack_tx_valid) begin
|
|
|
|
|
- combined_tx_owner <= COMBINED_OWNER_ACK;
|
|
|
|
|
- end else if (diag_busy || diag_start || diag_tx_valid) begin
|
|
|
|
|
- combined_tx_owner <= COMBINED_OWNER_DIAG;
|
|
|
|
|
- end
|
|
|
|
|
- end else begin
|
|
|
|
|
- combined_tx_owner <= COMBINED_OWNER_NONE;
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (startup_counter < STARTUP_DELAY_TICKS[31:0]) begin
|
|
|
|
|
- startup_counter <= startup_counter + 32'd1;
|
|
|
|
|
- end else if (ready_repeat_count < READY_REPEAT_COUNT) begin
|
|
|
|
|
- if (!diag_busy && !diag_start) begin
|
|
|
|
|
- if (ready_repeat_count == 32'd0) begin
|
|
|
|
|
- debug_frame_seq <= 32'd1;
|
|
|
|
|
- ready_timestamp_tick <= tick;
|
|
|
|
|
- end
|
|
|
|
|
- diag_seq <= 32'd1;
|
|
|
|
|
- diag_type <= FT_READY;
|
|
|
|
|
- diag_payload_len <= 8'd7;
|
|
|
|
|
- diag_payload <= {
|
|
|
|
|
- 456'd0,
|
|
|
|
|
- ready_announcement_seq,
|
|
|
|
|
- POR_REASON_CONFIG,
|
|
|
|
|
- BUILD_ID[31:24],
|
|
|
|
|
- BUILD_ID[23:16],
|
|
|
|
|
- BUILD_ID[15:8],
|
|
|
|
|
- BUILD_ID[7:0],
|
|
|
|
|
- PROFILE_ID
|
|
|
|
|
- };
|
|
|
|
|
- diag_start <= 1'b1;
|
|
|
|
|
- ready_repeat_count <= ready_repeat_count + 32'd1;
|
|
|
|
|
- ready_announcement_seq <= ready_announcement_seq + 8'd1;
|
|
|
|
|
- ready_sent <= 1'b1;
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (status_counter >= STATUS_PERIOD_TICKS[31:0]) begin
|
|
|
|
|
- status_counter <= 32'd0;
|
|
|
|
|
- queue_diag_frame(
|
|
|
|
|
- FT_ERROR_COUNTERS,
|
|
|
|
|
- 8'd12,
|
|
|
|
|
- {416'd0,
|
|
|
|
|
- host_err_count,
|
|
|
|
|
- {7'd0, host_rx_framing_error | host_rx_overflow | host_rx_break},
|
|
|
|
|
- bad_host_frame_count[15:8], bad_host_frame_count[7:0],
|
|
|
|
|
- bmc_rx_byte_count[15:8], bmc_rx_byte_count[7:0],
|
|
|
|
|
- bmc_tx_byte_count[15:8], bmc_tx_byte_count[7:0],
|
|
|
|
|
- bmc_poll_command_count[15:8], bmc_poll_command_count[7:0],
|
|
|
|
|
- bmc_frame_seq[15:8], bmc_frame_seq[7:0]}
|
|
|
|
|
- );
|
|
|
|
|
- end else begin
|
|
|
|
|
- status_counter <= status_counter + 32'd1;
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (snapshot_counter >= SNAPSHOT_PERIOD_TICKS[31:0]) begin
|
|
|
|
|
- snapshot_counter <= 32'd0;
|
|
|
|
|
- queue_diag_frame(
|
|
|
|
|
- FT_MODULE_SNAPSHOT,
|
|
|
|
|
- 8'd24,
|
|
|
|
|
- {320'd0,
|
|
|
|
|
- fan_install_in,
|
|
|
|
|
- fan_fg_in,
|
|
|
|
|
- {1'b0, fan_level[3]}, {1'b0, fan_level[0]},
|
|
|
|
|
- {1'b0, ptc_level[23]}, {1'b0, ptc_level[0]},
|
|
|
|
|
- missing_count, valid_count,
|
|
|
|
|
- {7'd0, timeout_active}, {7'd0, pid_requested},
|
|
|
|
|
- last_status_code, last_cmd_pct, last_cmd_ch, last_cmd_id,
|
|
|
|
|
- bmc_payload_checksum[15:8], bmc_payload_checksum[7:0],
|
|
|
|
|
- bmc_payload_last, bmc_payload_first,
|
|
|
|
|
- command_count_seen[15:8], command_count_seen[7:0],
|
|
|
|
|
- host_err_count, PROFILE_ID}
|
|
|
|
|
- );
|
|
|
|
|
- end else begin
|
|
|
|
|
- snapshot_counter <= snapshot_counter + 32'd1;
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (bad_host_frame) begin
|
|
|
|
|
- host_err_count <= host_err_count + 8'd1;
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (bmc_poll_accept) begin
|
|
|
|
|
- bmc_poll_hold_valid <= 1'b1;
|
|
|
|
|
- bmc_poll_hold_data <= bmc_poll_tx_data;
|
|
|
|
|
- end
|
|
|
|
|
- if (bmc_poll_hold_valid && bmc_tx_ready && !bmc_tx_inflight) begin
|
|
|
|
|
- bmc_tx_data <= bmc_poll_hold_data;
|
|
|
|
|
- bmc_tx_valid <= 1'b1;
|
|
|
|
|
- bmc_tx_inflight <= 1'b1;
|
|
|
|
|
- bmc_poll_hold_valid <= 1'b0;
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (cmd_valid) begin
|
|
|
|
|
- last_cmd_id <= cmd_id;
|
|
|
|
|
- last_cmd_ch <= cmd_ch;
|
|
|
|
|
- last_cmd_pct <= cmd_pct;
|
|
|
|
|
- host_timeout_counter <= 32'd0;
|
|
|
|
|
- timeout_active <= 1'b0;
|
|
|
|
|
- command_count_seen <= command_count_seen + 16'd1;
|
|
|
|
|
- cmd_status_value = 8'd0;
|
|
|
|
|
- if (cmd_id == CMD_SET_PTC) begin
|
|
|
|
|
- if (cmd_ch >= 8'd1 && cmd_ch <= 8'd24 && cmd_pct <= 8'd100) begin
|
|
|
|
|
- ptc_level[cmd_ch - 8'd1] <= cmd_pct[6:0];
|
|
|
|
|
- end else begin
|
|
|
|
|
- cmd_status_value = 8'd1;
|
|
|
|
|
- end
|
|
|
|
|
- end else if (cmd_id == CMD_SET_FAN) begin
|
|
|
|
|
- if (cmd_ch >= 8'd1 && cmd_ch <= 8'd4 && cmd_pct <= 8'd100) begin
|
|
|
|
|
- fan_level[cmd_ch - 8'd1] <= cmd_pct[6:0];
|
|
|
|
|
- end else begin
|
|
|
|
|
- cmd_status_value = 8'd1;
|
|
|
|
|
- end
|
|
|
|
|
- end else if (cmd_id == CMD_SET_PID_REQUESTED) begin
|
|
|
|
|
- pid_requested <= cmd_ch[0];
|
|
|
|
|
- end else if (cmd_id == CMD_DISABLE) begin
|
|
|
|
|
- for (i = 0; i < 24; i = i + 1) begin
|
|
|
|
|
- ptc_level[i] <= 7'd0;
|
|
|
|
|
- end
|
|
|
|
|
- for (i = 0; i < 4; i = i + 1) begin
|
|
|
|
|
- fan_level[i] <= 7'd30;
|
|
|
|
|
- end
|
|
|
|
|
- end else if (cmd_id == CMD_GET_SENSOR || cmd_id == CMD_GET_MAP || cmd_id == CMD_GET_STATUS) begin
|
|
|
|
|
- cmd_status_value = 8'd0;
|
|
|
|
|
- end else begin
|
|
|
|
|
- cmd_status_value = 8'd2;
|
|
|
|
|
- end
|
|
|
|
|
- cmd_hash_value = command_hash16(cmd_status_value, cmd_id, cmd_ch, cmd_pct);
|
|
|
|
|
- last_status_code <= cmd_status_value;
|
|
|
|
|
- queue_ack(cmd_seq, cmd_id, cmd_status_value, cmd_hash_value);
|
|
|
|
|
- queue_diag_frame(
|
|
|
|
|
- FT_HOST_CMD,
|
|
|
|
|
- 8'd3,
|
|
|
|
|
- {488'd0, cmd_pct, cmd_ch, cmd_id}
|
|
|
|
|
- );
|
|
|
|
|
- end else if (host_timeout_counter >= HOST_TIMEOUT_TICKS[31:0]) begin
|
|
|
|
|
- timeout_active <= 1'b1;
|
|
|
|
|
- for (i = 0; i < 24; i = i + 1) begin
|
|
|
|
|
- ptc_level[i] <= 7'd0;
|
|
|
|
|
- end
|
|
|
|
|
- for (i = 0; i < 4; i = i + 1) begin
|
|
|
|
|
- fan_level[i] <= 7'd30;
|
|
|
|
|
- end
|
|
|
|
|
- end else begin
|
|
|
|
|
- host_timeout_counter <= host_timeout_counter + 32'd1;
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (bmc_frame_valid) begin
|
|
|
|
|
- if (bmc_frame_index == 6'd0) begin
|
|
|
|
|
- bmc_payload_checksum <= 16'd0;
|
|
|
|
|
- bmc_payload_first <= bmc_frame_byte;
|
|
|
|
|
- bmc_payload_count <= 8'd0;
|
|
|
|
|
- end
|
|
|
|
|
- bmc_next_checksum = (bmc_frame_index == 6'd0) ? {8'd0, bmc_frame_byte} : (bmc_payload_checksum + {8'd0, bmc_frame_byte});
|
|
|
|
|
- bmc_next_count = (bmc_frame_index == 6'd0) ? 8'd1 : (bmc_payload_count + 8'd1);
|
|
|
|
|
- bmc_next_first = (bmc_frame_index == 6'd0) ? bmc_frame_byte : bmc_payload_first;
|
|
|
|
|
- bmc_next_last = bmc_frame_byte;
|
|
|
|
|
- bmc_payload_count <= bmc_next_count;
|
|
|
|
|
- bmc_payload_checksum <= bmc_next_checksum;
|
|
|
|
|
- bmc_payload_first <= bmc_next_first;
|
|
|
|
|
- bmc_payload_last <= bmc_next_last;
|
|
|
|
|
- next_sensor_missing = sensor_missing;
|
|
|
|
|
- if (bmc_frame_index[0]) begin
|
|
|
|
|
- if (bmc_prev_byte == 8'hff && bmc_frame_byte == 8'hff) begin
|
|
|
|
|
- sensor_missing[bmc_pair_index] <= 1'b1;
|
|
|
|
|
- next_sensor_missing[bmc_pair_index] = 1'b1;
|
|
|
|
|
- sensor_temp[bmc_pair_index] <= 7'd0;
|
|
|
|
|
- end else begin
|
|
|
|
|
- sensor_missing[bmc_pair_index] <= 1'b0;
|
|
|
|
|
- next_sensor_missing[bmc_pair_index] = 1'b0;
|
|
|
|
|
- dimm_temp_clamped = dimm_temp_value(bmc_prev_byte, bmc_frame_byte);
|
|
|
|
|
- sensor_temp[bmc_pair_index] <= dimm_temp_clamped;
|
|
|
|
|
- end
|
|
|
|
|
- bmc_pair_index <= bmc_pair_index + 5'd1;
|
|
|
|
|
- end
|
|
|
|
|
- if (bmc_frame_index == 6'd0) begin
|
|
|
|
|
- bmc_pair_index <= 5'd0;
|
|
|
|
|
- next_sensor_missing = 24'hffffff;
|
|
|
|
|
- end
|
|
|
|
|
- bmc_prev_byte <= bmc_frame_byte;
|
|
|
|
|
- if (bmc_frame_done) begin
|
|
|
|
|
- next_valid_count = 8'd0;
|
|
|
|
|
- next_missing_count = 8'd0;
|
|
|
|
|
- for (i = 0; i < 24; i = i + 1) begin
|
|
|
|
|
- if (next_sensor_missing[i]) begin
|
|
|
|
|
- next_missing_count = next_missing_count + 8'd1;
|
|
|
|
|
- end else begin
|
|
|
|
|
- next_valid_count = next_valid_count + 8'd1;
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
- valid_count <= next_valid_count;
|
|
|
|
|
- missing_count <= next_missing_count;
|
|
|
|
|
- bmc_payload_checksum <= bmc_next_checksum;
|
|
|
|
|
- bmc_payload_count <= bmc_next_count;
|
|
|
|
|
- bmc_payload_first <= bmc_next_first;
|
|
|
|
|
- bmc_payload_last <= bmc_next_last;
|
|
|
|
|
- bmc_payload_pending <= 1'b1;
|
|
|
|
|
- sensor_cache_pending <= 1'b1;
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (bmc_payload_pending) begin
|
|
|
|
|
- queue_diag_frame(
|
|
|
|
|
- FT_BMC_PAYLOAD,
|
|
|
|
|
- 8'd8,
|
|
|
|
|
- {448'd0,
|
|
|
|
|
- bmc_payload_checksum[15:8], bmc_payload_checksum[7:0],
|
|
|
|
|
- bmc_payload_last, bmc_payload_first,
|
|
|
|
|
- bmc_frame_seq[15:8], bmc_frame_seq[7:0],
|
|
|
|
|
- bmc_payload_count,
|
|
|
|
|
- 8'd48}
|
|
|
|
|
- );
|
|
|
|
|
- if (!diag_busy && !diag_start) begin
|
|
|
|
|
- bmc_payload_pending <= 1'b0;
|
|
|
|
|
- end
|
|
|
|
|
- end else if (sensor_cache_pending) begin
|
|
|
|
|
- queue_diag_frame(
|
|
|
|
|
- FT_SENSOR_CACHE,
|
|
|
|
|
- 8'd8,
|
|
|
|
|
- {448'd0,
|
|
|
|
|
- missing_count,
|
|
|
|
|
- valid_count,
|
|
|
|
|
- sensor_missing[23:16],
|
|
|
|
|
- sensor_missing[15:8],
|
|
|
|
|
- sensor_missing[7:0],
|
|
|
|
|
- bmc_frame_seq[15:8], bmc_frame_seq[7:0],
|
|
|
|
|
- PROFILE_ID}
|
|
|
|
|
- );
|
|
|
|
|
- if (!diag_busy && !diag_start) begin
|
|
|
|
|
- sensor_cache_pending <= 1'b0;
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- if (ptc_pwm_counter >= PTC_PWM_PERIOD_TICKS[31:0] - 32'd1) begin
|
|
|
|
|
- ptc_pwm_counter <= 32'd0;
|
|
|
|
|
- end else begin
|
|
|
|
|
- ptc_pwm_counter <= ptc_pwm_counter + 32'd1;
|
|
|
|
|
- end
|
|
|
|
|
- if (fan_pwm_counter >= FAN_PWM_PERIOD_TICKS[31:0] - 32'd1) begin
|
|
|
|
|
- fan_pwm_counter <= 32'd0;
|
|
|
|
|
- end else begin
|
|
|
|
|
- fan_pwm_counter <= fan_pwm_counter + 32'd1;
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < 24; i = i + 1) begin
|
|
|
|
|
- ptc_pwm_out[i] <= (ptc_level[i] != 7'd0) &&
|
|
|
|
|
- (ptc_pwm_counter < duty_threshold(PTC_PWM_STEP_TICKS, ptc_level[i]));
|
|
|
|
|
- end
|
|
|
|
|
- for (i = 0; i < 4; i = i + 1) begin
|
|
|
|
|
- fan_pwm_out[i] <= (fan_level[i] != 7'd0) &&
|
|
|
|
|
- (fan_pwm_counter < duty_threshold(FAN_PWM_STEP_TICKS, fan_level[i]));
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
- end
|
|
|
|
|
-
|
|
|
|
|
- assign led[0] = ~ready_sent;
|
|
|
|
|
- assign led[1] = ~timeout_active;
|
|
|
|
|
- assign led[2] = ~pid_requested;
|
|
|
|
|
- assign led[3] = ~(bmc_frame_seq != 16'd0);
|
|
|
|
|
- assign led[4] = ~(command_count_seen != 16'd0);
|
|
|
|
|
- assign led[5] = ~(bad_host_frame_count != 16'd0);
|
|
|
|
|
- assign led[6] = (COMBINED_HOST_DEBUG_UART != 0) ? ~host_tx_busy : ~debug_tx_busy;
|
|
|
|
|
- assign led[7] = (COMBINED_HOST_DEBUG_UART != 0) ? ~(combined_tx_owner != COMBINED_OWNER_NONE) : ~debug_uart_rx;
|
|
|
|
|
-endmodule
|
|
|