beautypg.com

Motorola DSP96002 User Manual

Page 558

background image

MOTOROLA

DSP96002 USER’S MANUAL

B-39

fmpy d7,d4,d0 fadd.s d2,d1 y:(r4)+,d7.s ;b23 1 1

fmpy.s d7,d3,d2 d1.s,x:(r1)+ y:(r4)+,d7.s ;b33 1 1

fmpy d7,d5,d2 fadd.s d2,d0 y:(r4)+,d7.s ;b43 1 1

fmpy d7,d6,d2 fadd.s d2,d0 y:(r4)+,d7.s ;b14 1 1

fmpy d7,d4,d1 fadd.s d2,d0 y:(r4)+,d7.s ;b24 1 1

fmpy.s d7,d3,d0 d0.s,x:(r1)+ y:(r4)+,d7.s ;b34 1 1

fmpy d7,d5,d0 fadd.s d0,d1 y:(r4)+,d7.s ;b44 1 1

fmpy d7,d6,d0 fadd.s d0,d1 1 1

fadd.s d0,d1 1 1

move d1.s,x:(r1)+ 1 1

--- ---

Totals: 19 19

B.1.22 NxN NxN Matrix Multiply

The matrix multiplications are for square NxN matrices. All the elements are stored in "row major" format.

i.e. for the array A:

a(1,1) ... a(1,N)

a(N,1) ... a(N,N)

the elements are stored:

a(1,1), a(1,2), ..., a(1,N), a(2,1), a(2,2), ..., a(2,N), ...

The following code implements C=AB where A and B are square matrices.

DSP56000 IMPLEMENTATION

Program

ICycles

Words

move #mat_a,r0 ;point to A 1 1

move #mat_b,r4 ;point to B 1 1

move #mat_c,r6 ;output mat C 1 1

move #N,n0 ;array size 1 1

move n0,n5 1 1

do #N,_rows ;do rows 2 3

do #N,_cols ;do columns 2 3

move r0,r1 ;copy start of row A 1 1

move r4,r5 ;copy start of col B 1 1

clr a ;clear sum and pipe 1 1

move x:(r1)+,x0 y:(r5)+n5,y0 1 1