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

no-image

SAF-C164SM

Manufacturer Part Number
SAF-C164SM
Description
16-Bit CMOS Microcontroller
Manufacturer
Infineon Technologies
Datasheet
22.2
Register banking provides the user with an extremely fast method for switching user
context. A single machine cycle instruction saves the old bank and enters a new register
bank. Each register bank may assign up to 16 registers. Each register bank should be
allocated during coding based on the needs of each task. After the internal memory has
been partitioned into a register bank space, internal stack space, and a global internal
memory area, each bank pointer is then assigned. Thus, upon entry into a new task, the
appropriate bank pointer is used as the operand for the SCXT (switch context)
instruction. Upon exit from a task, a simple POP instruction to the Context Pointer (CP)
restores the previous task’s register bank.
22.3
To support modular programming, a procedure mechanism is provided to allow coding
of frequently used portions of code into subroutines. The CALL and RET instructions
store and restore the value of the Instruction Pointer (IP) on the system stack before and
after a subroutine is executed.
Procedures may be called conditionally with instructions CALLA or CALLI, or may be
called unconditionally using instructions CALLR or CALLS.
Note: Any data pushed onto the system stack during execution of the subroutine must
Passing Parameters on the System Stack
PUSH instructions may be used to pass parameters via the system stack before the
subroutine is called; POP instructions may be used during execution of the subroutine.
Base plus offset indirect addressing also permits access to parameters without popping
these parameters from the stack during execution of the subroutine. Indirect addressing
provides a mechanism for accessing data referenced by data pointers, which are passed
to the subroutine.
Additionally, two instructions have been implemented to allow one parameter to be
passed on the system stack without additional software overhead.
The PCALL (push and call) instruction first pushes the ‘reg’ operand and the IP contents
onto the system stack and then passes control to the subroutine specified by the ‘caddr’
operand.
When exiting from the subroutine, the RETP (return and pop) instruction first pops the IP
and then the ‘reg’ operand from the system stack and returns to the calling program.
User’s Manual
be popped before the RET instruction is executed.
Register Banking
Procedure Call Entry and Exit
22-9
System Programming
C164CM/C164SM
Derivatives
V1.0, 2002-02

Related parts for SAF-C164SM