External Memory Interfaces Intel® Agilex™ FPGA IP User Guide

ID 683216
Date 1/31/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

11.10.4.1. Debug Data Structures

This topic describes how to navigate the debug structures in the user-RAM.

debug_data_struct (pt_DEBUG_DATA_PTR)

The debug_data_struct’s base address is equal to: (user_ram base address) + (offset for debug_data_struct, read from pt_DEBUG_DATA_PTR)

If you have enabled debug in this row, this structure is populated and the pointer (pt_DEBUG_DATA_PTR) is stored in the parameter table after calibration. This structure provides the following:
  1. An interface by which to view the state of calibration, by checking the status bit in the debug_data_struct:
    • Bit 1 is set if calibration has started.
    • Bit 2 is set if calibration has finished.
  2. An interface by which to send commands to the firmware (available commands are described by ENUM_INTERFACE_COMMANDS) and receive response codes about the command status (recognized status codes are described by ENUM_DEBUG_INTERFACE_COMMAND_STATUS_CODES). Sending a command should follow this procedure:
    1. Wait for command_status to be TX_STATUS_CMD_READY.
    2. Set any relevant command_parameters for the desired command (described in ENUM_INTERFACE_COMMANDS).
    3. Set the requested_command code (ENUM_INTERFACE_COMMANDS).
    4. Wait for command_status to be TX_STATUS_RESPONSE_READY.
    5. Set requested_command code to CMD_RESPONSE_ACK to acknowledge the response was received.
    6. Any following command can be send once command_status returns to the value TX_STATUS_CMD_READY.
  3. A pointer to mem_summary_report, which provides a more detailed status of calibration.
  4. A pointer to mem_cal_report, which provides details of settings that were decided during calibration (such as delay settings, margins, vref settings, and so forth).

Example 1: Steps to Request Full EMIF Recalibration

  1. Read from command_status. Wait until the readdata=32’h0000_0000 (TX_STATUS_CMD_READY)
  2. Write to command_parameters[0] with writedata=Interface_ID that you want to calibrate. (If you have only one interface, set the writedata=32’h0000_0000.)
  3. Write to command_parameters[1] with writedata=32’h0000_0003(DYNAMIC_FULL_RECAL). (Refer to ENUM_INIT_MODE table for other supported calibration options.)
  4. Write to requested_command with writedata=32’h0000_0005(RUN_MEM_CALIBRATE).
  5. Read from command_status. Wait until the readdata=32’h0000_0003 (TX_STATUS_RESPONSE_READY).
  6. Write to requested_command with writedata=32’h0000_0001(CMD_RESPONSE_ACK).

Example 2: Set the Starting value of VREF_OUT and Recalibrate EMIF using New Starting Value

  1. Read from command_status. Wait till the readdata=32’h0000_0000 (TX_STATUS_CMD_READY).
  2. Set the new VREF_OUT. Refer to debug_cal_data_struct for information on how to determine the Vref_setting and Vref_range.
    1. Write to command_parameters[0] with writedata=Vref_setting.
    2. Write to command_parameters[1] with writedata=Vref_range.
    3. Write to requested_command with writedata=32’h0000_001B(SET_VREF_OUT).
    4. Read from command_status. Wait till the readdata=32’h0000_0003 (TX_STATUS_RESPONSE_READY).
    5. Write to requested_command with writedata=32’h0000_0001(CMD_RESPONSE_ACK).
  3. Request Recalibration. Follow steps in Example 1 but set init_mode to SKIP_INIT_VREF.

