Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MIPS Registers R8 (t0) R16 (s0) R24 (t8) R17 (s1 R25 (t9) R26 (k0) R11 (t3) R19

ID: 2291277 • Letter: M

Question

MIPS Registers R8 (t0) R16 (s0) R24 (t8) R17 (s1 R25 (t9) R26 (k0) R11 (t3) R19 (s3) R27 (k1) R20 (s4) R28 (gp) 0x00000000 0x0f0f0f0f 0x00000000 0x00000000 Rl (at): 0x10010000 0x0000ffff [0x00000000 0x00000000 R10 (t2)R18 (s2): 0x0000000b 0x00000000 0x000000 58 Ox00000000 0x00000000 0x10010020 |0x00000000 0x00000000 R12 (t4) 0x000000580x100100f0 0x00400020 0x10008000 R13 (t5)R21 (s5): 0x100100100x10010030 0x00000000 0x7fffefEO R14 (t6) R22 (s6) R30 (s8): 0x0000000c 0x80000080 0x800c1001 Ox00000000 asciiz R15 (t7 R23 (s7) R31 (ra) 0x00000010 0xffffoo00 0x00000050 l0x00400070 world ' [0x10000000]. . . [0x1000fffc] 0x00000000 [0x10010000]|0x5350494d |0x20697 320?x61207573 0x6566756c 0x100100101 0x2073696d0x756c6174 0x6f722066 0x6f72206c [0x100100200x6561726e 0x696e6720 0x4d495053 0x20617373 [0x10010030]0x68656c6c 0x6f20776f 0x726c640a 0x00000000 [0x10010040] 0x726f6772 0x616d6d69 0x6e 672061 0x6e642063 [0x10010050] 0x6f6d7075 0x74657220 0x617263680x69746563 [0x10010060]. . .[0x10020000] 0x00000000

Explanation / Answer

(i) value for variable u is 0x6f722066. Each memory location can store a byte of data. Hence 4 memory location will able to accomodate a word of data.

(ii) $t1 = 0x6f72206c, RAM location contents is loaded in $t1 register.

(iii) load a word of data at RAM address ($t5 + 20, i.e. 0x10010030 + 20 = 0x10010044) into $t0 register.

Hence $t0 = 0x616d6d69

(iv) $t6 = 0x696e6720, same operation as in (i)

(v) rol, $t0, $t7, 8 - rotate the contents of $t7 in left by 8 bits and place the result into $t0 register. Hence contents of $t7 = 0xffff0000 is rotated 8 times to result 0xff0000ff. $t0 = 0xff0000ff

(vi) srl, $t0, $sp, 16 - Shift right logical sp register by 16 bits. Shifted places filled with 0. Here $sp = 0x7fffeff0 intially. After instruction execution 0x7fffeff0 becomes 0x00007fff.

$t0 = 0x00007fff