Motorola DSP56600 Manual page 45

Application optimization for digital signal processors
Table of Contents

Advertisement

Program Control
PC Relative Instructions
3-16
Table 3-5 Instructions with Program Memory Arguments
Address
Function
Argument
Note:
1. The LRA opcode can only add a displacement to the PC. The Assembler
translates the absolute address to displacement from the Location Counter, so
the two modes (absolute address/ displacement register) are the same from the
machine's point of view.
There are two main advantages for using PC relative addressing
over absolute addressing:
1. Code Relocation—Code written with PC relative code could
be relocated, reused or imported to different program
addresses without the need to update the program labels.
2. Code Compactness—Most address references are generally
to locations not many memory words away in the program.
Therefore, the PC displacement will usually be a small
number, that may fit in the address field of a 1-word opcode.
Absolute addressing generally will not fit, and requires a
second word to specify it.
Compare the following 2 examples:
;first example: using absolute addressing
_CONT
;second example: using PC relative addressing
_CONT1
After assembly, the labels _CONT and _CONT1 have definite
values. In the first example, if _CONT > 4095, then the Assembler
must use the 2-word opcode, placing the value of _CONT as the
second word. _CONT1, however, has the value of 2, therefore fitting
into the 1-word opcode version of the instruction Bcc (Branch on
Condition). Furthermore, the value of _CONT1 remains the same
regardless of the location of the code in the program space. The
Short Addressing mode force operator ("<" in the Bne argument)
Optimizing DSP56300/DSP56600 Applications
Mnemonic
cmp
x0,a
jne
_CONT
inc
b
rts
cmp
x0,a
bne
<_CONT1
inc
b
rts
The Address Argument
Encoded in the
2nd
Register
opcode
word
(total 1 w)
MOTOROLA
Data
Memory
<ea>

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dsp56300

Table of Contents