English
Language : 

UM10360 Datasheet, PDF (699/835 Pages) NXP Semiconductors – LPC17xx User manual
NXP Semiconductors
UM10360
Chapter 34: Appendix: Cortex-M3 User Guide
2.8.2 SBFX and UBFX
Signed Bit Field Extract and Unsigned Bit Field Extract.
2.8.2.1 Syntax
SBFX{cond} Rd, Rn, #lsb, #width
UBFX{cond} Rd, Rn, #lsb, #width
where:
cond is an optional condition code, see Section 34–2.3.7 “Conditional execution”.
Rd is the destination register.
Rn is the source register.
lsb is the position of the least significant bit of the bitfield. lsb must be in the range 0 to 31.
width is the width of the bitfield and must be in the range 1 to 32−lsb.
2.8.2.2 Operation
SBFX extracts a bitfield from one register, sign extends it to 32 bits, and writes the result to
the destination register.
UBFX extracts a bitfield from one register, zero extends it to 32 bits, and writes the result to
the destination register.
2.8.2.3 Restrictions
Do not use SP and do not use PC.
2.8.2.4 Condition flags
These instructions do not affect the flags.
2.8.2.5 Examples
SBFX R0, R1, #20, #4 ; Extract bit 20 to bit 23 (4 bits) from R1 and sign
; extend to 32 bits and then write the result to R0.
UBFX R8, R11, #9, #10 ; Extract bit 9 to bit 18 (10 bits) from R11 and zero
; extend to 32 bits and then write the result to R8
UM10360_1
User manual
Rev. 01 — 4 January 2010
© NXP B.V. 2010. All rights reserved.
699 of 835