Emi ddr3 Ug
Emi ddr3 Ug
EMI_DDR3_UG-2.0
Copyright © 2010 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company, the stylized Altera logo, specific device designations, and all other
words and logos that are identified as trademarks and/or service marks are, unless noted otherwise, the trademarks and service marks of Altera Corporation in the U.S. and other
countries. All other product or service names are the property of their respective holders. Altera products are protected under numerous U.S. and foreign patents and pending ap-
plications, maskwork rights, and copyrights. Altera warrants performance of its semiconductor products to current specifications in accordance with Altera's standard warranty,
but reserves the right to make changes to any products and services at any time without notice. Altera assumes no responsibility or liability arising out of the application or use of
any information, product, or service described herein except as expressly agreed to in writing by Altera Corporation. Altera customers are advised to obtain the latest version of
device specifications before relying on any published information and before placing orders for products or services.
Contents
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
iv
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
v
Chapter 8. Latency
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
vi
Additional Information
How to Contact Altera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info–1
Typographic Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info–1
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
About This Section
Revision History
The following table shows the revision history for this section.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
viii About This Section
Revision History
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
1. About This IP
1 DDR3 SDRAM high-performance controller denotes both HPC and HPC II unless
indicated otherwise.
Figure 1–1 on page 1–1 shows a system-level diagram including the example top-level
file that the DDR3 SDRAM Controller with ALTMEMPHY IP creates for you.
ALTMEMPHY Example
High- Driver Pass or Fail
External
DLL (1) Performance
Memory
Device Controller
PLL
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
1–2 Chapter 1: About This IP
Release Information
The ALTMEMPHY megafunction creates the datapath between the memory device
and the memory controller. The megafunction is available as a stand-alone product or
can be used in conjunction with Altera high-performance memory controllers. When
using the ALTMEMPHY megafunction as a stand-alone product, use with either
custom or third-party controllers.
Release Information
Table 1–1 provides information about this release of the DDR3 SDRAM Controller
with ALTMEMPHY IP.
Altera verifies that the current version of the Quartus® II software compiles the
previous version of each MegaCore function. The MegaCore IP Library Release Notes
and Errata report any exceptions to this verification. Altera does not verify
compilation with MegaCore function versions older than one release. For information
about issues on the DDR3 SDRAM high-performance controller and
theALTMEMPHY megafunction in a particular Quartus II version, refer to the
Quartus II Software Release Notes.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 1: About This IP 1–3
Features
Table 1–2 shows the level of support offered by the DDR3 SDRAM Controller with
ALTMEMPHY IP to each of the Altera device families.
Features
The ALTMEMPHY megafunction offers the following features:
■ Simple setup.
■ Support for the Altera PHY Interface (AFI) for DDR3 SDRAM on all supported
devices.
■ Automated initial calibration eliminating complicated read data timing
calculations.
■ Voltage and temperature (VT) tracking that guarantees maximum stable
performance for DDR3 SDRAM interface.
■ Self-contained datapath that makes connection to an Altera controller or a
third-party controller independent of the critical timing paths.
■ Easy-to-use MegaWizard interface.
The ALTMEMPHY megafunction supports DDR3 SDRAM DIMMs with leveling and
DDR3 SDRAM components without leveling:
■ ALTMEMPHY with leveling is for unbuffered DIMMs (including SODIMM and
MicroDIMM) or DDR3 SDRAM components up to 80-bit total data bus width with
a layout like a DIMM that target Stratix III and Stratix IV devices:
■ Supports a fully-calibrated DDR3 SDRAM PHY for DDR3 SDRAM unbuffered
DIMM with ×4 and ×8 devices with 300-MHz to 533-MHz frequency targets.
■ Deskew circuitry is enabled automatically for interfaces higher than 400 MHz.
■ Supports single and multiple chip selects.
■ ALTMEMPHY supports DDR3 SDRAM components without leveling for
Arria II GX, Stratix III, and Stratix IV devices using T-topology for clock, address,
and command bus:
■ Supports multiple chip selects.
■ The DDR3 SDRAM PHY with leveling fMAX is 533 MHz; without leveling fMAX is
400 MHz for single chip selects.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
1–4 Chapter 1: About This IP
Features
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 1: About This IP 1–5
Unsupported Features
Unsupported Features
The DDR3 SDRAM Controller with ALTMEMPHY IP does not support the following
features:
■ Timing simulation.
■ Partial burst and unaligned burst in ECC and non-ECC mode when DM pins are
disabled.
MegaCore Verification
Altera performs extensive random, directed tests with functional test coverage using
industry-standard Denali models to ensure the functionality of the DDR3 SDRAM
Controller with ALTMEMPHY IP.
Resource Utilization
The following sections show the resource utilization data for the ALTMEMPHY
megafunction, and the DDR3 high-performance controllers (HPC and HPC II).
ALTMEMPHY Megafunction
Table 1–4 and Table 1–5 show the typical size of the ALTMEMPHY megafunction with
the AFI in the Quartus II software version 10.0 for the following devices:
■ Arria II GX (EP2AGX260FF35C4) devices
■ Stratix III (EP3SL110F1152C2) devices
■ Stratix IV (EP4SGX230HF35C2) devices
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
1–6 Chapter 1: About This IP
Resource Utilization
Table 1–5. Resource Utilization in Stratix III and Stratix IV Devices (Note 1)
Memory
PHY Width Combinational M9K Memory
Memory Type Rate (Bits) ALUTS Logic Registers Blocks ALUTs
DDR3 SDRAM Half 8 1,359 1,047 1 40
(400 MHz, without leveling 16 1,426 1,196 1 80
only)
64 1,783 2,080 1 320
72 1,871 2,228 1 360
DDR3 SDRAM 8 3,724 2,723 2 80
(400 MHz, with leveling only) 16 4,192 3,235 2 160
64 6,835 6,487 5 640
72 7,182 6,984 5 720
DDR3 SDRAM 8 4,098 2,867 2 80
(533 MHz with read and write 16 4,614 3,391 2 160
deskew, with leveling only)
64 7,297 6,645 5 640
72 7,641 7,144 5 720
Note to Table 1–5:
(1) The listed resource utilization refers to resources used by the ALTMEMPHY megafunction with AFI only. Memory controller overhead is
additional.
High-Performance Controller
Table 1–6 and Table 1–7 show the typical sizes for the DDR3 SDRAM HPC (including
ALTMEMPHY) for Stratix III and Stratix IV devices.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 1: About This IP 1–7
System Requirements
High-Performance Controller II
Table 1–9 through Table 1–10 show the typical sizes for the DDR3 SDRAM HPC II
(including ALTMEMPHY) for Arria II GX, Stratix III, and Stratix IV devices.
System Requirements
The DDR3 SDRAM Controller with ALTMEMPHY IP is a part of the MegaCore IP
Library, which is distributed with the Quartus II software and downloadable from the
Altera website, [Link].
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
1–8 Chapter 1: About This IP
Installation and Licensing
<path>
Installation directory.
ip
Contains the Alterar MegaCore IP Library and third-party IP cores.
altera
Contains the Altera MegaCore IP Library.
common
Contains shared components.
ddr3_high_perf
Contains the DDR3 SDRAM Controller with ALTMEMPHY IP files.
lib
Contains encypted lower-level design files and other support files.
You need a license for the MegaCore function only when you are completely satisfied
with its functionality and performance, and want to take your design to production.
To use the DDR3 SDRAM HPC, you can request a license file from the Altera web site
at [Link]/licensing and install it on your computer. When you request a
license file, Altera emails you a [Link] file. If you do not have Internet access,
contact your local representative.
To use the DDR3 SDRAM HPC II, contact your local sales representative to order a
license.
Free Evaluation
Altera's OpenCore Plus evaluation feature is only applicable to the DDR3 SDRAM
HPC. With the OpenCore Plus evaluation feature, you can perform the following
actions:
■ Simulate the behavior of a megafunction (Altera MegaCore function or AMPPSM
megafunction) within your system.
■ Verify the functionality of your design, as well as evaluate its size and speed
quickly and easily.
■ Generate time-limited device programming files for designs that include
MegaCore functions.
■ Program a device and verify your design in hardware.
You need to purchase a license for the megafunction only when you are completely
satisfied with its functionality and performance, and want to take your design to
production.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 1: About This IP 1–9
Installation and Licensing
1 For MegaCore functions, the untethered time-out is 1 hour; the tethered time-out
value is indefinite.
Your design stops working after the hardware evaluation time expires and the
local_ready output goes low.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
1–10 Chapter 1: About This IP
Installation and Licensing
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
2. Getting Started
Design Flow
You can implement the DDR3 SDRAM Controller with ALTMEMPHY IP using either
one of the following flows:
■ SOPC Builder flow
■ MegaWizard Plug-In Manager flow
You can only instantiate the ALTMEMPHY megafunction using the MegaWizard
Plug-In Manager flow.
Figure 2–1 shows the stages for creating a system in the Quartus II software using
either one of the flows.
Complete
SOPC Builder System
Optional
Does
Simulation Give IP Complete
Expected Results?
Debug Design
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
2–2 Chapter 2: Getting Started
SOPC Builder Flow
f For more information about SOPC Builder, refer to volume 4 of the Quartus II
Handbook. For more information about how to use controllers with SOPC Builder,
refer to the ALTMEMPHY Design Tutorials section in volume 6 of the External Memory
Interface Handbook. For more information on the Quartus II software, refer to the
Quartus II Help.
Specifying Parameters
To specify the parameters for the DDR3 SDRAM Controller with ALTMEMPHY IP
using the SOPC Builder flow, perform the following steps:
1. In the Quartus II software, create a new Quartus II project with the New Project
Wizard.
2. On the Tools menu, click SOPC Builder.
3. For a new system, specify the system name and language.
4. Add DDR3 SDRAM Controller with ALTMEMPHY to your system from the
System Contents tab.
5. Specify the required parameters on all pages in the Parameter Settings tab.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 2: Getting Started 2–3
SOPC Builder Flow
If you are upgrading your Nios system design from version 8.1 or previous,
ensure that you change the Reset Vector Offset and the Exception Vector
Offset to AFI mode.
To calculate the Avalon-MM address equivalent of the memory address range 0×0
to 0×47, multiply the memory address by the width of the memory interface data
bus in bytes. Refer to Table 2–1 for more Avalon-MM addresses.
4. Click Finish.
5. On the System Contents tab, expand Interface Protocols and expand Serial.
6. Select JTAG UART and click Add.
7. Click Finish.
If you enable ECC and there are warnings about overlapping IRQs, on the
System menu click Auto Assign IRQs.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
2–4 Chapter 2: Getting Started
MegaWizard Plug-In Manager Flow
8. For this example system, ensure all the other modules are clocked on the
altmemddr_sysclk, to avoid any unnecessary clock-domain crossing logic.
9. Click Generate.
1 Among the files generated by SOPC Builder is the Quartus II IP File (.qip).
This file contains information about a generated IP core or system. In most
cases, the .qip file contains all of the necessary assignments and
information required to process the MegaCore function or system in the
Quartus II compiler. Generally, a single .qip file is generated for each SOPC
Builder system. However, some more complex SOPC Builder components
generate a separate .qip file. In that case, the system .qip file references the
component .qip file.
10. Compile your design, refer to “Compiling and Simulating” on page 4–1.
f For more information about the MegaWizard Plug-In Manager, refer to the Quartus II
Help.
Specifying Parameters
To specify parameters using the MegaWizard Plug-In Manager flow, perform the
following steps:
1. In the Quartus II software, create a new Quartus II project with the New Project
Wizard.
2. On the Tools menu, click MegaWizard Plug-In Manager to start the MegaWizard
Plug-In Manager.
■ The DDR3 SDRAM Controller with ALTMEMPHY is in the Interfaces folder
under the External Memory folder.
■ The ALTMEMPHY megafunction is in the I/O folder.
1 The <variation name> must be a different name from the project name and
the top-level design entity name.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 2: Getting Started 2–5
Generated Files
c Use the simulation models only for simulation and not for synthesis or any
other purposes. Using these models for synthesis creates a nonfunctional
design.
1 Some third-party synthesis tools can use a netlist that contains only the
structure of the MegaCore function, but not detailed logic, to optimize
performance of the design that contains the MegaCore function. If your
synthesis tool supports this feature, turn on Generate netlist.
5. On the Summary tab, select the files you want to generate. A gray checkmark
indicates a file that is automatically generated. All other files are optional.
6. Click Finish to generate the MegaCore function and supporting files. A generation
report appears.
7. If you generate the MegaCore function instance in a Quartus II project, you are
prompted to add the .qip files to the current Quartus II project. When prompted to
add the .qip files to your project, click Yes. The addition of the .qip files enables
their visibility to Nativelink. Nativelink requires the .qip files to include libraries
for simulation.
8. After you review the generation report, click Exit to close the MegaWizard Plug-In
Manager.
9. For the high-performance controller (HPC or HPC II), set the <variation
name>_example_top.v or .vhd file to be the project top-level design file.
a. On the File menu, click Open.
b. Browse to <variation name>_example_top and click Open.
c. On the Project menu, click Set as Top-Level Entity.
Generated Files
Table 2–2 shows the ALTMEMPHY generated files.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
2–6 Chapter 2: Getting Started
Generated Files
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 2: Getting Started 2–7
Generated Files
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
2–8 Chapter 2: Getting Started
Generated Files
Table 2–4 through Table 2–6 show the additional files generated by the
high-performance controllers, that may be in your project directory. The names and
types of files specified in the MegaWizard Plug-In Manager report vary based on
whether you created your design with VHDL or Verilog HDL.
1 In addition to the files in Table 2–4 through Table 2–6, the MegaWizard also generates
the ALTMEMPHY files in Table 2–2, but with a _phy prefix. For example,
<variation_name>_alt_mem_phy_delay.vhd becomes
<variation_name>_phy_alt_mem_phy_delay.vhd.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 2: Getting Started 2–9
Generated Files
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
2–10 Chapter 2: Getting Started
Generated Files
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
3. Parameter Settings
The text window at the bottom of the MegaWizard Plug-In Manager displays
information about the memory interface, warnings, and errors if you are trying to
create something that is not supported. The Finish button is disabled until you correct
all the errors indicated in this window.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
3–2 Chapter 3: Parameter Settings
ALTMEMPHY Parameter Settings
The following sections describe the four tabs of the Parameter Settings page in more
detail.
Memory Settings
In the Memory Settings tab, you can select a particular memory device for your
system and choose the frequency of operation for the device. Under General Settings,
you can choose the device family, speed grade, and clock information. In the middle
of the page (left-side), you can filter the available memory device listed on the right
side of the Memory Presets dialog box, refer to Figure 3–1. If you cannot find the
exact device that you are using, choose a device that has the closest specifications,
then manually modify the parameters to match your actual device by clicking Modify
parameters, next to the Selected memory preset field.
Table 3–1 describes the General Settings available on the Memory Settings page of
the ALTMEMPHY MegaWizard interface.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 3: Parameter Settings 3–3
ALTMEMPHY Parameter Settings
Table 3–2 describes the options available to filter the Memory Presets that are
displayed. This set of options is where you indicate whether you are creating a
datapath for DDR3 SDRAM.
1 Even though the device you are using is listed in Memory Presets, ensure that the
settings in the Preset Editor dialog box are accurate, as some parameters may have
been updated in the memory device datasheets.
You can change the parameters with a white background to reflect your system. You
can also change the parameters with a gray background so the device parameters
match the device you are using. These parameters in gray background are
characteristics of the chosen memory device and changing them creates a new custom
memory preset. If you click Save As (at the bottom left of the page) and save the new
settings in the <quartus_install_dir>\quartus\common\ip\altera\altmemphy\lib\
directory, you can use this new memory preset in other Quartus II projects created in
the same version of the software.
When you click Save, the new memory preset appears at the bottom of the Memory
Presets list in the Memory Settings tab.
1 If you save the new settings in a directory other than the default directory, click Load
Preset in the Memory Settings tab to load the settings into the Memory Presets list.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
3–4 Chapter 3: Parameter Settings
ALTMEMPHY Parameter Settings
Figure 3–2 shows the Preset Editor dialog box for a DDR3 SDRAM.
The Advanced option is only available for Arria II GX and Stratix IV devices. This
option shows the percentage of memory specification that is calibrated by the FPGA.
The percentage values are estimated by Altera based on the process variation.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 3: Parameter Settings 3–5
ALTMEMPHY Parameter Settings
Table 3–3 through Table 3–5 describe the DDR3 SDRAM parameters available for
memory attributes, initialization options, and timing parameters.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
3–6 Chapter 3: Parameter Settings
ALTMEMPHY Parameter Settings
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 3: Parameter Settings 3–7
ALTMEMPHY Parameter Settings
Memory write CAS latency 5.0, 6.0, 7.0, 8.0 cycles Sets the delay in clock cycles from the write command
setting (CWL) to the first expected data to the memory.
Memory partial array self Full array, — Determine whether you want to self-refresh only certain
refresh Half array arrays instead of the full array. According to the DDR3
{BA[2:0]=000,001, SDRAM specification, data located in the array beyond
010,011}, the specified address range are lost if self refresh is
Quarter array entered when you use this. This option is not supported
{BA[2:0]=000,001} by the DDR3 SDRAM Controller with ALTMEMPHY IP,
, so set to Full Array if you are using the Altera
Eighth array controller.
{BA[2:0]=000},
Three Quarters
array
{BA[2:0]=010,011,
100,101,110,111},
Half array
{BA[2:0]=100,101,
110,111},
Quarter array
{BA[2:0]=110,
111},
Eighth array
{BA[2:0]=111}
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
3–8 Chapter 3: Parameter Settings
ALTMEMPHY Parameter Settings
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 3: Parameter Settings 3–9
ALTMEMPHY Parameter Settings
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
3–10 Chapter 3: Parameter Settings
ALTMEMPHY Parameter Settings
1 For Arria II GX and Stratix IV devices, you need not derate using the Preset Editor.
You only need to enter the parameters referenced to VREF, and the deration is done
automatically when you enter the slew rate information on the Board Settings tab.
After derating the values, you then need to normalize the derated value because
Altera input and output timing specifications are referenced to VREF. When the
memory device setup and hold time numbers are derated and normalized to VREF,
update these values in the Preset Editor dialog box to ensure that your timing
constraints are correct.
The following memory device specifications and update the Preset Editor dialog box
with the derated value:
For example, according to JEDEC, 533-MHz DDR3 SDRAM has the following
specifications, assuming 1V/ns DQ slew rate rising signal and 2V/ns DQS-DQSn
slew rate:
■ Base tDS = 25
■ Base tDH = 100
■ VIH(ac) = VREF + 0.175 V
■ VIH(dc) = VREF + 0.100 V
■ VIL(ac) = VREF – 0.175 V
■ VIL(dc) = VREF – 0.100 V
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 3: Parameter Settings 3–11
ALTMEMPHY Parameter Settings
The VREF referenced setup and hold signals for a rising edge are:
tDS (VREF) = Base tDS + delta tDS + (VIH(ac) – VREF)/slew_rate = 25 + 0 + 175 = 200 ps
tDH (VREF) = Base tDH + delta tDH + (VIH(dc) – VREF)/slew_rate = 100 + 0 + 100 =
200 ps
If the output slew rate of the write data is different from 1V/ns, you have to first
derate the tDS and tDH values, then translate these AC/DC level specs to VREF
specification.
For a 2V/ns DQ slew rate rising signal and 2V/ns DQS-DQSn slew rate:
tDS (VREF) = Base tDS + delta tDS + (VIH(ac) – VREF)/slew_rate = 25 + 88 + 87.5 = 200.5
ps
tDH (VREF) = Base tDH + delta tDH + (VIH(dc) – VREF)/slew_rate = 100 + 50 + 50 = 200
ps
For a 0.5V/ns DQ slew rate rising signal and 1V/ns DQS-DQSn slew rate:
tDS (VREF) = Base tDS + delta tDS + (VIH(ac) – VREF)/slew_rate = 25 + 5 + 350 = 380 ps
tDH (VREF) = Base tDH + delta tDH + (VIH(dc) – VREF)/slew_rate = 100 + 10 + 200 =
310 ps
PHY Settings
Click Next or the PHY Settings tab to set the options described in Table 3–6. The
options are available if they apply to the target Altera device.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
3–12 Chapter 3: Parameter Settings
ALTMEMPHY Parameter Settings
Board Settings
Click Next or the Board Settings tab to set the options described in Table 3–7. The
board settings parameters are set to model the board level effects in the timing
analysis. The options are available if you choose Arria II GX or Stratix IV device for
your interface. Otherwise, the options are disabled.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 3: Parameter Settings 3–13
DDR3 SDRAM Controller with ALTMEMPHY Parameter Settings
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
3–14 Chapter 3: Parameter Settings
DDR3 SDRAM Controller with ALTMEMPHY Parameter Settings
Controller Settings
Table 3–8 shows the options provided on the Controller Settings tab.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 3: Parameter Settings 3–15
DDR3 SDRAM Controller with ALTMEMPHY Parameter Settings
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
3–16 Chapter 3: Parameter Settings
DDR3 SDRAM Controller with ALTMEMPHY Parameter Settings
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
4. Compiling and Simulating
After setting the parameters for the MegaCore function, you can now integrate the
MegaCore function variation into your design, and compile and simulate your design.
The following sections detail the steps you need to perform to compile and simulate
your design.
ALTMEMPHY Example
High- Driver Pass or Fail
External
DLL (1) Performance
Memory
Device Controller
PLL
Before compiling a design with the ALTMEMPHY variation, you must edit some
project settings, include the .sdc file, and make I/O assignments. I/O assignments
include I/O standard, pin location, and other assignments, such as termination and
drive strength settings. Some of these tasks are listed in the ALTMEMPHY
Generation window. For most systems, Altera recommends that you use the
Advanced I/O Timing feature by using the Board Trace Model command in the
Quartus II software to set the termination and output pin loads for the device.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
4–2 Chapter 4: Compiling and Simulating
Compiling the Design
To use the Quartus II software to compile the example top-level file in the Quartus II
software and perform post-compilation timing analysis, perform the following steps:
1. Set up the TimeQuest timing analyzer:
a. On the Assignments menu, click Timing Analysis Settings, select Use
TimeQuest Timing Analyzer during compilation, and click OK.
b. Add the Synopsys Design Constraints (.sdc) file,
<variation name>_phy_ddr_timing.sdc, to your project. On the Project menu,
click Add/Remove Files in Project and browse to select the file.
c. Add the .sdc file for the example top-level design,
<variation name>_example_top.sdc, to your project. This file is only required if
you are using the example as the top-level design.
2. You can either use the <variation_name>_pin_assignments.tcl or the
<variation_name>.ppf file to apply the I/O assignments generated by the
MegaWizard Plug-In Manager. Using the .ppf file and the Pin Planner gives you
the extra flexibility to add a prefix to your memory interface pin names. You can
edit the assignments either in the Assignment Editor or Pin Planner. Use one of the
following procedures to specify the I/O standard assignments for pins:
■ If you have a single SDRAM interface, and your top-level pins have default
naming shown in the example top-level file, run
<variation name>_pin_assignments.tcl.
or
■ If your design contains pin names that do not match the design, edit the
<variation name>_pin_assignments.tcl file before you run the script. To edit the .tcl
file, perform the following steps:
a. Open <variation name>_pin_assignments.tcl file.
b. Based on the flow you are using, set the sopc_mode value to Yes or No.
■ SOPC Builder System flow:
if {![info exists sopc_mode]} {set sopc_mode YES}
■ MegaWizard Plug-In Manager flow:
if {![info exists sopc_mode]} {set sopc_mode NO}
c. Type your preferred prefix in the pin_prefix variable. For example, to add
the prefix my_mem, do the following:
if {![info exists set_prefix}{set pin_prefix “my_mem_”}
After setting the prefix, the pin names are expanded as shown in the following:
■ SOPC Builder System flow:
my_mem_cs_n_from_the_<your instance name>
■ MegaWizard Plug-In Manager flow:
my_mem_cs_n[0]
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 4: Compiling and Simulating 4–3
Compiling the Design
1 If your top-level design does not use single bit bus notation for the
single-bit memory interface signals (for example, mem_dqs rather than
mem_dqs[0]), in the Tcl script you should change set single_bit
{[0]} to set single_bit {}.
or
■ Alternatively, to change the pin names that do not match the design, you can add a
prefix to your pin names by performing the following steps:
a. On the Assignments menu, click Pin Planner.
b. On the Edit menu, click Create/Import Megafunction.
c. Select Import an existing custom megafunction and navigate to
<variation name>.ppf.
d. Type the prefix you want to use in Instance name. For example, change
mem_addr to core1_mem_addr.
3. Set the top-level entity to the top-level design.
a. On the File menu, click Open.
b. Browse to your SOPC Builder system top-level design or <variation
name>_example_top if you are using MegaWizard Plug-In Manager, and click
Open.
c. On the Project menu, click Set as Top-Level Entity.
4. Assign the DQ and DQS pin locations.
a. You should assign pin locations to the pins in your design, so the Quartus II
software can perform fitting and timing analysis correctly.
b. Use either the Pin Planner or Assignment Editor to assign the clock source pin
manually. Also choose which DQS pin groups should be used by assigning
each DQS pin to the required pin. The Quartus II Fitter then automatically
places the respective DQ signals onto suitable DQ pins within each group.
1 To avoid no-fit errors when you compile your design, ensure that you place
the mem_clk pins to the same edge as the mem_dq and mem_dqs pins, and
set an appropriate I/O standard for the non-memory interfaces, such as the
clock source and the reset inputs, when assigning pins in your design. For
example, for DDR3 SDRAM select 1.5 V. Also select in which bank or side
of the device you want the Quartus II software to place them.
The ×4 DIMM has the following mapping between DQS and DQ pins:
■ DQS[0] maps to DQ[3:0]
■ DQS[9] maps to DQ[7:4]
■ DQS[1] maps to DQ[11:8]
■ DQS[10] maps to DQ[15:12]
The DQS pin index in other ×4 DIMM configurations typically increases
sequentially with the DQ pin index (DQS[0]: DQ[3:0]; DQS[1]: DQ[7:4]; DQS[2]:
DQ[11:8])
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
4–4 Chapter 4: Compiling and Simulating
Simulating the Design
5. For Stratix III and Stratix IV designs, if you are using advanced I/O timing, specify
board trace models in the Device & Pin Options dialog box. If you are using any
other device and not using advanced I/O timing, specify the output pin loading
for all memory interface pins.
6. Select your required I/O driver strength (derived from your board simulation) to
ensure that you correctly drive each signal or ODT setting and do not suffer from
overshoot or undershoot.
7. To compile the design, on the Processing menu, click Start Compilation.
After you have compiled the example top-level file, you can perform RTL simulation
or program your targeted Altera device to verify the example top-level file in
hardware.
f For more information about simulating SOPC Builder systems, refer to volume 4 of
the Quartus II Handbook and AN 351: Simulating Nios II Embedded Processor Designs. For
more information about simulation, refer to the Simulation section in volume 4 of the
External Memory Interface Handbook. For more information about how to include your
board simulation results in the Quartus II software and how to assign pins using pin
planners, refer to ALTMEMPHY Design Tutorials section in volume 6 of the External
Memory Interface Handbook.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 4: Compiling and Simulating 4–5
Simulating the Design
1 If you are simulating your ALTMEMPHY-based design with a Denali model, Altera
recommends that you use full calibration mode.
1 Check that the absolute path to your third-party simulator executable is set.
On the Tools menu, click Options and select EDA Tools Options.
c. In NativeLink settings, select Compile test bench and click Test Benches.
d. Click New on the Test Benches page to create a testbench.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
4–6 Chapter 4: Compiling and Simulating
Simulating the Design
1 Ensure that the Quartus II EDA Tool Options are configured correctly for
your simulation environment. On the Tools menu, click Options. In the
Category list, click EDA Tool Options and verify the locations of the
executable files.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 4: Compiling and Simulating 4–7
Simulating the Design
IP Functional Simulations
For VHDL simulations with IP functional simulation models, perform the following
steps:
1. Create a directory in the <project directory>\testbench directory.
2. Launch your simulation tool from this directory and create the following libraries:
■ altera_mf
■ lpm
■ sgate
■ <device name>
■ altera
■ ALTGXB
■ <device name>_hssi
■ auk_ddr3_hp_user_lib
3. Compile the files into the appropriate library (AFI mode) as shown in Table 4–1.
The files are in VHDL93 format.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
4–8 Chapter 4: Compiling and Simulating
Simulating the Design
1 If you are targeting Stratix IV devices, you need both the Stratix IV and
Stratix III files (stratixiv_atoms and stratixiii_atoms) to simulate in your
simulator, unless you are using NativeLink.
4. Load the testbench in your simulator with the timestep set to picoseconds.
For Verilog HDL simulations with IP functional simulation models, perform the
following steps:
1. Create a directory in the <project directory>\testbench directory.
2. Launch your simulation tool from this directory and create the following libraries:
■ altera_mf_ver
■ lpm_ver
■ sgate_ver
■ <device name>_ver
■ altera_ver
■ ALTGXB_ver
■ <device name>_hssi_ver
■ auk_ddr3_hp_user_lib
3. Compile the files into the appropriate library (AFI mode) as shown in Table 4–2 on
page 4–9.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 4: Compiling and Simulating 4–9
Simulating the Design
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
4–10 Chapter 4: Compiling and Simulating
Simulating the Design
1 If you are targeting Stratix IV devices, you need both the Stratix IV and
Stratix III files (stratixiv_atoms and stratixiii_atoms) to simulate in your
simulator, unless you are using NativeLink.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
5. Functional Description—ALTMEMPHY
The ALTMEMPHY megafunction creates the datapath between the memory device
and the memory controller, and user logic in various Altera devices. The
ALTMEMPHY megafunction GUI helps you configure multiple variations of a
memory interface. You can then connect the ALTMEMPHY megafunction variation
with either a user-designed controller or with an Altera high-performance controller.
In addition, the ALTMEMPHY megafunction and the Altera high-performance
controllers are available for half-rate DDR3 SDRAM interfaces.
1 If the ALTMEMPHY megafunction does not meet your requirements, you can also
create your own memory interface datapath using the ALTDLL and ALTDQ_DQS
megafunctions, available in the Quartus II software. However, you are then
responsible for every aspect of the interface, including timing analysis and
debugging.
This chapter describes the DDR3 SDRAM ALTMEMPHY megafunction, which uses
AFI as the interface between the PHY and the controller.
Block Description
Figure 5–1 on page 5–2 shows the major blocks of the ALTMEMPHY megafunction
and how it interfaces with the external memory device and the controller. The
ALTPLL megafunction is instantiated inside the ALTMEMPHY megafunction, so that
you do not need to generate the clock to any of the ALTMEMPHY blocks.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–2 Chapter 5: Functional Description—ALTMEMPHY
Block Description
Figure 5–1. ALTMEMPHY Megafunction Interfacing with the Controller and the External Memory
FPGA
ALTMEMPHY
Write
Datapath
Address
and
Command Memory User
Datapath Controller Logic
External
Memory
Device Clock
and Reset
Management
DLL
PLL
Read
Datapath
Sequencer
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–3
Block Description
Calibration
This section describes the calibration that the sequencer performs, to find the optimal
clock phase for the memory interface. The calibration sequence is similar across
families, but different depending on the following target memory interface:
■ DDR3 SDRAM Without Leveling
■ DDR3 SDRAM With Leveling
f For more detailed information about each calibration step, refer to the Debugging
section in volume 4 of the External Memory Interface Handbook.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–4 Chapter 5: Functional Description—ALTMEMPHY
Block Description
Memory Device
and PHY Initialization
Write Training
Patterns
Read Resynchronization
Clock Phase
Postamble
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–5
Block Description
Step 6: Postamble
This step sets the correct clock cycle for the postamble path. The aim of the postamble
path is to eliminate false DQ data capture because of postamble glitches on the DQS
signal, through an override on DQS. This step ensures the correct clock cycle timing of
the postamble enable (override) signal.
VT Tracking
VT tracking is a background process that tracks the voltage and temperature
variations to maintain the relationship between the resynchronization or capture
clock and the data valid window that are achieved at calibration.
When the data calibration phase is completed, the sequencer issues the mimic
calibration sequence every 128 ms.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–6 Chapter 5: Functional Description—ALTMEMPHY
Block Description
During initial calibration, the mimic path is sampled using the measure clock
(measure_clk has a _1x or _2x suffix, depending whether the ALTMEMPHY is a
full-rate or half-rate design). The sampled value is then stored by the sequencer. After
a sample value is stored, the sequencer uses the PLL reconfiguration logic to change
the phase of the measure clock by one VCO phase tap. The control sequencer then
stores the sampled value for the new mimic path clock phase. This sequence
continues until all mimic path clock phase steps are swept. After the control
sequencer stores all the mimic path sample values, it calculates the phase which
corresponds to the center of the high period of the mimic path waveform. This
reference mimic path sampling phase is used during the VT tracking phase.
In user mode, the sequencer periodically performs a tracking operation as defined in
the tracking calibration description. At the end of the tracking calibration operation,
the sequencer compares the most recent optimum tracking phase against the reference
sampling phase. If the sampling phases do not match, the mimic path delays have
changed due to voltage and temperature variations.
When the sequencer detects that the mimic path reference and most recent sampling
phases do not match, the sequencer uses the PLL reconfiguration logic to change the
phase of the resynchronization clock by the VCO taps in the same direction. This
allows the tracking process to maintain the near-optimum capture clock phase setup
during data tracking calibration as voltage and temperature vary over time.
The relationship between the resynchronization or capture clock and the data valid
window is maintained by measuring the mimic path variations due to the VT
variations and applying the same variation to the resynchronization clock.
Mimic Path
The mimic path mimics the FPGA elements of the round-trip delay, which enables the
calibration sequencer to track delay variation due to VT changes during the memory
read and write transactions without interrupting the operation of the ALTMEMPHY
megafunction.
The assumption made about the mimic path is that the VT variation on the round trip
delay path that resides outside of the FPGA is accounted for in the board skew and
memory parameters entered in the MegaWizard Plug-In Manager. For the write
direction, any VT variation in the memory devices is accounted for by timing analysis.
Figure 5–3 shows the mimic path in Stratix II and Stratix II GX devices, which mimics
the delay of the clock outputs to the memory as far as the pads of the FPGA and the
delay from the input DQS pads to a register in the FPGA core. During the tracking
operation, the sequencer measures the delay of the mimic path by varying the phase
of the measure clock. Any change in the delay of the mimic path indicates a
corresponding change in the round-trip delay, and a corresponding adjustment is
made to the phase of the resynchronization or capture clock.
1 The mimic path in Arria II GX, Stratix III and Stratix IV devices is similar to
Figure 5–3. The only difference is that the mem_clk[0] pin is generated by DDIO
register; mem_clk_n[0] is generated by signal splitter.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–7
Block Description
datain 1
mem_clk[0]
ddiodatain 0
outclk
mem_clk_2x
combout
ALTPLL
measure_clk
mimic_data_in
alt_mem_phy_mimic
measure_clk
With fly-by termination, each DDR3 SDRAM device on the DIMM sees the CK/CKn
edges at different times. Therefore, the sequencer must adjust the clock to launch the
DQS/DQSn and DQ signals so that it is appropriately aligned to the CK/CKn signals
on each device.
The DDR3 SDRAM leveling sequencer during calibration writes to the following
locations:
■ Banks 0, 1, and 2
■ Row 0
■ All columns
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–8 Chapter 5: Functional Description—ALTMEMPHY
Block Description
Bank 0 is written to for the block training pattern and clock cycle calibration (DQ_1T
and AC_1T). Bank 1 is written to for write deskew (DQ). Bank 2 is written to for write
deskew (DM). For each bank, only row 0 is accessed. The number of columns accessed
can vary, but you should avoid writing to all columns in these banks and row 0.
The calibration process for the DDR3 SDRAM PHY with leveling includes the
following steps:
■ “Step 1: Memory Device Initialization”
■ “Step 2: Write Leveling”
■ “Step 3: Write Training Patterns”
■ “Step 4: Read Resynchronization”
■ “Step 5: Address and Command Path Clock Cycle”
■ “Step 7: Write Clock Path Setup”
■ “Step 8: Prepare for User Mode”
1 No steps can be bypassed. Therefore, even if you are using only one DDR3 SDRAM
DIMM, all the calibration sequences are performed.
The calibration assumes that the skew for all the DQS launch times is one clock period
maximum.
The VT tracking portion of the DDR3 SDRAM sequencer is similar to that of the DDR
or DDR2 SDRAM sequencer.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–9
Block Description
Memory Device
and PHY Initialization
Write Leveling
Write Training
Patterns
Read Resynchronization
Clock Phase
Postamble
Write Clock
Path Setup
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–10 Chapter 5: Functional Description—ALTMEMPHY
Block Description
1 On multiple rank DDR3 SDRAM DIMMs, address signals are routed differently to
each rank (referred to in the JEDEC specification as address mirroring). Ranks with
address mirroring can be specified in the memory Preset Editor in the Mirror
addressing field.
1 RTL simulation of address mirroring is not currently supported by the memory model
generated with the example testbench. To simulate successfully, you need a DDR3
DIMM model compatible with address mirroring.
Step 6: Postamble
This step sets the correct clock cycle and clock phase shift for the postamble path.
With the read resynchronization process, the sequencer can approximate when the
postamble enable must be asserted. The sequencer then tries to incrementally assert
the postamble enable signal (per DQS group) earlier until there is a read failure. This
ensures the optimal clock phase for the system's postamble enable signal.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–11
Block Description
VT Tracking
f For information on VT tracking for DDR3 SDRAM with leveling, refer to “VT
Tracking” on page 5–5.
Mimic Path
f For information on mimic path for DDR3 SDRAM with leveling, refer to “Mimic
Path” on page 5–6.
Arria II GX Devices
The address and command datapath is responsible for taking the address and
command outputs from the controller and converting them from half-rate clock to
full-rate clock. Two types of addressing are possible:
■ 1T (full rate)—the duration of the address and command is a single memory clock
cycle (mem_clk_2x, Figure 5–6). This applies to all address and command signals
in full-rate designs or mem_cs_n, mem_cke, and mem_odt signals in half-rate
designs.
■ 2T (half rate)—the duration of the address and command is two memory clock
cycles. For half-rate designs, the ALTMEMPHY megafunction supports only a
burst size of four, which means the burst size on the local interface is always set to
1. The size of the data is 4n-bits wide on the local side and is n-bits wide on the
memory side. To transfer all the 4n-bits at the double data rate, two memory-clock
cycles are required. The new address and command can be issued to memory
every two clock cycles. This scheme applies to all address and command signals,
except for mem_cs_n, mem_cke, and mem_odt signals in half-rate mode.
1 Refer to Table 5–1 on page 5–14 to see the frequency relationship of mem_clk_2x with
the rest of the clocks.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–12 Chapter 5: Functional Description—ALTMEMPHY
Block Description
Figure 5–6 shows a 1T chip select signal (mem_cs_n), which is active low, and
disables the command in the memory device. All commands are masked when the
chip-select signal is inactive. The mem_cs_n signal is considered part of the command
code.
ac_clk_2x
mem_cas_n
mem_we_n
mem_cs_n
mem_ba 00
mem_dq
mem-dqs
1 The ac_clk_2x clock is derived from either mem_clk_2x (when you choose 0° or
180° phase shift) or write_clk_2x (when you choose 90° or 270° phase shift).
1 The address and command clock can be 0, 90, 180, or 270° from the system clock.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–13
Block Description
Clock Management
The clock management feature allows the ALTMEMPHY megafunction to work out
the optimum phase during calibration, and to track voltage and temperature variation
relies on phase shifting the clocks relative to each other.
You can implement clock management circuitry using PLLs and DLLs.
The ALTMEMPHY MegaWizard Plug-In Manager automatically generates an
ALTPLL megafunction instance. The ALTPLL megafunction generates the different
clock frequencies and relevant phases used within the ALTMEMPHY megafunction.
The available device families have different PLL capabilities. The minimum PHY
requirement is to have 16 phases of the highest frequency clock. The PLL uses With
No Compensation option to minimize jitter. Changing the PLL compensation to a
different operation mode may result in inaccurate timing results.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–14 Chapter 5: Functional Description—ALTMEMPHY
Block Description
The input clock to the PLL does not have any other fan-out to the PHY, so you do not
have to use a global clock resource for the path between the clock input pin to the
PLL. You must use the PLL located in the same device quadrant or side as the
memory interface and the corresponding clock input pin for that PLL, to ensure
optimal performance and accurate timing results from the Quartus II software.
You must choose a PLL and PLL input clock pin that are located on the same side of
the device as the memory interface to ensure minimal jitter. Also, ensure that the input
clock to the PLL is stable before the PLL locks. If not, you must perform a manual PLL
reset (by driving the global_reset_n signal low) and relock the PLL to ensure that
the phase relationship between all PLL outputs is properly set.
1 If the design cascades PLLs, the source (upstream) PLL should have a low-bandwidth
setting, and the destination (downstream) PLL should have a high-bandwidth setting.
Adjacent PLLs cascading is recommended to reduce clock jitter.
Cross-device cascading PLLs are only allowed in Stratix III devices with the following
conditions:
■ Upstream PLL: 0.59 MHz =< upstream PLL bandwidth < 1 MHz. The upstream
PLL should use the With No Compensation operation mode.
■ Downstream PLL: downstream PLL bandwidth > 2 MHz.
f For more information about the VCO frequency range and the available phase shifts,
refer to the Clock Networks and PLLs chapter in the respective device family handbook.
Table 5–1 shows the clock outputs that Arria II GX devices use.
aux_full_rate_
clk
mem_clk_1x C2 0 Half-Rate Global This clock is for clocking DQS and
as a reference clock for the
memory devices.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–15
Block Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–16 Chapter 5: Functional Description—ALTMEMPHY
Block Description
Table 5–2 shows the PLL outputs and their usage for Stratix III and Stratix IV devices.
Table 5–2. DDR3 SDRAM Clocking Stratix IV and Stratix III Devices (Part 1 of 2)
Clock
Postscale Phase Clock Network
Clock Name (1) Counter (Degrees) Rate Type Notes
phy_clk_1x C0 –40 Half-Rate Global The only clock parameterizable for the
(with ALTMEMPHY megafunction. With
and leveling) phy_clk_1x the sequencer generates
30 another sc_clk_dp clock with this clock
(without that programs the scan chains of the I/O
aux_half_rate_ elements. For more information on
clk leveling)
changing the clock network type, refer to the
ALTMEMPHY Design Tutorials section in
volume 6 of the External Memory Interface
Handbook.
mem_clk_2x C1 0 Full-Rate Special Generates mem_clk that provides the
reference clock for the DLL. A dedicated
routing resource exists from the PLL to the
DLL, which you select with the regional
routing resource for the mem_clk using
the following attribute in the HDL:
(-name global_signal
dual_regional
_clock;
-to dll~DFFIN
-name global_signal off). If you
use an external DLL, apply this attribute
similarly to the external DLL.
aux_full_rate_ C2 0 Full-Rate None A copy of mem_clk_2x that you can use
clk (with in other parts of your design.
leveling)
60
(without
leveling)
write_clk_2x C3 0 Full-Rate Regional This clock feeds the write leveling delay
(with chains that generate the DQ, DM, DQS, and
leveling) mem_clk signals.
–90
(without
leveling)
resync_clk_2x C4 Calibrated Full-Rate Regional This clock feeds the I/O clock divider that
then reads the data out of the DDIO pins. Its
phase is adjusted in the calibration process.
The design uses an inverted version of this
clock for postamble clocking.
measure_clk_1x C5 Calibrated Half-Rate Regional (2) This clock is for VT tracking. This
free-running clock measures relative phase
shifts between the internal clock(s) and
those being fed back through a mimic path.
As a result, you can track VT effects on the
FPGA and compensate for the effects.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–17
Block Description
Table 5–2. DDR3 SDRAM Clocking Stratix IV and Stratix III Devices (Part 2 of 2)
Clock
Postscale Phase Clock Network
Clock Name (1) Counter (Degrees) Rate Type Notes
ac_clk_1x C6 Set in the Half-Rate Regional Address and command clock.
GUI
Notes to Table 5–2:
(1) In full-rate designs a _1x clock may run at full-rate clock rate.
(2) This clock should be of the same clock network clock as the resync_clk_1x clock.
The phase-shift inputs on the PLL perform the PLL reconfiguration. The PLL
reconfiguration megafunction is not required.
Reset Management
Figure 5–8 and Figure 5–9 show the main features of the reset management block for
the DDR3 SDRAM PHY. You can use the pll_ref_clk input to feed the optional
reset_request_n edge detect and reset counter module. However, this requires the
pll_ref_clk signal to use a global clock network resource.
There is a unique reset metastability protection circuit for the clock divider circuit
because the phy_clk domain reset metastability protection registers have fan-in from
the soft_reset_n input so these registers cannot be used.
reset_master_ams reset_request_n
phasestep locked
phaseupdown global_pre_clear
Another pll_ref_clk scan_clk D SET Q D SET Q
system refclk
clock Optional global_reset_n pll_reset
reset_ request_n areset CLR Q CLR Q
soft_reset_n
phy_internal_reset_n
global_or_soft_reset_n PHY resets
Reset
Pipes
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–18 Chapter 5: Functional Description—ALTMEMPHY
Block Description
Figure 5–8. ALTMEMPHY Reset Management Block for Stratix IV and Stratix III Devices
pll_locked
pll_reconfig_reset_n
reset_request_n
locked
pll_ref_clk reset_master_ams global_pre_clear
Another refclk
D SET Q D SET Q
system PLL
clock Optional global_reset_n pll_reset
areset
reset_request_n (active HIGH)
CLR Q CLR Q
soft_reset_n
phy_internal_reset_n
global_or_soft_reset_n PHY resets
Reset
Pipes
Read Datapath
This topic discusses the read datapath.
Arria II GX Devices
The read datapath logic captures data sent by the memory device and subsequently
aligns the data back to the system clock domain. The read datapath for DDR3 SDRAM
consists of the following three main blocks:
■ Data capture
■ Data resynchronization
■ Data demultiplexing and alignment
As the DQS/DQSn signal is not continuous, the PHY also has postamble protection
logic to ensure that any glitches on the DQS input signals at the end of the read
postamble time do not cause erroneous data to be captured as a result of postamble
glitches.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–19
Block Description
Figure 5–9 shows the order of the functions performed by the read datapath and the
frequency at which the read data is handled.
RAM Block
DQS
DQ[n]
D Q D Q D Q wr_data[2n] rd_data[4n]
wr_clk rd_clk
D Q D Q
FIFO
phy_clk_1x
resync_clk_2x
Data Demultiplexing
Data demultiplexing is the process of changing the SDR data into HDR data. Data
demultiplexing is required to bring the frequency of the resynchronized data down to
the frequency of the system clock, so that data from the external memory device can
ultimately be brought into the FPGA controller clock domain. Before data capture, the
data is DDR and n-bit wide. After data capture, the data is SDR and 2n-bit wide. After
data demuxing, the data is HDR of width 4n-bits wide. The system clock frequency is
half the frequency of the memory clock. Demultiplexing is achieved using a dual-port
memory with a 2n-bit wide write-port operating on the resynchronization clock (SDR)
and a 4n-bit wide read-port operating on the PHY clock (HDR). The basic principle of
operation is that data is written to the memory at the SDR rate and read from the
memory at the HDR rate while incrementing the read- and write-address pointers. As
the SDR and HDR clocks are generated, the read and write pointers are continuously
incremented by the same PLL, and the 4n-bit wide read data follows the 2n-bit wide
write data with a constant latency
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–20 Chapter 5: Functional Description—ALTMEMPHY
Block Description
Postamble Protection
A dedicated postamble register controls the gating of the shifted DQS signal that
clocks the DQ input registers at the end of a read operation. Any glitches on the DQS
input signals at the end of the read postamble time do not cause erroneous data to be
captured as a result of postamble glitches. The postamble path is also calibrated to
determine the correct clock cycle, clock phase shift, and delay chain settings.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–21
Block Description
Figure 5–10 shows the order of the functions performed by the read datapath and the
frequency at which the read data is handled.
Figure 5–10. DDR3 SDRAM Data Capture and Read Data Mapping in Stratix IV and Stratix III Devices
Data Capture, Resynchronization,
and Data Demultiplexing Read Datapath
dio_rdata3_1x
ram_rdata_1x[4n]
dio_rdata2_1x
Dual Port RAM
IOE 4n bits Data
wr_data rd_data Mapping ctl_rdata[4n]
dio_rdata1_1x Logic
mem_dq wr_clk rd_clk
dio_rdata0_1x
mem_dqs
resync_clk_1x
mem_dqsn phy_clk_1x
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–22 Chapter 5: Functional Description—ALTMEMPHY
Block Description
Postamble Protection
A dedicated postamble register controls the gating of the shifted DQS signal that
clocks the DQ input registers at the end of a read operation. This ensures that any
glitches on the DQS input signals at the end of the read postamble time do not cause
erroneous data to be captured as a result of postamble glitches.
The postamble path is also calibrated to determine the correct clock cycle, clock phase
shift, and delay chain settings. You can see the process in simulation if you choose
Full calibration (long simulation time) mode in the MegaWizard Plug-In Manager.
Write Datapath
This topic discusses the write datapath.
Arria II GX Devices
The write datapath logic efficiently transfers data from the HDR memory controller to
DDR3 SDRAM. The write datapath logic consists of:
■ DQ and DQ output-enable logic
■ DQS/DQSn and DQS/DQSn output-enable logic
■ DM logic
The memory controller interface outputs 4n-bit wide data (ctl_wdata[4n]) at
half-rate frequency. Figure 5-4 shows that the HDR write data (ctl_wdata[4n]) is
clocked by the half-rate clock phy_clk_1x (ctl_clk) and is converted into SDR,
which is represented by wdp_wdata_h and wdp_wdata_l and clocked by the
full-rate clock write_clk_2x. The DQ IOEs convert 2-n SDR bits to n-DDR bits.
OE wdp_wdata_h
Q D
ctl_mem_wdata[4n]
DQ[n]
Data
Multiplexing phy_clk_1x
wdp_wdata_l
Q D write_clk_2x
write_clk_2x
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–23
Block Description
Figure 5–12. DDR3 SDRAM Write Datapath in Stratix IV and Stratix III Devices
HDR to DDR
Conversion Data Ordering
wdp_wdata3_1x
ctl_wdata[4n]
wdp_wdata2_1x
Stratix III Data
mem_dq wdp_wdata1_1x
IOE Ordering phy_clk_1x
wdp_wdata0_1x
write_clk_2x
phy_clk_1x
[
The write datapath DDIO registers are clocked by the phy_clk_1x clock. The
write_clk_2x signal then clocks the alignment registers.
f For more information about the I/O structure, refer to the External Memory Interface
chapter in the respective device family handbook.
Figure 5–13 shows how the write data, ctl_wdata signals should be aligned from
the controller during a (half rate, normally aligned) write operation. The PHY then
issues the write data as ABCD where a is the first data to be written to the memory.
(ABCD represent two beats of data each.) The ctl_wdata_valid signal in
Figure 5–13 shows the output enable for the DQ and DM pins.
Figure 5–13. Write Data Alignment from the DDR3 SDRAM Controller
ctl_clk
00 10 11 00
ctl_dqs_burst
00 11 00
ctl_wdata_valid
ctl_wdata -- ba dc --
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–24 Chapter 5: Functional Description—ALTMEMPHY
ALTMEMPHY Signals
ALTMEMPHY Signals
This section describes the ALMEMPHY megafunction signals for DDR3 SDRAM
variants.
Table 5–3 through Table 5–5 show the signals.
1 Signals with the prefix mem_ connect the PHY with the memory device; ports with the
prefix ctl_ connect the PHY with the controller.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–25
ALTMEMPHY Signals
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–26 Chapter 5: Functional Description—ALTMEMPHY
ALTMEMPHY Signals
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–27
ALTMEMPHY Signals
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–28 Chapter 5: Functional Description—ALTMEMPHY
ALTMEMPHY Signals
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–29
ALTMEMPHY Signals
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–30 Chapter 5: Functional Description—ALTMEMPHY
ALTMEMPHY Signals
Table 5–6 shows the parameters that Table 5–3 through Table 5–5 refer to.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–31
PHY-to-Controller Interfaces
PHY-to-Controller Interfaces
The following section describes the typical modules that are connected to the
ALTMEMPHY variation and the port name prefixes each module uses. This section
also describes using a custom controller. This section describes the AFI.
The AFI standardizes and simplifies the interface between controller and PHY for all
Altera memory designs, thus allowing you to easily interchange your own controller
code with Altera's high-performance controllers. The AFI PHY includes an
administration block that configures the memory for calibration and performs
necessary mode registers accesses to configure the memory as required (these
calibration processes are different). Figure 5–14 shows an overview of the connections
between the PHY, the controller, and the memory device.
1 Altera recommends that you use the AFI for new designs.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–32 Chapter 5: Functional Description—ALTMEMPHY
PHY-to-Controller Interfaces
Altera Device
AFI PHY
local_wdata ctl_addr
ctl_cas_n
ctl_we_n
DDR3
mem_dqs SDRAM
AFI
Admin mem_dq
Controller
Sequencer
local_rdata ctl_rdata
For half-rate designs, the address and command signals in the ALTMEMPHY
megafunction are asserted for one mem_clk cycle (1T addressing), such that there are
two input bits per address and command pin in half-rate designs. If you require a
more conservative 2T addressing, drive both input bits (of the address and command
signal) identically in half-rate designs.
For DDR3 SDRAM with the AFI, the read and write control signals are on a per-DQS
group basis. The controller can calibrate and use a subset of the available DDR3
SDRAM devices. For example, the controller can calibrate and use two devices out of
a 64- or 72-bit DIMM for better debugging mechanism.
For half-rate designs, the AFI allows the controller to issue reads and writes that are
aligned to either half-cycle of the half-rate phy_clk, which means that the datapaths
can support multiple data alignments—word-unaligned and word-aligned writes and
reads. Figure 5–15 and Figure 5–16 display the half-rate write operation.
ctl_clk
00 11 01 00
ctl_dqs_burst
00
ctl_wdata_valid 10 11 01 00
ctl_wdata -- ax cb xd
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–33
PHY-to-Controller Interfaces
ctl_clk
00 10 11 00
ctl_dqs_burst
ctl_wdata_valid 00 11 00
ctl_wdata -- ba dc --
After calibration process is complete, the sequencer sends the write latency in number
of clock cycles to the controller.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–34 Chapter 5: Functional Description—ALTMEMPHY
PHY-to-Controller Interfaces
Figure 5–17 and Figure 5–18 show word-aligned writes and reads. In the following
read and write examples the data is written to and read from the same address. In
each example, ctl_rdata and ctl_wdata are aligned with controller clock
(ctl_clk) cycles. All the data in the bit vector is valid at once. For comparison, refer
Figure 5–19 and Figure 5–20 that show the word-unaligned writes and reads.
1 The ctl_doing_rd is represented as a half-rate signal when passed into the PHY.
Therefore, the lower half of this bit vector represents one memory clock cycle and the
upper half the next memory clock cycle. Figure 5–20 on page 5–39 shows separated
word-unaligned reads as an example of two ctl_doing_rd bits are different.
Therefore, for each x16 device, at least two ctl_doing_rd bits need to be driven,
and two ctl_rdata_valid bits need to be interpreted.
1 The timing analysis script does not support word-unaligned reads and
writes.
1 Word-unaligned reads and writes are only supported on Stratix III and
Stratix IV devices.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–35
PHY-to-Controller Interfaces
Figure 5–17 through Figure 5–20 assume the following general points:
■ The burst length is four. A DDR2 SDRAM is used—the interface timing is identical
for DDR3 devices.
■ An 8-bit interface with one chip select.
■ The data for one controller clock (ctl_clk) cycle represents data for two memory
clock (mem_clk) cycles (half-rate interface).
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–36 Chapter 5: Functional Description—ALTMEMPHY
PHY-to-Controller Interfaces
(1) ( 2) (4)
(3)
ctl_clk
ctl_wlat 2
ctl_ras_n 00 11
ctl_cas_n 11 00
ctl_we_n 11 00
ctl_cs_n 11 01 11 01 11
ctl_dqs_burst 00 10 11 10 11 00
ctl_wdata_valid 00 11 00 11
Memory
Interface
mem_clk
command ACT WR
(Note 5)
mem_cs_n
mem_dqs
mem_dq
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–37
PHY-to-Controller Interfaces
(1) (3)
(2) (2) (4)
ctl_clk
ctl_rlat 15
ctl_ras_n 11
ctl_cas_n 0
ctl_we_n 00 11
ctl_cs_n 11 01 11 01 11
ctl_doing_rd 00 11 00 11 00
ctl_rdata_valid 00 11 00 11 00
ctl_rdata FFFFFFFF
ctl_ba 00
ctl_dm
Memory
Interface
mem_clk
command ACT RD
mem_cs_n
mem_dqs
mem_dq
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–38 Chapter 5: Functional Description—ALTMEMPHY
PHY-to-Controller Interfaces
Figure 5–19 and Figure 5–20 show spaced word-unaligned writes and reads.
ctl_clk
ctl_wlat 2
ctl_ras_n 10
ctl_cas_n 01 00
ctl_we_n 01 00
ctl_cs_n 11 10 11 10 11
ctl_dqs_burst 00 11 01 11 01 00
ctl_wdata_valid 00 10 11 01 10 11 01 00
ctl_ba 00
Memory
Interface
mem_clk
command ACT WR
mem_cs_n
mem_dqs
mem_dq
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–39
PHY-to-Controller Interfaces
ctl_clk
ctl_rlat 15
ctl_ras_n
ctl_cas_n
ctl_we_n 00 10
ctl_cs_n 11 10 11 10 11
ctl_doing_rd 00 10 11 01 10 11 01 0
ctl_rdata_valid 00 10 11 01 10 11 01 00
ctl_ba 00
ctl_addr 0000000
ctl_dm
Memory
Interface
mem_clk
command ACT RD
mem_cs_n
mem_dqs
mem_dq
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–40 Chapter 5: Functional Description—ALTMEMPHY
Using a Custom Controller
Preliminary Steps
Perform the following steps to generate the ALTMEMPHY megafunction:
1. If you are creating a custom DDR3 SDRAM controller, generate the Altera
high-performance controller targeting your chosen Altera and memory devices.
2. Compile and verify the timing. This step is optional; refer to “Compiling and
Simulating” on page 4–1.
3. If targeting a DDR3 SDRAM device, simulate the high-performance controller
design so you can determine how to drive the PHY signals using your own
controller.
4. Integrate the top-level ALTMEMPHY design with your controller. If you started
with the high-performance controller, the PHY variation name is
<controller_name>_phy.v/.vhd. Details about integrating your controller with
Altera’s ALTMEMPHY megafunction are described in the following sections.
5. Compile and simulate the whole interface to ensure that you are driving the PHY
properly and that your commands are recognized by the memory device.
Design Considerations
This section discuss the important considerations for implementing your own
controller with the ALTMEMPHY megafunction. This section describes the design
considerations for AFI variants.
1 Simulating the high-performance controller is useful if you do not know how to drive
the PHY signals.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–41
Using a Custom Controller
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–42 Chapter 5: Functional Description—ALTMEMPHY
Using a Custom Controller
1 2 3 4 5 6 7 8 9
ctl_clk
ctl_addr
ctl_cs_n
ctl_doing_read
mem_dqs
mem_dq
ctl_rdata_valid
ctl_rdata
ctl_cs_n 10
ctl_doing_read 10 01
mem_dqs
mem_dq
ctl_rdata_valid 10 01
ctl_rdata DX XD
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 5: Functional Description—ALTMEMPHY 5–43
Using a Custom Controller
Figure 5–23. Timing for ctl_dqs_burst, ctl_wdata_valid, Address, and Command—Half-Rate Design
ctl_wlat = 2
1 2
ctl_clk
ctl_addr AdAd
ctl_cs_n 01
ctl_dqs_burst 10 11
ctl_wdata_valid
ctl_wdata
For a half-rate design ctl_cs_n is 2 bits, not 1. Also the ctl_dqs_burst and
ctl_wdata_valid waveforms indicate a half-rate design. This write results in a
burst of 8 at the DDR. Where ctl_cs_n is driven 2'b01, the LSB (1) is the first value
driven out of mem_cs_n, and the MSB (0) follows on the next mem_clk. Similarly, for
ctl_dqs_burst, the LSB is driven out of mem_dqs first (0), then a 1 follows on the
next clock cycle. This sequence produces the continuous DQS pulse as required.
Finally, the ctl_addr bus is twice MEM_IF_ADDR_WIDTH bits wide and so the
address is concatenated to result in an address phase two mem_clk cycles wide.
Partial Writes
As part of the DDR3 SDRAM memory specifications, you have the option for partial
write operations by asserting the DM pins for part of the write signal.
For designs targeting the Arria II and Stratix III devices, deassert the
ctl_wdata_valid signal during partial writes, when the write data is invalid, to
save power by not driving the DQ outputs.
For designs targeting other devices, use only the DM pins if you require partial writes.
Assert the ctl_dqs_burst and ctl_wdata_valid signals as for full write
operations, so that the DQ and DQS pins are driven during partial writes.
The I/O difference between Stratix III devices and other devices, and the preamble
difference for DDR3 SDRAM on Arria II GX devices make it only possible to use the
ctl_dqs_burst signal for the DQS enable in Stratix III devices.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
5–44 Chapter 5: Functional Description—ALTMEMPHY
Using a Custom Controller
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
6. Functional Description—
High-Performance Controller
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–2 Chapter 6: Functional Description—High-Performance Controller
Block Description
Block Description
Figure 6–1 on page 6–2 shows the top-level block diagram of the DDR3 SDRAM HPC.
Figure 6–2 shows a block diagram of the DDR3 SDRAM HPC architecture.
Timer
Logic
Initialization
State Machine
Address and
Command
Command
FIFO
Decode
Bank
Write Data
Management
Tracking Logic
Logic
The blocks in Figure 6–2 on page 6–2 are described in the following sections.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–3
Block Description
Timer Logic
The timer logic tracks whether the required minimum number of clock cycles has
passed since the last relevant command was issued. For example, the timer logic
records how many cycles have elapsed since the last activate command so that the
state machine knows it is safe to issue a read or write command (tRCD). The timer logic
also counts the number of clock cycles since the last periodic refresh command and
sends a high priority alert to the state machine if the number of clock cycles has
expired.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–4 Chapter 6: Functional Description—High-Performance Controller
Block Description
1 HPC supports only precharge power-down mode and not active power-down mode.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–5
Block Description
Control Logic
Bus commands control SDRAM devices using combinations of the mem_ras_n,
mem_cas_n, and mem_we_n signals. For example, on a clock cycle where all three
signals are high, the associated command is a no operation (NOP). A NOP command
is also indicated when the chip select signal is not asserted. Table 6–2 shows the
standard SDRAM bus commands.
The DDR3 SDRAM HPC must open SDRAM banks before it accesses the addresses in
that bank. The row and bank to be opened are registered at the same time as the active
(ACT) command. The DDR3 SDRAM HPC closes the bank and opens it again if it
needs to access a different row. The precharge (PCH) command closes only a bank.
The primary commands used to access SDRAM are read (RD) and write (WR). When
the WR command is issued, the initial column address and data word is registered.
When a RD command is issued, the initial address is registered. The initial data
appears on the data bus 5 to 11 clock cycles later. This delay is the column address
strobe (CAS) latency and is due to the time required to read the internal DRAM core
and register the data on the bus. The CAS latency (of 6) depends on the speed of the
SDRAM and the frequency of the memory clock. In general, the faster the clock, the
more cycles of CAS latency are required. After the initial RD or WR command,
sequential reads and writes continue until the burst length is reached. DDR3 SDRAM
devices support fixed burst lengths of 4 or 8 data cycles or an on-the-fly mode where
the controller can request a burst of 4 or 8 for each read or write command. This
on-the-fly mode is the only mode supported. The auto-refresh command (ARF) is
issued periodically to ensure data retention. This function is performed by the DDR3
SDRAM HPC.
The load mode register command (LMR) configures the SDRAM mode register. This
register stores the CAS latency, burst length, and burst type.
f For more information, refer to the specification of the SDRAM that you are using.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–6 Chapter 6: Functional Description—High-Performance Controller
Block Description
■ Latency:
■ Maximum of 1 or 2 clock delay during writes
■ Minimum 1 or 3 clock delay during reads
■ Detects and corrects all single-bit errors. Also the ECC logic sends an interrupt
when the user-defined threshold for a single-bit error is reached.
■ Detects all double-bit errors. Also, the ECC logic counts the number of double-bit
errors and sends an interrupt when the user-define threshold for double-bit error
is reached.
■ Accepts partial writes
■ Creates forced errors to check the functioning of the ECC logic
■ Powers up to a ready state
Figure 6–3 shows the ECC block diagram.
ECC
Write Write
Message Codeword
From Local N x 64 Bits N x 72 Bits
Interface Encoder
N x 72 Bits DDR or DDR2
Read Read Memory
Message Codeword Controller SDRAM
To Local N x 64 Bits N x 72 Bits
Decoder-
Interface Corrector
32 Bits
To and From ECC
Local Interface Controller
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–7
Block Description
■ Configuration registers:
■ Single-bit error detection counter threshold
■ Double-bit error detection counter threshold
■ Capture status for first encountered error or most recent error
■ Enable deliberate corruption of ECC for test purposes
■ Status registers:
■ Error address
■ Error type: single-bit error or double-bit error
■ Respective byte error ECC syndrome
■ Error signal—an error signal corresponding to the data word is provided with
the data and goes high if a double-bit error that cannot be corrected occurs in
the return data word.
■ Counters:
■ Detected and/or corrected single-bit errors
■ Detected double-bit errors
The ECC logic can instantiate multiple encoders, each running in parallel, to encode
any width of data words assuming they are integer multiples of 64.
The ECC logic operates between the local (native or Avalon-MM interface) and the
memory controller.
The ECC logic has an N × 64-bit (where N is an integer) wide interface, between the
local interface and the ECC logic, for receiving and returning data from the local
interface. This interface can be a native interface or an Avalon-MM slave interface,
you select the type of interface in the MegaWizard interface.
The ECC logic has a second interface between the local interface and the ECC, which
is a 32-bit wide Avalon-MM slave to control and report the status of the operation of
the ECC controller.
The encoded data from the ECC logic is sent to the memory controller using a N ×
72-bit wide Avalon-MM master interface, which is between the ECC logic and the
memory controller.
When testing the DDR3 SDRAM HPC, you can turn off the ECC.
Interrupts
The ECC logic issues an interrupt signal when one of the following scenarios occurs:
■ The single-bit error counter reaches the set maximum single-bit error threshold
value.
■ The double-bit error counter reaches the set maximum double-bit error threshold
value.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–8 Chapter 6: Functional Description—High-Performance Controller
Block Description
The error counters increment every time the respective event occurs for all N parts of
the return data word. This incremented value is compared with the maximum
threshold and an interrupt signal is sent when the value is equal to the maximum
threshold. The ECC logic clears the interrupts when you write a 1 to the respective
status register. You can mask the interrupts from either of the counters using the
control word.
Partial Writes
The ECC logic supports partial writes. Along with the address, data, and burst
signals, the Avalon-MM interface also supports a signal vector that is responsible for
byte-enable. Every bit of this signal vector represents a byte on the data-bus. Thus, a 0
on any of these bits is a signal for the controller not to write to that particular
location—a partial write.
For partial writes, the ECC logic performs the following steps:
1. The ECC logic stalls further read or write commands from the Avalon-MM
interface when it receives a partial write condition.
2. It simultaneously sends a self-generated read command, for the partial write
address, to the memory controller.
3. Upon receiving the returned read data from the memory controller for the
particular address, the decoder decodes the data, checks for errors, and then sends
it to the ECC logic.
4. The ECC logic merges the corrected or correct dataword with the incoming
information.
5. The ECC logic sends the updated dataword to the encoder for encoding, and then
sends updated dataword to the memory controller with a write command.
6. The ECC logic stops stalling the commands from the Avalon-MM interface so that
the logic can receive new commands.
The following corner cases can occur:
■ A single-bit error during the read phase of the read-modify-write process. In this
case, the single-bit error is corrected first, the single-bit error counter is
incremented and then a partial write is performed to this corrected decoded data
word.
■ A double-bit error during the read phase of the read-modify-write process. In this
case, the double-bit error counter is incremented and an interrupt is sent through
the Avalon-MM interface. The new write word is written to the memory location.
A separate field in the interrupt status register highlights this condition.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–9
Block Description
Figure 6–4 shows the partial write operation for HPC. The half-rate DDR3 SDRAM
HPC supports a local size of 1 and 2.
local_address 0 1
local_size 2
local_be X1 XF
mem_dm
mem_dq 67 R R R EF CD AB 89
Partial Bursts
DIMMs that do not have the DM pins do not support partial bursts. A minimum of
eight words must be written to the memory at the same time.
Figure 6–5 shows the partial burst operation for HPC.
local_address 0
local_size 1
local_be X1
local_wdata 01234567
mem_dm
mem_dq 67 45 23 01
ECC Latency
Using the ECC results in the following latency changes:
■ Local Burst Length 1
■ Local Burst Length 2
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–10 Chapter 6: Functional Description—High-Performance Controller
Block Description
ECC Registers
Table 6–4 shows the ECC registers.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–11
Block Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–12 Chapter 6: Functional Description—High-Performance Controller
Block Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–13
Block Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–14 Chapter 6: Functional Description—High-Performance Controller
Example Top-Level File
Testbench
Example Design
pnf Wizard-
Example Driver DDR3 SDRAM Controller
Generated
test_complete
Memory Model
ALTMEMPHY
Control DLL
Logic
clock_source PLL
Table 6–10 describes the files that are associated with the example top-level file and
the testbench.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–15
Example Top-Level File
Example Driver
The example driver is a self-checking test pattern generator for the memory interface.
It uses a state machine to write and read from the memory to verify that the interface
is operating correctly.
It performs the following tests and loops back the tests indefinitely:
■ Sequential addressing writes and reads
The state machine writes pseudo-random data generated by a linear feedback shift
register (LFSR) to a set of incrementing row, bank, and column addresses. The
state machine then resets the LFSR, reads back the same set of addresses, and
compares the data it receives against the expected data. You can adjust the length
and pattern of the bursts that are written by changing the MAX_ROW, MAX_BANK,
and MAX_COL constants in the example driver source code, and the entire memory
space can be tested by adjusting these values. You can skip this test by setting the
test_seq_addr_on signal to logic zero.
■ Incomplete write operation
The state machine issues a series of write requests that are less than the maximum
burst size supported by your controller variation. The addresses are then read
back to ensure that the controller has issued the correct signals to the memory. This
test is only applicable when the local burst size is two. You can skip this test by
setting the test_incomplete_writes_on signal to logic zero.
■ Byte enable/data mask pin operation
The state machine issues two sets of write commands, the first of which clears a
range of addresses. The second set of write commands has only one byte enable bit
asserted. The state machine then issues a read request to the same addresses and
the data is verified. This test checks if the data mask pins are operating correctly.
You can skip this test by setting the test_dm_pin_on signal to logic zero.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–16 Chapter 6: Functional Description—High-Performance Controller
Top-level Signals Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–17
Top-level Signals Description
Table 6–13 on page 6–17 shows the DDR3 SDRAM HPC local interface signals.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–18 Chapter 6: Functional Description—High-Performance Controller
Top-level Signals Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–19
Top-level Signals Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–20 Chapter 6: Functional Description—High-Performance Controller
Top-level Signals Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 6: Functional Description—High-Performance Controller 6–21
Top-level Signals Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
6–22 Chapter 6: Functional Description—High-Performance Controller
Top-level Signals Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
7. Functional Description—
High-Performance Controller II
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–2 Chapter 7: Functional Description—High-Performance Controller II
Block Description
■ The side-band signals differ slightly for HPC II. If you use these signals, you need
to perform the following steps.
■ local_refresh_req
You need to drive an additional active high signal, local_refresh_chip, to
control which chip to issue the user-refresh to.
■ local_powerdn_req
The user-manual power signal is no longer supported in HPC II. Instead, you
can select auto power-down on the Controller Settings tab in the MegaWizard
Plug-In Manager, and specify the desired time-out (n cyles) after which the
controller automatically powers down the memory.
■ Because HPC II only supports a specific memory burst length, you must update
the memory burst length to match the controller settings. For DDR3, HPC II
supports on-the-fly burst length in half-rate mode.
■ Because HPC II supports arbitrary user burst length ranging from of 1 to 64, you
can adjust the max_local_size value in HPC II. Adjusting the maximum local
size value changes the width of the local_size signal. The maximum
local_size signal value is 2n–1, where n is the width of the local_size signal.
HPC has a fixed local_size signal width of 2.
1 You only can migrate your HPC designs to HPC II if you are using an Avalon-MM
interface.
Block Description
Figure 7–1 shows the top-level block diagram of the DDR3 SDRAM HPC II.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–3
Block Description
Figure 7–2 shows a block diagram of the DDR3 SDRAM HPC II architecture.
Address and
Command
Bank Decode
Management
Logic
Command Command-Issuing
Queue State Machine Write Data
Timing Logic
Timer
Logic
ODT
Generation
Avalon-MM Data Slave Interface
Logic
Half-Rate Bridge
AFI
ECC-enabled
Write Data Write Data
Write
FIFO Datapath
ECC
Encoder
ECC-enabled
Read Data Read
Datapath
ECC
Decoder and
Correction
Avalon-MM CSR
Slave Interface
The blocks in Figure 7–2 on page 7–3 are described in the following sections.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–4 Chapter 7: Functional Description—High-Performance Controller II
Block Description
Command Queue
The command queue allows the controller to buffer up to eight consecutive reads or
writes. The command queue presents the next 4, 6, or 8 accesses to the internal logic
for the look-ahead bank management. The bank management is more efficient if the
look-ahead is deeper, but a deeper queue consumes more resources, and may cause
maximum frequency degradation.
In addition to storing incoming commands, the command queue also maps the local
address to memory address based on the address mapping option selected. By
default, the command queue leverages the bank interleaving scheme, where the
address increment goes to the next bank instead of the next row to increase chances of
page hit.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–5
Block Description
Timer Logic
The timer logic models the internal behavior of each bank in the memory interface
and provides status output signals to the state machine. The state machine then
decides whether to issue the look-ahead bank management command based on the
timer status signals.
1 A longer memory burst length, in this case 8 beats, increases the command bandwidth
by allowing more data cycles for the same amount of command cycles. A longer
memory burst length also provides more command cycles that ensures a more
effective look-ahead bank management. However, longer memory burst lengths are
less efficient if the bursts you issue do not provide enough data to fill the burst.
This state machine accepts any local burst count of 1 to 64. The built-in burst adapter
in this state machine maps the local burst count to the most efficient memory burst.
The state machine also supports reads and writes that start on non-aligned memory
burst boundary addresses. For effective command bus bandwidth, this state machine
supports additive latency which issues reads and writes immediately after the ACT
command. This state machine accepts additive latency values greater or equal to tRCD
– 1, in clock cycle unit (tCK).
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–6 Chapter 7: Functional Description—High-Performance Controller II
Block Description
■ afi_wdata_valid
■ afi_wdata
■ afi_dm
During read, the afi_doing_read signal generates the afi_rdata_valid signal
and controls the ALTMEMPHY postamble circuit.
User-Refresh Commands
The user-refresh command enables the request to place the memory into refresh
mode. The user-refresh control takes precedence over a read or write request. You can
issue up to nine consecutive refresh commands to the selected memory chips.
However, if you enable the multi-cast write feature, the user refresh commands are
always issued to all chips.
Multi-Cast Write
The multi-cast write request signal allows you to ask the controller to send the current
write requests to all the chip selects. This means that the write data is written to all the
ranks in the system. The multi-cast write feature is useful for tRC mitigation where you
can cycle through chips to continuously read data without hitting tRC. The multi-cast
write is not supported for registered DIMM interfaces or when the ECC logic is
enabled.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–7
Block Description
1 HPC II supports only precharge power-down mode and not active power-down
mode.
1 The CSR interface is not fully supported for DDR3 SDRAM with leveling interfaces,
such as DIMMs.
f Refer to Table 7–9 through Table 7–23 in page 7–18 for detailed information about the
register maps.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–8 Chapter 7: Functional Description—High-Performance Controller II
Block Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–9
Block Description
Partial Writes
The ECC logic supports partial writes. Along with the address, data, and burst
signals, the Avalon-MM interface also supports a signal vector, local_be, that is
responsible for byte-enable. Every bit of this signal vector represents a byte on the
data-bus. Thus, a logic low on any of these bits instructs the controller not to write to
that particular byte, resulting in a partial write. The ECC code is calculated on all
bytes of the data-bus. If any bytes are changed, the ECC code must be recalculated
and the new code must be written back to the memory.
For partial writes, the ECC logic performs the following steps:
1. The ECC logic sends a read command to the partial write address.
2. Upon receiving a return data from the memory for the particular address, the ECC
logic decodes the data, checks for errors, and then merges the corrected or correct
dataword with the incoming information.
3. The ECC logic issues a write to write back the updated data and the new ECC
code.
The following corner cases can occur:
■ A single-bit error during the read phase of the read-modify-write process. In this
case, the single-bit error is corrected first, the single-bit error counter is
incremented and then a partial write is performed to this corrected decoded data
word.
■ A double-bit error during the read phase of the read-modify-write process. In this
case, the double-bit error counter is incremented and an interrupt is issued. A new
write word is written to the location of the error. The ECC status register keeps
track of the error information.
Figure 7–3 shows the partial write operation for HPC II.
local_address 0 1
local_size 2
local_be X1 XF
mem_dm
mem_dq 67 R R R EF CD AB 89
Partial Bursts
DIMMs that do not have the DM pins do not support partial bursts. You must write a
minimum of eight words to the memory at the same time.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–10 Chapter 7: Functional Description—High-Performance Controller II
Example Top-Level File
Figure 7–4 shows the partial burst operation for HPC II.
local_address 0
local_size 1
local_be X1
local_wdata 01234567
mem_dm
mem_dq 67 45 23 01
Testbench
Example Design
pnf Wizard-
Example Driver DDR SDRAM Controller
Generated
test_complete
Memory Model
ALTMEMPHY
Control DLL
Logic
clock_source PLL
Table 7–2 describes the files that are associated with the example top-level file and the
testbench.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–11
Example Top-Level File
Example Driver
The example driver is a self-checking test pattern generator for the memory interface.
It uses a state machine to write and read from the memory to verify that the interface
is operating correctly.
The example driver performs the following tests and loops back the tests indefinitely:
■ Sequential addressing writes and reads
The state machine writes pseudo-random data generated by a linear feedback shift
register (LFSR) to a set of incrementing row, bank, and column addresses. The
state machine then resets the LFSR, reads back the same set of addresses, and
compares the data it receives against the expected data. You can adjust the length
and pattern of the bursts that are written by changing the MAX_ROW, MAX_BANK,
and MAX_COL constants in the example driver source code, and the entire memory
space can be tested by adjusting these values. You can skip this test by setting the
test_seq_addr_on signal to logic zero.
■ Incomplete write operation
The state machine issues a series of write requests that are less than the maximum
burst size supported by your controller variation. The addresses are then read
back to ensure that the controller has issued the correct signals to the memory. This
test is only applicable in full-rate mode, when the local burst size is two. You can
skip this test by setting the test_incomplete_writes_on signal to logic zero.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–12 Chapter 7: Functional Description—High-Performance Controller II
Example Top-Level File
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–13
Top-level Signals Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–14 Chapter 7: Functional Description—High-Performance Controller II
Top-level Signals Description
Table 7–5 shows the DD3 SDRAM HPC II local interface signals.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–15
Top-level Signals Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–16 Chapter 7: Functional Description—High-Performance Controller II
Top-level Signals Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–17
Top-level Signals Description
Table 7–6 shows the DDR3 SDRAM HPC II CSR interface signals.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–18 Chapter 7: Functional Description—High-Performance Controller II
Register Maps Description
Table 7–8 shows the ALTMEMPHY Debug interface signals, which are located in
<variation_name>_phy.v/vhd file.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–19
Register Maps Description
1 DDR3 SDRAM with leveling does not support the ALTMEMPHY register map. For
more information about DDR3 SDRAM with leveling, refer to “DDR3 SDRAM With
Leveling” on page 5–7.
18 RTT 0 RW
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–20 Chapter 7: Functional Description—High-Performance Controller II
Register Maps Description
26 DQS# 0 RW
27 TDQS/RDQS 0 RW
28 QOFF 0 RW
31:29 Reserved 0 — Reserved for future use.
Table 7–12. Address 0x100 ALTMEMPHY Status and Control Register (Part 1 of 2)
Bit Name Default Access Description
0 CAL_SUCCESS — RO This bit reports the value of the ALTMEMPHY
ctl_cal_success output. Writing to this bit
has no effect.
1 CAL_FAIL — RO This bit reports the value of the ALTMEMPHY
ctl_cal_fail output. Writing to this bit has no
effect.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–21
Register Maps Description
Table 7–12. Address 0x100 ALTMEMPHY Status and Control Register (Part 2 of 2)
Bit Name Default Access Description
2 CAL_REQ 0 RW Writing a 1 to this bit asserts the ctl_cal_req
signal to the ALTMEMPHY megafunction. Writing a
0 to this bit deaaserts the signal, and the
ALTMEMPHY megafunction will then initiate its
calibration sequence.
Table 7–13. Address 0x110 Controller Status and Configuration Register (Part 1 of 2)
Bit Name Default Access Description
15:0 AUTO_PD_CYCLES 0x0 RW The number of idle clock cycles after which the
controller should place the memory into
power-down mode. The controller is considered
to be idle if there are no commands in the
command queue. Setting this register to 0
disables the auto power-down mode. The default
value of this register depends on the values set
during the generation of the design.
16 AUTO_PD_ACK 1 RO This bit indicates that the memory is in
power-down state.
17 SELF_RFSH 0 RW Setting this bit, or asserting the
local_self_rfsh signal, causes the
memory to go into self-refresh state.
18 SELF_RFSH-ACK 0 RO This bit indicates that the memory is in
self-refresh state.
19 Reserved 0 — Reserved for future use.
21:20 ADDR_ORDER 00 RW 00 - Chip, row, bank, column.
01 - Chip, bank, row, column.
10 - Reserved for future use.
11 - Reserved for future use.
22 REGDIMM 0 RW Setting this bit to 1 enables REGDIMM support
in controller.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–22 Chapter 7: Functional Description—High-Performance Controller II
Register Maps Description
Table 7–13. Address 0x110 Controller Status and Configuration Register (Part 2 of 2)
Bit Name Default Access Description
24:23 CTRL_DRATE 00 RO These bits represent controller date rate:
00 - Full rate.
01 - Half rate.
10 - Reserved for future use.
11 - Reserved for future use.
30:24 Reserved 0 — Reserved for future use.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–23
Register Maps Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–24 Chapter 7: Functional Description—High-Performance Controller II
Register Maps Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 7: Functional Description—High-Performance Controller II 7–25
Register Maps Description
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
7–26 Chapter 7: Functional Description—High-Performance Controller II
Register Maps Description
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
8. Latency
Latency is defined using the local (user) side frequency and absolute time (ns). There
are two types of latencies that exists while designing with memory controllers—read
and write latencies, which have the following definitions:
■ Read latency—the amount of time it takes for the read data to appear at the local
interface after initiating the read request.
■ Write latency—the amount of time it takes for the write data to appear at the
memory interface after initiating the write request.
1 For a half-rate controller, the local side frequency is half of the memory interface
frequency.
Altera defines read and write latencies in terms of the local interface clock frequency
and by the absolute time for the memory controllers. These latencies apply to
supported device families with the half-rate DDR3 high-performance controllers
(HPC and HPC II).
The latency defined in this section uses the following assumptions:
■ The row is already open, there is no extra bank management needed.
■ The controller is idle, there is no queued transaction pending, indicated by the
local_ready signal asserted high.
■ No refresh cycles occur before the transaction.
The latency for the high-performance controller comprises many different stages of
the memory interface.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
8–2 Chapter 8: Latency
Figure 8–1 shows a typical memory interface read latency path showing read latency
from the time a local_read_req assertion is detected by the controller up to data
available to be read from the dual-port RAM (DPRAM) module.
PHY Latency T3
local_read_req
High- Latency T2 (includes CAS
Performance latency)
local_addr Address/Command Generation
Controller mem_cs_n
Core I/O
Latency T1
Latency T4
Read Datapath
mem_clk [ ]
Resynchronization Shifted
Shifted mem_clk_n [ ]
Clock DQS
DQS Clk
Clock
Table 8–1 shows the different stages that make up the whole read and write latency
that Figure 8–1 shows.
From Figure 8–1, the read latency in the high-performance controllers is made up of
four components:
read latency = controller latency (T1) + command output latency (T2) +
CAS latency (T3) + PHY read data input latency (T4)
Similarly, the write latency in the high-performance controllers is made up of three
components:
write latency = controller latency (T1) + write data latency (T2+T3)
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 8: Latency 8–3
You can separate the controller and ALTMEMPHY read data input latency into
latency that occurred in the I/O element (IOE) and latency that occurred in the FPGA
fabric.
Table 8–2 shows the read and write latency derived from the write and read latency
definitions for half rate controller for Stratix III and Stratix IV devices.
1 The exact latency depends on your precise configuration. You should obtain precise
latency from simulation, but this figure may vary in hardware because of the
automatic calibration process.
f To see the latency incurred in the IOE for both read and write paths for ALTMEMPHY
variations in Stratix IV and Stratix III devices refer to the IOE figures in the External
Memory Interfaces in Stratix III Devices chapter of the Stratix III Device Handbook and the
External Memory Interfaces in Stratix IV Devices chapter of the Stratix IV Device
Handbook.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
8–4 Chapter 8: Latency
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
9. Timing Diagrams
This chapter details the timing diagrams for the DDR3 SDRAM high-performance
controllers (HPC) and high-performance controllers II (HPC II).
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–2 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers
Auto-Precharge
The auto-precharge read and auto-precharge write commands allow you to indicate
to the memory device that this read or write command is the last access to the
currently open row. The memory device automatically closes (auto-precharges) the
page it is currently accessing so that the next access to the same bank is quicker. This
command is particularly useful for applications that require fast random accesses.
phy_clk
Local Interface
local_autopch_req
local_ready
local_write_req
local_read_req
local_row_addr[13:0] 0002 0003
local_col_addr[9:0] 004 008 00C 010 000 004 008 00C 010 000
local_bank_addr[2:0]
mem_local_addr[24:0] 0C00100 0C00200
mem_addr[13:0] 0003 0000 0004 0008 000C 0410 0000 0004 0008 000C 0410
mem_clk
mem_clk_n
mem_cs_n
mem_dq[7:0] 00 00
mem_dqs
mem_dqsn
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 9: Timing Diagrams 9–3
DDR3 High-Performance Controllers
User Refresh
Figure 9–2 shows the user refresh control interface. This feature allows you to control
when the controller issues refreshes to the memory. This feature allows better control
of worst case latency and allows refreshes to be issued in bursts to take advantage of
idle periods.
global_reset_n
phy_clk
Local Interface
mem_local_refresh_req
local_init_done
local_refresh_ack
local_refresh_req
local_refresh_ack
local_ready
Controller - AFI
ddr_a[13:0]
ddr_ba[2:0]
ddr_cs_n
ddr_cke_h
ddr_cke_l
ddr_ras_n
ddr_cas_n
ddr_we_n
[3]
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
Half-Rate Read for Avalon Interface
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–4
Figure 9–3. Half-Rate Read Operation for HPC Using Avalon-MM Interface
[1] [2] [7]
phy_clk
Local Interface
local_read_req
local_write_req
local_row_addr[13:0] 0000 0002
local_col_addr[9:0] 000 000 008 010 000 008
local_bank_addr[2:0] 0
mem_local_addr[24:0] 0000000 0000200
0000202 0000204 0000300 0000302
local_size[1:0]
local_burstbegin
local_rdata[31:0] 0578FF82 0AF0E319 14FDDB32 28E7AB64 50D34BC8 A0BB968D
local_rdata_valid
local_read_req
local_ready
Controller - AFI
ddr_a[13:0] 0004 0000 0000 1010 0000 0001 0000 1000 0000 1008 0000 1010
ddr_ba[2:0] 0 7 0
ddr_cs_n
ctl_addr[27:0] 0010004 0000000 0000000 4041010 0000000 0004001 4001000 0000000 4021008 0000000 4041010
ctl_ba[5:0] 00 3F 00
ctl_cke[1:0]
ctl_cs_n[1:0] 3 1 3 3 1 3 1 3 1 3 1 3 1 3 1
ctl_rdata[31:0] 0578FF82 0AF0E319 14FDDB32 28E7AB64 50D34BC8 A0BB968D
ctl_rdata_valid[1:0] 3
ctl_doing_rd[1:0] 3 0 3
ctl_dqs_burst[1:0] 2
ctl_rlat[4:0]
ctl_command[5:0] 3F 0C 3F 3F 0F 3F 30 3F 33 3F 0F 3F 0F 3F 0F
Memory Interface
mem_command[2:0] NOP RD NOP RD NOP PCH NOP ACT NOP RD NOP NOP
mem_dq[7:0] 00 82 FF 78 05 19 E3 F0 0A 32 DB FD 14 64 AB E7 28 C8 4B D3 50 8D 96 BB A0 00
mem_dqs
mem_dqsn
mem_addr[13:0]
mem_cke
mem_clk
[3]
[4] [5] [6]
Chapter 9: Timing Diagrams 9–5
DDR3 High-Performance Controllers
The following sequence corresponds with the numbered items in Figure 9–3:
1. The local read request signal is asserted.
2. The controller accepts the request, the local_ready signal is asserted.
3. The controller asserts the ctl_doing_rd to tell the PHY how many clock cycles
of read data to expect.
4. The read command (RD) on the command bus.
5. The mem_dqs signal has the read data from the controller.
6. These are the data to the controller with the valid signal.
7. The controller returns the valid read data to the user logic by asserting the
local_rdata_valid signal when there is valid local read data.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
Half-Rate Write for Avalon Interface
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–6
Figure 9–4. Half-Rate Write Operation for HPC Using Avalon Interface
[1] [2] [3]
phy_clk
Local Interface
local_write_req
local_read_req
local_row_addr[13:0]
local_col_addr[9:0] 000 004 008
local_bank_addr[2:0]
mem_local_addr[24:0] 0000100 0000101 0000102
local_size[1:0]
local_be[3:0]
local_wdata[31:0] 0578FF82 5D6B3107 BAD6620E 69B1C41C
local_write_req
local_ready
Controller - AFI
ddr_a[13:0] 0000 0008 0000 000C 0000
ddr_ba[2:0]
ddr_cs_n
ctl_addr[27:0] 0000000 0020008 0000000 003000C 0000000
ctl_ba[5:0]
ctl_cke[1:0]
ctl_cs_n[1:0] 3 1 3 1 3
ctl_odt[1:0]
ctl_wdata[31:0] 0578FF82 0AF0E319
ctl_wdata_valid[1:0] 3 0 3 0
ctl_wlat[4:0]
ctl_dm[3:0]
ctl_dqs_burst[1:0] 2 3 2 3 2
ctl_command[5:0] 3F 03 3F 03 3F
Memory Interface
mem_command[2:0] WR NOP WR NOP WR
mem_dq[7:0] 82 FF 78 05
mem_dqs
mem_dqsn
mem_ba[2:0]
mem_cke
The following sequence corresponds with the numbered items in Figure 9–4:
1. The user logic requests write by asserting the local_write_req signal.
2. The local_ready signal is asserted, indicating that the controller has accepted
the request.
3. The data written to the memory for the write command.
4. The write (WR) command on the command bus.
5. The valid write data on the ctl_wdata signal.
6. The valid data on the mem_dq signal goes to the controller.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
Half Rate Write for Native Interface
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–8
Figure 9–5. Half-Rate Write Operation for HPC Using Native Interface
[1] [2] [3] [4]
phy_clk
Local Interface
local_wdata_req
local_write_req
local_read_req
local_row_addr[13:0] 0000 0001 0010 0020
local_col_addr[9:0] 000 008 080 100
local_bank_addr[2:0] 0 1 5 6
mem_local_addr[24:0] 0000000 0400102 1401020 1802040
local_size[1:0]
local_be[3:0]
local_wdata[31:0] 230F7B57 461EF6AE 5D6B3107 BAD6620E 69B1C41C
local_write_req
local_ready
Controller - AFI
ddr_a[13:0] 0000 0001 0000 1008
ddr_ba[2:0] 1 0 1
ddr_cs_n
ctl_addr[27:0] 0000000 0004001 0000000 4021008
ctl_ba[5:0] 09 00 09
ctl_cke[1:0]
ctl_cs_n[1:0] 3 1 3 1
ctl_odt[1:0]
ctl_wdata[31:0] 230F7B57 461EF6AE
ctl_wdata_valid[1:0] 3 0
ctl_wlat[4:0]
ctl_dm[3:0]
ctl_dqs_burst[1:0] 2 3 0
ctl_command[5:0] 3F 3C 3F 03
Memory Interface
mem_command[2:0] NOP WR NOP ACT
mem_dq[7:0] 57 7B 0F 23 AE F6 1E 46
mem_dqs
The following sequence corresponds with the numbered items in Figure 9–5:
1. The user logic requests write by asserting the local_write_req signal.
2. The local_ready signal is asserted, indicating that the controller has accepted
the request.
3. The data written to the memory for the write command.
4. The controller requests the user logic for the write data and byte-enables for the
write by asserting the local_wdata_req signal.
5. The write (WR) command on the command bus.
6. The valid write data on the ctl_wdata signal.
7. The valid data on the mem_dq signal goes to the controller.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
Initialization Timing
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–10
Figure 9–6. Initialization Timing for HPC
[1] [2] [3] [3]
global_reset_n
pll_locked
phs_shft_busy
seq_pll_select[3:0]
seq_pll_start_reconfig
seq_pll_inc_dec_n
seq_ac_ras_n[1:0] 3
seq_ac_cas_n[1:0] 3
seq_ac_we_n[1:0] 3
memory_0_0.ck
memory_0_0.ck_n
memory_0_0.cke
memory_0_0.cs_n
memory_0_0.addr[13:0]
memory_0_0.ras_n
memory_0_0.cas_n
memory_0_0.we_n
memory_0_0.odt
memory_0_0.ba[2]
memory_0_0.ba[1]
memory_0_0.ba[0]
memory_0_0.rst_n
memory_0_0.dq[7:0]
memory_0_0.dqs
memory_0_0.dqs_n
memory_0_0.dm_tdqs
memory_0_1.ck
memory_0_1.ck_n
memory_0_1.cke
memory_0_1.cs_n
memory_0_1.addr[13:0]
memory_0_1.ras_n
memory_0_1.cas_n
memory_0_1.we_n
memory_0_1.odt
memory_0_1.rst_n
memory_0_1.ba[1:0]
memory_0_1.ba[0]
memory_0_1.dq[7:0]
memory_0_1.dm_tdqs
The following sequence corresponds with the numbered items in Figure 9–6:
1. The PHY initialization stage; wait for PLL to unlock.
2. The DRAM initialization stage; reset sequence.
3. Various SDRAM bus commands during the initialization sequence.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
Calibration Timing
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–12
Figure 9–7. Calibration Timing for HPC
[1] [4] [6] [7] [8] [9] [10] [11]
global_reset_n
pll_locked
phs_shft_busy
seq_pll_select[3:0]
seq_pll_start_reconfig
seq_pll_inc_dec_n
state[1:0]
seq_ac_ras_n[1:0]
seq_ac_cas_n[1:0]
seq_ac_we_n[1:0] 333333333333333
scan_enable_dq
scan_enable_dqs
mem_cas_n
mem_ras_n
mem_we_n
memory_0_1.ba[0]
memory_0_0.ck
memory_0_0.ck_n 3 333 3333 3 3 33 3 3 3 3 3 333 3 3 3 3 333 1 3 3 3 3 33 3 3 33 3
memory_0_0.cke
memory_0_0.cs_n
memory_0_0.addr[13:0]
memory_0_0.cas_n 1 1 0 0 0 1 1 0 1 10 1 1
memory_0_0.ras_n
memory_0_0.we_n
memory_0_0.odt
memory_0_0.ba[2:0] 0 0
memory_0_0.rst_n
memory_0_0.dq[7:0]
memory_0_0.dqs 7
memory_0_0.dqs_n
memory_0_0.dm_tdqs
The following sequence corresponds with the numbered items in Figure 9–7:
1. The write leveling stage.
2. The write leveling coarse phase sweep.
3. Fine T9/T10 delay chain sweep.
4. The write burst training pattern.
5. Three training patterns available at different addresses—zeroes, ones, and mixed.
6. The read path setup starts with the first operation, read deskew.
7. The read path deskew increases capture margin.
8. The write deskew stage; patterns written to RAM and read back.
9. The write datapath setup; data written to DRAM to determine latency.
10. Advertise read and write latency stage.
11. Tracking setup stage to set up mimic window.
12. Calibration successful on user mode.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–14 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers II
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Half-Rate Read (Burst-Aligned Address)
© July 2010 Altera Corporation
Controller - AFI
afi_addr[27:0] 4001000 0000000 4021008 0000000 4041010 0000000
afi_ba[5:0]
afi_cs_n[3:0] B F B F B F
AFI Command[2:0] RD NOP RD RD NOP
afi_dm[3:0] F
afi_dqs_burst[0]
afi_dqs_burst[1]
afi_doing_rd[1:0] 3
afi_rdata[31:0] AABBCCDD EEFF0011 AABBCCDD EEFF0011 AABBCCDD EEFF0011
afi_rdata_valid[1:0] 3
mem_cke[1:0]
mem_clk
mem_ba[2:0] 0
mem_addr[13:0] 1000 0000 1008 0000 1010
mem_cs_n[0]
Mem Command[2:0] NOP RD NOP RD NOP RD NOP
mem_dqs
mem_dm
mem_dq[7:0] DDCCBB AA 11 00 FF EE DDCCBB AA 11 00 FF EE DDCCBB AA 11 00 FF EE
mem_odt[1:0]
[5] [6]
9–15
9–16 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers II
The following sequence corresponds with the numbered items in Figure 9–8:
1. The user logic requests the first read by asserting the local_read_req signal,
and the size and address for this read. In this example, the request is a burst of
length of 2 to the local address 0×000000. This local address is mapped to the
following memory address in half-rate mode:
mem_row_address = 0×000000
mem_col_address = 0×0000
mem_bank_address = 0×00
2. The user logic initiates a second read to a different memory column within the
same row. The request for the second write is a burst length of 2. In this example,
the user logic continues to accept commands until the command queue is full.
When the command queue is full, the controller deasserts the local_ready
signal. The starting local address 0x000002 is mapped to the following memory
address in half-rate mode:
mem_row_address = 0×0000
mem_col_address = 0×0002<<2 = 0×0008
mem_bank_address = 0×00
3. The controller issues the first read memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
4. The controller asserts the afi_doing_rd signal to indicate to the ALTMEMPHY
megafunction the number of clock cycles of read data it must expect for the first
read. The ALTMEMPHY megafunction uses the afi_doing_rd signal to enable
its capture registers for the expected duration of memory burst.
5. The ALTMEMPHY megafunction issues the first read command to the memory
and captures the read data from the memory.
6. The ALTMEMPHY megafunction returns the first data read to the controller after
resynchronizing the data to the phy_clk domain, by asserting the
afi_rdata_valid signal when there is valid read data on the afi_rdata bus.
7. The controller returns the first read data to the user by asserting the
local_rdata_valid signal when there is valid read data on the local_rdata
bus. If the ECC logic is disabled, there is no delay between the afi_rdata and the
local_rdata buses. If there is ECC logic in the controller, there is one or three
clock cycles of delay between the afi_rdata and local_rdata buses.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Half-Rate Write (Burst-Aligned Address)
© July 2010 Altera Corporation
phy_clk
Local Interface
local_address[25:0] 0000002 0000004 0000000
local_size[4:0] 02
local_ready
local_burstbegin
local_be[3:0]
local_write_req
local_wdata[31:0] AABBCCDD EEFF0011 AABBCCDD EEFF0011 AABBCCDD EEFF0011
Controller - AFI
afi_addr[27:0] 4001000 0000000 4001000 0000000 4021008 0000000 4041010
afi_ba[5:0]
afi_cs_n[3:0] B F B F B F B F B
AFI Command[2:0] ACT NOP WR NOP WR NOP WR NOP WR NOP
afi_dm[3:0] 0 F 0
afi_wlat[4:0]
afi_dqs_burst[0]
afi_dqs_burst[1]
afi_wdata[31:0] AABBCCDD EEFF0011 AABBCCDD EEFF0011 AABBCCDD EEFF0011
afi_wdata_valid[1:0] 3 0 3
mem_cke[1:0]
mem_clk
mem_ba[2:0]
mem_addr[13:0] 1000 0000 1000 0000 1008 0000 1010
mem_cs_n[0]
Mem Command[2:0] NOP ACT NOP WR NOP WR NOP WR NOP WR
mem_dqs
mem_dm
mem_dq[7:0] 00 00 DD CC BB AA11 00 FF EE DD CC BB AA11 00 FF EE DD CC BB AA11 00 FF EE
mem_odt[1:0]
9–17
9–18 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers II
The following sequence corresponds with the numbered items in Figure 9–9:
1. The user logic asserts the first write request to row 0 so that row 0 is open before
the next transaction.
2. The user logic asserts a second local_write_req signal with size of 2 and
address of 0 (col = 0, row = 0, bank = 0, chip = 0). The local_ready signal is
asserted along with the local_write_req signal, which indicates that the
controller has accepted this request, and the user logic can request another read or
write in the following clock cycle. If the local_ready signal was not asserted, the
user logic must keep the write request, size, and address signals asserted until the
local_ready signal is registered high.
3. The controller issues the necessary memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
4. The controller asserts the afi_wdata_valid signal to indicate to the
ALTMEMPHY megafunction that valid write data and write data masks are
present on the inputs to the ALTMEMPHY megafunction.
5. The controller asserts the afi_dqs_burst signals to control the timing of the
DQS signal that the ALTMEMPHY megafunction issues to the memory.
6. The ALTMEMPHY megafunction issues the write command, and sends the write
data and write DQS to the memory.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Half-Rate Read (Non Burst-Aligned Address)
© July 2010 Altera Corporation
phy_clk
Local Interface
local_address[25:0] 00000 00001 00003 00005 00000
local_size[4:0] 2
local_ready
local_burstbegin
local_read_req
local_rdata[31:0] AABBCCDD AABBAABBEEFF0011EEFFEEFF AABBCCDD AABBAABBEEFF0011EEFFEEFF AABBCCDD AABBAABB EEFF0011
local_rdata_valid
local_be[3:0]
Controller - AFI
afi_addr[27:0] 00000 10004 00000 20008 00000 3000C 00000 40010 00000 50014 00000 60018 00000
afi_ba[5:0]
afi_cs_n[3:0] B F B F B F B F B F B F
AFI Command[2:0] NOP RD NOP RD NOP RD NOP RD NOP RD NOP RD NOP
afi_dm[3:0] F
afi_dqs_burst[0]
afi_dqs_burst[1]
afi_doing_rd[1:0] 0 3 0 3 0 3 0 3 0 3 0 3
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
afi_rdata[31:0] AABBCCDD AABBAABB EEFF0011EEFFEEFF AABBCCDD AABBAABB EEFF0011EEFFEEFF AABBCCDD AABBAABB EEFF0011
afi_rdata_valid[1:0] 0 3 0 3 0 3 0 3 0 3 0 3
[4] [5]
9–19
9–20 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers II
The following sequence corresponds with the numbered items in Figure 9–10:
1. The user logic requests the first read by asserting the local_read_req signal,
and the size and address for this read. In this example, the request is a burst of
length of 2 to the local address 0×000001. This local address is mapped to the
following memory address in half-rate mode:
mem_row_address = 0×0000
mem_col_address = 0×0001<<2 = 0×0004
mem_bank_address = 0×00
2. The controller issues the first read memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
3. The controller asserts the afi_doing_rd signal to indicate to the ALTMEMPHY
megafunction the number of clock cycles of read data it must expect for the first
read. The ALTMEMPHY megafunction uses the afi_doing_rd signal to enable
its capture registers for the expected duration of memory burst.
4. The ALTMEMPHY megafunction issues the first read command to the memory
and captures the read data from the memory.
5. The ALTMEMPHY megafunction returns the first data read to the controller after
resynchronizing the data to the phy_clk domain, by asserting the
afi_rdata_valid signal when there is valid read data on the afi_rdata bus.
6. The controller returns the first read data to the user by asserting the
local_rdata_valid signal when there is valid read data on the local_rdata
bus. If the ECC logic is disabled, there is no delay between the afi_rdata and the
local_rdata buses. If there is ECC logic in the controller, there is one or three
clock cycles of delay between the afi_rdata and local_rdata buses.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Half-Rate Write (Non Burst-Aligned Address)
© July 2010 Altera Corporation
phy_clk
Local Interface
local_address[25:0] 0000001 0000003 0000001 0000003 0000005
local_size[4:0] 2
local_ready
local_burstbegin
local_be[3:0]
local_write_req
local_wdata[31:0] AABBCCDD EEFF0011 AABBCCDD EEFF0011
Controller - AFI
afi_addr[27:0] 0010004 0000000 0020008 0000000 003000C 0000000 0040010 0000000
afi_ba[5:0]
afi_cs_n[3:0] B F B F B F B F
AFI Command[2:0] WR NOP WR NOP WR NOP WR NOP
afi_dm[3:0] 0 F 0 F 0 F 0
afi_wlat[4:0]
afi_dqs_burst[0]
afi_dqs_burst[1]
afi_wdata[31:0] AABBCCDD EEFF0011 AABBCCDD
afi_wdata_valid[1:0] 3 0 3 0 3 0 3
AFI Memory Interface
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
mem_cke[1:0]
mem_clk
mem_ba[2:0]
mem_addr[13:0] 0004 0000 0008 0000 000C 0000 0010 0000
mem_cs_n[0]
Mem Command[2:0] WR NOP WR NOP WR NOP WR NOP
mem_dqs
mem_dm
mem_dq[7:0] DD CC BB AA 00 11 00 FF EE 00 DD CC BB AA 00 11 00 FF EE
mem_odt[1:0]
9–21
9–22 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers II
The following sequence corresponds with the numbered items in Figure 9–11:
1. The user logic asserts the first local_write_req signal with a size of 2 and an
address of 0×000001. The local_ready signal is asserted along with the
local_write_req signal, which indicates that the controller has accepted this
request, and the user logic can request another read or write in the following clock
cycle. If the local_ready signal was not asserted, the user logic must keep the
write request, size, and address signals asserted until the local_ready signal is
registered high. The local address 0x000001 is mapped to the following memory
address in half-rate mode:
mem_row_address = 0×0000
mem_col_address = 0×000001<<2 = 0×000004
mem_bank_address = 0×00
2. The user logic asserts the second local_write_req signal with a size of 2 and
an address of 0×000003. The local address 0×000003 is mapped to the following
memory address in half-rate mode:
mem_row_address = 0×0000
mem_col_address = 0×000003<<2 = 0×00000C
mem_bank_address = 0×00
3. The controller issues the necessary memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
4. The controller asserts the afi_wdata_valid signal to indicate to the
ALTMEMPHY megafunction that valid write data and write data masks are
present on the inputs to the ALTMEMPHY megafunction.
5. The controller asserts the afi_dqs_burst signals to control the timing of the
DQS signal that the ALTMEMPHY megafunction issues to the memory.
6. The ALTMEMPHY megafunction issues the write command, and sends the write
data and write DQS to the memory.
7. The controller generates another write because the first write is to a non-aligned
memory address, 0×0004. The controller performs the second write burst at the
memory address of 0×0008.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Half-Rate Read With Gaps
© July 2010 Altera Corporation
phy_clk
Local Interface
local_address[25:0] 0000810 0000912 0000A14
local_size[4:0] 2
local_ready
local_burstbegin
local_read_req
local_rdata[31:0] 00000000
local_rdata_valid
local_be[3:0]
Controller - AFI
afi_addr[27:0] 0000000 0000000 5101440 0004001 0000000 4121048 0004001 0000000 4141050 0000000
afi_ba[5:0] 00 09 00 09 12 00 12
afi_cs_n[3:0] F B F B F B F
AFI Command[2:0] NOP RD ACT NOP RD ACT NOP RD NOP
afi_dm[3:0] F
afi_dqs_burst[0]
afi_dqs_burst[1]
afi_doing_rd[1:0] 0 3 0 3 0 3
afi_rdata[31:0] 00000000
afi_rdata_valid[1:0] 0 3 0 3 0 3
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–23
9–24 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers II
The following sequence corresponds with the numbered items in Figure 9–12:
1. The user logic requests the first read by asserting the local_read_req signal,
and the size and address for this read. In this example, the request is a burst of
length of 2 to the local address 0×0000810. This local address is mapped to the
following memory address in half-rate mode:
mem_row_address = 0×0001
mem_col_address = 0×0010<<2 = 0×0040
mem_bank_address = 0×00
2. When the command queue is full, the controller deasserts the local_ready
signal to indicate that the controller has not accepted the command. The user logic
must keep the read request, size, and address signal until the local_ready
signal is asserted again.
3. The user logic asserts a second local_read_req signal with a size of 2 and
address of 0×0000912.
4. The controller issues the first read memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
5. The ALTMEMPHY megafunction issues the read command to the memory and
captures the read data from the memory.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 9: Timing Diagrams 9–25
DDR3 High-Performance Controllers II
The following sequence corresponds with the numbered items in Figure 9–13:
1. The user logic asserts a local_write_req signal with a size of 2 and an address
of 0×0000F1C.
2. The controller issues the necessary memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
3. The controller asserts the afi_wdata_valid signal to indicate to the
ALTMEMPHY megafunction that valid write data and write data masks are
present on the inputs to the ALTMEMPHY megafunction.
4. The controller asserts the afi_dqs_burst signals to control the timing of the
DQS signal that the ALTMEMPHY megafunction issues to the memory.
5. The ALTMEMPHY megafunction issues the write command, and sends the write
data and write DQS to the memory.
6. For transactions with a local size of two, the local_write_req and
local_ready signals must be high for two clock cycles so that all the write data
can be transferred to the controller.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–26 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers II
phy_clk
Local Interface
local_address[25:0] 0000000 0000001 0000002 0000003
local_size[4:0]
local_ready
local_burstbegin
local_be[3:0]
local_write_req
local_wdata[31:0] 00000000 22222222 33333333 00000000
Controller - AFI
afi_addr[27:0] 0000000 4001000 0000000 4021008 0000000
afi_ba[5:0]
afi_cs_n[3:0] F B F B F B F
AFI Command[2:0] ACT NOP WR NOP WR NOP
afi_dm[3:0] 0
afi_wlat[4:0]
afi_dqs_burst[0]
afi_dqs_burst[1]
afi_wdata[31:0] 00000000 22222222 33333333 00000000
afi_wdata_valid[1:0] 3 0 3
AFI Memory Interface
mem_cke
mem_clk
mem_ba[2:0]
mem_addr[13:0] 1000 0000 1008 0000
mem_cs_n[0]
Mem Command[2:0] ACT NOP WR NOP WR NOP
mem_dqs
mem_dm
mem_dq[7:0] 00 22 33 00
mem_odt[1:0]
The following sequence corresponds with the numbered items in Figure 9–14:
1. The user logic asserts the first local_write_req signal with a size of 1 and an
address of 0×000000. The local_ready signal is asserted along with the
local_write_req signal, which indicates that the controller has accepted this
request, and the user logic can request another read or write in the following clock
cycle. If the local_ready signal was not asserted, the user logic must keep the
write request, size, and address signals asserted until the local_ready signal is
registered high. The local address 0x000000 is mapped to the following memory
address in half-rate mode:
mem_row_address = 0×0000
mem_col_address = 0×0000<<2 = 0×0000
mem_bank_address = 0×00
2. The user logic asserts a second local_write_req signal with a size of 1 and
address of 1. The local_ready signal is asserted along with the
local_write_req signal, which indicates that the controller has accepted this
request. Since the second write request is to a sequential address (same row, same
bank, and column increment by 1), this write and the first write can be merged at
the memory transaction.
3. The controller issues the necessary memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Chapter 9: Timing Diagrams 9–27
DDR3 High-Performance Controllers II
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
Write-Read-Write-Read Operation
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–28
Figure 9–15. Write-Read Sequential Operation for HPC II
[1] [2] [3] [4] [5] [8] [9] [13]
phy_clk
Local Interface
local_address[25:0] 0000002 0000004 0000006
local_size[4:0]
local_ready
local_burstbegin
local_read_req
local_rdata[31:0] 00000000 00000008 00000000 00000010
local_rdata_valid
local_be[3:0]
local_write_req
local_wdata[31:0] 00000008 00000010 00000018
Controller - AFI
afi_addr[27:0] 0000000 0020008 0000000 0020008 0000000 0040010 0000000 0040010 0000000 0060018
afi_ba[5:0]
afi_cs_n[3:0] F B F B F B F B F B
AFI Command[2:0] NOP WR NOP RD NOP WR NOP RD NOP WR NOP
afi_dm[3:0] F 0 F 0 F 0
afi_wlat[4:0]
afi_wdata[31:0] 00000000 00000008 00000010
afi_doing_rd[1:0] 0 3 0 3
afi_wdata_valid[1:0] 0 3 0 3 0 3
afi_dqs_burst[1]
afi_dqs_burst[0]
afi_rdata[31:0] 00000000 00000008 00000000 00000010
afi_rdata_valid[1:0] 0 3 0 3
mem_ba[2:0]
mem_addr[13:0] 0000 0008 0000 0008 0000 0010 0000 0010 0000 0018
The following sequence corresponds with the numbered items in Figure 9–15:
1. The user logic requests the first write by asserting the local_write_req signal,
and the size and address for this write. In this example, the request is a burst
length of 1 to a local address 0x000002. This local address is mapped to the
following memory address in half-rate mode:
mem_row_address = 0×0000
mem_col_address = 0×0002<<2 = 0×0008
mem_bank_address = 0×00
2. The user logic initiates the first read to the same address as the first write. The
request for the read is a burst length of 1. The controller continues to accept
commands until the command queue is full. When the command queue is full, the
controller deasserts the local_ready signal. The starting local address 0x000002
is mapped to the following memory address in half-rate mode:
mem_row_address = 0×0000
mem_col_address = 0×0002<<2 = 0×0008
mem_bank_address = 0×00
3. The user logic asserts a second local_write_req signal with a size of 1 and
address of 0x000004.
4. The user logic asserts a second local_read_req signal with a size of 1 and
address of 0x000004.
5. The controller issues the necessary memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
6. The controller asserts the afi_wdata_valid signal to indicate to the
ALTMEMPHY megafunction that valid write data and write data masks are
present on the inputs to the ALTMEMPHY megafunction.
7. The controller asserts the afi_dqs_burst signals to control the timing of the
DQS signals that the ALTMEMPHY megafunction issues to the memory.
8. The controller issues the first read memory command and address signals to the
ALTMEMPHY megafunction for it to send to the memory device.
9. The controller asserts the afi_doing_rd signal to indicate to the ALTMEMPHY
megafunction the number of clock cycles of read data it must expect for the first
read. The ALTMEMPHY megafunction uses the afi_doing_rd signal to enable
its capture registers for the expected duration of memory burst.
10. The ALTMEMPHY megafunction issues the write command, and sends the write
data and write DQS to the memory.
11. The ALTMEMPHY megafunction issues the first read command to the memory
and captures the read data from the memory.
12. The ALTMEMPHY megafunction returns the first data read to the controller after
resynchronizing the data to the phy_clk domain, by asserting the
afi_rdata_valid signal when there is valid read data on the afi_rdata bus.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User Guide
9–30 Chapter 9: Timing Diagrams
DDR3 High-Performance Controllers II
13. The controller returns the first read data to the user by asserting the
local_rdata_valid signal when there is valid read data on the local_rdata
bus. If the ECC logic is disabled, there is no delay between the afi_rdata and the
local_rdata buses. If there is ECC logic in the controller, there is one or three
clock cycles of delay between the afi_rdata and local_rdata buses.
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Additional Information
Contact
Contact (Note 1) Method Address
Technical support Website [Link]/support
Technical training Website [Link]/training
Email custrain@[Link]
Altera literature services Email literature@[Link]
Non-technical support (General) Email nacomp@[Link]
(Software Licensing) Email authorization@[Link]
Note:
(1) You can also contact your local Altera sales office or sales representative.
Typographic Conventions
The following table shows the typographic conventions that this document uses.
© July 2010 Altera Corporation DDR3 SDRAM Controller with ALTMEMPHY IP User GuidePreliminary
Info–2 Additional Information
Typographic Conventions
DDR3 SDRAM Controller with ALTMEMPHY IP User Guide © July 2010 Altera Corporation
Preliminary