MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
16-Bit C <strong>Compiler</strong> User’s Guide<br />
__builtin_clr<br />
Assembler Operator<br />
/ Machine<br />
Instruction:<br />
clr<br />
Error Messages An error message will be displayed if the result is not an accumulator<br />
register.<br />
__builtin_clr_prefetch<br />
Description: Clear an accumulator <strong>and</strong> prefetch data ready <strong>for</strong> a future MAC<br />
operation.<br />
xptr may be null to signify no X prefetch to be per<strong>for</strong>med, in which<br />
case the values of xincr <strong>and</strong> xval are ignored, but required.<br />
yptr may be null to signify no Y prefetch to be per<strong>for</strong>med, in which<br />
case the values of yincr <strong>and</strong> yval are ignored, but required.<br />
xval <strong>and</strong> yval nominate the address of a C variable where the<br />
prefetched value will be stored.<br />
xincr <strong>and</strong> yincr may be the literal values: -6, -4, -2, 0, 2, 4, 6 or an<br />
integer value.<br />
If AWB is non null, the other accumulator will be written back into the<br />
referenced variable.<br />
For example:<br />
register int result asm("A");<br />
int x_memory_buffer[256]<br />
__attribute__((space(xmemory)));<br />
int y_memory_buffer[256]<br />
__attribute__((space(ymemory)));<br />
int *xmemory;<br />
int *ymemory;<br />
int awb;<br />
int xVal, yVal;<br />
xmemory = x_memory_buffer;<br />
ymemory = y_memory_buffer;<br />
result = __builtin_clr(&xmemory, &xVal, 2,<br />
&ymemory, &yVal, 2, &awb);<br />
might generate:<br />
clr A, [w8]+=2, w4, [w10]+=2, w5, w13<br />
The compiler may need to spill w13 to ensure that it is available <strong>for</strong> the<br />
write-back. It may be recommended to users that the register be<br />
claimed <strong>for</strong> this purpose.<br />
After this instruction:<br />
• result will be cleared<br />
• xVal will contain x_memory_buffer[0]<br />
• yVal will contain y_memory_buffer[0]<br />
• xmemory <strong>and</strong> ymemory will be incremented by 2, ready <strong>for</strong> the<br />
next mac operation<br />
Prototype: int __builtin_clr_prefetch(<br />
int **xptr, int *xval, int xincr,<br />
int **yptr, int *yval, int yincr, int *AWB);<br />
DS51284G-page 144 © 2008 <strong>Microchip</strong> Technology Inc.