After a pair of words have been pre-fetched, both the pointers may be incremented or decremented by certain fixed amounts (0, 2, 4 or 6). This feature is useful for utilizing different elements of an array for successive MAC instructions. Some examples of such scenarios are when calculating the dot product of 2 vectors, or applying an array of FIR filter coefficients to a data array.
Instead of incrementing or decrementing the pointers after a pre-fetch, a variable offset (either pre-stored or pre-calculated in W12) can be added to the pointer before the pre-fetch. The data being fetched is then the data located at the address given by the sum of the current pointer value and the offset. Note that only W12 can be used as an offset. Also, only W9 or W11, and not W8 or W10, can be used as the pre-fetch pointer if the Register Offset Addressing mode is to be used.
- Pre-fetch loads the registers that will be needed for subsequent iterations of the instruction
- Pre-fetch uses indirect addressing mode:
- -6, -4, -2, 0, 2, 4 or 6
- Indirect with Register offset using W12
- [W9+W12] in X space
- [W11+W12] in Y space
Various examples of MAC instruction usage are shown here. In the first example, only the source operands and target accumulator have been specified, and there is no operand pre-fetch.
In the second example, the result of the multiplication is added to accumulator B instead of A, and only 1 source operand is pre-fetched, from Y data space in this case.
In the third example, a pair of source operands are pre-fetched, from the X and Y data space respectively.
Finally, the fourth example shows the Register Offset Addressing mode being used for pre-fetching an operand from Y data space.