SW006012 Microchip Technology, SW006012 Datasheet - Page 125

C COMPILER FOR DSPIC30F FAMILY

SW006012

Manufacturer Part Number
SW006012
Description
C COMPILER FOR DSPIC30F FAMILY
Manufacturer
Microchip Technology
Type
MPLAB® C30 Compilerr
Series
PIC24 & DsPICr
Datasheets

Specifications of SW006012

Supported Families
PIC24, DsPIC30F And DsPIC33F
Core Architecture
PIC, DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Tool Type
Compiler
Processor Series
PIC24, dsPIC
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
dsPIC30F
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
© 2007 Microchip Technology Inc.
EXAMPLE 8-11:
Some instructions in the dsPIC DSC instruction set require operands to be in a partic-
ular register or groups of registers. Table 8-1 lists some constraint letters that may be
appropriate to satisfy the constraints of the instruction that you wish to generate.
If the constraints are not sufficient or you wish to nominate particular registers for use
inside asm statements, you may use the register-nominating extensions provided by
the compiler to support you (and reduce the need to mark registers as clobbered) as
the following code snippet shows. This snippet uses a fictitious instruction that has
some odd register requirements:
In this example, funky_instruction has one explicit output, out1, and one implicit
output, out2. Both have been placed in the asm template so that the compiler can
track the register usage properly (though the implicit output is in a comment statement).
The input shown is normal. Otherwise, the extended register declarator syntax is used
to nominate particular hard registers which satisfy the constraints of our fictitious
funky_instruction.
EXAMPLE 8-12:
Constraint letters and modifiers may be used to identify various entities with which it is
acceptable to replace a particular operand, such as %0 in:
asm("mov %1, %0" : "r"(foo) : "r"(bar));
This example indicates that the value stored in foo should be moved into bar. The
example code performs this task unless foo or bar are larger than an int.
By default, %0 represents the first register for the operand (0). To access the second,
third, or fourth register, use a modifier letter specified in Table 8-2.
Mixing Assembly Language and C Modules
{ register int in1 asm("w7");
}
register int in2 asm("w9");
register int out1 asm("w13");
register int out2 asm("w0");
in1 = some_input1;
in2 = some_input2;
__asm__ volatile ("funky_instruction %2,%3,%0; = %1" :
/* use out1 and out2 in normal C */
USING REQUIRED REGISTERS
HANDLING VALUES LARGER THAN INT
/* outputs */ "=r"(out1), "=r"(out2) :
/* inputs */ "r"(in1), "r"(in2));
DS51284F-page 119

Related parts for SW006012