rorw

Rotate right word (Register)

This instruction is defined by:

Encoding

svg

Synopsis

Performs a rotate right on the least-significant word of xs1 by the amount in least-significant 5 bits of xs2. The resultant word is sign-extended by copying bit 31 to all of the more-significant bits.

Access

M HS U VS VU

Always

Always

Always

Always

Always

Decode Variables

Bits<5> xs2 = $encoding[24:20];
Bits<5> xs1 = $encoding[19:15];
Bits<5> xd = $encoding[11:7];

Execution

  • Pruned, XLEN == 64

  • Original

if (implemented?(ExtensionName::B) && (misa.B == 1'b0)) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
XReg xs1_word = X[xs1][31:0];
XReg shamt = X[xs2][4:0];
XReg unextended_result = (X[xs1] >> shamt) | (X[xs1] << (32 - shamt));
X[xd] = {{32{unextended_result[31]}}, unextended_result};
if (implemented?(ExtensionName::B) && (misa.B == 1'b0)) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
XReg xs1_word = X[xs1][31:0];
XReg shamt = X[xs2][4:0];
XReg unextended_result = (X[xs1] >> shamt) | (X[xs1] << (32 - shamt));
X[xd] = {{32{unextended_result[31]}}, unextended_result};

Exceptions

This instruction may result in the following synchronous exceptions:

  • IllegalInstruction