When,where and why should the mflo statement be used in assembly language?
+1
A:
By extrapolation from this document, when you want to access the result of a multiplication or division on a MIPS processor.
Pascal Cuoq
2010-08-22 21:29:35
+1
A:
MIPS multiplier is a separate unit, and instructions within the unit consume more than other integer instructions. This is why there is a different handling of this unit and results it provides.
Usage of this unit is as follows:
- start multiply of divide
- execute the instructions in parallel
- store results in register
HI
andLO
, when finished - read results with
mfhi
andmflo
Note that if results are not ready when you try to read them, the CPU will wait until they arrive.
If you decide to use mul
and div
instructions, you do not need to think about mfhi
and mflo
instructions.
MannyNS
2010-08-23 11:12:17