3.3.10 Software Stack Pointer

The W15 register serves as a dedicated Software Stack Pointer (SSP) and is automatically modified by exception processing, subroutine calls and returns; however, W15 can be referenced by any instruction in the same manner as all other W registers. This simplifies reading, writing and manipulating the Stack Pointer (for example, creating stack frames).
Note: To protect against misaligned stack accesses, W15[1:0] is fixed to ‘00’ by the hardware.

W15 is initialized to 0x4000 during all Resets. This address ensures that the Software Stack Pointer points to valid RAM in all devices and permits stack availability for non-maskable trap exceptions. These can occur before the SSP is initialized by the user software. Reprogramming the SSP to any location within the data space is possible during initialization.

The Software Stack Pointer always points to the first available free word in the data space (RAM) and fills the software stack, working from lower addresses toward higher ones. Figure 3-4 illustrates how it pre-decrements for a stack pop (read) and post-increments for a stack push (write).

When the PC is pushed onto the stack, PC[23:0] are pushed onto the first available stack word, as shown in Figure 3-4.

Figure 3-4. Stack Operation for a CALL Instruction