Texas Instruments TMS320C28x Reference Manual page 237

Dsp cpu and instruction set
Table of Contents

Advertisement

CMPL ACC,loc32
CMPL ACC,loc32
SYNTAX OPTIONS
CMPL ACC,loc32
Operands
ACC
loc32
Description
Flags
N
and
Modes
Z
C
Repeat
Example
; Swap the contents of 32-bit VarA and VarB if VarB is higher:
MOVL ACC,@VarB
MOVL P,@VarA
CMPL ACC,@P
MOVL @VarA,ACC,HI
MOVL @P,ACC,HI
MOVL @VarA,P
6-80
0000 1111 LLLL LLLL
Accumulator register
Addressing mode (see Chapter 5)
The content of the ACC register is compared with the 32-bit location pointed to
by the "loc32" addressing mode. The status flag bits are set according to the
result of (ACC − [loc32]). The ACC register and the contents of the location
pointed to by "loc32" are left unchanged:
Modify flags on (ACC − [loc32]);
If the result of the operation is negative, then N is set; otherwise it is cleared.
The CMPL instruction assumes infinite precision when it determines the sign
of the result. For example, consider the subtraction 0x8000 0000 − 0x0000
0001. If the precision were limited to 32 bits, the result would cause an
overflow to the positive number 0x7FFF FFFF and N would be cleared.
However, because the CMPL instruction assumes infinite precision, it would
set N to indicate that 0x8000 0000 − 0x0000 0001 actually results in a
negative number.
The comparison is tested for a zero condition. The zero flag bit is set if the
operation (AX − [loc32]) = 0, otherwise it is cleared.
If the subtraction generates a borrow, C is cleared; otherwise C is set.
This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
OPCODE
; ACC = VarB
; P = VarA
; Set flags on (VarB - VarA)
; VarA = ACC if higher
; P = ACC if higher
; VarA = P
Compare 32-bit Value
OBJMODE
RPT
CYC
X
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