Write a program in any high level programming language to calculate the misprediction and successful prediction rates for each technique and print out the results.
Write a program in any high level programming language to perform the following:
1. Read a text file containing a sequence of branches, for each branch, predict the branch to be taken based on the three branch prediction techniques:
a. Static – Predict Taken
b. Static – Predict Not Taken
c. Dynamic Branch Prediction 1
6-state scheme where change prediction only if get misprediction three times
2. For each branch prediction, increment a branch prediction stall counter according to the following:
Prediction Correct Prediction Incorrect
Predict Taken 0 2
Predict Not Taken 0 3
3. Calculate the misprediction and successful prediction rates for each technique and print out the results. Also print a report on total cycles added to each program’s execution due to control hazards.
A sample output for dynamic branch prediction technique is shown below:
Dynamic Branch Prediction
Read 80 points
40 successes in 80 branches => 50% success rate
Total number of branch hazard cycles: xxx
Run the program for the three attached input files and collect the program outputs in a Word file. Also in your file answer the following:
1. What technique gives the best performance for a single test case? Why?
2. What technique gives the worst performance for a single test case? Why?
3. What technique gives the best performance ON THE AVERAGE for a all test cases? Why?
