Webcentive RISC-V Reference

c.srli

Shift right logical immediate

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

Encoding

RV64 form

1513121110976210
100nzuimm[5]00rs1′/rs2′nzuimm[4:0]01

Match 0x8001, mask 0xec03. Source: c.srli rd_rs1_p c_nzuimm6lo c_nzuimm6hi 1..0=1 15..13=4 11..10=0 in riscv-opcodes/extensions/rv64_c.

FieldBitsriscv-opcodes name
nzuimm[5]12c_nzuimm6hi
rs1′/rs2′9:7rd_rs1_p
nzuimm[4:0]6:2c_nzuimm6lo

RV32 form; listed in riscv-opcodes as a pseudo-op of c.srli

15131210976210
100000rs1′/rs2′nzuimm[4:0]01

Match 0x8001, mask 0xfc03. Source: $pseudo_op rv64_c::c.srli c.srli rd_rs1_p c_nzuimm5 1..0=1 15..13=4 12..10=0 in riscv-opcodes/extensions/rv32_c.

FieldBitsriscv-opcodes name
rs1′/rs2′9:7rd_rs1_p
nzuimm[4:0]6:2c_nzuimm5

Description

Shift the value in xd right by shamt, and store the result back in xd. The xd register index should be used as xd+8 (registers x8-x15). C.SRLI expands into srli xd, xd, shamt.

Description from riscv-unified-db, reformatted.

Operation

# shamt is between 0-63
X[creg2reg(xd)] = X[creg2reg(xd)] >> shamt;

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

Specification and related pages