Coming from the world of microcontrollers, I have recently purchased a Terasic De0 Nano SoC FPGA board and currently testing small projects focusing on the FPGA fabric of the chip.
While trying to build a VGA controller, I used an "On-Chip Memory" component to store pixel data at the beginning. However, as the FPGA memory space is not enough to hold a frame for a common VGA resolution, the external SDRAM needs to be used. For the De0 nano SoC board, the SDRAM chips are connected to the HPS portion of the chip, so a bridge between the FPGA fabric and the HPS needs to be implemented.
I am not interested (at the moment) into having a memory space which will be transparent to HPS as well, so as a first step, I limited the SDRAM used by the HPS (which boots into Linux from an SD card) from 1GB to 768MB.
To do this, while in uboot, the following commands need to be entered:
setenv mmcboot "setenv bootargs console=ttyS0,115200 root=${mmcroot} rw rootwait mem=768M;bootz ${loadaddr} - ${fdtaddr}"
saveenv
If for any reason you need to go back to the default setup then the following commends need to be entered:
env default -a
saveenv
It was interesting to see that if I reduced the SDRAM to 512MB, then Linux could not start (error while booting), I don't know if anyone else can confirm this behavior.
So, if I understand correctly, there are now 256MB for the FPGA to play with, which will not interfere with the hard processor.
The Golden Hardware Reference Design (GHRD) project, provided as an example in the documentation includes all the settings for the setup of the HPS in QSYS and the port mapping of all the pins.
However, even if the SDRAM timings are set on the GHRD, an FPGA-to-HPS SDRAM interface is not setup. Moreover, this interface can be either Avalon or AXI based.
So my questions are:
1) Is there any example project which implements the complete bridge from the FPGA to the SDRAM controller?
2) Would an Avalon type SDRAM interface be more preferable, so as to resemble to the On-chip memory component, which is fairly straight forward to implement?
3) What components need to be added in QSYS to complete the connection?
Thanks in advance!