Using The Assembly Optimizer For The Weighted Vector Sum - Texas Instruments TMS320C6000 Programmer's Manual

Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

6.6.7

Using the Assembly Optimizer for the Weighted Vector Sum

Example 6–39. Linear Assembly for Weighted Vector Sum
.global _w_vec
_w_vec: .cproc
.reg
.reg
MVK
MVKH
MVK
ADD
LOOP:
.trip 50
LDW
LDW
MPY
MPYHL
SHR
SHR
AND
SHR
ADD
ADD
STH
STH
[cntr]
SUB
[cntr]
B
.endproc
Example 6–39 shows the linear assembly code to perform the weighted vector
sum. You can use this code as input to the assembly optimizer to create a soft-
ware-pipelined loop instead of scheduling this by hand.
a, b, c, m
ai_i1, bi_i1, pi, pi1, pi_i1, pi_s, pi1_s
mask, bi, bi1, ci, ci1, c1, cntr
–1,mask
0,mask
50,cntr
2,c,c1
.D2
*a++,ai_i1
.D1
*b++,bi_i1
.M1
ai_i1,m,pi
.M2
ai_i1,m,pi1
.S1
pi,15,pi_s
.S2
pi1,15,pi1_s ; (m * ai+1) >> 15
.L2X
bi_i1,mask,bi ; bi
.S2
bi_i1,16,bi1 ; bi+1
.L1X
pi_s,bi,ci
.L2X
pi1_s,bi1,ci1 ; ci+1 = (m * ai+1) >> 15 + bi+1
.D2
ci,*c++[2]
.D1
ci1,*c1++[2] ; store ci+1
cntr,1,cntr
LOOP
Modulo Scheduling of Multicycle Loops
; set to all 1s to create 0xFFFFFFFF
; clear upper 16 bits to create 0xFFFF
; cntr = 100/2
; point to c[1]
; ai & ai+1
; bi & bi+1
; m * ai
; m * ai+1
; (m * ai) >> 15
; ci = (m * ai) >> 15 + bi
; store ci
; decrement loop counter
; branch to loop
Optimizing Assembly Code via Linear Assembly
6-73

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C6000 and is the answer not in the manual?

Questions and answers

Table of Contents