Esempio n. 1
0
void bpred_gshare_update(bpred *b, unsigned int pc, int pred_dir,
		int resolve_dir) {

	//update pht
	int pht_index = pc ^ b->ghr;
	pht_index = pht_index % (b->pht_entries);
	int pht_ctr = b->pht[pht_index];
	int new_pht_ctr;

	int branchPredMask = 1 << b->hist_len;
	//update ghr
	//bit shift ghr
	b->ghr = b->ghr << 1;
	//or with actually taken value (resolve_dir) to update ghr
	b->ghr = b->ghr | resolve_dir;
	//mask to keep correct value
	b->ghr = b->ghr % branchPredMask;

	if (resolve_dir == 1) {
		new_pht_ctr = BPRED_SAT_INC(pht_ctr, BPRED_PHT_CTR_MAX);
	} else {
		new_pht_ctr = BPRED_SAT_DEC(pht_ctr);
	}

	b->pht[pht_index] = new_pht_ctr;

	//update counters
	if (pred_dir == resolve_dir) {
		b->okpred = b->okpred + 1;
	} else {
		b->mispred = b->mispred + 1;
	}

}
Esempio n. 2
0
void  bpred_gshare_update(bpred *b, unsigned int pc,
                          int pred_dir, int resolve_dir)
{
    int pht_index = (pc ^ b->ghr) % (b->pht_entries);
    int pht_ctr = b->pht[pht_index];

    b->ghr = (((b->ghr)<<1) | resolve_dir);

    b->pht[pht_index] = resolve_dir ? BPRED_SAT_INC(pht_ctr,3) : BPRED_SAT_DEC(pht_ctr);
}
Esempio n. 3
0
void  bpred_bimodal_update(bpred *b, unsigned int pc, int pred_dir, int resolve_dir) {
  int pht_index = pc % (b->pht_entries);
  int pht_ctr = b->pht[pht_index];
  int new_pht_ctr;

  if(resolve_dir==1)
    new_pht_ctr = BPRED_SAT_INC(pht_ctr, BPRED_PHT_CTR_MAX);
  else
    new_pht_ctr = BPRED_SAT_DEC(pht_ctr);

  b->pht[pht_index] = new_pht_ctr;  
}
Esempio n. 4
0
void  bpred_gshare_update(bpred *b, unsigned int pc, int pred_dir, int resolve_dir, int thread_id){
  int pht_index = (pc^b->ghr[thread_id]) % (b->pht_entries);
  int pht_ctr = b->pht[pht_index];
  int new_pht_ctr;

  if(resolve_dir==1) {
    new_pht_ctr = BPRED_SAT_INC(pht_ctr, BPRED_PHT_CTR_MAX);
    b->ghr[thread_id] = (b->ghr[thread_id]<<1) | 0x00000001;
  }
  else {
    new_pht_ctr = BPRED_SAT_DEC(pht_ctr);
    b->ghr[thread_id] = (b->ghr[thread_id]<<1);
  }

  b->pht[pht_index] = new_pht_ctr;
}