SrLam9
New Contributor
7 years agoHPS2FPGA Bridge Throughput
Hi,
I am working on a project where there is a DDR4 RAM connected to the HPS2FPGA bridge and the host sends data to be saved in the RAM. I am trying to improve the throughput from the HPS to the DDR4, but the fastest I have achieved is ~16MB/s.
The software is written in C and the system is running embedded Linux. I am using the mmap() function to write the data to the DDR4 RAM. The program just writes large chunks of data to RAM. I am using an array of memory mapped locations in the example, but the rate is the same with only one map.
numOfBytes = 0x1000000;
for(i = 0; i < 32; i++)
{
ret = BridgeMap(HPS2FPGA, i * numOfBytes, numOfBytes, &ddr4Map[i]);
ddr4Reg[i] = (unsigned int *) (ddr4Map[i]);
for(j = 0; j < numOfBytes/4; j++)
{
ddr4Reg[i][j] = i;
}
}int BridgeMap(int bridgeType, int address, int numOfBytes, void ** pMap)
{
if(fd_bridge == -1)
{
return -1;
}
int bridgeOffset, pageAlignedAddress;
if(bridgeType == LWBRIDGE)
bridgeOffset = LWBRIDGE_START;
else if(bridgeType == HPS2FPGA)
bridgeOffset = HPS2FPGA_START;
pageAlignedAddress = (address / 0x1000) * 0x1000; // get page aligned address
*pMap = mmap(NULL, numOfBytes, PROT_READ | PROT_WRITE, MAP_SHARED,
fd_bridge, bridgeOffset + pageAlignedAddress);
if(pMap == MAP_FAILED)
{
printf("error mapping: %s\n",strerror(errno));
return -1;
}
return pageAlignedAddress;
}How can I improve the data rate going from the HPS to RAM? Is there a better way to communicate data from the HPS through the HPS2FPGA bridge? Should I be using the F2SDRAM bridge instead?
Thank you