Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

xchg Rd, Rx, Ry

Temp = *(Rx);
*(Rx) = Ry;
Rd = Temp;
{d,x,y} ∈ {0, 1, …, 14}

Rev1+

111

Rx

00000

Ry

000010110100

Rd

3

4

5

4

12

4

Description

Reads a word from memory pointed to by Rx into register Rd, and writes the value of register Ry to memory. This instruction can be used to implement binary semaphores (mutexes). The stcond instruction should be used to implement counting semaphores.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Note:

If R15 is used as Rd, Rx or Ry, the result is UNDEFINED.

If Rd = Ry, the result is UNDEFINED. If Rd = Rx, the result is UNDEFINED.