
User Manual
C166S V2
Central Processing Unit
User Manual
2-68
V 1.7, 2001-01
violation will not be detected. The stack underflow can be detected only if the
contents of SP are equal to (not higher than) the contents of the STKUN and only
in case of implicit SP modification. This means that SP may be explicitly set to the
value above the permitted SP range and even be operated there without triggering
any traps. However, if SP crosses the limit of the permitted SP range from outside
the range as a result of an implicit change (POP instruction, for example), the
event (SP) = (STKUN) will trigger the corresponding trap. Note that event (SP) =
(STKUN) resulting from an explicit SP modification does not trigger the trap.
The Stack Underflow Trap is triggered when (SP) = (STKUN) and if SP is to be implicitly
incremented. This trap may be used in two different ways:
Fatal error indication
treats the stack underflow as a system error and executes
associated trap service routine.
Automatic system stack refilling
allows use of the system stack as a
’
Stack Cache
’
for a bigger external user stack.
Scope of Stack Limit Control
The stack limit control implemented by the register pair STKOV and STKUN detects
cases in which the Stack Pointer (SP) crosses the defined stack area as a result of
implicit change.
Note: If a stack overflow or underflow event occurs in an ATOMIC/EXT sequence, the
stack operations that are part of the sequence are completed. The trap is issued
after the completion of the entire ATOMIC/EXT sequence.
2.6
Data Processing
All standard arithmetic, shift and logical operations are performed in the 16-bit ALU. In
addition to the standard arithmetic and logic unit, the ALU of the C166S V2 CPU includes
bit manipulation, multiply and divide unit. Most internal execution blocks have been
optimized to perform operations on either 8-bit or 16-bit numbers. After the pipeline has
been filled, most instructions are completed in one CPU cycle. The status flags are
automatically updated in the PSW register after each ALU operation (see
Section 2.6.6
).
These flags allow branching upon specific conditions. Support of both signed and
unsigned arithmetic is provided by the user selectable branch test. The status flags are
also preserved automatically by the CPU upon entry into an interrupt or trap routine.
2.6.1
Data Types
The C166S V2 CPU supports operations on booleans/bits, bit strings, characters,
integers, and signed fraction numbers. Most instructions operate with specific data
types, while others are useful for manipulating several data types.