Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3.3 Compile the following code snippet in MIPS assembly using instructions from Table 3.3, with the dynamic mix shown in Table 3.27: Table 3.27 Dynamic

image text in transcribed

3.3 Compile the following code snippet in MIPS assembly using instructions from Table 3.3, with the dynamic mix shown in Table 3.27: Table 3.27 Dynamic instruction mix Instructions Frequency Cycles Arithmetic/logic Loads Stores Branches (untaken) Branches (taken) Miscellancous 40% 25% 10% 8% 12% 3% S = 0; for (1-0; i 100: i++) S = S + A[i] ; Array Ali] is made of 1004-byte integers stored in increasing memory addresses and A is stored at memory address 1000. You can allocate registers as you wish except for the following restrictions. (a) First assume that no variable (including i) is allocated to register by the compiler across the loop, i.c., all variables are loaded (filled) from and stored (spilled) to memory whenever necessary. Write the code and estimate the execution time given the time taken by each class of instruction in Table 3.27 (b) Second, assume that both S and i are allocated to registers during the entirety of the loop. At first they are loaded in registers and initialized. Then, at the end of the loop the registers are spilled to memory. Other memory values are loaded in register as needed. Write the code and estimate the execution time given the time taken by each class of instruction in Table 3.27 3.3 Compile the following code snippet in MIPS assembly using instructions from Table 3.3, with the dynamic mix shown in Table 3.27: Table 3.27 Dynamic instruction mix Instructions Frequency Cycles Arithmetic/logic Loads Stores Branches (untaken) Branches (taken) Miscellancous 40% 25% 10% 8% 12% 3% S = 0; for (1-0; i 100: i++) S = S + A[i] ; Array Ali] is made of 1004-byte integers stored in increasing memory addresses and A is stored at memory address 1000. You can allocate registers as you wish except for the following restrictions. (a) First assume that no variable (including i) is allocated to register by the compiler across the loop, i.c., all variables are loaded (filled) from and stored (spilled) to memory whenever necessary. Write the code and estimate the execution time given the time taken by each class of instruction in Table 3.27 (b) Second, assume that both S and i are allocated to registers during the entirety of the loop. At first they are loaded in registers and initialized. Then, at the end of the loop the registers are spilled to memory. Other memory values are loaded in register as needed. Write the code and estimate the execution time given the time taken by each class of instruction in Table 3.27

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building The Data Warehouse

Authors: W. H. Inmon

4th Edition

0764599445, 978-0764599446

More Books

Students also viewed these Databases questions

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago

Question

What do you mean by underwriting of shares ?

Answered: 1 week ago

Question

Define "Rights Issue".

Answered: 1 week ago

Question

Challenges Facing Todays Organizations?

Answered: 1 week ago