DDR Code Preview

DDR Tool generates source code which can be incorporated into an application to initialize the DDR subsystem. The source code uses an array-based format and is generated after validation on target is finished.

Note: Changing DDR frequency in DDR View will generate code for the desired frequency, but the DDR clock initialization must be handled by user application - i.e. DDR PLL must be configured for same frequency.
  1. Configure DDR controller from DDR View.
  2. Select Connection type and configure parameters.
  3. Select test, e.g. Firmware Init test.
  4. Click on Start Validation.
  5. Wait until execution finishes.
  6. The generated code is shown in the Code Preview tab on the right window. It displays all generated files, each in its own tab.
Figure 1. DDR Generated Files

Generated Files:

Init Firmware and Operational tests

  • ddr_init.c – main source file and the entry point of ddr initialization. The method which needs to be called from the user application in order to initialize the DDR subsystem is ddr_init(). It configures the DDRC controller based on the selected UI values from DDR View and executes the PHY training algorithm.
    Figure 2. ddr_init.c file
  • ddr_init.h – main header file, contains method prototypes and global variable definitions.
  • pin_swizzle.c – contains DQ and CA swapping options, generated based on selection from UI.
    Figure 3. DDR DQ Swapping
  • phy_cfg.c – contains phy module initialization sequence, based on the selected parameters from UI.
  • pie_cfg.c – contains PIE initialization sequence.
  • ddrss_cfg.c – initializes global data structure used in ddr_init() method.
  • ddrc_cfg.c – DDRC controller initialization sequence, generated based on selected values in UI (e.g. Clock Cycle Freq (MHz)).
  • imem_cfg.c – IMEM initialization sequence.
  • dmem_cfg.c – DMEM initialization sequence.
  • io.h – io access utility methods.
  • ddr_utils.c – utility methods used by the phy training algorithm.
  • ddr_utils.h – utility methods header file.
  • custom_overwrites.c – contains custom user writes for phy, pie, imem and dmem sequences.

Read Margin and Write Margin tests

  • ddr_diag_rx.h – ASCII representation comment and C structures populated with parameters of interest for each read diag eye matrix.
  • ddr_diag_tx.h – ASCII representation comment and C structures populated with parameters of interest for each write diag eye matrix.
Figure 4. DDR Diag Codegen
Any of the Shmoo scenarios will display results but will not generate initialization code in Code Preview. A custom message is displayed instead:
Figure 5. DDR Shmoo Codegen