SAF-C164SM Infineon Technologies, SAF-C164SM Datasheet - Page 428

no-image

SAF-C164SM

Manufacturer Part Number
SAF-C164SM
Description
16-Bit CMOS Microcontroller
Manufacturer
Infineon Technologies
Datasheet
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 requires moving only that portion of stack
data which is really to be re-used (the upper part of the defined stack area) instead of the
entire stack area. Stack data that remain in the lower part of the internal stack need not
be moved by the distance of the space being flushed or filled, as the Stack Pointer
automatically wraps around to the beginning of the freed part of the stack area.
Note: This circular stack technique is applicable for stack sizes of 32 to 512 words
When a boundary is reached, the stack underflow or overflow trap is entered in which
the user moves a predetermined portion of the internal stack to or from the external
stack. The amount of data transferred is determined by the average stack space required
by routines and the frequency of calls, traps, interrupts, and returns. In most cases, this
will be approximately one-quarter to one-tenth the size of the internal stack. After the
transfer is complete, the boundary pointers are updated to reflect the newly allocated
space on the internal stack. Thus, the user is free to write code without concern for the
internal stack limits. Only the execution time required by the trap routines affects user
programs.
The following procedure initializes the controller for use of the circular stack mechanism:
• Specify the size of the physical system stack area within the internal RAM (bitfield
• Define two pointers which specify the upper and lower boundary of the external stack.
• Set the stack overflow pointer (STKOV) to the limit of the defined internal stack area
The internal stack will now fill until the overflow pointer is reached. After entry into the
overflow trap procedure, the top of the stack will be copied to the external memory. The
internal pointers will then be modified to reflect the newly allocated space. After exiting
from the trap procedure, the internal stack will wrap around to the top of the internal stack
and continue to grow until the new value of the stack overflow pointer is reached.
When the underflow pointer is reached while the stack is emptied, the bottom of stack is
reloaded from the external memory and the internal pointers are adjusted accordingly.
User’s Manual
STKSZ in register SYSCON).
These values are then tested in the stack underflow and overflow trap routines when
moving data.
plus six words (for the reserved space to store two interrupt entries).
(STKSZ = ‘000
uses the complete internal RAM for system stack.
In the latter case, the address transformation mechanism is deactivated.
B
’ to ‘100
B
’), it does not work with option STKSZ = ‘111
22-7
System Programming
C164CM/C164SM
Derivatives
V1.0, 2002-02
B
’, which

Related parts for SAF-C164SM