extrwi
Extract and Right-shift Word Immediate - 7C 00 2E 30
extrwi

Instruction Syntax

MnemonicFormatFlags
extrwirA, rS, n, bNone

Instruction Encoding

0
1
1
1
1
1
S
S
S
S
S
A
A
A
A
A
n
n
n
n
n
n
b
b
b
b
b
1
0
1
1
1
0
FieldBitsDescription
Primary Opcode0-5011111 (0x1F)
rS6-10Source register
rA11-15Destination register
n16-20Number of bits to extract
b21-25Starting bit position

Operation

rA ← (rS >> b) & ((1 << n) - 1)

EXTRWI extracts n bits from the source register rS, starting at bit position b, right-shifts them, and stores the result in rA.

  1. Right-shifts rS by b bits
  2. Masks the lower n bits
  3. Stores the result in rA

Note: Used for bitfield extraction and manipulation.

Affected Registers

Examples

# Extract 8 bits from bit 16
extrwi r3, r4, 8, 16

# Extract lower 4 bits
extrwi r5, r6, 4, 0

Related Instructions

rlwinm, clrlwi, clrrwi

Back to Index