Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using any high-level programming language of your choice, develop a programme to test the working of Branch prediction technique, which is used in Computer
Using any high-level programming language of your choice, develop a programme to test the working of "Branch prediction" technique, which is used in Computer Engineering to improve performance. In developing this program, it is suggested that you consider the following possibilities: [1] Write a main program that has at least ten different executable branches. The executed branch should be determined by a value of a global variable, say, myBranchNumber. [2] For the ten branches suggested in [1] above, ensure that they have comparable computations. [3] Apart from the ten branches in [1], the main program should have at least thirty (30) sequentially executed instructions. [4] Write a function that generates random numbers within a reasonable range and update the global variable as suggested in [1]. [5] There should be a function which keeps track of the time taken to complete N runs of the program. This function should store in a file the record of predicted and executed branches as well as the time to complete the N runs. Question 2 (Performance measure) Using your programs developed in question 1 above, perform the following tests: [1] Run the program for N runs with the prediction functionality disabled and determine time taken to complete the runs. [2] Re-run the program with the branch prediction enabled and determine time taken to complete the runs. "Adjust" the branch prediction accuracy and determine its effect on the speed of execution. [3] Report on your findings. Using any high-level programming language of your choice, develop a programme to test the working of "Branch prediction" technique, which is used in Computer Engineering to improve performance. In developing this program, it is suggested that you consider the following possibilities: [1] Write a main program that has at least ten different executable branches. The executed branch should be determined by a value of a global variable, say, myBranchNumber. [2] For the ten branches suggested in [1] above, ensure that they have comparable computations. [3] Apart from the ten branches in [1], the main program should have at least thirty (30) sequentially executed instructions. [4] Write a function that generates random numbers within a reasonable range and update the global variable as suggested in [1]. [5] There should be a function which keeps track of the time taken to complete N runs of the program. This function should store in a file the record of predicted and executed branches as well as the time to complete the N runs. Question 2 (Performance measure) Using your programs developed in question 1 above, perform the following tests: [1] Run the program for N runs with the prediction functionality disabled and determine time taken to complete the runs. [2] Re-run the program with the branch prediction enabled and determine time taken to complete the runs. "Adjust" the branch prediction accuracy and determine its effect on the speed of execution. [3] Report on your findings.
Step by Step Solution
★★★★★
3.37 Rating (150 Votes )
There are 3 Steps involved in it
Step: 1
int randomint branch...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