subject

Objective:

To write a C program that calculates the average CPI, total processing 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 rate (frequency) of a particular machine.

Inputs:

Number of instruction classes (types)

CPI of each type of instruction

Total instruction count of each type of instruction

Clock rate of machine (MHz)

Output:

Table of parameters

Table of performance (Average CPI, CPU time (ms), MIPS)

Specification:

The program calculates the output based on choosing from a menu of choices, where each choice calls the appropriate procedure, where the choices are:

1) Enter parameters

2) Print table of parameters

3) Print table of performance

4) Quit

Notes:

Make sure all calculations are displayed truncated to 2 decimal fractional places, using the format "%.2f" in the printf statements.

Be sure that execution time is measured in milliseconds (msec).

To typecast an int x to a float y, use y = (float)x orsimply y = 1.0*x

To create proper spacing, use "\t" to tab.

Feel free to use the template "skeleton" code provided {beware: it might not compile correctly until modified appropriately}

#include
#include

/* NOTE: throughout the code, change the name of each procedure or function to something else in order to compile */

/* declare global var's */

//
/* define functions to calculate average cpi, cpu time, and mips */

float "FUNCTION TO CALCULATE AVERAGE CPI"()
{

/* declare local var's, calculate and return average cpi */

}

float "FUNCTION TO CALCULATE CPU TIME"()
{

/* declare local var's, calculate and return cpu time */

}

float "FUNCTION TO CALCULATE MIPS"()
{

/* declare local var's, calculate and return mips */

}

//
void "OPTION #1"()
{

/* declare local var's */

/* Prompt for number of instruction classes and frequency of machine */

/* allocate memory for dynamic arrays for cpi and instruction count */

/* for each instruction class, prompt for CPI and instruction count */
/* update total number of instructions and cycles */

}

//
void "OPTION #2"()
{

/* declare local var's */

/* print table of parameters inputed from OPTION #1, with each row containing the class number, the CPI of the class, and the instruction count of the class, following the sample output on the handout */

}

//
void "OPTION #3"()
{

/* declare local var's */

/* print table of calculations, including the average CPI, the CPU time, and the MIPS */

}

//
int main()
{

/* declare local var's */

/* until user chooses "4", loop */

/* print out menu list */

/* prompt for selection & choose appropriate procedure using either a case statement of if-else if-else statements */

}

Sample Input/Output

Performance assessment:



1) Enter parameters

2) Print table of parameters

3) Print table of performance

4) Quit

Enter selection: 1

Enter the number of instruction classes: 3

Enter the frequency of the machine (MHz): 200

Enter CPI of class 1: 2

Enter instruction count of class 1 (millions): 3

Enter CPI of class 2: 4

Enter instruction count of class 2 (millions): 5

Enter CPI of class 3: 6

Enter instruction count of class 3 (millions): 7

Performance assessment:



1) Enter parameters

2) Print table of parameters

3) Print table of performance

4) Quit

Enter selection: 2



|Class |CPI |Count |



|1 |2 |3 |



|2 |4 |5 |



|3 |6 |7 |



Performance assessment:



1) Enter parameters

2) Print table of parameters

3) Print table of performance

4) Quit

Enter selection: 3



|Performance |Value |



|Average CPI |4.53 |



|CPU Time (ms) |340.00 |



|MIPS |44.12 |



Performance assessment:



1) Enter parameters

2) Print table of parameters

3) Print table of performance

4) Quit

Enter selection: 4

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 10:00
How do i delete my account on this because i didn't read this agreements and also i put age at xd
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Brian wants to conduct an online search with a certain phrase. he intends to use the words books that belong to the 1800s in his search. how should he use the word that in his search?
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
Develop the program incrementally: a) start by reading and displaying each line of the input file to make sure you are reading the data set correctly. b) use the split string method to extract information from each line into a list. print the list to prove that this step is working correctly. d) convert the exam scores to type int and calculate the student’s average. display those items to prove this step is working correctly. e) create a tuple containing the six items for each student (name, exam scores, exam mean). display the tuples to prove this step is working correctly. (optionally, you may want to have the exam scores in a list so your tuple is (name, scores_list, f) append each tuple to a list. display the list to prove this step is working correctly. g) use the sort list method to re-order the tuples in the list. display the list to prove this step is working correctly. h) use a for statement to display the contents of the list as a table (with appropriate formatting). i) use a for statement to calculate the average of all scores on exam #1, then display the results. note that you could have calculated this average within the first loop, but we are explicitly requiring you to do this calculation by looping though your list of tuples. j) add the logic to calculate the average of all scores on exam #2, then display the results.
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
Looking at the electroscope, describe how you can cause the two leaves at the bottom to repel each other and stay that way
Answers: 3
You know the right answer?
Objective:

To write a C program that calculates the average CPI, total processing time,...
Questions
question
Mathematics, 16.06.2020 23:57
question
Mathematics, 16.06.2020 23:57
question
Mathematics, 16.06.2020 23:57
question
Chemistry, 16.06.2020 23:57
question
Mathematics, 16.06.2020 23:57