English
Language : 

C165H Datasheet, PDF (438/499 Pages) Infineon Technologies AG – EMBEDDED C166 WITH USART IOM-2 AND HDLC SUPPORT
C165H
System Programming
The reset values (STKOV=FA00H, STKUN=FC00H, SP=FC00H, STKSZ=000B) map the
virtual stack area directly to the physical stack area and allow using the internal system
stack without any changes, provided that the 256 word area is not exceeded.
FBFEH 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0
FBFEH 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0
FB80H 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 Phys.A. FA00H 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0
Y FB80H 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 <SP> F800H 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0
R After PUSH
A FBFEH 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0
After PUSH
FBFEH 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0
IN - FBFEH 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 Phys.A. FBFEH 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0
T FB7EH 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 0 <SP> F7FEH 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0
IM P 64 words
Stack Size
256 words
L R Figure 138 Physical Stack Address Generation
E E The following example demonstrates the circular stack mechanism which is also an
effect of this virtual stack mapping: First, register R1 is pushed onto the lowest physical
R C stack location according to the selected maximum stack size. With the following
instruction, register R2 will be pushed onto the highest physical stack location although
X the SP is decremented by 2 as for the previous push operation.
P E MOV
SP, #0F802H
;Set SP before last entry...
- ;...of physical stack of 256 words
...
;(SP)=F802H: Physical stack addr.=FA02H
PUSH
R1
;(SP)=F800H: Physical stack addr.=FA00H
PUSH
R2
;(SP)=F7FEH: Physical stack addr.=FBFEH
The effect of the address transformation is that the physical stack addresses wrap
around from the end of the defined area to its beginning. When flushing and filling the
internal stack, this circular stack mechanism only requires to move that portion of stack
Data Sheet
438
2001-04-19