4.3.11 Arithmetic Logic Unit (ALU)
The dsPIC33A ALU is 32 bits wide and is capable of addition, subtraction, single-bit shifts and logic operations. Unless otherwise mentioned, arithmetic operations are a two’s complement in nature. Depending on the operation, the ALU can affect the values of the following bits in the STATUS Register:
- Carry (C)
- Zero (Z)
- Negative (N)
- Overflow (OV)
The ALU can perform 8/16-bit or 32-bit operations, depending on the mode of the instruction that is used. Data for the ALU operation can come from the W register array or data memory depending on the addressing mode of the instruction. Likewise, output data from the ALU can be written to the W register array or a data memory location.
Note: Byte operations use the 16-bit ALU and can produce results in
excess of eight bits. However, to maintain backward compatibility with PIC®
MCU devices, the ALU result from all byte operations is written back as a byte (i.e.,
the MSB is not modified) and the STATUS Register is updated based only upon the state of
the LSB of the result.