CPU Registers

The MIPS32® Architecture defines the following Central Processing Unit (CPU) registers:

  • Thirty-two 32-bit General Purpose Registers (GPRs)
  • A special-purpose Program Counter (PC) that is affected only indirectly by certain instructions and is not architecturally visible
  • One 64-bit Accumulator to hold the results of integer multiply, divide and multiply-accumulate operations (HI and LO)

General Purpose Registers

The MIPS® architecture has 32 general purpose CPU registers for your program use: $0 - $31.

Two, and only two, behave differently than the others: $0 & $31:

  • $0 - Always returns zero, no matter what you store in it.
  • $31 - Always used by the normal subroutine calling instruction (jal)

The remainder are identical and may be used in any instruction to hold data or addresses.

Although the hardware makes few rules about the use of registers, their practical use is governed by conventions that have been developed over time in order to facilitate code re-use.

With the conventional uses of the registers come the conventional set of names. The following table lists the conventional names of the registers with usages (from the MPLAB® XC32 Users Guide DS50001686G):


HI(x)/LO(x) Register Usage

  • During a legacy multiply operation (mult), the HI and LO registers store the product of integer multiply. Special instructions are available to move HI/LO results to/from the register file (mfhi, mflo, mthi, mtlo)
  • Multiply-Add (madd) and Multiply-Subtract (msub) produce a full-width product twice the width of the input operations and adds or subtracts the product from the concatenated value of HI and LO. The low half of the addition is loaded into LO and the high half is loaded into HI.
  • Divide (div) produces a quotient that is loaded into LO and a remainder that is loaded into HI.
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.