thank you first
and there is another question: as you said "denom is a power of two of the form" ,but I can not understand for example the real is 0.56 ,then my faction form is 56/100, but 100 is just be 10 power , how to transfer this , 0.56==56/100, I can not image there is a data can do this 0.56==56/ 2's power , that is mean the real data that I caculate will be changed??
sorry for my English and sorry for my poor FFT knowledge ;)
--- Quote Start ---
I'm not familiar with this specific piece of code, but it looks like a common technique for fixed-point arithmetic.
Rather than using floating point, which is very expensive in gate count, values between zero and one (like the sine and cosine) are expressed as fractions. For convenience, all fractions have powers of two in the denominator. Also, since the denominator is the same for all fractions, adding and subtracting can just ignore it and use only the numerator.
In floating point, that code would be:
tmp = cos * data
+ sinreal * data;
Using fractions instead of floating point:
tmp = (cosNumer/denom) * data
+ (sinnumer/denom) * data;
or
tmp = (cosNumer * data
+ sinnumer * data ) / denom;
Since denom is a power of two of the form (1 << SCALE),
tmp = (cosNumer * data
+ sinnumer * data ) >> SCALE;
--- Quote End ---