Motorola DSP Developer's Kit | ![]() ![]() |
Y = mot###_log(X)
Description
This function returns the natural logarithm elements of input vector X. The input vector X is a real vector
Input/Output
Algorithm
log(Z) in a1
(a2
is sign extended anda0
=don't care). log(Z) = log2(Z)*log(2) log2(Z)= pi3*(Z**3) +pi2*(Z**2) + pi1*Z + pi0 i = 1, 2, 3. The range of the input number is divided into three different subranges and corresponding pij's(i=1,2,3; j=0,1,2,3)
are used for each range. Range 1: 1 > Z > 0.8 p13 = 0.6651550174712363 p12 = -2.691225081621167 p11 = 4.830861130814611 p10 = -2.8047790282999791 Range 2: 0.8 >= Z > 0.64 p23 = 1.299130893496323 p22 = -4.205039190029353 p21 = 6.038576413515295 p20 = -3.126707123185897 Range 3: 0.64 >= Z >= 0.5 p33 = 2.62317472043452 p32 = -6.720343733123614 p31 = 7.635399480799159 p30 = -3.465490657054861 In the following pseudocodecij = pij/8 (i=1,2,3)
(j=0,1,2,3) log2nrm(Z) = [log2(ZS)/8 + (-S)/8]/2 FindS
such thatZS = (2**S)*Z
lies in the range [0.5,1] Find the range ofZS
. If1 > ZS > 0.8
Range 1: Find Term1_1 = c13* ZS + c12 Find Term1_2 = Term1_1*ZS + c11 Find log2(ZS)/8 = Term1_2 * ZS + c10 If0.8 >= ZS > 0.64
Range 2: Find Term2_1 = c23 * ZS + c22 Find Term2_2 = Term2_1 * ZS +c21 Find log2(ZS)/8 = Term2_3 * ZS + c20 If0.64 >= ZS >= 0.5
Range 3: Find Term3_1 = c33 * ZS + c32 Find Term3_2 = Term3_1 * ZS +c31 Find log2(ZS)/8 = Term3_2 * ZS + c30
Memory & Register
6 for dsp56300
5 for dsp56600
tmp
Assumes M{0...7} = $ffff
Status Register
The assembly function log-r.asm
does not set explicitly any status registers/bits during the function execution.
Data Size Limit
The length of vector X can't be larger than the continuous available data memory size.
Data Range Limit
The value of input vector X must be between -1.0 and +1.0.
Precision
In the case of DSP563, precision is 16 bits.
In the case of DSP566, precision is 12 bits.
![]() | interp-c.asm | log-c.asm | ![]() |