NXP Semiconductors
PT2001SWUG
PT2001 programming guide and instruction set
PT2001SWUG
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2019. All rights reserved.
User guide
Rev. 3.0 — 29 April 2019
112 / 153
stal
Description:
Sets the arithmetic logic mode. This mode is the set according to the bits A1 and A0 of
the ALU condition register (arith_reg). This instruction configures the behavior of addition
and subtraction instructions only. All other math instructions (multiply, shift, bitwise) are
not affected by this instruction. The addition and subtraction results are affected only if
one of the 'saturation' modes is selected.
With 'saturation' enabled the results is bounded by the natural limits of the 16-bit register
(max signed = 0x7FFF) ALU operations behavior is affected by the arithmetic logic mode
ModeAL as described by the following:
The ALU instruction operands are handled as a C-complement number (signed number).
If the resulting value exceeds the result register capacity, it leads to overflow detection
but no saturation.
The ALU instruction operands are handled as a C-complement number (signed number).
If the resulting value exceeds the result register capacity, it leads to overflow detection
and saturation.
The ALU instruction operands are handled as a positive number (unsigned number). If
the resulting value exceeds the result register capacity it leads to overflow detection but
no saturation.
The ALU instruction operands are handled as a positive number (unsigned number). If
the resulting value exceeds the result register capacity it leads to overflow detection and
saturation.
The ModeAL reset value is al3.
Assembler syntax:
stal ModeAL;
Operands:
•
ModeAL – Operand defines the ALU behavior selected
Operand label
Operand description
al1
Two's complement number without overflow saturation
al2
Two's complement number with overflow saturation
al3
Positive number without overflow saturation
al4
Positive number with overflow saturation
Table 99. stal instruction format
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
ModeAL
Source code example: