tags:

views:

25

answers:

2

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
+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:

  1. start multiply of divide
  2. execute the instructions in parallel
  3. store results in register HI and LO, when finished
  4. read results with mfhi and mflo

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