Generic Serial Flash Interface Intel® FPGA IP User Guide

ID 683419
Date 4/20/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

1.8.6. Program Flash

The following registers are used to perform program flash:

  • Operating protocols setting
  • Control register
  • Write instruction

Perform Page Program (Extended Mode)

proc page_program { } {
global mp operating_protocols_setting control_register write_instr
master_write_32 $mp $operating_protocols_setting 0x00000000
master_write_32 $mp $control_register 0x00000001
master_write_32 $mp $write_instr 0x00007002
master_write_32 $mp 0x00001000 0x1234abcd
 }

To perform the page program for the extended mode, follow these steps:

  1. Define the global variables.
  2. Write to the operating protocols setting register to set the transfer mode of the program operation. In this example, the transfer mode for read is (1-1-1).
    1. Set the instruction transfer mode [1:0] to 0, write address transfer mode [5:4] to 0, and write data in transfer mode [9:8] to 0.
  3. Write to the control register to choose the byte addressing mode of the write operation.
    1. This example is using the 3-byte addressing mode. Set bit 8 to 0.
  4. Write to the write instruction register to customize the program operation.
    1. Set the write operation code [7:0] to 02 as 02h is the operation code for page program.
    2. Set the polling operation code [15:8] to 70 as 70h is the operation code for the read flag status register. After completing the write operation, the IP core releases the wait request of the Avalon® memory-mapped interface. For the flash that does not have the read flag status register, you can use the read status register (05h).
  5. After setting the registers, you can start to program the memory into the address.
    1. In this example, 1234abcdh is written to the memory address 0x00001000.

Perform 4-byte Quad Input Fast Program (Quad SPI Mode)

proc fourbyte_quad_input_fast_program { } {
global mp operating_protocols_setting control_register write_instr
master_write_32 $mp $operating_protocols_setting 0x00000222
master_write_32 $mp $control_register 0x00000101
master_write_32 $mp $write_instr 0x00007034
master_write_32 $mp 0x00002000 0xabcd1234
}

To perform the 4-byte quad input fast program, follow these steps:

  1. Define the global variables.
  2. Write to the operating protocols setting register to set the transfer mode of the program operation. In this example, the transfer mode for 4-byte quad input fast program is (4-4-4).
    1. Set the instruction transfer mode [1:0] to 2, write address transfer mode [5:4] to 2, and write data in transfer mode [9:8] to 2.
  3. Write to the control register to choose the byte addressing mode of the write operation.
    1. This example is using the 4-byte addressing mode. Set bit 8 to 1.
  4. Write to the write instruction register to customize the program operation.
    1. Set the write operation code [7:0] to 34 as 34h is the operation code for the 4-byte quad input fast program.
    2. Set the polling operation code [15:8] to 70 as 70h is the operation code for the read flag status register. After completing the write operation, the IP core releases the wait request of the Avalon® memory-mapped interface. For the flash that does not have the read flag status register, you can use the read status register (05h).
  5. After setting the registers, you can start to program the memory into the address.
    1. In this example, 1234abcdh is written to the memory address 0x00002000.