Develop a program C++ that accepts the name of a branch trace file as a command line argument.  Use the data to simulate 4 branch prediction algorithms: Fixed-False predictor "Static-First" predictor makes its first prediction false (predicting the branch will not be taken) Bimodal dynamic predictor begins in the state that will predict false but not confidently (assumes the previous prediction was an error) Two-layered dynamic predictor uses a 2-bit history to index its prediction table and sets the Prediction:ErrCount bits to 0:1, 1:1, 0:1, and 1:1 for the histories 00, 01, 10, and 11, respectively and an initial history of two branches not taken.   Your program (say it's a compiled C program) would be run like this: ./branch data.tra Trace File The trace file is line based where each line represents the history of a single branch instruction in memory.  Each line will be a long string of '@' or '.' characters (indicating the branch was taken or not, respectively) without whitespace.  Run each of the 4 algorithms on each line of data, being sure to reset the start conditions of the last 3 algorithms, and track how many total times the branches were encountered and how many of those times each of the 4 predictors was correct. Program output When finished analyzing the trace data for each of the prediction algorithms over the entire input file, your program should print each predictor's success ratio (the total number of correct predictions / the total branch count). The output should be formatted EXACTLY as below with only the numbers varying.  Please note the total number of branches in my test trace may exceed the capacity of a signed 32-bit value, so choose your data types wisely… for example, you could use "uint64_t" or "long long". Example proper output would be (I made up the numbers): Fixed-F: 123456 / 234567 StaticF: 187654 / 234567 Bimodal: 214365 / 234567 2-Layer: 223344 / 234567   The attached example trace file is the branch history of compiling my solution C++ program for this assignment with clang++.  The exact output my solution gives for that trace file follows...   Fixed-F: 5669407/9297776StaticF: 8739705/9297776Bimodal: 9106285/92977762-Layer: 9132533/9297776

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

Develop a program C++ that accepts the name of a branch trace file as a command line argument.  Use the data to simulate 4 branch prediction algorithms:

  1. Fixed-False predictor

  2. "Static-First" predictor makes its first prediction false (predicting the branch will not be taken)

  3. Bimodal dynamic predictor begins in the state that will predict false but not confidently (assumes the previous prediction was an error)

  4. Two-layered dynamic predictor uses a 2-bit history to index its prediction table and sets the Prediction:ErrCount bits to 0:1, 1:1, 0:1, and 1:1 for the histories 00, 01, 10, and 11, respectively and an initial history of two branches not taken.

 

Your program (say it's a compiled C program) would be run like this:

./branch data.tra

Trace File

The trace file is line based where each line represents the history of a single branch instruction in memory.  Each line will be a long string of '@' or '.' characters (indicating the branch was taken or not, respectively) without whitespace.  Run each of the 4 algorithms on each line of data, being sure to reset the start conditions of the last 3 algorithms, and track how many total times the branches were encountered and how many of those times each of the 4 predictors was correct.

Program output

When finished analyzing the trace data for each of the prediction algorithms over the entire input file, your program should print each predictor's success ratio (the total number of correct predictions / the total branch count). The output should be formatted EXACTLY as below with only the numbers varying.  Please note the total number of branches in my test trace may exceed the capacity of a signed 32-bit value, so choose your data types wisely… for example, you could use "uint64_t" or "long long". Example proper output would be (I made up the numbers):

Fixed-F: 123456 / 234567

StaticF: 187654 / 234567

Bimodal: 214365 / 234567

2-Layer: 223344 / 234567

 

The attached example trace file is the branch history of compiling my solution C++ program for this assignment with clang++.  The exact output my solution gives for that trace file follows...

 

Fixed-F: 5669407/9297776
StaticF: 8739705/9297776
Bimodal: 9106285/9297776
2-Layer: 9132533/9297776
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,