Program Control
PC Relative Instructions
MOTOROLA
Optimizing DSP56300/DSP56600 Applications
3-13
add
b,x1
bra
_CONT
_TRUE
add
b,x0
_CONT
.....
Using conditional instructions, the code can be written more
compactly, as listed below:
cmp
Y0,a
add
b,x0
IFeq
add
b,x1
IFne
The only difference between the two codes is that the Status
Register in the later option is not updated according to the
calculation result. Conditional execution with CCR update may in
some cases solve the problem, as in the following example:
btst
#0,a0
;CCR is updated according to the
asr
a
IFcs.U
;value of A if the instruction
;was executed.
Another example of using the CCR update is setting a complex
condition by accumulating simple comparison results. For example,
consider the high-level code line and its translation in assembly
listed below:
if (X0 < A && X1 < A) then {A=A+y0; b=b+y0}
cmp
X0,a
x:(r0),x1
;test for X0<a. parallel field
;used to set X1 for next cmp
cmp
X1,a
IFgt.U
;test for X1<a only if the last
;condition was true.
add
y0,a
IFgt
;A=A+y0,B=B+y0 only if both
;conditions were true.
add
y0,b
IFgt
3.6
PC RELATIVE INSTRUCTIONS
Many of the DSP56300 control instructions require a program
location as one of their arguments. The most obvious example is a
jump instruction, which needs the jump address. A strong feature of
the DSP56300 instruction set is the ability to reference program
locations relative to the Program Counter. Almost all instructions
that need program location arguments can be given both PC relative
and an absolute address. In the
DSP56300 Family Manual
, using
traditional mnemonic convention, jumps using PC relative
addressing are referred to as “branches”, while those using absolute
addressing are referred to as “jumps”.
Содержание DSP56300
Страница 49: ...3 20 Optimizing DSP56300 DSP56600 Applications MOTOROLA Program Control Using Fast Interrupts ...
Страница 95: ...7 10 Optimizing DSP56300 DSP56600 Applications MOTOROLA Compact Opcode Use Special Instructions ...
Страница 99: ...A 4 Optimizing DSP56300 DSP56600 Applications MOTOROLA Saving Power Disabling Functional Blocks ...
Страница 103: ...B 4 Optimizing DSP56300 DSP56600 Applications MOTOROLA Debug and Test Support Address Tracing ...