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

Sakai UD 7S-CISC26 x Me CISC 260 Machine org x D Lab7DrSeuss.pdf x f Facebook M

ID: 3840571 • Letter: S

Question

Sakai UD 7S-CISC26 x Me CISC 260 Machine org x D Lab7DrSeuss.pdf x f Facebook M Inbox (1,575) ttimauc x C Sakai OUD Le C++ Tuto x Secure https:// E Apps f Facebook N Netflix YouTube a Amazon.com: Online e Sakai UD: My work D CIsc220-Data Struct Library Genesis ome Ichegg.com 2 /2 CISC 260 Machine organization and Assembly Language performance of arithmetic instructions by 10 times? Problem 3.17 points] For the following questions, assume that for a given program 70% of the executed instructions are arithmetic. 10% are load/store, and 20% are branch. a. Given 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 if load/store and branch instructions are not improved at all? 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 exam) so that the recursion is tail- recursion. funct (int x) if (x 0) return 0 else if (x & 0x1) return x funct (x-1); else return x funct (x-1); Type here to search 009 PM 5/16/2017

Explanation / Answer

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