Example 3: Hardcode the VREF_IN and VREF_OUT and bypass the VREFCAL in next EMIF Recalibration

  1. Set the new VREF_OUT. Refer to debug_cal_data_struct for information on how to determine the Vref_setting and Vref_range.
    1. Read from command_status. Wait till the readdata=32’h0000_0000 (TX_STATUS_CMD_READY).
    2. Write to command_parameters[0] with writedata=Vref_setting.
    3. Write to command_parameters[1] with writedata=Vref_range.
    4. Write to requested_command with writedata=32’h0000_001B(SET_VREF_OUT).
    5. Read from command_status. Wait till the readdata=32’h0000_0003 (TX_STATUS_RESPONSE_READY).
    6. Write to requested_command with writedata=32’h0000_0001(CMD_RESPONSE_ACK).
  2. Set the new VREF_IN. Refer to debug_cal_data_struct for information on how to determine the Vref_setting and Vref_range.
    1. Read from command_status. Wait till the readdata=32’h0000_0000 (TX_STATUS_CMD_READY).
    2. Write to command_parameters[0] with writedata=Vref_setting.
    3. Write to requested_command with writedata=32’h0000_001A(SET_VREF_IN).
    4. Read from command_status. Wait till the readdata=32’h0000_0003 (TX_STATUS_RESPONSE_READY).
    5. Write to requested_command with writedata=32’h0000_0001(CMD_RESPONSE_ACK).
  3. Set the calibration to skip VREF_IN can VREF_OUT.
    1. Read from command_status. Wait till the readdata=32’h0000_0000 (TX_STATUS_CMD_READY).
    2. Write to command_parameters[0] with writedata=32'h 0000 C000 (CALIB_SKIP_VREFIN_CAL | CALIB_SKIP_VREFOUT_CAL).
    3. Write to requested_command with writedata= 32'h 0000 001E (SET_SKIP_STEPS).
    4. Read from command_status. Wait till the readdata=32’h0000_0003 (TX_STATUS_RESPONSE_READY).
  4. Start EMIF calibration. Follow the same steps as in example 1, but set init_mode to SKIP_INIT_VREF.
Parameter Offset Within Structure Size Purpose
data_size 0 32 size of this structure (in bytes).
status 4 32 output: calibration status (ENUM_CAL_ERROR).
requested_command 8 32 input: a command that the user wishes for firmware to perform (ENUM_INTERFACE_COMMANDS).
command_status 12 32 output: status of the command that a user requested (ENUM_DEBUG_INTERFACE_COMMAND_STATUS_CODES).
command_parameters[0] 16 32 input: a parameter for a requested_command. The relevant parameters for each command are described in ENUM_DEBUG_INTERFACE_COMMANDS.
command_parameters[1] 20 32 input: a parameter for a requested_command. The relevant parameters for each command are described in ENUM_DEBUG_INTERFACE_COMMANDS.
command_parameters[2] 24 32 input: a parameter for a requested_command. The relevant parameters for each command are described in ENUM_DEBUG_INTERFACE_COMMANDS.
command_parameters[3] 28 32 input: a parameter for a requested_command. The relevant parameters for each command are described in ENUM_DEBUG_INTERFACE_COMMANDS.
mem_summary_report_pointer 32 32 output: pointer to the mem_summary_report structure.
mem_cal_report_pointer 36 32 output: pointer to the mem_cal_report structure.

mem_summary_report (mem_summary_report_pointer)

This structure provides details about the status of calibration.

Parameter Offset Within Structure Size Comments
data_size 0 32 The size of this structure (in bytes).
report_flags 4 32

bit[0]: is 1 if report is ready, and all the registers below are valid.

bits[23:1]: reserved for future use.

bits[31:24]: version number of this report.

error_stage 12 32 The first stage at which calibration has failed (ENUM_CAL_STAGE).
error_group 16 32 Each bit corresponds to a dqs group. If a bit is set 1, then the corresponding group failed in the stage indicated by error_stage.
error_code 20 32 Detailed calibration status (ENUM_CAL_ERROR).
in_out_rate 72 8

bits [7:4] = out_rate = vco : mem_clk.

bits [3:0] = in_rate = mem_clk : phy_clk ratio.

cur_interface_idx 32 32 ID of the interface to which the stored debug information applies — that is, the latest interface to have been calibrated.

