About how many significant bits do you expect in this product:
01001010 × 00010101
About 12 significant bits.
mfhi
and mflo
InstructionsThere are two instructions that move the result of a multiplication into a general purpose register:
mfhi d # d <— hi. Move From Hi
mflo d # d <— lo. Move From Lo
The hi
and lo
registers
cannot be used with any of the other arithmetic or logic
instructions.
If you want to do something with a product, it must first
be moved to a general purpose register.
However there is a further complication on MIPS hardware:
Rule:
Do not use a multiply or a divide instruction
within two instructions after mflo
or mfhi
.
The reason for this involves the way the MIPS pipeline works.
On the SPIM simulator this rule does not matter.
Must you move the result of one multiply
from lo
and hi
before you start another multiply operation?