MULH

Multiply High Signed

MULH rd, rs1, rs2

Performs a signed multiplication and stores the upper bits of the result.

Details

MULH multiplies rs1 and rs2 as signed values and writes the upper XLEN bits of the 2×XLEN-bit product to rd.

Pseudocode Operation

R[rd] = (sext(R[rs1]) * sext(R[rs2])) >> XLEN;

Example

MULH x5, x6, x7

Encoding

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

Operands

  • rd
    Dest (Upper Bits)
  • rs1
    Source register 1 (integer)
  • rs2
    Source register 2 (integer)