Below is the usual (\"standard\") snapshot of MIPS registers, with a data declar
ID: 2291279 • Letter: B
Question
Below is the usual ("standard") snapshot of MIPS registers, with a data declaration and the SPIM memory dump from the data section. Remember: All register and memory contents are shown in hexadecimal form. Also, if any register or memory location is changed in a MIPS Revisters data n: .word p: word RO (r0) 0x00000000 0x0fofof0f Ox00000000 0x00000000 R1 (at): 0x10010000 0x0000ffff 0x00000000 0x00000001 R2 (v0) 0x0000000b 0x00000000 0x00000058 0x00000000 R3 (vl): 0x00000000 0x10010020 0x00000000 0x00000000 R4 (a0) 0x00000058 0x100100fo 0x00400020 0x10008000 R5 (al) 0x10010010 0x10010030 0x00000000 0x7fffeffo R6 (a2) 0x0000000c 0x80000080 0x800c1001 0x00000000 R7 (a3) 0x00000010 Oxffff0000 0x00000050 0x00400070 R8 (to) R9 (tl)R17 (s1) R25 (t9): R10 (t2) R18 (s2): R26 (k0): R11 (t3) R19 (s3)R27 (kl): R12 (t4) R20 (s4) R13 (t5) R14 (t6) R22 (s6): R15 (t7)R23 (s7) R16 (s0): R24 (t8): .word r Word : word t: .Word u: .word v: .Word : .word x Word Y: .Word z Word str: R28 (gp) R29 (sp) R30 (s8): R31 (ra) R21 (s5) asciiz "hello world " [0x10000000].. . [0x1000fffc] 0x00000000 [0x10010000] 0x5350494d 0x20697320 0x61207573 0x6566756c [0x10010010] 0x9073696d 0x756c6174 0xcf722066 0x6f72206c [0x10010020] 0x6561726e [0xf96e6720 0x4d495053 0xa0617373 [0x10010030] 0x68656c6c 0x6f20776f 0x726c640a 0x00000000 [0x100100401 0x726f6772 0x616d6d69 0x6e672061 0x6e642063 [0x10010050] 0xf7f7f7f70x74657220 0x617263680x69746563 [0x10010060] . . . [ 0x10020000] 0x00000000Explanation / Answer
move $t0, $at ; move assembler temporary (r1) register content to $to register (i.e. $t0 = 0x10010000)
li $t2, 8 ; load immediate value 8 into $t2 register
loop: lw $t1, 0($t0) ; copy word from RAM location (i.e. $t1 = 0x5350494d)
sw $t1, 64($t0) ; store word at RAM location ($t0 +64 = 0x10010040) $t1 = 0x726f6772
sub $t2, $t2, 1 ; $t2 = $t2 – 1 , decrement $t2 by 1
addi $t0, $t0, 4 ; $t0 = $t0 + 4
bgtz $t2 loop ; branch on greater than 0
li $v0, 10 ; load system call code
syscall
?(1.2) Program is moving (copying) 8 words of data from 0x10010000 location to 0x10010040 location in RAM
(1.2) Source data is at 0x10010000 onwards and pointed by $t0 register
(1.3) Destination is at 0x10010040 location onwards
(1.4) 8 cycles
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.