10 cmp compare two words – Texas Instruments MSP50C614 User Manual

Page 182

Advertising
background image

Individual Instruction Descriptions

4-90

4.14.10

CMP

Compare Two Words

[label]

name

src, src1 [, mod]

Clock,

clk

Word,

w

With RPT,

clk

Class

CMP

A

n, {adrs}

Table 4–46

Table 4–46

1b

CMP

A

n[~], imm16 [, next A]

2

2

N/R

2b

CMP
CMP

A

n, An~ [, next A]

A

n~, An [, next A]

1

1

n

R

+3

3

CMP

R

x, imm16

2

2

N/R

4c

CMP

R

x, R5

1

1

n

R

+3

4d

† Does not modify An status

Execution

[premodify AP if

mod specified]

STAT flags set by

src – src1 operation

PC = PC +

w

Flags Affected

src is An:

OF, SF, ZF, CF are set accordingly

src is Rx:

RCF, RZF are set accordingly

src is {adrs}:

TAG bit is set accordingly

Opcode

Instructions

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

CMP A

n, {adrs}

0

1

0

1

1

0

0

A

n

adrs

x

dma16 (for direct) or offset16 (long relative) [see section 4.13]

CMP A

n[~], imm16 [, next A]

1

1

1

0

0

next A

A

n

0

1

1

0

0

1

A~

~A

x

imm16

CMP A

n, An~ [, next A]

1

1

1

0

0

next A

A

n

1

0

0

0

0

0

0

0

CMP A

n~, An [, next A]

1

1

1

0

0

next A

A

n

1

0

0

0

0

0

1

0

CMP R

x, imm16

1

1

1

1

1

1

1

0

0

0

1

1

R

x

0

0

x

imm16

CMP R

x, R5

1

1

1

1

1

1

1

0

0

1

1

1

R

x

0

0

Description

Subtract value of

src1 from src (i.e., src–src1) and only modify the status flag.

Premodification of accumulator pointer is allowed with some operand types.

See Also

CMPB, CMPS, J

cc, Ccc

Example 4.14.10.1

CMP A0, *R0

Compare value at accumulator A0 and the content of data memory location pointed by R0 and change
the STAT flags accordingly.

Example 4.14.10.2

CMP A0~, 0x1400, – –A

Predecrement accumulator pointer AP0. Compare value at accumulator A0~ to immediate value at
0x1400 and change the STAT flags accordingly.

Advertising