Detailed Explanation of DDR3 Design on Xilinx FPGA Platform
DDR3 memory interfaces are a staple in high-performance computing and storage applications. For FPGA designs, managing these interfaces manually is complex. Xilinx provides the Memory Interface Generator (MIG) IP core to abstract this complexity, allowing developers to focus on application logic rather than low-level hardware signaling.
🛠 MIG IP Core Overview #
The MIG is a high-performance memory interface IP that automates the generation of a DDR3 controller through a graphical configuration flow. It handles the heavy lifting of hardware design, including power management, signal integrity analysis, and precise timing control.
By utilizing MIG, designers can significantly reduce development time. The IP manages the physical layer and internal controller logic, providing a clean user interface for data exchange.
🏗 MIG IP Architecture #
The MIG IP is structured into three primary layers:
- User Interface Block: The top layer where the FPGA logic interacts with the memory controller.
- Memory Controller: The middle layer that manages command scheduling and data flow.
- Physical Layer: The bottom layer that handles the actual electrical signals to the DDR3 chips.
To control DDR3 read and write operations effectively, you must master the timing requirements of the User Interface (UI) signals. This interface is the bridge between your logic and the physical memory.
🔌 User Interface (UI) Signals #
The following signals define how the FPGA logic communicates with the MIG IP:
- app_addr: The address for the current request. This includes all address fields for the entire DDR3 SDRAM.
- app_cmd: The read/write control command. (001 = Read, 000 = Write).
- app_en: Indicates if the current command is valid. It must be synchronized with
app_addr,app_cmd, andapp_hi_pri. - app_hi_pri: Flags the current request as high priority.
- app_wdf_data: The data bus for write operations.
- app_wdf_end: Indicates the last data word in a burst write. This should align with
app_wdf_wren. - app_wdf_wren: Indicates that the data on the
app_wdf_databus is valid. - app_rd_data: The data bus for read operations.
- app_rd_data_end: Indicates the last data word in a burst read.
- app_rd_data_valid: Indicates that the data on the
app_rd_databus is valid. - app_rdy: The status signal of the UI. A ‘1’ indicates the UI is ready to accept a request; a ‘0’ means the UI is busy.
- app_wdf_rdy: Indicates if the write data FIFO is ready to accept data. A ‘1’ means the FIFO is not full; a ‘0’ means it is full.
- app_wdf_mask: A bitmask defining which bits of
app_wdf_dataare written to memory and which remain unchanged. - ui_clk / ui_clk_sync_rst: The output clock and synchronized reset for the UI logic.
- init_calib_complete: A flag indicating that the DDR3 memory calibration is finished.
For complex real-time systems requiring high-reliability memory access, integrating these hardware interfaces with a real-time operating system like VxWorks can provide the necessary hardware abstraction.
⏱ Read and Write Timing #
Command and Address Logic #
The MIG only accepts valid commands and addresses when both app_en and app_rdy are high simultaneously. When app_rdy is high, the MIG UI is in an idle state and can accept new instructions. You must pull app_en high at this moment to pass the app_cmd and app_addr into the IP.
Write Data Timing #
Write operations involve a relationship between the “Write Control Command” (app_cmd, app_addr, app_rdy, app_en) and the “Write Data Command” (app_wdf_rdy, app_wdf_wren, app_wdf_end, app_wdf_data). There are three logic modes for writing data:
- Simultaneous: The write command and the write data are valid at the same time.
- Data First: The data is written into the MIG input FIFO first, followed by the write address and command a few cycles later.
- Command First: The write command is sent a few cycles (maximum two user clock cycles) before the write data.
Note that for write data commands, you must check app_wdf_rdy. If it is high, the input data FIFO is not full, and you can proceed with the write.
Read Data Timing #
Read timing is straightforward. When app_rdy is high, you send the read address and command. After the command is accepted, you monitor the read data channel. Data becomes available when app_rd_data_valid is high, and you can then capture the values from the app_rd_data bus.