modud

Modulo Unsigned Doubleword

modud RT, RA, RB

Calculates remainder of unsigned doubleword division.

Details

The modud instruction performs an unsigned doubleword modulo operation. It divides a 128-bit dividend, formed by concatenating the contents of register RA and 64 bits of zero, by a 64-bit divisor from register RB. The result is the remainder of this division, which is placed into register RT.

Pseudocode Operation

dividend0:127 ← (RA) || 640
 divisor0:63 ← (RB)
 RT ← dividend % divisor

Programming Note

The modud instruction is used for performing an unsigned doubleword modulo operation. Ensure that the divisor in register RB is not zero to avoid undefined behavior. The result is placed in register RT, and this instruction operates at user privilege level.

Example

modud r3, r4, r5

Encoding

Binary Layout
31
0
RT
6
RA
11
RB
16
265
21
/
31
 
Format X-form
Opcode 0x7C000212
Extension Base

Operands

  • RT
    Target
  • RA
    Dividend
  • RB
    Divisor