dsp56800 Freescale Semiconductor, Inc, dsp56800 Datasheet - Page 130

no-image

dsp56800

Manufacturer Part Number
dsp56800
Description
16-bit Digital Signal Controllers
Manufacturer
Freescale Semiconductor, Inc
Datasheet
Program Controller
data memory pointed to by the stack pointer (SP) register. The PUSH instruction macro (two instruction
cycles) pre-increments the SP register, and the POP instruction (one instruction cycle) will post-decrement
the SP register.
The program counter and the SR are pushed on this stack for subroutine calls and interrupts. These
registers are pulled from the stack for returns from subroutines using the RTS instruction (which pulls and
discards the original SR). For returns from interrupt service routines that use the RTI instruction (the entire
SR is restored from the stack).
The software stack is also used for nesting hardware DO loops in software on the DSP56800 architecture.
On the DSP56800 architecture, the user must push and pop the LA and LC registers explicitly if DO loops
are nested. In this case, the software stack is typically used for this purpose, as demonstrated in
Section 8.6.4, “Nested Loops,” on page 8-22. The hardware stack is used, however, for stacking the
address of the first instruction in the loop. Because this stack is implemented using locations in the X data
memory, there is no limit to the number of interrupts or jump-to subroutines or combinations of these that
can be accommodated by this stack.
See Section 8.5, “Multiple Value Pushes,” on page 8-19 and Section 8.8, “Parameters and Local
Variables,” on page 8-28 for recommended techniques for using the software stack.
5.3
The DSC core supports looping on a single instruction (REP looping) and looping on a block of
instructions (DO looping). Hardware DO looping allows fast looping on a block of instructions and is
interruptible. Once the loop is set up with the DO instruction, there is no additional execution time to
perform the looping tasks. REP looping repeats a one-word instruction for the specified number of times
and can be efficiently nested within a hardware DO loop. It allows for excellent code density because
blocks of in-line code of a single instruction can be replaced with a one-word REP instruction followed by
the instruction to be repeated. The correct programming of loops is discussed in detail in Section 8.6,
“Loops,” on page 8-20.
5.3.1
The REP instruction is a one-word instruction that performs single-instruction repeating on one-word
instructions. It repeats the execution of a single instruction for the amount of times specified either with a
6-bit unsigned value or with the 13 least significant bits of a DSC core register. When a repeat loop is
begun, the instruction to be repeated is only fetched once from the program memory; it is not fetched each
time the repeated instruction is executed. Repeat looping does not use any locations on the hardware stack.
It also has no effect on the LF or NL bits in the SR and OMR, respectively. Repeat looping cannot be used
on an instruction that accesses the program memory; it is necessary to use DO looping in this case.
5-14
Program Looping
Repeat (REP) Looping
Care must be taken to allocate enough space in the X data memory so that
stack operations do not overlap other areas of data used by the program.
Similarly, it may be desirable to locate the stack in on-chip memory to
avoid delays due to wait states or bus arbitration.
DSP56800 Family Manual
NOTE:
Freescale Semiconductor

Related parts for dsp56800