System to simulate branch prediction algorithms
- C++
- C++ Compiler (Clang, G++, etc.)
- Clone the repo:
git clone https://github.com/Str-Josh/Financial-Derivatives-Strategy-Backtester.git - Change git remote url to avoid accidental pushes to main project
git remote set-url origin github_username/repo_namegit remote -v - Compile the following scripts:
g++ -c BranchPredictionSimulator.cppg++ -c TestPredictor.cppg++ -c main.cpp - Link the object files using the following:
g++ main.o BranchPredictionSimulator.o TestPredictor.o -o BranchPrediction - Execute the program. For example:
BranchPrediction --bpalg 1-bit --trace instruction_traces/trace1.txt
Lessons Learned:
- Implementation of 1-bit branch prediction algorithm
- CPU Instruction Execution Cycles
- File Management in C++
- Implementing command line arguments in C++
- Usage of smart pointers
Future Additions/Improvements:
- Modify the code to be able to operate on a microcontroller and to take actual instruction traces from the CPU