mem_cal_report (mem_cal_report_pointer)

This structure provides details of settings observed during calibration (such as delay settings, margins, vref settings, etc).

Parameter Offset Within Structure Number of Elements in Array (1 if not an array) Size of Each Element in Array
data_size 0 1 32
debug_cal_data_struct_pointer__cal_data_dq_in 4 num_dq 32
debug_cal_data_struct_pointer__cal_data_dq_out 8 num_dq 32
debug_cal_data_struct_pointer__cal_data_dm_dbi_in 12 num_dm 32
debug_cal_data_struct_pointer__cal_data_dm_dbi_out 16 num_dm 32
debug_cal_data_struct_pointer__cal_data_dqs_in 20 num_dqs_rd 32
debug_cal_data_struct_pointer__cal_data_dqs_en 24 num_dqs_rd 32
debug_cal_data_struct_pointer__cal_data_dqs_en_b 28 num_dqs_rd 32
debug_cal_data_struct_pointer__cal_data_dqs_out 32 num_dqs_wr 32
debug_cal_data_struct_pointer__vrefin 36 num_dqs_rd 32
debug_cal_data_struct_pointer__vrefout 40 num_dqs_wr 32
debug_cal_data_struct_pointer__cal_data_ca 44 num_ac_rom_enums 32
debug_cal_data_struct_pointer__vfifo 52 num_dqs_rd 8
debug_cal_data_struct_pointer__lfifo 56 num_dqs_rd 8
debug_cal_data_struct_pointer__dcc_dq_in 60 num_dq 8
debug_cal_data_struct_pointer__dcc_dq_out 64 num_dq 8
debug_cal_data_struct_pointer__dcc_dm_dbi_in 68 num_dm 8
debug_cal_data_struct_pointer__dcc_dm_dbi_out 72 num_dm 8
debug_cal_data_struct_pointer__dcc_dqs_in 76 num_dqs_rd 8
debug_cal_data_struct_pointer__dcc_dqs_out 80 num_dqs_wr 8
debug_cal_data_struct_pointer__dcc_ca 84 num_ac_rom_enums 8
debug_cal_data_struct_pointer__vrefout_all_ranks 88 num_dqs_wr 8
debug_cal_data_struct_pointer__ctle_out 92 num_dqs_wr 8
debug_cal_data_struct_pointer__ctle_in_dq 96 num_dq 8
debug_cal_data_struct_pointer__ctle_in_dqs 100 num_dqs_rd 8
write_lat 108 1 32
read_lat 112 1 32
rank_skew_data_out 116 1 32
rank_skew_dqsen 120 1 32
extra_rank_delay_any_to_read 124 1 32
extra_rank_delay_any_to_write 128 1 32

debug_cal_data_struct

This data structure is instantiated many times and is pointed to by each debug_cal_data_struct_pointer__* in the mem_cal_report. The setting field stores the chosen setting for the given parameter, while the left_edge and right_edge fields store the offset from the setting, for which transactions were found to still pass. To interpret the values stored, observe the following:

  • For a timing parameter, all three fields are stored in taps.
  • For a voltage parameter, the setting field is as follows:
    • Bits[15:8] = vref_range. This is set during IP parameterization.
      • Value 0 has a range of 60-92.5% of the VCCIO/VREFDQ.
      • Value 1 has range of 45-77.5% of the VCCIO/VREFDQ.
    • Bits[7:0] = vref_setting decided during calibration, as the number of incremental steps within the range (where each step is 0.65%).

      For example, in DDR4, the VCCIO voltage is 1.2V. So, given the setting = 0x0122:

      Vref_range=1, vref_setting=34

      Therefore, to calculate the Vref value in volts: ((34 × 0.0065) + 0.45) × 1.2V) = 0.805V

Parameter Offset Within Structure Size
setting 0 16
left_edge 2 8
right_edge 3 8