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
| 3125 | 2420 | 1915 | 1412 | 117 | 62 | 10 | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0110000 | shamt | rs1 | 101 | rd | 00110 | 11 | |||||||||||||||||||||||||
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.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| shamt | 24:20 | shamtw |
| rs1 | 19:15 | rs1 |
| rd | 11:7 | rd |
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
- The RISC-V Instruction Set Manual: src/unpriv/zbb.adoc (Zbb)
- The RISC-V Instruction Set Manual: src/unpriv/zbkb.adoc (Zbkb)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zk)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zkn)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zks)
- riscv-unified-db: spec/std/isa/inst/B/roriw.yaml
- Zbb instruction listing
- Zbkb instruction listing
- Zk instruction listing
- Zkn instruction listing
- Zks instruction listing