RORW

RISC-V RORW Instruction Details

Instruction ManualR-type

Rotate right word by register (RV64)

Instruction Syntax

rorw rd, rs1, rs2
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
BZbbBit Manipulation

Instruction Behavior

Rotates lower 32 bits of rs1 right by rs2[4:0], result sign-extended to XLEN. Part of Zbb and Zbkb.

RORW Decode And Execute Animation

Starts with machine-code field decoding, then shows operand reads, instruction-specific execution, and ISA-visible state update.

rd
rs1
rs2
rorw
,
,
Execution Context
t1(x6)
0x0000000000000014
a0(x10)
0x0000000000001000
31..25
24..20
19..15
14..12
11..7
6..0
0110000
funct7
01010
rs2
00110
rs1
101
funct3
00101
rd
0111011
opcode
Execution Data Path
instruction
0x60A352BB
opcode
0111011 -> OP-32
funct3
101 -> RORW
funct7
0110000 -> RORW selector
rd / rs1 / rs2
t0(x5) / t1(x6)=0x00000014 / a0(x10)=0x0000000000001000
shamt
rs2[4:0]=00000 -> 0
32-bit rotate right
0x00000014 rotr 0 -> low 32 bits 0x00000014 -> sext.w 0x0000000000000014
x5
t0(x5) = 0x0000000000000014
Current Step

Concept Step: receive the 32-bit instruction encoding

The machine code is split by the current instruction format; the animation starts from encoding/decode.

encoding: 0x60A352BB
syntax : rorw t0(x5), t1(x6), a0(x10)
result : t0(x5) = 0x0000000000000014
Architectural Result
t0(x5) = 0x0000000000000014

This animation shows ISA-visible decode and state changes, not any specific CPU pipeline, cache, prediction, or timing implementation.

Quick Understanding & Search Notes

RORW is RV64-only: it rotates rs1[31:0] right by rs2[4:0], then sign-extends the result to XLEN.

The W-suffixed form operates only on the low 32 bits of rs1 and uses a 5-bit amount.
The 32-bit result is sign-extended from bit 31 to XLEN; it is not an ordinary 64-bit rotate.

Common Usage Scenarios

Comparison & Detection

Understand this scenario with real code like «rorw x10, x11, x12 ; x10 = sign_ext(rotr(x11[31:0], x12[4:0]))».

Crypto & Security

Understand this scenario with real code like «rorw x10, x11, x12 ; x10 = sign_ext(rotr(x11[31:0], x12[4:0]))».

Pre-Use Checklist

Syntax Check
  • Verify rd, rs1, rs2 (and rs3) are valid GPRs.
  • Confirm funct3 and funct7 encoding is correct.
Semantic Check
  • Check if the result affects subsequent branches or address calculations.
  • Ensure the rd register is not overwritten by another instruction.

Pitfalls / Common Confusions

RV64 only
Operates on lower 32 bits
W-suffix instructions produce a 32-bit result and sign-extend bit 31 to XLEN; do not treat them as ordinary 64-bit operations.
RORW is an RV64 instruction; this W form does not exist in RV32.

FAQ

Does RORW access memory?

No. It only reads and writes integer registers; any memory access must be performed by a separate load or store instruction.

What is the result width of RORW?

RORW operates only on rs1[31:0] and writes rd after sign-extending bit 31 of the 32-bit result.