Skip to main content
Knowledgebase
Home
Renesas Singapore - Knowledgebase

What's the differences between SPI and SPU?

Latest Updated:03/22/2017

Question:

What are the differences between the stack pointer for interrupts (SPI) and the stack pointer for the user (SPU)?

Answer:

The stack pointer for interrupts (SPI) is used in interrupt handling, whereas the stack pointer for the user (SPU) is used in all other processing. The SPI and SPU hold the current stack pointer addresses. These registers can be accessed as general-purpose register R15. Whether this general-purpose register is used as SPI or as SPU is determined by the stack mode bit (SM) in the Processor Status Word register (PSW).

  • When SM bit = 0, the register is used as the stack pointer for interrupts (SPI).
  • When SM bit = 1, the register is used as the stack pointer for the user (SPU).
For some EITs, the SM bit is automatically cleared to 0 when the EIT occurs, so that the register is switched for use as the SPI.
Table 1 shows types of EIT events and changes of the state of the SM bit caused by hardware preprocessing when each relevant EIT is accepted.

Table1. Types of EIT Events and Changes of the SM Bit Made Upon EIT Acceptance
EIT Event SM Bit
Reset interrupt (RI) 0
System break interrupt (SBI) 0
Reserved instruction exception (RIE) Unchanged
Address exception (AE) Unchanged
Trap (TRAP) Unchanged
External interrupt (EI) 0


For details about EIT events, please refer to the relevant chapter in the user's manual of your microcomputer in which EITs are described.

 

Suitable Products
32170, 32174
32171
32172, 32173
32176
32180
32182
32185
32186
32192
32195
32196