Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

cp.w Rd, Rs

Rd - Rs;
{d, s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00011

Rd

3

4

5

4

2

cp.w Rd, imm

Rd - SE(imm6);
d ∈ {0, 1, …, 15}
imm ∈ {-32, -31, ..., 31}

Rev1+

010110

imm6

Rd

6

6

4

3

cp.w Rd, imm

Rd - SE(imm21);
d ∈ {0, 1, …, 15}
imm ∈ {-1048576, -104875, ..., 1048575}

Rev1+

111

imm21[20:17]

0010

imm21[16]

Rd

imm21[15:0]

3

4

4

1

4

16

Description

Performs a compare between the two operands specified. The operation is implemented by doing a subtraction without writeback of the difference. The operation sets the status flags according to the result of the subtraction, but does not affect the operand registers.

Status Flags:

Format I: OP1 = Rd, OP2 = Rs

Format II: OP1 = Rd, OP2 = SE(imm6)

Format III:OP1 = Rd, OP2 = SE(imm21)

Q:

Not affected

V:

V = (OP1[31] AND ~OP2[31] AND ~RES[31]) OR (~OP1[31] AND OP2[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = ~OP1[31] AND OP2[31] OR OP2[31] AND RES[31] OR ~OP1[31] AND RES[31]