@@ -643,13 +643,13 @@ void tag_array::fill(new_addr_type addr, unsigned time, mem_fetch *mf, //on-fill
643643 uint8_t *l1d_prediction_table,uint8_t hashed_pc // cwpeng
644644 ) {
645645 fill (addr, time, mf->get_access_sector_mask (), mf->get_access_byte_mask (),
646- is_write, l1d_prediction_table, hashed_pc, mf->get_bypassBit ());
646+ is_write, l1d_prediction_table, hashed_pc, mf->get_bypassBit (), mf); // cwpeng mf for print PC
647647}
648648
649649void tag_array::fill (new_addr_type addr, unsigned time, // on-fill
650650 mem_access_sector_mask_t mask,
651651 mem_access_byte_mask_t byte_mask, bool is_write,
652- uint8_t *l1d_prediction_table,uint8_t hashed_pc, bool bypassBit
652+ uint8_t *l1d_prediction_table,uint8_t hashed_pc, bool bypassBit, mem_fetch *mf
653653 ) {
654654 // assert( m_config.m_alloc_policy == ON_FILL );
655655 unsigned idx;
@@ -675,13 +675,17 @@ void tag_array::fill(new_addr_type addr, unsigned time, //on-fill
675675 }
676676 if (isBypassed){
677677 if (bypassBit){
678- // printf("L2 indicate misprediction, bypassbit = 1\n") ;
678+ printf (" L2 indicate misprediction, bypassbit = 1, PC=%llx \n " , mf-> get_pc ()); ;
679679 // l1d_prediction_table[hashed_pc] = threshold-1 ;
680680 isBypassed = false ; // if L2 indicates misprediction, do not bypass
681+ l1_cache::inst_stats[hashed_pc].misprediction_time ++ ;
682+ }
683+ else {
684+ l1_cache::inst_stats[hashed_pc].no_misprediction_time ++ ;
681685 }
682686 }
683687
684- // isBypassed = false ;
688+ // isBypassed = false ; // For testing without bypass
685689
686690
687691 if (l1d_prediction_table[m_lines[idx]->m_hashed_pc ] < 15 && victim_valid && isBypassed==false ) // && m_tag_array->get_hashed_pc_from_tag(addr)->is_valid_line()) // AISH Saturating counter stays at 15
@@ -1587,6 +1591,7 @@ void baseline_cache::fill(mem_fetch *mf, unsigned time, uint8_t *l1d_prediction_
15871591
15881592 if (e->second .pending_read > 0 ) {
15891593 // wait for the other requests to come back
1594+ // printf("pending_read=%d\n", e->second.pending_read);
15901595 delete mf;
15911596 return ;
15921597 } else {
@@ -2645,16 +2650,17 @@ void l1_cache::print_prediction_table(FILE *fp, unsigned core_id) const {
26452650}
26462651
26472652void l1_cache::print_ldst_inst_stats (FILE *fp){
2648- fprintf (fp, " L1D Prediction Table State :\n " );
2653+ fprintf (fp, " L1D Prediction Table Stats :\n " );
26492654 for (unsigned i = 0 ; i < 256 ; i++){
2650- fprintf (fp, " HashPC:%3d: access time %8d, hit_rate:%1.5f, L2 access time:%7d, bypass_rate:%1.5f, occupy_l1_count:%8d, reuse_rate:%1.5f\n " ,
2655+ fprintf (fp, " HashPC:%3d: access time %8d, hit_rate:%1.5f, L2 access time:%7d, bypass_rate:%1.5f, occupy_l1_count:%8d, reuse_rate:%1.5f, mispredict_rate:%1.5f \n " ,
26512656 i,
26522657 inst_stats[i].access_time ,
26532658 inst_stats[i].get_hit_rate (),
26542659 inst_stats[i].get_l2_access_time (),
26552660 inst_stats[i].get_bypass_rate (),
26562661 inst_stats[i].no_reuse_time + inst_stats[i].reuse_time ,
2657- inst_stats[i].get_reuse_rate ()
2662+ inst_stats[i].get_reuse_rate (),
2663+ inst_stats[i].get_misprediction_rate ()
26582664 );
26592665 }
26602666 fprintf (fp, " ========================================================================\n " );
0 commit comments