How to change parameters in ChampSim simulator?

Viewed 237

I am new to c++ programming and computer architecture. I am trying to learn branch prediction using ChampSim simulator.(https://github.com/ChampSim/ChampSim)

However, I have no idea how to change the parameters in the program to do some simple simulations.

For example, for the bimodal predictor in ChampSim, how can I change the size of prediction tables?How can I change the branch history to 1-bit and do the simulation?

I also don't know how to change parameters like fetch-width(fetches how many instructions per cycle), decode-width, execute-width, commit-width, and ROB size.

If there is anybody who is familiar with ChamnpSim simulator and C++, please help me.

For example, it is the code for bimodal predictor:

#include "ooo_cpu.h"

#define BIMODAL_TABLE_SIZE 16384
#define BIMODAL_PRIME 16381
#define MAX_COUNTER 3
int bimodal_table[NUM_CPUS][BIMODAL_TABLE_SIZE];

void O3_CPU::initialize_branch_predictor()
{
    cout << "CPU " << cpu << " Bimodal branch predictor" << endl;

    for(int i = 0; i < BIMODAL_TABLE_SIZE; i++)
        bimodal_table[cpu][i] = 0;
}

uint8_t O3_CPU::predict_branch(uint64_t ip)
{
    uint32_t hash = ip % BIMODAL_PRIME;
    uint8_t prediction = (bimodal_table[cpu][hash] >= ((MAX_COUNTER + 1)/2)) ? 1 : 0;

    return prediction;
}

void O3_CPU::last_branch_result(uint64_t ip, uint8_t taken)
{
    uint32_t hash = ip % BIMODAL_PRIME;

    if (taken && (bimodal_table[cpu][hash] < MAX_COUNTER))
        bimodal_table[cpu][hash]++;
    else if ((taken == 0) && (bimodal_table[cpu][hash] > 0))
        bimodal_table[cpu][hash]--;
}

What should I do if I want to change the branch history to 1 bit and let the bimodal predictor to study prediction tables of 128 entries?

0 Answers
Related