Infineon Technologies C166S V2 User Manual page 67

16-bit microcontroller
Table of Contents

Advertisement

trigger the corresponding trap. Note that event (SP) = (STKOV) resulting from an
explicit SP modification does not trigger the trap.
The Stack Overflow Trap is triggered when (SP) = (STKOV) and if SP is to be implicitly
decremented. This trap may be used in two different ways:
• Fatal error indication treats the stack overflow as a system error and executes
associated trap service routine. Under these circumstances, data in the bottom of the
stack may have been overwritten by the status information stacked upon servicing the
stack overflow trap.
• Automatic system stack flushing allows the system stack to be used as a 'Stack
Cache' for a bigger external user stack.
The Stack Underflow Pointer STKUN
This non-bit addressable register STKUN is compared with the SP register before each
implicit read operation that increments the contents of the SP register. If the contents of
the SP register are equal to the contents of the STKUN register, a stack underflow
hardware trap will occur.
STKUN
Stack Underflow Pointer
15
14
13
12
Field
STKUN
0
The STKUN register can be updated via any instruction capable of modifying a SFR.
Note: The Stack Pointer Segment Register SPSG is not taken into account for the stack
pointer comparison. The system stack cannot cross a 64 k segment.
This checking mechanism is triggered before each implicit read access. The contents of
the stack pointer are compared to the contents of the underflow register, whenever the
SP will be incremented either by a RET, RETS, RETP, RETI or POP instruction.
Note: If the Stack Pointer was explicitly changed as a result of move or arithmetic
instruction, SP is not compared to the contents of the STKUN register. Therefore,
if the modified Stack Pointer is above the limit set by STKUN register, the stack
User Manual
11
10
9
8
STKUN
rw
Bits
Type Description
[15:1]
rw
Modifiable portion of register STKUN
Specifies the segment offset address of the upper
limit of the system stack.
[0]
r
Fixed to 0
SFR
7
6
5
2-67
User Manual
C166S V2
Central Processing Unit
Reset Value: FC00
4
3
2
1
V 1.7, 2001-01
H
0
0
r

Advertisement

Table of Contents
loading

Table of Contents