Texas Instruments TMS320C2XX Calculator User Manual


 
Conditional Branches, Calls, and Returns
5-11
Program Control
Group 2. You can select up to three conditions. Each of these conditions
must be from a different category (A, B, or C); you cannot have two condi-
tions from the same category. For example, you can test TC, C, and BIO
at the same time, but you cannot test C and NC at the same time.
Table 5–4. Groupings of Conditions
Group 1 Group 2
Category A Category B Category A Category B Category C
EQ OV TC C BIO
NEQ NOV NTC NC
LT
LEQ
GT
GEQ
5.4.2 Stabilization of Conditions
A conditional instruction must be able to test the most recent values of the sta-
tus bits. Therefore, the conditions cannot be considered stable until the fourth,
or execution, stage of the pipeline, one cycle after the previous instruction has
been executed. The pipeline controller stops the decoding of any instructions
following the conditional instruction until the conditions are stable.
5.4.3 Conditional Branches
A branch instruction transfers program control to any location in program
memory. Conditional branch instructions are executed only when one or more
user-specified conditions are met (see Table 5–3 on page 5-10). If all the
conditions are met, the PC is loaded with the second word of the branch
instruction, which contains the address to branch to, and execution continues
at this address.
By the time the conditions have been tested, the two instruction words follow-
ing the conditional branch instruction have already been fetched in the pipe-
line. If all the conditions are met, these two instruction words are flushed from
the pipeline so that they are not executed, and then execution continues at the
branched-to address. If the conditions are
not
met, the two instruction words
are executed instead of the branch. Because conditional branches use condi-
tions determined by the execution of the previous instructions, a conditional
branch takes one more cycle than an unconditional one.