MIPS Instructions

The instructions implemented in the model are:

Load/Store Instructions:

InstructionDescriptionExampleResult
LBLoad ByteLB R3 1(R0) Loads Byte from memory location 1
LBULoad Byte UnsignedLBU R4 1(R0) Loads Byte Unsigned from memory location 1
SBStore ByteSB R1 1(R0) Stores Byte in R1 into memory location 1
LHLoad HalfwordLH R4 2(R0)

Loads Halfword from memory location 2 into R4

LHULoad Halfword UnsignedLHU R4 2(R0) Loads Halfword Unsigned from memory location 2 into R4
LUILoad Upper ImmediateLUI R1 124 Load 124 in the the upper half of regester R1
SHStore HalfwordSH R5 6(R0) Stores Halfword from R5 into memory loction 6
LWLoad WordLW R4 8(R0) Loads Word from data memory loaction word 8 into R4
SWStore WordSW R3 16(R0) Stores Word in R3 into location 16 in data memory

Arithmetic Instructions:

InstructionDescriptionExample Result
ADDIAdd Immediate WordADDI R1 R2 -4 Store R2 + -4 in R1
ADDIUAdd Immediate Unsigned WordADDIU R1 R2 16 Store R2 + 16 in R1
ADDAdd WordADD R1 R2 R3 Store R2 + R3 in R1
ADDUAdd Word UnsignedADD R1 R2 R3 Store R2 + R3 in R1
SUBSubtract WordSUB R1 R2 R3 Store R2 - R3 in R1
SUBUSubtract Word UnsignedSUB R1 R2 R3 Store R2 - R3 in R1
SLTSet on less thanSLT R1 R2 R3 If R2 is less than R3 set R1 to be 1 else set it to 0
SLTISet on less than ImmediateSLTI R1 R2 5 If R2 is less than 5 then set R1 to 1 else set it to 0
SLTUSet on less than UnsignedSLTU R1 R2 R3 If the unsigned value of R2 is less than the unsigned value R3 set R1 to 1 else set it to 0
SLTIUSet on less than Immediate UnsignedSLTIU R1 R2 6 If the R2 is less than 6 (after sign extension)set R1 to 1 else set it to 0

Logical Instructions:

InstructionDescriptionExampleResult
ANDAndAND R1 R2 R3 Stores result of R2 AND R3 into R1
ANDIAnd ImmediateANDI R1 R1 19 Stores the result of R1 AND 19 back into R1
OROrOR R1 R2 R3 Stores result of R2 OR R3 into R1
ORIOr ImmediateORI R1 R1 128 Stores the result of R1 OR 128 back into R1
XORExclusive OrXOR R1 R2 R3 Stores result of R2 XOR R3 into R1
XORIExclusive Or ImmediateXORI R1 R1 64 Stores the result of R1 OR 64 back into R1
NORNorNOR R1 R2 R3 Stores result of R2 NOR R3 into R1
SSLShift Word Left LogicalSSL R1 R2 4 Shift R2 4 bits to the left and store in R1
SRLShift Word Right LogicalSRL R1 R2 2 Shift R2 2 bits to the right and store in R1
SRAShift Word Right ArithmeticSRA R3 R4 2 Arithmrticaly shift R4 2 bits right and store in R3
SLLVShift Word Left Logical VarableSLLV R1 R2 R3 Shift R2 left by R3 bits and store in R1
SRLVShift Word Right Logical VarableSRLV R1 R2 R3 Shift R2 right by R3 bits and store in R1
SRAVShift Word Right Arithmetic VarableSRAV R1 R2 R3 Shift R2 right arithemeticaly by R3 bits and store in R1

Jump Instructions:

InstructionDescriptionExampleResult
JJumpJ 8 Jump to instruction 8
JRJump RegisterJ R1 Jump to the instruction number held in R1

Branch Instructions:

InstructionDescriptionExampleResult
BEQBranch on equalBEQ R1 R2 4 Branch forward 4 instructions if R1 and R2 are equal
BNEBranch on not equalBNE R1 R2 8 Branch forward 8 instructions if R1 and R2 are not equal
BLEZBranch on less than or equal to zeroBLEZ R2 -2 Branch back 2 instructions if R2 is less than or equal to zero
BGTZBranch on greater than zeroBGTZ R2 -2 Branch back 2 instructions if R2 is greater than zero
BLTZBranch on less than zeroBLTZ R2 3 Branch forward 3 instructions if R2 is less than zero
BGEZBranch on greater than or equal to zeroBGTZ R2 5 Branch forward 5 instructions if R2 is greater than or equal to zero
BLTZALBranch on less than zero and linkBLTZAL R2 3 Branch forward 3 instructions if R2 is less than zero
BGEZALBranch on greater than or equal to zero and linkBGTZAL R2 5 Branch forward 5 instructions if R2 is greater than or equal to zero and link

Other Instructions:

InstructionDescriptionExampleResult
BREAKBreakpointBREAK Halt
NOPNo OperationNOP No operation