An 379
An 379
An 379
Introduction If you are designing with Altera® Stratix® II, Cyclone™ II, or Cyclone
FPGAs, the active serial memory interface (ASMI) controller reference
design is useful in accessing the unused portion of Altera EPCS1, EPCS4,
EPCS16, and EPCS64 serial configuration devices. The Nios® II
embedded processor also provides a complete solution for this capability
by using the EPCS Controller module in SOPC Builder.
This reference design provides a top-level design to write to, read from,
or erase data on the serial configuration device. By using this reference
design, you do not need to be concerned with the protocol needed to read
from or write to the memory in the serial configuration device. The ASMI
controller reference design handles the protocol. You can use this
reference design for all serial configuration devices (EPCS1, EPCS4,
EPCS16, and EPCS64 devices). The MSEL pin settings must be set to
Active Serial (AS) mode (Stratix II, Cyclone II, and Cyclone devices) or
Fast Active Serial (FAS) mode (Stratix II and Cyclone II devices) so that
the FPGA’s ASMI is always enabled.
Altera Corporation 1
AN-379-1.0 Preliminary
Active Serial Memory Interface Controller Reference Design
Port Names of Table 1 provides a brief description for the input and output ports found
on the top level of this reference design, which is the ASMI_CONTROLLER
ASMI_ module.
CONTROLLER
2 Altera Corporation
Preliminary
Port Names of ASMI_ CONTROLLER
Altera Corporation 3
Preliminary
Active Serial Memory Interface Controller Reference Design
Block Diagram Figure 1 shows a simplified block diagram for the ASMI_CONTROLLER
module. You can remove any sub-block inside the ASMI_CONTROLLER
module to reduce the number of logic elements (LEs) used, or add your
own code to the module.
4 Altera Corporation
Preliminary
Block Diagram
ASMI_CONTROLLER
read_block
ASDI
erase_sector_block
stratixii_asmiblock, nCS
CLK_DIVIDER cycloneii_asmiblock,
User Design
or cyclone_asmiblock. DCLK
erase_bulk_block
DATA
read_silicon_id_block
write_status_block
Altera Corporation 5
Preliminary
Active Serial Memory Interface Controller Reference Design
Included Files Table 2 provides the directory structure of the deliverables in this
reference design release:
Write to Serial While writing data to the serial configuration device memory, the serial
configuration device only allows you to change the bits in the memory
Configuration from 1 to 0 since it is serial flash memory. For example, if the initial data
Device in the address 0×070000 is 0×EC and you try to write a data byte 0×79
in the same address using the write_bytes operation, the data in that
address becomes 0x68 since the bit0 and bit4 of the initial data byte
0×EC cannot be changed from 0 to 1.
To change bits from 0 to 1, you have to erase the targeted sector memory
or erase all memory in the serial configuration device. Therefore, it is
important to carefully plan when writing data bytes to the serial
configuration device memory.
6 Altera Corporation
Preliminary
Write to Serial Configuration Device
overwrite the configuration data in the EPCS device during user mode,
you must replace it with valid configuration data for the selected FPGA
before the next configuration cycle is initiated.
Figures 2 through 7 show the timing diagrams for the ASMI Controller.
rden (1)
DCLK
24-bit Address
ASDO
nCSO
Notes to Figure 2:
(1) The rden signal is asynchronous with DCLK. When rden is de-asserted, the read_bytes operation stops
immediately.
(2) The DATA signal is truncated after the rden signal is de-asserted.
(3) The last read_addr signal is valid before the rden signal is de-asserted. The read_addr signal is then reset after
the rden signal is de-asserted.
(4) The last data read is valid before the rden signal is de-asserted. The data_read value is not reset after the rden
signal is de-asserted.
Altera Corporation 7
Preliminary
Active Serial Memory Interface Controller Reference Design
wren (1)
DCLK
24-bit Address
ASDO Data Write 1
nCSO
DATA
num_of_bytes
write_In_progress
write_clk
wren (1)
DCLK
ASDO
nCSO
DATA
data_write
addr
num_of_bytes
write_In_progress
write_clk
Note to Figure 3:
(1) Assert the wren signal until the write_in_progress signal goes low.
8 Altera Corporation
Preliminary
Write to Serial Configuration Device
read_sid (1)
DCLK
3 dummy
ASDO
bytes
nCSO
DATA
Notes to Figure 4:
(1) Assert the read_sid signal until a valid epcs_id[7..0] value is obtained.
(2) The valid epcs_id[7..0] bus value is 0×10 (EPCS1), 0×12 (EPCS4), 0×14 (EPCS16), or 0×16 (EPCS64).
Altera Corporation 9
Preliminary
Active Serial Memory Interface Controller Reference Design
erase_sector (1)
DCLK
24-Bit Address
ASDO
nCSO
DATA
es_in_progress
erase_sector (1)
DCLK
ASDO
nCSO
DATA
es_in_progress
Note to Figure 5:
(1) The rising edge of the erase_sector signal triggers the erase_sector operation. The erase_sector signal is
not level-sensitive.
10 Altera Corporation
Preliminary
Write to Serial Configuration Device
erase_bulk (1)
DCLK
ASDO
nCSO
DATA
eb_in_progress
erase_bulk (1)
DCLK
ASDO
nCSO
DATA
eb_in_progress
Note to Figure 6:
(1) The rising edge of the erase_bulk signal triggers the erase_bulk operation. The erase_bulk signal is not
level-sensitive.
Altera Corporation 11
Preliminary
Active Serial Memory Interface Controller Reference Design
wrstatus (1)
DCLK
8-Bit
Status Register
ASDO
nCSO
DATA
ws_in_progress
wrstatus (1)
DCLK
ASDO
nCSO
WS_In_Progress
Note to Figure 7:
(1) Assert the wren signal until the ws_in_progress signal goes low.
How to Read You can use the Quartus® II Programmer during the prototyping stage to
read back all the data in your serial configuration device, verifying that
Back All Serial your design is working.
Configuration
Data Using the Step 1: Read Back the Data in Programmer Object File Format
Quartus II In Step 1, perform the following steps:
Software 1. Open the Quartus II Programmer and connect the download cable
(ByteBlaster™ II or USB Blaster™ cable) to the AS programming
interface.
12 Altera Corporation
Preliminary
How to Read Back All Serial Configuration Data Using the Quartus II Software
Figure 8. Examine the Data in EPCS Device using the Quartus II Programmer
Altera Corporation 13
Preliminary
Active Serial Memory Interface Controller Reference Design
Quartus II Fitter The Quartus II Fitter, which is also known as the PowerFit™ Fitter,
performs place and route, which is also referred to as “fitting” in the
Quartus II software. Using the database created by Quartus II Analysis &
Synthesis, the Fitter matches the logic and timing requirements of the
14 Altera Corporation
Preliminary
Conclusion
1 Since the Quartus II Fitter cannot fit more than one asmiblock,
do not insert more than one asmiblock in your design during
compilation. If you insert more than one asmiblock in your
design, a fitter error will occur during compilation in the
Quartus II software. Therefore, if you already use a Nios II
processor and include the EPCS Controller module in your
design, you should not include the ASMI_CONTROLLER
reference design in your design, or vice versa.
Conclusion When using Altera FPGAs, the ASMI reference design allows you to
interface on-the-fly with serial configuration devices. Since serial
configuration devices have non-volatile memory, you are able to
customize this reference design to store your data.
You can use the Quartus II Programmer during the prototyping stage to
read back all the data in your serial configuration device and convert the
read back POF to a RPD file.
Support If you have additional questions with the reference design provided,
contact Altera Applications at www.altera.com/mysupport.
Altera Corporation 15
Preliminary