Changeset 48


Ignore:
Timestamp:
Jun 13, 2010, 8:29:15 AM (14 years ago)
Author:
gao
Message:

Activity counter update

Location:
trunk/modules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_cc_vcache_wrapper2_v1/caba/source/include/vci_cc_vcache_wrapper2_v1.h

    r37 r48  
    440440
    441441    uint32_t m_cpt_frz_cycles;              // number of cycles where the cpu is frozen
    442     uint32_t m_cpt_total_cycles;                // total number of cycles
     442    uint32_t m_cpt_total_cycles;                // total number of cycles
     443    uint32_t m_cpt_dcache_frz_cycles;       // number of cycles where the data cache is frozen   
    443444
    444445    // Cache activity counters
     
    460461    uint32_t m_cpt_unc_transaction;         // number of VCI uncached read transactions
    461462    uint32_t m_cpt_write_transaction;       // number of VCI write transactions
     463    uint32_t m_cpt_icache_unc_transaction;
    462464
    463465    uint32_t m_cost_imiss_transaction;      // cumulated duration for VCI IMISS transactions
     
    465467    uint32_t m_cost_unc_transaction;        // cumulated duration for VCI UNC transactions
    466468    uint32_t m_cost_write_transaction;      // cumulated duration for VCI WRITE transactions
     469    uint32_t m_cost_icache_unc_transaction; // cumulated duration for VCI IUNC transactions   
    467470    uint32_t m_length_write_transaction;    // cumulated length for VCI WRITE transactions
    468471
     
    470473    uint32_t m_cpt_ins_tlb_read;            // number of instruction tlb read
    471474    uint32_t m_cpt_ins_tlb_miss;            // number of instruction tlb miss
    472     uint32_t m_cpt_ins_tlb_write_et;        // number of instruction tlb write ET
    473 
     475    uint32_t m_cpt_ins_tlb_update_acc;      // number of instruction tlb update acc
    474476    uint32_t m_cpt_data_tlb_read;           // number of data tlb read
    475477    uint32_t m_cpt_data_tlb_miss;           // number of data tlb miss
    476     uint32_t m_cpt_data_tlb_write_et;       // number of data tlb write ET
    477     uint32_t m_cpt_data_tlb_write_dirty;    // number of data tlb write dirty
     478    uint32_t m_cpt_data_tlb_update_acc;     // number of data tlb update acc
     479    uint32_t m_cpt_data_tlb_update_dirty;   // number of data tlb update dirty
     480    uint32_t m_cpt_ins_tlb_hit_dcache;      // number of instruction tlb hit in data cache
     481    uint32_t m_cpt_data_tlb_hit_dcache;     // number of data tlb hit in data cache
     482    uint32_t m_cpt_ins_tlb_occup_cache;     // number of instruction tlb occupy data cache line
     483    uint32_t m_cpt_data_tlb_occup_cache;    // number of data tlb occupy data cache line
     484    uint32_t m_cpt_tlb_occupy_dcache;
    478485   
    479486    uint32_t m_cost_ins_tlb_miss_frz;       // number of frozen cycles related to instruction tlb miss
    480487    uint32_t m_cost_data_tlb_miss_frz;      // number of frozen cycles related to data tlb miss
    481 
    482     uint32_t m_cost_ins_waste_wait_frz;     // number of frozen cycles related to ins wait coherence operate
    483     uint32_t m_cost_ins_tlb_sw_frz;         // number of frozen cycles related to ins context switch
    484     uint32_t m_cost_ins_cache_flush_frz;    // number of frozen cycles related to ins cache flush
    485 
    486     uint32_t m_cpt_ins_tlb_cleanup;         // number of ins tlb cleanup
    487     uint32_t m_cost_data_waste_wait_frz;    // number of frozen cycles related to data wait coherence operate
    488     uint32_t m_cost_data_tlb_sw_frz;        // number of frozen cycles related to data context switch
    489     uint32_t m_cost_data_cache_flush_frz;   // number of frozen cycles related to data cache flush
    490 
    491     uint32_t m_cpt_itlbmiss_transaction;    // number of itlb miss transactions
    492     uint32_t m_cpt_itlb_write_transaction;  // number of itlb write ET transactions
    493     uint32_t m_cpt_dtlbmiss_transaction;    // number of dtlb miss transactions
    494     uint32_t m_cpt_dtlb_write_transaction;  // number of dtlb write ET and dirty transactions
    495 
    496     uint32_t m_cost_itlbmiss_transaction;   // cumulated duration for VCI instruction TLB miss transactions
    497     uint32_t m_cost_itlb_write_transaction; // cumulated duration for VCI instruction TLB write ET transactions
    498     uint32_t m_cost_dtlbmiss_transaction;   // cumulated duration for VCI data TLB miss transactions
    499     uint32_t m_cost_dtlb_write_transaction; // cumulated duration for VCI data TLB write transactions
    500 
    501     uint32_t m_cpt_cc_update;               // number of coherence update packets
    502     uint32_t m_cpt_cc_inval;                // number of coherence inval packets
    503     uint32_t m_cpt_cc_broadcast;            // number of coherence broadcast packets
     488    uint32_t m_cost_ins_tlb_update_acc_frz;    // number of frozen cycles related to instruction tlb update acc
     489    uint32_t m_cost_data_tlb_update_acc_frz;   // number of frozen cycles related to data tlb update acc
     490    uint32_t m_cost_data_tlb_update_dirty_frz; // number of frozen cycles related to data tlb update dirty
     491    uint32_t m_cost_ins_tlb_occup_cache_frz;   // number of frozen cycles related to instruction tlb miss operate in dcache
     492    uint32_t m_cost_data_tlb_occup_cache_frz;  // number of frozen cycles related to data tlb miss operate in dcache
     493
     494    uint32_t m_cpt_itlbmiss_transaction;       // number of itlb miss transactions
     495    uint32_t m_cpt_itlb_ll_transaction;        // number of itlb ll acc transactions
     496    uint32_t m_cpt_itlb_sc_transaction;        // number of itlb sc acc transactions
     497    uint32_t m_cpt_dtlbmiss_transaction;       // number of dtlb miss transactions
     498    uint32_t m_cpt_dtlb_ll_transaction;        // number of dtlb ll acc transactions
     499    uint32_t m_cpt_dtlb_sc_transaction;        // number of dtlb sc acc transactions
     500    uint32_t m_cpt_dtlb_ll_dirty_transaction;  // number of dtlb ll dirty transactions
     501    uint32_t m_cpt_dtlb_sc_dirty_transaction;  // number of dtlb sc dirty transactions
     502
     503    uint32_t m_cost_itlbmiss_transaction;     // cumulated duration for VCI instruction TLB miss transactions
     504    uint32_t m_cost_itlb_ll_transaction;      // cumulated duration for VCI instruction TLB ll acc transactions
     505    uint32_t m_cost_itlb_sc_transaction;      // cumulated duration for VCI instruction TLB sc acc transactions
     506    uint32_t m_cost_dtlbmiss_transaction;     // cumulated duration for VCI data TLB miss transactions
     507    uint32_t m_cost_dtlb_ll_transaction;      // cumulated duration for VCI data TLB ll acc transactions
     508    uint32_t m_cost_dtlb_sc_transaction;      // cumulated duration for VCI data TLB sc acc transactions
     509    uint32_t m_cost_dtlb_ll_dirty_transaction;// cumulated duration for VCI data TLB ll dirty transactions
     510    uint32_t m_cost_dtlb_sc_dirty_transaction;// cumulated duration for VCI data TLB sc dirty transactions
     511
     512    uint32_t m_cpt_cc_update_data;              // number of coherence update data packets
     513    uint32_t m_cpt_cc_inval_ins;                // number of coherence inval instruction packets
     514    uint32_t m_cpt_cc_inval_data;               // number of coherence inval data packets
     515    uint32_t m_cpt_cc_broadcast;                // number of coherence broadcast packets
    504516
    505517    uint32_t m_cost_ins_tlb_inval_frz;      // number of frozen cycles related to checking ins tlb invalidate
  • trunk/modules/vci_cc_vcache_wrapper2_v1/caba/source/src/vci_cc_vcache_wrapper2_v1.cpp

    r37 r48  
    367367    float run_cycles = (float)(m_cpt_total_cycles - m_cpt_frz_cycles);
    368368    std::cout << name() << std::endl
    369               << "- CPI                    = " << (float)m_cpt_total_cycles/run_cycles << std::endl
    370               << "- READ RATE              = " << (float)m_cpt_read/run_cycles << std::endl
    371               << "- WRITE RATE             = " << (float)m_cpt_write/run_cycles << std::endl
    372               << "- UNCACHED READ RATE     = " << (float)m_cpt_unc_read/m_cpt_read << std::endl
    373               << "- CACHED WRITE RATE      = " << (float)m_cpt_write_cached/m_cpt_write << std::endl
    374               << "- IMISS_RATE             = " << (float)m_cpt_ins_miss/m_cpt_ins_read << std::endl   
    375               << "- DMISS RATE             = " << (float)m_cpt_data_miss/(m_cpt_read-m_cpt_unc_read) << std::endl
    376               << "- INS MISS COST          = " << (float)m_cost_ins_miss_frz/m_cpt_ins_miss << std::endl
    377               << "- IMISS TRANSACTION      = " << (float)m_cost_imiss_transaction/m_cpt_imiss_transaction << std::endl
    378               << "- DMISS COST             = " << (float)m_cost_data_miss_frz/m_cpt_data_miss << std::endl
    379               << "- DMISS TRANSACTION      = " << (float)m_cost_dmiss_transaction/m_cpt_dmiss_transaction << std::endl
    380               << "- UNC COST               = " << (float)m_cost_unc_read_frz/m_cpt_unc_read << std::endl
    381               << "- UNC TRANSACTION        = " << (float)m_cost_unc_transaction/m_cpt_unc_transaction << std::endl
    382               << "- WRITE COST             = " << (float)m_cost_write_frz/m_cpt_write << std::endl
    383               << "- WRITE TRANSACTION      = " << (float)m_cost_write_transaction/m_cpt_write_transaction << std::endl
    384               << "- WRITE LENGTH           = " << (float)m_length_write_transaction/m_cpt_write_transaction << std::endl
    385               << "- INS TLB MISS RATE      = " << (float)m_cpt_ins_tlb_miss/m_cpt_ins_tlb_read << std::endl
    386               << "- DATA TLB MISS RATE     = " << (float)m_cpt_data_tlb_miss/m_cpt_data_tlb_read << std::endl
    387               << "- ITLB MISS TRANSACTION  = " << (float)m_cost_itlbmiss_transaction/m_cpt_itlbmiss_transaction << std::endl
    388               << "- ITLB WRITE TRANSACTION = " << (float)m_cost_itlb_write_transaction/m_cpt_itlb_write_transaction << std::endl
    389               << "- ITLB MISS COST         = " << (float)m_cost_ins_tlb_miss_frz/(m_cpt_ins_tlb_miss+m_cpt_ins_tlb_write_et) << std::endl
    390               << "- DTLB MISS TRANSACTION  = " << (float)m_cost_dtlbmiss_transaction/m_cpt_dtlbmiss_transaction << std::endl
    391               << "- DTLB WRITE TRANSACTION = " << (float)m_cost_dtlb_write_transaction/m_cpt_dtlb_write_transaction << std::endl
    392               << "- DTLB MISS COST         = " << (float)m_cost_data_tlb_miss_frz/(m_cpt_data_tlb_miss+m_cpt_data_tlb_write_et+m_cpt_data_tlb_write_dirty) << std::endl;
     369        << "- CPI                    = " << (float)m_cpt_total_cycles/run_cycles << std::endl
     370        << "- READ RATE              = " << (float)m_cpt_read/run_cycles << std::endl
     371        << "- WRITE RATE             = " << (float)m_cpt_write/run_cycles << std::endl
     372        << "- IMISS_RATE             = " << (float)m_cpt_ins_miss/m_cpt_ins_read << std::endl
     373        << "- DMISS RATE             = " << (float)m_cpt_data_miss/(m_cpt_read-m_cpt_unc_read) << std::endl 
     374        << "- INS MISS COST          = " << (float)m_cost_ins_miss_frz/m_cpt_ins_miss << std::endl     
     375        << "- DATA MISS COST         = " << (float)m_cost_data_miss_frz/m_cpt_data_miss << std::endl
     376        << "- WRITE COST             = " << (float)m_cost_write_frz/m_cpt_write << std::endl       
     377        << "- UNC COST               = " << (float)m_cost_unc_read_frz/m_cpt_unc_read << std::endl
     378        << "- UNCACHED READ RATE     = " << (float)m_cpt_unc_read/m_cpt_read << std::endl
     379        << "- CACHED WRITE RATE      = " << (float)m_cpt_write_cached/m_cpt_write << std::endl
     380        << "- INS TLB MISS RATE      = " << (float)m_cpt_ins_tlb_miss/m_cpt_ins_tlb_read << std::endl
     381        << "- DATA TLB MISS RATE     = " << (float)m_cpt_data_tlb_miss/m_cpt_data_tlb_read << std::endl
     382        << "- ITLB MISS COST         = " << (float)m_cost_ins_tlb_miss_frz/m_cpt_ins_tlb_miss << std::endl
     383        << "- DTLB MISS COST         = " << (float)m_cost_data_tlb_miss_frz/m_cpt_data_tlb_miss << std::endl   
     384        << "- ITLB UPDATE ACC COST   = " << (float)m_cost_ins_tlb_update_acc_frz/m_cpt_ins_tlb_update_acc << std::endl
     385        << "- DTLB UPDATE ACC COST   = " << (float)m_cost_data_tlb_update_acc_frz/m_cpt_data_tlb_update_acc << std::endl
     386        << "- DTLB UPDATE DIRTY COST = " << (float)m_cost_data_tlb_update_dirty_frz/m_cpt_data_tlb_update_dirty << std::endl
     387        << "- ITLB HIT IN DCACHE RATE= " << (float)m_cpt_ins_tlb_hit_dcache/m_cpt_ins_tlb_miss << std::endl
     388        << "- DTLB HIT IN DCACHE RATE= " << (float)m_cpt_data_tlb_hit_dcache/m_cpt_data_tlb_miss << std::endl
     389        << "- DCACHE FROZEN BY TLB OP= " << (float)(m_cost_ins_tlb_occup_cache_frz+m_cost_data_tlb_occup_cache_frz)/m_cpt_dcache_frz_cycles << std::endl
     390        << "- DCACHE FOR TLB %       = " << (float)m_cpt_tlb_occup_dcache/(m_dcache_ways*m_dcache_sets) << std::endl
     391        << "- NB CC BROADCAST        = " << m_cpt_cc_broadcast << std::endl
     392        << "- NB CC UPDATE DATA      = " << m_cpt_cc_update_data << std::endl
     393        << "- NB CC INVAL DATA       = " << m_cpt_cc_inval_data << std::endl
     394        << "- NB CC INVAL INS        = " << m_cpt_cc_inval_ins << std::endl
     395        << "- NB CC CLEANUP DATA     = " << m_cpt_cc_cleanup_data << std::endl
     396        << "- NB CC CLEANUP INS      = " << m_cpt_cc_cleanup_ins << std::endl
     397        << "- IMISS TRANSACTION      = " << (float)m_cost_imiss_transaction/m_cpt_imiss_transaction << std::endl
     398        << "- DMISS TRANSACTION      = " << (float)m_cost_dmiss_transaction/m_cpt_dmiss_transaction << std::endl
     399        << "- UNC TRANSACTION        = " << (float)m_cost_unc_transaction/m_cpt_unc_transaction << std::endl
     400        << "- WRITE TRANSACTION      = " << (float)m_cost_write_transaction/m_cpt_write_transaction << std::endl
     401        << "- WRITE LENGTH           = " << (float)m_length_write_transaction/m_cpt_write_transaction << std::endl
     402        << "- ITLB MISS TRANSACTION  = " << (float)m_cost_itlbmiss_transaction/m_cpt_itlbmiss_transaction << std::endl
     403        << "- DTLB MISS TRANSACTION  = " << (float)m_cost_dtlbmiss_transaction/m_cpt_dtlbmiss_transaction << std::endl;
    393404}
    394405
     
    464475        r_dcache_dirty_save       = false;
    465476        r_dcache_hit_p_save       = false;
     477        r_dcache_cached_save      = false;
    466478
    467479        r_icache_buf_unc_valid    = false;
     
    527539        m_cpt_icache_dir_write  = 0;
    528540
    529         m_cpt_frz_cycles   = 0;
    530         m_cpt_total_cycles = 0;
     541        m_cpt_frz_cycles        = 0;
     542        m_cpt_dcache_frz_cycles = 0;
     543        m_cpt_total_cycles      = 0;
    531544
    532545        m_cpt_read         = 0;
     
    543556        m_cost_ins_miss_frz  = 0;
    544557
    545         m_cpt_imiss_transaction = 0;
    546         m_cpt_dmiss_transaction = 0;
    547         m_cpt_unc_transaction   = 0;
    548         m_cpt_write_transaction = 0;
    549 
    550         m_cost_imiss_transaction   = 0;
    551         m_cost_dmiss_transaction   = 0;
    552         m_cost_unc_transaction     = 0;
    553         m_cost_write_transaction   = 0;
    554         m_length_write_transaction = 0;
    555 
    556         m_cpt_ins_tlb_read         = 0;             
    557         m_cpt_ins_tlb_miss         = 0;             
    558         m_cpt_ins_tlb_write_et     = 0;         
    559 
    560         m_cpt_data_tlb_read        = 0;           
    561         m_cpt_data_tlb_miss        = 0;           
    562         m_cpt_data_tlb_write_et    = 0;       
    563         m_cpt_data_tlb_write_dirty = 0;   
    564 
    565         m_cost_ins_tlb_miss_frz    = 0;     
    566         m_cost_data_tlb_miss_frz   = 0;     
    567 
    568         m_cpt_itlbmiss_transaction   = 0;   
    569         m_cpt_itlb_write_transaction = 0; 
    570         m_cpt_dtlbmiss_transaction   = 0; 
    571         m_cpt_dtlb_write_transaction = 0; 
     558        m_cpt_imiss_transaction      = 0;
     559        m_cpt_dmiss_transaction      = 0;
     560        m_cpt_unc_transaction        = 0;
     561        m_cpt_write_transaction      = 0;
     562        m_cpt_icache_unc_transaction = 0;       
     563
     564        m_cost_imiss_transaction      = 0;
     565        m_cost_dmiss_transaction      = 0;
     566        m_cost_unc_transaction        = 0;
     567        m_cost_write_transaction      = 0;
     568        m_cost_icache_unc_transaction = 0;
     569        m_length_write_transaction    = 0;
     570
     571        m_cpt_ins_tlb_read       = 0;             
     572        m_cpt_ins_tlb_miss       = 0;             
     573        m_cpt_ins_tlb_update_acc = 0;         
     574
     575        m_cpt_data_tlb_read         = 0;           
     576        m_cpt_data_tlb_miss         = 0;           
     577        m_cpt_data_tlb_update_acc   = 0;       
     578        m_cpt_data_tlb_update_dirty = 0;   
     579        m_cpt_ins_tlb_hit_dcache    = 0;
     580        m_cpt_data_tlb_hit_dcache   = 0;
     581        m_cpt_ins_tlb_occup_cache   = 0;
     582        m_cpt_data_tlb_occup_cache  = 0;
     583
     584        m_cost_ins_tlb_miss_frz          = 0;     
     585        m_cost_data_tlb_miss_frz         = 0;     
     586        m_cost_ins_tlb_update_acc_frz    = 0;
     587        m_cost_data_tlb_update_acc_frz   = 0;
     588        m_cost_data_tlb_update_dirty_frz = 0;
     589        m_cost_ins_tlb_occup_cache_frz   = 0;
     590        m_cost_data_tlb_occup_cache_frz  = 0;
     591
     592        m_cpt_itlbmiss_transaction      = 0;   
     593        m_cpt_itlb_ll_transaction       = 0; 
     594        m_cpt_itlb_sc_transaction       = 0; 
     595        m_cpt_dtlbmiss_transaction      = 0; 
     596        m_cpt_dtlb_ll_transaction       = 0; 
     597        m_cpt_dtlb_sc_transaction       = 0; 
     598        m_cpt_dtlb_ll_dirty_transaction = 0; 
     599        m_cpt_dtlb_sc_dirty_transaction = 0; 
    572600 
    573         m_cost_itlbmiss_transaction   = 0;   
    574         m_cost_itlb_write_transaction = 0; 
    575         m_cost_dtlbmiss_transaction   = 0;   
    576         m_cost_dtlb_write_transaction = 0;   
     601        m_cost_itlbmiss_transaction      = 0;   
     602        m_cost_itlb_ll_transaction       = 0; 
     603        m_cost_itlb_sc_transaction       = 0; 
     604        m_cost_dtlbmiss_transaction      = 0;   
     605        m_cost_dtlb_ll_transaction       = 0;   
     606        m_cost_dtlb_sc_transaction       = 0;   
     607        m_cost_dtlb_ll_dirty_transaction = 0;   
     608        m_cost_dtlb_sc_dirty_transaction = 0;   
    577609        return;
    578610    }
     
    691723                    r_tgt_update = false;
    692724                    r_vci_tgt_fsm = TGT_REQ_DCACHE;
    693                     m_cpt_cc_inval++ ;
     725                    m_cpt_cc_inval_data++ ;
    694726                }
    695727                else if (cell == 4)                // update
     
    703735                    r_tgt_update = true;
    704736                    r_vci_tgt_fsm = TGT_UPDT_WORD;
    705                     m_cpt_cc_update++ ;
     737                    m_cpt_cc_update_data++ ;
    706738                }     
    707739                else if (cell == 8)
     
    715747                    r_tgt_update = false;
    716748                    r_vci_tgt_fsm = TGT_REQ_ICACHE;
    717                     m_cpt_cc_inval++ ;
     749                    m_cpt_cc_inval_ins++ ;
    718750
    719751                }
     
    948980        if ( r_tgt_icache_req )
    949981        {
    950             if ( ireq.valid ) m_cost_ins_waste_wait_frz++;
    951982            r_icache_fsm = ICACHE_CC_INVAL;
    952983            r_icache_fsm_save = r_icache_fsm;
     
    957988        if ( r_dcache_itlb_inval_req )
    958989        {
    959             if ( ireq.valid ) m_cost_ins_waste_wait_frz++;
    960990            r_itlb_inval_req = true;
    961991            r_icache_fsm = ICACHE_TLB_CC_INVAL;
     
    11191149    case ICACHE_BIS:
    11201150    {
    1121         m_cost_ins_miss_frz++;
    11221151        // external cache invalidate request
    11231152        if ( r_tgt_icache_req )
    11241153        {
     1154            if ( ireq.valid ) m_cost_ins_miss_frz++;
    11251155            r_icache_fsm = ICACHE_CC_INVAL;
    11261156            r_icache_fsm_save = r_icache_fsm;
    1127             m_cost_ins_waste_wait_frz++;
    11281157            break;
    11291158        }
     
    11321161        if ( r_dcache_itlb_inval_req )
    11331162        {
     1163            if ( ireq.valid ) m_cost_ins_miss_frz++;
    11341164            r_itlb_inval_req = true;
    11351165            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    11361166            r_icache_fsm_save = r_icache_fsm;
    1137             m_cost_ins_waste_wait_frz++;
    11381167            break;
    11391168        }
     
    11421171        if ( r_icache_inval_tlb_rsp )
    11431172        {
     1173            if ( ireq.valid ) m_cost_ins_miss_frz++;
    11441174            r_icache_inval_tlb_rsp = false;
    11451175            r_icache_fsm = ICACHE_IDLE;
    1146             m_cost_ins_tlb_miss_frz++;
    11471176            break;
    11481177        }
     
    11671196                r_icache_fsm = ICACHE_MISS_WAIT;
    11681197                m_cpt_ins_miss++;
     1198                m_cost_ins_miss_frz++;
    11691199            }
    11701200            else
     
    11911221    case ICACHE_TLB1_READ:
    11921222    {
    1193         m_cost_ins_tlb_miss_frz++;
     1223        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
    11941224
    11951225        // external cache invalidate request
     
    11981228            r_icache_fsm = ICACHE_CC_INVAL;
    11991229            r_icache_fsm_save = r_icache_fsm;
    1200             m_cost_ins_waste_wait_frz++;
    12011230            break;
    12021231        }
     
    12081237            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    12091238            r_icache_fsm_save = r_icache_fsm;
    1210             m_cost_ins_waste_wait_frz++;
    12111239            break;
    12121240        }
     
    12621290                                r_itlb_acc_dcache_req = true;
    12631291                                r_icache_fsm          = ICACHE_TLB1_WRITE;
    1264                                 m_cpt_ins_tlb_write_et++;
     1292                                m_cpt_ins_tlb_update_acc++;
     1293                                m_cost_ins_tlb_update_acc_frz++;
    12651294                            }
    12661295                        }
     
    12771306                                r_itlb_acc_dcache_req = true;
    12781307                                r_icache_fsm          = ICACHE_TLB1_WRITE;
    1279                                 m_cpt_ins_tlb_write_et++;
     1308                                m_cpt_ins_tlb_update_acc++;
     1309                                m_cost_ins_tlb_update_acc_frz++;
    12801310                            }
    12811311                        }
     
    13111341    case ICACHE_TLB1_WRITE: 
    13121342    {
    1313         m_cost_ins_tlb_miss_frz++;
     1343        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
     1344        m_cost_ins_tlb_update_acc_frz++;
    13141345
    13151346        // external cache invalidate request
     
    13181349            r_icache_fsm = ICACHE_CC_INVAL;
    13191350            r_icache_fsm_save = r_icache_fsm;
    1320             m_cost_ins_waste_wait_frz++;
    13211351            break;
    13221352        }
     
    13271357            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    13281358            r_icache_fsm_save = r_icache_fsm;
    1329             m_cost_ins_waste_wait_frz++;
    13301359            break;
    13311360        }
     
    13681397    case ICACHE_TLB1_UPDT:
    13691398    {
    1370         m_cost_ins_tlb_miss_frz++;
     1399        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
    13711400
    13721401        // external cache invalidate request
     
    13751404            r_icache_fsm = ICACHE_CC_INVAL;
    13761405            r_icache_fsm_save = r_icache_fsm;
    1377             m_cost_ins_waste_wait_frz++;
    13781406            break;
    13791407        }
     
    13851413            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    13861414            r_icache_fsm_save = r_icache_fsm;
    1387             m_cost_ins_waste_wait_frz++;
    13881415            break;
    13891416        }
     
    13951422            r_dcache_itlb_cleanup_req = icache_tlb.update(r_icache_pte_update,r_icache_vaddr_req.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index);
    13961423            r_dcache_itlb_cleanup_line = victim_index;
     1424            m_cpt_cc_cleanup_ins++;
    13971425            r_icache_fsm = ICACHE_IDLE;
    13981426        }
     
    14091437    case ICACHE_TLB2_READ:
    14101438    {
    1411         m_cost_ins_tlb_miss_frz++;
     1439        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
    14121440
    14131441        // external cache invalidate request
     
    14161444            r_icache_fsm = ICACHE_CC_INVAL;
    14171445            r_icache_fsm_save = r_icache_fsm;
    1418             m_cost_ins_waste_wait_frz++;
    14191446            break;
    14201447        }
     
    14261453            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    14271454            r_icache_fsm_save = r_icache_fsm;
    1428             m_cost_ins_waste_wait_frz++;
    14291455            break;
    14301456        }
     
    14661492                                r_itlb_acc_dcache_req = true;
    14671493                                r_icache_fsm          = ICACHE_TLB2_WRITE;
    1468                                 m_cpt_ins_tlb_write_et++;
     1494                                m_cpt_ins_tlb_update_acc++;
     1495                                m_cost_ins_tlb_update_acc_frz++;
    14691496                            }
    14701497                        }
     
    14811508                                r_itlb_acc_dcache_req = true;
    14821509                                r_icache_fsm          = ICACHE_TLB2_WRITE;
    1483                                 m_cpt_ins_tlb_write_et++;
     1510                                m_cpt_ins_tlb_update_acc++;
     1511                                m_cost_ins_tlb_update_acc_frz++;
    14841512                            }
    14851513                        }
     
    15151543    case ICACHE_TLB2_WRITE:
    15161544    { 
    1517         m_cost_ins_tlb_miss_frz++;
     1545        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
     1546        m_cost_ins_tlb_update_acc_frz++;
    15181547
    15191548        // external cache invalidate request
     
    15221551            r_icache_fsm = ICACHE_CC_INVAL;
    15231552            r_icache_fsm_save = r_icache_fsm;
    1524             m_cost_ins_waste_wait_frz++;
    15251553            break;
    15261554        }
     
    15311559            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    15321560            r_icache_fsm_save = r_icache_fsm;
    1533             m_cost_ins_waste_wait_frz++;
    15341561            break;
    15351562        }
     
    15721599    case ICACHE_TLB2_UPDT:
    15731600    {
    1574         m_cost_ins_tlb_miss_frz++;
     1601        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
    15751602
    15761603        // external cache invalidate request
     
    15791606            r_icache_fsm = ICACHE_CC_INVAL;
    15801607            r_icache_fsm_save = r_icache_fsm;
    1581             m_cost_ins_waste_wait_frz++;
    15821608            break;
    15831609        }
     
    15891615            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    15901616            r_icache_fsm_save = r_icache_fsm;
    1591             m_cost_ins_waste_wait_frz++;
    15921617            break;
    15931618        }
     
    15991624            r_dcache_itlb_cleanup_req = icache_tlb.update(r_icache_pte_update,r_dcache_rsp_itlb_ppn,r_icache_vaddr_req.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index);
    16001625            r_dcache_itlb_cleanup_line = victim_index;
     1626            m_cpt_cc_cleanup_ins++;
    16011627            r_icache_fsm = ICACHE_IDLE;
    16021628        }
     
    16161642        bool clean = false;
    16171643
    1618         if ( ireq.valid ) m_cost_ins_waste_wait_frz++;
    16191644        m_cost_ins_tlb_sw_frz++;
    16201645
     
    16541679    case ICACHE_TLB_FLUSH:
    16551680    {   
    1656         if ( ireq.valid ) m_cost_ins_waste_wait_frz++;
    1657 
    16581681        // data cache flush leads to ins tlb flush, flush all tlb entry
    16591682        icache_tlb.flush(true);    // global entries are invalidated
     
    16721695            r_icache_fsm = ICACHE_CC_INVAL;
    16731696            r_icache_fsm_save = r_icache_fsm;
    1674             m_cost_ins_waste_wait_frz++;
    16751697            break;
    16761698        }
     
    16791701        size_t set = r_icache_set;
    16801702        bool clean = false;
    1681 
    1682         m_cost_ins_cache_flush_frz++;
    1683         if ( ireq.valid ) m_cost_ins_waste_wait_frz++;
    16841703
    16851704        // cache flush and send cleanup to external
     
    16961715                        r_icache_cleanup_req = true;
    16971716                        r_icache_cleanup_line = victim_index;
     1717                        m_cpt_cc_cleanup_ins++;
    16981718                        r_icache_way = way + ((set+1)/m_icache_sets);
    16991719                        r_icache_set = (set+1) % m_icache_sets;
     
    17151735    case ICACHE_TLB_INVAL: 
    17161736    {
    1717         if ( ireq.valid ) m_cost_ins_waste_wait_frz++;
    17181737        paddr_t victim_index = 0;
    17191738
     
    17221741            r_dcache_itlb_cleanup_req = icache_tlb.inval(r_dcache_wdata_save, &victim_index);
    17231742            r_dcache_itlb_cleanup_line = victim_index;
     1743            m_cpt_cc_cleanup_ins++;
    17241744            r_dcache_xtn_req = false;
    17251745            r_itlb_translation_valid = false;
     
    17321752    case ICACHE_CACHE_INVAL:
    17331753    {   
    1734         if ( ireq.valid ) m_cost_ins_waste_wait_frz++;
    17351754        // external cache invalidate request
    17361755        if ( r_tgt_icache_req )
     
    17381757            r_icache_fsm = ICACHE_CC_INVAL;
    17391758            r_icache_fsm_save = r_icache_fsm;
    1740             m_cost_ins_waste_wait_frz++;
    17411759            break;
    17421760        }
     
    17601778                // invalidate and cleanup if necessary
    17611779                r_icache_cleanup_req = r_icache.inval(ipaddr);
    1762                 r_icache_cleanup_line = ipaddr >> (uint32_log2(m_icache_words) + 2);   
     1780                r_icache_cleanup_line = ipaddr >> (uint32_log2(m_icache_words) + 2); 
     1781                m_cpt_cc_cleanup_ins++;
    17631782            }
    17641783            r_dcache_xtn_req = false;
     
    17751794            r_icache_fsm = ICACHE_CC_INVAL;
    17761795            r_icache_fsm_save = r_icache_fsm;
    1777             m_cost_ins_waste_wait_frz++;
    17781796            break;
    17791797        }
     
    17851803            // invalidate and cleanup if necessary
    17861804            r_icache_cleanup_req = r_icache.inval(ipaddr);
    1787             r_icache_cleanup_line = ipaddr >> (uint32_log2(m_icache_words) + 2);   
     1805            r_icache_cleanup_line = ipaddr >> (uint32_log2(m_icache_words) + 2); 
     1806            m_cpt_cc_cleanup_ins++;
    17881807            r_dcache_xtn_req = false;
    17891808            r_icache_fsm = ICACHE_IDLE;
     
    18011820            r_icache_fsm = ICACHE_CC_INVAL;
    18021821            r_icache_fsm_save = r_icache_fsm;
    1803             m_cost_ins_waste_wait_frz++;
    18041822            break;
    18051823        }
     
    18111829            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    18121830            r_icache_fsm_save = r_icache_fsm;
    1813             m_cost_ins_waste_wait_frz++;
    18141831            break;
    18151832        }
     
    18321849                if ( r_icache_cleanup_req ) break;
    18331850                r_icache_cleanup_req = true;
    1834                 r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
     1851                r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2);
     1852                m_cpt_cc_cleanup_ins++;
    18351853                r_icache_fsm = ICACHE_IDLE;
    18361854                r_icache_inval_tlb_rsp = false;
    18371855                if ( r_icache_inval_rsp ) r_icache_inval_rsp = false;
    1838                 m_cost_ins_tlb_miss_frz++;
    18391856                break;
    18401857            }
     
    18451862                r_icache_cleanup_req = true;
    18461863                r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
     1864                m_cpt_cc_cleanup_ins++;
    18471865                r_icache_fsm = ICACHE_IDLE;
    18481866                r_icache_inval_rsp = false;
     
    18561874    case ICACHE_UNC_WAIT:
    18571875    {
    1858         m_cost_ins_miss_frz++;
    1859 
    18601876        // external cache invalidate request
    18611877        if ( r_tgt_icache_req )
     
    18631879            r_icache_fsm = ICACHE_CC_INVAL;
    18641880            r_icache_fsm_save = r_icache_fsm;
    1865             m_cost_ins_waste_wait_frz++;
    18661881            break;
    18671882        }
     
    18731888            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    18741889            r_icache_fsm_save = r_icache_fsm;
    1875             m_cost_ins_waste_wait_frz++;
    18761890            break;
    18771891        }
     
    19131927            r_icache_fsm = ICACHE_CC_INVAL;
    19141928            r_icache_fsm_save = r_icache_fsm;
    1915             m_cost_ins_waste_wait_frz++;
    19161929            break;
    19171930        }
     
    19231936            r_icache_fsm = ICACHE_TLB_CC_INVAL;
    19241937            r_icache_fsm_save = r_icache_fsm;
    1925             m_cost_ins_waste_wait_frz++;
    19261938            break;
    19271939        }
     
    19311943            if ( r_icache_cleanup_req ) break;
    19321944            r_icache_cleanup_req = true;
    1933             r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
     1945            r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2);
     1946            m_cpt_cc_cleanup_ins++;
    19341947            r_icache_inval_tlb_rsp = false;
    19351948            if ( r_icache_inval_rsp ) r_icache_inval_rsp = false;
    19361949            r_icache_fsm = ICACHE_IDLE;
    1937             m_cost_ins_tlb_miss_frz++;
    19381950            break;
    19391951        }
     
    19441956            {
    19451957                r_icache_cleanup_req = true;
    1946                 r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
     1958                r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2);
     1959                m_cpt_cc_cleanup_ins++;
    19471960                r_icache_fsm = ICACHE_IDLE;
    19481961                r_icache_inval_rsp = false;
     
    19561969
    19571970                r_icache_cleanup_req = r_icache.update(r_icache_paddr_save.read(), buf, &victim_index);
    1958                 r_icache_cleanup_line = victim_index;           
    1959 
     1971                r_icache_cleanup_line = victim_index;                        m_cpt_cc_cleanup_ins++;
    19601972                r_icache_fsm = ICACHE_IDLE;
    19611973            }
     
    19771989    case ICACHE_CC_INVAL: 
    19781990    {                       
    1979         if ( ireq.valid ) m_cost_ins_waste_wait_frz++;
    19801991        m_cpt_icache_dir_read += m_icache_ways;
     1992        /* activity counter */
     1993        if ( (( r_icache_fsm_save == ICACHE_BIS ) ||( r_icache_fsm_save == ICACHE_MISS_WAIT ) || ( r_icache_fsm_save == ICACHE_MISS_UPDT ) ) && ( ireq.valid ) )       
     1994        {
     1995            m_cost_ins_miss_frz++;
     1996        }
     1997        if( (( r_icache_fsm_save == ICACHE_TLB1_READ )   || ( r_icache_fsm_save == ICACHE_TLB2_READ )    ||
     1998             ( r_icache_fsm_save == ICACHE_TLB1_WRITR )  || ( r_icache_fsm_save == ICACHE_TLB2_WRITE ) ||
     1999             ( r_icache_fsm_save == ICACHE_TLB1_UPDT )   || ( r_icache_fsm_save == ICACHE_TLB2_UPDT ))   && (ireq.valid) )
     2000        {
     2001            m_cost_ins_tlb_miss_frz++;
     2002        }
    19812003
    19822004        // invalidate cache
     
    19992021    case ICACHE_TLB_CC_INVAL:
    20002022    {
    2001         if ( ireq.valid ) m_cost_ins_waste_wait_frz++;       
     2023        /* activity counter */
     2024        if ( (( r_icache_fsm_save == ICACHE_BIS ) ||( r_icache_fsm_save == ICACHE_MISS_WAIT ) || ( r_icache_fsm_save == ICACHE_MISS_UPDT ) ) && ( ireq.valid ) )       
     2025        {
     2026            m_cost_ins_miss_frz++;
     2027        }
     2028        if( (( r_icache_fsm_save == ICACHE_TLB1_READ )   || ( r_icache_fsm_save == ICACHE_TLB2_READ )    ||
     2029             ( r_icache_fsm_save == ICACHE_TLB1_WRITR )  || ( r_icache_fsm_save == ICACHE_TLB2_WRITE ) ||
     2030             ( r_icache_fsm_save == ICACHE_TLB1_UPDT )   || ( r_icache_fsm_save == ICACHE_TLB2_UPDT ))   && (ireq.valid) )
     2031        {
     2032            m_cost_ins_tlb_miss_frz++;
     2033        }
    20022034
    20032035        if ( r_itlb_inval_req ) break;
     
    21482180            r_dcache_fsm = DCACHE_CC_CHECK;
    21492181            r_dcache_fsm_save = r_dcache_fsm;
    2150             if ( dreq.valid ) m_cost_data_waste_wait_frz++;
    21512182            break;
    21522183        }
     
    21942225            r_dcache_fsm = DCACHE_CC_CHECK;
    21952226            r_dcache_fsm_save = DCACHE_IDLE;
    2196             if ( dreq.valid ) m_cost_data_waste_wait_frz++;
    21972227            break;
    21982228        }       
     
    22022232        {
    22032233            r_dcache_fsm = DCACHE_ITLB_CLEANUP;
    2204             m_cpt_ins_tlb_cleanup++;
    2205             if ( dreq.valid ) m_cost_data_waste_wait_frz++;
    22062234            break;
    22072235        }   
     
    22092237        if ( r_itlb_read_dcache_req )
    22102238        {
     2239            if ( dreq.valid ) m_cost_ins_tlb_occup_cache_frz++;         
    22112240            data_t rsp_itlb_miss;
    22122241            data_t rsp_itlb_ppn;
     
    22252254            if ( itlb_hit_dcache )  // ins TLB request hits in data cache
    22262255            {
     2256                if (!((rsp_itlb_miss & PTE_T_MASK ) >> PTE_T_SHIFT)) m_cpt_ins_tlb_hit_dcache++;                   
    22272257                r_dcache_rsp_itlb_miss = rsp_itlb_miss;
    22282258                r_dcache_rsp_itlb_ppn = rsp_itlb_ppn;
     
    22412271                r_dcache_fsm = DCACHE_ITLB_READ;
    22422272            }
    2243             if ( dreq.valid ) m_cost_data_waste_wait_frz++;
    22442273        }
    22452274        else if ( r_itlb_acc_dcache_req ) // ins tlb write access bit
     
    22482277            assert(write_hit && "Write on miss ignores data");
    22492278            r_dcache_itlb_ll_acc_req = true;
    2250             r_dcache_fsm = DCACHE_ITLB_LL_WAIT;                
    2251             if ( dreq.valid ) m_cost_data_waste_wait_frz++;
     2279            r_dcache_fsm = DCACHE_ITLB_LL_WAIT;         
     2280            m_cpt_dcache_data_write++;     
    22522281        }
    22532282        else if (dreq.valid)
     
    26302659                r_dcache_hit_p_save = dcache_hit_p;
    26312660                r_dcache_fsm = DCACHE_BIS;
    2632                 m_cost_data_miss_frz++;
     2661                m_cost_data_tlb_miss_frz++;
    26332662            }
    26342663            else  // cached or uncached access with a correct speculative physical address
     
    27302759                        m_cpt_write++;
    27312760                        if ( dcache_cached ) m_cpt_write_cached++;
    2732 
     2761                        m_cost_write_frz++;
    27332762                        if ( dcache_hit_c && dcache_cached )    // cache update required
    27342763                        {
     
    27372766                        else if ( !dcache_pte_info.d && (r_mmu_mode.read() & DATA_TLB_MASK) )   // dirty bit update required
    27382767                        {
     2768                            m_cpt_data_tlb_update_dirty++;
     2769                            m_cost_data_tlb_update_dirty_frz++;
    27392770                            if ( dcache_tlb.getpagesize(dcache_tlb_way, dcache_tlb_set) )       // 2M page size, one level page table
    27402771                            {
     
    27432774                                r_dcache_tlb_ll_dirty_req = true;
    27442775                                r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2745                                 m_cpt_data_tlb_write_dirty++;
    27462776                            }
    27472777                            else        // 4k page size, two levels page table
     
    27532783                                    r_dcache_tlb_ll_dirty_req = true;
    27542784                                    r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2755                                     m_cpt_data_tlb_write_dirty++;
    27562785                                }
    27572786                                else    // get PTBA to calculate the physical address of PTE
     
    27632792                                }
    27642793                            }
    2765                             m_cost_data_tlb_miss_frz++;
    27662794                        }
    27672795                        else                                    // no cache update, not dirty bit update
     
    28122840            r_dcache_fsm = DCACHE_CC_CHECK;
    28132841            r_dcache_fsm_save = r_dcache_fsm;
    2814             m_cost_data_waste_wait_frz++;
     2842            if ( dreq.valid ) m_cost_data_miss_frz++;
    28152843            break;
    28162844        }
     
    28212849            r_dcache_inval_tlb_rsp = false;
    28222850            r_dcache_fsm = DCACHE_IDLE;
    2823             m_cost_data_tlb_miss_frz++;
     2851            if ( dreq.valid ) m_cost_data_miss_frz++;
    28242852            break;
    28252853        }
     
    28662894                else if (!r_dcache_dirty_save && (r_mmu_mode.read() & DATA_TLB_MASK))   // dirty bit update required
    28672895                {
     2896                    m_cpt_data_tlb_update_dirty++;
     2897                    m_cost_data_tlb_update_dirty_frz++;                         
    28682898                    if (dcache_tlb.getpagesize(r_dcache_tlb_way_save, r_dcache_tlb_set_save))
    28692899                    {
     
    28722902                        r_dcache_tlb_ll_dirty_req = true;
    28732903                        r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2874                         m_cpt_data_tlb_write_dirty++;
    28752904                    }
    28762905                    else
     
    28822911                            r_dcache_tlb_ll_dirty_req = true;
    28832912                            r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2884                             m_cpt_data_tlb_write_dirty++;
    28852913                        }
    28862914                        else
     
    28922920                        }
    28932921                    }
    2894                     m_cost_data_tlb_miss_frz++;
    28952922                }
    28962923                else                                    // no cache update, not dirty bit update
     
    29142941    case DCACHE_LL_DIRTY_WAIT:
    29152942    {
     2943        m_cost_data_tlb_update_dirty_frz++;
     2944
    29162945        // external cache invalidate request
    29172946        if ( r_tgt_dcache_req )   
     
    29192948            r_dcache_fsm = DCACHE_CC_CHECK;
    29202949            r_dcache_fsm_save = r_dcache_fsm;
    2921             m_cost_data_waste_wait_frz++;
    29222950            break;
    29232951        }
     
    29632991                    r_dcache_inval_tlb_rsp = false;
    29642992                    r_dcache_fsm = DCACHE_IDLE;
    2965                     m_cost_data_tlb_miss_frz++;
    29662993                }
    29672994                else if ( r_dcache_inval_rsp )
     
    29833010    case DCACHE_SC_DIRTY_WAIT:
    29843011    {
     3012        m_cost_data_tlb_update_dirty_frz++;         
    29853013        // external cache invalidate request
    29863014        if ( r_tgt_dcache_req )   
     
    29883016            r_dcache_fsm = DCACHE_CC_CHECK;
    29893017            r_dcache_fsm_save = r_dcache_fsm;
    2990             m_cost_data_waste_wait_frz++;
    29913018            break;
    29923019        }
     
    30183045                    r_dcache_fsm = DCACHE_IDLE;
    30193046                    if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false;
    3020                     m_cost_data_tlb_miss_frz++;
    30213047                }
    30223048                else if ( r_dcache_inval_rsp )
     
    30303056                    r_dcache_tlb_ll_dirty_req = true;
    30313057                    r_dcache_tlb_sc_fail = false;
    3032                     r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
     3058                    r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
     3059                    m_cpt_data_tlb_update_dirty++;
    30333060                }
    30343061                else
     
    30503077            r_dcache_fsm = DCACHE_CC_CHECK;
    30513078            r_dcache_fsm_save = r_dcache_fsm;
    3052             m_cost_data_waste_wait_frz++;
    30533079            break;
    30543080        }       
     
    30593085            r_dcache_inval_tlb_rsp = false;
    30603086            r_dcache_fsm = DCACHE_IDLE;
    3061             m_cost_data_tlb_miss_frz++;
    30623087            break;
    30633088        }
     
    30993124                    r_dcache_tlb_ll_dirty_req = true;
    31003125                    r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    3101                     m_cpt_data_tlb_write_dirty++;
     3126                    m_cpt_dcache_data_write++;
     3127                    m_cost_data_tlb_update_dirty_frz++;
    31023128                }
    31033129                else
     
    31083134            else        // PTE
    31093135            {
     3136                m_cpt_data_tlb_hit_dcache++;
    31103137                r_dcache_ptba_ok = false;
    31113138                if ( (m_srcid_rw >> 4) == ((r_dcache_tlb_paddr.read() & ((1<<(m_paddr_nbits - PAGE_M_NBITS))-1)) >> (m_paddr_nbits - PAGE_M_NBITS -10)) ) // local
     
    31233150                        assert(write_hit && "Write on miss ignores data"); 
    31243151                        r_dcache_fsm = DCACHE_TLB1_LL_WAIT;
    3125                         m_cpt_ins_tlb_write_et++;
     3152                        m_cpt_dcache_data_write++;
     3153                        m_cpt_data_tlb_update_acc++;
     3154                        m_cost_data_tlb_update_acc_frz++;
    31263155                    }
    31273156                }
     
    31403169                        assert(write_hit && "Write on miss ignores data"); 
    31413170                        r_dcache_fsm = DCACHE_TLB1_LL_WAIT;
    3142                         m_cpt_ins_tlb_write_et++;
     3171                        m_cpt_dcache_data_write++;
     3172                        m_cpt_data_tlb_update_acc++;
     3173                        m_cost_data_tlb_update_acc_frz++;
    31433174                    }
    31443175                }
     
    31563187    case DCACHE_TLB1_LL_WAIT:
    31573188    {
     3189        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
     3190        m_cost_data_tlb_update_acc_frz++;           
    31583191        // external cache invalidate request
    31593192        if ( r_tgt_dcache_req )   
     
    31613194            r_dcache_fsm = DCACHE_CC_CHECK;
    31623195            r_dcache_fsm_save = r_dcache_fsm;
    3163             m_cost_data_waste_wait_frz++;
    31643196            break;
    31653197        }
     
    32053237                    r_dcache_inval_tlb_rsp = false;
    32063238                    r_dcache_fsm = DCACHE_IDLE;
    3207                     m_cost_data_tlb_miss_frz++;
    32083239                }
    32093240                else if ( r_dcache_inval_rsp )
     
    32253256    case DCACHE_TLB1_SC_WAIT:
    32263257    {
     3258        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
     3259        m_cost_data_tlb_update_acc_frz++;           
    32273260        // external cache invalidate request
    32283261        if ( r_tgt_dcache_req )   
     
    32303263            r_dcache_fsm = DCACHE_CC_CHECK;
    32313264            r_dcache_fsm_save = r_dcache_fsm;
    3232             m_cost_data_waste_wait_frz++;
    32333265            break;
    32343266        }
     
    32603292                    r_dcache_fsm = DCACHE_IDLE;
    32613293                    if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false;
    3262                     m_cost_data_tlb_miss_frz++;
    32633294                }
    32643295                else if ( r_dcache_inval_rsp )
     
    32723303                    r_dcache_tlb_sc_fail = false;
    32733304                    r_dcache_tlb_ll_acc_req = true;
    3274                     r_dcache_fsm = DCACHE_TLB1_LL_WAIT;
     3305                    r_dcache_fsm = DCACHE_TLB1_LL_WAIT;
     3306                    m_cpt_data_tlb_update_acc++;
    32753307                }
    32763308                else
     
    32853317    case DCACHE_TLB1_READ:
    32863318    {
    3287         m_cost_data_tlb_miss_frz++;
     3319        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
    32883320
    32893321        // external cache invalidate request
     
    32923324            r_dcache_fsm = DCACHE_CC_CHECK;
    32933325            r_dcache_fsm_save = r_dcache_fsm;
    3294             m_cost_data_waste_wait_frz++;
    32953326            break;
    32963327        }       
     
    33283359                r_dcache_cleanup_req = true;
    33293360                r_dcache_cleanup_line = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words) + 2); 
     3361                m_cpt_cc_cleanup_data++;
    33303362                r_dcache_fsm = DCACHE_IDLE;
    33313363                r_dcache_inval_rsp = false;
     
    33483380            r_dcache_fsm = DCACHE_CC_CHECK;
    33493381            r_dcache_fsm_save = r_dcache_fsm;
    3350             m_cost_data_waste_wait_frz++;
    33513382            break;
    33523383        }       
     
    33573388            r_dcache_inval_tlb_rsp = false;
    33583389            r_dcache_fsm = DCACHE_IDLE;
    3359             m_cost_data_tlb_miss_frz++;
    33603390            break;
    33613391        }
     
    33743404            {
    33753405                r_dcache_cleanup_req = true;
    3376                 r_dcache_cleanup_line = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words) + 2); 
     3406                r_dcache_cleanup_line = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words) + 2);
     3407                m_cpt_cc_cleanup_data++;       
    33773408                r_dcache_fsm = DCACHE_IDLE;
    33783409                r_dcache_inval_rsp = false;
     
    33963427                r_dcache_cleanup_req = true;
    33973428                r_dcache_cleanup_line = victim_index;
     3429                m_cpt_cc_cleanup_data++;
    33983430                r_dcache_fsm = DCACHE_TLB_CC_INVAL;
    33993431                r_dcache_fsm_save = r_dcache_fsm;
     
    34033435            r_dcache.update(r_dcache_tlb_paddr, way, set, r_dcache_miss_buf);
    34043436            r_dcache.read(r_dcache_tlb_paddr, &rsp_dtlb_miss); 
     3437            m_cpt_data_tlb_occup_cache++;
    34053438
    34063439            if ( !(rsp_dtlb_miss >> PTE_V_SHIFT) )      // unmapped
     
    34333466                    r_dcache_tlb_ll_dirty_req = true;
    34343467                    r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    3435                     m_cpt_data_tlb_write_dirty++;
     3468                    m_cpt_dcache_data_write++;
     3469                    m_cpt_data_tlb_update_dirty++;
     3470                    m_cost_data_tlb_update_dirty_frz++;
    34363471                }
    34373472                else
     
    34573492                        assert(write_hit && "Write on miss ignores data"); 
    34583493                        r_dcache_fsm        = DCACHE_TLB1_LL_WAIT;
    3459                         m_cpt_ins_tlb_write_et++;
     3494                        m_cpt_dcache_data_write++;
     3495                        m_cpt_data_tlb_update_acc++;
     3496                        m_cost_data_tlb_update_acc_frz++;
    34603497                    }
    34613498                }
     
    34743511                        assert(write_hit && "Write on miss ignores data"); 
    34753512                        r_dcache_fsm        = DCACHE_TLB1_LL_WAIT;
    3476                         m_cpt_ins_tlb_write_et++;
     3513                        m_cpt_dcache_data_write++;
     3514                        m_cpt_data_tlb_update_acc++;
     3515                        m_cost_data_tlb_update_acc_frz++;
    34773516                    }
    34783517                }
     
    34913530            r_dcache_fsm = DCACHE_CC_CHECK;
    34923531            r_dcache_fsm_save = r_dcache_fsm;
    3493             m_cost_data_waste_wait_frz++;
    34943532            break;
    34953533        }       
     
    35233561            r_dcache_fsm = DCACHE_CC_CHECK;
    35243562            r_dcache_fsm_save = r_dcache_fsm;
    3525             m_cost_data_waste_wait_frz++;
    35263563            break;
    35273564        }       
     
    35323569            r_dcache_inval_tlb_rsp = false;
    35333570            r_dcache_fsm = DCACHE_IDLE;
    3534             m_cost_data_tlb_miss_frz++;
    35353571            break;
    35363572        }
     
    35713607            else
    35723608            {
     3609                m_cpt_data_tlb_hit_dcache++;
    35733610                if ( (m_srcid_rw >> 4) == ((r_dcache_tlb_paddr.read() & ((1<<(m_paddr_nbits - PAGE_M_NBITS))-1)) >> (m_paddr_nbits - PAGE_M_NBITS -10)) ) // local
    35743611                {
     
    35873624                        assert(write_hit && "Write on miss ignores data"); 
    35883625                        r_dcache_fsm = DCACHE_TLB2_LL_WAIT;
    3589                         m_cpt_ins_tlb_write_et++;
     3626                        m_cpt_dcache_data_write++;
     3627                        m_cpt_data_tlb_update_acc++;
     3628                        m_cost_data_tlb_update_acc_frz++;
    35903629                    }
    35913630                }
     
    36063645                        assert(write_hit && "Write on miss ignores data"); 
    36073646                        r_dcache_fsm = DCACHE_TLB2_LL_WAIT;
    3608                         m_cpt_ins_tlb_write_et++;
     3647                        m_cpt_dcache_data_write++;
     3648                        m_cpt_data_tlb_update_acc++;
     3649                        m_cost_data_tlb_update_acc_frz++;
    36093650                    }
    36103651                }
     
    36223663    case DCACHE_TLB2_LL_WAIT:
    36233664    {
     3665        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
     3666        m_cost_data_tlb_update_acc_frz++;
     3667
    36243668        // external cache invalidate request
    36253669        if ( r_tgt_dcache_req )   
     
    36273671            r_dcache_fsm = DCACHE_CC_CHECK;
    36283672            r_dcache_fsm_save = r_dcache_fsm;
    3629             m_cost_data_waste_wait_frz++;
    36303673            break;
    36313674        }
     
    36713714                    r_dcache_inval_tlb_rsp = false;
    36723715                    r_dcache_fsm = DCACHE_IDLE;
    3673                     m_cost_data_tlb_miss_frz++;
    36743716                }
    36753717                else if ( r_dcache_inval_rsp )
     
    36913733    case DCACHE_TLB2_SC_WAIT:
    36923734    {
     3735        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
     3736        m_cost_data_tlb_update_acc_frz++;           
    36933737        // external cache invalidate request
    36943738        if ( r_tgt_dcache_req )   
     
    36963740            r_dcache_fsm = DCACHE_CC_CHECK;
    36973741            r_dcache_fsm_save = r_dcache_fsm;
    3698             m_cost_data_waste_wait_frz++;
    36993742            break;
    37003743        }
     
    37263769                    if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false;
    37273770                    r_dcache_fsm = DCACHE_IDLE;
    3728                     m_cost_data_tlb_miss_frz++;
    37293771                }
    37303772                else if ( r_dcache_inval_rsp )
     
    37383780                    r_dcache_tlb_ll_acc_req = true;
    37393781                    r_dcache_tlb_sc_fail = false;
    3740                     r_dcache_fsm = DCACHE_TLB2_LL_WAIT;
     3782                    r_dcache_fsm = DCACHE_TLB2_LL_WAIT;
     3783                    m_cpt_data_tlb_update_acc++;
    37413784                }
    37423785                else
     
    37583801            r_dcache_fsm = DCACHE_CC_CHECK;
    37593802            r_dcache_fsm_save = r_dcache_fsm;
    3760             m_cost_data_waste_wait_frz++;
    37613803            break;
    37623804        }       
     
    37943836                r_dcache_cleanup_req = true;
    37953837                r_dcache_cleanup_line = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words) + 2); 
     3838                m_cpt_cc_cleanup_data++;
    37963839                r_dcache_fsm = DCACHE_IDLE;
    37973840                r_dcache_inval_rsp = false;
     
    38143857            r_dcache_fsm = DCACHE_CC_CHECK;
    38153858            r_dcache_fsm_save = r_dcache_fsm;
    3816             m_cost_data_waste_wait_frz++;
    38173859            break;
    38183860        }       
     
    38233865            r_dcache_inval_tlb_rsp = false;
    38243866            r_dcache_fsm = DCACHE_IDLE;
    3825             m_cost_data_tlb_miss_frz++;
    38263867            break;
    38273868        }
     
    38423883                r_dcache_cleanup_req = true;
    38433884                r_dcache_cleanup_line = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words) + 2); 
     3885                m_cpt_cc_cleanup_data++;
    38443886                r_dcache_fsm = DCACHE_IDLE;
    38453887                r_dcache_inval_rsp = false;
     
    38633905                r_dcache_cleanup_req = true;
    38643906                r_dcache_cleanup_line = victim_index;
     3907                m_cpt_cc_cleanup_data++;
    38653908                r_dcache_fsm = DCACHE_TLB_CC_INVAL;
    38663909                r_dcache_fsm_save = r_dcache_fsm;
     
    38703913            r_dcache.update(r_dcache_tlb_paddr, way, set, r_dcache_miss_buf);
    38713914            r_dcache.read(r_dcache_tlb_paddr, &rsp_dtlb_miss);
     3915            m_cpt_data_tlb_occup_cache++;
    38723916
    38733917            bool tlb_hit_ppn = r_dcache.read(r_dcache_tlb_paddr.read()+4, &tlb_data_ppn);
     
    39113955                        assert(write_hit && "Write on miss ignores data"); 
    39123956                        r_dcache_fsm = DCACHE_TLB2_LL_WAIT;
    3913                         m_cpt_ins_tlb_write_et++;
     3957                        m_cpt_dcache_data_write++;
     3958                        m_cpt_data_tlb_update_acc++;
     3959                        m_cost_data_tlb_update_acc_frz++;
    39143960                    }
    39153961                }
     
    39303976                        assert(write_hit && "Write on miss ignores data"); 
    39313977                        r_dcache_fsm = DCACHE_TLB2_LL_WAIT;
    3932                         m_cpt_ins_tlb_write_et++;
     3978                        m_cpt_dcache_data_write++;
     3979                        m_cpt_data_tlb_update_acc++;
     3980                        m_cost_data_tlb_update_acc_frz++;
    39333981                    }
    39343982                }
     
    39473995            r_dcache_fsm = DCACHE_CC_CHECK;
    39483996            r_dcache_fsm_save = r_dcache_fsm;
    3949             m_cost_data_waste_wait_frz++;
    39503997            break;
    39513998        }       
     
    40264073            r_dcache_fsm = DCACHE_CC_CHECK;
    40274074            r_dcache_fsm_save = r_dcache_fsm;
    4028             m_cost_data_waste_wait_frz++;
    40294075            break;
    40304076        } 
     
    40484094                        r_dcache_cleanup_req = true;
    40494095                        r_dcache_cleanup_line = victim_index;
     4096                        m_cpt_cc_cleanup_data++;
    40504097                        r_dcache_way = way + ((set+1)/m_dcache_sets);
    40514098                        r_dcache_set = (set+1) % m_dcache_sets;
     
    40994146            r_dcache_fsm = DCACHE_CC_CHECK;
    41004147            r_dcache_fsm_save = r_dcache_fsm;
    4101             m_cost_data_waste_wait_frz++;
    41024148            break;
    41034149        } 
     
    41264172                r_dcache_cleanup_req = r_dcache.inval(dpaddr, &way, &set);
    41274173                r_dcache_cleanup_line = dpaddr >> (uint32_log2(m_dcache_words)+2);
     4174                m_cpt_cc_cleanup_data++;
    41284175               
    41294176                if ( r_dcache_in_itlb[way*m_dcache_sets+set] || r_dcache_in_dtlb[way*m_dcache_sets+set] )
     
    41564203            r_dcache_fsm = DCACHE_CC_CHECK;
    41574204            r_dcache_fsm_save = r_dcache_fsm;
    4158             m_cost_data_waste_wait_frz++;
    41594205            break;
    41604206        } 
     
    41684214            r_dcache_cleanup_req = r_dcache.inval(dpaddr, &way, &set);
    41694215            r_dcache_cleanup_line = dpaddr >> (uint32_log2(m_dcache_words)+2);
     4216            m_cpt_cc_cleanup_data++;
    41704217           
    41714218            if ( r_dcache_in_itlb[way*m_dcache_sets+set] || r_dcache_in_dtlb[way*m_dcache_sets+set] )
     
    42104257            r_dcache_fsm = DCACHE_CC_CHECK;
    42114258            r_dcache_fsm_save = r_dcache_fsm;
    4212             m_cost_data_waste_wait_frz++;
    42134259            break;
    42144260        }
     
    42324278                r_dcache_cleanup_req = true;
    42334279                r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
     4280                m_cpt_cc_cleanup_data++;
    42344281                r_dcache_fsm = DCACHE_IDLE;
    42354282                r_dcache_inval_tlb_rsp = false;
     
    42434290                r_dcache_cleanup_req = true;
    42444291                r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
     4292                m_cpt_cc_cleanup_data++;
    42454293                r_dcache_fsm = DCACHE_IDLE;
    42464294                r_dcache_inval_rsp = false;
     
    42624310            r_dcache_fsm = DCACHE_CC_CHECK;
    42634311            r_dcache_fsm_save = r_dcache_fsm;
    4264             m_cost_data_waste_wait_frz++;
    42654312            break;
    42664313        }
     
    42714318            r_dcache_cleanup_req = true;
    42724319            r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
     4320            m_cpt_cc_cleanup_data++;
    42734321            r_dcache_inval_tlb_rsp = false;
    42744322            r_dcache_inval_rsp = false;
    42754323            r_dcache_fsm = DCACHE_IDLE;
    4276             m_cost_data_tlb_miss_frz++;
    42774324            break;
    42784325        }
     
    42844331            size_t set = 0;
    42854332
    4286             m_cpt_dcache_data_write++;
    4287             m_cpt_dcache_dir_write++;
    4288 
    42894333            // Using tlb entry is in the invalidated cache line 
    42904334            if ( r_dcache_inval_rsp )
     
    42924336                r_dcache_cleanup_req = true;
    42934337                r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
     4338                m_cpt_cc_cleanup_data++;
    42944339                r_dcache_fsm = DCACHE_IDLE;
    42954340                r_dcache_inval_rsp = false;
     
    43134358                r_dcache_cleanup_req = true;
    43144359                r_dcache_cleanup_line = victim_index;
     4360                m_cpt_cc_cleanup_data++;
    43154361                if ( r_dcache_in_itlb[m_dcache_sets*way+set] || r_dcache_in_dtlb[m_dcache_sets*way+set] )
    43164362                {
     
    43204366                }
    43214367            }
    4322 
     4368            m_cpt_dcache_dir_write++;
     4369            m_cpt_dcache_data_write++;
    43234370            r_dcache.update(r_dcache_paddr_save.read(), way, set, r_dcache_miss_buf);
    43244371            r_dcache_fsm = DCACHE_IDLE;
     
    43364383            r_dcache_fsm = DCACHE_CC_CHECK;
    43374384            r_dcache_fsm_save = r_dcache_fsm;
    4338             m_cost_data_waste_wait_frz++;
    43394385            break;
    43404386        }
     
    43644410                r_dcache_cleanup_req = r_dcache.inval(r_dcache_paddr_save, &way, &set);
    43654411                r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2);
     4412                m_cpt_cc_cleanup_data++;
    43664413               
    43674414                if ( r_dcache_in_itlb[way*m_dcache_sets+set] || r_dcache_in_dtlb[way*m_dcache_sets+set] )
     
    43924439    {
    43934440        m_cost_write_frz++;
     4441        m_cpt_dcache_data_write++;
    43944442        size_t way = 0;
    43954443        size_t set = 0;
     
    44194467        if ( !r_dcache_dirty_save && (r_mmu_mode.read() & DATA_TLB_MASK) )   
    44204468        {
     4469            m_cpt_data_tlb_update_dirty++;
     4470            m_cost_data_tlb_update_dirty_frz++;
    44214471            if ( dcache_tlb.getpagesize(r_dcache_tlb_way_save, r_dcache_tlb_set_save) ) // 2M page size, one level page table
    4422             {
     4472            {               
    44234473                r_dcache_pte_update = dcache_tlb.getpte(r_dcache_tlb_way_save, r_dcache_tlb_set_save) | PTE_D_MASK;
    44244474                r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2);
    44254475                r_dcache_tlb_ll_dirty_req = true;
    4426                 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    4427                 m_cpt_data_tlb_write_dirty++;
     4476                r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;         
    44284477            }
    44294478            else
     
    44354484                    r_dcache_tlb_ll_dirty_req = true;
    44364485                    r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    4437                     m_cpt_data_tlb_write_dirty++;
    44384486                }
    44394487                else
     
    44574505    case DCACHE_WRITE_DIRTY:
    44584506    {
    4459         m_cost_data_tlb_miss_frz++;
     4507        m_cost_data_tlb_update_dirty_frz++;
    44604508
    44614509        // external cache invalidate request
     
    44644512            r_dcache_fsm = DCACHE_CC_CHECK;
    44654513            r_dcache_fsm_save = r_dcache_fsm;
    4466             m_cost_data_waste_wait_frz++;
    44674514            break;
    44684515        }
     
    44824529        }
    44834530
     4531        m_cpt_dcache_data_write++;
    44844532        r_dcache.write(r_dcache_tlb_paddr, r_dcache_pte_update);
    44854533        dcache_tlb.setdirty(r_dcache_tlb_way_save, r_dcache_tlb_set_save);
     
    45024550    case DCACHE_ITLB_READ:
    45034551    {
    4504         m_cost_data_waste_wait_frz++;
     4552       if ( dreq.valid ) m_cost_ins_tlb_occup_cache_frz++;
    45054553
    45064554        // external cache invalidate request
     
    45094557            r_dcache_fsm = DCACHE_CC_CHECK;
    45104558            r_dcache_fsm_save = r_dcache_fsm;
    4511             m_cost_data_waste_wait_frz++;
    45124559            break;
    45134560        }
     
    45314578                r_dcache_cleanup_req = true;
    45324579                r_dcache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
     4580                m_cpt_cc_cleanup_data++;
    45334581                r_dcache_fsm = DCACHE_IDLE;
    45344582                r_dcache_inval_rsp = false;
     
    45434591    case DCACHE_ITLB_UPDT:
    45444592    {
    4545         m_cost_data_waste_wait_frz++;
     4593        if ( dreq.valid ) m_cost_ins_tlb_occup_cache_frz++; 
    45464594
    45474595        // external cache invalidate request
     
    45504598            r_dcache_fsm = DCACHE_CC_CHECK;
    45514599            r_dcache_fsm_save = r_dcache_fsm;
    4552             m_cost_data_waste_wait_frz++;
    45534600            break;
    45544601        }
     
    45674614                r_dcache_cleanup_req = true;
    45684615                r_dcache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
     4616                m_cpt_cc_cleanup_data++;
    45694617                r_dcache_fsm = DCACHE_IDLE;
    45704618                r_dcache_inval_rsp = false;
     
    45884636                r_dcache_cleanup_req = true;
    45894637                r_dcache_cleanup_line = victim_index;
     4638                m_cpt_cc_cleanup_data++;
    45904639                if ( r_dcache_in_itlb[m_dcache_sets*way+set] || r_dcache_in_dtlb[m_dcache_sets*way+set] )
    45914640                {
     
    46004649            r_dcache.setinbit(r_icache_paddr_save, r_dcache_in_itlb, true);
    46014650            bool itlb_hit_dcache = r_dcache.read(r_icache_paddr_save, &rsp_itlb_miss); 
    4602  
     4651            m_cpt_ins_tlb_occup_cache++;
     4652
    46034653            if ( r_itlb_k_read_dcache && itlb_hit_dcache )
    46044654            {   
     
    46194669    case DCACHE_ITLB_LL_WAIT:
    46204670    {
     4671        if ( dreq.valid ) m_cost_ins_tlb_occup_cache_frz++;         
    46214672        // external cache invalidate request
    46224673        if ( r_tgt_dcache_req )   
     
    46244675            r_dcache_fsm = DCACHE_CC_CHECK;
    46254676            r_dcache_fsm_save = r_dcache_fsm;
    4626             m_cost_data_waste_wait_frz++;
    46274677            break;
    46284678        }
     
    46514701                    r_dcache_inval_rsp = false;
    46524702                    r_dcache_fsm = DCACHE_IDLE;
    4653                     m_cost_data_tlb_miss_frz++;
    46544703                }
    46554704                else
     
    46664715    case DCACHE_ITLB_SC_WAIT:
    46674716    {
     4717        if ( dreq.valid ) m_cost_ins_tlb_occup_cache_frz++;         
    46684718        // external cache invalidate request
    46694719        if ( r_tgt_dcache_req )   
     
    46714721            r_dcache_fsm = DCACHE_CC_CHECK;
    46724722            r_dcache_fsm_save = r_dcache_fsm;
    4673             m_cost_data_waste_wait_frz++;
    46744723            break;
    46754724        }
     
    46924741                    r_dcache_fsm = DCACHE_IDLE;
    46934742                    if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false;
    4694                     m_cost_data_tlb_miss_frz++;
    46954743                }
    46964744                else if ( r_dcache_tlb_sc_fail )
     
    47124760    case DCACHE_CC_CHECK:   // read directory in case of invalidate or update request
    47134761    {
    4714         if ( dreq.valid ) m_cost_data_waste_wait_frz++;
    4715 
    47164762        m_cpt_dcache_dir_read += m_dcache_ways;
    47174763        m_cpt_dcache_data_read += m_dcache_ways;
     4764
     4765        /* activity counter */
     4766        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     4767        {
     4768            m_cost_data_miss_frz++;
     4769        }
     4770        if( (( r_dcache_fsm_save == DCACHE_DTLB1_READ_CACHE ) || ( r_dcache_fsm_save == DCACHE_DTLB2_READ_CACHE ) ||
     4771             ( r_dcache_fsm_save == DCACHE_TLB1_READ )        || ( r_dcache_fsm_save == DCACHE_TLB2_READ )        ||
     4772             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT )     ||
     4773             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT )     ||
     4774             ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT )   ||
     4775             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )        || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT )) && (dreq.valid) )
     4776        {
     4777            m_cost_data_tlb_miss_frz++;
     4778        }
    47184779
    47194780        // DCACHE_TLB1_LL_WAIT  DCACHE_TLB1_SC_WAIT  DCACHE_LL_DIRTY_WAIT  DCACHE_WRITE_DIRTY DCACHE_ITLB_LL_WAIT  DCACHE_ITLB_SC_WAIT
     
    47924853    case DCACHE_CC_UPDT:    // update directory and data cache       
    47934854    {
    4794         if ( dreq.valid ) m_cost_data_waste_wait_frz++;
     4855        /* activity counter */
     4856        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     4857        {
     4858            m_cost_data_miss_frz++;
     4859        }
     4860        if( (( r_dcache_fsm_save == DCACHE_DTLB1_READ_CACHE ) || ( r_dcache_fsm_save == DCACHE_DTLB2_READ_CACHE ) ||
     4861             ( r_dcache_fsm_save == DCACHE_TLB1_READ )        || ( r_dcache_fsm_save == DCACHE_TLB2_READ )        ||
     4862             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT )     ||
     4863             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT )     ||
     4864             ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT )   ||
     4865             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )        || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT )) && (dreq.valid) )
     4866        {
     4867            m_cost_data_tlb_miss_frz++;
     4868        }
    47954869
    47964870        m_cpt_dcache_dir_write++;
     
    48104884    case DCACHE_CC_INVAL:   // invalidate a cache line
    48114885    {
    4812         if ( dreq.valid ) m_cost_data_waste_wait_frz++;
     4886        /* activity counter */
     4887        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     4888        {
     4889            m_cost_data_miss_frz++;
     4890        }
     4891        if( (( r_dcache_fsm_save == DCACHE_DTLB1_READ_CACHE ) || ( r_dcache_fsm_save == DCACHE_DTLB2_READ_CACHE ) ||
     4892             ( r_dcache_fsm_save == DCACHE_TLB1_READ )        || ( r_dcache_fsm_save == DCACHE_TLB2_READ )        ||
     4893             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT )     ||
     4894             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT )     ||
     4895             ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT )   ||
     4896             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )        || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT )) && (dreq.valid) )
     4897        {
     4898            m_cost_data_tlb_miss_frz++;
     4899        }
    48134900
    48144901        r_tgt_dcache_rsp = r_dcache.inval(r_tgt_addr.read());
     
    48204907    case DCACHE_CC_NOP:     // no external hit
    48214908    {
    4822         if ( dreq.valid ) m_cost_data_waste_wait_frz++;
     4909        /* activity counter */
     4910        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     4911        {
     4912            m_cost_data_miss_frz++;
     4913        }
     4914        if( (( r_dcache_fsm_save == DCACHE_DTLB1_READ_CACHE ) || ( r_dcache_fsm_save == DCACHE_DTLB2_READ_CACHE ) ||
     4915             ( r_dcache_fsm_save == DCACHE_TLB1_READ )        || ( r_dcache_fsm_save == DCACHE_TLB2_READ )        ||
     4916             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT )     ||
     4917             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT )     ||
     4918             ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT )   ||
     4919             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )        || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT )) && (dreq.valid) )
     4920        {
     4921            m_cost_data_tlb_miss_frz++;
     4922        }
    48234923
    48244924        r_tgt_dcache_req = false;
     
    48384938    case DCACHE_TLB_CC_INVAL:
    48394939    {
    4840         if ( dreq.valid ) m_cost_data_waste_wait_frz++;
     4940        /* activity counter */
     4941        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     4942        {
     4943            m_cost_data_miss_frz++;
     4944        }
     4945        if( (( r_dcache_fsm_save == DCACHE_DTLB1_READ_CACHE ) || ( r_dcache_fsm_save == DCACHE_DTLB2_READ_CACHE ) ||
     4946             ( r_dcache_fsm_save == DCACHE_TLB1_READ )        || ( r_dcache_fsm_save == DCACHE_TLB2_READ )        ||
     4947             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT )     ||
     4948             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )     || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT )     ||
     4949             ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT )   ||
     4950             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )        || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT )) && (dreq.valid) )
     4951        {
     4952            m_cost_data_tlb_miss_frz++;
     4953        }
    48414954
    48424955        if ( r_dcache_itlb_inval_req || r_dcache_dtlb_inval_req ) break;
     
    48784991    case DCACHE_ITLB_CLEANUP:
    48794992    {
    4880         if ( dreq.valid ) m_cost_data_waste_wait_frz++;
     4993        if ( dreq.valid ) m_cost_data_miss_frz++;
    48814994
    48824995        r_dcache.setinbit(((paddr_t)r_dcache_itlb_cleanup_line.read()*m_dcache_words*2), r_dcache_in_itlb, false);
     
    49735086        m_cpt_frz_cycles++;
    49745087    }
    4975 
     5088    if ( dreq.valid && !drsp.valid )
     5089    {
     5090        m_cpt_dcache_frz_cycles++;
     5091    }
     5092    for (size_t way = 0; way < m_dcache_ways; way++ )
     5093    {   
     5094        for (size_t set = 0; set < m_dcache_sets; set++ )
     5095        {
     5096            if (r_dcache_in_itlb[way*m_dcache_sets+set] || r_dcache_in_dtlb[way*m_dcache_sets+set])
     5097                m_cpt_tlb_occup_dcache++;
     5098        }
     5099    }
    49765100    ////////////////////////////////////////////////////////////////////////////
    49775101    //     VCI_CMD FSM
     
    50065130        {
    50075131            r_vci_cmd_fsm = CMD_INS_CLEANUP;
     5132            m_cpt_icleanup_transaction++;
    50085133        }
    50095134        else if (r_dcache_cleanup_req)
    50105135        {
    50115136            r_vci_cmd_fsm = CMD_DATA_CLEANUP;
     5137            m_cpt_dcleanup_transaction++;
    50125138        }
    50135139        else if (r_dcache_itlb_read_req)           
     
    50195145        {
    50205146            r_vci_cmd_fsm = CMD_ITLB_ACC_LL;
    5021             m_cpt_itlb_write_transaction++;
     5147            m_cpt_itlb_ll_transaction++;
    50225148        }
    50235149        else if (r_dcache_itlb_sc_acc_req)
    50245150        {
    50255151            r_vci_cmd_fsm = CMD_ITLB_ACC_SC;
    5026             m_cpt_itlb_write_transaction++;
     5152            m_cpt_itlb_sc_transaction++;
    50275153        }
    50285154        else if (r_icache_miss_req)
     
    50345160        {   
    50355161            r_vci_cmd_fsm = CMD_INS_UNC;
    5036             m_cpt_imiss_transaction++;
     5162            m_cpt_icache_unc_transaction++;
    50375163        } 
    50385164        else if (r_dcache_tlb_read_req)
     
    50445170        { 
    50455171            r_vci_cmd_fsm = CMD_DTLB_ACC_LL;
    5046             m_cpt_dtlb_write_transaction++;
     5172            m_cpt_dtlb_ll_transaction++;
    50475173        }
    50485174        else if (r_dcache_tlb_sc_acc_req)
    50495175        { 
    50505176            r_vci_cmd_fsm = CMD_DTLB_ACC_SC;
    5051             m_cpt_dtlb_write_transaction++;
     5177            m_cpt_dtlb_sc_transaction++;
    50525178        }
    50535179        else if (r_dcache_tlb_ll_dirty_req)
    50545180        { 
    50555181            r_vci_cmd_fsm = CMD_DTLB_DIRTY_LL;
    5056             m_cpt_dtlb_write_transaction++;
     5182            m_cpt_dtlb_ll_dirty_transaction++;
    50575183        }
    50585184        else if (r_dcache_tlb_sc_dirty_req)
    50595185        { 
    50605186            r_vci_cmd_fsm = CMD_DTLB_DIRTY_SC;
    5061             m_cpt_dtlb_write_transaction++;
     5187            m_cpt_dtlb_sc_dirty_transaction++;
    50625188        }
    50635189        else if (r_dcache_write_req)
     
    52135339
    52145340    case RSP_ITLB_ACC_LL:
     5341        m_cost_itlb_ll_transaction++;
    52155342        if ( ! p_vci_ini_rw.rspval.read() )
    52165343            break;
     
    52325359
    52335360    case RSP_ITLB_ACC_SC:
     5361        m_cost_itlb_sc_transaction++;
    52345362        if ( ! p_vci_ini_rw.rspval.read() )
    52355363            break;
     
    52765404
    52775405    case RSP_INS_UNC:
    5278         m_cost_imiss_transaction++;
     5406        m_cost_icache_unc_transaction++;
    52795407        if ( ! p_vci_ini_rw.rspval.read() )
    52805408            break;
     
    53185446
    53195447    case RSP_DTLB_ACC_LL:
     5448        m_cost_dtlb_ll_transaction++;
    53205449        if ( ! p_vci_ini_rw.rspval.read() )
    53215450            break;
     
    53375466
    53385467    case RSP_DTLB_ACC_SC:
     5468        m_cost_dtlb_sc_transaction++;
    53395469        if ( ! p_vci_ini_rw.rspval.read() )
    53405470            break;
     
    53575487
    53585488    case RSP_DTLB_DIRTY_LL:
     5489        m_cost_dtlb_ll_dirty_transaction++;
    53595490        if ( ! p_vci_ini_rw.rspval.read() )
    53605491            break;
     
    53765507
    53775508    case RSP_DTLB_DIRTY_SC:
     5509        m_cost_dtlb_sc_dirty_transaction++;
    53785510        if ( ! p_vci_ini_rw.rspval.read() )
    53795511            break;
     
    54575589    case RSP_INS_CLEANUP:
    54585590    case RSP_DATA_CLEANUP:
     5591        if ( r_vci_rsp_fsm == RSP_INS_CLEANUP )
     5592        {
     5593            m_cost_icleanup_transaction++;
     5594        }
     5595        else
     5596        {                                   
     5597            m_cost_dcleanup_transaction++;
     5598        }
     5599
    54595600        if ( ! p_vci_ini_c.rspval.read() )
    54605601            break;
  • trunk/modules/vci_cc_vcache_wrapper_v1/caba/source/include/vci_cc_vcache_wrapper_v1.h

    r38 r48  
    313313    sc_signal<size_t>       r_dcache_way;
    314314    sc_signal<size_t>       r_dcache_set;
    315     sc_signal<bool>         r_dcache_cleanup_check_req;
    316315    sc_signal<bool>         r_dcache_cleanup_req;
    317316    sc_signal<data_t>       r_dcache_cleanup_line;
     
    347346    sc_signal<size_t>       r_icache_way;
    348347    sc_signal<size_t>       r_icache_set;
    349     sc_signal<bool>         r_icache_cleanup_check_req;
    350348    sc_signal<bool>         r_icache_cleanup_req;
    351349    sc_signal<data_t>       r_icache_cleanup_line;
     
    383381    sc_signal<bool>         r_tgt_icache_req;
    384382    sc_signal<bool>         r_tgt_dcache_req;
    385     sc_signal<bool>         r_tgt_icache_tlb_req;
    386     sc_signal<bool>         r_tgt_dcache_tlb_req;
    387383    sc_signal<bool>         r_tgt_icache_rsp;
    388384    sc_signal<bool>         r_tgt_dcache_rsp;
     
    440436    uint32_t m_cost_unc_read_frz;           // number of frozen cycles related to uncached read of cache
    441437    uint32_t m_cost_ins_miss_frz;           // number of frozen cycles related to ins miss of cache
    442     uint32_t m_cost_cc_wait_frz;            // number of frozen cycles related to cc check
    443438
    444439    uint32_t m_cpt_imiss_transaction;       // number of VCI instruction miss transactions
     
    446441    uint32_t m_cpt_unc_transaction;         // number of VCI uncached read transactions
    447442    uint32_t m_cpt_write_transaction;       // number of VCI write transactions
     443    uint32_t m_cpt_icache_unc_transaction;  // number of VCI instruction uncached transactions
    448444
    449445    uint32_t m_cost_imiss_transaction;      // cumulated duration for VCI IMISS transactions
    450446    uint32_t m_cost_dmiss_transaction;      // cumulated duration for VCI DMISS transactions
    451447    uint32_t m_cost_unc_transaction;        // cumulated duration for VCI UNC transactions
     448    uint32_t m_cost_icache_unc_transaction; // cumulated duration for VCI IUNC transactions   
    452449    uint32_t m_cost_write_transaction;      // cumulated duration for VCI WRITE transactions
    453450    uint32_t m_length_write_transaction;    // cumulated length for VCI WRITE transactions
     
    456453    uint32_t m_cpt_ins_tlb_read;            // number of instruction tlb read
    457454    uint32_t m_cpt_ins_tlb_miss;            // number of instruction tlb miss
    458     uint32_t m_cpt_ins_tlb_write_et;        // number of instruction tlb write ET
    459 
     455    uint32_t m_cpt_ins_tlb_update_acc;      // number of instruction tlb update acc
    460456    uint32_t m_cpt_data_tlb_read;           // number of data tlb read
    461457    uint32_t m_cpt_data_tlb_miss;           // number of data tlb miss
    462     uint32_t m_cpt_data_tlb_write_et;       // number of data tlb write ET
    463     uint32_t m_cpt_data_tlb_write_dirty;    // number of data tlb write dirty
     458    uint32_t m_cpt_data_tlb_update_acc;     // number of data tlb update acc
     459    uint32_t m_cpt_data_tlb_update_dirty;   // number of data tlb update dirty
    464460   
    465461    uint32_t m_cost_ins_tlb_miss_frz;       // number of frozen cycles related to instruction tlb miss
    466462    uint32_t m_cost_data_tlb_miss_frz;      // number of frozen cycles related to data tlb miss
    467     uint32_t m_cost_ins_tlb_flush_frz;      // number of cycles for instruction tlb flush
    468     uint32_t m_cost_data_tlb_flush_frz;     // number of cycles for data tlb flush
    469     uint32_t m_cost_ins_cache_flush_frz;    // number of cycles for instruction cache flush
    470     uint32_t m_cost_data_cache_flush_frz;   // number of cycles for data cache flush
    471     uint32_t m_cost_data_waste_wait_frz;
     463    uint32_t m_cost_ins_tlb_update_acc_frz;      // number of cycles for instruction tlb flush
     464    uint32_t m_cost_data_tlb_update_acc_frz;     // number of cycles for data tlb flush
     465    uint32_t m_cost_data_tlb_update_dirty_frz;    // number of cycles for instruction cache flush
    472466
    473467    uint32_t m_cpt_itlbmiss_transaction;    // number of itlb miss transactions
    474     uint32_t m_cpt_itlb_write_transaction;  // number of itlb write ET transactions
     468    uint32_t m_cpt_itlb_ll_transaction;        // number of itlb ll acc transactions
     469    uint32_t m_cpt_itlb_sc_transaction;        // number of itlb sc acc transactions
    475470    uint32_t m_cpt_dtlbmiss_transaction;    // number of dtlb miss transactions
    476     uint32_t m_cpt_dtlb_write_transaction;  // number of dtlb write ET and dirty transactions
     471    uint32_t m_cpt_dtlb_ll_transaction;        // number of dtlb ll acc transactions
     472    uint32_t m_cpt_dtlb_sc_transaction;        // number of dtlb sc acc transactions
     473    uint32_t m_cpt_dtlb_ll_dirty_transaction;  // number of dtlb ll dirty transactions
     474    uint32_t m_cpt_dtlb_sc_dirty_transaction;  // number of dtlb sc dirty transactions   
    477475
    478476    uint32_t m_cost_itlbmiss_transaction;   // cumulated duration for VCI instruction TLB miss transactions
    479     uint32_t m_cost_itlb_write_transaction; // cumulated duration for VCI instruction TLB write ET transactions
     477    uint32_t m_cost_itlb_ll_transaction;      // cumulated duration for VCI instruction TLB ll acc transactions
     478    uint32_t m_cost_itlb_sc_transaction;      // cumulated duration for VCI instruction TLB sc acc transactions
    480479    uint32_t m_cost_dtlbmiss_transaction;   // cumulated duration for VCI data TLB miss transactions
    481     uint32_t m_cost_dtlb_write_transaction; // cumulated duration for VCI data TLB write transactions
    482 
    483     uint32_t m_cpt_cc_update;               // number of coherence update packets
    484     uint32_t m_cpt_cc_inval;                // number of coherence inval packets
    485     uint32_t m_cpt_cc_broadcast;            // number of coherence inval packets
    486 
    487     uint32_t m_cost_cc_update_frz;          // number of waiting cycles for coherence update
    488     uint32_t m_cost_cc_inval_frz;           // number of waiting cycles for coherence invalidate
     480    uint32_t m_cost_dtlb_ll_transaction;      // cumulated duration for VCI data TLB ll acc transactions
     481    uint32_t m_cost_dtlb_sc_transaction;      // cumulated duration for VCI data TLB sc acc transactions
     482    uint32_t m_cost_dtlb_ll_dirty_transaction;// cumulated duration for VCI data TLB ll dirty transactions
     483    uint32_t m_cost_dtlb_sc_dirty_transaction;// cumulated duration for VCI data TLB sc dirty transactions
     484
     485    uint32_t m_cpt_cc_cleanup_ins;
     486    uint32_t m_cpt_cc_cleanup_data;
     487    uint32_t m_cpt_icleanup_transaction;
     488    uint32_t m_cpt_dcleanup_transaction;
     489    uint32_t m_cost_icleanup_transaction;
     490    uint32_t m_cost_dcleanup_transaction;
     491
     492    uint32_t m_cpt_cc_update_data;              // number of coherence update data packets
     493    uint32_t m_cpt_cc_inval_ins;                // number of coherence inval instruction packets
     494    uint32_t m_cpt_cc_inval_data;               // number of coherence inval data packets
     495    uint32_t m_cpt_cc_broadcast;                // number of coherence broadcast packets
    489496
    490497protected:
  • trunk/modules/vci_cc_vcache_wrapper_v1/caba/source/src/vci_cc_vcache_wrapper_v1.cpp

    r38 r48  
    320320              << "- READ RATE              = " << (float)m_cpt_read/run_cycles << std::endl
    321321              << "- WRITE RATE             = " << (float)m_cpt_write/run_cycles << std::endl
    322               << "- UNCACHED READ RATE     = " << (float)m_cpt_unc_read/m_cpt_read << std::endl
    323               << "- CACHED WRITE RATE      = " << (float)m_cpt_write_cached/m_cpt_write << std::endl
    324322              << "- IMISS_RATE             = " << (float)m_cpt_ins_miss/m_cpt_ins_read << std::endl   
    325323              << "- DMISS RATE             = " << (float)m_cpt_data_miss/(m_cpt_read-m_cpt_unc_read) << std::endl
    326324              << "- INS MISS COST          = " << (float)m_cost_ins_miss_frz/m_cpt_ins_miss << std::endl
    327               << "- IMISS TRANSACTION      = " << (float)m_cost_imiss_transaction/m_cpt_imiss_transaction << std::endl
    328               << "- DMISS COST             = " << (float)m_cost_data_miss_frz/m_cpt_data_miss << std::endl
    329               << "- DMISS TRANSACTION      = " << (float)m_cost_dmiss_transaction/m_cpt_dmiss_transaction << std::endl
     325              << "- DATA MISS COST             = " << (float)m_cost_data_miss_frz/m_cpt_data_miss << std::endl
     326              << "- WRITE COST             = " << (float)m_cost_write_frz/m_cpt_write << std::endl
    330327              << "- UNC COST               = " << (float)m_cost_unc_read_frz/m_cpt_unc_read << std::endl
    331               << "- UNC TRANSACTION        = " << (float)m_cost_unc_transaction/m_cpt_unc_transaction << std::endl
    332               << "- WRITE COST             = " << (float)m_cost_write_frz/m_cpt_write << std::endl
    333               << "- WRITE TRANSACTION      = " << (float)m_cost_write_transaction/m_cpt_write_transaction << std::endl
    334               << "- WRITE LENGTH           = " << (float)m_length_write_transaction/m_cpt_write_transaction << std::endl
     328              << "- UNCACHED READ RATE     = " << (float)m_cpt_unc_read/m_cpt_read << std::endl
     329              << "- CACHED WRITE RATE      = " << (float)m_cpt_write_cached/m_cpt_write << std::endl
    335330              << "- INS TLB MISS RATE      = " << (float)m_cpt_ins_tlb_miss/m_cpt_ins_tlb_read << std::endl
    336331              << "- DATA TLB MISS RATE     = " << (float)m_cpt_data_tlb_miss/m_cpt_data_tlb_read << std::endl
     332              << "- ITLB MISS COST         = " << (float)m_cost_ins_tlb_miss_frz/m_cpt_ins_tlb_miss << std::endl
     333              << "- DTLB MISS COST         = " << (float)m_cost_data_tlb_miss_frz/m_cpt_data_tlb_miss << std::endl     
     334              << "- ITLB UPDATE ACC COST   = " << (float)m_cost_ins_tlb_update_acc_frz/m_cpt_ins_tlb_update_acc << std::endl
     335              << "- DTLB UPDATE ACC COST   = " << (float)m_cost_data_tlb_update_acc_frz/m_cpt_data_tlb_update_acc << std::endl
     336              << "- DTLB UPDATE DIRTY COST = " << (float)m_cost_data_tlb_update_dirty_frz/m_cpt_data_tlb_update_dirty << std::endl
     337              << "- NB CC BROADCAST        = " << m_cpt_cc_broadcast << std::endl
     338              << "- NB CC UPDATE DATA      = " << m_cpt_cc_update_data << std::endl
     339              << "- NB CC INVAL DATA       = " << m_cpt_cc_inval_data << std::endl
     340              << "- NB CC INVAL INS        = " << m_cpt_cc_inval_ins << std::endl
     341              << "- NB CC CLEANUP DATA     = " << m_cpt_cc_cleanup_data << std::endl
     342              << "- NB CC CLEANUP INS      = " << m_cpt_cc_cleanup_ins << std::endl
    337343              << "- ITLB MISS TRANSACTION  = " << (float)m_cost_itlbmiss_transaction/m_cpt_itlbmiss_transaction << std::endl
    338               << "- ITLB WRITE TRANSACTION = " << (float)m_cost_itlb_write_transaction/m_cpt_itlb_write_transaction << std::endl
    339               << "- ITLB MISS COST         = " << (float)m_cost_ins_tlb_miss_frz/(m_cpt_ins_tlb_miss+m_cpt_ins_tlb_write_et) << std::endl
    340               << "- DTLB MISS TRANSACTION  = " << (float)m_cost_dtlbmiss_transaction/m_cpt_dtlbmiss_transaction << std::endl
    341               << "- DTLB WRITE TRANSACTION = " << (float)m_cost_dtlb_write_transaction/m_cpt_dtlb_write_transaction << std::endl
    342               << "- DTLB MISS COST         = " << (float)m_cost_data_tlb_miss_frz/(m_cpt_data_tlb_miss+m_cpt_data_tlb_write_et+m_cpt_data_tlb_write_dirty) << std::endl;
     344              << "- DTLB MISS TRANSACTION  = " << (float)m_cost_dtlbmiss_transaction/m_cpt_dtlbmiss_transaction << std::endl;
    343345}
    344346
     
    396398        r_dcache_xtn_req           = false;
    397399
    398         r_icache_cleanup_check_req = false;
     400        r_dcache_dirty_save      = false;
     401        r_dcache_hit_p_save      = false;
     402        r_dcache_cached_save      = false;
     403
     404        r_icache_buf_unc_valid   = false;
     405        r_dcache_buf_unc_valid   = false;
     406
     407        r_vci_rsp_ins_error      = false;
     408        r_vci_rsp_data_error     = false;
     409
     410        r_icache_id1_save        = 0;
     411        r_icache_ppn_save        = 0;
     412        r_icache_vpn_save        = 0;
     413        r_itlb_translation_valid = false;
     414
     415        r_dcache_id1_save        = 0;
     416        r_dcache_ppn_save        = 0;
     417        r_dcache_vpn_save        = 0;
     418        r_dtlb_translation_valid = false;
     419
     420        r_icache_ptba_ok         = false;
     421        r_dcache_ptba_ok         = false;
     422
     423        r_icache_error_type      = MMU_NONE;
     424        r_dcache_error_type      = MMU_NONE;
     425
    399426        r_icache_cleanup_req       = false;
    400427        r_icache_cleanup_type      = NONE;
    401428   
    402         r_dcache_cleanup_check_req = false;
    403429        r_dcache_cleanup_req       = false;
    404430        r_dcache_cleanup_type      = NONE;
     
    428454        r_dcache_inval_tlb_rsp     = false;
    429455
    430         r_dcache_dirty_save      = false;
    431         r_dcache_hit_p_save      = false;
    432 
    433         r_icache_buf_unc_valid   = false;
    434         r_dcache_buf_unc_valid   = false;
    435 
    436         r_vci_rsp_ins_error      = false;
    437         r_vci_rsp_data_error     = false;
    438 
    439         r_icache_id1_save        = 0;
    440         r_icache_ppn_save        = 0;
    441         r_icache_vpn_save        = 0;
    442         r_itlb_translation_valid = false;
    443 
    444         r_dcache_id1_save        = 0;
    445         r_dcache_ppn_save        = 0;
    446         r_dcache_vpn_save        = 0;
    447         r_dtlb_translation_valid = false;
    448 
    449         r_icache_ptba_ok         = false;
    450         r_dcache_ptba_ok         = false;
    451 
    452         r_icache_error_type      = MMU_NONE;
    453         r_dcache_error_type      = MMU_NONE;
    454 
    455456        // activity counters
    456457        m_cpt_dcache_data_read  = 0;
     
    479480        m_cost_ins_miss_frz  = 0;
    480481
    481         m_cpt_imiss_transaction = 0;
    482         m_cpt_dmiss_transaction = 0;
    483         m_cpt_unc_transaction   = 0;
    484         m_cpt_write_transaction = 0;
    485 
    486         m_cost_imiss_transaction   = 0;
    487         m_cost_dmiss_transaction   = 0;
    488         m_cost_unc_transaction     = 0;
    489         m_cost_write_transaction   = 0;
    490         m_length_write_transaction = 0;
     482        m_cpt_imiss_transaction      = 0;
     483        m_cpt_dmiss_transaction      = 0;
     484        m_cpt_unc_transaction        = 0;
     485        m_cpt_write_transaction      = 0;
     486        m_cpt_icache_unc_transaction = 0;
     487
     488        m_cost_imiss_transaction      = 0;
     489        m_cost_dmiss_transaction      = 0;
     490        m_cost_unc_transaction        = 0;
     491        m_cost_write_transaction      = 0;
     492        m_cost_icache_unc_transaction = 0;
     493        m_length_write_transaction    = 0;
    491494
    492495        m_cpt_ins_tlb_read         = 0;             
    493496        m_cpt_ins_tlb_miss         = 0;             
    494         m_cpt_ins_tlb_write_et     = 0;         
    495 
    496         m_cpt_data_tlb_read        = 0;           
    497         m_cpt_data_tlb_miss        = 0;           
    498         m_cpt_data_tlb_write_et    = 0;       
    499         m_cpt_data_tlb_write_dirty = 0;   
    500 
    501         m_cost_ins_tlb_miss_frz    = 0;     
    502         m_cost_data_tlb_miss_frz   = 0;     
    503 
    504         m_cpt_itlbmiss_transaction   = 0;   
    505         m_cpt_itlb_write_transaction = 0; 
    506         m_cpt_dtlbmiss_transaction   = 0; 
    507         m_cpt_dtlb_write_transaction = 0; 
     497        m_cpt_ins_tlb_update_acc   = 0;         
     498
     499        m_cpt_data_tlb_read         = 0;           
     500        m_cpt_data_tlb_miss         = 0;           
     501        m_cpt_data_tlb_update_acc   = 0;       
     502        m_cpt_data_tlb_update_dirty = 0;   
     503
     504        m_cost_ins_tlb_miss_frz          = 0;     
     505        m_cost_data_tlb_miss_frz         = 0;     
     506        m_cost_ins_tlb_update_acc_frz    = 0;
     507        m_cost_data_tlb_update_acc_frz   = 0;
     508        m_cost_data_tlb_update_dirty_frz = 0;
     509
     510        m_cpt_itlbmiss_transaction      = 0;   
     511        m_cpt_itlb_ll_transaction       = 0; 
     512        m_cpt_itlb_sc_transaction       = 0; 
     513        m_cpt_dtlbmiss_transaction      = 0; 
     514        m_cpt_dtlb_ll_transaction       = 0; 
     515        m_cpt_dtlb_sc_transaction       = 0; 
     516        m_cpt_dtlb_ll_dirty_transaction = 0; 
     517        m_cpt_dtlb_sc_dirty_transaction = 0; 
    508518 
    509         m_cost_itlbmiss_transaction   = 0;   
    510         m_cost_itlb_write_transaction = 0; 
    511         m_cost_dtlbmiss_transaction   = 0;   
    512         m_cost_dtlb_write_transaction = 0; 
     519        m_cost_itlbmiss_transaction      = 0;   
     520        m_cost_itlb_ll_transaction       = 0; 
     521        m_cost_itlb_sc_transaction       = 0; 
     522        m_cost_dtlbmiss_transaction      = 0;   
     523        m_cost_dtlb_ll_transaction       = 0;   
     524        m_cost_dtlb_sc_transaction       = 0;   
     525        m_cost_dtlb_ll_dirty_transaction = 0;   
     526        m_cost_dtlb_sc_dirty_transaction = 0;   
     527
     528        m_cpt_cc_cleanup_ins        = 0;
     529        m_cpt_cc_cleanup_data       = 0;
     530        m_cpt_icleanup_transaction  = 0;
     531        m_cpt_dcleanup_transaction  = 0;
     532        m_cost_icleanup_transaction = 0;
     533        m_cost_dcleanup_transaction = 0;
     534
     535        m_cpt_cc_update_data = 0;               
     536        m_cpt_cc_inval_ins   = 0;               
     537        m_cpt_cc_inval_data  = 0;               
     538        m_cpt_cc_broadcast   = 0;
    513539        return;
    514540    }
     
    630656                    r_tgt_update = false;
    631657                    r_vci_tgt_fsm = TGT_REQ_DCACHE;
    632                     m_cpt_cc_inval++ ;
     658                    m_cpt_cc_inval_data++ ;
    633659                }
    634660                else if (cell == 4)                // update
     
    642668                    r_tgt_update = true;
    643669                    r_vci_tgt_fsm = TGT_UPDT_WORD;
    644                     m_cpt_cc_update++ ;
     670                    m_cpt_cc_update_data++ ;
    645671                }     
    646672                        else if (cell == 8)
     
    654680                    r_tgt_update = false;
    655681                    r_vci_tgt_fsm = TGT_REQ_ICACHE;
    656                     m_cpt_cc_inval++ ;
     682                    m_cpt_cc_inval_ins++ ;
    657683                        }
    658684            } // end if address   
     
    853879        if (r_dcache_xtn_req)
    854880        {
    855             if ( ireq.valid ) m_cost_ins_miss_frz++;
    856 
    857881            if ((int)r_dcache_type_save == (int)iss_t::XTN_PTPR) 
    858882            {
     
    889913        if ( r_tgt_icache_req )
    890914        {
    891             if ( ireq.valid ) m_cost_ins_miss_frz++;
    892915            r_icache_fsm = ICACHE_CC_INVAL;
    893916            r_icache_fsm_save = r_icache_fsm;
     
    10111034                r_icache_vaddr_req = ireq.addr;
    10121035                r_icache_fsm = ICACHE_BIS;
    1013                 m_cost_ins_miss_frz++;
     1036                m_cost_ins_tlb_miss_frz++;
    10141037            }
    10151038            else    // cached or uncached access with a correct speculative physical address
     
    10891112                r_icache_fsm = ICACHE_MISS_WAIT;
    10901113                m_cpt_ins_miss++;
    1091                 m_cost_ins_miss_frz++;
    10921114            }
    10931115            else
     
    11161138    {
    11171139        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
    1118 
    11191140        // external cache invalidate request
    11201141        if ( r_tgt_icache_req )
     
    11661187                        r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
    11671188                        r_icache_cleanup_type = TLB_CLEANUP;
     1189                        m_cpt_cc_cleanup_ins++;
    11681190                        }       
    11691191                        else        // PTE
     
    11831205                                r_icache_tlb_ll_req = true;
    11841206                                r_icache_fsm        = ICACHE_TLB1_LL_WAIT;
    1185                                 m_cpt_ins_tlb_write_et++;
     1207                                m_cpt_ins_tlb_update_acc++;
     1208                                m_cost_ins_tlb_update_acc_frz++;
    11861209                                }
    11871210                        }
     
    11981221                                r_icache_tlb_ll_req = true;
    11991222                                r_icache_fsm        = ICACHE_TLB1_LL_WAIT;
    1200                                 m_cpt_ins_tlb_write_et++;
     1223                                m_cpt_ins_tlb_update_acc++;
     1224                                m_cost_ins_tlb_update_acc_frz++;
    12011225                                }
    12021226                            }
     
    12261250                    r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
    12271251                    r_icache_cleanup_type = TLB_CLEANUP;
     1252                    m_cpt_cc_cleanup_ins++;
    12281253                    r_icache_fsm = ICACHE_IDLE; 
    12291254                }
     
    12351260    case ICACHE_TLB1_LL_WAIT:
    12361261    {
     1262        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
     1263        m_cost_ins_tlb_update_acc_frz++;           
     1264
    12371265        // external cache invalidate request
    12381266        if ( r_tgt_icache_req )
     
    12811309    case ICACHE_TLB1_SC_WAIT:
    12821310    {
     1311       if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
     1312        m_cost_ins_tlb_update_acc_frz++;
     1313
    12831314        // external cache invalidate request
    12841315        if ( r_tgt_icache_req )
     
    13411372            r_icache_cleanup_line = victim_index;
    13421373            r_icache_cleanup_type = TLB_CLEANUP;
     1374            m_cpt_cc_cleanup_ins++;
    13431375            r_icache_fsm = ICACHE_IDLE;
    13441376        }
     
    14011433                                r_icache_tlb_ll_req = true;
    14021434                                r_icache_fsm        = ICACHE_TLB2_LL_WAIT;
    1403                                 m_cpt_ins_tlb_write_et++;
     1435                                m_cpt_ins_tlb_update_acc++;
     1436                                m_cost_ins_tlb_update_acc_frz++;
    14041437                                }
    14051438                        }
     
    14161449                                r_icache_tlb_ll_req = true;
    14171450                                r_icache_fsm        = ICACHE_TLB2_LL_WAIT;
    1418                                 m_cpt_ins_tlb_write_et++;
     1451                                m_cpt_ins_tlb_update_acc++;
     1452                                m_cost_ins_tlb_update_acc_frz++;
    14191453                                }
    14201454                            }
     
    14451479                    r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
    14461480                    r_icache_cleanup_type = TLB_CLEANUP;
     1481                    m_cpt_cc_cleanup_ins++;
    14471482                    r_icache_fsm = ICACHE_IDLE; 
    14481483                }
     
    14541489    case ICACHE_TLB2_LL_WAIT:
    14551490    {
     1491        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
     1492        m_cost_ins_tlb_update_acc_frz++;
     1493
    14561494        // external cache invalidate request
    14571495        if ( r_tgt_icache_req )
     
    15001538    case ICACHE_TLB2_SC_WAIT:
    15011539    {
     1540        if ( ireq.valid ) m_cost_ins_tlb_miss_frz++;
     1541        m_cost_ins_tlb_update_acc_frz++;
     1542
    15021543        // external cache invalidate request
    15031544        if ( r_tgt_icache_req )
     
    15611602            r_icache_cleanup_line = victim_index;
    15621603            r_icache_cleanup_type = TLB_CLEANUP;
     1604            m_cpt_cc_cleanup_ins++;
    15631605            r_icache_fsm = ICACHE_IDLE;
    15641606        }
     
    15941636                        r_icache_cleanup_line = victim_index;
    15951637                        r_icache_cleanup_type = TLB_CLEANUP;
     1638                        m_cpt_cc_cleanup_ins++;
    15961639                        r_icache_way = way + ((set+1)/m_itlb_sets);
    15971640                        r_icache_set = (set+1) % m_itlb_sets;
     
    16271670        size_t set = r_icache_set;
    16281671        bool clean = false;
    1629 
    1630         m_cost_ins_cache_flush_frz++;
    16311672
    16321673        // cache flush and send cleanup to external
     
    16441685                        r_icache_cleanup_line = victim_index;
    16451686                        r_icache_cleanup_type = CACHE_CLEANUP;
     1687                        m_cpt_cc_cleanup_ins++;
    16461688                        r_icache_way = way + ((set+1)/m_icache_sets);
    16471689                        r_icache_set = (set+1) % m_icache_sets;
     
    16701712            r_icache_cleanup_type = TLB_CLEANUP;
    16711713            r_icache_cleanup_line = victim_index;
     1714            m_cpt_cc_cleanup_ins++;
    16721715            r_dcache_xtn_req = false;
    16731716            r_itlb_translation_valid = false;
     
    17081751                r_icache_cleanup_line = ipaddr >> (uint32_log2(m_icache_words) + 2);
    17091752                r_icache_cleanup_type = CACHE_CLEANUP;
     1753                m_cpt_cc_cleanup_ins++;
    17101754            }
    17111755            r_dcache_xtn_req = false;
     
    17331777            r_icache_cleanup_line = ipaddr >> (uint32_log2(m_icache_words) + 2);   
    17341778            r_icache_cleanup_type = CACHE_CLEANUP;
     1779            m_cpt_cc_cleanup_ins++;
    17351780            r_dcache_xtn_req = false;
    17361781            r_icache_fsm = ICACHE_IDLE;
     
    17701815                r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
    17711816                r_icache_cleanup_type = CACHE_CLEANUP;
     1817                m_cpt_cc_cleanup_ins++;
    17721818                r_icache_fsm = ICACHE_IDLE;
    17731819                r_icache_inval_tlb_rsp = false;
    17741820                if ( r_icache_inval_rsp ) r_icache_inval_rsp = false;
    1775                 m_cost_ins_tlb_miss_frz++;
    17761821                break;
    17771822            }
     
    17831828                r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2); 
    17841829                r_icache_cleanup_type = CACHE_CLEANUP;
     1830                m_cpt_cc_cleanup_ins++;
    17851831                r_icache_fsm = ICACHE_IDLE;
    17861832                r_icache_inval_rsp = false;
     
    17941840    case ICACHE_UNC_WAIT:
    17951841    {
    1796         m_cost_ins_miss_frz++;
    17971842        // external cache invalidate request
    17981843        if ( r_tgt_icache_req )
     
    18461891            r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2);
    18471892            r_icache_cleanup_type = CACHE_CLEANUP;
     1893            m_cpt_cc_cleanup_ins++;
    18481894            r_icache_inval_tlb_rsp = false;
    18491895            if ( r_icache_inval_rsp ) r_icache_inval_rsp = false;
     
    18591905                r_icache_cleanup_line = r_icache_paddr_save.read() >> (uint32_log2(m_icache_words) + 2);
    18601906                r_icache_cleanup_type = CACHE_CLEANUP;
     1907                m_cpt_cc_cleanup_ins++;
    18611908                r_icache_inval_rsp = false;
    18621909                r_icache_fsm = ICACHE_IDLE;
     
    18711918                r_icache_cleanup_req = r_icache.update(r_icache_paddr_save.read(), buf, &victim_index);
    18721919                r_icache_cleanup_line = victim_index;         
    1873                 r_icache_cleanup_type = CACHE_CLEANUP;           
     1920                r_icache_cleanup_type = CACHE_CLEANUP;         
     1921                m_cpt_cc_cleanup_ins++;
    18741922                r_icache_fsm = ICACHE_IDLE;
    18751923            }
     
    18901938    case ICACHE_CC_INVAL: 
    18911939    {                       
    1892         if ( ireq.valid ) m_cost_ins_miss_frz++;
    18931940        m_cpt_icache_dir_read += m_icache_ways;
    18941941
    1895         // invalidate cache
     1942        /* activity counter */
     1943        if ( (( r_icache_fsm_save == ICACHE_BIS ) ||( r_icache_fsm_save == ICACHE_MISS_WAIT ) || ( r_icache_fsm_save == ICACHE_MISS_UPDT ) ) && ( ireq.valid ) )       
     1944        {
     1945            m_cost_ins_miss_frz++;
     1946        }
     1947        if( (( r_icache_fsm_save == ICACHE_TLB1_READ )   || ( r_icache_fsm_save == ICACHE_TLB2_READ )    ||
     1948             ( r_icache_fsm_save == ICACHE_TLB1_LL_WAIT )|| ( r_icache_fsm_save == ICACHE_TLB2_LL_WAIT ) ||
     1949             ( r_icache_fsm_save == ICACHE_TLB1_SC_WAIT )|| ( r_icache_fsm_save == ICACHE_TLB2_SC_WAIT ) ||
     1950             ( r_icache_fsm_save == ICACHE_TLB1_UPDT )   || ( r_icache_fsm_save == ICACHE_TLB2_UPDT ))   && (ireq.valid) )
     1951        {
     1952            m_cost_ins_tlb_miss_frz++;
     1953        }
     1954
    18961955        if( (( r_icache_fsm_save == ICACHE_MISS_WAIT ) || ( r_icache_fsm_save == ICACHE_MISS_UPDT ) ) &&
    18971956            ((r_icache_paddr_save.read() & ~((m_icache_words<<2)-1)) == (r_tgt_addr.read() & ~((m_icache_words<<2)-1))) )
     
    19211980    case ICACHE_TLB_CC_INVAL:
    19221981    {
    1923         if ( ireq.valid ) m_cost_ins_miss_frz++;     
     1982         /* activity counter */
     1983        if ( (( r_icache_fsm_save == ICACHE_BIS ) ||( r_icache_fsm_save == ICACHE_MISS_WAIT ) || ( r_icache_fsm_save == ICACHE_MISS_UPDT ) ) && ( ireq.valid ) )       
     1984        {
     1985            m_cost_ins_miss_frz++;
     1986        }   
     1987
     1988        if( (( r_icache_fsm_save == ICACHE_TLB1_READ )   || ( r_icache_fsm_save == ICACHE_TLB2_READ )    ||
     1989             ( r_icache_fsm_save == ICACHE_TLB1_LL_WAIT )|| ( r_icache_fsm_save == ICACHE_TLB2_LL_WAIT ) ||
     1990             ( r_icache_fsm_save == ICACHE_TLB1_SC_WAIT )|| ( r_icache_fsm_save == ICACHE_TLB2_SC_WAIT ) ||
     1991             ( r_icache_fsm_save == ICACHE_TLB1_UPDT )   || ( r_icache_fsm_save == ICACHE_TLB2_UPDT ))   && (ireq.valid) )
     1992        {
     1993            m_cost_ins_tlb_miss_frz++;
     1994        }
    19241995
    19251996            if ( r_icache_tlb_inval_req ) break;
     
    19882059     
    19892060        // r_tgt_addr is number of line
    1990         bool tlb_hit = icache_tlb.cccheck((r_tgt_addr.read() >> (uint32_log2(m_icache_words)+2)),way, set, &way, &set, &end);
    1991    
     2061        bool tlb_hit = icache_tlb.cccheck((r_tgt_addr.read() >> (uint32_log2(m_icache_words)+2)),way, set, &way, &set, &end);     
    19922062        if ( tlb_hit )
    19932063        {
     
    20072077    case INVAL_ITLB_INVAL:
    20082078    {
    2009         //m_cost_ins_tlb_inval_frz++;
    2010  
    20112079        icache_tlb.ccinval(r_ccinval_itlb_way, r_ccinval_itlb_set);
    20122080
     
    21282196            r_dcache_fsm = DCACHE_CC_CHECK;
    21292197            r_dcache_fsm_save = DCACHE_IDLE;
    2130             if ( dreq.valid ) m_cost_data_miss_frz++;
    21312198            break;
    21322199        }       
     
    25092576                r_dcache_hit_p_save = dcache_hit_p;
    25102577                r_dcache_fsm = DCACHE_BIS;
    2511                 m_cost_data_miss_frz++;
     2578                m_cost_data_tlb_miss_frz++;
    25122579            }
    25132580            else  // cached or uncached access with a correct speculative physical address
     
    25452612                        m_cpt_write++;
    25462613                        if ( dcache_cached ) m_cpt_write_cached++;
     2614                        m_cost_write_frz++;
    25472615
    25482616                        if ( dcache_hit_c && dcache_cached )    // cache update required
     
    25532621                        else if ( !dcache_pte_info.d && (r_mmu_mode.read() & DATA_TLB_MASK) )   // dirty bit update required
    25542622                        {
     2623                            m_cpt_data_tlb_update_dirty++;
     2624                            m_cost_data_tlb_update_dirty_frz++;                           
    25552625                            if (dcache_tlb.getpagesize(dcache_tlb_way, dcache_tlb_set))
    25562626                            {
     
    25592629                                r_dcache_tlb_ll_dirty_req = true;
    25602630                                r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2561                                 m_cpt_data_tlb_write_dirty++;
    25622631                            }
    25632632                            else
     
    25692638                                    r_dcache_tlb_ll_dirty_req = true;
    25702639                                    r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2571                                     m_cpt_data_tlb_write_dirty++;
    25722640                                }
    25732641                                else    // get PTBA to calculate the physical address of PTE
     
    25812649                                }
    25822650                            }
    2583                             m_cost_data_tlb_miss_frz++;
    25842651                        }
    25852652                        else                                    // no cache update, not dirty bit update
     
    26852752                else if ( !r_dcache_dirty_save && (r_mmu_mode.read() & DATA_TLB_MASK) )   // dirty bit update required
    26862753                {
     2754                    m_cpt_data_tlb_update_dirty++;
     2755                    m_cost_data_tlb_update_dirty_frz++;                     
    26872756                    if (dcache_tlb.getpagesize(r_dcache_tlb_way_save, r_dcache_tlb_set_save))
    26882757                    {
     
    26912760                        r_dcache_tlb_ll_dirty_req = true;
    26922761                        r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2693                         m_cpt_data_tlb_write_dirty++;
    26942762                    }
    26952763                    else
     
    27012769                            r_dcache_tlb_ll_dirty_req = true;
    27022770                            r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2703                             m_cpt_data_tlb_write_dirty++;
    27042771                        }
    27052772                        else
     
    27132780                        }
    27142781                    }
    2715                     m_cost_data_tlb_miss_frz++;
    27162782                }
    27172783                else                                    // no cache update, not dirty bit update
     
    27352801    case DCACHE_LL_DIRTY_WAIT:
    27362802    {
     2803        m_cost_data_tlb_update_dirty_frz++;
     2804
    27372805        // external cache invalidate request
    27382806        if ( r_tgt_dcache_req )   
     
    27402808            r_dcache_fsm = DCACHE_CC_CHECK;
    27412809            r_dcache_fsm_save = r_dcache_fsm;
    2742             //m_cost_data_waste_wait_frz++;
    27432810            break;
    27442811        }
     
    27842851                    r_dcache_inval_tlb_rsp = false;
    27852852                    r_dcache_fsm = DCACHE_IDLE;
    2786                     m_cost_data_tlb_miss_frz++;
    27872853                }
    27882854                    else if ( r_dcache_inval_rsp )
     
    28042870    case DCACHE_SC_DIRTY_WAIT:
    28052871    {
     2872        m_cost_data_tlb_update_dirty_frz++;
    28062873        // external cache invalidate request
    28072874        if ( r_tgt_dcache_req )   
     
    28092876            r_dcache_fsm = DCACHE_CC_CHECK;
    28102877            r_dcache_fsm_save = r_dcache_fsm;
    2811             //m_cost_data_waste_wait_frz++;
    28122878            break;
    28132879        }
     
    28392905                    if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false;
    28402906                    r_dcache_fsm = DCACHE_IDLE;
    2841                     m_cost_data_tlb_miss_frz++;
    28422907                }
    28432908                    else if ( r_dcache_inval_rsp )
     
    29022967                r_dcache_cleanup_line = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words) + 2); 
    29032968                r_dcache_cleanup_type = TLB_CLEANUP;
     2969                m_cpt_cc_cleanup_data++;
    29042970                r_dcache_inval_tlb_rsp = false;
    29052971                        break;
     
    29322998                    r_dcache_tlb_ll_dirty_req = true;
    29332999                    r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    2934                     m_cpt_data_tlb_write_dirty++;
     3000                    m_cpt_data_tlb_update_dirty_frz++;
    29353001                }
    29363002                else
     
    29453011                r_dcache_cleanup_line = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words) + 2); 
    29463012                r_dcache_cleanup_type = TLB_CLEANUP;
     3013                m_cpt_cc_cleanup_data++;
    29473014
    29483015                }
     
    29623029                        r_dcache_tlb_ll_acc_req = true;
    29633030                        r_dcache_fsm        = DCACHE_TLB1_LL_WAIT;
    2964                         m_cpt_ins_tlb_write_et++;
     3031                        m_cpt_data_tlb_update_acc++;
     3032                        m_cost_data_tlb_update_acc_frz++;
    29653033                        }
    29663034                }
     
    29773045                        r_dcache_tlb_ll_acc_req = true;
    29783046                        r_dcache_fsm        = DCACHE_TLB1_LL_WAIT;
    2979                         m_cpt_ins_tlb_write_et++;
     3047                        m_cpt_data_tlb_update_acc++;
     3048                        m_cost_data_tlb_update_acc_frz++;
    29803049                        }
    29813050                    }
     
    29873056    case DCACHE_TLB1_LL_WAIT:
    29883057    {
     3058        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
     3059        m_cost_data_tlb_update_acc_frz++;
     3060       
    29893061        // external cache invalidate request
    29903062        if ( r_tgt_dcache_req )   
     
    30333105                    r_dcache_inval_tlb_rsp = false;
    30343106                    r_dcache_fsm = DCACHE_IDLE;
    3035                     m_cost_data_tlb_miss_frz++;
    30363107                }
    30373108                        else
     
    30483119    case DCACHE_TLB1_SC_WAIT:
    30493120    {
     3121        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
     3122        m_cost_data_tlb_update_acc_frz++;
     3123
    30503124        // external cache invalidate request
    30513125        if ( r_tgt_dcache_req )   
     
    30813155                    if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false;
    30823156                    r_dcache_fsm = DCACHE_IDLE;
    3083                     m_cost_data_tlb_miss_frz++;
    30843157                }
    30853158                    else if ( r_dcache_tlb_sc_fail )
     
    31073180            r_dcache_fsm = DCACHE_CC_CHECK;
    31083181            r_dcache_fsm_save = r_dcache_fsm;
    3109             //m_cost_data_waste_wait_frz++;
    31103182            break;
    31113183        }
     
    31183190            r_dcache_cleanup_line = victim_index;
    31193191            r_dcache_cleanup_type = TLB_CLEANUP;
     3192            m_cpt_cc_cleanup_data++;
    31203193            r_dcache_fsm = DCACHE_IDLE;
    31213194        }
     
    31693242                r_dcache_cleanup_line = r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words) + 2); 
    31703243                r_dcache_cleanup_type = TLB_CLEANUP;
     3244                m_cpt_cc_cleanup_data++;
    31713245                r_dcache_inval_tlb_rsp = false;
    31723246                        break;
     
    32053279                        r_dcache_tlb_ll_acc_req = true;
    32063280                        r_dcache_fsm = DCACHE_TLB2_LL_WAIT;
    3207                         m_cpt_ins_tlb_write_et++;
     3281                        m_cpt_data_tlb_update_acc++;
     3282                        m_cost_data_tlb_update_acc_frz++;
    32083283                        }
    32093284                }
     
    32203295                        r_dcache_tlb_ll_acc_req = true;
    32213296                        r_dcache_fsm = DCACHE_TLB2_LL_WAIT;
    3222                         m_cpt_ins_tlb_write_et++;
     3297                        m_cpt_data_tlb_update_acc++;
     3298                        m_cost_data_tlb_update_acc_frz++;
    32233299                        }
    32243300                    }
     
    32303306    case DCACHE_TLB2_LL_WAIT:
    32313307    {
     3308        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
     3309        m_cost_data_tlb_update_acc_frz++;
     3310       
    32323311        // external cache invalidate request
    32333312        if ( r_tgt_dcache_req )   
     
    32763355                    r_dcache_inval_tlb_rsp = false;
    32773356                    r_dcache_fsm = DCACHE_IDLE;
    3278                     m_cost_data_tlb_miss_frz++;
    32793357                }
    32803358                        else
     
    32913369    case DCACHE_TLB2_SC_WAIT:
    32923370    {
     3371        if ( dreq.valid ) m_cost_data_tlb_miss_frz++;
     3372        m_cost_data_tlb_update_acc_frz++;
     3373       
    32933374        // external cache invalidate request
    32943375        if ( r_tgt_dcache_req )   
     
    33243405                    if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false;
    33253406                    r_dcache_fsm = DCACHE_IDLE;
    3326                     m_cost_data_tlb_miss_frz++;
    33273407                }
    33283408                    else if ( r_dcache_tlb_sc_fail )
     
    33603440            r_dcache_cleanup_line = victim_index;
    33613441            r_dcache_cleanup_type = TLB_CLEANUP;
     3442            m_cpt_cc_cleanup_data++;
    33623443            r_dcache_fsm = DCACHE_IDLE;
    33633444        }
     
    33773458        size_t set = r_dcache_set;
    33783459        bool clean = false;
    3379 
    3380         m_cost_data_tlb_flush_frz++;
    33813460
    33823461        // 4K page size TLB flush leads to cleanup req 
     
    33943473                        r_dcache_cleanup_line = victim_index;
    33953474                        r_dcache_cleanup_type = TLB_CLEANUP;
     3475                        m_cpt_cc_cleanup_data++;
    33963476                        r_dcache_way = way + ((set+1)/m_dtlb_sets);
    33973477                        r_dcache_set = (set+1) % m_dtlb_sets;
     
    34353515            r_dcache_fsm = DCACHE_CC_CHECK;
    34363516            r_dcache_fsm_save = r_dcache_fsm;
    3437             m_cost_data_waste_wait_frz++;
    34383517            break;
    34393518        } 
     
    34563535                        r_dcache_cleanup_line = victim_index;
    34573536                        r_dcache_cleanup_type = CACHE_CLEANUP;
     3537                        m_cpt_cc_cleanup_data++;
    34583538                        r_dcache_way = way + ((set+1)/m_dcache_sets);
    34593539                        r_dcache_set = (set+1) % m_dcache_sets;
     
    34823562            r_dcache_cleanup_req = dcache_tlb.inval1(r_dcache_wdata_save, &victim_index);
    34833563            r_dcache_cleanup_type = TLB_CLEANUP;
     3564            m_cpt_cc_cleanup_data++;
    34843565            r_dcache_cleanup_line = victim_index;
    34853566            r_dtlb_translation_valid = false;
     
    34983579            r_dcache_fsm = DCACHE_CC_CHECK;
    34993580            r_dcache_fsm_save = r_dcache_fsm;
    3500             m_cost_data_waste_wait_frz++;
    35013581            break;
    35023582        } 
     
    35233603                r_dcache_cleanup_req = r_dcache.inval(dpaddr);
    35243604                r_dcache_cleanup_type = CACHE_CLEANUP;
     3605                m_cpt_cc_cleanup_data++;
    35253606                r_dcache_cleanup_line = dpaddr >> (uint32_log2(m_dcache_words)+2);
    35263607            }
     
    35383619            r_dcache_fsm = DCACHE_CC_CHECK;
    35393620            r_dcache_fsm_save = r_dcache_fsm;
    3540             m_cost_data_waste_wait_frz++;
    35413621            break;
    35423622        } 
     
    35493629            r_dcache_cleanup_req = r_dcache.inval(dpaddr);
    35503630            r_dcache_cleanup_type = CACHE_CLEANUP;
     3631            m_cpt_cc_cleanup_data++;
    35513632            r_dcache_cleanup_line = dpaddr >> (uint32_log2(m_dcache_words)+2);
    35523633            r_dcache_fsm = DCACHE_IDLE;
     
    35693650    case DCACHE_MISS_WAIT:
    35703651    {
     3652        if (dreq.valid) m_cost_data_miss_frz++;
    35713653        // external cache invalidate request
    35723654        if ( r_tgt_dcache_req )
     
    35743656            r_dcache_fsm = DCACHE_CC_CHECK;
    35753657            r_dcache_fsm_save = r_dcache_fsm;
    3576             m_cost_cc_wait_frz++;
    35773658            break;
    35783659        }
     
    35963677                r_dcache_cleanup_req = true;
    35973678                r_dcache_cleanup_type = CACHE_CLEANUP;
     3679                m_cpt_cc_cleanup_data++;
    35983680                r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
    35993681                r_dcache_fsm = DCACHE_IDLE;
     
    36083690                r_dcache_cleanup_req = true;
    36093691                r_dcache_cleanup_type = CACHE_CLEANUP;
     3692                m_cpt_cc_cleanup_data++;
    36103693                r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
    36113694                r_dcache_fsm = DCACHE_IDLE;
     
    36213704    case DCACHE_MISS_UPDT:
    36223705    {
     3706        if (dreq.valid) m_cost_data_miss_frz++;
    36233707        // external cache invalidate request
    36243708        if ( r_tgt_dcache_req )
     
    36343718            r_dcache_cleanup_req = true;
    36353719            r_dcache_cleanup_type = CACHE_CLEANUP;           
     3720            m_cpt_cc_cleanup_data++;
    36363721            r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
    36373722            r_dcache_inval_tlb_rsp = false;
     
    36473732            r_dcache_cleanup_req = true;
    36483733            r_dcache_cleanup_type = CACHE_CLEANUP;           
     3734            m_cpt_cc_cleanup_data++;
    36493735            r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words) + 2); 
    36503736            r_dcache_inval_rsp = false;
    36513737            r_dcache_fsm = DCACHE_IDLE;
    3652             m_cost_data_tlb_miss_frz++;
    36533738            break;
    36543739        }
     
    36573742        {
    36583743            paddr_t  victim_index = 0;
     3744            m_cpt_dcache_data_write++;
     3745            m_cpt_dcache_dir_write++;
    36593746            r_dcache_cleanup_req = r_dcache.update(r_dcache_paddr_save.read(), r_dcache_miss_buf, &victim_index);
    36603747            r_dcache_cleanup_line = victim_index;
    36613748            r_dcache_cleanup_type = CACHE_CLEANUP;
     3749            m_cpt_cc_cleanup_data++;
    36623750            r_dcache_fsm = DCACHE_IDLE;
    36633751        }
     
    36673755    case DCACHE_UNC_WAIT:
    36683756    {
     3757        if ( dreq.valid ) m_cost_unc_read_frz++;
    36693758        // external cache invalidate request
    36703759        if ( r_tgt_dcache_req )
     
    36973786                        r_dcache_cleanup_req = r_dcache.inval(r_dcache_paddr_save);
    36983787                r_dcache_cleanup_type = CACHE_CLEANUP;
     3788                m_cpt_cc_cleanup_data++;
    36993789                        r_dcache_cleanup_line = r_dcache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2);
    37003790            }           
     
    37083798    case DCACHE_WRITE_UPDT:
    37093799    {
     3800        m_cpt_dcache_data_write++;
    37103801        bool write_hit = false;
    37113802        data_t mask = vci_param::be2mask(r_dcache_be_save.read());
     
    37163807        if ( !r_dcache_dirty_save && (r_mmu_mode.read() & DATA_TLB_MASK) )   
    37173808        {
     3809            m_cpt_data_tlb_update_dirty++;
     3810            m_cost_data_tlb_update_dirty_frz++;               
    37183811            if ( dcache_tlb.getpagesize(r_dcache_tlb_way_save, r_dcache_tlb_set_save) ) // 2M page size, one level page table
    37193812            {
     
    37223815                r_dcache_tlb_ll_dirty_req = true;
    37233816                r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    3724                 m_cpt_data_tlb_write_dirty++;
    37253817            }
    37263818            else
     
    37323824                    r_dcache_tlb_ll_dirty_req = true;
    37333825                    r_dcache_fsm = DCACHE_LL_DIRTY_WAIT;
    3734                     m_cpt_data_tlb_write_dirty++;
    37353826                }
    37363827                else
     
    37563847    case DCACHE_WRITE_DIRTY:
    37573848    {
    3758         m_cost_data_tlb_miss_frz++;
     3849        m_cost_data_tlb_update_dirty_frz++;
    37593850
    37603851        // external cache invalidate request
     
    37633854            r_dcache_fsm = DCACHE_CC_CHECK;
    37643855            r_dcache_fsm_save = r_dcache_fsm;
    3765             //m_cost_data_waste_wait_frz++;
    37663856            break;
    37673857        }
     
    37953885        m_cpt_dcache_data_read += m_dcache_ways;
    37963886
    3797         m_cost_cc_wait_frz++;
     3887        /* activity counter */
     3888        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     3889        {
     3890            m_cost_data_miss_frz++;
     3891        }
     3892        if( (( r_dcache_fsm_save == DCACHE_TLB1_READ )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ )    ||
     3893             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT ) ||
     3894             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) ||
     3895             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT ))   && (dreq.valid) )
     3896        {
     3897            m_cost_data_tlb_miss_frz++;
     3898        }
    37983899
    37993900        if(( /*( r_dcache_fsm_save == DCACHE_UNC_WAIT ) ||*/
     
    38413942    case DCACHE_CC_UPDT:    // update directory and data cache       
    38423943    {
     3944        /* activity counter */
     3945        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     3946        {
     3947            m_cost_data_miss_frz++;
     3948        }
     3949        if( (( r_dcache_fsm_save == DCACHE_TLB1_READ )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ )    ||
     3950             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT ) ||
     3951             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) ||
     3952             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT ))   && (dreq.valid) )
     3953        {
     3954            m_cost_data_tlb_miss_frz++;
     3955        }
     3956
    38433957        m_cpt_dcache_dir_write++;
    38443958        m_cpt_dcache_data_write++;
    3845         m_cost_cc_wait_frz++;
    38463959
    38473960        data_t* buf = r_tgt_buf;
     
    38583971    case DCACHE_CC_INVAL:   // invalidate a cache line
    38593972    {
    3860         m_cost_cc_wait_frz++;
     3973        /* activity counter */
     3974        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     3975        {
     3976            m_cost_data_miss_frz++;
     3977        }
     3978        if( (( r_dcache_fsm_save == DCACHE_TLB1_READ )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ )    ||
     3979             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT ) ||
     3980             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) ||
     3981             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT ))   && (dreq.valid) )
     3982        {
     3983            m_cost_data_tlb_miss_frz++;
     3984        }
     3985
    38613986        r_tgt_dcache_rsp = r_dcache.inval(r_tgt_addr.read());
    38623987        if ( r_tgt_broadcast )
     
    38754000    case DCACHE_CC_NOP:     // no external hit
    38764001    {
    3877         m_cost_cc_wait_frz++;
     4002        /* activity counter */
     4003        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     4004        {
     4005            m_cost_data_miss_frz++;
     4006        }
     4007        if( (( r_dcache_fsm_save == DCACHE_TLB1_READ )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ )    ||
     4008             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT ) ||
     4009             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) ||
     4010             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT ))   && (dreq.valid) )
     4011        {
     4012            m_cost_data_tlb_miss_frz++;
     4013        }
     4014
    38784015        r_tgt_dcache_rsp = r_tgt_update;
    38794016        if ( r_tgt_broadcast )
     
    38924029    case DCACHE_TLB_CC_INVAL:
    38934030    {
     4031        /* activity counter */
     4032        if ( (( r_dcache_fsm_save == DCACHE_BIS ) ||( r_dcache_fsm_save == DCACHE_MISS_WAIT ) || ( r_dcache_fsm_save == DCACHE_MISS_UPDT ) ) && ( dreq.valid ) )       
     4033        {
     4034            m_cost_data_miss_frz++;
     4035        }
     4036        if( (( r_dcache_fsm_save == DCACHE_TLB1_READ )   || ( r_dcache_fsm_save == DCACHE_TLB2_READ )    ||
     4037             ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT ) ||
     4038             ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT )|| ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) ||
     4039             ( r_dcache_fsm_save == DCACHE_TLB1_UPDT )   || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT ))   && (dreq.valid) )
     4040        {
     4041            m_cost_data_tlb_miss_frz++;
     4042        }
     4043
    38944044        paddr_t dcache_tlb_nline = 0;
    3895         if ( dreq.valid ) m_cost_data_tlb_miss_frz++;       
    38964045
    38974046            if ( r_dcache_tlb_inval_req ) break;
     
    40524201        {
    40534202            r_vci_cmd_fsm = CMD_INS_CLEANUP;
     4203            m_cpt_icleanup_transaction++;
    40544204        }
    40554205        else if (r_dcache_cleanup_req)
    40564206        {
    40574207            r_vci_cmd_fsm = CMD_DATA_CLEANUP;
     4208            m_cpt_dcleanup_transaction++;
    40584209        }       
    40594210        else if (r_icache_tlb_read_req)           
     
    40654216        { 
    40664217            r_vci_cmd_fsm = CMD_ITLB_ACC_LL;
    4067             //m_cpt_itlb_write_transaction++;
     4218            m_cpt_itlb_ll_transaction++;
    40684219        }
    40694220        else if (r_icache_tlb_sc_req)     
    40704221        { 
    40714222            r_vci_cmd_fsm = CMD_ITLB_ACC_SC;
    4072             //m_cpt_itlb_write_transaction++;
     4223            m_cpt_itlb_sc_transaction++;
    40734224        }
    40744225        else if (r_icache_miss_req)
     
    40804231        {   
    40814232            r_vci_cmd_fsm = CMD_INS_UNC;
    4082             m_cpt_imiss_transaction++;
     4233            m_cpt_icache_unc_transaction++;
    40834234        } 
    40844235        else if (r_dcache_tlb_read_req)
     
    40904241        { 
    40914242            r_vci_cmd_fsm = CMD_DTLB_ACC_LL;
    4092             m_cpt_dtlb_write_transaction++;
     4243            m_cpt_dtlb_ll_transaction++;
    40934244        }
    40944245        else if (r_dcache_tlb_sc_acc_req)
    40954246        { 
    40964247            r_vci_cmd_fsm = CMD_DTLB_ACC_SC;
    4097             m_cpt_dtlb_write_transaction++;
     4248            m_cpt_dtlb_sc_transaction++;
    40984249        }
    40994250        else if (r_dcache_tlb_ll_dirty_req)
    41004251        { 
    41014252            r_vci_cmd_fsm = CMD_DTLB_DIRTY_LL;
    4102             m_cpt_dtlb_write_transaction++;
     4253            m_cpt_dtlb_ll_dirty_transaction++;
    41034254        }
    41044255        else if (r_dcache_tlb_sc_dirty_req)
    41054256        { 
    41064257            r_vci_cmd_fsm = CMD_DTLB_DIRTY_SC;
    4107             m_cpt_dtlb_write_transaction++;
     4258            m_cpt_dtlb_sc_dirty_transaction++;
    41084259        }
    41094260        else if (r_dcache_write_req)
     
    42494400                    "illegal VCI response packet for data read uncached");
    42504401            }
    4251 /*
    42524402            else
    42534403            {
     
    42554405                       "The VCI response packet for instruction miss is too short");
    42564406            }
    4257 */
     4407
    42584408            r_icache_tlb_read_req = false;
    42594409            r_icache_tlb_first_req = false;
     
    42674417
    42684418    case RSP_ITLB_ACC_LL:
     4419        m_cost_itlb_ll_transaction++;
    42694420        if ( ! p_vci_ini_rw.rspval.read() )
    42704421            break;
     
    42864437
    42874438    case RSP_ITLB_ACC_SC:
     4439        m_cost_itlb_sc_transaction++;
    42884440        if ( ! p_vci_ini_rw.rspval.read() )
    42894441            break;
     
    43284480
    43294481    case RSP_INS_UNC:
    4330         m_cost_imiss_transaction++;
     4482        m_cost_icache_unc_transaction++;
    43314483        if ( ! p_vci_ini_rw.rspval.read() )
    43324484            break;
     
    43604512                    "illegal VCI response packet for data read uncached");
    43614513            }
    4362 /*
    43634514            else
    43644515            {
     
    43664517                       "The VCI response packet for instruction miss is too short");
    43674518            }
    4368 */
     4519
    43694520            r_dcache_tlb_read_req = false;
    43704521            r_dcache_tlb_first_req = false;
     
    43784529
    43794530    case RSP_DTLB_ACC_LL:
     4531        m_cost_dtlb_ll_transaction++;
    43804532        if ( ! p_vci_ini_rw.rspval.read() )
    43814533            break;
     
    43974549
    43984550    case RSP_DTLB_ACC_SC:
     4551        m_cost_dtlb_sc_transaction++;
    43994552        if ( ! p_vci_ini_rw.rspval.read() )
    44004553            break;
     
    44164569
    44174570    case RSP_DTLB_DIRTY_LL:
     4571        m_cost_dtlb_ll_dirty_transaction++;
    44184572        if ( ! p_vci_ini_rw.rspval.read() )
    44194573            break;
     
    44354589
    44364590    case RSP_DTLB_DIRTY_SC:
     4591        m_cost_dtlb_sc_dirty_transaction++;
    44374592        if ( ! p_vci_ini_rw.rspval.read() )
    44384593            break;
     
    45154670    case RSP_INS_CLEANUP:
    45164671    case RSP_DATA_CLEANUP:
     4672        if ( r_vci_rsp_fsm == RSP_INS_CLEANUP )
     4673        {
     4674            m_cost_icleanup_transaction++;
     4675        }
     4676        else
     4677        {                                   
     4678            m_cost_dcleanup_transaction++;
     4679        }
     4680
    45174681        if ( ! p_vci_ini_c.rspval.read() )
    45184682            break;
Note: See TracChangeset for help on using the changeset viewer.