Question
C Programming Project. Any help would be greatly appreciated! Please use the skeleton code provided. Sample test run is given at the bottom. ---------------------------------------------------------------------------------- Objective:
C Programming Project. Any help would be greatly appreciated! Please use the skeleton code provided. Sample test run is given at the bottom.
----------------------------------------------------------------------------------
Objective: To calculate the average CPI, the execution time, and MIPS of a sequence of instructions, given the number of instruction classes, the CPI and total count of each instruction type, and the clock cycle rate (frequency) of a particular machine.
Inputs: Number of instructions classes (types) CPI each type of instruction Total count of each type of instruction (in billions) Clock rate of machine (GHz)
Output: Average CPI of the sequence of instructions Total CPU processing time (seconds) of the sequence of instructions MIPS of the sequence of instructions
#include
/* declare global var's, including total cycles,
total instruction count, and clock cycle rate */
/*********************************************************/
void "OPTION #1"()
{
/* declare local var's and initialize*/
/* prompt for # instruction classes & clock cycle rate of machine */
/* for each instruction class, prompt for CPI of class and instruction
count */
/* update values in appropriate glocal var's */
return;
}
/*********************************************************/
void "OPTION #2"()
{
/* declare local var's */
/* Calculate execution time and print result */
return;
}
/*********************************************************/
void "OPTION #3"()
{
/* declare local var's */
/* Calculate MIPS and print result */
return;
}
/*********************************************************/
void "OPTION #4"()
{
/* declare local var's */
/* Calculate average CPI and print result */
return;
}
/*********************************************************/
int main()
{
/* declare local var's */
/* until user chooses to quit, print menu,
select choice via switch statement and call appropriate function*/
return 1;
}
**Sample Test Run**
Measuring Performance:
----------------------
1) Enter parameters
2) Calculate Execution time of a sequence
3) Calculate MIPS of a sequence
4) Calculate average CPI of a sequence
5) Exit program Enter selection: 1
Enter the number of instruction classes: 3
Enter the frequency of the machine (GHz): 2.5
Enter CPI of class 1: 1
Enter instruction count of class 1 (billions): 6
Enter CPI of class 2: 3
Enter instruction count of class 2 (billions): 4
Enter CPI of class 3: 5
Enter instruction count of class 3 (billions): 2 Measuring Performance:
----------------------
1) Enter parameters
2) Calculate Execution time of a sequence
3) Calculate MIPS of a sequence
4) Calculate average CPI of a sequence
5) Exit program Enter selection: 2
The execution time of the sequence is: 11.20 sec Measuring Performance:
----------------------
1) Enter parameters
2) Calculate Execution time of a sequence
3) Calculate MIPS of a sequence
4) Calculate average CPI of a sequence
5) Exit program Enter selection: 3
The MIPS of the sequence is: 1071.43 Measuring Performance:
----------------------
1) Enter parameters
2) Calculate Execution time of a sequence
3) Calculate MIPS of a sequence
4) Calculate average CPI of a sequence
5) Exit program Enter selection: 4
The average CPI of the sequence is: 2.33 Measuring Performance:
----------------------
1) Enter parameters
2) Calculate Execution time of a sequence
3) Calculate MIPS of a sequence
4) Calculate average CPI of a sequence
5) Exit program Enter selection: 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started