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
173
SAM4S Series [DATASHEET]
Atmel-11100G-ATARM-SAM4S-Datasheet_27-May-14
These instructions do not affect the flags.
Examples
SXTH
R4, R6, ROR #16
; Rotates R6 right by 16 bits, obtains bottom halfword of
; of result, sign extends to 32 bits and writes to R4
UXTB
R3, R10
; Extracts lowest byte of value in R10, zero extends, and
; writes to R3.
12.6.8.3 SXTA and UXTA
Signed and Unsigned Extend and Add
Syntax
op{cond} {Rd,} RnRm {, ROR #n}
op{cond} {Rd,} RnRm {, ROR #n}
where:
opis one of:
SXTAB Sign extends an 8-bit value to a 32-bit value and add.
SXTAH Sign extends a 16-bit value to a 32-bit value and add.
SXTAB16 Sign extends two 8-bit values to two 16-bit values and add.
UXTAB Zero extends an 8-bit value to a 32-bit value and add.
UXTAH Zero extends a 16-bit value to a 32-bit value and add.
UXTAB16 Zero extends two 8-bit values to two 16-bit values and add.
condis an optional condition code, see 
.
Rdis the destination register.
Rnis the first operand register.
Rmis the register holding the value to rotate and extend.
ROR #nis one of:
ROR #8 Value from Rm is rotated right 8 bits.
ROR #16 
Value from Rm is rotated right 16 bits.
ROR #24 
Value from Rm is rotated right 24 bits.
If ROR #n is omitted, no rotation is performed.
Operation
These instructions do the following:
1. Rotate the value from Rm right by 0, 8, 16 or 24 bits.
2. Extract bits from the resulting value:
̶
SXTAB extracts bits[7:0] from Rm and sign extends to 32 bits.
̶
UXTAB extracts bits[7:0] from Rm and zero extends to 32 bits.
̶
SXTAH extracts bits[15:0] from Rm and sign extends to 32 bits.
̶
UXTAH extracts bits[15:0] from Rm and zero extends to 32 bits.
̶
SXTAB16 extracts bits[7:0] from Rm and sign extends to 16 bits,
and extracts bits [23:16] from Rm and sign extends to 16 bits.
̶
UXTAB16 extracts bits[7:0] from Rm and zero extends to 16 bits,
and extracts bits [23:16] from Rm and zero extends to 16 bits.