Motorola DSP96002 User Manual page 717

32-bit digital signal processor
Table of Contents

Advertisement

move
d0.d,l:ieee_out ;output as dp ieee number
move
(r2)-n2
jmp
_loop
;
;
;
;
; ***NOTE:
All numbers are assumed to be in DPLIB format.
;
org
x:0
order
equ
3
elements equ
order*order
a
ds
4*elements
org
x:64
b
ds
4*elements
org
x:128
c
ds
4*elements
;
org
p:$100
start
move
#a,r2
move
#b,r1
move
#c,r0
move
#4,n0
move
#order*4,n1
move
#4,n2
move
#(elements-order+1)*4,n3
move
#(order+1)*4,n4
move
n1,n5
move
#(elements*4)-1,m0
move
#(elements*4)-1,m1
move
#(elements*4)-1,m2
;
3x3mult
do
#order,rows
do
#order,columns ;calculate each column of the result
jsr
dp_mpy
move
(r1)+n1
move
(r2)+n2
jsr
dp_mac
move
(r1)+n1
move
(r2)+n2
jsr
dp_mac
move
n3,n2
move
n4,n1
move
(r0)+n0
move
(r1)+n1
move
(r2)+n2
move
n0,n2
move
n5,n1
columns
move
n1,n2
move
#b,r1
move
(r2)+n2
move
n0,n2
rows
stop
include "dplib"
end
B-198
;delete last sample
NxN by NxN Matrix Multiplication Example
Multiply Two Matrices:
;Nth order system
;matrix A stored starting at x:$00
;matrix B stored starting at x:$40
;matrix C stored starting at x:$80
;r2 points to matrix A elements
;r1 points to matrix B elements
;r0 points to matrix C (the result)
;offset for 4 word numbers
;offset for one row
;offset for 4 word numbers
;calculate each row of the result
;multiply the first row-column elements
;update B offset for next column element
;update A offset for next row element
;accumulate the inner products
;update B offset for next column element
;update A offset for next row element
;accumulate the inner products
;update A offset to return to column 1
;update B offset for next column
;update result matrix pointer
;point to a row 1 element
;point to a column 1 element
;restore A offset
;restore B offset
;update A offset for row shift
;point to B column 1
;point to the next A row
;restore A offset
;resultant matrix finished
DSP96002 USER'S MANUAL
AB = C
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents