1
votes

I have the following question:

.data
a: .word 12,-5,4,0
x: .byte 5
.text
main: addi $t1, $0, 8
lw $t2, a($0)
lw $t3, a($t1)

Can someone tell me what the value of $t3 will be? How can you access the 8th element when the array has a length of 4?

1

1 Answers

4
votes

The value will be 4. MIPS is byte-addressed, not word-addressed. A word is 4 bytes, so a byte offset of 8 is equivalent to a word offset of 2.