I need help with C++ this is my midterm...please help me 1. Given a program with
ID: 3620905 • Letter: I
Question
I need help with C++this is my midterm...please help me
1. Given a program with 10 6 instructions and the implementation below,
a. What's the CPU time?
b. What's the global CPI?
c. Give two options for improving the CPU performance by 25%.
Clock Rate: 2.0GHZ
Class A: 20%, CPI 2
Class B: 30%, CPI 1
Class C: 10%, CPI 3
Class D: 20%, CPI 4
Class E: 20%, CPI 5
2. Translate the C instructions below to MIPS instructions. Assume that variables i and j are assigned to registers $s0 and $s1 and the base addresses for arrays A, B and C are in registers $s5, $s6 and $s7 respectively.
i = 0;
while (i < 10)
{
j = 0;
while (j <= i)
{
A[i] = A[i] + B[C[j]];
j = j + 1;
}
i = i + 1;
}
3. Translate the MIPS instructions below to machine code.
a. add $t1,$t2,$t3
b. sll $s2,$s3,5
c. sw $s5,40($s6)
d. lui $t5,50
e. beq $t1,$t2,50
4. Translate the recursive procedure below to MIPS instructions.
int sum (int n)
{
if (n < 1)
return 1;
else
return (n + sum (n-1));
}
Answer
Question 4 answers
Explanation / Answer
Dear, 3. a. Adds values at register$t2,$t3 and stores in $t1 b.shifts C number of bits to the left (multiplies by 2 power Constant=2 power 5) $s2 = $s3Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.