Download MC68340 - mct.de

Transcript
First, the results of each TBL are rounded with the TBLS round-to-nearest-even algorithm.
The following values would be returned by TBLS:
TBL # 1
TBL # 2
TBL # 3
0010 0000 .
0011 1111 .
0000 0001 .
Summing, the following result is obtained:
0010
0011
0000
0110
0000 .
1111 .
0001 .
0000 .
Now, using the same TBL results, the sum is first calculated and then rounded according
to the same algorithm:
0010
0011
0000
0110
0000 . 0111
1111 . 0111
0001 . 0111
0001 . 0101
0000
0000
0000
0000
Rounding yields:
0110 0001 .
The second result is preferred. The following code sequence illustrates how addition of a
series of table interpolations can be performed without loss of precision in the intermediate
results:
L0:
TBLSN.B
TBLSN.B
TBLSN.B
ADD.L
ADD.L
ASR.L
BCC.B
ADDQ.B
L1: . . .
MOTOROLA
〈ea〉, Dx
〈ea〉, Dx
〈ea〉, Dl
Dx, Dm
Dm, Dl
#8, Dl
L1
#1, Dl
Long addition avoids problems with carry
Move radix point
Fraction MSB in carry
MC68340 USER’S MANUAL
5-35