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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education