Negative Flag Under Overflow Conditions - Texas Instruments TMS320C28x Reference Manual

Dsp cpu and instruction set
Table of Contents

Advertisement

Status Register (ST0)
N
Bit 5
Table 2−7. Negative Flag Under Overflow Conditions
Á Á Á Á
Á Á Á
Á Á Á Á Á Á Á Á Á Á Á Á
A
B
Á Á Á Á
Á Á Á
Á Á Á Á Á Á Á Á Á Á Á Á
Pos
Neg
(due to overflow in positive direction)
(due to overflow in negative direction)
Neg
Pos
Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á
For 32-bit data: Pos = Positive number from 0000 0000
Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á
Neg = Negative number from 8000 0000
Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á
For 16-bit data: Pos = Positive number from 0000
Neg = Negative number from 8000
Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á
The compare instructions are CMP, CMPB, CMPL, MIN, MAX, MINL, and MAXL.
Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á Á
2-24
Table 2−6. Instructions Affected by V flag (Continued)
Instruction
XMACD P,loc16,*(pma)
XRETC COND
Negative flag. During certain operations, N is set if the result of the operation is a negative
number or cleared if the result is a positive number. At reset, N is cleared.
Results in ACC are tested for the negative condition. Bit 31 of ACC is the sign bit. If bit 31
is a 0, ACC is positive; if bit 31 is a 1, ACC is negative. N is set if a result in ACC is negative
or cleared if a result is positive.
Results in AH, AL, and other 16-bit registers or data-memory locations are also tested for
the negative condition. In these cases bit 15 of the value is the sign bit (1 indicates negative,
0 indicates positive). N is set if the value is negative or cleared if the value is positive.
The TEST ACC instruction sets N if the value in ACC is negative. Otherwise the instruction
clears N.
As shown in Table 2−7, under overflow conditions, the way the N flag is set for compare
operations is different from the way it is set for addition or subtraction operations. For addi-
tion or subtraction operations, the N flag is set to match the most significant bit of the trun-
cated result. For compare operations, the N flag assumes infinite precision. This applies
to operations whose result is loaded to ACC, AH, AL, another register, or a data-memory
location.
(A − B)
Neg
Pos
N can be summarized as follows:
0
The tested number is positive, or N has been cleared.
1
The tested number is negative, or N has been set.
Description
V = 1 on signed overflow
V = 0 if tested
Á Á Á Á Á Á Á Á
Á
Subtraction
Á Á Á Á Á Á Á Á
Á
to 7FFF FFFF
16
16
to FFFF FFFF
16
16
to 7FFF
16
16
to FFFF
16
16
Á Á Á Á Á Á Á
Compare
Á Á Á Á Á Á Á
N = 1
N = 0
N = 0
N = 1

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C28x and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF