extldi

Extract and Left Justify Immediate

extldi ra,rs,n,b (n > 0)

Extracts a field of n bits starting at bit position b in the source register, left justifies this field in the target register, and clears all other bits of the target register to 0.

Details

For extldi, the field of n bits starting at bit position b in the source register is extracted, left justified in the target register, and all other bits are cleared to 0.

Pseudocode Operation

if 'extldi' then
    ra <- (rs >> b) & ((1 << n) - 1)

Programming Note

Use extldi to extract a specific bit field from a source register, left-justifying it in the target register. Ensure that the bit position and length are correctly specified to avoid data corruption. This instruction operates at user privilege level.

Example

extldi ra, rs, n, b (n > 0)

Encoding

Binary Layout
18
0
LI
6
AA
30
LK
31
 
Format XO-form
Opcode
Extension Base

Operands

  • ra
    Target General Purpose Register
  • rs
    Source General Purpose Register
  • n
    Number of bits to extract
  • b
    Starting bit position