MAXS

Instruction: Limit maximum of signed value to another signed value.

MAXS SValue1, < # > SValue2


Result: Lesser of signed SValue1 and signed SValue2 is stored in SValue1.

  • SValue1 (d-field) is the register containing the value to compare against SValue2 and is the destination in which to write the lesser of the two.
  • SValue2 (s-field) is a register or a 9-bit literal whose value is compared against SValue1.

Opcode Table:

–INSTR–  ZCRI  –CON–    –DEST–         –SRC–

Z Result

C Result

Result

Clocks

  010001    001i    1111    ddddddddd    sssssssss

S = 0

Signed (D < S)

Written

4

Concise Truth Table:

In

Out

Destination

Source

Z

C

Effects

Destination

Z

C

$0000_0001; 1

$FFFF_FFFF; -1

-

-

wz wc

$FFFF_FFFF; -1

0

0

$0000_0001; 1

$0000_0000; 0

-

-

wz wc

$0000_0000; 0

1

0

$0000_0001; 1

$0000_0001; 1

-

-

wz wc

$0000_0001; 1

0

0

$0000_0001; 1

$0000_0002; 2

-

-

wz wc

$0000_0001; 1

0

1

$FFFF_FFFF; -1

$0000_0001; 1

-

-

wz wc

$FFFF_FFFF; -1

0

1

$0000_0000; 0

$0000_0001; 1

-

-

wz wc

$0000_0000; 0

0

1

$0000_0001; 1

$0000_0001; 1

-

-

wz wc

$0000_0001; 1

0

0

$0000_0002; 2

$0000_0001; 1

-

-

wz wc

$0000_0001; 1

0

0

Explanation

MAXS compares the signed values of SValue1 and SValue2 and stores the lesser of the two into the SValue1 register, effectively limiting SValue1 to a maximum of SValue2.

If the WZ effect is specified, the Z flag is set (1) if SValue2 is zero (0). If the WC effect is specified, the C flag is set (1) if the signed SValue1 is less than the signed SValue2. The lesser of the two values is written to SValue1 unless the NR effect is specified.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.