English
Language : 

C165_96 Datasheet, PDF (65/283 Pages) Siemens Semiconductor Group – 16-Bit CMOS Single-Chip Microcontrollers
10Jul97@15:33Thhe Central Processing Unit (CPU) / C165/C163
The Stack Underflow Pointer STKUN
This non-bit addressable register is compared against the SP register after each operation, which
pops data from the system stack (eg. POP and RET instructions) and after each addition to the SP
register. If the content of the SP register is greater than the the content of the STKUN register, a
stack underflow hardware trap will occur.
Since the least significant bit of register STKUN is tied to ’0’ and bits 15 through 12 are tied to ’1’ by
hardware, the STKUN register can only contain values from F000H to FFFEH.
STKUN (FE16H / 0BH)
SFR
Reset Value: FC00H
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1111
stkun
0
r
r
r
r
rw
r
Bit
stkun
Function
Modifiable portion of register STKUN
Specifies the upper limit of the internal system stack.
The Stack Underflow Trap (entered when (SP) > (STKUN)) may be used in two different ways:
• Fatal error indication treats the stack underflow as a system error through the associated trap
service routine.
• Automatic system stack refilling allows to use the system stack as a ’Stack Cache’ for a bigger
external user stack. In this case register STKUN should be initialized to a value, which represents
the desired highest Bottom of Stack address.
More details about the stack underflow trap service routine and virtual stack management are given
in chapter “System Programming”.
Scope of Stack Limit Control
The stack limit control realized by the register pair STKOV and STKUN detects cases where the
stack pointer SP is moved outside the defined stack area either by ADD or SUB instructions or by
PUSH or POP operations (explicit or implicit, ie. CALL or RET instructions).
This control mechanism is not triggered, ie. no stack trap is generated, when
• the stack pointer SP is directly updated via MOV instructions
• the limits of the stack area (STKOV, STKUN) are changed, so that SP is outside of the new limits.
Semiconductor Group
4-26