Mips

Reference GuideFree at PushingButtons.net
MIPS contains 32 registers for programmers to use:
Used to store returned values from function calls
Used to store values passed as arguments to functions
The MIPS IR register supports three different register formats. They
are R (register), I (immediate) and J (jump). All MIPS registers are 32-bit, so each register format is 32 bits wide. They differ in the number and types of fields they contain.
The R (register) format consists of five different fields. The 6-bit op-
code will always be 000000. Rs, Rt and Rd are 5-bit fields that specify the locations of registers being used. Rs and Rt are sources for the operation. Rd is the destination to store the result. If Rh (shift amount) is not used, it becomes 00000. The last 5 bits are the function code. This tells the computer which type of instruction should be executed.
The I (immediate) format consists of four different fields. The 6-bit
op-code determines what type of instruction should be executed. This is similar to the function code in the R-format. The Rs field is the source for the operation. The Rt is the register destination to store the result. The last 16 bits hold the value being applied in the operation.
The J (jump) format consists of only two fields. The 6-bit op-code will
always be 00001f. The last 26 bits specify the location being jumped to. These type of instructions are similar to high-level language “go to” commands.
Meaning  if $s >= 0 branch to offset
Meaning  if $s >= 0 branch to offset
Meaning  if $s > 0 branch to offset
Meaning  if $s <= 0 branch to offset
Meaning  if $s < 0 branch to offset
Meaning  if $s < 0 branch to offset
Meaning  [$s + offset] = half word $t
Meaning  $d = $t shifted left # times
Every program written in SPIM needs a data and text segment.
#.data signifies the beginning of the data segment.data
#.text starts the “text” portion of the program
Within the data segment you can initialize your variables. All variables are initialized in the form:
The name is user defined. It can be any name the programmer wishes to call the variable by. The variable types are the following:
ASCII string followed by a null terminator
http://www.cs.wisc.edu/~larus/spim.html
#This program prints to screen the string “Hello World!”
#.data signifies the beginning of the data segment.data
#If hello is called within the main program it will lead to the string.#.asciiz means that the string is in ASCII format followed by#a NULL terminatorhello: .asciiz "Hello World!"
#.text starts the “text” portion of the program.text
#Setting register $v0 equal to 4 tells the processor that#a string in register $a0 is going to be printed to screenli $v0, 4#Setting content of $a0 to string hellola $a0, hello#Calling system to perform outputsyscall
#This program inputs a number and then displays the number
#Setting register $v0 to 5 tells the processor that#an integer is going to be entered from the keyboardli $v0, 5#calling system to perform inputsyscall
#The integer that was entered will now be in#register $v0.#Moving this value into register $t0.move $t0, $v0
#Setting register $v0 to 1 tells the processor that the#contents of register $a0 are going to be printed to the monitorli $v0, 1#Moving content of register $t0 into register $a0move $a0, $t0#calling system to perform outputsyscall
#This program asks the user for two integers and then displays the sum
#Creating ASCII strings for input prompt and outputMsg: .asciiz "Enter in an integer: "Msg2: .asciiz "The sum is: "#Creating ASCII string for a carriage returnreturn: .asciiz "\n"
#Text portion of the program.text#Starting main programmain:
#Print to screen string “Enter in an integer: “li $v0, 4la $a0, Msgsyscall
#Input an integer from keyboard into register $v0li $v0, 5syscall#Move content of register $v0 into register $t0move $t0, $v0
#Print to screen string “Enter in an integer: “li $v0, 4la $a0, Msgsyscall
#Input an integer from keyboard into register $v0li $v0, 5syscall#move content of register $v0 into register $t1move $t1, $v0
#Print to screen string “\n” car carriage return.li $v0, 4la $a0, returnsyscall
#Print to screen string “The sum is: “li $v0, 4la $a0, Msg2syscall
#Adding registers $t0 and $t1 and store sum in $t2add $t2,$t0,$t1#Move content of register $t2 (the sum) into register $a0move $a0, $t2#Print to screen content of $a0li $v0, 1syscall
#This program asks the user for two numbers and displays their product
#Creating ASCII string for input promptmsg1: .asciiz "Please enter a number: "#Creating ASCII string for outputmsg2: .asciiz "The product is: "
#Printing to screen string “Please enter a number: “li $v0, 4la $a0, msg1syscall
#Input an integer from keyboard into register $v0li $v0, 5syscall#Move content of register $v0 into register $t0move $t0, $v0
#Printing to screen string “Please enter a number: “li $v0, 4la $a0, msg1syscall
#Input an integer from keyboard into register $v0li $v0, 5syscall#Move content of register $v0 into register $t1move $t1, $v0
#Multiplying $t0 by $t1. Product will be stored in register $LOmult $t0, $t1
#Moving content of $LO (the product) into register $t2mflo $t2
#Printing to screen string “The product is: “li $v0, 4la $a0, msg2syscall
#Moving content of $t2 (the product) into register $a0move $a0, $t2
#Printing to screen content of $a0li $v0, 1syscall
#This program asks the user for an integer and then determines if it#is even or odd
#Creating ASCII string for input promptquestion: .asciiz "Please enter an integer: "#Creating ASCII string for output if the number is eveneven: .asciiz "That number is even"#Creating ASCII string for output if the number is oddodd: .asciiz "That number is odd"
#Print to screen the string “Please enter an integer: “li $v0, 4la $a0, questionsyscall
#Input an integer from keyboard and store it in register $v0li $v0, 5syscall#Move content of $v0 into register $t0move $t0, $v0
#Load register $t1 with immediate value of 2li $t1, 2#Divide $t0 by $t1.#$t0 % $t1 will be stored in $HI. $t0 * $t1 will be stored in $LOdiv $t0, $t1
#Move content of $HI into register $t2mfhi $t2#If register $t2 is 0 (NUM % 2 = 0) then branch to AAAbeq $t2, $zero, AAA
#Print to screen string “That number is odd” if haven’t branchedli $v0, 4la $a0, oddsyscall#Jump to BBB (to skip message for even number)j BBB
#Print to screen string “That number is even”li $v0, 4la $a0, evensyscall

Online Information, from overseas, N. America – Over-the-counter health care products, 2012 DISCLAIMER: Information provided in this article is for educational purposes only and may not be construed as medical or legal advice. While the author believes information to be accurate, no claim has been made as to its accuracy and readers encouraged to make their own independent online inquires. ___

City of Northampton Public Health Notice Town of Southampton Public Health Notice West Nile Virus (WNV) Confirmed in Mosquitoes Collected from Northampton and Southampton August 1, 2013 CONTACT: Merridith O’Leary, R.S., Director of Public Health, City of Northampton (413) 587-1215 Adam Kinney, Public Health Agent, Town of Southampton (413) 529-1003 [email protected]