Motorola CPU32 Reference Manual page 254

M68300 series central processor unit
Hide thumbs Also See for CPU32:
Table of Contents

Advertisement

If the 8-bit value for X were used directly by the table instruction, interpolation
would be incorrectly performed between entries 0 and 1. Data must be shifted
to the left four places before use:
LSL.W #4, Dx
The new range for
X
is 0
~
X
~
4096; however, since a left shift fills the least
significant digits of the word with zeroes, the interpolation fraction can only have
one of 16 values.
After the shift operation, Dx contains the following value:
31
16
15
0
NOT USED
1 0 0 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1
Execution of the table instruction using the new value in Dx yields:
Table Entry Offset
=>
Dx [8:15]
=
$OB
=
11
Interpolation Fraction
=>
Dx [0:7]
=
$DO
=
208
Thus,
Y
is calculated as follows:
Y
=
80
+
(208 (64 - 80)) / 256
=
67
4.6.4 Table Example 4: Maintaining Precision
In this example, three table lookup and interpolation (TLI) operations are
performed and the results are summed. The calculation is done once with the
result of each TLI rounded before addition and once with only the final result
rounded. Assume that the result of the three interpolations are as follows (a
If."
indicates the binary radix point).
TLI # 1
TLI # 2
TLI #3
0010 0000. 0111 0000
0011 1111.0111 0000
0000 0001 . 0111 0000
First, the results of each TLI are rounded with the TBLS round-to-nearest-even
algorithm. The following values would be returned by TBLS:
CPU32 REFERENCE MANUAL
TLI
#
1
TLI # 2
TLI #3
0010 0000.
0011 1111.
0000 0001 .
INSTRUCTION SET
MOTOROLA
4-201
III

Advertisement

Table of Contents
loading

Table of Contents