If-Then-Else Statements in a Loop
6.8.3
Drawing a Dependency Graph
Figure 6–17. Dependency Graph of If-Then-Else Code
6-88
Figure 6–17 shows the dependency graph for the if-then-else C code. This
graph illustrates the following arrangement:
Two nodes on the graph contain sum: one for the ADD and one for the
SUB. Because some iterations are performing an ADD and others are
performing a SUB, each of these nodes is a possible input to the next itera-
tion of either node.
The LDH ai instruction is a parent of both ADD sum and SUB sum, be-
cause both instructions read ai.
CMPEQ if is also a parent to ADD sum and SUB sum, because both read
IF for the conditional execution.
The result of SHL mask is read on the next iteration by the AND cond
instruction.
A side
SHL
1
mask
1
LDH
5
ai
5
ADD
sum
1
B side
AND
cond
1
MVK
!(!(cond))
1
1
CMPEQ
if
1
1
SUB
sum
1
1
ADD
cntr
1
B
LOOP
1
1
Need help?
Do you have a question about the TMS320C6000 and is the answer not in the manual?
Questions and answers