User`s manual

Program Control
Using the Stack Extension
MOTOROLA Optimizing DSP56300/DSP56600 Applications 3-7
3.3 USING THE STACK EXTENSION
The hardware stack could be extended to the data memory (X or Y),
and it’s depth could be set by the user according to need. After
initialization, the stack extension works automatically without any
user overhead, giving the same functionality as the hardware stack.
The registers participating in stack extension operation are listed in
Table 3-2.
Stack extension initialization bits in the OMR include the XYS (X Y
Select) bit, by which the user selects the data space (X or Y) in which
the stack extension will reside, and the SEN (Stack Extension
Enable) bit, by which the user activates the stack extension after all
the relevant registers are initialized.
The SP register counts the number of entries in the stack. If the stack
extension is disabled, the values of SP are bounded to 0–15, and
selection of other values cause a stack error exception. When the
stack extension is enabled, SP may hold values from 0 up to the
value stored in SZ. A push increments SP by 1, a pop decrements it
by 1.
SZ stores the maximum stack depth. During stack extension
operation, if SP becomes greater than SZ, a stack overflow exception
occurs. SZ has no default value, and therefore, must be initialized
by the user before enabling the stack extension. Set the SZ value
according the amount of memory available to the user, using the
Table 3-2 Registers Involved in Stack Extension Operation
Register Name Function
OMR operating
mode register
stack extension initialization (bits:SEN,XYS)
stack extension status (bits: WRP,EOV,EUN)
SZ stack extension
size
maximum stack depth, in word pairs.
SP stack pointer current total stack depth, in word pairs
SC stack counter current hardware stack depth.
EP stack extension
pointer
pointer to the last address written in the
memory extension.