Using The Parallel Flash Loader With The Quartus II Software
Using The Parallel Flash Loader With The Quartus II Software
Introduction With the density of FPGAs increasing, the need for larger configuration
storage is also increasing. If your system already contains a common flash
interface (CFI) flash memory, you can utilize it for the FPGA
configuration storage as well. The parallel flash loader (PFL) feature in
MAX® II devices provides an efficient method to program CFI flash
memory devices through the Joint Test Action Group (JTAG) interface
and the logic to control configuration from the flash memory device to the
Altera® FPGA. Figure 1 illustrates the PFL feature.
MAX II CPLD
Passive Serial or
Quartus II Fast-Passive Parallel
Software Interface (2) Altera
PFL
via JTAG FPGA
Common
Flash
Interface
CFI Flash
Memory (1)
Notes to Figure 1:
(1) Refer to Table 1 for the list of supported CFI flash devices.
(2) Fast Passive Parallel (FPP) and Passive Serial (PS) are configuration schemes that
allow configuration data to be loaded to a target device. FPP allows eight bits of
data to be loaded on every clock cycle; PS allows only one bit. For more
information about FPP and PS, refer to the Configuration Handbook.
Altera Corporation 1
AN-386-4.1
Using the Parallel Flash Loader with the Quartus II Software
MAX II CPLD
Altera
Quartus II Configuration Data FPGA
Software PFL
via JTAG
Common Altera FPGA Not Used
Flash for Flash Programming
Interface
CFI Flash
Memory
2 Altera Corporation
MAX II PFL
Common
Flash
Interface
CFI Flash
Memory
The PFL megafunction provides the flexibility to either program the flash
programming or configure the FPGA or perform both functions together.
The benefit of performing the functions separately instead of together is
that fewer logic elements are used. You can use this option if you do not
need to modify the flash data frequently or if you have JTAG/ISP access
to the MAX II device.
3. Compile and generate a programmer object file (POF) for the Flash
Programmer. Ensure that you tri-state all unused I/O pins.
6. Whenever you must program the flash device, program the MAX II
device with the flash programmer POF and update the flash device
contents.
7. Reprogram the MAX II device with the production design POF that
includes the configuration controller.
Altera Corporation 3
Using the Parallel Flash Loader with the Quartus II Software
1 By default, all unused pins are set to ground. If you must keep
the FPGA configuration data during flash programming, you
must tri-state the FPGA configuration pins common to the
MAX II device interface in your flash programming design file.
1 The MAX II device tri-states all I/O pins during the CPLD
programming. However, the MAX II device functions as normal
and does not tri-state the I/O pins during the flash
programming and the FPGA configuration.
Quartus II The Quartus II software generates the PFL megafunction logic for the
programming bridge and configuration. User entry of SRAM Object Files
Software (.sof) and Hexadecimal Files (.hex) in the Quartus II software creates the
Support programming file for the flash memory. Table 1 shows the types of flash
memories, data widths, configuration modes, and file formats supported
by the PFL.
Table 1. Flash Memory, Data Width, Configuration Mode, and File Format Supported by the PFL Feature in
the Quartus II Software (Part 1 of 2)
4 Altera Corporation
Quartus II Software Support
Table 1. Flash Memory, Data Width, Configuration Mode, and File Format Supported by the PFL Feature in
the Quartus II Software (Part 2 of 2)
Notes to Table 1:
(1) All flash devices, except the flash devices listed below, have been tested with POF and are confirmed to be
supported by PFL megafunction.
– Intel Flash 28F256J3 has been discontinued and thus remains untested. However, with the device being
CFI-compliant, the PFL megafunction should be able to support this device. Note that Altera does not recommend
the usage of this flash. For an alternative recommendation, refer to the Intel website.
– ST Micro flash devices are only supported by the Quartus II software version 8.0 and later.
(2) PFL supports top and bottom boot block of the flash devices.
(3) Configuration of an Altera FPGA by the MAX II device through the PFL. Configuration with data compression is
supported. Configuration for Stratix II and Stratix III families also supports data encryption.
(4) Supported file format to program the MAX II device and the flash memory device. Raw Binary file (.rbf) can be
generated for the flash device as well, and you can use your own programmer to program the flash with the data
from the .rbf file.
Altera Corporation 5
Using the Parallel Flash Loader with the Quartus II Software
The logic element (LE) usage for the PFL varies with different PFL and the
Quartus II software settings. The only way to get the exact number on the
LE usage is to compile a PFL design with the exact settings, using the
Quartus II software.
The number of pages and the size of a page depend on individual user or
design. The total number of pages allowed and the size of each page
depend on the density of the flash. These pages allow users to store
designs for different FPGA chains or different designs for the same FPGA
chain in different pages.
When converting the SOF(s) to a POF, three address modes are available
to determine the page address: Block mode, Start mode, and Auto mode.
■ Block mode—Allows you to specify the start and end addresses for
the page.
■ Start mode—Allows you to specify only the start address. The start
address for each page resides on an 8-KByte boundary, which means
that if the first valid start address is 0x000000, the next valid start
address must be an increment of 0x2000.
■ Auto mode—Allows the Quartus II software to automatically
determine the start address of the page. The Quartus II software
aligns the pages on a 128-KByte boundary; for example, if the first
valid start address is 0x000000, the next valid start address must be
an increment of 0x20000.
The option-bit sector stores the start address for each page and the
Page-Valid bits, indicating whether each page is successfully
programmed. The programmer programs the Page-Valid bits after
successfully programming the pages. Always store the option-bits in
unused address locations in the flash memory. The start address for the
option-bit sector must reside on an 8-KByte boundary. You must specify
the start address for the option-bit sector when converting the SOF(s) to
the POF, as well as when creating the PFL megafunction. This procedure
is detailed in “Instantiating the PFL Megafunction in Quartus II
Software” on page 30 and “Converting the SOF(s) to a POF for the Flash
Device” on page 34. Figure 4 shows the page mode and option-bits
implementation in the CFI flash memory.
6 Altera Corporation
Quartus II Software Support
32 Bits
Configuration Data (Page 1)
Page 2 Address + Page-Valid
Page 1 Address + Page-Valid
Page 0 Address + Page-Valid
Configuration Data (Page 0)
0x000000
Notes to Figure 4:
(1) The end address depends on the density of the flash device. For the address range
for devices with different densities, refer to Table 2 .
(2) You must specify the byte address location for the option-bits sector.
Altera Corporation 7
Using the Parallel Flash Loader with the Quartus II Software
Bits 0 to 11 for the Page Start Address are all set to zeros and are not stored
as option bits. Figure 5 shows how the start address and Page-Valid bit for
each page are stored in the option-bit sector. Table 2 shows the byte
address range for CFI devices with different densities.
Figure 5. Page Start Address, End Address, and Page-Valid Bit Stored as
Option Bits
Bit 7...Bit 1 Bit 0
Bit 7...Bit 0
Bit 7...Bit 1
Bit 7...Bit 0
Note to Figure 5:
(1) For flash byte addressing mode.
8 Altera Corporation
Input and Output Signals for the PFL
Input and Output This section explains the input and output signals of the PFL
megafunction. Figure 6 shows the symbol for PFL megafunction
Signals for the supporting both flash programming and FPGA configuration.
PFL
Figure 6. PFL Megafunction Symbol
Table 3 describes the functions of the PFL signals and specifies the
external pull-up resistor required for the configuration pins.
Altera Corporation 9
Using the Parallel Flash Loader with the Quartus II Software
Weak
Pin Description Function
Pull-Up
pfl_nreset Input — Asynchronous reset for the PFL. Pull high to
enable the FPGA configuration. Otherwise,
to prevent FPGA configuration, pull low at all
times when the PFL is not used. This pin
does not affect the flash programming.
pfl_flash_access_granted Input — Used for system-level synchronization. This
pin can be driven by a processor or any
arbitrator that controls access to the flash.
This active high pin should be connected
permanently high if you want the PFL as the
flash master. Pulling it low prevents the
JTAG to access the flash and FPGA
configuration.
pfl_clk (2) Input — User input clock for the device. Frequency
should match the frequency specified in the
megafunction and should not be higher than
the maximum DCLK frequency specified for
the specific FPGA during configuration. (1)
fpga_pgm[2..0] (2) Input — Determines the page to be used for the
configuration.
fpga_conf_done (2) Input 10-kΩ Connects to the CONF_DONE pin of the
Pull-Up FPGA. The FPGA releases the pin high if
Resistor configuration is successful.
fpga_nstatus (2) Input 10-kΩ Connects to the nSTATUS pin of the FPGA.
Pull-Up FPGA pulls the pin low if a configuration
Resistor error occurs.
pfl_nreconfigure (2) Input — Initiates a reconfiguration of the FPGA. This
pin can be connected to a switch where you
can select a high or low input. A low input
initiates a reconfiguration of the FPGA.
pfl_flash_access_request Output — Used for system-level synchronization. This
pin can be connected to a processor or
arbitrator, if needed. The PFL drives this pin
high when JTAG accesses the flash or PFL
configures the FPGA. This output pin works
in conjunction with the flash_noe and
flash_nwe pins.
flash_addr[x..0] Output — Address inputs for memory addresses. The
most significant bit (MSB) depends on the
density of the flash device as well as the
width of the flash_data bus.
10 Altera Corporation
Input and Output Signals for the PFL
Weak
Pin Description Function
Pull-Up
flash_data[x..0] Input/ Output — Data bus to transmit or receive 8- or 16-bit
(bidirectional data to or from the flash memory in parallel.
pin) (3)
flash_nce Output — Connects to the CE pin of the flash device. A
low signal enables the flash device.
flash_nwe Output — Connects to the WE pin of the flash device. A
low signal enables write operation to the
flash device.
flash_noe Output — Connects to the OE pin of the flash device. A
low signal enables the outputs of the flash
device during a read operation.
flash_clk (4) Output — For burst mode. Connects to the CLK input
pin of the flash device. The active edges of
CLK increment the flash device internal
address counter.
flash_nadv (4) Output — For burst mode. Connects to the address
valid input pin of the flash device. This signal
is used for latching the start address.
flash_nreset (4) Output — For burst mode. Connects to the reset pin of
the flash device. A low signal resets the
flash device.
fpga_data[x..0] (2) Output — Data output from the flash to the FPGA
device during configuration. For PS mode,
this will be a 1-bit bus fpga_data[0] data
line. For FPP mode, this will be an 8-bit
fpga_data[7..0] data bus.
fpga_dclk (2) Output — Connects to the DCLK pin of the FPGA.
Clock input data to the FPGA device during
configuration.
Altera Corporation 11
Using the Parallel Flash Loader with the Quartus II Software
Weak
Pin Description Function
Pull-Up
fpga_nconfig (2) Open Drain 10-kΩ Connects to the nCONFIG pin of the FPGA.
Output Pull-Up A low pulse resets the FPGA and initiates
Resistor configuration. (3)
Notes to Table 3:
(1) For maximum FPGA configuration DCLK frequencies, refer to the Configuration Handbook.
(2) These pins are not available for the flash programming option in the PFL megafunction.
(3) You should not insert any logic between PFL pins and MAX II I/O pins especially on flash_data and
fpga_nconfig pins.
(4) The flash_clk, flash_nadv, and flash_nreset pins are used for burst mode only. Do not connect these pins
from the flash device to the MAX II device if you are not using burst mode.
1 Altera recommends that you enable the safe state machine setting to avoid the PFL from
going into undefined states. You can set this option by clicking More Settings on the
Analysis & Synthesis Settings page in the Settings dialog box from the Assignments
menu.
f For more details about the FPGA configuration, refer to the Configuration
Handbook.
12 Altera Corporation
Input and Output Signals for the PFL
pfl_flash_access_request
ADDR flash_addr fpga_conf_done CONF_DONE
DATA flash_data fpga_nstatus nSTATUS
nWE flash_nwe fpga_nconfig nCONFIG
nCE flash_nce fpga_data (2) DATA
nOE flash_noe fpga_dclk DCLK
WP#/ACC nCE nCEO NC (3)
BYTE#
Nios II Processor Interface (4)
flash_access_request
flash_access_granted
ext_ram_bus_addr
ext_ram_bus_data
write_n_to_ext_flash
chip_n_to_ext_flash
output_n_to_ext_flash
WP#/ACC
BYTE#
Notes to Figure 7:
(1) The pull-up resistor should be connected to a supply that provides an acceptable input signal for the devices. VCC
should be high enough to meet the VIH specification of the I/O on both devices. For example, the Stratix II VIH
specification is in the range of 1.7 to 3.3 V; therefore the supply for the pull-up resistor, VCC, must be within 1.7 to
3.3 V to meet the VIH specification.
(2) For PS configuration mode, this is a 1-bit data line. For FPP configuration mode, this is an 8-bit data bus.
(3) Do not connect anything to NC pin (no connect pin), not even VCC and Gnd.
(4) Nios II processor can be implemented in any other Altera FPGA apart from the FPGA that is being configured.
Altera Corporation 13
Using the Parallel Flash Loader with the Quartus II Software
Altera FPGA 2
CONF_DONE
nSTATUS
nCONFIG
DATA
DCLK
nCE nCEO NC
Notes to Figure 8:
(1) The pull-up resistor should be connected to a supply that provides an acceptable input signal for the devices.
VCC should be high enough to meet the VIH specification of the I/O on both devices. For example, the Stratix II VIH
specification is in the range of 1.7 to 3.3 V; therefore the supply for the pull-up resistor, VCC, must be within 1.7 to
3.3 V to meet the VIH specification.
(2) For PS configuration mode, this is a 1-bit data line. For FPP configuration mode, this is an 8-bit data bus.
14 Altera Corporation
PFL Design Example
PFL Design The PFL megafunction is able to support flash programming and
multiple FPGA configurations, and at the same time allow another
Example processor to access the flash device. This approach is useful if you need
an alternative way to program the flash device other than through the
PFL megafunction, or if you need to allow another processor to access the
flash device. For example, you can use the PFL megafunction to program
the flash and configure the FPGA with a Nios II processor. The Nios II
processor that is configured utilizes the non-configuration data stored in
the same flash device.
Altera Corporation 15
Using the Parallel Flash Loader with the Quartus II Software
Figure 9. Relationship between the Four Major Sections in the Design Example
pfl_flash_ pfl_flash_
access_ access_
granted request
Altera FPGA
with
Nios II Processor
PFL Megafunction
To create the PFL megafunction, refer to “Instantiating the PFL
Megafunction in Quartus II Software” on page 30. Make sure the tri-state
all flash bus pin option in the PFL megawizard is turned on when not in
use to ensure that the PFL megafunction does not drive out. You need to
tri-state all outputs from the PFL megafunction manually with tri-state
buffers if you are using the Quartus II software version 6.0 or earlier.
Nios II Processor
You can create the Nios II system by using the Quartus II SOPC Builder.
The following steps briefly demonstrate how to generate the Nios II
system in SOPC Builder.
Components Settings
The Nios II processor Nios II/s, JTAG debug module level 1
Avalon-MM Tri-state Bridge Registered
16 Altera Corporation
PFL Design Example
Components Settings
CFI Flash Memory AM29LV128MH
JTAG UART Default setting (this component is required if you
are using JTAG interface to configure the Nios II
processor into the Altera FPGA)
4. From the Edit menu, add the Nios II system that was created into
the block diagram by selecting Insert Symbol. Select the Nios II
system from the libraries window. The flash_test module in
Figure 10 is the Nios II system built in the design example.
5. Compile the project and configure the Altera FPGA when you have
completed the pin assignments and the connection to the Nios II
system. The address, data, read, select, and write from the Nios II
system connect to the address, data, output enable, chip enable, and
write enable of the flash device, respectively.
Altera Corporation 17
Using the Parallel Flash Loader with the Quartus II Software
After creating the Nios II processor, you can run the Nios II flash
programmer. There are two modes in the flash programmer: the
integrated development environment (IDE) mode and the
Command-Line mode. The Nios II IDE mode provides an easy-to-use
interface to the flash programmer features while the Command-Line
mode is for advanced users. The Command-Line mode provides
complete control over the flash programmer features.
f For more information about the IDE and Command-Line modes, refer to
the Nios II Flash Programmer User Guide.
Note that you need to configure the Altera FPGA with the Nios II
processor whenever you power up your board. You can store the Nios II
processor image into the flash device and use the PFL megafunction to
configure the Altera FPGA with the Nios II processor whenever you
power up your board. If you store the Nios II processor image in the same
flash device that you intend to program, make sure that you do not
overwrite the Nios II image when you program the flash device with
other user data. Another option is to store the Nios II image in other
storage devices such as EPC and EPCS devices.
18 Altera Corporation
PFL Design Example
Flash Device
For the flash device, take note of the byte enable pin. Pulling this pin low
places the flash device in ×8 data width mode. A high input to this pin
places the flash device in ×16 data width mode. The PFL megafunction
and the Nios II processor data pin must be assigned according to the data
width mode you have selected.
The read or write access time depends on the flash device type. In the PFL
megafunction, the write access time is encoded into the PFL
megafunction. You do not need to specify the write access time but you
would need to specify the read access time in the PFL megawizard. As for
the Nios II system, you need to specify the read or write access time if you
select the custom flash option. Refer to the flash device datasheet for the
read or write access time. Note that the PFL megafunction and the Nios II
system are not able to perform a selective read during a write operation
as the data bus only allows single directional data. It does not support
bidirectional flow of data concurrently.
Altera Corporation 19
Using the Parallel Flash Loader with the Quartus II Software
Table 5. pfl_flash_access_request and pfl_flash_access_granted Pins with Nios II and PFL Megafunction
For the PFL megafunction, the tri-state all flash bus pin when not in use
option disables the PFL megafunction whenever
pfl_flash_access_granted pin receives a low input. This option is
only available in the Quartus II software version 6.1 and later. You need
to tri-state all outputs from the PFL megafunction manually with tri-state
buffers if you are using Quartus II software version 6.0 or earlier.
20 Altera Corporation
PFL Design Example
Figure 11. Nios II Processor and the PFL Megafunction Accessing the Flash Device
Nios II processor connects By default, Nios II processor is connected to the flash device.
to the flash device All PFL megafunction output pins are tri-stated.
PFL megafunction requests PFL megafunction pulls the pfl_flash_access_request pin high
for access to flash device to request access to the flash device.
Nios II processor receives Nios II processor tri-states all output pins to flash device and routes
the PFL megafunction the output of pfl_flash_access_request to pfl_flash_access _granted.
PFL megafunction releases The PFL megafunction pulls the pfl_flash_access_request output pin low
the flash device when it accesses the flash device.
You need to specify the flash device read or write access time in your
processor or controller as well. Make sure that the output pins from your
processor are tri-stated when access request is high to avoid data
contention when the PFL megafunction is accessing the flash device.
Altera Corporation 21
Using the Parallel Flash Loader with the Quartus II Software
PFL and Flash Figures 12 through 15 show the address connections between the PFL and
flash device. The address connections vary depending on the flash
Address vendors and data bus width.
Mapping
Figure 12. Intel J3 Flash Memory in 8-Bit Mode and Intel C3, P30, and P33
Flash Memories in 16-Bit Mode Note (1)
PFL Flash Memory
address: 24 bits address: 24 bits
23 23
22 22
21 21
- -
- -
- -
2 2
1 1
0 0
22 23
21 22
20 21
- -
- -
- -
2 3
1 2
0 1
22 Altera Corporation
PFL and Flash Address Mapping
Figure 14. Spansion and ST Micro Flash Memory in 8-Bit Mode Note (1)
PFL Flash Memory
address: 24 bits address: 24 bits
23 22
22 21
21 20
- -
- -
- -
2 1
1 0
0 D15
Figure 15. Spansion and ST Micro Flash Memory in 16-Bit Mode Note (1)
PFL Flash Memory
address: 23 bits address: 23 bits
22 22
21 21
20 20
- -
- -
- -
2 2
1 1
0 0
Altera Corporation 23
Using the Parallel Flash Loader with the Quartus II Software
PFL This section provides the equations to estimate the time required to
configure the FPGA with the PFL megafunction. The estimated time
Configuration derived from these equations is only valid for the Quartus II software
Time version 7.2 and later.
Table 6. Equations for the PFL Version 7.2 Note (1) (Part 1 of 3)
24 Altera Corporation
PFL Configuration Time
Table 6. Equations for the PFL Version 7.2 Note (1) (Part 2 of 3)
Altera Corporation 25
Using the Parallel Flash Loader with the Quartus II Software
Table 6. Equations for the PFL Version 7.2 Note (1) (Part 3 of 3)
Total clock cycles (from nRESET asserted high to N bytes of data clocked out)
= Coverhead + max(Cflash, Ccfg) * N
Note to Table 6:
(1) Cflash represents the number of clock cycles required to read from flash.
Ccfg represents the number of input clock cycles to clock out the data (producing between 1 and 16 DCLK cycles, depending
on the choice of flash data bus width and FPP/PS mode). The process of reading from the flash and clocking out the data
for configuration are performed in parallel, so only the larger number between Cflash and Ccfg is important.
Fclk represents the input clock frequency to the PFL.
Taccess time represents the flash access time.
Caccess represents the number of clock cycles needed before the data from the flash is ready.
N represents the number of bytes to be clocked out. This value can be obtained from the .rbf file for the specific FPGA.
(2) Spansion Page Mode support is only available in Quartus II software version 8.0 and later
26 Altera Corporation
Using the PFL in Quartus II Software
Using the PFL in This section describes the steps for using the PFL feature with the
Quartus II software. The process includes:
Quartus II
Software 1. The instantiation of the PFL megafunction in the user design.
2. Converting the SOF(s) that contains the configuration data for the
Altera FPGA to a POF specifically for the flash device.
3. Programming the POF into the flash device through the MAX II
device using the Quartus II Programmer.
By default, all unused pins are set to ground. It is advisable to set all
unused pins to tri-state because doing otherwise may cause interference.
To set this, on the Assignments menu, select Device, then click Device
and Pin Options. Next, click Unused Pins and select an item from the
Reserve all unused pins drop-down list (Figure 16).
Altera Corporation 27
Using the Parallel Flash Loader with the Quartus II Software
28 Altera Corporation
Using the PFL in Quartus II Software
Figure 17 shows the steps for using the PFL. The Quartus II software does
not support simulation of the JTAG pins or the programming process of
the MAX II or flash device. However, simulation is possible for FPGA
configuration but with the condition that there are proper flash vectors
and FPGA responses. Examples of the flash vectors are flash_addr and
flash_data; examples of the FPGA responses are fpga_conf_done
and fpga_nstatus.
Compile
& Obtain Add SOF(s) for conversion to POF
MAX II
POF
Convert to
POF for
Add MAX II POF to
Targeted
Quartus II Programmer
Flash
Altera Corporation 29
Using the Parallel Flash Loader with the Quartus II Software
6. Specify the directory and output filename. The dialog box should
now be similar to Figure 18. Click Next.
30 Altera Corporation
Using the PFL in Quartus II Software
Altera Corporation 31
Using the Parallel Flash Loader with the Quartus II Software
8. Click Next.
32 Altera Corporation
Using the PFL in Quartus II Software
Altera Corporation 33
Using the Parallel Flash Loader with the Quartus II Software
10. Figure 21 shows the files that can be created for the megafunction.
Choose any additional file types that you want to create and click
Finish. The Quartus II software generates the PFL megafunction in
the form of the HDL file you specified as well as any additional files
(if specified).
Figure 21. Selecting the Output File Type for the PFL Megafunction
34 Altera Corporation
Using the PFL in Quartus II Software
3. Select the CFI device with the correct density for the configuration
device (for example, CFI_32Mb means CFI device with 32-Mbit
capacity).
4. To add in the configuration data, select SOF Data under Input files
to convert. Click Add File and browse to the SOFs you want to add.
You can place more than one SOF into the same page if you intend to
configure a chain of FPGAs. The order of the SOFs should follow the
order of the devices in the chain.
If you want to store the data from another SOF in another page, click
Add Data. Add the SOF(s) to that new page.
Altera Corporation 35
Using the Parallel Flash Loader with the Quartus II Software
5. To set the page number and name, select SOF Data and click
Properties. Figure 23 shows the SOF Data Properties dialog box.
6. Under Address mode for selected pages, select Auto to let the
Quartus II software automatically set the start address for that page.
Select Block to specify the start and end addresses, or select Start to
specify the start address only. Click OK.
7. You can also store user data (HEX file format) in the flash device:
b. In the Add Hex Data dialog box, you can choose either absolute
or relative addressing mode.
If you select absolute addressing mode, the data in the HEX file is
programmed into the flash device at the exact same address location
listed in the HEX file. If you select relative addressing mode, you are
allowed to specify a start address. The HEX file data is programmed
into the flash with the specific start address, and the differences
between the addresses are kept. If no address is specified, the
Quartus II software will select an address.
36 Altera Corporation
Using the PFL in Quartus II Software
1 You cannot create the flash POF by using the HEX file only.
You must add in an FPGA SOF when creating the flash POF.
8. Click Options to specify the start address where the option bits are
stored. This start address should be identical to the address
specified when creating the PFL megafunction. Make sure that the
option-bit sector does not overlap with the configuration data
page(s) and the start address resides on an 8-KByte boundary.
Altera Corporation 37
Using the Parallel Flash Loader with the Quartus II Software
1. Open the Quartus II Programmer window and click Add File to add
the POF for the MAX II device.
38 Altera Corporation
Using the PFL in Quartus II Software
4. Right-click the flash device density added and click Change File, as
shown in Figure 27. Then select the POF generated for the flash
device. The POF for the flash device is attached to the POF for the
MAX II device.
Altera Corporation 39
Using the Parallel Flash Loader with the Quartus II Software
5. Add other programming files if your chain has other devices. You
can only program one flash device in the chain at a time as the
Quartus II Programmer only allows you to attach the flash POF to
one MAX II device in the chain at a time. To program another flash
device associated with another MAX II device in the chain, you
must delete the flash POF for the first MAX II device and add in the
flash POF for the next MAX II device in the chain.
6. Check the boxes under the Program/Configure column for the POF
that was added (Figure 28) and click Start to program the MAX II
device and flash device.
40 Altera Corporation
Creating Jam File for MAX II and Flash Device Programming
1 If you intend to use the flash device to store user data only, pull
the pfl_nreset pin low at all times to prevent FPGA
configuration.
Creating Jam Jam programming files can be created to program the MAX II device and
the flash device.
File for MAX II
and Flash 1. Open the Quartus II Programmer and add in the MAX II POF and
flash POF (follow steps 1 through 5 in “Programming MAX II and
Device Flash Devices” on page 38).
Programming 2. On the File menu, point to Create/Update and click Create JAM,
SVF, or ISC File.
3. Enter a name and select the file format (.jam). Click OK.
The Jam files can be used with the Quartus II Programmer or the
quartus_jli executable.
Altera Corporation 41
Using the Parallel Flash Loader with the Quartus II Software
PFL With the correct simulation vectors, you can simulate the configuration
part of the PFL using the Quartus II Simulator to understand the
Configuration configuration behavior of the PFL. Simulation with the Quartus II
Simulation Simulator can be performed using the Vector Waveform File (.vwf) and a
simple VHDL file that represents a flash device. This VHDL file is
available with this application note. With the correct input vectors
supplied to the input of the PFL, you can see the correct output from the
megafunction in the simulation waveform.
Before you start the simulation, you must instantiate the PFL
megafunction and create a symbol for your flash device VHDL file in
your design if you use block diagrams as the design entry. This example
uses block diagrams as design entry.
42 Altera Corporation
PFL Configuration Simulation
You can change the flash device density by editing the VHDL file
manually. To create a symbol for this file, on the File menu, point to
Create/Update and click Create Symbol Files for Current File. Make
sure the VHDL file is open when you create the symbol. The flash device
symbol appears in the Symbol window.
Altera Corporation 43
Using the Parallel Flash Loader with the Quartus II Software
You can start creating the vector waveform file after you have instantiated
the megafunction, connected all the ports to input, output or bidirectional
pins, and compiled your design. The new vector waveform file must have
an end time of at least 200 µs.
The input vectors assigned to the input ports of the PFL in the vector
waveform file for this example are provided in Table 8.
Input Setting
pfl_clk 36 MHz clock input
fpga_conf_done low means configuration is not complete
fpga_nstatus high means the FPGA device is ready for configuration
fpga_pgm[2:0] set to 000, meaning the PFL reads from page 0 in the flash for
configuration
pfl_flash_access_granted high means the PFL can access the flash
pfl_nreset high means the PFL is out of the reset state
pfl_nreconfigure high means no reconfiguration is required
flash_data this bidirectional bus contains the data read out for the option bits and
the FPGA configuration data
44 Altera Corporation
PFL Configuration Simulation
The option bit start address is 0x1FE000, which is specified when the PFL
megafunction is instantiated. Initially, the PFL reads from address
0x1FE0080, which is the last address of the option bit sector. This address
stores the version information of the POF used for programming the flash
and this information does not affect the configuration process. Because
the fpga_pgm[2..0] is set to 000, the PFL reads from address 0x1FE000
to 1FE003 to get the start and end addresses for page 0, and also the
page-valid bit, which is the LSB in address 0x1FE000.
For the configuration to proceed, the page-valid bit must be 0. During the
time the PFL reads from the flash, the PFL asserts the flash_nce and
flash_noe signals low, and the pfl_flash_access_request signal
high. Figure 32 shows the PFL reading the option bits from the flash
before configuration starts.
Altera Corporation 45
Using the Parallel Flash Loader with the Quartus II Software
After reading the option bits for page 0, there is a waiting period before
configuration starts. Because the flash_data bus contains 0xZZ after
the option bits are read, the configuration data read out from the flash is
0xZZ. The configuration starts when the fpga_dclk starts to toggle and
the fpga_data[0] is the configuration data being sent to the FPGA.
Since the MSB of the flash contains the LSB of the configuration data, the
simulation waveform shows that the configuration data is the toggle data
of the flash data with the eight fpga_dclk pulses. During configuration,
the PFL asserts the flash_nce and flash_noe signals low and the
pfl_flash_access_request signal high. Figure 33 shows the start of
the configuration. When the configuration starts, the flash_data bus
contains 0x11. From the waveform, you can see that the configuration
data is the toggle of the flash_data, 0x88.
46 Altera Corporation
PFL Configuration Simulation
Altera Corporation 47
Using the Parallel Flash Loader with the Quartus II Software
Conclusion The MAX II PFL feature enables you to use CFI flash memories and
MAX II devices to store FPGA configuration data and control
configuration of Altera FPGAs.
Referenced ■ AN 341: Using the Design Security Feature in Stratix II and Stratix II GX
Devices
Documents ■ AN 425: Using Command-Line Jam STAPL Solution for Device
Programming
■ Configuration Handbook
■ Nios II Flash Programmer User Guide
■ Nios II Processor Reference Handbook
■ Quartus II Simulator chapter in volume 3 of the Quartus II Handbook
■ SOPC Builder Components chapter in volume 4 of the Quartus II
Handbook
48 Altera Corporation
Document Revision History
Revision History
Altera Corporation 49
Using the Parallel Flash Loader with the Quartus II Software
50 Altera Corporation
Document Revision History
Copyright © 2008 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
101 Innovation Drive applications, maskwork rights, and copyrights. Altera warrants performance of its semiconductor products
San Jose, CA 95134 to current specifications in accordance with Altera's standard warranty, but reserves the right to make
www.altera.com 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
Literature Services: herein except as expressly agreed to in writing by Altera Corporation. Altera customers
[email protected] are advised to obtain the latest version of device specifications before relying on any
published information and before placing orders for products or services.
Altera Corporation 51