c.andi
And immediate
- Extension
- C
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
c.andi xd, imm- Length
- 16-bit (compressed)
Encoding
| 1513 | 12 | 1110 | 97 | 62 | 10 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | imm[5] | 10 | rs1′/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.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| imm[5] | 12 | c_imm6hi |
| rs1′/rs2′ | 9:7 | rd_rs1_p |
| imm[4:0] | 6:2 | c_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.