49
CHAPTER 3 CPU ARCHITECTURE
User’s Manual U15104EJ2V0UD
(3) Stack pointer (SP)
This is a 16-bit register to hold the start address of the memory stack area. Only the internal high-speed RAM
area (FB00H to FEFFH for
µ
PD178053, 178054, and 178F054) can be set as the stack area.
Figure 3-9. Configuration of Stack Pointer
The SP is decremented ahead of a write (save) to the stack memory and is incremented after a read (restored)
from the stack memory.
Each stack operation saves/restores data as shown in Figures 3-10 and 3-11.
Caution Since reset input makes SP contents undefined, be sure to initialize the SP before instruction
execution.
Figure 3-10. Data to Be Saved to Stack Memory
Figure 3-11. Data to Be Restored from Stack Memory
SP15
SP
SP14 SP13 SP12 SP11
SP9
SP8
15
0
SP10
SP7
SP6
SP5
SP4
SP3
SP1
SP0
SP2
Interrupt and
BRK instruction
PSW
PC15 to PC8
PC15 to PC8
PC7 to PC0
Register pair lower
SP SP _ 2
SP _ 2
Register pair upper
CALL, CALLF, and
CALLT instruction
PUSH rp instruction
SP _ 1
SP
SP SP _ 2
SP _ 2
SP _ 1
SP
PC7 to PC0
SP _ 3
SP _ 2
SP _ 1
SP
SP SP _ 3
RETI and RETB
instruction
PSW
PC15 to PC8
PC15 to PC8
PC7 to PC0
Register pair lower
SP SP + 2
SP
Register pair upper
RET instruction
POP rp instruction
SP + 1
PC7 to PC0
SP SP + 2
SP
SP + 1
SP + 2
SP
SP + 1
SP SP + 3