XC886/888CLM
Multiplication/Division Unit
User’s Manual
10-3
V1.3, 2010-02
MDU, V2.1
10.1.1
Division Operation
The MDU supports the truncated division operation, which is also the ISO C99 standard
and the popular choice among modern processors. The division and modulus functions
of the truncated division are related in the following way:
If q = D div d
and r = D mod d
then D = q * d + r
and | r | < | d |
where “D” is the dividend, “d” is the divisor, “q” is the quotient and “r” is the remainder.
The truncated division rounds the quotient towards zero and the sign of its remainder is
always the same as that of its dividend, i.e., sign (r) = sign (D).
10.1.2
Normalize
The MDU supports up to 32-bit unsigned normalize.
Normalizing is done on an unsigned 32-bit variable stored in MD0 (least significant byte)
to MD3 (most significant byte). This feature is mainly meant to support applications
where floating point arithmetic is used. During normalization, all leading zeros of the
unsigned variable in registers MD0 to MD3 are removed by shift left operations. The
whole operation is completed when the MSB (most significant bit) contains a 1.
After normalizing, bit field MR4.SCTR contains the number of shift left operations that
were done. This number may be used later as an exponent. The maximum number of
shifts in a normalize operation is 31 (= 2
5
- 1).
10.1.3
Shift
The MDU implements both logical and arithmetic shifts to support up to 32-bit unsigned
and signed shift operations.
During logical shift, zeros are shifted in from the left end of register MD3 or right end of
register MD0. An arithmetic left shift is identical to a logical left shift, but during arithmetic
right shifts, signed bits are shifted in from the left end of register MD3. For example, if
the data 0101
B
and 1010
B
are to undergo an arithmetic shift right, the results obtained
will be 0010
B
and 1101
B
, respectively.
For any shift operation, register bit MD4.SLR specifies the shift direction, and
MD4.SCTR the shift count.
Note: The MDU does not detect overflows due to an arithmetic shift left operation. User
must always ensure that the result of an arithmetic shift left is within the
boundaries of MDU.
*
Содержание XC886CLM
Страница 1: ...User s Manual V1 3 2010 02 Microcontrollers 8 Bit XC886 888CLM 8 Bit Single Chip Microcontroller...
Страница 3: ...User s Manual V1 3 2010 02 Microcontrollers 8 Bit XC886 888CLM 8 Bit Single Chip Microcontroller...
Страница 324: ...XC886 888CLM Serial Interfaces User s Manual 12 52 V1 3 2010 02 Serial Interfaces V 1 0...
Страница 663: ...w w w i n f i n e o n c o m Published by Infineon Technologies AG...