Motorola DSP96002 User Manual
Page 573
B-54
DSP96002 USER’S MANUAL
MOTOROLA
9. Dynamic bit field clear. Register d1.l contains FOFF, d2.l contains
FSIZE.
Program
ICycles
Words
move #32,d3.l ;register size 1 1 sub
d2,d3 #-1,d2.l ;32-fsize, get 1s mask 2 2 move
d3.l,d3.h ;move shift count 1 1 lsr d3,d2 d1.l,d1.h
;trim mask, get foff 1 1 lsl d1,d2 ;align
mask 1 1 andc d2,d0 ;invert mask
and clear 1 1
--- ---
Totals: 7 7
10. Dynamic bit field set. Register d1.l contains FOFF, d2.l contains FSIZE.
Program
ICycles
Words
move #32,d3.l ;register size 1 1 sub
d2,d3 #-1,d2.l ;32-fsize, get 1s mask 2 2 move
d3.l,d3.h ;move shift count 1 1 lsr d3,d2 d1.l,d1.h
;trim mask, get foff 1 1 lsl d1,d2 ;align
mask 1 1 or d2,d0 ;clear bit
field 1 1
--- ---
Totals: 7 7
B.1.29 Newton-Raphson Approximation for 1.0/SQRT(x)
The Newton-Raphson iteration can be used to approximate the function:
1.0
y= -------
sqrt(x)
by minimizing the function:
1.0
F(y) = x - -------
y*y
Given an initial approximate value y=1/sqrt(x), the Newton-Raphson iteration for refining the estimate is:
y(n+1)=y(n)*(3.0-x*y*y)/2.0
Newton-Raphson Approximation
Program
ICycles
of 1.0/SQRT(x)
Words