Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

flush the data cache before activating

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?

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

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