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
| 1513 | 12 | 1110 | 97 | 62 | 10 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | nzuimm[5] | 00 | rs1′/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.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| nzuimm[5] | 12 | c_nzuimm6hi |
| rs1′/rs2′ | 9:7 | rd_rs1_p |
| nzuimm[4:0] | 6:2 | c_nzuimm6lo |
RV32 form; listed in riscv-opcodes as a pseudo-op of c.srli
| 1513 | 1210 | 97 | 62 | 10 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 000 | rs1′/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.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| rs1′/rs2′ | 9:7 | rd_rs1_p |
| nzuimm[4:0] | 6:2 | c_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.