Translating C Code To Linear Assembly (Outer Loop) - Texas Instruments TMS320C6000 Programmer's Manual

Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

Outer Loop Conditionally Executed With Inner Loop

6.14.3 Translating C Code to Linear Assembly (Outer Loop)

Example 6–74. Linear Assembly for FIR Outer Loop
[sctr]
SUB
[!sctr]
SHR
[!sctr]
SHR
[!sctr]
STH
[!sctr]
STH
[!sctr]
MVK
[pctr]
SUB
[!pctr]
SUB
[!pctr]
SUB
[!pctr]
SUB
[!pctr]
SUB
[!pctr]
MVK
6.14.4 Unrolled FIR Filter C Code
6-138
Example 6–74 shows the instructions that execute all of the outer loop func-
tions. All of these instructions are conditional on inner loop counters. Two
different counters are needed, because they must decrement to 0 on different
iterations.
The resetting of the x and h pointers is conditional on the pointer reset
counter, prc.
The shifting and storing of the even and odd y elements are conditional on
the store counter, sctr.
When these counters are 0, all of the instructions that are conditional on that
value execute.
The MVK instruction resets the pointers to 8 because after every eight
iterations of the loop, a new inner loop is completed (8
processed).
The pointer reset counter becomes 0 first to reset the load pointers, then
the store counter becomes 0 to shift and store the result.
sctr,1,sctr
sum07,15,y0
sum17,15,y1
y0,*y++[2]
y1,*y_1++[2]
4,sctr
pctr,1,pctr
x,rstx2,x
x_1,rstx1,x_1
h,rsth1,h
h_1,rsth2,h_1
4,pctr
The total number of instructions to execute both the inner and outer loops is
38 ( 26 for the inner loop and 12 for the outer loop). A 4-cycle loop is no longer
possible. To avoid slowing down the throughput of the inner loop to reduce the
outer-loop overhead, you must unroll the FIR filter again.
Example 6–75 shows the C code for the FIR filter, which operates on eight
elements every inner loop. Two outer loops are also being processed together,
as in Example 6–72 on page 6-136.
; dec store lp cntr
; (sum0 >> 15)
; (sum1 >> 15)
; y[j] = (sum0 >> 15)
; y[j+1] = (sum1 >> 15)
; reset store lp cntr
; dec pointer reset lp cntr
; reset x ptr
; reset x_1 ptr
; reset h ptr
; reset h_1 ptr
; reset pointer reset lp cntr
4 elements are

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