Texas Instruments TMS320C28x Reference Manual page 232

Dsp cpu and instruction set
Table of Contents

Advertisement

CMP loc16,#16bitSigned
SYNTAX OPTIONS
CMP loc16,#16bitSigned
loc16
Operands
#16bitSigned 16-bit immediate signed constant value
Description
N
Flags and
Modes
C
Repeat
Note:
Addressing mode (see Chapter 5)
Compare the 16-bit contents of the location pointed to by the "loc16"
addressing mode to the signed 16-bit immediate constant value. To
perform the comparison, the result of ([loc16] − #16bitSigned ) is
evaluated and the status flag bits are set accordingly. The content of
"loc16" is left unchanged:
Modify flags on ([loc16] − 16bitSigned);
Smart Encoding:
If loc16 = AL or AH and #16bitSigned is an 8-bit number, then the
assembler will encode this instruction as CMPB AX, #8bit, to override
this encoding, use the CMPW AX, #16bitSigned instruction alias.
If the result of the operation is negative, then N is set; otherwise it is
cleared. The CMP instruction assumes infinite precision when it deter-
mines the sign of the result. For example, consider the subtraction
0x8000 − 0x0001. If the precision were limited to 16 bits, the result
would cause an overflow to the positive number 0x7FFF and N would
be cleared. However, because the CMP instruction assumes infinite
precision, it would set N to indicate that 0x8000 − 0x0001 actually re-
sults in a negative number.
Z
The comparison is tested for a zero condition. The zero flag bit is set if
the operation ([loc16] − 16bitSigned ) = 0, otherwise it is cleared.
If the subtraction generates a borrow, then 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.
The examples in this chapter assume that the device is already
operating in C28x Mode (OBJMODE = 1, AMODE = 0). To put the
device into C28x mode following a reset, you must first set the
OBJMODE bit in ST1 by executing the "C28OBJ" (or "SETC
OBJMODE") instruction.
OPCODE
0001 1011 LLLL LLLL
CCCC CCCC CCCC CCCC
CMP loc16,#16bit
Compare
OBJMODE
RPT
CYC
X
1
6-75

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?

Table of Contents

Save PDF