| MIPS: instruction example | |||||||||||
| Example: add unsigned | |||||||||||
| addu $r10,$r8,$r9 # add 2 numbers | |||||||||||
| Syntax | |||||||||||
| 3-operand instructions: all arithmetic/logical operations | |||||||||||
| operands separated by commas | |||||||||||
| Design principle #1: "Simplicity favors regularity." | |||||||||||
| operation: | addu | ||||||||||
| one operation per instruction | |||||||||||
| one instruction per line | |||||||||||
| registers | |||||||||||
| source: | $r8, $r9 | ||||||||||
| target: | $r10 | ||||||||||
| comment: | # add 2 numbers | ||||||||||
| starts with #, ends with end of line | |||||||||||
| Semantics | |||||||||||
| $r10 = $r8 + $r9; | |||||||||||
| alternative notation: | |||||||||||
| R[10] <-- R[8] + R[9] | |||||||||||
| Machine code | |||||||||||
| hex: | 0x01095021 | ||||||||||