Specifications
Usage
Carry Detection (unsigned operands):
Before or after the multiply operation, the carry out of the MSB
of rC can be detected using the following instruction sequence:
mul rC, rA, rB
mulxuu rD, rA, rB
cmpne rD, rD, r0
# The mul operation (optional)
# rD is nonzero if carry occurred
# rD is 1 if carry occurred, 0 if not
The mulxuu instruction writes a nonzero value into rD if the
multiplication of unsigned numbers generates a carry
(unsigned overflow). If a 0/1 result is desired, follow the mulxuu
with the cmpne instruction.
Overflow Detection (signed operands):
After the multiply operation, overflow can be detected using
the following instruction sequence:
mul rC, rA, rB
cmplt rD, rC, r0
mulxss rE, rA, rB
add rD, rD, rE
cmpne rD, rD, r0
# The original mul operation
# rD is nonzero if overflow
# rD is 1 if overflow, 0 if not
The cmplt–mulxss–add instruction sequence writes a nonzero
value into rD if the product in rC cannot be represented in 32
bits (signed overflow). If a 0/1 result is desired, follow the
instruction sequence with the cmpne instruction.
Exceptions
Unimplemented instruction
Instruction Type
R
Instruction Fields
A = Register index of operand rA
B = Register index of operand rB
C = Register index of operand rC
Bit Fields
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
8-58
mul
NII51017
2015.04.02
Altera Corporation
Instruction Set Reference
Send Feedback