000000 01000 01001 0 1 0 1 1 00000 100001 ALUop $8 $9 $11 addu op1 op2 dest
|$1||$at||Assembler Temporary (reserved)|
|$2, $3||$v0, $v1||Value returned by a subroutine|
|$4-$7||$a0-$a3||Arguments to a subroutine|
(not preserved across a function call)
|$16-$23||$s0-$s7||Saved registers |
(preserved across a function call)
|$24, $25||$t8, $t9||Temporary|
|$26, $27||$k0, $k1||Kernel (reserved for OS)|
|$31||$ra||Return Address |
(Automatically used in some instructions)
Congratulations! (if you correctly answered the question). You have just done some machine language programming. Who needs that old assembler, anyway?
General purpose registers are those that assembly language
programs work with (other than floating point registers).
The general purpose registers are numbered
However, by convention (and sometimes by hardware)
different registers are used for different purposes.
In addition to a number
registers have a mnemonic name
(a name that reminds you of its use).
For example register
$0 has the mnemonic name zero.
The table shows the 32 registers and their conventional use.
$31 are the only two that
behave differently from the others.
$0 is permanently wired to contain zero bits.
$31 is automatically used by some subroutine linkage
instructions to hold the return address.
If this looks totally cryptic, don't worry. Don't try to memorize this. You will get used to what you need to know after writing a few programs.
A program has just calculated an important value which is
contained in register
It copies this value to register
$0. Is this wise?