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

Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

Loop Carry Paths
6.7.2

Translating C Code to Linear Assembly (Inner Loop)

Example 6–42. Linear Assembly for IIR Inner Loop
LDH
*xptr++,xi
MPY
c1,xi,p0
LDH
*xptr,xi+1
MPY
c2,xi+1,p1
ADD
p0,p1,s0
LDH
*yptr++,yi
MPY
c3,yi,p2
ADD
s0,p2,s1
SHR
s1,15,yi+1
STH
yi+1,*yptr
[cntr]SUB
cntr,1,cntr
[cntr]B
LOOP
6-78
Example 6–42 shows the 'C6000 instructions that execute the inner loop of the
IIR filter C code. In this example:
xptr is not postincremented after loading xi+1, because xi of the next
iteration is actually xi+1 of the current iteration. Thus, the pointer points to
the same address when loading both xi+1 for one iteration and xi for the
next iteration.
yptr is also not postincremented after storing yi+1, because yi of the next
iteration is yi+1 for the current iteration.
; xi+1
; c1 * xi
; xi+1
; c2 * xi+1
; c1 * xi + c2 * xi+1
; yi
; c3 * yi
; c1 * xi + c2 * xi+1 + c3 * yi
; yi+1
; store yi+1
; 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