Notes From CS Undergrad Courses FSU
This project is maintained by awa03
Pre Lecture Video Notes
An instruction is a command that hardware understands
The general classes of MIPS instructions are
add a, b, c # a = b + c;
add a, a, a. # a = a + a
sub a, b, a # f contains t0 - t1
# a = b - ((b+c) + a + a)
In MIPS, operands for general arithmetic operations must be from registers of constants
| Name | Number | Use |
|---|---|---|
$zero |
0 | Const 0 |
$at |
1 | Assembler temporary, for resolving pseudoinstructions |
$v0 - $v1 |
2-3 | Function results and expression evaluation |
$a0 - $a3 |
4-7 | Arguments |
$t0 - $t9 |
8-15, 24-25 | Temporary |
$s0 - $s7 |
16-23 | Saved Temporary |
$k0 - $k1 |
26-27 | OS Kernel |
$gp |
28 | Global pointer |
$sp |
29 | Stack pointer |
$fp |
30 | Frame pointer |
$ra |
31 | Return address |
More about how these work: [[Intro To MIPS]] More about the use of these: [[Logical Operations]]
The general form for a mips instruction is
Instruction_mnemonic $target, $source1, $source2
Add can be ADD or even aDdWe don’t have variables, we have registers.