Reading image, sound, binary file from nonvolatile memory for FPGA

eepromflashfpgavhdl

For applications that require design on FPGA which shall make use of several image files, sound files or other forms of files, can they be simply included in the FPGA design configuration file? In any case if these things are stored in an external flash or EEPROM memory, is there a reference design that:

  1. Shows how to put them in this external memory
  2. Create a design which knows where to read in the external memory
  3. It reads it and then send this data to the output device?

Best Answer

Well, it really depends on how big your data is, how often you need access to it, and what sort of bandwidth you need. There is no good 'one size fits all' solution to this.

For small data, on-FPGA block RAM is a good option. The on-chip block RAM can be initialized from the bitstream data, so it can be used as a ROM. The on-chip location of the block RAM also provides the highest possible bandwidth. No external pins are required. However, the block RAM is very limited in size, so don't waste this resource unless absolutely necessary. It is also not really possible for the FPGA to edit the ROM entries as it would have to edit the initialization data for the block RAM in the bitstream (a far from trivial operation), so they are really only useful for constant storage or volatile storage.

Now, as for external nonvolatile memory, this is a bit more difficult. There are many different types of memory that could be used, with many different protocols. This could range from a simple I2C or SPI flash chip or SD card, to a parallel NOR flash or NAND flash, to an SSD or HDD connected via SATA or PATA, to accessing a file server or SAN over Ethernet. What makes sense depends on how big your data is, the access latency required, and the access bandwidth required. Connections over I2C or SPI will be very slow, perhaps up to a couple of MB per second. However, the protocols are very simple. So if you just need to stream 48 ksps audio data, this could be a good option. However, this will not work for something that requires a lot of bandwidth like full HD video. For something like that, you would need an interface with a lot more bandwidth. This is where the engineering can get a bit challenging - large, fast storage is not easy to interface with. One option might be to bring up a SATA interface and connect a large SSD. There will be some latency requesting the data, but you'll be able to stream many gigabytes of data off of the device at several hundred Mbps.

Also, don't forget that you will probably need some way to write to the nonvolatile storage as well. If this needs to be done at high bandwidth, then that means you will need some other interface to the outside world. Ethernet and USB 3 are reasonable options.

Related Topic