MIPS ISA and MIPS Assembly
CS301
- Prof. Szajda
MIPS ISA and MIPS Assembly CS301 Prof. Szajda Administrative HW - - PowerPoint PPT Presentation
MIPS ISA and MIPS Assembly CS301 Prof. Szajda Administrative HW #2 due Wednesday (9/11) at 5pm Lab #2 due Friday (9/13) 1:30pm Read Appendix B5, B6, B.9 and Chapter 2.5-2.9 (if you have not already done so!) MIPS ISA MIPS ISA
w $0
w $v0, $v1 ($2, $3)
w $a0-$a3 ($4-$7) w If more than 4 registers required, then place parameters “above” frame pointer (at higher address)
w $f0, $f1, ..., $f31
w reference even numbered registers
w Return values
§ $f0-$f3
w Function arguments
§ $f12 - $f15
w load computed address (not contents of location) into register rt
w load word in memory location address into register rt
w store value in register rt into memory at location address
w load integer constant imm into register rt
w load double precision fp value from memory location address into fp register rt and rt+1
w rd = rs + rt
w rd = rs + imm
w rd = rs - rt
w rd = rs × rt
w rd = rs / rt
w Set register rd to 1 if rs < rt, otherwise set rd to 0
w Set register rd to 1 if rs < imm, otherwise set rd to 0
w Set rd to 1 if rs == rt, otherwise set rd to 0
16
# assign.asm # simple program to modify a global variable .data # add what follows to the data section x: .word 5 # create global integer variable x. Set to 5. .text # add what follows to the text .align 2 # Align on word boundaries .globl main # "exports" the symbol main so it is # accessible to other modules main: # we don't need a frame la $t0, x # $t0 = &x lw $t1, 0($t0) # $t1 = x addi $t1,$t1,2 # $t1 = $t1 + 2 sw $t1, 0($t0) # x = $t1 jr $ra # return - main is a function, too
w main:
w registers w constants/immediates w addresses
§ Explicit numbers § Register + ofgset § Labels
w How would I declare A as a global array?
w How would I declare A as a global variable?