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+ |
|
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.
Q: |
Not affected |
V: |
Not affected |
N: |
Not affected |
Z: |
Not affected |
C: |
Not affected |
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.