32-Bit Hardware Multiplier Operation
9-11
32-Bit Hardware Multiplier
Fractional Number Mode
Multiplying two fractional numbers using the default multiplication mode with
MPYFRAC = 0 and MPYSAT = 0 gives a result with 2 sign bits. For example
if two 16-bit Q15 numbers are multiplied a 32-bit result in Q30 format is
obtained. To convert the result into Q15 format manually, the first 15 trailing
bits and the extended sign bit must be removed. However, when the fractional
mode of the multiplier is used, the redundant sign bit is automatically removed
yielding a result in Q31 format for the multiplication of two 16-bit Q15 numbers.
Reading the result register RES1 gives the result as 16-bit Q15 number. The
32-bit Q31 result of a multiplication of two 32-bit Q31 numbers is accessed by
reading registers RES2 and RES3.
The fractional mode is enabled with MPYFRAC = 1 in register MPY32CTL0.
The actual content of the result register(s) is not modified when
MPYFRAC = 1. When the result is accessed using software, the value is
left−shifted 1 bit resulting in the final Q formatted result. This allows user
software to switch between reading both the shifted (fractional) and the
un-shifted result. The fractional mode should only be enabled when required
and disabled after use.
In fractional mode the SUMEXT register contains the sign extended bits 32
and 33 of the shifted result for 16x16-bit operations and bits 64 and 65 for
32x32-bit operations − not only bits 32 or 64, respectively.
The MPYC bit is not affected by the fractional mode. It always reads the carry
of the nonfractional result.
; Example using
; Fractional 16x16 multiplication
BIS
#MPYFRAC,&MPY32CTL0
; Turn on fractional mode
MOV
&FRACT1,&MPYS
; Load 1st operand as Q15
MOV
&FRACT2,&OP2
; Load 2nd operand as Q15
MOV
&RES1,&PROD
; Save result as Q15
BIC
#MPYFRAC,&MPY32CTL0
; Back to normal mode
Table 9−5. Result Availability in Fractional Mode (MPYFRAC = 1; MPYSAT = 0)
Operation
Result ready in MCLK cycles
After
(OP1 x OP2)
RES0
RES1
RES2
RES3
MPYC Bit
8/16 x 8/16
3
3
4
4
3
OP2 written
24/32 x 8/16
3
5
6
7
7
OP2 written
8/16 x 24/32
3
5
6
7
7
OP2L written
N/A
3
4
4
4
OP2H written
24/32 x 24/32
3
8
10
11
11
OP2L written
N/A
3
5
6
6
OP2H written
Содержание MSP430x4xx Family
Страница 1: ...MSP430x4xx Family 2007 Mixed Signal Products User s Guide SLAU056G ...
Страница 2: ......
Страница 6: ...vi ...
Страница 114: ...3 76 RISC 16 Bit CPU ...
Страница 304: ...5 20 FLL Clock Module ...
Страница 340: ...7 8 Supply Voltage Supervisor ...
Страница 348: ...8 8 16 Bit Hardware Multiplier ...
Страница 372: ...9 24 32 Bit Hardware Multiplier ...
Страница 400: ...10 28 DMA Controller ...
Страница 428: ...13 10 Basic Timer1 ...
Страница 466: ...15 24 Timer_A ...
Страница 522: ...17 30 USART Peripheral Interface UART Mode ...
Страница 544: ...18 22 USART Peripheral Interface SPI Mode ...
Страница 672: ...23 12 Comparator_A ...
Страница 692: ...24 20 LCD Controller ...
Страница 746: ...26 28 ADC12 ...