BSET

Bit Set

BSET rd, rs1, rs2

Sets a single bit in rs1 at the index specified by rs2.

Details

BSET sets the single bit of rs1 selected by the lower log2(XLEN) bits of rs2, writing the result to rd.

Pseudocode Operation

R[rd] = R[rs1] | (1 << (R[rs2] & (XLEN-1)));

Example

BSET x10, x11, x12

Encoding

Binary Layout
0010100
31:25
rs2
24:20
rs1
19:15
001
14:12
rd
11:7
0110011
6:0
 
Format R-Type
Opcode 0x33
Extension Zbs

Operands

  • rd
    Destination register (integer)
  • rs1
    Source
  • rs2
    Index