Question: Objective: Write C code to calculate the performance of a program with dependent arithmetic instructions on a 5 - stage pipeline architecture. The five stages

Objective:
Write C code to calculate the performance of a program with dependent arithmetic instructions
on a 5-stage pipeline architecture. The five stages are: Instruction Fetch (IF), Instruction Decode
(ID), Execution (Ex), Memory access (ME), and Write-Back (WB)
Inputs:
* Number of instructions in the program
* Set of instructions
Outputs:
* A chart of the pipelined stages of the instructions
* The total cycle count for the program
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:
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
You can use any editor an(d)/(o)r compiler, but make sure your code compiles and executes under the gcc compiler in the Unix environment.
Example:
$ a.out
Performance assessment:
-----------------------
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Enter selection: 1
Enter the number of instructions: 4
R0=R1+R2
R3=R1- R4
R2=R0+R3
R0=R2+R3
Performance assessment:
-----------------------
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Enter selection: 2
|IF |ID |EX |ME |WB |
|IF |ID |EX |ME |WB |
|IF |ID |EX |ME |WB |
|IF |ID |EX |ME |WB |
Performance assessment:
-----------------------
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Enter selection: 3
The total cycle count for the program is 8
Performance assessment:
-----------------------
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Enter selection: 4
Objective:
Write C code to calculate the performance of a program with dependent arithmetic instructions
on a 5-stage pipeline architecture. The five stages are: Instruction Fetch (IF), Instruction Decode
(ID), Execution (Ex), Memory access (ME), and Write-Back (WB)
Inputs:
Number of instructions in the program
Set of instructions
Outputs:
A chart of the pipelined stages of the instructions
The total cycle count for the program
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:
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Example:
$ a.out
Performance assessment:
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Enter selection: 1
Enter the number of instructions: 4
R0=R1+R2
R3=R1-R4
R2=R0+R3
RO=R2+R3
Performance assessment:
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Enter selection: 2
|IF |ID |EX |ME |WB |
|IF |ID |EX |ME |WB
|IF |ID |EX |ME |WB |
|IF |ID |EX |ME |WB |
Performance assessment:
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Enter selection: 3
The total cycle count for the program is 8
Performance assessment:
Enter instructions
Print a chart of the pipelined stages of the instructions
Print the total cycle count for the program
Quit
Enter selection: 4
Objective: Write C code to calculate the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!