Ignore:
Timestamp:
Jan 20, 2011, 4:27:47 PM (14 years ago)
Author:
gao
Message:

Cleanup fsm seperated from vci fsm to evite deadlock

Location:
trunk/modules/vci_cc_vcache_wrapper2_v1/caba/source
Files:
2 edited

Legend:

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

    r120 r130  
    565565    void print_cpi();
    566566    void print_stats();
     567    void clear_stats();
     568    void print_trace(size_t mode = 0);
    567569
    568570private:
  • trunk/modules/vci_cc_vcache_wrapper2_v1/caba/source/src/vci_cc_vcache_wrapper2_v1.cpp

    r120 r130  
    3535//#define EVALUATION_CACHE
    3636
    37 #ifdef SOCLIB_MODULE_DEBUG
     37//#ifdef SOCLIB_MODULE_DEBUG
    3838namespace {
    3939const char *icache_fsm_state_str[] = {
     
    169169    };
    170170}
    171 #endif
     171//#endif
    172172
    173173#define tmpl(...)  template<typename vci_param, typename iss_t> __VA_ARGS__ VciCcVCacheWrapper2V1<vci_param, iss_t>
     
    368368    std::cout << name() << " CPI = "
    369369        << (float)m_cpt_total_cycles/(m_cpt_total_cycles - m_cpt_frz_cycles) << std::endl ;
     370}
     371
     372////////////////////////////////////
     373tmpl(void)::print_trace(size_t mode)
     374////////////////////////////////////
     375{
     376    typename iss_t::InstructionRequest  ireq;
     377    typename iss_t::DataRequest         dreq;
     378
     379    m_iss.getRequests( ireq, dreq );
     380   
     381    std::cout << std::dec << "L1_(" << name() << ") cycle: " << m_cpt_total_cycles << std::endl;
     382    std::cout << " Proc state: PC = " << std::hex << ireq.addr << " / AD = " << dreq.addr
     383              << std::dec << " / V = " << dreq.valid << " / TYPE = " << dreq.type << std::endl;
     384   
     385    std::cout << " Cache state:"
     386              << " tgt fsm: " << tgt_fsm_state_str[r_vci_tgt_fsm]
     387              << " dcache fsm: " << dcache_fsm_state_str[r_dcache_fsm]
     388              << " icache fsm: " << icache_fsm_state_str[r_icache_fsm]
     389              << " cmd fsm: " << cmd_fsm_state_str[r_vci_cmd_fsm]
     390              << " rsp fsm: " << rsp_fsm_state_str[r_vci_rsp_fsm]
     391              << " cleanup fsm: " << cleanup_fsm_state_str[r_cleanup_fsm]
     392              << " inval itlb fsm: " << inval_itlb_fsm_state_str[r_inval_itlb_fsm]
     393              << " inval dtlb fsm: " << inval_dtlb_fsm_state_str[r_inval_dtlb_fsm] << std::endl;
     394
     395    if( r_vci_tgt_fsm != TGT_IDLE )
     396        std::cout << "    ... coherence request address = " << std::hex << r_tgt_addr.read() << std::endl;
     397   
     398    if(mode & 0x1)
     399    {
     400        r_wbuf.printTrace();
     401    }
    370402}
    371403
     
    411443        << "- ITLB MISS TRANSACTION  = " << (float)m_cost_itlbmiss_transaction/m_cpt_itlbmiss_transaction << std::endl
    412444        << "- DTLB MISS TRANSACTION  = " << (float)m_cost_dtlbmiss_transaction/m_cpt_dtlbmiss_transaction << std::endl;
     445}
     446
     447////////////////////////
     448tmpl(void)::clear_stats()
     449////////////////////////
     450{
     451    m_cpt_dcache_data_read  = 0;
     452    m_cpt_dcache_data_write = 0;
     453    m_cpt_dcache_dir_read   = 0;
     454    m_cpt_dcache_dir_write  = 0;
     455    m_cpt_icache_data_read  = 0;
     456    m_cpt_icache_data_write = 0;
     457    m_cpt_icache_dir_read   = 0;
     458    m_cpt_icache_dir_write  = 0;
     459   
     460        m_cpt_frz_cycles        = 0;
     461    m_cpt_dcache_frz_cycles = 0;
     462        m_cpt_total_cycles      = 0;
     463   
     464    m_cpt_read         = 0;
     465    m_cpt_write        = 0;
     466    m_cpt_data_miss    = 0;
     467    m_cpt_ins_miss     = 0;
     468    m_cpt_unc_read     = 0;
     469    m_cpt_write_cached = 0;
     470    m_cpt_ins_read     = 0;
     471   
     472    m_cost_write_frz     = 0;
     473    m_cost_data_miss_frz = 0;
     474    m_cost_unc_read_frz  = 0;
     475    m_cost_ins_miss_frz  = 0;
     476   
     477    m_cpt_imiss_transaction      = 0;
     478    m_cpt_dmiss_transaction      = 0;
     479    m_cpt_unc_transaction        = 0;
     480    m_cpt_write_transaction      = 0;
     481    m_cpt_icache_unc_transaction = 0;   
     482   
     483    m_cost_imiss_transaction      = 0;
     484    m_cost_dmiss_transaction      = 0;
     485    m_cost_unc_transaction        = 0;
     486    m_cost_write_transaction      = 0;
     487    m_cost_icache_unc_transaction = 0;
     488    m_length_write_transaction    = 0;
     489   
     490    m_cpt_ins_tlb_read       = 0;             
     491    m_cpt_ins_tlb_miss       = 0;             
     492    m_cpt_ins_tlb_update_acc = 0;         
     493   
     494    m_cpt_data_tlb_read         = 0;           
     495    m_cpt_data_tlb_miss         = 0;           
     496    m_cpt_data_tlb_update_acc   = 0;       
     497    m_cpt_data_tlb_update_dirty = 0;   
     498    m_cpt_ins_tlb_hit_dcache    = 0;
     499    m_cpt_data_tlb_hit_dcache   = 0;
     500    m_cpt_ins_tlb_occup_cache   = 0;
     501    m_cpt_data_tlb_occup_cache  = 0;
     502   
     503    m_cost_ins_tlb_miss_frz          = 0;     
     504    m_cost_data_tlb_miss_frz         = 0;     
     505    m_cost_ins_tlb_update_acc_frz    = 0;
     506    m_cost_data_tlb_update_acc_frz   = 0;
     507    m_cost_data_tlb_update_dirty_frz = 0;
     508    m_cost_ins_tlb_occup_cache_frz   = 0;
     509    m_cost_data_tlb_occup_cache_frz  = 0;
     510   
     511    m_cpt_itlbmiss_transaction      = 0;   
     512    m_cpt_itlb_ll_transaction       = 0; 
     513    m_cpt_itlb_sc_transaction       = 0; 
     514    m_cpt_dtlbmiss_transaction      = 0; 
     515    m_cpt_dtlb_ll_transaction       = 0; 
     516    m_cpt_dtlb_sc_transaction       = 0; 
     517    m_cpt_dtlb_ll_dirty_transaction = 0; 
     518    m_cpt_dtlb_sc_dirty_transaction = 0; 
     519   
     520    m_cost_itlbmiss_transaction      = 0;   
     521    m_cost_itlb_ll_transaction       = 0; 
     522    m_cost_itlb_sc_transaction       = 0; 
     523    m_cost_dtlbmiss_transaction      = 0;   
     524    m_cost_dtlb_ll_transaction       = 0;   
     525    m_cost_dtlb_sc_transaction       = 0;   
     526    m_cost_dtlb_ll_dirty_transaction = 0;   
     527    m_cost_dtlb_sc_dirty_transaction = 0;
     528
     529    m_cpt_cc_broadcast  = 0;
     530    m_cpt_cc_update_data = 0;
     531    m_cpt_cc_inval_data = 0;
     532    m_cpt_cc_inval_ins = 0;
     533    m_cpt_cc_cleanup_data = 0;
     534    m_cpt_cc_cleanup_ins = 0;
    413535}
    414536
     
    11591281    case ICACHE_BIS:
    11601282    {
    1161         if ( ireq.valid ) m_cost_ins_miss_frz++;
     1283        //if ( ireq.valid ) m_cost_ins_miss_frz++;
    11621284
    11631285        // external cache invalidate request
     
    27492871                r_dcache_hit_p_save = dcache_hit_p;
    27502872                r_dcache_fsm = DCACHE_BIS;
    2751                 m_cost_data_tlb_miss_frz++;
     2873                //m_cost_data_tlb_miss_frz++;
    27522874            }
    27532875            else  // cached or uncached access with a correct speculative physical address
     
    29173039    case DCACHE_BIS:
    29183040    {
    2919         if ( dreq.valid ) m_cost_data_miss_frz++;
     3041        //if ( dreq.valid ) m_cost_data_miss_frz++;
    29203042
    29213043        // external cache invalidate request
     
    51595281    case DCACHE_ITLB_CLEANUP:
    51605282    {
    5161         if ( dreq.valid ) m_cost_data_miss_frz++;
     5283        //if ( dreq.valid ) m_cost_data_miss_frz++;
    51625284
    51635285        r_dcache.setinbit(((paddr_t)r_dcache_itlb_cleanup_line.read()<<(uint32_log2(m_dcache_words)+2)), r_dcache_in_itlb, false);
     
    52955417
    52965418        r_vci_cmd_cpt = 0;
     5419
     5420        if ( (r_dcache_cleanup_req && r_dcache_itlb_read_req && (((r_icache_paddr_save.read() & ~((m_dcache_words<<2)-1)) >> (uint32_log2(m_dcache_words) + 2)) == r_dcache_cleanup_line.read()))
     5421          || (r_dcache_cleanup_req && r_dcache_tlb_read_req && (((r_dcache_tlb_paddr.read() & ~((m_dcache_words<<2)-1)) >> (uint32_log2(m_dcache_words) + 2)) == r_dcache_cleanup_line.read()))
     5422          || (r_dcache_cleanup_req && r_dcache_miss_req && (((r_dcache_paddr_save.read() & ~((m_dcache_words<<2)-1)) >> (uint32_log2(m_dcache_words) + 2)) == r_dcache_cleanup_line.read()))
     5423          || (r_icache_cleanup_req && r_icache_miss_req && (((r_icache_paddr_save.read() & ~((m_icache_words<<2)-1)) >> (uint32_log2(m_icache_words) + 2)) == r_icache_cleanup_line.read())) )
     5424        {
     5425            break;
     5426        }
     5427
    52975428        if (r_dcache_itlb_read_req)           
    52985429        {           
     
    54035534
    54045535        r_vci_rsp_cpt = 0;
     5536
     5537        if ( (r_dcache_cleanup_req && r_dcache_itlb_read_req && (((r_icache_paddr_save.read() & ~((m_dcache_words<<2)-1)) >> (uint32_log2(m_dcache_words) + 2)) == r_dcache_cleanup_line.read()))
     5538          || (r_dcache_cleanup_req && r_dcache_tlb_read_req && (((r_dcache_tlb_paddr.read() & ~((m_dcache_words<<2)-1)) >> (uint32_log2(m_dcache_words) + 2)) == r_dcache_cleanup_line.read()))
     5539          || (r_dcache_cleanup_req && r_dcache_miss_req && (((r_dcache_paddr_save.read() & ~((m_dcache_words<<2)-1)) >> (uint32_log2(m_dcache_words) + 2)) == r_dcache_cleanup_line.read()))
     5540          || (r_icache_cleanup_req && r_icache_miss_req && (((r_icache_paddr_save.read() & ~((m_icache_words<<2)-1)) >> (uint32_log2(m_icache_words) + 2)) == r_icache_cleanup_line.read())) )
     5541        {
     5542            break;
     5543        }
     5544
    54055545        if (r_dcache_itlb_read_req)          // ITLB miss response
    54065546        {           
     
    60776217    } // end switch TGT_FSM
    60786218
    6079 #ifdef SOCLIB_MODULE_DEBUG 
     6219#ifdef SOCLIB_MODULE_DEBUG
    60806220   std::cout << name()
    60816221             << " Moore R/W:" << std::hex
Note: See TracChangeset for help on using the changeset viewer.