Changeset 57 for trunk/modules


Ignore:
Timestamp:
Jun 18, 2010, 4:07:34 PM (14 years ago)
Author:
guthmull
Message:

Fix a bug with uncached reads, add more debug capabilities

Location:
trunk/modules
Files:
4 edited

Legend:

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

    r31 r57  
    445445
    446446    /////////////////////////////////////////////////////////////////////
     447    // The print_list() function prints a list from selected directory entry
     448    // Arguments :
     449    // - ptr : the pointer to the first entry to print
     450    /////////////////////////////////////////////////////////////////////
     451      void print_list(const size_t &ptr){
     452        bool end = false;
     453        size_t ptr_temp = ptr;
     454        std::cout << "Heap, printing the list from : " << std::dec << ptr << std::endl;
     455        while(!end){
     456            m_heap_tab[ptr_temp].print();
     457            if(ptr_temp == m_heap_tab[ptr_temp].next) end = true;
     458            ptr_temp = m_heap_tab[ptr_temp].next;
     459        }
     460      } // end print_list()
     461
     462
     463    /////////////////////////////////////////////////////////////////////
    447464    // The is_full() function return true if the heap is full.
    448465    /////////////////////////////////////////////////////////////////////
  • trunk/modules/vci_mem_cache_v3/caba/source/src/vci_mem_cache_v3.cpp

    r19 r57  
    892892            entry.tag     = r_read_tag.read();
    893893            entry.lock    = r_read_lock.read();
    894             entry.ptr     = 0;
     894            entry.ptr     = r_read_ptr.read();
    895895            if(cached_read){  // Cached read, we update the copy
    896896              if(!is_cnt){ // Not counter mode
  • trunk/modules/vci_mem_cache_v4/caba/source/include/mem_cache_directory_v4.h

    r31 r57  
    440440
    441441    /////////////////////////////////////////////////////////////////////
     442    // The print_list() function prints a list from selected directory entry
     443    // Arguments :
     444    // - ptr : the pointer to the first entry to print
     445    /////////////////////////////////////////////////////////////////////
     446      void print_list(const size_t &ptr){
     447        bool end = false;
     448        size_t ptr_temp = ptr;
     449        std::cout << "Heap, printing the list from : " << std::dec << ptr << std::endl;
     450        while(!end){
     451            m_heap_tab[ptr_temp].print();
     452            if(ptr_temp == m_heap_tab[ptr_temp].next) end = true;
     453            ptr_temp = m_heap_tab[ptr_temp].next;
     454        }
     455      } // end print_list()
     456
     457    /////////////////////////////////////////////////////////////////////
    442458    // The is_full() function return true if the heap is full.
    443459    /////////////////////////////////////////////////////////////////////
  • trunk/modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp

    r19 r57  
    3232//#define IDEBUG // Update tab debug
    3333//#define DDEBUG // Directory debug
     34//#define LOCK_DEBUG // Lock debug
    3435//#define DEBUG_VCI_MEM_CACHE 1
     36#define DEBUG_START_CYCLE 8750000
    3537#define RANDOMIZE_SC
    36 #define NCYCLES -1
    3738namespace soclib { namespace caba {
    3839
     
    134135    "XRAM_RSP_INVAL",
    135136    "XRAM_RSP_WRITE_DIRTY",
     137    "XRAM_RSP_HEAP_ERASE",
     138    "XRAM_RSP_HEAP_LAST",
    136139  };
    137140  const char *ixr_cmd_fsm_str[] = {
     
    581584
    582585#if DEBUG_VCI_MEM_CACHE
    583 if(m_cpt_cycles > NCYCLES){
     586if(m_cpt_cycles > DEBUG_START_CYCLE){
    584587    std::cout << "---------------------------------------------" << std::dec << std::endl;
    585588    std::cout << "MEM_CACHE " << m_srcid_ini << " ; Time = " << m_cpt_cycles << std::endl
     
    758761            bool valid  = m_update_tab.decrement(r_init_rsp_upt_index.read(), count);
    759762#ifdef IDEBUG
     763if(m_cpt_cycles > DEBUG_START_CYCLE){
    760764        std::cout << sc_time_stamp() << " " << name() << " INIT_RSP_UPT_LOCK update table : " << std::endl;
    761765        m_update_tab.print();
     766}
    762767#endif
     768            while(!valid);
    763769            assert ( valid
    764770                && "VCI_MEM_CACHE Invalid UPT entry in VCI response paquet received by memory cache" );
     
    782788            m_update_tab.clear(r_init_rsp_upt_index.read());
    783789#ifdef IDEBUG
     790if(m_cpt_cycles > DEBUG_START_CYCLE){
    784791        std::cout << sc_time_stamp() << " " << name() << " INIT_RSP_UPT_CLEAR update table : " << std::endl;
    785792        m_update_tab.print();
     793}
    786794#endif
    787795          }
     
    835843            DirectoryEntry entry = m_cache_directory.read(m_cmd_read_addr_fifo.read(), way);
    836844#ifdef DDEBUG
     845if(m_cpt_cycles > DEBUG_START_CYCLE){
    837846           std::cout << "In READ_DIR_LOCK printing the entry of address is : " << std::hex << m_cmd_read_addr_fifo.read() << std::endl;
    838847           entry.print();
    839848           std::cout << "done" << std::endl;
     849}
    840850#endif
    841 
    842851            r_read_is_cnt   = entry.is_cnt;
    843852            r_read_dirty    = entry.dirty;
     
    888897            entry.tag     = r_read_tag.read();
    889898            entry.lock    = r_read_lock.read();
    890             entry.ptr     = 0;
     899            entry.ptr     = r_read_ptr.read();
    891900            if(cached_read){  // Cached read, we update the copy
    892901              if(!is_cnt){ // Not counter mode
     
    905914            }
    906915#ifdef DDEBUG
     916if(m_cpt_cycles > DEBUG_START_CYCLE){
    907917           std::cout << "In READ_DIR_HIT printing the entry of address is : " << std::endl;
    908918           entry.print();
    909919           std::cout << "done" << std::endl;
     920}
    910921#endif
    911922
     
    946957            }
    947958#ifdef DDEBUG
     959if(m_cpt_cycles > DEBUG_START_CYCLE){
    948960           std::cout << "In READ_HEAP_LOCK printing the entry of address is : " << std::endl;
    949961           entry.print();
    950962           std::cout << "done" << std::endl;
     963}
    951964#endif
    952965
     
    10641077          if ( r_alloc_trt_fsm.read() == ALLOC_TRT_READ ) {
    10651078#ifdef TDEBUG
     1079if(m_cpt_cycles > DEBUG_START_CYCLE){
    10661080        std::cout << sc_time_stamp() << " " << name() << " READ_TRT_LOCK " << std::endl;
     1081}
    10671082#endif
    10681083            size_t index = 0;
     
    10951110                std::vector<data_t>(m_words,0));
    10961111#ifdef TDEBUG
     1112if(m_cpt_cycles > DEBUG_START_CYCLE){
    10971113        std::cout << sc_time_stamp() << " " << name() << " READ_TRT_SET transaction table : " << std::endl;
    10981114        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    10991115          m_transaction_tab.print(i);
     1116}
    11001117#endif
    11011118
     
    13361353            }
    13371354#ifdef IDEBUG
     1355if(m_cpt_cycles > DEBUG_START_CYCLE){
    13381356            if(wok){
    13391357        std::cout << sc_time_stamp() << " " << name() << " WRITE_UPT_LOCK update table : " << std::endl;
    13401358        m_update_tab.print();
    13411359            }
     1360}
    13421361#endif
    13431362            r_write_upt_index = index;
     
    14561475          if ( r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE ) {
    14571476#ifdef TDEBUG
     1477if(m_cpt_cycles > DEBUG_START_CYCLE){
    14581478        std::cout << sc_time_stamp() << " " << name() << " READ_TRT_LOCK " << std::endl;
     1479}
    14591480#endif
    14601481            size_t hit_index = 0;
     
    15071528                data_vector);
    15081529#ifdef TDEBUG
     1530if(m_cpt_cycles > DEBUG_START_CYCLE){
    15091531        std::cout << sc_time_stamp() << " " << name() << " WRITE_TRT_SET transaction table : " << std::endl;
    15101532        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    15111533          m_transaction_tab.print(i);
     1534}
    15121535#endif
    15131536
     
    15331556            r_write_fsm = WRITE_RSP;
    15341557#ifdef TDEBUG
     1558if(m_cpt_cycles > DEBUG_START_CYCLE){
    15351559        std::cout << sc_time_stamp() << " " << name() << " WRITE_TRT_DATA transaction table : " << std::endl;
    15361560        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    15371561          m_transaction_tab.print(i);
     1562}
    15381563#endif
    15391564
     
    15921617                index);
    15931618#ifdef IDEBUG
     1619if(m_cpt_cycles > DEBUG_START_CYCLE){
    15941620            if(wok){
    15951621        std::cout << sc_time_stamp() << " " << name() << " WRITE_INVAL_LOCK update table : " << std::endl;
    15961622        m_update_tab.print();
    15971623            }
     1624}
    15981625#endif
    15991626            r_write_upt_index = index;
     
    16241651                std::vector<data_t>(m_words,0));
    16251652#ifdef TDEBUG
     1653if(m_cpt_cycles > DEBUG_START_CYCLE){
    16261654        std::cout << sc_time_stamp() << " " << name() << " WRITE_DIR_INVAL transaction table : " << std::endl;
    16271655        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    16281656          m_transaction_tab.print(i);
     1657}
    16291658#endif
    16301659
     
    18301859            r_ixr_rsp_fsm = IXR_RSP_IDLE;
    18311860#ifdef TDEBUG
     1861if(m_cpt_cycles > DEBUG_START_CYCLE){
    18321862        std::cout << sc_time_stamp() << " " << name() << " IXR_RSP_TRT_ERASE transaction table : " << std::endl;
    18331863        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    18341864          m_transaction_tab.print(i);
     1865}
    18351866#endif
    18361867
     
    18511882            if ( eop ) {
    18521883#ifdef TDEBUG
     1884if(m_cpt_cycles > DEBUG_START_CYCLE){
    18531885        std::cout << sc_time_stamp() << " " << name() << " IXR_RSP_TRT_READ transaction table : " << std::endl;
    18541886        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    18551887          m_transaction_tab.print(i);
     1888}
    18561889#endif
    18571890
     
    19001933              break;
    19011934#ifdef TDEBUG
     1935if(m_cpt_cycles > DEBUG_START_CYCLE){
    19021936        std::cout << "XRAM_RSP FSM in XRAM_RSP_IDLE state" << std::endl;
     1937}
    19031938#endif
    19041939            }
     
    19121947            r_xram_rsp_fsm           = XRAM_RSP_TRT_COPY;
    19131948#ifdef TDEBUG
     1949if(m_cpt_cycles > DEBUG_START_CYCLE){
    19141950        std::cout << "XRAM_RSP FSM in XRAM_RSP_DIR_LOCK state" << std::endl;
     1951}
    19151952#endif
    19161953          }
     
    19481985            r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK;
    19491986#ifdef TDEBUG
     1987if(m_cpt_cycles > DEBUG_START_CYCLE){
    19501988        std::cout << "XRAM_RSP FSM in XRAM_RSP_TRT_COPY state" << std::endl;
    19511989        std::cout << "Victim way : " << std::hex << way << " set " << std::hex << set << std::endl;
    19521990        victim.print();
     1991}
    19531992#endif
    19541993          }
     
    19601999          if ( r_alloc_upt_fsm == ALLOC_UPT_XRAM_RSP ) {
    19612000#ifdef IDEBUG
     2001if(m_cpt_cycles > DEBUG_START_CYCLE){
    19622002        std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_LOCK state" << std::endl;
     2003}
    19632004#endif
    19642005            size_t index;
     
    19662007              r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT;
    19672008#ifdef IDEBUG
     2009if(m_cpt_cycles > DEBUG_START_CYCLE){
    19682010        std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_LOCK state to XRAM_RSP_INVAL_WAIT state" << std::endl;
    19692011    std::cout << "A invalidation is already registered at this address" << std::endl;
    19702012        m_update_tab.print();
     2013}
    19712014#endif
    19722015
     
    19752018              r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT;
    19762019#ifdef IDEBUG
     2020if(m_cpt_cycles > DEBUG_START_CYCLE){
    19772021        std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_LOCK state to XRAM_RSP_INVAL_WAIT state" << std::endl;
    19782022    std::cout << "The inval tab is full" << std::endl;
    19792023        m_update_tab.print();
     2024}
    19802025#endif
    19812026            }
     
    19832028              r_xram_rsp_fsm = XRAM_RSP_DIR_UPDT;
    19842029#ifdef IDEBUG
     2030if(m_cpt_cycles > DEBUG_START_CYCLE){
    19852031        std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_LOCK state to XRAM_RSP_DIR_UPDT state" << std::endl;
    19862032        m_update_tab.print();
     2033}
    19872034#endif
    19882035            }
     
    19962043          break;
    19972044#ifdef IDEBUG
     2045if(m_cpt_cycles > DEBUG_START_CYCLE){
    19982046        std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL_WAIT state" << std::endl;
     2047}
    19992048#endif
    20002049        }
     
    20422091          m_cache_directory.write(set, way, entry);
    20432092#ifdef DDEBUG
     2093if(m_cpt_cycles > DEBUG_START_CYCLE){
    20442094           std::cout << "printing the entry : " << std::endl;
    20452095           entry.print();
    20462096           std::cout << "done" << std::endl;
     2097}
    20472098#endif
    20482099
    20492100#ifdef TDEBUG
     2101if(m_cpt_cycles > DEBUG_START_CYCLE){
    20502102        std::cout << sc_time_stamp() << " " << name() << " XRAM_RSP_DIR_UPDT transaction table : " << std::endl;
    20512103        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    20522104          m_transaction_tab.print(i);
     2105}
    20532106#endif
    20542107
     
    20692122
    20702123#ifdef IDEBUG
     2124if(m_cpt_cycles > DEBUG_START_CYCLE){
    20712125            std::cout << "xram_rsp : record invalidation, time = " << std::dec << m_cpt_cycles << std::endl;
    20722126            m_update_tab.print();
     2127}
    20732128#endif
    20742129            r_xram_rsp_upt_index = index;
     
    21052160                std::vector<data_t>(m_words,0) );
    21062161#ifdef TDEBUG
     2162if(m_cpt_cycles > DEBUG_START_CYCLE){
    21072163        std::cout << sc_time_stamp() << " " << name() << " XRAM_RSP_TRT_DIRTY transaction table : " << std::endl;
    21082164        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    21092165          m_transaction_tab.print(i);
     2166}
    21102167#endif
    21112168
     
    21352192
    21362193#ifdef DDEBUG
     2194if(m_cpt_cycles > DEBUG_START_CYCLE){
    21372195        std::cout << "XRAM_RSP FSM in XRAM_RSP_DIR_RSP state" << std::endl;
     2196}
    21382197#endif
    21392198          }
     
    21642223            else                            r_xram_rsp_fsm = XRAM_RSP_IDLE;
    21652224#ifdef IDEBUG
     2225if(m_cpt_cycles > DEBUG_START_CYCLE){
    21662226        std::cout << "XRAM_RSP FSM in XRAM_RSP_INVAL state" << std::endl;
     2227}
    21672228#endif
    21682229          }
     
    21852246            else                        r_xram_rsp_fsm = XRAM_RSP_IDLE;
    21862247#ifdef TDEBUG
     2248if(m_cpt_cycles > DEBUG_START_CYCLE){
    21872249        std::cout << "XRAM_RSP FSM in XRAM_RSP_WRITE_DIRTY state" << std::endl;
     2250}
    21882251#endif
    21892252          }
     
    22862349           DirectoryEntry entry = m_cache_directory.read(cleanup_address , way);
    22872350#ifdef DDEBUG
     2351if(m_cpt_cycles > DEBUG_START_CYCLE){
    22882352           std::cout << "In CLEANUP_DIR_LOCK printing the entry of address is : " << std::hex << cleanup_address << std::endl;
    22892353           entry.print();
    22902354           std::cout << "done" << std::endl;
     2355}
    22912356#endif
    22922357            r_cleanup_is_cnt    = entry.is_cnt;
     
    25132578            if(!hit_inval) {
    25142579#ifdef DEBUG_VCI_MEM_CACHE
    2515 if(m_cpt_total_cycles > NCYCLES)
     2580if(m_cpt_cycles > DEBUG_START_CYCLE)
    25162581              std::cout << "MEM_CACHE WARNING: cleanup with no corresponding entry at address : " << std::hex << (r_cleanup_nline.read()*4*m_words) << std::dec << std::endl;
    25172582#endif
     
    25362601            m_update_tab.clear(r_cleanup_index.read());
    25372602#ifdef IDEBUG
     2603if(m_cpt_cycles > DEBUG_START_CYCLE){
    25382604        std::cout << sc_time_stamp() << " " << name() << " CLEANUP_UPT_WRITE update table : " << std::endl;
    25392605        m_update_tab.print();
     2606}
    25402607#endif
    25412608
     
    26052672          if( m_cmd_llsc_addr_fifo.rok() ) {
    26062673#ifdef LOCK_DEBUG
     2674if(m_cpt_cycles > DEBUG_START_CYCLE){
    26072675            std::cout << "SC data : " << m_cmd_llsc_wdata_fifo.read() << std::endl;
    26082676            std::cout << "SC addr : " << std::hex << m_cmd_llsc_addr_fifo.read() << std::dec << std::endl;
    26092677            std::cout << "SC cpt  : " << r_llsc_cpt.read() << std::endl;
     2678}
    26102679#endif
    26112680            if(m_cmd_llsc_eop_fifo.read()){
     
    26132682              r_llsc_fsm = SC_DIR_LOCK;
    26142683#ifdef LOCK_DEBUG
     2684if(m_cpt_cycles > DEBUG_START_CYCLE){
    26152685              std::cout << "SC eop" << std::endl;
     2686}
    26162687#endif
    26172688            } else { // we keep the last word
     
    26812752
    26822753#ifdef LOCK_DEBUG
     2754if(m_cpt_cycles > DEBUG_START_CYCLE){
    26832755          std::cout << "SC_DIR_HIT_READ ok ? " << ok << std::endl;
    26842756          if(!ok){
     
    26932765                  std::cout << "SC_DIR_HIT_READ wdata 1      : " << m_cmd_llsc_wdata_fifo.read() << std::endl;
    26942766          }
     2767}
    26952768#endif
    26962769          if(ok){
     
    27702843            }
    27712844#ifdef IDEBUG
     2845if(m_cpt_cycles > DEBUG_START_CYCLE){
    27722846            if(wok){
    27732847        std::cout << sc_time_stamp() << " " << name() << " SC_UPT_LOCK update table : " << std::endl;
    27742848        m_update_tab.print();
    27752849            }
     2850}
    27762851#endif
    27772852            r_llsc_upt_index = index;
     
    28222897            if(r_llsc_count.read() == 1){
    28232898#ifdef LOCK_DEBUG
     2899if(m_cpt_cycles > DEBUG_START_CYCLE){
    28242900              std::cout << "SC_UPT_REQ, only one owner : " << r_llsc_copy.read() << std::endl;
     2901}
    28252902#endif
    28262903              r_llsc_fsm = LLSC_IDLE;
     
    29162993                index);
    29172994#ifdef IDEBUG
     2995if(m_cpt_cycles > DEBUG_START_CYCLE){
    29182996            if(wok){
    29192997        std::cout << sc_time_stamp() << " " << name() << " LLSC_INVAL_LOCK update table : " << std::endl;
    29202998        m_update_tab.print();
    29212999            }
     3000}
    29223001#endif
    29233002            r_llsc_upt_index = index;
     
    29473026                std::vector<data_t>(m_words,0));
    29483027#ifdef TDEBUG
     3028if(m_cpt_cycles > DEBUG_START_CYCLE){
    29493029        std::cout << sc_time_stamp() << " " << name() << " SC_DIR_INVAL transaction table : " << std::endl;
    29503030        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    29513031          m_transaction_tab.print(i);
     3032}
    29523033#endif
    29533034
     
    30833164                  data_vector);
    30843165#ifdef TDEBUG
     3166if(m_cpt_cycles > DEBUG_START_CYCLE){
    30853167        std::cout << sc_time_stamp() << " " << name() << " LLSC_TRT_SET transaction table : " << std::endl;
    30863168        for(size_t i = 0 ; i < m_transaction_tab.size() ; i++)
    30873169          m_transaction_tab.print(i);
     3170}
    30883171#endif
    30893172
Note: See TracChangeset for help on using the changeset viewer.