CAN YOU SHOW ME THE STEPS HOW THE PREDICTION AND TRUE OUTCOME IS DONE? I NEED ST
ID: 3578579 • Letter: C
Question
CAN YOU SHOW ME THE STEPS HOW THE PREDICTION AND TRUE OUTCOME IS DONE? I NEED STEPS NOT THE DIRECT ANSWER PLEASE!
5. (12 Points) Branch Prediction Consider the pseudo code below. Using a 1-bit bimodal predictor, for each branch, keep track of the prediction and the true outcome in the tables below. Also, indicate what the prediction accuracies for each branch and for both. Assume, for each branch, the initial prediction is not- taken. Indicate a not-taken in the tables with a 0 and a taken with a 1. Show your work to receive full credit. while (1) Branch 1 for (i 0 i 5 i++) Do something Branch 2 for (j jExplanation / Answer
import java.util.*;
class Main
{
public static void main(String args[])
{
Scanner scr=new Scanner(System.in);
int stage,inst,br;
int cycle1,cycle2;
System.out.println("Enter num of stages ");
stage=scr.nextInt();
System.out.println("Enter num of instructions ");
inst=scr.nextInt();
System.out.println("Enter num of branch instructions ");
br=scr.nextInt();
cycle1=stage+(inst-1);
cycle2=cycle1+(br*(stage-1));
System.out.println("Num of cycles without branching= "+cycle1);
System.out.println("Num of cycles with branching= "+cycle2);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.