1. For this problem, assume that each instruction takes the same number of cycle
ID: 3876585 • Letter: 1
Question
1. For this problem, assume that each instruction takes the same number of cycles, and use the code listed below. mov Sr2, #4 jmp L1 Loop: mul Sr3, Sr3, $rl add $r4, $r4, $rl ld $r5, [Sr3] sub $r5, $r5, #5 add $r0, $r0, #1 bne SrO, Sr2, Loop mov Sr1, $r2 L1 : (a) [3 points] How many instructions does this program execute (there might be several iterations)? What is the total number of memory type instructions (load and store instructions)? What is the proportion of memory instructions? technology. What is the overall speedup for the entire program? same program with the new memory, what is the maximum possible theoretical overall speediup for this (b) [2 points] Assume we can get a 10x speedup for memory instructions by employing a new memory (c) [2 points] In the future, we can make the memory instructions as fast as we want. When we run the program?Explanation / Answer
Following are the answers to the question provided:
a.) Let TS be the total no of instructions executed so far. TS = 0 initially.
The first 3 instructions will be executed once (TS = 3 ). After that the control jumps to label L1.
Note that r0 contains 0 as the initial value as A XOR A = 0 . Also r2 = 4 has been set.
The Label L1 checks for the value of r0 and r2 . Now since , last statement of the label LOOP increments the
value of r0 by 1.
So it will take 4 cycles for the loop to execute. Hence TS = 3 + 4*6 = 27 .
Now, the label L1 executes 5 times ( 4 times for the loop and one more when r0 becomes 5 ) .
So TS = 27+5 = 32.
Finally the last statement will execute once finalising the answer to 33.
Hence , the instructions will execute 33 times in total.
As given load ( ld ) and store ( st ) are memory type instructions. So we have 2 memory type instructions.
Total Instructions are : 9 and memory type instructions are 2 , so ratio = 2/9
b.) Lets Assume x be the time taken by each instruction to execute. Then,
Originally, we have:
t1 = 33x ( 33 is the total no of instructions )
Also, 8 is total no of times memory instructions will executed. Hence, 33-8 = 25 are non memory instructions.
Given memory instructions are sped up 10 times, so x becomes x/10.
so,
t2 = 25x + 8(x)/10 = 25.8x
ratio = [ (33-25.8)x ] / [ 33x ] = 0.2181 = 21.81 %
c.) Here, assuming the factor of by 10 becomes infintely high. Hence :
t2 = 25x + 8x/(k) where k tends to infinity
t2 = 25x
ratio = (33x-25x)/33x = 0.24242 = 24.242%
Hence, the program will run approximately 24.24% faster.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.