Atmel ARM-Based Evaluation Kit for SAM4S16C, 32-Bit ARM® Cortex® Microcontroller ATSAM4S-WPIR-RD ATSAM4S-WPIR-RD Data Sheet

Product codes
ATSAM4S-WPIR-RD
Page of 1231
177
SAM4S Series [DATASHEET]
Atmel-11100G-ATARM-SAM4S-Datasheet_27-May-14
12.6.9.2 SBFX and UBFX
Signed Bit Field Extract and Unsigned Bit Field Extract.
Syntax
SBFX{condRdRn, #lsb, #width
UBFX{condRdRn, #lsb, #width
where:
condis an optional condition code, see 
.
Rdis the destination register.
Rnis the source register.
lsbis the position of the least significant bit of the bitfield. lsb must be in the range
0 to 31.
widthis the width of the bitfield and must be in the range 1 to 32-lsb.
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. 
Restrictions
Do not use SP and do not use PC
.
Condition Flags
These instructions do not affect the flags.
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.