B displacement, Branch using a displacement b – Texas Instruments TMS320C67X/C67X+ DSP User Manual

Page 129

Advertising
background image

Branch Using a Displacement

B

3-69

Instruction Set

SPRU733

Branch Using a Displacement

B

Syntax

B (.unit) label

.unit = .S1 or .S2

Compatibility

C62x, C64x, C67x, and C67x+ CPU

Opcode

31

29

28

27

7

6

5

4

3

2

1

0

creg

z

cst21

0 0 1 0 0 s p

3

1

21

1

1

Opcode map field used...

For operand type...

Unit

cst21

scst21

.S1, .S2

Description

A 21-bit signed constant, cst21, is shifted left by 2 bits and is added to the
address of the first instruction of the fetch packet that contains the branch
instruction. The result is placed in the program fetch counter (PFC). The
assembler/linker automatically computes the correct value for cst21 by the
following formula:

cst21 = (label − PCE1)

>>

2

If two branches are in the same execute packet and both are taken, behavior
is undefined.

Two conditional branches can be in the same execute packet if one branch
uses a displacement and the other uses a register, IRP, or NRP. As long as only
one branch has a true condition, the code executes in a well-defined way.

Execution

if (cond)

cst21

<<

2 + PCE1

PFC

else nop

Notes:
1) PCE1 (program counter) represents the address of the first instruction

in the fetch packet in the E1 stage of the pipeline. PFC is the program
fetch counter.

2) The execute packets in the delay slots of a branch cannot be interrupted.

This is true regardless of whether the branch is taken.

3) See section 3.5.2 on page 3-18 for information on branching into the

middle of an execute packet.

Advertising