clrrwi
Clear Right Immediate - 54 00 00 3C
clrrwi
Instruction Syntax
Mnemonic | Format | Flags |
clrrwi | rA, rS, n | None |
Instruction Encoding
0
1
0
1
0
1
S
S
S
S
S
A
A
A
A
A
n
n
n
n
n
n
1
1
1
1
1
1
Field | Bits | Description |
Primary Opcode | 0-5 | 010101 (0x15) |
rS | 6-10 | Source register |
rA | 11-15 | Destination register |
n | 16-20 | Number of bits to clear (right) |
Operation
rA ← (rS >> n) & (0xFFFFFFFF << n)
CLRRWI shifts the source register right by n bits and clears the rightmost n bits (sets them to zero).
- Shifts the value in rS right by n bits
- Clears the rightmost n bits (sets to zero)
- Stores the result in rA
Note: Used for bitfield extraction and manipulation.
Affected Registers
- rA (Destination register)
Examples
# Clear right 8 bits clrrwi r3, r4, 8 # Extract upper 16 bits clrrwi r5, r6, 16