bexti

Single-Bit extract (Immediate)

Returns a single bit extracted from xs1 at the index specified in xs2. The index is read from the lower log2(XLEN) bits of shamt. For RV32, the encodings corresponding to shamt[5]=1 are reserved.

Assembly format

bexti xd, xs1, shamt

Decode Variables

  • RV32

  • RV64

Bits<5> shamt = $encoding[24:20];
Bits<5> xs1 = $encoding[19:15];
Bits<5> xd = $encoding[11:7];
Bits<6> shamt = $encoding[25:20];
Bits<5> xs1 = $encoding[19:15];
Bits<5> xd = $encoding[11:7];

Execution

if (implemented?(ExtensionName::B) && (CSR[misa].B == 1'b0)) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
XReg index = shamt & (xlen() - 1);
X[xd] = (X[xs1] >> index) & 1;

Exceptions

This instruction may result in the following synchronous exceptions:

  • IllegalInstruction

Encoding

This instruction has different encodings in RV32 and RV64.
RV32
svg
RV64
svg

Defining extension

Zbs

Access

M

Always

Containing profiles

  • Mandatory: RVA22S64, RVA22U64, RVA23S64, RVA23U64, RVB23S64, RVB23U64

  • Optional: None