106
AT94KAL Series FPSLIC
Rev. 1138G–FPSLI–11/03
Multiplier
The multiplier is capable of multiplying two 8-bit numbers, giving a 16-bit result using only two
clock cycles. The multiplier can handle both signed and unsigned integer and fractional num-
bers without speed or code size penalty. Below are some examples of using the multiplier for
8-bit arithmetic.
To be able to use the multiplier, six new instructions are added to the AVR instruction set.
These are:
•
MUL, multiplication of unsigned integers
•
MULS, multiplication of signed integers
•
MULSU, multiplication of a signed integer with an unsigned integer
•
FMUL, multiplication of unsigned fractional numbers
•
FMULS, multiplication of signed fractional numbers
•
FMULSU, multiplication of a signed fractional number and with an unsigned fractional
number
The MULSU and FMULSU instructions are included to improve the speed and code density for
multiplication of 16-bit operands. The second section will show examples of how to efficiently
use the multiplier for 16-bit arithmetic.
The component that makes a dedicated digital signal processor (DSP) specially suitable for
signal processing is the multiply-accumulate (MAC) unit. This unit is functionally equivalent to
a multiplier directly connected to an arithmetic logic unit (ALU). The FPSLIC-based AVR Core
is designed to give FPSLIC the ability to effectively perform the same multiply-accumulate
operation.
The multiply-accumulate operation (sometimes referred to as
multiply-add operation
) has one
critical drawback. When adding multiple values to one result variable, even when adding posi-
tive and negative values to some extent, cancel each other; the risk of the result variable to
overrun its limits becomes evident, i.e. if adding 1 to a signed byte variable that contains the
value +127, the result will be -128 instead of +128. One solution often used to solve this prob-
lem is to introduce fractional numbers, i.e. numbers that are less than 1 and greater than or
equal to -1. Some issues regarding the use of fractional numbers are discussed.
A list of all implementations with key performance specifications is given in Table 34.
Table 34.
Performance Summary
8-bit x 8-bit Routines:
Word (Cycles)
Unsigned Multiply 8 x 8 = 16 bits
1 (2)
Signed Multiply 8 x 8 = 16 bits
1 (2)
Fractional Signed/Unsigned Multiply 8 x 8 = 16 bits
1 (2)
Fractional Signed Multiply-accumulate 8 x 8 + = 16 bits
3 (4)
16-bit x 16-bit Routines:
Word (Cycles)
Signed/Unsigned Multiply 16 x 16 = 32 bits
6 (9)
UnSigned Multiply 16 x 16 = 32 bits
13 (17)
Signed Multiply 16 x 16 = 32 bits
15 (19)
Signed Multiply-accumulate 16 x 16 + = 32 bits
19 (23)
Fractional Signed Multiply 16 x 16 = 32 bits
16 (20)
Fractional Signed Multiply-accumulate 16 x 16 + = 32 bits
21 (25)