MIPS Training Formats

 



Typical Instruction Formats


Basic I-format Instructions

Instructions ensure observe typical select:
Name Format Layout Example
6 bit 5 bits 5 piece 5 bits 5 score 6 bits
op rs rt immediacy
addiI8 21100 addi $1, $2, 100
addiuI9 21100 addiu $1, $2, 100
andiI12 21100 andi $1, $2, 100
oriI13 21100 ori $1, $2, 100
sltiI10 21100 slti $1, $2, 100
sltiuI11 21100 sltiu $1, $2, 100
NOTE: Rank of components in machine code is different from assembly code. Module code order is similar to C, destination first. Machine cypher shall source registrations, then destination.
op rs rt immediate
8 19 10 4
001000 10011 01010 0000000000000100

J-format Instructions

Product Format System Exemplary
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
op address
jBOUND2 2500j 10000
jalJ3 2500jal 10000
op address
2 257
000010 00000000000000000100000001

Basic R-format Instructions

Name Size View Example
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
op rs rt rd shamt funct
addR0 2310 32add $1, $2, $3
adduR0 2310 33addu $1, $2, $3
subR0 2310 34sub $1, $2, $3
subuR0 2310 35subu $1, $2, $3
andR0 2310 36and $1, $2, $3
orR0 2310 37instead $1, $2, $3
norR0 2310 39nor $1, $2, $3
sltR0 2310 42slt $1, $2, $3
sltuRADIUS0 2310 43sltu $1, $2, $3

NOTE: op be 0, as funct disambiguates

ops rs rt rd shamt funct
0 17 18 16 0 32
000000 10001 10010 10000 00000 100000
NOTE: Order of components in machine code is different from assembly key. Assembly code order is similar to C, destination first. Powered code has destination last.
C: a = barn + hundred
assembly code: add $s0, $s1, $s2    # add rd, rs, rt
machine control: 000000 10001 10010 10000 0000 100000
(op rs rt rd shamt funct)

 


Alyce Brady, Kalamazoo College