Modulo Scheduling Of Multicycle Loops; Weighted Vector Sum C Code; Translating C Code To Linear Assembly - Texas Instruments TMS320C6000 Programmer's Manual

Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

Modulo Scheduling of Multicycle Loops

6.6 Modulo Scheduling of Multicycle Loops
6.6.1

Weighted Vector Sum C Code

Example 6–34. Weighted Vector Sum C Code
void w_vec(short a[],short b[],short c[],short m)
{
int i;
for (i=0; i<100; i++) {
c[i] = ((m * a[i]) >> 15) + b[i];
}
}
6.6.2

Translating C Code to Linear Assembly

Example 6–35. Linear Assembly for Weighted Vector Sum Inner Loop
LDH
*aptr++,ai
LDH
*bptr++,bi
MPY
m,ai,pi
SHR
pi,15,pi_scaled
ADD
pi_scaled,bi,ci
STH
ci,*cptr++
[cntr]SUB
cntr,1,cntr
[cntr]B
LOOP
6-58
Section 6.5 demonstrated the modulo-scheduling technique for the dot
product code. In that example of a single-cycle loop, none of the instructions
used the same resources. Multicycle loops can present resource conflicts
which affect modulo scheduling. This section describes techniques to deal
with this issue.
Example 6–34 shows the C code for a weighted vector sum.
Example 6–35 shows the linear assembly that executes the weighted vector
sum in Example 6–34. This linear assembly does not have functional units as-
signed. The dependency graph will help in those decisions. However, before
looking at the dependency graph, the code can be optimized further.
; ai
; bi
; m * ai
; (m * ai) >> 15
; ci = (m * ai) >> 15 + bi
; store ci
; decrement loop counter
; branch to loop

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

Subscribe to Our Youtube Channel

Table of Contents