Forum Discussion
Altera_Forum
Honored Contributor
16 years agoCode for FFT using SGDMA
I'm attempting to write nios code to send information to an FFT, then view the result. The hardware is: sgdma_mem_to_stream-->FFT-->sgdma_stream_to_mem With a streaming FFT of length 64, 32 ...
Altera_Forum
Honored Contributor
16 years agoIf the CPU is configured to have a data cache then I would expect intermittent cache coherency issues with that code. Since you are using malloc to allocate the memory I would replace those calls to the uncacheable malloc instead which will make sure that the pointer returned will perform cache bypassing automatically as well as flush the cache before returning the pointer.
Using IOWR based on the pointer returned from malloc is not enough to ensure no cache coherency issues. If the memory that was allocated by malloc happened to be cached before hand and you attempt to use IOWR to write to those memory locations the data in the cache will get written out instead of what you pass into IOWR. This is not a bug because you are essentially treating the memory range as cacheable and non-cacheable at the same time. That is why I recommend using the uncache malloc calls instead which will avoid this automatically (see Nios II software developers handbook for more details.)