ARM ARM7TDMI User Manual Page 37

  • Download
  • Add to my manuals
  • Print
  • Page
    / 43
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 36
Page 33
Usage and Examples:
The SWP instruction exchanges a word between a register and memory. This
instruction is intended to support semaphore manipulation by completing the transfers
as a single, atomic operation.
ADR R1, semaphore ;semaphore address
MOV R0, #1
SWP R0, R0, [R1] ;make swap
CMPS R0, #0 ;test result
4.36 SWPB – Swap Byte
Syntax:
SWPB{<cond>} <Rd>, <Rm>, [<Rn>]
RTL:
if(cond)
temp [Rn]
[Rn] Rm
Rd temp
Flags updated:
None
Encoding:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 0 0 Rn Rd SBZ 1 0 0 1 Rm
Usage and Examples:
The SWPB instruction exchanges a single byte between a register and memory. This
instruction is intended to support semaphore manipulation by completing the transfers
as a single, atomic operation.
ADR R1, semaphore ;semaphore address
MOV R0, #1
SWPB R0, R0, [R1] ;make swap
TST R0, #0xFF ;test result
Page view 36
1 2 ... 32 33 34 35 36 37 38 39 40 41 42 43

Comments to this Manuals

No comments