Inspired by Pavel's project, I am using AXI BRAM Reader IP for fetching the data from BRAM to the device memory of PS. I store around 32768 samples of 32-bit each in the BRAM. used a void* for mapping the device memory with the offset provided in the address editor using the mmap() command. I then typecast it into uint32_t* and use fwrite to store all the samples into a binary file
Code: Select all
fwrite(srcInt32, sizeof(uint32_t), buflen, fptr_b);
The function takes around 4.5-5ms, which is extremely slow for my application (my application demands sub millisecond delay). So, I try to use memcpy() for writing the data from '/dev/mem' to file. The input data is a counter that has values sequentially {1,2,3,etc}. But when we try to acquire the data using memcpy (acquiring multiple 32bit chunks), the difference between subsequent indexes of the copied data was found to follow a constant pattern of {-62,64,66,-64,2,0,2,0,2,0,2,0,2,0,2,0} and repeats itself (ideally the differences should give constant 1 between subsequent indexes).
Also, when I try printing the value of srcInt32[j] in a for loop, the output values follow sequential pattern as desired, whereas when I print srcInt32[j-1], srcInt32[j], srcInt32[j+1] in the same iteration, the output of j-1th index gives value of j+1 (the last value accessed), whereas output of jth or j+1th index gives the value of j and j+1 as desired.
Request you to kindly help me out with faster access of desired data from BRAM of FPGA.