Home/Instructions/Bit Extract Immediate
BEXTI

RISC-V BEXTI Instruction Details

Instruction ManualI-type

Extract single bit by immediate index

Instruction Syntax

bexti rd, rs1, uimm
Operand Breakdown
Destination rd: receives the result of the single-bit extract, invert, or set operation; a write to rd=x0 is discarded.
Source rs1: supplies the XLEN-bit value whose bit is extracted, inverted, or set.
shamt: immediate-encoded bit index. RV32 uses shamt[4:0] and encodings with shamt[5]=1 are reserved; RV64 uses shamt[5:0].
ZbsBit ManipulationSingle-Bit Operation

Instruction Behavior

bexti is a Zbs single-bit extract instruction. The bit index comes from the immediate field.

BEXTI Decode And Execute Animation

Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.

rd
rs1
shamt
bexti
,
,
Execution Context
a0(x10)
0x00001000
31..25
24..20
19..15
14..12
11..7
6..0
0100100
fixed imm[11:5]
01100
shamt[4:0]
01010
rs1
101
funct3
00101
rd
0010011
opcode
Execution Data Path
instruction
0x48C55293
opcode
0010011 -> OP-IMM
funct3
101 -> BEXTI
imm[11:5]
imm[11:5]=0100100 fixed
rd / rs1
t0(x5) / a0(x10)=0x00001000
imm[11:5] + shamt[4:0]
imm[11:5]=0100100 fixed -> index=12
single-bit extract
(0x00001000 >> 12) & 1 = 1
x5
t0(x5) = 0x00000001
Current Step

Concept Step: receive the 32-bit instruction encoding

The machine code is split by the current instruction format; the animation starts from encoding/decode.

encoding: 0x48C55293
syntax : bexti t0(x5), a0(x10), 12
result : t0(x5) = 0x00000001
Architectural Result
t0(x5) = 0x00000001

This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.

Quick Understanding & Search Notes

bexti is a Zbs single-bit extract instruction. The bit index comes from the immediate field.

These instructions are part of a B-extension subset and operate on XLEN-wide integer register values.
The immediate field width depends on XLEN; RV32 encodings with shamt[5]=1 are reserved, while RV64 encodes 0..63.
bext/bexti returns 0 or 1; it does not preserve the original bit position.

Common Usage Scenarios

Bit Operations & Masks

Understand this scenario with real code like «bexti x10, x11, 2 ; x10 = (x11 >> 2) & 1».

Comparison & Detection

Understand this scenario with real code like «bexti x10, x11, 2 ; x10 = (x11 >> 2) & 1».

Pre-Use Checklist

Syntax Check
  • Verify the immediate field is within the valid range.
  • Confirm source register rs1 points to the correct operand.
Semantic Check
  • Check if the immediate sign-extension matches expectations.
  • Ensure the result register rd has a clear purpose.

Pitfalls / Common Confusions

The immediate field width depends on XLEN; RV32 encodings with shamt[5]=1 are reserved, while RV64 encodes 0..63.
bext/bexti returns 0 or 1; it does not preserve the original bit position.

FAQ

Does bexti access memory?

No. It reads integer register operands and writes rd only.

How is the bit index selected for bexti?

The immediate encodes the bit position directly, with the legal range determined by XLEN.