@@ -2209,8 +2209,9 @@ enum cache_request_status data_cache::rd_hit_base_l1d(
22092209 // l1d_prediction_table[mf->get_pc()%256]--;
22102210 // //fprintf(stdout,"HIT Time: %d PC: %d Value: %d\n", time, storedhashedPC, l1d_prediction_table[storedhashedPC]);
22112211 // }
2212- printf (" CWPENG: PC:%d hit, update table[%d] to %d, ptr:%p\n " , mf->get_pc ()%256 , storedhashedPC, l1d_prediction_table[storedhashedPC], l1d_prediction_table) ;
2213- m_tag_array->set_hashed_pc_from_tag (addr, mf, (uint8_t ) mf->get_pc ()); // cwpeng
2212+ uint8_t hashed_pc = l1_cache::pc2hashed_pc (mf->get_pc ()) ;
2213+ printf (" CWPENG: PC:%d hit, update table[%d] to %d, ptr:%p\n " , hashed_pc, storedhashedPC, l1d_prediction_table[storedhashedPC], l1d_prediction_table) ;
2214+ m_tag_array->set_hashed_pc_from_tag (addr, mf, hashed_pc); // cwpeng
22142215
22152216 m_tag_array->access (block_addr, time, cache_index, mf);
22162217 // Atomics treated as global read/write requests - Perform read, mark line as
@@ -2285,7 +2286,7 @@ enum cache_request_status data_cache::rd_miss_base_l1d(
22852286 bool isBypassed = false ;
22862287 int threshold = 8 ; // From SDBP paper
22872288 // fprintf(stdout,"AISH, %s, %d\n",__func__, __LINE__);
2288- if (l1d_prediction_table[mf->get_pc () % 256 ] >= threshold){
2289+ if (l1d_prediction_table[l1_cache::pc2hashed_pc ( mf->get_pc ()) ] >= threshold){
22892290 isBypassed = true ;
22902291 }
22912292
@@ -2526,6 +2527,10 @@ enum cache_request_status l1_cache::access(new_addr_type addr, mem_fetch *mf,
25262527 return data_cache::access (addr, mf, time, events, l1_prediction_table);
25272528}
25282529
2530+ uint8_t l1_cache::pc2hashed_pc (new_addr_type addr){ // cwpeng PC -> 256bit hash PC translation
2531+ return (addr >> 2 ) % 256 ;
2532+ }
2533+
25292534// The l2 cache access function calls the base data_cache access
25302535// implementation. When the L2 needs to diverge from L1, L2 specific
25312536// changes should be made here.
0 commit comments