dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 255

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
Before a subroutine is exited, be careful to de-allocate space that is reserved on the stack for local
variables. The stack pointer should be decremented so that it points to the saved status register before the
RTS instruction is executed, so the correct return address is popped from the stack.
8.4
The hardware stack is a last-in-first-out (LIFO) stack that consists of two 24-bit internal registers.
Although there are two locations on the stack, the stack is always accessed through the hardware stack
register (HWS). Reads or writes to the HWS access or modify the top location in the stack.
The hardware stack is updated when a hardware DO loop is entered or exited. Executing a DO or DOSLC
instruction (or a write to HWS) pushes the address of the first instruction in the loop onto the stack. When
the loop terminates, the address is popped off the stack. The hardware stack can also be manipulated under
program control with the use of standard MOVE instructions.
When a value is written to HWS, either through a MOVE instruction or by the DO and DOSLC
instructions saving the looping state, the following occur:
Reading a value from HWS does the following:
Freescale Semiconductor
1. The SR’s LF bit is copied to the OMR’s NL bit, overwriting the previous NL value.
2. The value in the first HWS location (HWS0) is copied to the second (HWS1), overwriting
3. The LF bit in the status register is set.
4. The appropriate value is written to the top hardware stack register.
1. Copies the OMR’s NL bit to the SR’s LF bit, overwriting the previous LF value
2. Copies the value in the second hardware stack register to the first, or top, register
3. Clears the OMR’s NL bit
the previous value.
Hardware Stack
SP
Figure 8-4. Example Stack Frame
Program Controller
2nd Passed Parameter
1st Passed Parameter
X Data Memory
2nd Local Variable
3rd Local Variable
4th Local Variable
1st Local Variable
Status Register
Return Address
Hardware Stack
8-17

Related parts for dsp56800e