Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Sakai@UD le C++ Tutorial 7S-CISC 220 x ISO 260 Machine Organ Secure https:// sak

ID: 3839822 • Letter: S

Question

Sakai@UD le C++ Tutorial 7S-CISC 220 x ISO 260 Machine Organ Secure https:// sakai udel.edu/access/content/attachment/876b 1554-7dd4-4931-8019-8822ed9e19d5/Assignments/f2a60197-dc44-4248-b995-320cd5e17af6/cis260s17 hw6.pd Apps Facebook N Netflix YouTube a Amazon.com: Online e SakaieUD My work D CISC220 Data Struct Library Genesis ome I chegg.com 2 /2 CISC 260 Machine organization and Assembly Language Problem 2: 17 points For the following. questions. assume for a given processor the CPI of arithmetic instructions is 1, the CPI of load/store instructions is 10, and the CPI of branch instructions is 3. Assume a program has the following instruction breakdowns: 500 million arithmetic instructions 300 million load/store instructions, 100 million branch instructions a. Suppose that new, more powerful arithmetic instructions are added to the instruction set. On average, through the use of these more powerful arithmetic instructions, we can reduce the number of arithmetic instructions needed to execute a program by 25%, while increasing the clock cycle time by only 10%. Is this a good design choice? Why? b. Suppose that we find a way to double the performance of arithmetic instructions. What is the overall speedup of our machine? What if we find a way to improve the performance of arithmetic instructions by 10 Limes? Problem 3. [7 points] For the following questions, assume that for a given program 70% of the executed instructions are arithmetic, 10% are loadstone, and 20% are branch. a. iven this instruction mix and the assumption that an arithmetic instruction requires two cycles. a load/store instruction takes six cycles. and a branch instruction takes three cycles, find the average CPI b. For a 25% improvement in performance, how many cycles, on average, may an arithmetic instruction take ifload/store and branch instructions are not improved at c. For a 50% improvement in performance, how many cycles, on average may an arithmetic instruction take if loadstore and branch instructions are not improved at Problem 4. 4 points) Modify the following C code (from the midterm exa so that the recursion IS tail. Tecursion funct (int x) if x return 0 else if (x & 0x1) funct (x-1 return x else return x funct (x-1); Type here to search 5/15/2017

Explanation / Answer

Problem 2 --->

CPI of arthmetic instructions is 1
CPI of load/store instructions is 10
CPI of branch instructions is 3.

Instruction breakdowns are

500 million arithmetic instructions
300 million load/store instructions
100 million branch instructions

CPU Execution time = CPI * Number of Instructions / clock rate


= ((1*500 + 10*300 + 3*100) * 10^6) / clock rate

= (3800 * 10^6) / clock rate


a) program has reduced to 25% of 500 million arithmetic instructions, i.e

25% of 500 = (500*25)/100 =125
Now, 25% has reduced so, we have 500 - 125 = 375 million arithmetic instructions.

New execution time = ((1*375 + 10*300 + 3*100) * 10^6) + 10% of ((1*375 + 10*300 + 3*100) * 10^6) / clock rate
= (3675 + 367.5) * 10^6 / clock rate
= 4042.5 * 10^6 / clock rate

Here, execution time is increased so, it is good choice.


b)   

Performance of AI by 2 times

If CPI of arithmetic instructions = 0.5

New execution time = (((0.5)*500 + 10*300 + 3*100) * 10^6) / clock rate

= 3550 * 10^6 / clock rate

Speedup = Old execution time / New execution time
= (3800 * 10^6 / clock rate) / (3550 * 10^6 / clock rate)
= 3800 / 3550
= 1.07 (performance)

Performance of AI by 10 times

* If CPI of arithmetic instructions = 0.1

New execution time = (((0.1)*500 + 10*300 + 3*100) * 10^6) / clock rate

= 3350 * 10^6 / clock rate

Speedup = Old execution time / New execution time

= (3800 * 10^6 / clock rate) / (3350 * 10^6 / clock rate)

= 3800 / 3350

= 1.13 (performance)

Problem 3

Arthimetic instructions ---> 70%
Load/Store --> 10%
Branches --> 20%

a) Given ,

Operation |Frequency | Clock cycles

------------------------------------------------------

Arthimetic | 70% | 2
Load/Store | 10% | 6
Branches | 20% | 3

CPI (old) = 0.70 + 0.10 + 0.20 = 1
CPI (new) = (0.70 * 2) + (0.10 * 6) + (0.20 * 3)
= 1.4 + 0.6 + 0.6
= 2.6
CPI average = (1 + 2.6)/2 = (3.6)/2 = 1.8

b) We need to get 25% improvement in performance.

Assume, you have 100 operators : 70 Arthimatic, 10 Load/store and 20 Branches. You want to reduce the number of arthimatic instructions until you have only 75 operators left. Because their is no change in load/store and Branch instructions at all.

Now, How many arthimatic instructions do we have = 70 - 25 = 45 operators i.e, 45% ---> Arthimatic instructions has to be executed.

70% arithmetic instructions takes 2 cycles, now 45% arithmetic instructions takes (2/70)*45 = 1.285 cycles ,i.e, 1 complete cycle


c) We need to get 50% improvement in performance.

Assume, you have 100 operators : 70 Arthimatic, 10 Load/store and 20 Branches. You want to reduce the number of arthimatic instructions until you have only 50 operators left. Because their is no change in load/store and Branch instructions at all.

Now, How many arthimatic instructions do we have = 70 - 50 = 20 operators i.e, 20% ---> Arthimatic instructions has to be executed.

70% arithmetic instructions takes 2 cycles, now 20% arithmetic instructions takes (2/70)*20 = 0.571 cycles ,i.e, less than 1 complete cycle.

Problem 4

* Recursion uses more number of stack frames, to overcome this count we use tail recursion because it will use only one stack frame.

* In tail recursion their is nothing to do with return value.

//Tail recursion function

funct(int x,int a) {

if (x<=0) return a;
else if (x & 0x1)
funct(x-1,x+a); // Addition happens in the function call
else
funct(x-1,x-a); // Substration happens in the function call
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote