| 1 |
32 |
redbear |
#ifndef TCLRPT_H_
|
| 2 |
|
|
#define TCLRPT_H_
|
| 3 |
|
|
/*
|
| 4 |
|
|
* Copyright Altera Corporation (C) 2012-2014. All rights reserved
|
| 5 |
|
|
*
|
| 6 |
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
| 7 |
|
|
*
|
| 8 |
|
|
* Redistribution and use in source and binary forms, with or without
|
| 9 |
|
|
* modification, are permitted provided that the following conditions are met:
|
| 10 |
|
|
* * Redistributions of source code must retain the above copyright
|
| 11 |
|
|
* notice, this list of conditions and the following disclaimer.
|
| 12 |
|
|
* * Redistributions in binary form must reproduce the above copyright
|
| 13 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
| 14 |
|
|
* documentation and/or other materials provided with the distribution.
|
| 15 |
|
|
* * Neither the name of Altera Corporation nor the
|
| 16 |
|
|
* names of its contributors may be used to endorse or promote products
|
| 17 |
|
|
* derived from this software without specific prior written permission.
|
| 18 |
|
|
*
|
| 19 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
| 20 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 21 |
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 22 |
|
|
* DISCLAIMED. IN NO EVENT SHALL ALTERA CORPORATION BE LIABLE FOR ANY
|
| 23 |
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 24 |
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 25 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 26 |
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 27 |
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 28 |
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
|
|
*/
|
| 30 |
|
|
|
| 31 |
|
|
|
| 32 |
|
|
#include "sequencer.h"
|
| 33 |
|
|
|
| 34 |
|
|
#if ENABLE_TCL_DEBUG
|
| 35 |
|
|
#define TCLRPT_SET(item, value) item = value
|
| 36 |
|
|
#else
|
| 37 |
|
|
#define TCLRPT_SET(item, value)
|
| 38 |
|
|
#endif
|
| 39 |
|
|
|
| 40 |
|
|
// None of the rest of the file should be referenced if ENABLE_TCL_DEBUG is not
|
| 41 |
|
|
// set (although it's not a problem if it is, but this helps catch errors)
|
| 42 |
|
|
#if ENABLE_TCL_DEBUG
|
| 43 |
|
|
|
| 44 |
|
|
#define PRINTF_READ_BUFFER_SIZE 128/4
|
| 45 |
|
|
#define PRINTF_READ_BUFFER_FIFO_WORDS 32
|
| 46 |
|
|
|
| 47 |
|
|
#define NUM_DI_SAMPLE 100
|
| 48 |
|
|
|
| 49 |
|
|
#define DI_REPORT_FLAGS_READY 0x00000001
|
| 50 |
|
|
#define DI_REPORT_FLAGS_DONE 0x00000002
|
| 51 |
|
|
|
| 52 |
|
|
//*****************************************************************************
|
| 53 |
|
|
// TCL Commands
|
| 54 |
|
|
//*****************************************************************************
|
| 55 |
|
|
// The wait command
|
| 56 |
|
|
#define TCLDBG_CMD_WAIT_CMD 1000
|
| 57 |
|
|
|
| 58 |
|
|
// No operation command
|
| 59 |
|
|
#define TCLDBG_CMD_NOP 0
|
| 60 |
|
|
|
| 61 |
|
|
// Command response acknowledged
|
| 62 |
|
|
#define TCLDBG_CMD_RESPONSE_ACK 1
|
| 63 |
|
|
|
| 64 |
|
|
// Run the full test
|
| 65 |
|
|
#define TCLDBG_RUN_FULLTEST 2
|
| 66 |
|
|
|
| 67 |
|
|
// Query the parameterization info
|
| 68 |
|
|
#define TCLDBG_PARAM_INFO 3
|
| 69 |
|
|
|
| 70 |
|
|
// Query the status of calibration
|
| 71 |
|
|
#define TCLDBG_CAL_STATUS 4
|
| 72 |
|
|
|
| 73 |
|
|
// Run memory calibration
|
| 74 |
|
|
#define TCLDBG_RUN_MEM_CALIBRATE 5
|
| 75 |
|
|
|
| 76 |
|
|
// Run pattern to generate eye diagrams
|
| 77 |
|
|
#define TCLDBG_RUN_EYE_DIAGRAM_PATTERN 6
|
| 78 |
|
|
|
| 79 |
|
|
// Run full test and see how far we can push DQ delay on input and output sides
|
| 80 |
|
|
#define TCLDBG_FIND_FULL_TEST_DQ 7
|
| 81 |
|
|
|
| 82 |
|
|
// Run full test and see how far we can push DQS delay on input and output sides
|
| 83 |
|
|
#define TCLDBG_FIND_FULL_TEST_DQS 8
|
| 84 |
|
|
|
| 85 |
|
|
// Run full test and see how far we can push DM delay on output sides
|
| 86 |
|
|
#define TCLDBG_FIND_FULL_TEST_DM 9
|
| 87 |
|
|
|
| 88 |
|
|
// Query the margins found during read and write calibration
|
| 89 |
|
|
#define TCLDBG_QUERY_CALIB_MARGINS 10
|
| 90 |
|
|
|
| 91 |
|
|
// Query the settings applied during calibration on DQ pins
|
| 92 |
|
|
#define TCLDBG_QUERY_DQ_SETTINGS 11
|
| 93 |
|
|
|
| 94 |
|
|
// Query the settings applied during calibration on DQS groups
|
| 95 |
|
|
#define TCLDBG_QUERY_DQS_SETTINGS 12
|
| 96 |
|
|
|
| 97 |
|
|
// Query the state of the PHY. User mode or debug mode
|
| 98 |
|
|
#define TCLDBG_QUERY_PHY_USER_DEBUG_MODE 13
|
| 99 |
|
|
|
| 100 |
|
|
// Mark all groups as being valid for calibration
|
| 101 |
|
|
#define TCLDBG_MARK_ALL_DQS_GROUPS_AS_VALID 14
|
| 102 |
|
|
|
| 103 |
|
|
// Mark a specific group to be skipped for calibration
|
| 104 |
|
|
#define TCLDBG_MARK_GROUP_AS_SKIP 15
|
| 105 |
|
|
|
| 106 |
|
|
// Query the DQS skip group mask
|
| 107 |
|
|
#define TCLDBG_QUERY_GROUP_AS_SKIP 16
|
| 108 |
|
|
|
| 109 |
|
|
// Mark all ranks as being valid for calibration
|
| 110 |
|
|
#define TCLDBG_MARK_ALL_RANKS_AS_VALID 17
|
| 111 |
|
|
|
| 112 |
|
|
// Mark a specific rank to be skipped for calibration
|
| 113 |
|
|
#define TCLDBG_MARK_RANK_AS_SKIP 18
|
| 114 |
|
|
|
| 115 |
|
|
// Query the rank skip mask
|
| 116 |
|
|
#define TCLDBG_QUERY_RANK_AS_SKIP 19
|
| 117 |
|
|
|
| 118 |
|
|
// Query the settings applied during calibration on DM pins
|
| 119 |
|
|
#define TCLDBG_QUERY_DM_SETTINGS 20
|
| 120 |
|
|
|
| 121 |
|
|
// Enable the margining report as part of calibration
|
| 122 |
|
|
#define TCLDBG_ENABLE_MARGIN_REPORT 21
|
| 123 |
|
|
|
| 124 |
|
|
// Enable sweeping all groups of calibration
|
| 125 |
|
|
#define TCLDBG_ENABLE_SWEEP_ALL_GROUPS 22
|
| 126 |
|
|
|
| 127 |
|
|
// Enable the guaranteed read test as part of calibration
|
| 128 |
|
|
#define TCLDBG_DISABLE_GUARANTEED_READ 23
|
| 129 |
|
|
|
| 130 |
|
|
// Enable/disable non-destructive calibration
|
| 131 |
|
|
#define TCLDBG_SET_NON_DESTRUCTIVE_CALIBRATION 24
|
| 132 |
|
|
|
| 133 |
|
|
#if ENABLE_DELAY_CHAIN_WRITE
|
| 134 |
|
|
// Set DQ D1 Delay (I/O buffer to input register)
|
| 135 |
|
|
#define TCLDBG_SET_DQ_D1_DELAY 25
|
| 136 |
|
|
|
| 137 |
|
|
// Set DQ D5 Delay (output register to I/O buffer)
|
| 138 |
|
|
#define TCLDBG_SET_DQ_D5_DELAY 26
|
| 139 |
|
|
|
| 140 |
|
|
// Set DQ D6 Delay (output register to I/O buffer)
|
| 141 |
|
|
#define TCLDBG_SET_DQ_D6_DELAY 27
|
| 142 |
|
|
|
| 143 |
|
|
// Set DQS D4 Delay (DQS delay chain)
|
| 144 |
|
|
#define TCLDBG_SET_DQS_D4_DELAY 28
|
| 145 |
|
|
|
| 146 |
|
|
// Set DQS DQ Output Phase (deg)
|
| 147 |
|
|
#define TCLDBG_SET_DQDQS_OUTPUT_PHASE 29
|
| 148 |
|
|
|
| 149 |
|
|
// Set DQS D5 Delay (output register to I/O buffer)
|
| 150 |
|
|
#define TCLDBG_SET_DQS_D5_DELAY 30
|
| 151 |
|
|
|
| 152 |
|
|
// Set DQS D6 Delay (output register to I/O buffer)
|
| 153 |
|
|
#define TCLDBG_SET_DQS_D6_DELAY 31
|
| 154 |
|
|
|
| 155 |
|
|
// Set DQS DQS Enable Phase (deg)
|
| 156 |
|
|
#define TCLDBG_SET_DQS_EN_PHASE 32
|
| 157 |
|
|
|
| 158 |
|
|
// Set DQS T11 Delay (DQS post-amble delay)
|
| 159 |
|
|
#define TCLDBG_SET_DQS_T11_DELAY 33
|
| 160 |
|
|
|
| 161 |
|
|
// Set DM D5 Delay (output register to I/O buffer)
|
| 162 |
|
|
#define TCLDBG_SET_DM_D5_DELAY 34
|
| 163 |
|
|
|
| 164 |
|
|
// Set DM D6 Delay (output register to I/O buffer)
|
| 165 |
|
|
#define TCLDBG_SET_DM_D6_DELAY 35
|
| 166 |
|
|
|
| 167 |
|
|
// Rerun DQ margining without calibrating
|
| 168 |
|
|
#define TCLDBG_REMARGIN_DQ 36
|
| 169 |
|
|
|
| 170 |
|
|
// Rerun DM margining without calibrating
|
| 171 |
|
|
#define TCLDBG_REMARGIN_DM 37
|
| 172 |
|
|
|
| 173 |
|
|
// Increment VFIFO
|
| 174 |
|
|
#define TCLDBG_INCR_VFIFO 38
|
| 175 |
|
|
|
| 176 |
|
|
// Decrement VFIFO
|
| 177 |
|
|
#define TCLDBG_DECR_VFIFO 39
|
| 178 |
|
|
|
| 179 |
|
|
// Select shadow register
|
| 180 |
|
|
#define TCLDBG_SELECT_SHADOW_REG 40
|
| 181 |
|
|
|
| 182 |
|
|
#endif // ENABLE_DELAY_CHAIN_WRITE
|
| 183 |
|
|
|
| 184 |
|
|
// Update RDIMM Control Word
|
| 185 |
|
|
#define TCLDBG_SET_UPDATE_PARAMETERS 41
|
| 186 |
|
|
|
| 187 |
|
|
// Run memory calibration
|
| 188 |
|
|
#define TCLDBG_RUN_NON_DES_MEM_CALIBRATE 42
|
| 189 |
|
|
|
| 190 |
|
|
//*****************************************************************************
|
| 191 |
|
|
// TCL RX Status Codes
|
| 192 |
|
|
//*****************************************************************************
|
| 193 |
|
|
// RX interface waiting for command
|
| 194 |
|
|
#define TCLDBG_RX_STATUS_WAIT_CMD 0
|
| 195 |
|
|
|
| 196 |
|
|
// RX interface command ready for operation.
|
| 197 |
|
|
#define TCLDBG_RX_STATUS_CMD_READY 1
|
| 198 |
|
|
|
| 199 |
|
|
// RX interface command executing
|
| 200 |
|
|
#define TCLDBG_RX_STATUS_CMD_EXE 2
|
| 201 |
|
|
|
| 202 |
|
|
//*****************************************************************************
|
| 203 |
|
|
// TCL TX Status Codes
|
| 204 |
|
|
//*****************************************************************************
|
| 205 |
|
|
// RX interface ready to accept commands in debug mode
|
| 206 |
|
|
#define TCLDBG_TX_STATUS_CMD_READY 0
|
| 207 |
|
|
|
| 208 |
|
|
// TX interface response not ready as command is running
|
| 209 |
|
|
#define TCLDBG_TX_STATUS_CMD_EXE 1
|
| 210 |
|
|
|
| 211 |
|
|
// RX interface illegal command
|
| 212 |
|
|
#define TCLDBG_TX_STATUS_ILLEGAL_CMD 2
|
| 213 |
|
|
|
| 214 |
|
|
// TX interface response ready
|
| 215 |
|
|
#define TCLDBG_TX_STATUS_RESPONSE_READY 3
|
| 216 |
|
|
|
| 217 |
|
|
|
| 218 |
|
|
|
| 219 |
|
|
//*****************************************************************************
|
| 220 |
|
|
// Main report status bits
|
| 221 |
|
|
//*****************************************************************************
|
| 222 |
|
|
#define DEBUG_STATUS_PRINTF_ENABLED_BIT 0
|
| 223 |
|
|
#define DEBUG_STATUS_CALIBRATION_STARTED 1
|
| 224 |
|
|
#define DEBUG_STATUS_CALIBRATION_ENDED 2
|
| 225 |
|
|
|
| 226 |
|
|
//*****************************************************************************
|
| 227 |
|
|
// Individual reports status bits
|
| 228 |
|
|
//*****************************************************************************
|
| 229 |
|
|
#define DEBUG_REPORT_STATUS_REPORT_READY 0x00000001
|
| 230 |
|
|
#define DEBUG_REPORT_STATUS_REPORT_GEN_ENABLED 0x00000002
|
| 231 |
|
|
#define DEBUG_REPORT_DTAP_PER_PTAP_DYNAMIC 0x00000004
|
| 232 |
|
|
|
| 233 |
|
|
//*****************************************************************************
|
| 234 |
|
|
// Debug report sizes
|
| 235 |
|
|
//*****************************************************************************
|
| 236 |
|
|
#define NUM_RANK_MASK_WORDS ((RW_MGR_MEM_NUMBER_OF_RANKS % 32) == 0 ? (RW_MGR_MEM_NUMBER_OF_RANKS/32) : (RW_MGR_MEM_NUMBER_OF_RANKS/32)+1)
|
| 237 |
|
|
#define NUM_GROUP_MASK_WORDS ((RW_MGR_MEM_IF_READ_DQS_WIDTH % 32) == 0 ? (RW_MGR_MEM_IF_READ_DQS_WIDTH/32) : (RW_MGR_MEM_IF_READ_DQS_WIDTH/32)+1)
|
| 238 |
|
|
|
| 239 |
|
|
#define COMMAND_PARAM_WORDS 4
|
| 240 |
|
|
|
| 241 |
|
|
//*****************************************************************************
|
| 242 |
|
|
// Debug report structs
|
| 243 |
|
|
// Margins are reported in terms of delay chain taps.
|
| 244 |
|
|
//*****************************************************************************
|
| 245 |
|
|
typedef struct debug_cal_observed_dq_margins_struct {
|
| 246 |
|
|
alt_32 left_edge;
|
| 247 |
|
|
alt_32 right_edge;
|
| 248 |
|
|
} debug_cal_observed_dq_margins_t;
|
| 249 |
|
|
|
| 250 |
|
|
typedef struct debug_cal_observed_dqs_in_margins_struct {
|
| 251 |
|
|
alt_32 dq_margin;
|
| 252 |
|
|
alt_32 dqs_margin;
|
| 253 |
|
|
alt_u32 dqsen_margin;
|
| 254 |
|
|
} debug_cal_observed_dqs_in_margins_t;
|
| 255 |
|
|
|
| 256 |
|
|
typedef struct debug_cal_observed_dqsen_margins_struct {
|
| 257 |
|
|
alt_u32 vfifo_begin;
|
| 258 |
|
|
alt_u32 phase_begin;
|
| 259 |
|
|
alt_u32 delay_begin;
|
| 260 |
|
|
alt_u32 work_begin;
|
| 261 |
|
|
alt_u32 vfifo_end;
|
| 262 |
|
|
alt_u32 phase_end;
|
| 263 |
|
|
alt_u32 delay_end;
|
| 264 |
|
|
alt_u32 work_end;
|
| 265 |
|
|
} debug_cal_observed_dqsen_margins_t;
|
| 266 |
|
|
|
| 267 |
|
|
typedef struct debug_cal_observed_dqs_out_margins_struct {
|
| 268 |
|
|
alt_32 dq_margin;
|
| 269 |
|
|
alt_32 dqs_margin;
|
| 270 |
|
|
alt_32 dm_margin;
|
| 271 |
|
|
alt_u32 dqdqs_start;
|
| 272 |
|
|
alt_u32 dqdqs_end;
|
| 273 |
|
|
} debug_cal_observed_dqs_out_margins_t;
|
| 274 |
|
|
|
| 275 |
|
|
typedef struct debug_cal_dq_settings_struct {
|
| 276 |
|
|
alt_u32 dq_in_delay;
|
| 277 |
|
|
alt_u32 dq_out_delay1;
|
| 278 |
|
|
alt_u32 dq_out_delay2;
|
| 279 |
|
|
} debug_cal_dq_settings_t;
|
| 280 |
|
|
|
| 281 |
|
|
typedef struct debug_cal_dqs_in_settings_struct {
|
| 282 |
|
|
alt_u32 dqs_bus_in_delay;
|
| 283 |
|
|
alt_u32 dqs_en_phase;
|
| 284 |
|
|
alt_u32 dqs_en_delay;
|
| 285 |
|
|
#if TRACKING_ERROR_TEST || TRACKING_WATCH_TEST
|
| 286 |
|
|
alt_u32 sample_count;
|
| 287 |
|
|
alt_u32 dtaps_per_ptap;
|
| 288 |
|
|
#endif
|
| 289 |
|
|
} debug_cal_dqs_in_settings_t;
|
| 290 |
|
|
|
| 291 |
|
|
typedef struct debug_cal_dqs_out_settings_struct {
|
| 292 |
|
|
alt_u32 dqdqs_out_phase;
|
| 293 |
|
|
alt_u32 dqs_out_delay1;
|
| 294 |
|
|
alt_u32 dqs_out_delay2;
|
| 295 |
|
|
alt_u32 oct_out_delay1;
|
| 296 |
|
|
alt_u32 oct_out_delay2;
|
| 297 |
|
|
alt_u32 dqs_io_in_delay;
|
| 298 |
|
|
} debug_cal_dqs_out_settings_t;
|
| 299 |
|
|
|
| 300 |
|
|
typedef struct debug_cal_dm_settings_struct {
|
| 301 |
|
|
alt_u32 dm_in_delay;
|
| 302 |
|
|
alt_u32 dm_out_delay1;
|
| 303 |
|
|
alt_u32 dm_out_delay2;
|
| 304 |
|
|
} debug_cal_dm_settings_t;
|
| 305 |
|
|
|
| 306 |
|
|
/* Error stages are defined in sequencer.h */
|
| 307 |
|
|
typedef struct debug_cal_status_per_group_struct {
|
| 308 |
|
|
alt_u32 error_stage;
|
| 309 |
|
|
alt_u32 error_sub_stage;
|
| 310 |
|
|
alt_u32 fom_in;
|
| 311 |
|
|
alt_u32 fom_out;
|
| 312 |
|
|
} debug_cal_status_per_group_t;
|
| 313 |
|
|
|
| 314 |
|
|
/* Summary report */
|
| 315 |
|
|
typedef struct debug_summary_report_struct {
|
| 316 |
|
|
// Size in 32-bit words of the report
|
| 317 |
|
|
alt_u32 data_size;
|
| 318 |
|
|
|
| 319 |
|
|
alt_u32 report_flags;
|
| 320 |
|
|
|
| 321 |
|
|
alt_u32 sequencer_signature;
|
| 322 |
|
|
alt_u32 protocol;
|
| 323 |
|
|
|
| 324 |
|
|
alt_u32 error_stage;
|
| 325 |
|
|
alt_u32 error_sub_stage;
|
| 326 |
|
|
alt_u32 error_group;
|
| 327 |
|
|
alt_u32 fom_in;
|
| 328 |
|
|
alt_u32 fom_out;
|
| 329 |
|
|
|
| 330 |
|
|
alt_u32 mem_address_width;
|
| 331 |
|
|
alt_u32 mem_bank_width;
|
| 332 |
|
|
alt_u32 mem_control_width;
|
| 333 |
|
|
alt_u32 mem_cs_width;
|
| 334 |
|
|
alt_u32 mem_cke_width;
|
| 335 |
|
|
alt_u32 mem_odt_width;
|
| 336 |
|
|
alt_u32 mem_data_width;
|
| 337 |
|
|
alt_u32 mem_dm_width;
|
| 338 |
|
|
alt_u32 mem_read_dqs_width;
|
| 339 |
|
|
alt_u32 mem_write_dqs_width;
|
| 340 |
|
|
alt_u32 mem_dq_per_read_dqs;
|
| 341 |
|
|
alt_u32 mem_num_ranks;
|
| 342 |
|
|
|
| 343 |
|
|
alt_u32 num_shadow_regs;
|
| 344 |
|
|
|
| 345 |
|
|
alt_u32 mem_mmr_burst_len;
|
| 346 |
|
|
alt_u32 mem_mmr_cas;
|
| 347 |
|
|
|
| 348 |
|
|
alt_u32 mem_num_dm_per_write_group;
|
| 349 |
|
|
|
| 350 |
|
|
alt_u32 rate;
|
| 351 |
|
|
|
| 352 |
|
|
alt_u32 cal_write_latency;
|
| 353 |
|
|
alt_u32 cal_read_latency;
|
| 354 |
|
|
|
| 355 |
|
|
alt_u32 dll_length;
|
| 356 |
|
|
|
| 357 |
|
|
alt_u32 rank_mask_size;
|
| 358 |
|
|
alt_u32 active_ranks;
|
| 359 |
|
|
alt_u32 rank_mask[NUM_RANK_MASK_WORDS];
|
| 360 |
|
|
|
| 361 |
|
|
alt_u32 group_mask_size;
|
| 362 |
|
|
alt_u32 active_groups;
|
| 363 |
|
|
alt_u32 group_mask[NUM_GROUP_MASK_WORDS];
|
| 364 |
|
|
|
| 365 |
|
|
alt_u32 groups_attempted_calibration[NUM_GROUP_MASK_WORDS];
|
| 366 |
|
|
|
| 367 |
|
|
alt_u32 computed_dtap_per_ptap;
|
| 368 |
|
|
// The delay per phase tap is the period/dll_length
|
| 369 |
|
|
alt_u32 io_delay_per_opa_tap;
|
| 370 |
|
|
// The delay per delay tap is the delay per phase tap
|
| 371 |
|
|
// divided by the number of delay taps per phase tap
|
| 372 |
|
|
// (i.e. io_delay_per_opa_tap / computed_dtap_per_ptap)
|
| 373 |
|
|
// The value of computed_dtap_per_ptap is computed during calibration.
|
| 374 |
|
|
|
| 375 |
|
|
alt_u32 margin_dq_in_left_delay_chain_len;
|
| 376 |
|
|
alt_u32 margin_dq_in_right_delay_chain_len;
|
| 377 |
|
|
alt_u32 margin_dq_out_left_delay_chain_len;
|
| 378 |
|
|
alt_u32 margin_dq_out_right_delay_chain_len;
|
| 379 |
|
|
|
| 380 |
|
|
} debug_summary_report_t;
|
| 381 |
|
|
|
| 382 |
|
|
/* Calibration report: The calibration status per group is here (cal_status_per_group)*/
|
| 383 |
|
|
typedef struct debug_cal_report_struct {
|
| 384 |
|
|
// Size in 32-bit words of the report
|
| 385 |
|
|
alt_u32 data_size;
|
| 386 |
|
|
|
| 387 |
|
|
alt_u32 report_flags;
|
| 388 |
|
|
|
| 389 |
|
|
alt_u32 mem_data_width;
|
| 390 |
|
|
alt_u32 mem_dm_width;
|
| 391 |
|
|
alt_u32 mem_num_dm_per_write_group;
|
| 392 |
|
|
alt_u32 mem_read_dqs_width;
|
| 393 |
|
|
alt_u32 mem_write_dqs_width;
|
| 394 |
|
|
|
| 395 |
|
|
alt_u32 num_shadow_regs;
|
| 396 |
|
|
|
| 397 |
|
|
/* Pass/fail status per group */
|
| 398 |
|
|
debug_cal_status_per_group_t cal_status_per_group[NUM_SHADOW_REGS][RW_MGR_MEM_IF_WRITE_DQS_WIDTH];
|
| 399 |
|
|
|
| 400 |
|
|
/* Margins observed before calibration. */
|
| 401 |
|
|
debug_cal_observed_dq_margins_t cal_dq_in_margins[NUM_SHADOW_REGS][RW_MGR_MEM_DATA_WIDTH];
|
| 402 |
|
|
debug_cal_observed_dq_margins_t cal_dq_out_margins[NUM_SHADOW_REGS][RW_MGR_MEM_DATA_WIDTH];
|
| 403 |
|
|
debug_cal_observed_dq_margins_t cal_dm_margins[NUM_SHADOW_REGS][RW_MGR_MEM_IF_WRITE_DQS_WIDTH][RW_MGR_NUM_TRUE_DM_PER_WRITE_GROUP];
|
| 404 |
|
|
debug_cal_observed_dqsen_margins_t cal_dqsen_margins[NUM_SHADOW_REGS][RW_MGR_MEM_IF_READ_DQS_WIDTH];
|
| 405 |
|
|
|
| 406 |
|
|
debug_cal_observed_dqs_in_margins_t cal_dqs_in_margins[NUM_SHADOW_REGS][RW_MGR_MEM_IF_READ_DQS_WIDTH];
|
| 407 |
|
|
debug_cal_observed_dqs_out_margins_t cal_dqs_out_margins[NUM_SHADOW_REGS][RW_MGR_MEM_IF_WRITE_DQS_WIDTH];
|
| 408 |
|
|
|
| 409 |
|
|
/* Phase, delay chain settings */
|
| 410 |
|
|
debug_cal_dq_settings_t cal_dq_settings[NUM_SHADOW_REGS][RW_MGR_MEM_DATA_WIDTH];
|
| 411 |
|
|
debug_cal_dqs_in_settings_t cal_dqs_in_settings[NUM_SHADOW_REGS][RW_MGR_MEM_IF_READ_DQS_WIDTH];
|
| 412 |
|
|
debug_cal_dqs_out_settings_t cal_dqs_out_settings[NUM_SHADOW_REGS][RW_MGR_MEM_IF_WRITE_DQS_WIDTH];
|
| 413 |
|
|
debug_cal_dm_settings_t cal_dm_settings[NUM_SHADOW_REGS][RW_MGR_MEM_IF_WRITE_DQS_WIDTH][RW_MGR_NUM_TRUE_DM_PER_WRITE_GROUP];
|
| 414 |
|
|
|
| 415 |
|
|
} debug_cal_report_t;
|
| 416 |
|
|
|
| 417 |
|
|
/* Left and right edges of the data valid window, in units of delay taps. */
|
| 418 |
|
|
typedef struct debug_margin_min_max_margins_struct {
|
| 419 |
|
|
alt_u32 min_working_setting;
|
| 420 |
|
|
alt_u32 max_working_setting;
|
| 421 |
|
|
} debug_margin_min_max_margins_t;
|
| 422 |
|
|
|
| 423 |
|
|
/* Post-calibration margin report (must be enabled using the TCLDBG_ENABLE_MARGIN_REPORT command first)*/
|
| 424 |
|
|
typedef struct debug_margin_report_struct {
|
| 425 |
|
|
// Size in 32-bit words of the report
|
| 426 |
|
|
alt_u32 data_size;
|
| 427 |
|
|
|
| 428 |
|
|
alt_u32 report_flags;
|
| 429 |
|
|
|
| 430 |
|
|
alt_u32 mem_data_width;
|
| 431 |
|
|
alt_u32 mem_write_dqs_width;
|
| 432 |
|
|
|
| 433 |
|
|
alt_u32 num_shadow_regs;
|
| 434 |
|
|
|
| 435 |
|
|
debug_margin_min_max_margins_t margin_dm_margins[NUM_SHADOW_REGS][RW_MGR_MEM_IF_WRITE_DQS_WIDTH][RW_MGR_NUM_TRUE_DM_PER_WRITE_GROUP];
|
| 436 |
|
|
|
| 437 |
|
|
debug_margin_min_max_margins_t margin_dq_in_margins[NUM_SHADOW_REGS][RW_MGR_MEM_DATA_WIDTH];
|
| 438 |
|
|
debug_margin_min_max_margins_t margin_dq_out_margins[NUM_SHADOW_REGS][RW_MGR_MEM_DATA_WIDTH];
|
| 439 |
|
|
|
| 440 |
|
|
|
| 441 |
|
|
} debug_margin_report_t;
|
| 442 |
|
|
|
| 443 |
|
|
typedef alt_u32 printf_read_buffer_t[PRINTF_READ_BUFFER_SIZE];
|
| 444 |
|
|
|
| 445 |
|
|
typedef struct debug_printf_output {
|
| 446 |
|
|
alt_u32 data_size;
|
| 447 |
|
|
|
| 448 |
|
|
alt_u32 fifo_size;
|
| 449 |
|
|
alt_u32 word_size;
|
| 450 |
|
|
|
| 451 |
|
|
alt_u32 head;
|
| 452 |
|
|
alt_u32 count;
|
| 453 |
|
|
alt_u32 slave_lock;
|
| 454 |
|
|
alt_u32 master_lock;
|
| 455 |
|
|
|
| 456 |
|
|
|
| 457 |
|
|
printf_read_buffer_t read_buffer[PRINTF_READ_BUFFER_FIFO_WORDS];
|
| 458 |
|
|
printf_read_buffer_t active_word;
|
| 459 |
|
|
|
| 460 |
|
|
} debug_printf_output_t;
|
| 461 |
|
|
|
| 462 |
|
|
typedef struct rw_manager_di_buffer {
|
| 463 |
|
|
alt_u32 bit_chk;
|
| 464 |
|
|
alt_u32 delay;
|
| 465 |
|
|
alt_u32 v;
|
| 466 |
|
|
alt_u32 p;
|
| 467 |
|
|
alt_u32 d;
|
| 468 |
|
|
alt_u32 di_buffer_0a;
|
| 469 |
|
|
alt_u32 di_buffer_0b;
|
| 470 |
|
|
alt_u32 di_buffer_1a;
|
| 471 |
|
|
alt_u32 di_buffer_1b;
|
| 472 |
|
|
alt_u32 di_buffer_2a;
|
| 473 |
|
|
alt_u32 di_buffer_2b;
|
| 474 |
|
|
alt_u32 di_buffer_3a;
|
| 475 |
|
|
alt_u32 di_buffer_3b;
|
| 476 |
|
|
alt_u32 di_buffer_4a;
|
| 477 |
|
|
alt_u32 di_buffer_4b;
|
| 478 |
|
|
} rw_manager_di_buffer_t;
|
| 479 |
|
|
|
| 480 |
|
|
typedef struct rw_manager_di_report {
|
| 481 |
|
|
alt_u32 data_size;
|
| 482 |
|
|
alt_u32 flags;
|
| 483 |
|
|
alt_u32 cur_samples;
|
| 484 |
|
|
alt_u32 max_samples;
|
| 485 |
|
|
rw_manager_di_buffer_t di_buffer[NUM_DI_SAMPLE];
|
| 486 |
|
|
} rw_manager_di_report_t;
|
| 487 |
|
|
|
| 488 |
|
|
typedef struct emif_toolkit_debug_data {
|
| 489 |
|
|
// Size in 32-bit words of all the emif toolkit debug data
|
| 490 |
|
|
alt_u32 data_size;
|
| 491 |
|
|
|
| 492 |
|
|
alt_u32 dqs_write_width_ptr;
|
| 493 |
|
|
alt_u32 group_mask_ptr;
|
| 494 |
|
|
alt_u32 num_ranks_ptr;
|
| 495 |
|
|
alt_u32 rank_mask_ptr;
|
| 496 |
|
|
alt_u32 active_groups_ptr;
|
| 497 |
|
|
alt_u32 active_ranks_ptr;
|
| 498 |
|
|
alt_u32 group_mask_size_ptr;
|
| 499 |
|
|
alt_u32 rank_mask_size_ptr;
|
| 500 |
|
|
} emif_toolkit_debug_data_t;
|
| 501 |
|
|
|
| 502 |
|
|
/* This the main debug data structure. This is where you write
|
| 503 |
|
|
commands, poll command status, pass command parameters, etc. Contained
|
| 504 |
|
|
within this data structure are the reports. The memory address of this
|
| 505 |
|
|
data structure is in core_debug_defines.h (it is dynamic). For example:
|
| 506 |
|
|
#define SEQ_CORE_DEBUG_BASE 0x000140c4
|
| 507 |
|
|
The sizes of all the data structures are dynamic, as they depend on
|
| 508 |
|
|
interface size and other parameters. Accessing them outside a software
|
| 509 |
|
|
context is trickier but it can be done by looking at the "data_size"
|
| 510 |
|
|
field of the reports.
|
| 511 |
|
|
*/
|
| 512 |
|
|
typedef struct debug_data_struct {
|
| 513 |
|
|
// Size in 32-bit words of all the debug data
|
| 514 |
|
|
alt_u32 data_size;
|
| 515 |
|
|
|
| 516 |
|
|
// Status bits
|
| 517 |
|
|
alt_u32 status;
|
| 518 |
|
|
|
| 519 |
|
|
// Command interaction
|
| 520 |
|
|
alt_u32 requested_command;
|
| 521 |
|
|
alt_u32 command_status;
|
| 522 |
|
|
alt_u32 command_parameters[COMMAND_PARAM_WORDS];
|
| 523 |
|
|
|
| 524 |
|
|
// Pointers to the reports
|
| 525 |
|
|
alt_u32 summary_report_ptr;
|
| 526 |
|
|
alt_u32 cal_report_ptr;
|
| 527 |
|
|
alt_u32 margin_report_ptr;
|
| 528 |
|
|
|
| 529 |
|
|
// Printf output report
|
| 530 |
|
|
alt_u32 printf_output_ptr;
|
| 531 |
|
|
|
| 532 |
|
|
// Debug toolkit debugging data
|
| 533 |
|
|
alt_u32 emif_toolkit_debug_data_ptr;
|
| 534 |
|
|
|
| 535 |
|
|
#if ENABLE_DQSEN_SWEEP
|
| 536 |
|
|
// di report
|
| 537 |
|
|
alt_u32 di_report_ptr;
|
| 538 |
|
|
#endif
|
| 539 |
|
|
|
| 540 |
|
|
// Report data structures
|
| 541 |
|
|
debug_summary_report_t summary_report;
|
| 542 |
|
|
debug_cal_report_t cal_report;
|
| 543 |
|
|
debug_margin_report_t margin_report;
|
| 544 |
|
|
|
| 545 |
|
|
#if ENABLE_PRINTF_LOG
|
| 546 |
|
|
debug_printf_output_t printf_output;
|
| 547 |
|
|
#endif
|
| 548 |
|
|
|
| 549 |
|
|
#if ENABLE_DQSEN_SWEEP
|
| 550 |
|
|
rw_manager_di_report_t di_report;
|
| 551 |
|
|
#endif
|
| 552 |
|
|
|
| 553 |
|
|
emif_toolkit_debug_data_t emif_toolkit_debug_data;
|
| 554 |
|
|
|
| 555 |
|
|
} debug_data_t;
|
| 556 |
|
|
|
| 557 |
|
|
/* TCL io memory */
|
| 558 |
|
|
|
| 559 |
|
|
volatile extern debug_summary_report_t *debug_summary_report;
|
| 560 |
|
|
volatile extern debug_cal_report_t *debug_cal_report;
|
| 561 |
|
|
volatile extern debug_margin_report_t *debug_margin_report;
|
| 562 |
|
|
volatile extern debug_printf_output_t *debug_printf_output;
|
| 563 |
|
|
volatile extern debug_data_t *debug_data;
|
| 564 |
|
|
|
| 565 |
|
|
volatile extern emif_toolkit_debug_data_t *debug_emif_toolkit_debug_data;
|
| 566 |
|
|
|
| 567 |
|
|
|
| 568 |
|
|
extern void tclrpt_initialize_debug_status (void);
|
| 569 |
|
|
extern void tclrpt_initialize (debug_data_t *);
|
| 570 |
|
|
extern void tclrpt_loop(void);
|
| 571 |
|
|
extern void tclrpt_initialize_data(void);
|
| 572 |
|
|
extern void tclrpt_set_group_as_calibration_attempted(alt_u32 write_group);
|
| 573 |
|
|
|
| 574 |
|
|
#if BFM_MODE
|
| 575 |
|
|
extern void tclrpt_dump_internal_data(void);
|
| 576 |
|
|
extern void tclrpt_populate_fake_margin_data(void);
|
| 577 |
|
|
#endif
|
| 578 |
|
|
|
| 579 |
|
|
#endif // ENABLE_TCL_DEBUG
|
| 580 |
|
|
|
| 581 |
|
|
#endif
|