REMW

Remainder Word

REMW rd, rs1, rs2

Computes the remainder of 32-bit signed division, sign-extending the result.

Details

REMW computes the signed 32-bit remainder of rs1 ÷ rs2, sign-extends to 64 bits, and writes to rd (RV64 only).

Pseudocode Operation

R[rd] = sext(R[rs1][31:0] %s R[rs2][31:0]);

Example

REMW x10, x11, x12

Encoding

Binary Layout
0000001
31:25
rs2
24:20
rs1
19:15
110
14:12
rd
11:7
0111011
6:0
 
Format R-Type
Opcode 0x3B
Extension M

Operands

  • rd
    Remainder
  • rs1
    Dividend
  • rs2
    Divisor