32-Bit Instruction Set

CMPI

Compare Immediate

Operation:

 

 

 

 

RA – (0x00.00 : K : IMM5)

 

 

 

 

 

 

 

Assembler Syntax:

 

 

CMPI & %rA,IMM5

 

 

 

 

 

 

 

 

Example:

 

 

 

 

Not preceded by PFX:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CMPI %i3,24 ; compare %i3 to 24

 

 

 

 

 

 

 

 

 

 

 

Preceded by PFX:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PFX %hi(1000)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CMPI %i4,%lo(1000)

 

 

 

 

 

 

 

 

Description:

 

 

 

 

Not preceded by PFX:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Subtract a 5-bit immediate value given by IMM5 from RA, and discard the result.

 

 

 

 

 

 

Set the condition codes according to the subtraction. RA is not altered.

 

 

 

 

 

 

 

Preceded by PFX:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The Immediate operand is extended from 5 to 16 bits by concatenating the

 

 

 

 

 

 

 

contents of the K-register (11 bits) with IMM5 (5 bits). The 16-bit immediate value

 

 

 

 

 

 

(K : IMM5) is zero-extended to 32 bits and subtracted from RA. Condition codes

 

 

 

 

 

 

are set and the result is discarded. RA is not altered.

 

 

 

 

Condition Codes:

 

 

Flags:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

N

 

V

Z

C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

N: Result bit 31

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

V: Signed-arithmetic overflow

 

 

 

 

 

 

 

 

 

 

 

 

 

Z: Set if result is zero; cleared otherwise

 

 

 

 

 

 

 

 

 

 

 

 

C: Set if there was a borrow from the subtraction; cleared otherwise

 

 

Instruction Format:

 

 

Ri5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Instruction Fields:

 

 

A = Register index of RA operand

 

 

 

 

 

 

 

 

 

 

 

 

 

IMM5 = 5-bit immediate value

 

 

 

 

 

 

 

15

14

13

 

12

11

10

 

9

8

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

0

 

1

0

1

 

 

 

 

 

IMM5

 

 

 

 

A

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

46

Altera Corporation

Page 58
Image 58
Excalibur electronic A-MNL-NIOSPROG-01.1 manual Compare Immediate, Cmpi & %rA,IMM5, Cmpi %i3,24 compare %i3 to