EasyManuals Logo

Texas Instruments TMS320C28x User Manual

Texas Instruments TMS320C28x
695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #232 background imageLoading...
Page #232 background image
CMP loc16,#16bit
6-75
CMP loc16,#16bitSigned Compare
SYNTAX OPTIONS OPCODE OBJMODE RPT CYC
CMP loc16,#16bitSigned 0001 1011 LLLL LLLL
CCCC CCCC CCCC CCCC
X 1
Operands
loc16
Addressing mode (see Chapter 5)
#16bitSigned
16-bit immediate signed constant value
Description 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.
Flags and
Modes
N
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.
C
If the subtraction generates a borrow, then C is cleared; otherwise C is
set.
Repeat This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only
once.
Note: 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.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Texas Instruments TMS320C28x Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS320C28x
CategoryProcessor
LanguageEnglish

Related product manuals