3.3.12.2.1 DSP Multiply Instructions
The DSP instructions that use the multiplier are summarized in Table 3-4.
DSP Instruction(1) |
Description |
Algebraic Equivalent |
---|---|---|
MAC |
Multiply and Add to Accumulator or Square and Add to Accumulator |
a = a + b * c or a = a + b2 |
MSC |
Multiply and Subtract from Accumulator |
a = a – b * c |
MPY |
Multiply |
a = b * c |
MPY.N |
Multiply and Negate Result |
a = -b * c |
SQR | Square to Accumulator |
a = b ^ 2 |
SQRAC | Square and Accumulate |
a = a + (b2) |
ED |
Partial Euclidean Distance |
a = (b – c)2 |
EDAC |
Add Partial Euclidean Distance to the Accumulator |
a = a + (b – c)2 |
Note:
|
The DSP Multiplier Unsigned/Signed Control (US[1:0]) bits (CORCON[13:12]) determine whether the DSP multiply instructions are signed (default), unsigned or mixed-sign. The US[1:0] bits do not influence the MCU multiply instructions, which have specific instructions for a signed or unsigned operation. If the USx bits are set to ‘01’, the input operands for instructions shown in Table 3-4 are considered as unsigned values, which are always zero-extended into the 33th bit of the multiplier value. If the USx bits are set to ‘00’, the operands are sign-extended.
If the USx bits (CORCON[13:12]) are set to ‘10’, the operands for the instructions listed in Table 3-4 are considered as unsigned values. The result is zero-extended prior to any operation with the accumulator (which will always effectively be signed).