AI Engine Intrinsics
(AIE) r2p21
|
These are the intrinsics functions used for implementing FFT functionality.
For intrinsics used for addressing related to FFT please see FFT addressing.
The FFT algorithm works by executing these functions a number of times in different stages.
The number of stages is the log of the number of points in the FFT with the radix as the base of the log. For instance for a 256 point radix 2 FFT the process is split into 8 stages. The first 6 stages are the same and consist of calling the butterfly function on every input value that is supplied to it, these input values depend on the radix. In this instance (radix 2) means that every second block is processed. The input pointer is determined by by an incrementation function fft_data_incr. The twiddle values are determined by the use of two functions fft_permute_incr which determines which values within the register to use and fft_twiddle_incr which increments the pointer to the twiddle factors, thereby providing a fresh set of twiddle values.
The output of each stage becomes the input of the next stage.
The last two stages differ from the initial 6 stages in the way that the inputs are twiddles are mapped from the registers and how often the twiddles are updated from the registers.
In the case of radix 2, 256 point FFT with 32bit data, a stage will consist of 32 butterfly calls, each consuming 8 samples, 64 store operations and 64 AIE cycles total.
FFT scalar functions | |
unsigned | fft_zoffs (umod_t cntwrap, int step, bool wide_twiddle, bool wide_data) |
Change twiddle factor selectors. | |
umod_t | fft_mod_delay (umod_t cntwrap) |
Delay the count/wrap parameter. | |
FFT butterfly intrinsics | |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. The butterfly function performs the following pseudocode: o = a + b*func(z)
p = a - b*func(z)
return p::o
Alternatively, the following pseudo-code can be performed. The intrinsic will be prefixed with half_ in this case: o = b*func(z)
p = a + b*func(z)
return p::o
Where func(z) can be:
See each of the following intrinsics for more specific pseudocode. | |
v8cacc48 | butterfly_dit (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, int shft) |
v8cacc48 | butterfly_dit_cj (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, int shft) |
v8cacc48 | butterfly_dit (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, bool zconj, int shft) |
v8cacc48 | half_butterfly_dit (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, int shft) |
v8cacc48 | half_butterfly_dit_cj (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, int shft) |
v8cacc48 | half_butterfly_dit (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, bool zconj, int shft) |
v8cacc48 | half_butterfly_dit (v8cacc48 acc, v8cint32 x, v8cint32 y, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets) |
v8cacc48 | half_butterfly_dit_cj (v8cacc48 acc, v8cint32 x, v8cint32 y, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets) |
v8cacc48 | half_butterfly_dit (v8cacc48 acc, v8cint32 x, v8cint32 y, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, bool zconj) |
v8cacc48 | butterfly_dit_minj (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, int shft) |
v8cacc48 | butterfly_dit_cj_minj (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, int shft) |
v8cacc48 | butterfly_dit_minj (v8cint32 x, v8cint32 y, unsigned int aoffsets, unsigned int boffsets, v8cint16 z, unsigned int zstart, unsigned int zoffsets, bool zconj, int shft) |
v8cacc48 butterfly_dit | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
v8cacc48 butterfly_dit | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
bool | zconj, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
v8cacc48 butterfly_dit_cj | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
v8cacc48 butterfly_dit_cj_minj | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
v8cacc48 butterfly_dit_minj | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
v8cacc48 butterfly_dit_minj | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
bool | zconj, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
umod_t fft_mod_delay | ( | umod_t | cntwrap | ) |
Delay the count/wrap parameter.
cntwrap | Counts the number of FFT wraps. The MSB is the wrap bit itself. |
This function is needed in the radix-4 FFT implementations where the cntwrap parameter is generated many cycles before its consumption and hence needs to be delayed.
unsigned fft_zoffs | ( | umod_t | cntwrap, |
int | step, | ||
bool | wide_twiddle, | ||
bool | wide_data | ||
) |
Change twiddle factor selectors.
cntwrap | Counts the number of FFT wraps. The MSB is the wrap bit itself. |
step | Range {0..3}. Binary logarithm of the count wrap around (number of wraps per twiddle vector). This must be a compile time constant. |
wide_twiddle | True if a wide 8 lane twiddle vector is used. This must be a compile time constant. |
wide_data | True if a wide 8 lane data vector is used This must be a compile time constant. |
The butterfly function chooses which twiddle values from the register to use with which input values, based on the returned zoffs value.
For instance if zoffs = 0x1100 then the first twiddle value is used with in[3] and in[2] and the second twiddle value is used with in[1] and in[0]. Which values in the input register correspond to in[3]-in[0] is determined by a similar mapping process in the butterfly function.
For more information on the intrinsic's behaviour you can check the following pseudocode:
The following tables shows the resulting offset's the intrinsic would return when:
cntwrap | Stage=3 | Stage=2 | Stage=1 |
---|---|---|---|
0 | {0,0,0,0} | {0,0,1,1} | {0,1,2,3} |
1 | {1,1,1,1} | {2,2,3,3} | {0,1,2,3} |
2 | {2,2,2,2} | {0,0,1,1} | {0,1,2,3} |
3 | {3,3,3,3} | {2,2,3,3} | {0,1,2,3} |
4 | {0,0,0,0} | {0,0,1,1} | {0,1,2,3} |
5 | {1,1,1,1} | {2,2,3,3} | {0,1,2,3} |
6 | {2,2,2,2} | {0,0,1,1} | {0,1,2,3} |
7 | {3,3,3,3} | {2,2,3,3} | {0,1,2,3} |
cntwrap | Stage = 3 | Stage = 2 | Stage = 1 |
---|---|---|---|
0 | {0,0,0,0} | {0,0,1,1} | {0,1,2,3} |
1 | {1,1,1,1} | {2,2,3,3} | {4,5,6,7} |
2 | {2,2,2,2} | {4,4,5,5} | {0,1,2,3} |
3 | {3,3,3,3} | {6,6,7,7} | {4,5,6,7} |
4 | {4,4,4,4} | {0,0,1,1} | {0,1,2,3} |
5 | {5,5,5,5} | {2,2,3,3} | {4,5,6,7} |
6 | {6,6,6,6} | {4,4,5,5} | {0,1,2,3} |
7 | {7,7,7,7} | {6,6,7,7} | {4,5,6,7} |
cntwrap | Stage = 3 | Stage = 2 | Stage = 1 |
---|---|---|---|
0 | {0,0,0,0,0,0,0,0} | {0,0,0,0,1,1,1,1} | {0,0,1,1,2,2,2,3} |
1 | {1,1,1,1,1,1,1,1} | {2,2,2,2,3,3,3,3} | {0,0,1,1,2,2,2,3} |
2 | {2,2,2,2,1,1,1,1} | {0,0,0,0,1,1,1,1} | {0,0,1,1,2,2,2,3} |
3 | {3,3,3,3,3,3,3,3} | {2,2,2,2,3,3,3,3} | {0,0,1,1,2,2,2,3} |
4 | {0,0,0,0,0,0,0,0} | {0,0,0,0,1,1,1,1} | {0,0,1,1,2,2,2,3} |
5 | {1,1,1,1,1,1,1,1} | {2,2,2,2,3,3,3,3} | {0,0,1,1,2,2,2,3} |
6 | {2,2,2,2,1,1,1,1} | {0,0,0,0,1,1,1,1} | {0,0,1,1,2,2,2,3} |
7 | {3,3,3,3,3,3,3,3} | {2,2,2,2,3,3,3,3} | {0,0,1,1,2,2,2,3} |
cntwrap | Stage = 3 | Stage = 2 | Stage = 1 | Stage = 0 |
---|---|---|---|---|
0 | {0,0,0,0,0,0,0,0} | {0,0,0,0,1,1,1,1} | {0,0,1,1,2,2,2,3} | {0,1,2,3,4,5,6,7} |
1 | {1,1,1,1,1,1,1,1} | {2,2,2,2,3,3,3,3} | {4,4,5,5,6,7,7,7} | {0,1,2,3,4,5,6,7} |
2 | {2,2,2,2,1,1,1,1} | {4,4,4,4,5,5,5,5} | {0,0,1,1,2,2,2,3} | {0,1,2,3,4,5,6,7} |
3 | {3,3,3,3,3,3,3,3} | {6,6,6,6,7,7,7,7} | {4,4,5,5,6,6,7,7} | {0,1,2,3,4,5,6,7} |
4 | {4,4,4,4,4,4,4,4} | {0,0,0,0,1,1,1,1} | {0,0,1,1,2,2,2,3} | {0,1,2,3,4,5,6,7} |
5 | {5,5,5,5,5,5,5,5} | {2,2,2,2,3,3,3,3} | {4,4,5,5,6,7,7,7} | {0,1,2,3,4,5,6,7} |
6 | {6,6,6,6,6,6,6,6} | {4,4,4,4,5,5,5,5} | {0,0,1,1,2,2,2,3} | {0,1,2,3,4,5,6,7} |
7 | {7,7,7,7,7,7,7,7} | {6,6,6,6,7,7,7,7} | {4,4,5,5,6,6,7,7} | {0,1,2,3,4,5,6,7} |
v8cacc48 half_butterfly_dit | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
bool | zconj, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
v8cacc48 half_butterfly_dit | ( | v8cacc48 | acc, |
v8cint32 | x, | ||
v8cint32 | y, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | acc | Direct accumulator values for a. |
v8cacc48 half_butterfly_dit | ( | v8cacc48 | acc, |
v8cint32 | x, | ||
v8cint32 | y, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
bool | zconj | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | acc | Direct accumulator values for a. |
v8cacc48 half_butterfly_dit | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
v8cacc48 half_butterfly_dit_cj | ( | v8cint32 | x, |
v8cint32 | y, | ||
unsigned int | aoffsets, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets, | ||
int | shft | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | aoffsets | Selects the values for a from x::y. |
[in] | shft | Upshift value for the values from a before accumulation. |
v8cacc48 half_butterfly_dit_cj | ( | v8cacc48 | acc, |
v8cint32 | x, | ||
v8cint32 | y, | ||
unsigned int | boffsets, | ||
v8cint16 | z, | ||
unsigned int | zstart, | ||
unsigned int | zoffsets | ||
) |
The butterfly function is the central calculation of the FFT algorithm. It takes two inputs that are to be acted upon as well as a set of twiddle values and performs the decimation-in-time (dit) FFT operation upon them. The offset values (aoffsets,boffsets,zoffsets) determine which inputs will interact with which twiddle values. This butterfly function performs the following pseudocode:
For more information, see FFT intrinsics
[in] | x | First input buffer for FFT values. |
[in] | y | Second input buffer for FFT values. |
[in] | boffsets | Selects the values for b from x::y. |
[in] | z | Buffer of twiddle values. |
[in] | zstart | Fixed offset to the twiddle value selectors. This must be a compile time constant. |
[in] | zoffsets | Selects the twiddle values from z. |
[in] | zconj | (Optional) twiddle values are conjugated befor multiplication. |
[in] | acc | Direct accumulator values for a. |