Read/WriteRAM memory from FPGA side


Hello. I’m using de0-nano-SoC kit for some experiments. I’v already figure out how to access to the RAM memory from HPS side, I can read or write data there (trough /dev/mem). So I don’t have problems with Linux/“C” part.

The next step is writing/read data from FPGA. I use DE0_NANO_SOC_GHRD as base project. It has “onchip_memory2_0” added in Qsys, so I didn’t make any changes there. Then I’v added “RAM: 1-PORT” symbol to the project ( ).
What I have to do now, to access this Symbol on my “GHRD” base project? As I understand i have to write code in ghrd.v but I don’t know how))
Please, provide small peace of code where I can assign first byte of RAM to 0x1 for example, or redirect me to some tutorial, where I can understand clearly how to implement symbols (such as “RAM: 1-PORT”) in the code.
Many thanks!


You need a dual port RAM, one side is on Avalon side (connected to system with Qsys), the other is with FGPA pins.

The excellent example here use a single port RAM (onchip_memory2_0 or onchip_memory2_1), just has to be extended to a two port RAM with Qsys