Webcentive RISC-V Reference

roriw

Rotate right word (Immediate)

Extension
Zbb, Zbkb, Zk, Zkn, Zks
XLEN
RV64 only
Assembly (riscv-unified-db)
roriw xd, xs1, shamt
Length
32-bit

Encoding

31252420191514121176210
0110000shamtrs1101rd0011011

Match 0x6000501b, mask 0xfe00707f. Source: roriw rd rs1 31..25=0x30 shamtw 14..12=5 6..2=0x06 1..0=3 in riscv-opcodes/extensions/rv64_zbb.

FieldBitsriscv-opcodes name
shamt24:20shamtw
rs119:15rs1
rd11:7rd

Description

Performs a rotate right on the least-significant word of xs1 by the amount in the least-significant log2(XLEN) bits of shamt. The resulting word value is sign-extended by copying bit 31 to all of the more-significant bits.

Description from riscv-unified-db, reformatted.

Operation

XReg xs1_word = X[xs1][31:0];

XReg unextended_result = (xs1_word >> shamt) | (xs1_word << (32 - shamt));
X[xd] = {{32{unextended_result[31]}}, unextended_result};

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

Specification and related pages