|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pseudoinstructions: Data
transfer (register) |
|
|
|
|
|
|
|
Instruction |
|
Real instructions |
|
Semantics |
|
|
Copy contents of register
s to register t |
|
|
mov
$rt, $rs |
addi $rt, $rs, 0 |
|
R[t] = R[s] |
|
|
|
|
|
|
|
|
|
Load immediate into
register s |
|
|
|
|
|
|
li
$rs, immed |
|
|
|
R[s] = immed |
|
|
|
The way this is
translated depends on whether immed is 16 bits or 32 bits: |
|
li
$rs, small |
ori $rs, $0, small |
|
R[s] = small |
|
|
li
$rs, -small |
addiu $rs, $0, -small |
|
R[s] = -small |
|
|
li $rs, big |
|
lui $rs, upper(big) |
|
R[s] = big |
|
|
|
|
ori $rs, $rs, lower(big) |
|
|
|
|
small: 16-bit value |
|
|
|
|
|
|
big: 32-bit value |
|
|
|
|
|
|
Note: upper(big) and lower(big)
are not real instruction syntax |
|
|
|
The assembler must
figure out how to get the upper 16 bits of a 32-bit value: |
|
|
upper (big) = big31-16 |
|
lower (big) = big15-0 |
|
|
|
|
|
|
|
|
|
Load address into
register s |
|
|
|
|
|
|
la
$rs, addr |
lui $rs, upper(addr) |
|
R[s] = addr |
|
|
|
|
|
ori $rs, $rs, lower(addr) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|