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.

Real FFT implementation using the HWAFFT coprocessor instructions. Is it possible?

Hi, I'm working on a C5515 with the using the HWAFFT coprocessor for FFTs. I was wondering about if its worth it to make a real FFT out if half size complex FFT (see "A Different DIT" at http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM). You have to do a final step then, and I'm wondering if this could be done with HWAFFT coprocessor instructions, or if I might as well forget it and use complex ffts since they are hardware accelerated?

I did this in matlab just to verify (the equivalent for a IFFT is very similar):

 

function [X] = realfft(x)

N = length(x);

even = 1:2:N; % Note that the even pins is "odd" in matlab because of the matlab indexing from 1

odd = 2:2:N;

z = x(even) + i*x(odd);

Z = fft(z);

Z = [Z Z(1)]; % Can't use circular buffers in matlab

X = .5*((Z(1:((N/2)))+conj(Z(((N/2)+1):-1:2))) - i*exp(-i*2*pi*(0:((N/2)-1))/N).*(Z(1:((N/2)))-conj(Z(((N/2)+1):-1:2))));

X = [X .5*((Z(1)+conj(Z(1))) + i*(Z(1)-conj(Z(1))))];

 

Thanks, Stefan Gram

  • Stefan,

    You can use HWA for real FFT by placing zero for imaginary part. 

    Regards,

    Peter

  • Peter,

    That is what I'm already doing now. I was just wondering if I could optimization using half size ffts. Doing this wast half the computations since you set half of the values to zero. For example instead of using a 512 FFT as I'm doing now, I could use a 256 FFT and put the samples in the imaginary part also. All I would need to do then is a final "butterfly" step. But it might not be efficient enough to do this in assembly compared to doing 512 FFTs with the HWA.

    I could also do 2 real FFTs instead (see the "Two for the Price of One" at http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM), but the DMA's already kind of split the samples from the stereo codec into to buffers, and I would have to repack it back to left,right, left, right... which would also be a wast.

    Maybe I'm using a bit much energy on this but power consumption is very important to me.

    Best regards,

    Stefan

  • Stefan,

    OK, I understand what you are trying to do.  Actually I once tried to implement it but I realized that it would take extra steps which result in longer cycle counts. I gave it up. With FFT HWA, I don't see benefit out of it. I would use the regular way. 

    Best Regards,

    Peter Chung

     

  • Peter,

    That's what I wanted to know. Thank you so much for saving me the trouble of trying to do this myself.

    Best Regards,

    Stefan Gram