Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

16-bit MCU and DSC Programmer’s Reference Manual
DS70157F-page 460 © 2005-2011 Microchip Technology Inc.
__builtin_mac
Description:
Computes a x b and sums with accumulator; also prefetches data ready for a future MAC
operation.
xptr may be null to signify no X prefetch to be performed, in which case the values of xincr
and xval are ignored, but required.
yptr may be null to signify no Y prefetch to be performed, in which case the values of yincr
and yval are ignored, but required.
xval and yval nominate the address of a C variable where the prefetched value will be stored.
xincr and yincr may be the literal values: -6, -4, -2, 0, 2, 4, 6 or an integer value.
If AWB is non null, the other accumulator will be written back into the referenced variable.
For example:
register int result asm("A");
register int B asm("B");
int *xmemory;
int *ymemory;
int xVal, yVal;
result = _ _builtin_mac(result, xVal, yVal,
&xmemory, &xVal, 2,
&ymemory, &yVal, 2, 0, B);
May generate:
mac w4*w5, A, [w8]+=2, w4, [w10]+=2, w5
Prototype:
int _ _builtin_mac(int Accum, int a, int b,
int **xptr, int *xval, int xincr,
int **yptr, int *yval, int yincr, int *AWB,
int AWB_accum);
Argument:
Accum Accumulator to sum.
a Integer multiplicand.
b Integer multiplier.
xptr Integer pointer to pointer to x prefetch.
xval Integer pointer to value of x prefetch.
xincr Integer increment value of x prefetch.
yptr Integer pointer to pointer to y prefetch.
yval Integer pointer to value of y prefetch.
yincr Integer increment value of y prefetch.
AWB Accumulator write-back location.
AWB_accum Accumulator to write-back.
Note: The arguments xptr and yptr must point to the arrays located in the x data
memory and y data memory, respectively.
Return Value:
Returns the cleared value result to an accumulator.
Assembler Operator / Machine Instruction:
mac

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh