3. (15 pts.) Consider the following fragment of C code: for (i=0; i<=100; i=i+1) a [i] = b[i] + c; Assume that a and b are arrays of words and that the base address of a is in $a0 and the base address of b is in $a1. Register $t0 is associated with variable I and register $50 with the value of c. You may also assume that any address constants you need are available to be loaded from memory. (1) (10 pts.) Write the code for MIPS. (2) (5 pts.) How many instructions are executed during the running of this code if there are no array out-of-bounds exceptions thrown? (3) How many memory data references will be made during execution?
3. (15 pts.) Consider the following fragment of C code: for (i=0; i<=100; i=i+1) a [i] = b[i] + c; Assume that a and b are arrays of words and that the base address of a is in $a0 and the base address of b is in $a1. Register $t0 is associated with variable I and register $50 with the value of c. You may also assume that any address constants you need are available to be loaded from memory. (1) (10 pts.) Write the code for MIPS. (2) (5 pts.) How many instructions are executed during the running of this code if there are no array out-of-bounds exceptions thrown? (3) How many memory data references will be made during execution?
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section10.1: Addresses And Pointers
Problem 9E
Related questions
Question
![3. (15 pts.) Consider the following fragment of C code:
for (i=0; i<=100; i=i+1)
a [i] = b[i] + c;
Assume that a and b are arrays of words and that the base address of a is in $a0 and
the base address of b is in $a1. Register $t0 is associated with variable I and register
$50 with the value of c. You may also assume that any address constants you need are
available to be loaded from memory.
(1) (10 pts.) Write the code for MIPS.
(2) (5 pts.) How many instructions are executed during the running of this code if
there are no array out-of-bounds exceptions thrown?
(3) How many memory data references will be made during execution?](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F512a3831-9ca9-4c42-8f52-54630bc21cac%2Fc7094a9e-de9d-47a5-8da6-a785576c3aca%2Fqb38tdo_processed.png&w=3840&q=75)
Transcribed Image Text:3. (15 pts.) Consider the following fragment of C code:
for (i=0; i<=100; i=i+1)
a [i] = b[i] + c;
Assume that a and b are arrays of words and that the base address of a is in $a0 and
the base address of b is in $a1. Register $t0 is associated with variable I and register
$50 with the value of c. You may also assume that any address constants you need are
available to be loaded from memory.
(1) (10 pts.) Write the code for MIPS.
(2) (5 pts.) How many instructions are executed during the running of this code if
there are no array out-of-bounds exceptions thrown?
(3) How many memory data references will be made during execution?
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning