Datasheet
1996 Microchip Technology Inc. DS30412C-page 49
PIC17C4X
8.0 HARDWARE MULTIPLIER
All PIC17C4X devices except the PIC17C42, have an
8 x 8 hardware multiplier included in the ALU of the
device. By making the multiply a hardware operation, it
completes in a single instruction cycle. This is an
unsigned multiply that gives a 16-bit result. The result
is stored into the 16-bit PRODuct register
(PRODH:PRODL). The multiplier does not affect any
flags in the ALUSTA register.
Making the 8 x 8 multiplier execute in a single cycle
gives the following advantages:
• Higher computational throughput
• Reduces code size requirements for multiply
algorithms
The performance increase allows the device to be used
in applications previously reserved for Digital Signal
Processors.
Table 8-1 shows a performance comparison between
the PIC17C42 and all other PIC17CXX devices, which
have the single cycle hardware multiply.
Example 8-1 shows the sequence to do an 8 x 8
unsigned multiply. Only one instruction is required
when one argument of the multiply is already loaded in
the WREG register.
Example 8-2 shows the sequence to do an 8 x 8 signed
multiply. To account for the sign bits of the arguments,
each argument’s most significant bit (MSb) is tested
and the appropriate subtractions are done.
EXAMPLE 8-1: 8 x 8 MULTIPLY ROUTINE
MOVFP ARG1, WREG
MULWF ARG2 ; ARG1 * ARG2 ->
; PRODH:PRODL
EXAMPLE 8-2: 8 x 8 SIGNED MULTIPLY
ROUTINE
MOVFP ARG1, WREG
MULWF ARG2 ; ARG1 * ARG2 ->
; PRODH:PRODL
BTFSC ARG2, SB ; Test Sign Bit
SUBWF PRODH, F ; PRODH = PRODH
; - ARG1
MOVFP ARG2, WREG
BTFSC ARG1, SB ; Test Sign Bit
SUBWF PRODH, F ; PRODH = PRODH
; - ARG2
TABLE 8-1: PERFORMANCE COMPARISON
Routine Device
Program Memory
(Words)
Cycles (Max)
Time
@ 25 MHz @ 33 MHz
8 x 8 unsigned PIC17C42 13 69 11.04
µ
s N/A
All other PIC17CXX devices 1 1 160 ns 121 ns
8 x 8 signed PIC17C42 — — — N/A
All other PIC17CXX devices 6 6 960 ns 727 ns
16 x 16 unsigned PIC17C42 21 242 38.72
µ
s N/A
All other PIC17CXX devices 24 24 3.84
µ
s 2.91
µ
s
16 x 16 signed PIC17C42 52 254 40.64
µ
s N/A
All other PIC17CXX devices 36 36 5.76
µ
s 4.36
µ
s
This document was created with FrameMaker404