![Infineon Technologies XC2200 User Manual Download Page 190](http://html1.mh-extra.com/html/infineon-technologies/xc2200/xc2200_user-manual_2055439190.webp)
XC2200 Derivatives
System Units (Vol. 1 of 2)
Central Processing Unit (CPU)
User’s Manual
4-52
V2.1, 2008-08
CPUSV2_X, V2.2
4.7.5
The System Stack
The XC2200 supports a system stack of up to 64 Kbytes. The stack can be located
internally in one of the on-chip memories or externally. The 16-bit Stack Pointer register
(SP) addresses the stack within a 64-Kbyte segment selected by the Stack Pointer
Segment register (SPSG). A virtual stack (usually bigger than 64 Kbytes) can be
implemented by software. This mechanism is supported by the Stack Overflow register
STKOV and the Stack Underflow register STKUN (see descriptions below).
4.7.5.1
The Stack Pointer Registers SP and SPSEG
Register SPSEG (not bitaddressable) selects the segment being used at run-time to
access the system stack. The lower eight bits of register SPSEG select one of up
256 segments of 64 Kbytes each, while the higher 8 bits are reserved for future use.
The Stack Pointer SP (not bitaddressable) points to the top of the system stack (TOS).
SP is pre-decremented whenever data is pushed onto the stack, and it is post-
incremented whenever data is popped from the stack. Therefore, the system stack
grows from higher towards lower memory locations.
System stack addresses are generated by directly extending the 16-bit contents of
register SP by the contents of register SPSG, as shown in
The system stack cannot cross a 64-Kbyte segment boundary.
Figure 4-17 Addressing via the Stack Pointer
15
MCA04929
23
0
Stack Pointer
Segment
255
254
1
0
FF'0000
H
FE'0000
H
01'0000
H
00'0000
H
16
15
0
SP
15
0
SPSEGNR
7
SPSEG