Example Configurations............................................................................................................................. 2-8
Instantiating the Core..................................................................................................................................8-3
Video Sync Generator............................................................................................................................... 24-1
IP Caveats....................................................................................................................................................34-8
This user guide describes the IP cores provided by Altera that are included in the Quartus® II design
software.
The IP cores are optimized for Altera® devices and can be easily implemented to reduce design and test
time. You can use the IP parameter editor from Qsys to add the IP cores to your system, configure the
cores, and specify their connectivity.
Altera's Qsys system integration tool is available in the Quartus II software subcription edition version
14.0.
Before using Qsys, review the (Quartus II software Version 14.0 Release Notes) for known issues and
limitations. To submit general feedback or technical support, click Feedback on the Quartus II software
Help menu and also on all Altera technical documentation.
Quartus II Handbook 14.0
Quartus II Software and Device Support Release Notes Version 14.0
Tool Support
Qsys is a system-level integration tool which is included as part of the Quartus II software. Qsys leverages
the easy-to-use interface of SOPC Builder and provides backward compatibility for easy migration of
existing embedded systems.You can implement a design using the IP cores from the Qsys component
library.
Subscribe
Send Feedback
All the IP cores described in this user guide are supported by Qsys except for the following cores which
are only supported by SOPC Builder.
• Common Flash Interface Controller Core
• SDRAM Controller Core (pin-sharing mode)
• System ID Core
Obsolescence
The following IP cores are scheduled for product obsolescence and discontinued support:
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. 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. 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.
ISO
9001:2008
Registered
1-2
Device Support
• PCI Lite Core
• Mailbox Core
Altera recommends that you do not use these cores in new designs.
For more information about Altera’s current IP offering, refer to Altera’s Intellectual Property
website.
Device Support
The IP cores described in this user guide support all Altera® device families except the cores listed in the
table below.
Table 1-1: Device Support
IP CoresDevice Support
Off-Chip Interfaces
EPCS Serial Flash Controller CoreAll device families except HardCopy
Different device families support different I/O standards, which may affect the ability of the core to
interface to certain components. For details about supported I/O types, refer to the device handbook for
the target device family.
Document Revision History
Table 1-2: Document Revision History
Date and
Document
Version
July 2014
v14.0.0
December
2013 v13.1.0
-Removed mention of SOPC Builder, updated to QsysMaintenance
Removed listing of the DMA Controller core in the Qsys
unsupported list. The DMA controller core is now
supported in Qsys.
Changes MadeSummary of Changes
®
Release
—
Altera Corporation
Removed listing of the MDIO core in Device Support Table.
The MDIO core support all device families that the 10-Gbps
Ethernet MAC MegaCore Function supports.
Introduction
Send Feedback
UG-01085
2014.24.07
Document Revision History
1-3
Date and
Document
Version
December
2010
v10.1.0
Changes MadeSummary of Changes
Initial release.—
Introduction
Send Feedback
Altera Corporation
2014.24.07
www.altera.com
101 Innovation Drive, San Jose, CA 95134
SDRAM Controller Core
2
UG-01085
Core Overview
The SDRAM controller core with Avalon® interface provides an Avalon Memory-Mapped (Avalon-MM)
interface to off-chip SDRAM. The SDRAM controller allows designers to create custom systems in an
Altera® device that connect easily to SDRAM chips. The SDRAM controller supports standard SDRAM as
described in the PC100 specification.
SDRAM is commonly used in cost-sensitive applications requiring large amounts of volatile memory.
While SDRAM is relatively inexpensive, control logic is required to perform refresh operations, open-row
management, and other delays and command sequences. The SDRAM controller connects to one or more
SDRAM chips, and handles all SDRAM protocol requirements. Internal to the device, the core presents an
Avalon-MM slave port that appears as linear memory (flat address space) to Avalon-MM master
peripherals.
The core can access SDRAM subsystems with various data widths (8, 16, 32, or 64 bits), various memory
sizes, and multiple chip selects. The Avalon-MM interface is latency-aware, allowing read transfers to be
pipelined. The core can optionally share its address and data buses with other off-chip Avalon-MM tristate devices. This feature is valuable in systems that have limited I/O pins, yet must connect to multiple
memory chips in addition to SDRAM.
Subscribe
Send Feedback
Functional Description
The diagram below shows a block diagram of the SDRAM controller core connected to an external
SDRAM chip.
2014 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. 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. 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.
ISO
9001:2008
Registered
Avalon-MM slave
interface
to on-chip
logic
SDRAM Controller Core
data, control
Avalon-MM Slave Port
clock
waitrequest
readdatavalid
dq
dqm
PLL
Phase Shift
Interface to SDRAM pins
Altera FPGA
clk
addr
ras
cas
cs
cke
ba
we
Control
Logic
address
SDRAM Clock
Controller Clock
Clock
Source
SDRAM Chip
(PC100)
2-2
Avalon-MM Interface
Figure 2-1: SDRAM Controller with Avalon Interface Block Diagram
The following sections describe the components of the SDRAM controller core in detail. All options are
specified at system generation time, and cannot be changed at runtime.
UG-01085
2014.24.07
Altera Corporation
Avalon-MM Interface
The Avalon-MM slave port is the user-visible part of the SDRAM controller core. The slave port presents
a flat, contiguous memory space as large as the SDRAM chip(s). When accessing the slave port, the details
of the PC100 SDRAM protocol are entirely transparent. The Avalon-MM interface behaves as a simple
memory interface. There are no memory-mapped configuration registers.
The Avalon-MM slave port supports peripheral-controlled wait states for read and write transfers. The
slave port stalls the transfer until it can present valid data. The slave port also supports read transfers with
variable latency, enabling high-bandwidth, pipelined read transfers. When a master peripheral reads
sequential addresses from the slave port, the first data returns after an initial period of latency. Subsequent
reads can produce new data every clock cycle. However, data is not guaranteed to return every clock cycle,
because the SDRAM controller must pause periodically to refresh the SDRAM.
For details about Avalon-MM transfer types, refer to the Avalon Interface Specifications.
Off-Chip SDRAM Interface
The interface to the external SDRAM chip presents the signals defined by the PC100 standard. These
signals must be connected externally to the SDRAM chip(s) through I/O pins on the Altera device.
Signal Timing and Electrical Characteristics
The timing and sequencing of signals depends on the configuration of the core. The hardware designer
configures the core to match the SDRAM chip chosen for the system. See the Configuration section for
details. The electrical characteristics of the device pins depend on both the target device family and the
assignments made in the Quartus® II software. Some device families support a wider range of electrical
SDRAM Controller Core
Send Feedback
UG-01085
2014.24.07
standards, and therefore are capable of interfacing with a greater variety of SDRAM chips. For details,
refer to the device handbook for the target device family.
Synchronizing Clock and Data Signals
The clock for the SDRAM chip (SDRAM clock) must be driven at the same frequency as the clock for the
Avalon-MM interface on the SDRAM controller (controller clock). As in all synchronous designs, you
must ensure that address, data, and control signals at the SDRAM pins are stable when a clock edge
arrives. As shown in the above SDRAM Controller with Avalon Interface block diagram, you can use an
on-chip phase-locked loop (PLL) to alleviate clock skew between the SDRAM controller core and the
SDRAM chip. At lower clock speeds, the PLL might not be necessary. At higher clock rates, a PLL is
necessary to ensure that the SDRAM clock toggles only when signals are stable on the pins. The PLL block
is not part of the SDRAM controller core. If a PLL is necessary, you must instantiate it manually. You can
instantiate the PLL core interface or instantiate an ALTPLL megafunction outside the Qsys system
module.
If you use a PLL, you must tune the PLL to introduce a clock phase shift so that SDRAM clock edges
arrive after synchronous signals have stabilized. See Clock, PLL and Timing Considerations sections for
details.
For more information about instantiating a PLL, refer to PLL Cores chapter. The Nios® II development
tools provide example hardware designs that use the SDRAM controller core in conjunction with a PLL,
which you can use as a reference for your custom designs.
Synchronizing Clock and Data Signals
2-3
The Nios II development tools are available free for download from www.Altera.com.
Clock Enable (CKE) not Supported
The SDRAM controller does not support clock-disable modes. The SDRAM controller permanently
asserts the CKE signal on the SDRAM.
Sharing Pins with other Avalon-MM Tri-State Devices
If an Avalon-MM tri-state bridge is present, the SDRAM controller core can share pins with the existing
tri-state bridge. In this case, the core’s addr, dq (data) and dqm (byte-enable) pins are shared with other
devices connected to the Avalon-MM tri-state bridge. This feature conserves I/O pins, which is valuable in
systems that have multiple external memory chips (for example, flash, SRAM, and SDRAM), but too few
pins to dedicate to the SDRAM chip. See Performance Considerations section for details about how pin
sharing affects performance.
The SDRAM addresses must connect all address bits regardless of the size of the word so that the loworder address bits on the tri-state bridge align with the low-order address bits on the memory device. The
Avalon-MM tristate address signal always presents a byte address. It is not possible to drop A0 of the tristate bridge for memories when the smallest access size is 16 bits or A0-A1 of the tri-state bridge when the
smallest access size is 32 bits.
Board Layout and Pinout Considerations
When making decisions about the board layout and device pinout, try to minimize the skew between the
SDRAM signals. For example, when assigning the device pinout, group the SDRAM signals, including the
SDRAM clock output, physically close together. Also, you can use the Fast Input Register and FastOutput Register logic options in the Quartus II software. These logic options place registers for the
SDRAM signals in the I/O cells. Signals driven from registers in I/O cells have similar timing characteris‐
tics, such as tCO, tSU, and tH.
SDRAM Controller Core
Send Feedback
Altera Corporation
2-4
Performance Considerations
Performance Considerations
Under optimal conditions, the SDRAM controller core’s bandwidth approaches one word per clock cycle.
However, because of the overhead associated with refreshing the SDRAM, it is impossible to reach one
word per clock cycle. Other factors affect the core’s performance, as described in the following sections.
Open Row Management
SDRAM chips are arranged as multiple banks of memory, in which each bank is capable of independent
open-row address management. The SDRAM controller core takes advantage of open-row management
for a single bank. Continuous reads or writes within the same row and bank operate at rates approaching
one word per clock. Applications that frequently access different destination banks require extra
management cycles to open and close rows.
Sharing Data and Address Pins
When the controller shares pins with other tri-state devices, average access time usually increases and
bandwidth decreases. When access to the tri-state bridge is granted to other devices, the SDRAM incurs
overhead to open and close rows. Furthermore, the SDRAM controller has to wait several clock cycles
before it is granted access again.
To maximize bandwidth, the SDRAM controller automatically maintains control of the tri-state bridge as
long as back-to-back read or write transactions continue within the same row and bank.
UG-01085
2014.24.07
This behavior may degrade the average access time for other devices sharing the Avalon-MM tri-state
bridge.
The SDRAM controller closes an open row whenever there is a break in back-to-back transactions, or
whenever a refresh transaction is required. As a result:
• The controller cannot permanently block access to other devices sharing the tri-state bridge.
• The controller is guaranteed not to violate the SDRAM’s row open time limit.
Hardware Design and Target Device
The target device affects the maximum achievable clock frequency of a hardware design. Certain device
families achieve higher f
performance than other families. Furthermore, within a device family, faster
MAX
speed grades achieve higher performance. The SDRAM controller core can achieve 100 MHz in Altera’s
high-performance device families, such as Stratix® series. However, the core might not achieve 100 MHz
performance in all Altera device families.
The f
performance also depends on the system design. The SDRAM controller clock can also drive
MAX
other logic in the system module, which might affect the maximum achievable frequency. For the SDRAM
controller core to achieve f
performance of 100 MHz, all components driven by the same clock must
MAX
be designed for a 100 MHz clock rate, and timing analysis in the Quartus II software must verify that the
overall hardware design is capable of 100 MHz operation.
Configuration
The SDRAM controller MegaWizard has two pages: Memory Profile and Timing. This section describes
the options available on each page.
The Presets list offers several pre-defined SDRAM configurations as a convenience. If the SDRAM
subsystem on the target board matches one of the preset configurations, you can configure the SDRAM
Altera Corporation
SDRAM Controller Core
Send Feedback
UG-01085
2014.24.07
controller core easily by selecting the appropriate preset value. The following preset configurations are
defined:
• Micron MT8LSDT1664HG module
• Four SDR100 8 MByte × 16 chips
• Single Micron MT48LC2M32B2-7 chip
• Single Micron MT48LC4M32B2-7 chip
• Single NEC D4564163-A80 chip (64 MByte × 16)
• Single Alliance AS4LC1M16S1-10 chip
• Single Alliance AS4LC2M8S0-10 chip
Selecting a preset configuration automatically changes values on the Memory Profile and Timing tabs
to match the specific configuration. Altering a configuration setting on any page changes the Preset
value to custom.
Memory Profile Page
The Memory Profile page allows you to specify the structure of the SDRAM subsystem such as address
and data bus widths, the number of chip select signals, and the number of banks.
Table 2-1: Memory Profile Page Settings
Memory Profile Page
2-5
SettingsAllowed
Values
Default
Values
Description
Data Width8, 16, 32,6432SDRAM data bus width. This value determines the
width of the dq bus (data) and the dqm bus (byteenable).
Chip Selects 1, 2, 4, 81Number of independent chip selects in the SDRAM
subsystem. By using multiple chip selects, the
Archite
cture
Setting
s
Banks2, 44Number of SDRAM banks. This value determines the
SDRAM controller can combine multiple SDRAM
chips into one memory subsystem.
width of the ba bus (bank address) that connects to
the SDRAM. The correct value is provided in the data
sheet for the target SDRAM.
Row11, 12, 13,1412Number of row address bits. This value determines
the width of the addr bus. The Row and Column
Addres
s
Width
values depend on the geometry of the chosen
SDRAM. For example, an SDRAM organized as 4096
(212) rows by 512 columns has a Row value of 12.
Setting
s
Column>= 8, and
less than
Row value
8Number of column address bits. For example, the
SDRAM organized as 4096 rows by 512 (29) columns
has a Column value of 9.
Share pins via tristate bridge dq/dqm/
addr I/O pins
SDRAM Controller Core
Send Feedback
On, OffOffWhen set to No, all pins are dedicated to the SDRAM
chip. When set to Yes, the addr, dq, and dqm pins can
be shared with a tristate bridge in the system. In this
case, select the appropriate tristate bridge from the
pull-down menu.
Altera Corporation
2-6
Timing Page
UG-01085
2014.24.07
SettingsAllowed
Include a functional
memory model in the
system testbench
Values
On, OffOnWhen on, Qsys functional simulation model for the
Default
Values
Description
SDRAM chip. This default memory model acceler‐
ates the process of creating and verifying systems that
use the SDRAM controller. See HardwareSimulation Considerations section.
Based on the settings entered on the Memory Profile page, the wizard displays the expected memory
capacity of the SDRAM subsystem in units of megabytes, megabits, and number of addressable words.
Compare these expected values to the actual size of the chosen SDRAM to verify that the settings are
correct.
Timing Page
The Timing page allows designers to enter the timing specifications of the SDRAM chip(s) used. The
correct values are available in the manufacturer’s data sheet for the target SDRAM.
Table 2-2: Timing Page Settings
SettingsAllowe
d
Values
CAS latency1, 2, 33Latency (in clock cycles) from a read command to data
Default
Value
Description
out.
Initialization
refresh cycles
1–82This value specifies how many refresh cycles the
SDRAM controller performs as part of the initialization
sequence after reset.
Issue one refresh
command every
—15.625 µs This value specifies how often the SDRAM controller
refreshes the SDRAM. A typical SDRAM requires 4,096
refresh commands every 64 ms, which can be achieved
by issuing one refresh command every 64 ms / 4,096 =
15.625 μs.
Delay after power
up, before initiali‐
—100 µsThe delay from stable clock and power to SDRAM
—20 nsACTIVE to READ or WRITE delay.
or WRITE delay
(t_rcd)
Access time (t_ac)—17 nsAccess time from clock edge. This value may depend on
CAS latency.
Altera Corporation
SDRAM Controller Core
Send Feedback
UG-01085
2014.24.07
Hardware Simulation Considerations
2-7
SettingsAllowe
Write recovery
time (t_wr, No
auto precharge)
d
Values
—14 nsWrite recovery if explicit precharge commands are
Default
Value
issued. This SDRAM controller always issues explicit
precharge commands.
Regardless of the exact timing values you specify, the actual timing achieved for each parameter is an
integer multiple of the Avalon clock period. For the Issue one refresh command every parameter, the
actual timing is the greatest number of clock cycles that does not exceed the target value. For all other
parameters, the actual timing is the smallest number of clock ticks that provides a value greater than or
equal to the target value.
Hardware Simulation Considerations
This section discusses considerations for simulating systems with SDRAM. Three major components are
required for simulation:
• A simulation model for the SDRAM controller.
• A simulation model for the SDRAM chip(s), also called the memory model.
• A simulation testbench that wires the memory model to the SDRAM controller pins.
Some or all of these components are generated by Qsys at system generation time.
Description
SDRAM Controller Simulation Model
The SDRAM controller design files generated by Qsys are suitable for both synthesis and simulation.
Some simulation features are implemented in the HDL using “translate on/off” synthesis directives that
make certain sections of HDL code invisible to the synthesis tool.
The simulation features are implemented primarily for easy simulation of Nios and Nios II processor
systems using the ModelSim® simulator. The SDRAM controller simulation model is not ModelSim
specific. However, minor changes may be required to make the model work with other simulators.
If you change the simulation directives to create a custom simulation flow, be aware that Qsys overwrites
existing files during system generation. Take precautions to ensure your changes are not overwritten.
Refer to AN 351: Simulating Nios II Processor Designs for a demonstration of simulation of the
SDRAM controller in the context of Nios II embedded processor systems.
SDRAM Memory Model
This section describes the two options for simulating a memory model of the SDRAM chip(s).
Using the Generic Memory Model
If the Include a functional memory model the system testbench option is enabled at system generation,
Qsys generates an HDL simulation model for the SDRAM memory. In the auto-generated system
testbench, Qsys automatically wires this memory model to the SDRAM controller pins.
Using the automatic memory model and testbench accelerates the process of creating and verifying
systems that use the SDRAM controller. However, the memory model is a generic functional model that
does not reflect the true timing or functionality of real SDRAM chips. The generic model is always
SDRAM Controller Core
Send Feedback
Altera Corporation
data
32
128 Mbits
16 Mbytes
32 data width device
SDRAM
Controller
Altera FPGA
Avalon-MM
interface
to
on-chip
logic
addr
cs_n
ctl
addr
ctl
cs_n
SDRAM
Controller
Altera FPGA
Avalon-MM
interface
to
on-chip
logic
64 Mbits
8 Mbytes
16 data width device
64 Mbits
8 Mbytes
16 data width device
data
16
16
32
2-8
Using the SDRAM Manufacturer's Memory Model
structured as a single, monolithic block of memory. For example, even for a system that combines two
SDRAM chips, the generic memory model is implemented as a single entity.
Using the SDRAM Manufacturer's Memory Model
If the Include a functional memory model the system testbench option is not enabled, you are
responsible for obtaining a memory model from the SDRAM manufacturer, and manually wiring the
model to the SDRAM controller pins in the system testbench.
Example Configurations
The following examples show how to connect the SDRAM controller outputs to an SDRAM chip or chips.
The bus labeled ctl is an aggregate of the remaining signals, such as cas_n, ras_n, cke and we_n.
The address, data, and control signals are wired directly from the controller to the chip. The result is a
128-Mbit (16-Mbyte) memory space.
Figure 2-2: Single 128-Mbit SDRAM Chip with 32-Bit Data
UG-01085
2014.24.07
Altera Corporation
The address and control signals connect in parallel to both chips. The chips share the chipselect (cs_n)
signal. Each chip provides half of the 32-bit data bus. The result is a logical 128-Mbit (16-Mbyte) 32-bit
data memory.
Figure 2-3: Two 64-MBit SDRAM Chips Each with 16-Bit Data
SDRAM Controller Core
Send Feedback
addr
ctl
cs_n [0]
cs_n [1]
SDRAM
Controller
Altera FPGA
Avalon-MM
interface
to
on-chip
logic
data
32
128 Mbits
16 Mbytes
32 data width device
128 Mbits
16 Mbytes
32 data width device
32
32
UG-01085
2014.24.07
The address, data, and control signals connect in parallel to the two chips. The chipselect bus (cs_n[1:0])
determines which chip is selected. The result is a logical 256-Mbit 32-bit wide memory.
Figure 2-4: Two 128-Mbit SDRAM Chips Each with 32-Bit Data
Software Programming Model
Software Programming Model
2-9
The SDRAM controller behaves like simple memory when accessed via the Avalon-MM interface. There
are no software-configurable settings and no memory-mapped registers. No software driver routines are
required for a processor to access the SDRAM controller.
Clock, PLL and Timing Considerations
This section describes issues related to synchronizing signals from the SDRAM controller core with the
clock that drives the SDRAM chip. During SDRAM transactions, the address, data, and control signals are
valid at the SDRAM pins for a window of time, during which the SDRAM clock must toggle to capture
the correct values. At slower clock frequencies, the clock naturally falls within the valid window. At higher
frequencies, you must compensate the SDRAM clock to align with the valid window.
Determine when the valid window occurs either by calculation or by analyzing the SDRAM pins with an
oscilloscope. Then use a PLL to adjust the phase of the SDRAM clock so that edges occur in the middle of
the valid window. Tuning the PLL might require trial-and-error effort to align the phase shift to the
properties of your target board.
For details about the PLL circuitry in your target device, refer to the appropriate device family handbook.
For details about configuring the PLLs in Altera devices, refer to the ALTPLL Megafunction User Guide.
Factors Affecting SDRAM Timing
The location and duration of the window depends on several factors:
SDRAM Controller Core
Send Feedback
Altera Corporation
2-10
Symptoms of an Untuned PLL
• Timing parameters of the device and SDRAM I/O pins — I/O timing parameters vary based on device
family and speed grade.
• Pin location on the device — I/O pins connected to row routing have different timing than pins
connected to column routing.
• Logic options used during the Quartus II compilation — Logic options such as the Fast Input Register
and Fast Output Register logic affect the design fit. The location of logic and registers inside the
device affects the propagation delays of signals to the I/O pins.
• SDRAM CAS latency
As a result, the valid window timing is different for different combinations of FPGA and SDRAM
devices. The window depends on the Quartus II software fitting results and pin assignments.
Symptoms of an Untuned PLL
Detecting when the PLL is not tuned correctly might be difficult. Data transfers to or from the SDRAM
might not fail universally. For example, individual transfers to the SDRAM controller might succeed,
whereas burst transfers fail. For processor-based systems, if software can perform read or write data to
SDRAM, but cannot run when the code is located in SDRAM, the PLL is probably tuned incorrectly.
Estimating the Valid Signal Window
This section describes how to estimate the location and duration of the valid signal window using timing
parameters provided in the SDRAM datasheet and the Quartus II software compilation report. After
finding the window, tune the PLL so that SDRAM clock edges occur exactly in the middle of the window.
UG-01085
2014.24.07
Calculating the window is a two-step process. First, determine by how much time the SDRAM clock can
lag the controller clock, and then by how much time it can lead. After finding the maximum lag and lead
values, calculate the midpoint between them.
These calculations provide an estimation only. The following delays can also affect proper PLL tuning, but
are not accounted for by these calculations.
• Signal skew due to delays on the printed circuit board — These calculations assume zero skew.
• Delay from the PLL clock output nodes to destinations — These calculations assume that the delay
from the PLL SDRAM-clock output-node to the pin is the same as the delay from the PLL controllerclock output-node to the clock inputs in the SDRAM controller. If these clock delays are significantly
different, you must account for this phase shift in your window calculations.
Lag is a negative time shift, relative to the controller clock, and lead is a positive time shift. The
SDRAM clock can lag the controller clock by the lesser of the maximum lag for a read cycle or that for
a write cycle. In other words, Maximum Lag = minimum(Read Lag, Write Lag). Similarly, the SDRAM
clock can lead by the lesser of the maximum lead for a read cycle or for a write cycle. In other words,
Maximum Lead = minimum(Read Lead, Write Lead).
Altera Corporation
SDRAM Controller Core
Send Feedback
UG-01085
2014.24.07
Figure 2-5: Calculating the Maximum SDRAM Clock Lag
Figure 2-6: Calculating the Maximum SDRAM Clock Lead
Example Calculation
2-11
Example Calculation
This section demonstrates a calculation of the signal window for a Micron MT48LC4M32B2-7 SDRAM
chip and design targeting the Stratix II EP2S60F672C5 device. This example uses a CAS latency (CL) of 3
cycles, and a clock frequency of 50 MHz. All SDRAM signals on the device are registered in I/O cells,
enabled with the Fast Input Register and Fast Output Register logic options in the Quartus II software.
SDRAM Controller Core
Send Feedback
Altera Corporation
2-12
Example Calculation
Table 2-3: Timing Parameters for Micron MT48LC4M32B2 SDRAM Device
setup time
Data-in hold timet
Data-in setup timet
Data-out
highimpedance
time
CL = 3t
CL = 2t
CL = 1t
Data-out low-impedance timet
Data-out hold timet
DH
DS
HZ(3)
HZ(2)
HZ(1)
LZ
OH
The FPGA I/O Timing Parameters table below shows the relevant timing information, obtained from the
Timing Analyzer section of the Quartus II Compilation Report. The values in the table are the maximum
or minimum values among all device pins related to the SDRAM. The variance in timing between the
SDRAM pins on the device is small (less than 100 ps) because the registers for these signals are placed in
the I/O cell.
Table 2-4: FPGA I/O Timing Parameters
ParameterSymbolValue (ns)
Clock periodt
Minimum clock-to-output timet
CLK
CO_MIN
2—
1
2
5.5
—8
—17
1—
2.5
20
2.399
Altera Corporation
SDRAM Controller Core
Send Feedback
UG-01085
2014.24.07
ParameterSymbolValue (ns)
Document Revision History
2-13
Maximum clock-to-output timet
Maximum hold time after clockt
Maximum setup time before clockt
CO_MAX
H_MAX
SU_MAX
2.477
–5.607
5.936
You must compile the design in the Quartus II software to obtain the I/O timing information for the
design. Although Altera device family datasheets contain generic I/O timing information for each device,
the Quartus II Compilation Report provides the most precise timing information for your specific design.
The timing values found in the compilation report can change, depending on fitting, pin location, and
other Quartus II logic settings. When you recompile the design in the Quartus II software, verify that the
I/O timing has not changed significantly.
The following examples illustrate the calculations from figures Maximum SDRAM Clock Lag and
Maximum Lead also using the values from the Timing Parameters and FPGA I/O Timing Parameters
table.
The SDRAM clock can lag the controller clock by the lesser of Read Lag or Write Lag:
Read Lag = tOH(SDRAM) – t
H_MAX
(FPGA)
= 2.5 ns – (–5.607 ns) = 8.107 ns
or
Write Lag = t
CLK
– t
CO_MAX
(FPGA) – tDS(SDRAM)
= 20 ns – 2.477 ns – 2 ns = 15.523 ns
The SDRAM clock can lead the controller clock by the lesser of Read Lead or Write Lead:
Read Lead = t
CO_MIN
(FPGA) – tDH(SDRAM)
= 2.399 ns – 1.0 ns = 1.399 ns
or
Write Lead = t
CLK
– t
(SDRAM) – t
HZ(3)
= 20 ns – 5.5 ns – 5.936 ns = 8.564 ns
Therefore, for this example you can shift the phase of the SDRAM clock from –8.107 ns to 1.399 ns
relative to the controller clock. Choosing a phase shift in the middle of this window results in the value (–
8.107 + 1.399)/2 = –3.35 ns.
Document Revision History
Table 2-5: Document Revision History
Date and
Document
Version
July 2014
V14.0
-Removed mention of SOPC Builder, updated to QsysMaintenance
SU_MAX
Changes MadeSummary of Changes
(FPGA)
Release
SDRAM Controller Core
Send Feedback
Altera Corporation
2-14
Document Revision History
UG-01085
2014.24.07
Date and
Document
Version
December
2010
v10.1.0
July 2010
v10.0.0
November
2009
v9.1.0
March 2009
v9.0.0
November
2008
v8.1.0
Changes MadeSummary of Changes
Removed the “Device Support”, “Instantiating the Core in
—
SOPC Builder”, and “Referenced Documents” sections.
No change from previous release.—
No change from previous release.—
No change from previous release.—
Changed to 8-1/2 x 11 page size. No change to content.—
May 2008
No change from previous release.—
v8.0.0
For previous versions of this chapter, refer to the
Quartus II Handbook Archive.
Altera Corporation
SDRAM Controller Core
Send Feedback
Loading...
+ 306 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.