PMIS 0.4 Instruction Set

Note: instructions are in alphabetical order

add
DescriptionPlace the sum of register1 and register2 into register0
Syntaxadd register0, register1, register2
Exampleadd $t0, $t1, $t2
Example implies$t0 = $t1 + $t2

addi
DescriptionPlace the sum of register1 and value into register0
Syntaxaddi register0, register1, value
Exampleaddi $t0, $t1, 42
Example implies$t0 = $t1 + 42
Range of value-32,768 to 32,767

and
DescriptionPlace the logical AND of register1 and register2 into register0
Syntaxand register0, register1, register2
Exampleand $t0, $t1, $t2
Example implies$t0 = binary bitwise ($t1 AND $t2)

andi
DescriptionPlace the logical AND of register1 and value into register0
Syntaxandi register0, register1, value
Exampleandi $t0, $t0, 42
Example implies$t0 = binary bitwise ($t0 AND 42)
Range of value0 to 65,535

beq
DescriptionBranch (jump to) label if register0 equals register1
Syntaxbeq register0, register1, label
Examplebeq $t0, $t1, end
Example impliesJump straight to "end:" if $t0 = $t1

bne
DescriptionBranch (jump to) label if register0 does NOT equal register1
Syntaxbne register0, register1, label
Examplebne $t0, $t1, end
Example impliesJump straight to "end:" if $t0 != $t1

j
DescriptionJump unconditionally to the instruction at the named label
Syntaxj label
Examplej end
Example impliesjump straight to label "end:"

jal
DescriptionJump straight to the instruction at the named label, and save the address of the next instruction (after jal) in $ra
Syntaxjal label
Examplejal subroutine1
Example impliesJump to "subroutine1:", storing following instruction's address in $ra

jr
DescriptionJump straight to the instruction whose address is in register0
Syntaxjr register0
Examplejr $t0
Example impliesJump to the instruction stored in $t0

lb
DescriptionLoad byte currently in memory to register
Syntaxlb register0, offset(register1)
Examplelb $t0, 44($s0)
Example implies$t0 = memory contents of address ($s0 + 44 bytes)
Range of offset-32,768 to 32767

lui
DescriptionLoad value into the upper halfword of register0, setting lower bits to 0
Syntaxlui register0, value
Examplelui $t0, 65535
Example impliesLoad "ffff" into the upper of $t0
Range of value0 to 65,535

lw
Descriptionload word from memory into a register address
Syntaxlw register0, offset, register1
Examplelw $t0, 16($s0)
Example implies$t0 = memory contents of ($s0 + 16 bytes)
Range of offset-32,768 to 32,767

nop
DescriptionDo nothing (useful for aligning programs in memory with external examples)
Syntaxnop
Examplenop
Example impliesNo operation performed

nor
DescriptionPlace the logical NOT OR of register1 and register2 into register0
Syntaxnor register0, register1, register2
Examplenor $t0, $zero, $t1
Example implies$t0 = NOT ($zero OR $t1)

or
DescriptionPlace the logical OR of register1 and register2 into register0
Syntaxor register0, register1, register2
Exampleor $t0, $t1, $t2
Example implies$t0 = binary bitwise ($t1 OR $t2)

ori
DescriptionPlace the logical OR of register1 and value into register0
Syntaxori register0, register1, value
Exampleori $t0, $s0, 64000
Example implies$t0 = binary bitwise ($s0 OR 64000)
Range of value0 to 65,535

sb
DescriptionSave byte currently in register to memory
Syntaxsb register0, offset(register1)
Examplesb $t0, 44($s0)
Example impliesMemory contents of address ($s0 + 44 bytes) = $t0
Range of offset-32,768 to 32767

sll
DescriptionShift the bits in register1 to the left by value places, and put result into register0
Syntaxsll register0, register1, value
Examplesll $t0, $t1, 4
Example implies$t0 = bits in $t1 shifted 4 places to left
Range of value0 to 31

slt
DescriptionSet register0 to 1 if register1 is less than register2
Syntaxslt register0, register1, register2
Exampleslt $t0, $t1, $t2
Example implies$t0 will hold 1 if $t1 is less than $t2; otherwise $t0 is set to 0

srl
DescriptionShift the bits in register1 to the right by value places, and put result into register0
Syntaxsrl register0, register1, value
Examplesrl $t0, $t1, 4
Example implies$t0 = bits in $t1 shifted 4 places to right
Range of value0 to 31

sub
DescriptionPlace the result of register1 minus register2 into register0
Syntaxsub register0, register1, register2
Examplesub $t0, $t1, $t2
Example implies$t0 = $t1 - $t2

sw
Descriptionsave word into memory from a register address
Syntaxsw register0, offset, register1
Examplesw $t0, 16($s0)
Example impliesmemory contents of ($s0 + 16 bytes) = $t0
Range of offset-32,768 to 32,767


[back to top]

Valid HTML 4.01
Last updated on 27 November, 2003 by Paul Morris