|
|
|
|
|
|
|
|
|
|
|
|
|
Instruction formats:
R-type, I-type |
|
|
|
|
R-type: register |
|
|
|
|
addu $r10,$r8,$r9 # add 2 numbers |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
000000 |
01000 |
01001 |
01010 |
00000 |
100001 |
|
|
|
b31-26 |
b25-21 |
b20-16 |
b15-11 |
b10-6 |
b5-0 |
|
|
|
|
opcode |
$rs |
$rt |
$rd |
shamt |
function |
|
|
|
3 registers: 2 source, 1
destination |
|
|
|
operation: opcode and
function |
|
|
|
|
|
|
|
I-type:
immediate |
|
|
|
|
|
addi $rt, $rs, immed # add a constant to a register |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
001000 |
01000 |
01001 |
01010 |
00000 |
100001 |
|
|
|
b31-26 |
b25-21 |
b20-16 |
b15-0 |
|
|
|
|
opcode |
$rs |
$rt |
immediate |
|
|
|
|
semantics: |
R[t] = R[s] + (IR15)16::IR15-0 |
|
|
|
|
- sign-extend the immediate value to 32
bits |
|
|
|
|
- add it (using signed addition) to
register R[s] |
|
|
|
|
- store the result in register R[t] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|