Webcentive RISC-V Reference

c.andi

And immediate

Extension
C
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
c.andi xd, imm
Length
16-bit (compressed)

Encoding

1513121110976210
100imm[5]10rs1′/rs2′imm[4:0]01

Match 0x8801, mask 0xec03. Source: c.andi rd_rs1_p c_imm6hi c_imm6lo 1..0=1 15..13=4 11..10=2 in riscv-opcodes/extensions/rv_c.

FieldBitsriscv-opcodes name
imm[5]12c_imm6hi
rs1′/rs2′9:7rd_rs1_p
imm[4:0]6:2c_imm6lo

Description

And an immediate to the value in xd, and store the result in xd. The xd register index should be used as xd+8 (registers x8-x15). C.ANDI expands into andi xd, xd, imm.

Description from riscv-unified-db, reformatted.

Operation

# shamt is between 0-63
X[creg2reg(xd)] = X[creg2reg(xd)] & $signed(imm);

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages