BEXT
Bit Extract
BEXT rd, rs1, rs2
Extracts the value of a single bit (0 or 1) at the index specified by rs2. The result is placed in the LSB of rd.
Details
BEXT extracts the single bit of rs1 selected by the lower log2(XLEN) bits of rs2, zero-extending to XLEN and writing to rd.
Pseudocode Operation
R[rd] = (R[rs1] >> (R[rs2] & (XLEN-1))) & 1;
Example
BEXT x10, x11, x12
Encoding
Binary Layout
0100100
31:25
rs2
24:20
rs1
19:15
101
14:12
rd
11:7
0110011
6:0
Operands
-
rd
Dest (0 or 1) -
rs1
Source -
rs2
Index