CS 2734, Hand Assembly of MIPS Code,  Answers

Assume that the acutal main program code starts at 0x00400020 and that the array A in the data segment starts at 0x10010000.
 
Line Number Location Counter Assembled Code MIPS Source
1          .global main
2 0   main:
3 0 0x20090004      addi $t1, $0, 4
4 4 0x212AFFFE      addi $t2, $t1, -2
5 8 0x01294020      add $t0, $t1, $t1
6 12 0x152A0002      bne $t1, $t2, next
7 16 0x08100010      j done
8     next:
9 20
24
0x3C091001
0x35290000
     la $t1, A
10 28 0x8D310005      lw $s1, 5($t1)
11 32   done:
12 32 0x03E00008      jr $ra
13          .data
14 0   A:   .word 1,2,3,4,5,6,7,8,9

Symbol Table
 
Numeber Symbol Value Segment Global
1 main 0 text Y
2 next 20 text N
3 A 0 data N
4 done 32 text N
5

Relocation Table
 
Number Location Type Segment Dependence
1 16 j text done
2 20 lui text A
3 24 ori text A
4 0 variable data A
5