Download Library of Macros for Optimization Using eMAC and MAC

Transcript
size
In
Number of elements in input and output arrays
x
In
FRAC32 value between zero and one that controls filter
coefficients computation
Returns: The HPASS_1POLE_FLTR macro generates output values, which are stored in the array,
pointed to by dst.
4.8.3
Description of Optimization
This macro frequently performs multiplication and addition operations on fractional values It is suitable
for the eMAC unit, because it has a fractional mode.
Optimization for the MAC unit is performed as an emulation of the fractional mode, using mac.w with
shift to left instruction on the upper 16 bits of operands. So only the upper 16 bits of the resulting signals
are valuable.
The following optimization techniques were used:
1. Mac with load operations to access input array elements.
2. Post-increment addressing mode to store output array elements.
3. Loop unrolling by two.
4. Descending loop organization.
Particular techniques for optimization are reviewed below.
С code:
arr_c[i] = a0 * arr1d[i] + a1 * arr1d[i-1] + b1 * arr_c[i-1];
Optimization for the MAC unit.
The following should be noticed:
•
The loop is unrolled by two.
•
Coefficients a0 and b1 are pre-computed and held in registers a3 and d6 correspondingly.
•
The a1 coefficient is not computed, because a1 = -a0, so the msac operation is used.
•
The d0 register always holds the last computed output signal.
•
Input operands are fetched from memory in msac instructions and stored in registers d3 and d4.
•
The a0 register holds the pointer to the output array; the a1 register holds the pointer to the input
array.
4-82
Library of Macros for Optimization, Rev 1.0
Freescale Semiconductor