Academic Program

Multiplication Instructions

Multiplication Instructions

Instruction Description
MUL.B Integer unsigned byte multiply F and WREG0
MUL{.W} Integer unsigned word multiply F and WREG0
MULL.SS Integer 16x16 Signed multiply
MULL.US Integer 16x16 Unsigned-Signed Multiply
MULL.UU Integer 16x16 Unsigned Multiply
MULL.UU Integer 16x16 Unsigned-Unsigned Short Literal Multiply
MULL.SU Integer 16x16 Signed-Unsigned Short Literal Multiply
  • WREG Multiply ( MUL.B or MUL.W)
    • Always uses WREG0 and any file register
    • Supports 8x8 multiply, generates 16-bit product
    • Results stored in W2 ( MUL.B ) or W3:W2 (MUL.W)
    • Provides PIC® MCU backward compatibility
  • 16-bit Integer Multiplication
    • Unsigned, Signed modes support W * W multiplies
      • MUL.UUMUL.SS,
    • Mixed mode – supports W * short (5-bit) literal multiplies
      • MUL.US and MUL.SU
    • 32-bit Product is stored in adjacent working registers
      • W1:W0, W3:W2, … , W13:W12

MUL Example

mov     #0xFFFE, w1              ;load 0x0800 with 0xFFFE (65534)
mov.w   w1, 0x0800            
 
mov     #0x0002, w0              ;load WREG0 with 0x0002 (2)
 
mul     0x0800                   ; W3:W2 = F * W0
                                 ; W3:W2 = 1:FFFC (131068)

 

MULExample.png

 

MUL = file * WREG0 so therefore a file location must be used.

MUL.SS Example

mov #0xFFFE, w1              ;load WREG1 with 0xFFFE (-2)
 
mov #0x0002, w0              ;load WREG0 with 0x0002 (2)
 
mul.ss w0,w1,w2              ; W3:W2 = W0 * W1
                             ; W3:W2 = FFFF:FFFC (-4)

 

MULLSSExample.png

 

MUL.SS can multiply two WREGs, and the second operand can be used as a pointer if desired. That is, you can have an instruction of the form mul.ss w0, [w1], w2