beautypg.com

Motorola DSP96002 User Manual

Page 595

background image

B-76

DSP96002 USER’S MANUAL

MOTOROLA

B.1.42

Signed Reciprocal Generation

This generates a fast approximation to 1/x.

Approximation of 1/d1

Program

ICycles

16 Bit Accuracy

Words

fseedd d1,d6 1 1

fmpy.s d1,d6,d1 #2.0,d4.s 2 2

fsub.s d1,d4 1 1

fmpy.s d6,d4,d1 1 1

--- ---

Totals: 5 5


Approximation of 1/d1

Program

ICycles

32 Bit Accuracy

Words

fseedd d1,d6 1 1

fmpy.s d1,d6,d1 #2.0,d4.s 2 2

fsub.s d1,d4 d4.s,d3.s 1 1

fmpy.s d1,d4,d1 1 1

fmpy d6,d4,d1 fsub.s d1,d3 1 1

fmpy.s d1,d3,d1 1 1

--- ---

Totals: 7 7

B.1.43

Line Drawing

B.1.43.1

Floating-Point Incremental Line Drawing Algorithm

This algorithm generates points along a line given the endpoints. As the coordinate along one axis is incre-

mented in fixed point, the other coordinate is incremented in floating-point and then converted to fixed

point. A full line drawing algorithm which draws lines in all directions is given below.

Registers:

d0 = temporary d4 = temporary x1 d8 =

d1 = temporary d5 = temporary y1 d9 = 2.0

d2 = x1 (dx) d6 = x0 and xScreen

d3 = y1 (dy) d7 = y0 and yScreen