7-50
SC140 DSP Core Reference Manual
Programming Guidelines
•
Observe the immediate operand ranges as specified within the braces { } in
Appendix A.2,
“Instructions,”
on page A-19. Operand values outside these ranges are undefined. Some specific
examples are:
—
ADD #u5,Dn {0 < u5 < 32}
—
ASLL Da,Dn {-40 < Da[6:0] < 40}
•
Observe address pointer alignments on memory accesses as specified in
Table 2-19: Memory
Address Alignment
and within the braces { } in
Appendix A.2, “Instructions.”
Misaligned memory
accesses are undefined. Some specific examples are:
—
MOVE.L (a32),DR {0 £ a32 < 2
32
,L}
, meaning long word aligned (address is a multiple
of 4).
—
MOVE.4F (EA),Da:Db:Dc:Dd {0 £ EA < 2
32
,Q}
, meaning quad word aligned (address is
a multiple of 8).
•
Observe SP and OSP stack pointer quad alignment. The ESP and NSP registers have their three least
significant bits hard-wired to zero. So SP arithmetic results that are not a multiple of 8 cannot be
represented in the ESP and NSP registers. Note that MOVE-like instructions using SP with an offset
to access the stack allow more general alignment based on the memory access size.
•
Observe the word alignment requirement for COF destinations. Computed COF destinations (such
as JMP R0) that are not a multiple of 2 are in error. Misaligned program fetches are undefined. Note
that the PC register has its least significant bit hard-wired to zero.
•
Observe modifier mode parameter constraints on size and offset discussed in
Section 2.3.4,
“Address Modifier Modes.”
Using out-of-range or reserved parameter values may produce
undefined results. Also observe address pointer alignments specific to the selected modifier mode.
•
MOVES should be preceded by an instruction that updates the Ln-bit based on the data. Otherwise,
the data moved may be modified by a Ln-bit not associated with the data.
•
Do not explicitly modify the SR register to change the loop flags LFn and SLF in SR. Use the loop
control instructions in
Table A-14: AGU Loop Control (Including Loop COF) Instructions
on page
A-18.
•
The SR register contains local task context such as the loop flags, T bit, etc. Always save and restore
the SR register on exceptions and OS context switches.
•
The EMR register contains global, not local, status bits. Do not use EMR status bits for local task
context. Do not save and restore EMR on exceptions and OS context switches.
•
Do not return from a subroutine with RTE/D, and do not return from an exception with RTS/D.
•
If the return address on the memory stack is changed to effect a task switch, use RTSTK to bypass
the RAS mechanism. Otherwise, the SC140 will return to the previous caller location if RAS is
valid.
•
Do not use VSL for anything other than the Viterbi algorithm. It violates the endian rules.
•
Do not use “reserved” bits in registers for data storage. Always write “reserved” bits with their initial
reset value (usually zero). This maintains software compatibility if a “reserved” bit is defined in the
future.
7.7.2.2 Binary Code Practices
•
Do not write self-modifying code (replacing portions of an application binary at run-time). It cannot
be checked for errors by the assembler. It is also difficult to debug, and may not be compatible with
future processor implementations.
Содержание SC140 DSP Core
Страница 12: ...xii SC140 DSP Core Reference Manual ...
Страница 18: ...xviii SC140 DSP Core Reference Manual ...
Страница 32: ...1 6 SC140 DSP Core Reference Manual Core Architecture Features ...
Страница 180: ...4 70 SC140 DSP Core Reference Manual Trace Unit Registers ...
Страница 250: ...6 70 SC140 DSP Core Reference Manual Programming Rules ...
Страница 314: ...7 64 SC140 DSP Core Reference Manual NOP Definition ...
Страница 385: ...BMCHG W SC140 DSP Core Reference Manual A 71 u16 iiiiiiiiiiiiiiii 16 bit unsigned immediate data ...
Страница 388: ...A 74 SC140 DSP Core Reference Manual BMCHG W s16 AAAAAAAAAAAAAAAA 16 bit signed SP address offset ...
Страница 391: ...BMCLR SC140 DSP Core Reference Manual A 77 u16 iiiiiiiiiiiiiiii 16 bit unsigned immediate data ...
Страница 454: ...A 140 SC140 DSP Core Reference Manual DECA u5 iiiii 5 bit unsigned immediate data 1 set by the assembler ...
Страница 463: ...DI SC140 DSP Core Reference Manual A 149 15 8 7 0 DI 1 1 4 1 0 0 1 1 1 1 1 0 1 1 1 1 1 0 1 ...
Страница 478: ...A 164 SC140 DSP Core Reference Manual EI ...
Страница 592: ...A 278 SC140 DSP Core Reference Manual MOVE L a32 aaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAA 32 bit absolute long address ...
Страница 618: ...A 304 SC140 DSP Core Reference Manual MOVES 4F s15 sssssssssssssss Signed 15 bit offset ...
Страница 638: ...A 324 SC140 DSP Core Reference Manual MPYR ...
Страница 660: ...A 346 SC140 DSP Core Reference Manual OR W s16 AAAAAAAAAAAAAAAA Signed 16 bit SP address offset ...
Страница 746: ...A 432 SC140 DSP Core Reference Manual ZXTA x ...
Страница 758: ...I 10 Index ...
Страница 759: ...SC140 DSP Core Reference Manual i ...
Страница 760: ......