Table Lookup And Interpolation Instructions - Motorola CPU32 Reference Manual

Hide thumbs Also See for CPU32:
Table of Contents

Advertisement

4.6 Table Lookup and Interpolation Instructions

There are four table lookup and interpolate instructions. TBLS returns a signed, round-
ed byte, word, or long-word result. TBLSN returns a signed, unrounded byte, word, or
long-word result. TBLU returns an unsigned, rounded byte, word, or long-word result.
TBLUN returns an unsigned, unrounded byte, word, or long-word result. All four in-
structions support two types of interpolation data: an n-element table stored in memo-
ry, and a two-element range stored in a pair of data registers. The latter form provides
a means of performing surface (3D) interpolation between two previously calculated
linear interpolations.
The following examples show how to compress tables and use fewer interpolation lev-
els between table entries. Example 1 (see Figure 4-3) demonstrates table lookup and
interpolation for a 257-entry table, allowing up to 256 interpolation levels between en-
tries. Example 2 (see Figure 4-4) reduces table length for the same data to four en-
tries. Example 3 (see Figure 4-5) demonstrates use of an 8-bit independent variable
with an instruction.
Two additional examples show how TBLSN can reduce cumulative error when multi-
ple table lookup and interpolation operations are used in a calculation. Example 4
demonstrates addition of the results of three table interpolations. Example 5 illustrates
use of TBLSN in surface interpolation.
4.6.1 Table Example 1: Standard Usage
Y
The table consists of 257 word entries. As shown in Figure 4-3, the function is linear
within the range 32768 ≤ X ≤ 49152. Table entries within this range are as follows:
MOTOROLA
4-188
16384
32768
INDEPENDENT VARIABLE
Figure 4-3 Table Example 1
INSTRUCTION SET
49152
65536
X
CPU32
REFERENCE MANUAL

Advertisement

Table of Contents
loading

Table of Contents