BINV

Bit Invert

BINV rd, rs1, rs2

Inverts (toggles) a single bit in rs1 at the index specified by rs2.

Encoding

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

Operands

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

Example

BINV x10, x11, x12

// Toggle the bit at index x12.

Related

More in Zbs

Description

BINV inverts 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)));