Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12615 Discussions

flush the data cache before activating

Altera_Forum
Honored Contributor II
994 Views

Should the C2H wrapper function flush the data cache before 

activating the hardware accelerator if the processor has a 

data cache but doesn't write to the same memory 

that the accelerated function operates on?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
284 Views

The cache flush is optional and you only need to use when data is accessed by the CPU and accelerator. Function parameters will be communicated to the accelerator using cache bypassing so you don't have to worry about them. The cache flush is needed if you for example have Nios II populate some buffer, then call the accelerator which then accesses this buffer. The Nios II processor has a writeback cache so the contents written might be still in the cache without the flush. Another example of where the cache flush is needed is if the accelerator writes to a memory location(s) and the CPU needs to access this data after. If you are familiar with cache coherency with multiple processors or processors and DMA engines then the same applies to C2H.

0 Kudos
Altera_Forum
Honored Contributor II
284 Views

Tthanks for your rich reply. Sometimes, some documents are confusing and need to simplify things like what you did!

0 Kudos
Reply