MIPS Registers


Registers are small storage areas in the CPU. Each register is 32 bits (4 bytes) long and can hold one value in 2's complement. In MIPS all arithmetic and logic operations take place in registers. Registers are also used to hold parameters, function return values, and for various information needed for the MIPS hardware and operating system.

There are 32 general purpose registers. There are additional registers for floating point and for control purposes.

Register
Number
Mnemonic
Name
Conventional Use
$0 zero permanently contains the value 0
$1 $at (Assembler Temporary) reserved for the assembler; used to implement macros
$2, $3 $v0, $v1 (Values) value(s) returned by a function
$4-$7 $a0-$a3 (Arguments) first four parms to a function; not preserved across function calls
$8-$15 $t0-$t7 (Temporary)
saved by caller if necessary, called function can use without saving; not preserved across function calls
$16-$23 $s0-$s7 (Saved values)
called function must save and restore before exiting; preserved across function calls
$24, $25 $t8, $t9 (Temporary)
saved by caller if necessary, called function can use without saving; not preserved across function calls (use in addition to $t0 to $t7)
$26, $27 $k0, $k1 Kernel (reserved for OS)
$28 $gp Global Pointer
$29 $sp Stack Pointer
$30 $fp Frame Pointer
$31 $ra Return Address for function calls
(Automatically used in some instructions)

There are two ways to use a register in an assembly language instruction. One method is to use the register number preceded by a $ sign. The other method is to use the alternative name.


Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2009