6 implementation details – Texas Instruments MSP50C6xx User Manual

Page 320

Advertising
background image

Implementation Details

5-24

5.6

Implementation Details

This section is C– – specific.

5.6.1

Comparisons

We use the CMP instruction for both signed and unsigned comparisons. The
two integers a and b to be compared are in A0 and A0~.

CMP A0,A0~ : A0 contains a, A0~ contains b

A0

A0~

ACO

AZ

ANEG

5

0

1

0

0

5

1

1

0

0

0

5

0

0

1

1

5

0

0

1

0

0

1

1

0

5

5

1

1

0

FFFF

0

1

0

1

0

FFFF

0

0

0

FFFF

FFFF

1

1

0

FFFF

FFFE

1

0

0

FFFE

FFFF

0

0

1

-

Signed comparison of a and b. (a is in A0, b is in A0~)

Assembly

Test

Condition

_eq

a = b

AEQ

_ne

a != b

!AEQ

_lt

a < b

ALZ

_le

a <= b

!AGT

_ge

a >= b

!ALZ

_gt

a > b

AGT

Advertising