MIPS Instructions | |||||||
---|---|---|---|---|---|---|---|
Bit # | 31..26 | 25..21 | 20..16 | 15..11 | 10..6 | 5..0 | |
R-type | op | rs | rt | rd | sa | func | |
add | 000000 | rs | rt | rd | 00000 | 100000 | rd <- rs + rt |
sub | 000000 | rs | rt | rd | 00000 | 100010 | rd <- rs - rt |
and | 000000 | rs | rt | rd | 00000 | 100100 | rd <- rs & rt |
or | 000000 | rs | rt | rd | 00000 | 100101 | rd <- rs | rt |
sll | 000000 | 00000 | rt | rd | sa | 000000 | rd <- rt << sa |
srl | 000000 | 00000 | rt | rd | sa | 000010 | rd <- rt >> sa (logical) |
sra | 000000 | 00000 | rt | rd | sa | 000011 | rd <- rt >> sa (arithmetic) |
I-type | op | rs | rt | immediate | |||
addi | 001000 | rs | rt | immediate | rt <- rs + (sign-extend)immediate | ||
andi | 001100 | rs | rt | immediate | rt <- rs & (zero-extend)immediate | ||
ori | 001101 | rs | rt | immediate | rt <- rs | (zero-extend)immediate | ||
lw | 100011 | rs | rt | immediate | rt <- memory[rs + (sign-extend)immediate] | ||
sw | 101011 | rs | rt | immediate | memory[rs + (sign-extend)immediate] <- rt | ||
beq | 000100 | rs | rt | immediate | if (rs == rt) PC <- PC+4 + (sign-extend)immediate<<2 | ||
bne | 000101 | rs | rt | immediate | if (rs != rt) PC <- PC+4 + (sign-extend)immediate<<2 | ||
J-type | op | address | |||||
j | 000010 | address | PC <- (PC+4)[31..28],address,0,0 |