English
Language : 

GMS30C2116 Datasheet, PDF (92/322 Pages) Hynix Semiconductor – USERS MANUAL
3-28
CHAPTER 3
3.20 Compare Instructions
Two operands are compared by subtracting the source operand or the immediate operand
from the destination operand. The condition flags are set or cleared according to the result;
the result itself is not retained. Note that the N flag indicates the correct compare result
even in the case of an overflow.
All operands and the result are interpreted as either all signed or all unsigned integers.
Format Notation
Operation
RR
CMP Rd, Rs
result := Rd - Rs;
Z := Rd = Rs;
N := Rd < Rs signed;
V := overflow;
C := Rd < Rs unsigned;
-- result is zero
-- result is true negative
-- borrow
Rimm CMPI Rd, imm
result := Rd - imm;
Z := Rd = imm;
N := Rd < imm signed;
V := overflow;
C := Rd < imm unsigned;
-- result is zero
-- result is true negative
-- borrow
When the SR is denoted as a source operand at CMP, C is subtracted instead of SR. The
notation is then:
Format Notation
Operation
RR
CMP, Rd, C
result := Rd - C;
Z := Rd = C;
N := Rd < C signed;
V := overflow;
C := Rd < C unsigned;
-- result is zero
-- result is true negative
-- borrow
3.21 Compare Bit Instructions
The result of a bitwise logical AND of the source or immediate operand and the destination
operand is used to set or clear the Z flag accordingly; the result itself is not retained.
All operands and the result are interpreted as bit-strings of 32 bits each.
Format Notation
Operation
RR
CMPB Rd, Rs
Z := (Rd and Rs) = 0;
Rimm CMPBI Rd, imm
Z := (Rd and imm) = 0;
The following instruction is a special case of CMPBI differentiated by n = 0 (see section
2.3.1. Table of Immediate Values):
Format Notation
Operation
Rimm CMPBI Rd, ANYBZ
Z := Rd(31..24) = 0 or Rd(23..16) = 0 or
Rd(15..8) = 0 or Rd(7..0) = 0;
-- any Byte of Rd = 0