Question: In C++ make a program with multiple classes that is a branch prediction simulator using 2-bit Smith counters (aka saturating counters). The input for your

In C++ make a program with multiple classes that is a branch prediction simulator using 2-bit Smith counters (aka saturating counters).

The input for your program should be from a file named "branch_trace.dat" which will be a text file. Each line of the file will represent a branch instruction. Each line will consist of an integer representing the address of the instruction, one or more blanks, and a single character either 'T' or 'N' indicating taken or not taken.

Note that I am assuming this is simulating a modern RISC machine and that every instruction starts on a word boundary; that is all the addresses will be multiples of 4. (i.e. the last 2 bits will always be 00)

You are allotted at most 100 bits for your simulator.

The structure for the basic Smith Counter Predictor is:

The output of your simulator should look like:

Number of branches: XXXX

Number of branches taken: XXXX

Number taken branches correctly predicted: XXXX

Number of branches not taken: XXXX

Number not taken branches correctly predicted: XXXX

Overall rate of correct predictions: YY.YY%

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 Databases Questions!