MIPS

Cards (8)

  • In the MIPS ISA, R-type instructions are instructions where the operands are all registers, except for right shift instructions. I-type instructiions are instructions where the operands are a combination of registers and an immediate value.
  • The MIPS ISA operates on 32 CPU registers.
  • MIPS also has access to special registers HI and LO. Most operations use the general purpose registers. However, the mult and div instructions use HI and LO for parts of their computation.
    mult rs rt
    Mult stores the result of $rs * $rt for the 32 most significant bits in HI and the 32 least significant bits in LO.
    div rs rt
    Div stores the result of $rs / $rt by storing the quotient in LO and the remainder in HI.
  • The MIPS instructions
    mflo rd
    Moves the value in the LO special register to $rd.
    mfhi rd
    Moves the value in HI special register to $rd.
  • When memory is spilled from registers, it is stored in main memory. Main memory can also hold data structures, such as arrays, that are used by the processor.
  • It is important to note that R-type instructions use the $rs register as the output register. I-type instructions use the $rt register for output. (no, I don't know why its like this)
  • To load a word from memory into a CPU register, use the MIPS instruction,
    lw rt immediate(rs)
  • To store a word in memory from a CPU register, use the MIPS instruction,
    sw rt immediate(rs)