17 Aug Simulate a simple branch predictor with a 2-bit saturating counter.(c++)
Please do not plagiarize.
Please see the detailed question in the attached.
You will have branchsimulator_skeleton.cpp config.txt makefile.txt trace.txt
In this lab, you will simulate a simple branch predictor with a 2-bit saturating counter. You are provided with a text file containing a trace of branch instructions consisting of the PC at which each branch occurs, and whether the branch is Taken or Not Taken.
Your goal is to write code to evaluate the performance of a 2-bit saturating counter based branch predictor on this trace. Your output file indicates, for each branch in the trace, whether it was predicted as Taken or Not Taken.
What to Submit
a) code
1. Your source code. On compilation, we should be able to execute your simulator with the following command
./branchsimulator.out config.txt trace.txt
Your simulator should output a file trace.txt.out in the same directory.
2. A Makefile that will compile the code. You must use a Makefile, any special instructions must be included in a readme.txt with instructions on how to compile your code (only if necessary, please keep it simple).
b)Analysis
Forr the provided trace.txt, plot a graph of the branch misprediction rate as a function of m with m varying from 10 to 20 in increments of 1.
Submit your plot as a PDF file in the same folder as your source code.
