beautypg.com

Motorola DSP96002 User Manual

Page 646

background image

MOTOROLA

DSP96002 USER’S MANUAL

B-127

Totals: 44 8N+37

B.1.54

[NxN] by [NxN] Matrix Multiplication (Modulo-Aligned)

;This routine performs an [NxN] by [NxN] matrix multiplication
;for the 96000 floating-point DSP chip. Sample data is given
;for N=4. The data for all matrices is stored in row major
;format. For example, take the matrix A:
;
; A(1,1) ... A(1,N)
; . . .
; . . .
; A(N,1) ... A(N,N)
;
;Matrix A’s elements are stored as such:
;amatrix dc A(1,1),A(1,2),...,A(1,N),A(2,1),A(2,2),...,A(2,N), ...
;
;Matrices A and C are in X memory, while matrix B is in Y memory.
;Since modulo N**2 addressing is used for all matrices, the first
;k least significant bits of the address of the beginning of any
;matrix storage area must be equal to zero, where 2**k >= N**2.
;
;This routine takes
;
; 16 + n(3 + n(2 +n(1) + 2) + 2)
;
; = n**3 + 4n**2 + 5n + 16 instruction cycles to complete.
;
;
;
Program ICycles
Words
page 132,60,1,1
N equ 4
N_sqr equ N*N
org x:$0
amatrix dc .1,.2,.3,.4
dc .5,.6,.7,.8
dc .9,.1,.2,.3
dc .4,.5,.6,.7
org x:$20
cmatrix ds N_sqr
org y:$0
bmatrix dc .5,.5,.5,.5