![Texas Instruments TMS320C80 Скачать руководство пользователя страница 58](http://html.mh-extra.com/html/texas-instruments/tms320c80/tms320c80_user-manual_1094755058.webp)
Prototyping Code Using Linker Command Files
3-18
TMS320C80 to TMS320C82 Software Compatibility User’s Guide
Example 3–9.Assembly Language Function to Calculate the Dot Product of Two Vectors
a_addr
.set
d1
; pointer to A[] passed in d1
b_addr
.set
d2
; pointer to B[] passed in d2
vect_size
.set d3
; vector size is passed in d3
dot_product
.set
d5
; the dot product of A and B is
; returned in d5.
A
.reg d
; ppca determines the registers
B
.reg d
; these variables will be assigned to.
prod
.reg
d
La_A_ptr
.reg
la
Ga_B_ptr
.reg
ga
.lock d6, d7, a4, a12
; tell ppca not to use
; these registers
.entry a_addr, b_addr, vect_size ; tell ppca that registers
; are live on entry (these
; are the arguments passed
; from the C calling function).
.system $dot_product
; define function entry point
.system _dot_product
; so that it is visible
; to both MP and PP C.
$dot_product:
_dot_product:
La_A_ptr = a_addr
; initialize a local address
; register to vector A.
Ga_B_ptr = b_addr
; initialize global address
; register to vector B.
lrse2 = vect_size – 1
; Use the fast initialization
; form to set up a single
; instruction loop. The PP
; executes the instruction
; at DOT_PROD_LOOP vect_size
; times.
prod = 0
; clear prod.
|| A =h *L+
; load first element of A,
; using the local port
; and postincrement A’s
; pointer.
dot_product = 0
; clear dot_product
|| B =h *G+
; load first element of B,
; using the global port
; and postincrement B’s
; pointer.
DOT_PROD_LOOP:
prod = A * B
; calculate the product of
; A and B
|| dot_product=dot_prod ; calculate sum of products
|| B =h *G+
; load next B element (global port)
|| A =h *L+
; load next A element (local port)
.cjump DOT_PROD_LOOP
; tell ppca that the code conditionally
; loops to DOT_PROD_LOOP.
br = iprs
; return to calling function.
dot_product = dot_p prod ; calculate last sum.
nop
.uexit
; tell ppca that this is the end of
; this function.
Содержание TMS320C80
Страница 1: ...TMS320C80 to TMS320C82 Software Compatibility User s Guide 1995 Digital Signal Processing Products ...
Страница 2: ...SPRU154 Printed in U S A November 1995 M418017 9741 revision ...
Страница 8: ...vi TMS320C80 to TMS320C82 Software Compatibility User s Guide ...
Страница 16: ...xiv TMS320C80 to TMS320C82 Software Compatibility User s Guide ...
Страница 30: ...1 14 TMS320C80 to TMS320C82 Software Compatibility User s Guide ...
Страница 40: ...2 10 TMS320C80 to TMS320C82 Software Compatibility User s Guide ...
Страница 64: ...A 6 TMS320C80 to TMS320C82 Software Compatibility User s Guide ...