Motorola DSP96002 User Manual page 558

32-bit digital signal processor
Table of Contents

Advertisement

fmpy
fmpy.s d7,d3,d2
fmpy
fmpy
fmpy
fmpy.s d7,d3,d0
fmpy
fmpy
move
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)
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.
move
#mat_a,r0
move
#mat_b,r4
move
#mat_c,r6
move
#N,n0
move
n0,n5
do
#N,_rows
do
#N,_cols
move
r0,r1
move
r4,r5
clr
a
move
MOTOROLA
d7,d4,d0 fadd.s d2,d1
d7,d5,d2 fadd.s d2,d0
d7,d6,d2 fadd.s d2,d0
d7,d4,d1 fadd.s d2,d0
d7,d5,d0 fadd.s d0,d1
d7,d6,d0 fadd.s d0,d1
fadd.s d0,d1
a(N,1) ... a(N,N)
DSP56000 IMPLEMENTATION
x:(r1)+,x0 y:(r5)+n5,y0
DSP96002 USER'S MANUAL
y:(r4)+,d7.s ;b23
d1.s,x:(r1)+ y:(r4)+,d7.s ;b33
y:(r4)+,d7.s ;b43
y:(r4)+,d7.s ;b14
y:(r4)+,d7.s ;b24
d0.s,x:(r1)+ y:(r4)+,d7.s ;b34
y:(r4)+,d7.s ;b44
d1.s,x:(r1)+
;point to A
;point to B
;output mat C
;array size
;do rows
;do columns
;copy start of row A
;copy start of col B
;clear sum and pipe
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
--- ---
Totals: 19
19
Program
ICycles
Words
1
1
1
1
1
1
1
1
1
1
2
3
2
3
1
1
1
1
1
1
1
1
B-39

Advertisement

Table of Contents
loading

Table of Contents