Coder Social home page Coder Social logo

branch-prediction-simulator's Introduction

Branch Prediction Simulator

This project implements a branch direction predictor that is used in CPU designs to predict the taken or not-taken behaviour of the branch. The simulator is capable of simulating 2bc Saturing Counter Predictor, 1-bit Bimodal Predictor and Gshare Branch History Predictor.

The simulator uses unordered maps data structure in C++ to mimic the cache behaviour and provides O(1) search times.

The simulator tests the branch prediction implementation against 3 workloads: test_br.ctrace, house.ctrace, wireframe.ctrace using the custom feeder program which reads the aforementioned files, extracts the PC, read the instruction and decides if the PC is a branch or not, and feeds the data to predictors.

Since, my simulator knows if the PC is a branch or not, the predictor in the original CPU hardware will sit at the decode stage. Additionally, predictors can be simulated in future by adding BTB and whether it's a branch or not to the program.

Steps to run the Simulator

The Makefile has commands for all three simulators with each having backward compatibility, so 2bc compiles bimodal as well and gshare compiles everything.

  1. Clean Command
make CleanGshare
  1. Compile Command
make gshare
  1. Output Command
./gshare > output.txt

branch-prediction-simulator's People

Contributors

prateekbashista avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.