Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8863303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:56:37+00:00 2026-06-14T15:56:37+00:00

I got an project to convert 2-bit branch predictor in ‘SimpleScalar’ to 8-bit branch

  • 0

I got an project to convert 2-bit branch predictor in ‘SimpleScalar’ to 8-bit branch predictor. Which means I need to change the source code of 2-bit predicor from ‘SimpleScalar’ and make it work like a 8-bit predictor.

I know how predictors work but I do not know how to implement a branch predictor using c language. Recommend me some implementation of 8-bit brach predictor.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:56:39+00:00Added an answer on June 14, 2026 at 3:56 pm

    This set of slides does a good job of describing 2-bit branch prediction. Extending this to 8-bit (I assume) means that we are allowed a state machine of 256 states rather then 4 in the 2 bit case to decide what is going on. If we extend the 4 state case in the logical way, there will be 128 states where we predict the branch will be taken and 128 where it’s not taken…a kind of hysteresis.

    I am supposing you are programming inside a processor emulator or simulator. You didn’t say. The C code only has to keep track of the last 128 decisions made and only switch to the alternate prediction if 128 guesses were wrong:

    static int stickiness = 128;          // assume 128 states of knowledge that the default branch will occur
    static int predicted_branch = 1;      // default prediction is (say) branch taken
    
    if (simulated_branch_condition_is_true != predicted_branch) {
      if (--stickiness <= 0) {
        predicted_branch = simulated_branch_condition_is_true;
        stickiness = 128;
      }
    }
    // Now simulate the predicted_branch. If it's wrong, we will later simulate a pipeline, flush etc.
    

    Without more information, this is the best I can do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a project with 49 source files that I'm trying to convert to
I got the source of an older project and have to change little things
I have been assigned to Convert a VB.NET project to C# and I got
I've got a project which has a manifest file (which includes a version number),
I've got a project that I'm trying to convert to F#, with a fair
I've got to convert a not terribly complicated bespoke project management system from MsAccess
I am trying to convert my model-first project to code-first, as I can see
I got a C++ dll which has to be integrated in a C# project.
I've got simple java-based ppt->swf sub-project that basically works. The open source software out
I've got some code to convert a large (many gigabytes) XML file into another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.