DATA REPRESENTATION AND ROUNDING
MOTOROLA
DATA ARITHMETIC LOGIC UNIT 3 - 13
A1 or B1(see Figure 3-8).
A comparison between integer and fractional number representation is shown in Figure
3-8. The number representation for integers is between
±
2
(N-1)
; whereas, the fractional
representation is limited to numbers between
±
1. To convert from an integer to a frac-
tional number, the integer must be multiplied by a scaling factor so the result will always
be between
±
1. The representation of integer and fractional numbers is the same if the
numbers are added or subtracted but is different if the numbers are multiplied or divided.
An example of two numbers multiplied together is given in Figure 3-9. The key difference
is that the extra bit in the integer multiplication is used as a duplicate sign bit and as the
least significant bit (LSB) in the fractional multiplication. The advantages of fractional
data representation are as follows:
The MSP (left half) has the same format as the input data.
The LSP (right half) can be rounded into the MSP without shifting or updating the
exponent.
A significant bit is not lost through sign extension.
Conversion to floating-point representation is easier because the industry-standard
floating-point formats use fractional mantissas.
Coefficients for most digital filters are derived as fractions by the high-level language
programs used in digital-filter design packages, which implies that the results can be
used without the extensive data conversions that other formats require.
Should integer arithmetic be required in an application, shifting a one or zero, depending
on the sign, into the MSB converts a fraction to an integer.
The Data ALU MAC performs rounding of the accumulator register to single precision if
requested in the instruction (the A1 or B1 register is rounded according to the contents of
the A0 or B0 register). The rounding method is called round-to-nearest (even) number, or
convergent rounding. The usual rounding method rounds up any value above one-half
S
S
N BITS
N BITS
–2(N–1) TO [+2(N–1) –1]
–1 TO [+1–2–(N–1)]
TWOS COMPLEMENT INTEGER
TWOS COMPLEMENT FRACTIONAL
FRACTIONAL = INTEGER EXCEPT FOR X AND ÷
Figure 3-8 Integer/Fractional Number Comparison