logo

Crowdly

Browser

Додати до Chrome

Consider the following MIPS assembly code which implements a FOR loop to find t...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Consider the following MIPS assembly code which implements a FOR loop to find the sum of all the elements of an array of 10 integers, of which the base address is loaded in register $a0. The address of each instruction is mentioned next to the respective instruction.

Instruction Address 

Instruction 

0x80010014

addi $t0, $zero, 10

0x80010018 

li $t1, 0

0x8001001C

li $v0, 0

0x80010020 

loop: beq $t0, $t1, exit

0x80010024 

lw $t2, 0($a0)

0x80010028 

add $v0, $v0, $t2

0x8001002C

addi $t1, $t1, 1

0x80010030

addi $a0, $a0, 4 

0x80010034

 j loop

0x80010038

exit: addi $a0, $a0, -40

Convert the following MIPS instructions in the code above into machine code. Write your answers clearly in the boxes provided. Note that Bit 31 is the most significant bit and Bit 0 is the least significant bit of the machine code representing the instruction.

(a) beq $t0, $t1, exit

31

30

29

28

27

26

25

24

23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

 

(b) j loop

31

30

29

28

27

26

25

24

23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на learning.monash.edu?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome