Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment examine your basic understanding of CPU performance and MIPS Assembly. To cover these concepts, answer the bellow questions ( Q 1 - Q

This assignment examine your basic understanding of CPU performance and MIPS Assembly. To cover these concepts, answer the bellow questions (Q1-Q4):
Part 1. CPU Performance and Energy Efficiency Analysis (50 points)
Instructions:
Using the formulas provided in the course material in Week 1, answer the following questions. Show all your work and the steps leading to the final answer. After performing the calculations, provide a brief analysis of what the results indicate about the CPU's performance and energy efficiency.
Q1. CPU Performance Calculation (10 points):
Given a CPU with a clock frequency of 3 GHz and a CPI (Cycles Per Instruction) of 2.5, calculate the execution time for a program that has 5 million instructions.
Define the performance of this CPU in terms of instructions per second.
Q2. Clock Period and Frequency Relationship (10 points):
If the clock frequency of a CPU is doubled from 2 GHz to 4 GHz, explain how this affects the clock period. Calculate the new clock period.
Q3. Energy Efficiency Evaluation (15 points):
Consider a CPU that performs 2\times 109 operations and consumes 65 Watts of power. Calculate the CPU's operations per Watt using the given formula. Discuss what this value suggests about the CPU's energy efficiency.
Q4. Comparative Analysis (15 points):
Compare two CPUs where:
o CPU A has a clock rate of 2.5 GHz, CPI of 3, and performs 2\times 109 operations using 60 Watts.
o CPU B has a clock rate of 3.2 GHz, CPI of 2.8, and performs 1.2\times 109 operations using 75 Watts.
Calculate the CPU time for a program with 8 million instructions and the overall ssj_ops per Watt for both CPUs. Which CPU is more energy-efficient?
PART 2. MIPS Assembly Programming
Objective
This assignment aims to reinforce your understanding of MIPS assembly language and the use of various instructions in creating assembly programs. You are expected to demonstrate your ability to use arithmetic operations, control flow, logical operations, and procedure calls.
Instruction:
Task 1: C# Program
Study the following C# program bellow (also attached to the assignment) that performs the following operations:
Defines an array of integers with at least 10 elements.
Calculates the sum of the elements in the array.
Determines the difference between the largest and smallest elements in the array.
Implements a simple function that multiplies two numbers and returns the result.
Task 2: MIPS Assembly Translation (50 points)
Translate the C# program shown in Task 1 into MIPS assembly code. Your MIPS program mainly contains some of the instructions that you studied in your class such as add, sub, lw, sw, addi, bne, j, jal, beq, sll, srl, slt, slti, and jr.
Implement a leaf procedure to multiply two numbers.
Implement a non-leaf procedure that calls the leaf procedure and uses its result.
Include comments on each line to explain the MIPS assembly instructions used.
C# Code:
using System;
class Program
{
static void Main()
{
// Task 1: Define an array of integers with at least 10 elements.
int[] numbers ={1,3,5,7,9,2,4,6,8,10};
// Task 2: Calculate the sum of the elements in the array.
int sum = CalculateSum(numbers);
// Task 3: Determine the difference between the largest and smallest elements in the array.
int difference = FindMax(numbers)- FindMin(numbers);
// Task 4: Implement a simple function that multiplies two numbers and returns the result.
int product = Multiply(5,3);
// Output results to the console
Console.WriteLine("Sum of array elements: "+ sum);
Console.WriteLine("Difference between the largest and smallest elements: "+ difference);
Console.WriteLine("Product of 5 and 3: "+ product);
}
// Calculates the sum of an array of integers
static int CalculateSum(int[] array)
{
int sum =0;
for (int i =0; i < array.Length; i++)
{
sum += array[i];
}
return sum;
}
// Finds the maximum value in an array of integers
static int FindMax(int[] array)
{
int max = array[0];
for (int i =1; i < array.Length; i++)
{
if (array[i]> max)
{
max = array[i];
}
}
return max;
}
// Finds the minimum value in an array of integers
static int FindMin(int[] array)
{
int min = array[0];
for (int i =1; i < array.Length; i++)
{
if (array[i]< min)
{
min = array[i];
}
}
return min;
}
// Multiplies two integers and returns the result
static int Multiply(int a, int b)
{
return a * b;
}
}

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

I would have had to wait a long time for a reply.

Answered: 1 week ago

Question

Id already thrown away the receipt.

Answered: 1 week ago