Infineon Technologies C166S V2 User Manual page 43

16-bit microcontroller
Table of Contents

Advertisement

memory register bank is preserved when the service routine terminates, i.e. its contents
is available on the next call.
Before returning from the service routine (RETI), the previous CP is simply popped from
the system stack which returns the registers to the original bank.
Context Pointer Updating
After the CP has been update, a state machine starts to store the old contents of the
global register bank and to load the new one. An instruction "SCXT CP, #New_Bank"
takes two cycles. The store and load algorithm is executed in nineteen CPU cycles: the
execution of the cache validation process takes sixteen cycles plus three cycles to stall
an instruction execution to avoid pipeline conflicts upon the completion of the validation
process. The context switch process has two phases:
1. Store phase: The contents of the global register bank is stored back into the DPRAM
by executing eight injected STORE instructions. After the last STORE instruction the
contents of the global register bank are invalidated.
2. Load phase: The global register bank is loaded with the new context by executing
eight injected LOAD instructions. After the last LOAD instruction the contents of the
global register bank are validated.
The code execution is stopped until the global register bank is valid. A hardware interrupt
which also uses a global register bank cannot be executed until the validation process is
finished (see
Figure
global
Bank
Execution
Task A
Interrupt of Task B
recognized
Execution of
SCXT CP
Register Bank
validation
process
started
Figure 2-12 Validation process and hardware interrupts using a global register
bank
But, the validation process can be interrupted by any hardware interrupt which will work
with a local register bank. After switching back to the global register bank, the validation
process must be finished. The way the validation process will be restarted depends on
the phase in which it has been interrupted.
User Manual
2-12).
Execution
Task B
Execution of
SCXT CP
Register Bank
validation
process
started
finished
global
Bank
Execution
Task B
Execution of
POP CP
Register Bank
validation
process
finished
started
2-43
User Manual
C166S V2
Central Processing Unit
Execution
Execution
Task B
Execution of
RETI
finished
V 1.7, 2001-01
global
Bank
Task A

Advertisement

Table of Contents
loading

Table of Contents