System and user stack management, System-stack pointer, 10 system and user stack management – Texas Instruments TMS320C3x User Manual

Page 182

Advertising
background image

System and User Stack Management

6-29

Addressing Modes

6.10 System and User Stack Management

The ’C3x provides a dedicated system-stack pointer (SP) for building stacks
in memory. The auxiliary registers can also be used to build a variety of more
general linear lists. This section discusses the implementation of the following
types of linear lists:

-

Stack

The stack is a linear list for which all insertions and deletions are made at
one end of the list.

-

Queue

The queue is a linear list for which all insertions are made at one end of the
list and all deletions are made at the other end.

-

Dequeue

The dequeue is a double-ended queue linear list for which insertions and
deletions are made at either end of the list.

6.10.1 System-Stack Pointer

The system-stack pointer (SP) is a 32-bit register that contains the address of
the top of the system stack. The system stack fills from low-memory address
to high-memory address (see Figure 6–9). The SP always points to the last
element pushed onto the stack. A push performs a preincrement, and a pop
performs a postdecrement of the system-stack pointer.

The program counter is pushed onto the system stack on subroutine calls,
traps, and interrupts. It is popped from the system stack on returns. The sys-
tem stack can be pushed and popped using the PUSH, POP, PUSHF, and
POPF instructions.

Figure 6–9. System Stack Configuration

Bottom of stack

Top of stack

(Free)

Low memory

High memory

SP

.

.

.

Advertising