开发者

Use of mflo statement

When,where and why should the mflo statement be used in assembly langu开发者_开发百科age?


By extrapolation from this document, when you want to access the result of a multiplication or division on a MIPS processor.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