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 78 © 2005-2011 Microchip Technology Inc.
4.10 ASSIGNED WORKING REGISTER USAGE
The 16 working registers of the 16-bit MCU and DSC devices provide a large register set for
efficient code generation and algorithm implementation. In an effort to maintain an instruction set
that provides advanced capability, a stable run-time environment and backwards compatibility
with earlier Microchip processor cores, some working registers have a preassigned usage.
Table 4-9 summarizes these working register assignments. For the dsPIC30F, dsPIC33F, and
dsPIC33E, additional details are provided in subsections Section 4.10.1 “Implied DSP
Operands (dsPIC30F, dsPIC33F and dsPIC33E Devices)” through Section 4.10.3 “PIC
®
Microcontroller Compatibility”.
Table 4-9: Special Working Register Assignments
4.10.1 Implied DSP Operands (dsPIC30F, dsPIC33F and dsPIC33E
Devices)
To assist instruction encoding and maintain uniformity among the DSP class of instructions,
some working registers have pre-assigned functionality. For all DSP instructions which have
prefetch ability, the following 10 register assignments must be adhered to:
• W4-W7 are used for arithmetic operands
• W8-W11 are used for prefetch addresses (pointers)
• W12 is used for the prefetch register offset index
• W13 is used for the accumulator Write Back destination
These restrictions only apply to the DSP MAC class of instructions, which utilize working
registers and have prefetch ability (described in
Section 4.15 “DSP Accumulator Instructions
(dsPIC30F, dsPIC33F and dsPIC33E Devices)”). These instructions are CLR, ED, EDAC, MAC,
MOVSAC, MPY, MPY.N and MSC.
In dsPIC33E devices, mixed-sign DSP multiplication operations are supported without the need
to dynamically modify the US<1:0> bits. In this mode (US<1:0> = ‘10’), each input operand is
treated as unsigned or signed based on which register is being used for that operand. W4 and
W6 are always unsigned operand, whereas W5 and W7 are always signed operands. This
feature can be used to efficiently execute extended-precision DSP multiplications.
The DSP Accumulator class of instructions (described in Section 4.15 “DSP Accumulator
Instructions (dsPIC30F, dsPIC33F and dsPIC33E Devices)”) are not required to follow the
working register assignments in Table 4-9 and may freely use any working register when required.
Register Special Assignment
W0 Default WREG, Divide Quotient
W1 Divide Remainder
W2 “MUL f” Product least significant word
W3 “MUL f” Product most significant word
W4 MAC Operand
(1)
W5 MAC Operand
(1)
W6 MAC Operand
(1)
W7 MAC Operand
(1)
W8 MAC Prefetch Address (X Memory)
(1)
W9 MAC Prefetch Address (X Memory)
(1)
W10 MAC Prefetch Address (Y Memory)
(1)
W11 MAC Prefetch Address (Y Memory)
(1)
W12 MAC Prefetch Offset
(1)
W13 MAC Write Back Destination
(1)
W14 Frame Pointer
W15 Stack Pointer
Note 1: This assignment is only applicable in dsPIC30F, dsPIC33F, and dsPIC33E devices.
Protego_Release_01_05-Related-OEM-Documentation-PIC24FJ64GA004-Programmers_Reference_Manual.pdf