← Home

mul

Signed multiply

MUL performs an XLEN-bitxXLEN-bit multiplication of `xs1` by `xs2` and places the lower XLEN bits in the destination register. Any overflow is thrown away.

Note: If both the high and low bits of the same product are required, then the recommended code sequence is: MULH[[S]U] xdh, xs1, xs2; MUL xdl, xs1, xs2 (source register specifiers must be in same order and xdh cannot be the same as xs1 or xs2). Microarchitectures can then fuse these into a single multiply operation instead of performing two separate multiplies.

This instruction has data-independent execution timing.

Assembly format

mul xd, xs1, xs2

Encoding

313029282726252423222120191817161514131211109876543210
0000001xs2xs1000xd0110011

Decode variables

VariableBitsWidth
xs2[24:20]5
xs1[19:15]5
xd[11:7]5

Execution

XReg src1 = X[xs1];
XReg src2 = X[xs2];

X[xd] = (src1 * src2)[MXLEN-1:0];

Defined by

Zmmul

Access

SUVSVU
AlwaysAlwaysAlwaysAlways

Version af3eaf9+cheriot.f635218

Data from the RISC-V Unified Database, copyright RISC-V International and contributors.

CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.

This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.