This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

c55 ring buffer optimization

Hello everybody,

I am implementing a high order decimation filter which has a 11-samples delay line (11 taps). The filter is computationally quite heavy because it works on blocks of 16 96kHz samples, so it has to iterate 16*11 times, which is a lot.

The filter of course, handles the delay line as a ring (circular) buffer, and not as a shift buffer (fifo), by incrementing a pointer, and resetting it to the base address of the buffer when it reaches the end of it.

Acirc_inc(a,b,c,d) a+=b; if (a >= (c+d)) a -= d

The handling of this circular buffer is written in c, and contains a "if" instruction, which breaks the pipeline efficiency of the loop.

I have seen on the c55 CPU guide that the machine has the capability to handle circular buffers in hardware, but all the documentation is about assembler while I would like to keep the code in c for platform portability reasons.

When I look at the generated optimized assembler, after compilation, I can't see any instruction setting the ST2_55 register bits, which are used for circular buffer configuration, so I assume that, even with maximum optimization enabled, the compiler doesn't understand that my pointer to the buffer has to be circularly incremented.

Is there any way to tell the compiler to treat that buffer (pointer) as circular?

Thank you