Infineon Technologies C166S V2 User Manual page 239

16-bit microcontroller
Table of Contents

Advertisement

CMPD2
Group
Syntax
Source Operand(s)
Destination Operand(s)
Operation
(op1) ⇔ (op2)
(op1) ← (op1) - 2
Description
This instruction is used to enhance the performance and flexibility of loops. The source
operand specified by op1 is compared to the source operand specified by op2 by
performing a 2s complement binary subtraction of op2 from op1. Operand op1 may
specify ONLY GPR registers. Once the subtraction has completed, the operand op1 is
decremented by two. Using the set flags, a branch instruction can then be used in
conjunction with this instruction to form common high level language FOR loops of any
range.
CPU Flags
E
Set if the value of op2 represents the lowest possible negative number.
Cleared otherwise. Used to signal the end of a table.
Z
Set if result equals zero. Cleared otherwise.
V
Set if an arithmetic underflow occurred, i.e. the result cannot be
represented in the word data type. Cleared otherwise.
C
Set if a borrow is generated. Cleared otherwise.
N
Set if the most significant bit of the result is set. Cleared otherwise.
Encoding
Mnemonic
CMPD2
Rw
CMPD2
Rw
CMPD2
Rw
User Manual
Integer Compare and Decrement by 2
Compare and Loop Control Instructions
CMPD2 op1, op2
op1, op2 → WORD
op1 → WORD
E
Z
*
*
, #data16
n
, #data4
n
, mem
n
Detailed Instruction Description
V
C
*
S
Format
B6 Fn ## ##
B0 #n
B2 Fn MM MM
8-239
User Manual
C166S V2
CMPD2
N
*
Bytes
4
2
4
V 1.7, 2001-01

Advertisement

Table of Contents
loading

Table of Contents