10.07.2015 Views

pic24fj128ga010 family - Microchip

pic24fj128ga010 family - Microchip

pic24fj128ga010 family - Microchip

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PIC24FJ128GA010 FAMILY2.3 Arithmetic Logic Unit (ALU)The PIC24F ALU is 16 bits wide and is capable of addition,subtraction, bit shifts and logic operations. Unlessotherwise mentioned, arithmetic operations are 2’scomplement in nature. Depending on the operation, theALU may affect the values of the Carry (C), Zero (Z),Negative (N), Overflow (OV) and Digit Carry (DC)Status bits in the SR register. The C and DC Status bitsoperate as Borrow and Digit Borrow bits, respectively,for subtraction operations.The ALU can perform 8-bit or 16-bit operations,depending on the mode of the instruction that is used.Data for the ALU operation can come from the Wregister array, or data memory, depending on theaddressing mode of the instruction. Likewise, outputdata from the ALU can be written to the W register arrayor a data memory location.The PIC24F CPU incorporates hardware support forboth multiplication and division. This includes a dedicatedhardware multiplier and support hardware for16-bit divisor division.2.3.1 MULTIPLIERThe ALU contains a high-speed, 17-bit x 17-bitmultiplier. It supports unsigned, signed or mixed signoperation in several multiplication modes:1. 16-bit x 16-bit signed2. 16-bit x 16-bit unsigned3. 16-bit signed x 5-bit (literal) unsigned4. 16-bit unsigned x 16-bit unsigned5. 16-bit unsigned x 5-bit (literal) unsigned6. 16-bit unsigned x 16-bit signed7. 8-bit unsigned x 8-bit unsigned2.3.2 DIVIDERThe divide block supports 32-bit/16-bit and 16-bit/16-bitsigned and unsigned integer divide operation with thefollowing data sizes:1. 32-bit signed/16-bit signed divide2. 32-bit unsigned/16-bit unsigned divide3. 16-bit signed/16-bit signed divide4. 16-bit unsigned/16-bit unsigned divideThe quotient for all divide instructions ends up in W0and the remainder in W1. 16-bit signed and unsignedDIV instructions can specify any W register for both the16-bit divisor (Wn) and any W register (aligned) pair(W(m+1):Wm) for the 32-bit dividend. The divide algorithmtakes one cycle per bit of divisor, so both32-bit/16-bit and 16-bit/16-bit instructions take thesame number of cycles to execute.2.3.3 MULTI-BIT SHIFT SUPPORTThe PIC24F ALU supports both single bit andsingle-cycle, multi-bit arithmetic and logic shifts.Multi-bit shifts are implemented using a shifter block,capable of performing up to a 15-bit arithmetic rightshift, or up to a 15-bit left shift, in a single cycle. Allmulti-bit shift instructions only support Register DirectAddressing for both the operand source and resultdestination.A full summary of instructions that use the shiftoperation is provided below in Table 2-2.TABLE 2-2: INSTRUCTIONS THAT USE THE SINGLE AND MULTI-BIT SHIFT OPERATIONInstructionDescriptionASR Arithmetic shift right source register by one or more bits.SLShift left source register by one or more bits.LSR Logical shift right source register by one or more bits.DS39747E-page 26© 2009 <strong>Microchip</strong> Technology Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!