BSET
Bit Set
BSET rd, rs1, rs2
Sets a single bit in rs1 at the index specified by rs2.
Encoding
Binary Layout
0010100
31:25
rs2
24:20
rs1
19:15
001
14:12
rd
11:7
0110011
6:0
Operands
-
rd
Destination register (integer) -
rs1
Source -
rs2
Index
Example
BSET x10, x11, x12
// Set the bit at index x12 in x11.
Related
More in Zbs
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
BSET sets the single bit of rs1 selected by the lower log2(XLEN) bits of rs2, writing the result to rd.
Operation
R[rd] = R[rs1] | (1 << (R[rs2] & (XLEN-1)));