Changeset 143 for trunk/modules


Ignore:
Timestamp:
Mar 28, 2011, 6:46:33 PM (13 years ago)
Author:
kane
Message:

fix bug in ccxcachev4, save cpu_info in memcachev4

Location:
trunk/modules
Files:
4 edited

Legend:

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

    r140 r143  
    4343
    4444/*
    45  * CC_XCACHE_WRAPPER_SELECT_VICTIM :
    46  *   The selection and the update of cache (after a read miss)
    47  *   are separated in two step
    48  *   Also, the cleanup can be send in parallel at the read miss.
    49  *
    5045 * CC_XCACHE_WRAPPER_FIFO_RSP
    5146 *   Two simple fifo (each 2x32 depth) receive the cache line from
    5247 *   RAM. Instead of two buffers (m_icache_words and m_dcache_words)
     48 *    1     - nb_icache+nb_dcache simple fifo
     49 *    2     - 2 simple fifo
     50 *    else  - two buffers  (m_icache_words and m_dcache_words)
    5351 *   
    5452 * CC_XCACHE_WRAPPER_CC_UPDATE_MULTI_CYCLE
     
    6765 * CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY
    6866 *   Write buffer access is conditionnal with dcache_miss_req and icache_miss_req
    69  *     1    - two access authorized
    70  *     2    - one access with static priority (dcache prior)
    71  *     3    - one access with static priority (icache prior)
    72  *     4    - one access with round robin priority
     67 *     1    - one access with static priority (dcache prior)
     68 *     2    - one access with static priority (icache prior)
     69 *     3    - one access with round robin priority
     70 *     4    - two access authorized
    7371 *
    7472 * CC_XCACHE_WRAPPER_MULTI_CACHE :
     
    9593
    9694// implementation
    97 #ifndef CC_XCACHE_WRAPPER_SELECT_VICTIM
    98 #define CC_XCACHE_WRAPPER_SELECT_VICTIM               1
    99 #endif
    10095#ifndef CC_XCACHE_WRAPPER_FIFO_RSP
    10196#define CC_XCACHE_WRAPPER_FIFO_RSP                    1
     
    111106#endif
    112107#ifndef CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY
    113 #define CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY            4
     108#define CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY            3
    114109#endif 
    115110#ifndef CC_XCACHE_WRAPPER_MULTI_CACHE
    116111#define CC_XCACHE_WRAPPER_MULTI_CACHE                 2
    117 #endif 
     112// if multi_cache :
     113// <tsar toplevel>/modules/vci_mem_cache_v4/caba/source/include/mem_cache_directory_v4.h : L1_MULTI_CACHE 1
     114// <soclib toplevel>/soclib/lib/multi_write_buffer/include/multi_write_buffer.h          : CC_XCACHE_MULTI_CACHE 1
     115#endif
     116 
    118117// debugging
     118#ifndef CC_XCACHE_WRAPPER_VERBOSE
     119#define CC_XCACHE_WRAPPER_VERBOSE                     1
     120#endif
    119121#ifndef CC_XCACHE_WRAPPER_STOP_SIMULATION
    120122#define CC_XCACHE_WRAPPER_STOP_SIMULATION             1
     
    124126#endif
    125127#ifndef CC_XCACHE_WRAPPER_DEBUG_CYCLE_MIN
    126 #define CC_XCACHE_WRAPPER_DEBUG_CYCLE_MIN             949900
     128#define CC_XCACHE_WRAPPER_DEBUG_CYCLE_MIN             1500
    127129#endif
    128130#ifndef CC_XCACHE_WRAPPER_DEBUG_FILE_TRANSACTION
     
    158160        DCACHE_IDLE,
    159161        DCACHE_WRITE_UPDT,
    160 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    161162        DCACHE_MISS_VICTIM,
    162 #endif
    163163        DCACHE_MISS_WAIT,
    164164        DCACHE_MISS_UPDT,
     
    176176    enum icache_fsm_state_e {
    177177        ICACHE_IDLE,
    178 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    179178        ICACHE_MISS_VICTIM,
    180 #endif
    181179        ICACHE_MISS_WAIT,
    182180        ICACHE_MISS_UPDT,
     
    341339    sc_signal<bool>       * r_vci_rsp_data_error; //[m_nb_dcache]
    342340
    343 #if CC_XCACHE_WRAPPER_FIFO_RSP
     341#if   (CC_XCACHE_WRAPPER_FIFO_RSP==1)
    344342    std::queue<data_t>    * r_icache_miss_buf;    //[m_nb_icache]
    345343    std::queue<data_t>    * r_dcache_miss_buf;    //[m_nb_dcache]
     344#elif (CC_XCACHE_WRAPPER_FIFO_RSP==2)
     345    typedef struct
     346    {
     347        data_t   data;
     348        uint32_t num_cache;
     349    } miss_buf_t;
     350
     351    std::queue<miss_buf_t>  r_icache_miss_buf;
     352    std::queue<miss_buf_t>  r_dcache_miss_buf;
    346353#else
    347354    bool                 ** r_icache_miss_val;    //[m_nb_icache][m_icache_words]
  • trunk/modules/vci_cc_xcache_wrapper_v4/caba/source/src/vci_cc_xcache_wrapper_v4.cpp

    r140 r143  
    7575// =====[ FIFO_RSP ]=================================
    7676
    77 // FIXME : une FIFO avec le numéro du cache !
    78 #if CC_XCACHE_WRAPPER_FIFO_RSP
     77#if   (CC_XCACHE_WRAPPER_FIFO_RSP==1)
    7978# define CACHE_MISS_BUF_ALLOC             do { \
    8079                                              r_icache_miss_buf = new std::queue<data_t> [m_nb_icache]; \
     
    106105                                                  PRINTF("    * cache_miss_buf - size : %d\n",r_##c##cache_miss_buf[x].size()); \
    107106                                              } \
     107                                          } while (0)
     108#elif (CC_XCACHE_WRAPPER_FIFO_RSP==2)
     109# define CACHE_MISS_BUF_ALLOC             
     110# define CACHE_MISS_BUF_DEALLOC           
     111# define CACHE_MISS_BUF_RESET(c)          do {                          \
     112                                              while (r_##c##cache_miss_buf.size()>0) { \
     113                                                  r_##c##cache_miss_buf.pop(); \
     114                                              }                         \
     115                                          } while (0)
     116# define CACHE_MISS_BUF_REQ_INIT(c,x)     
     117# define CACHE_MISS_BUF_RSP_VAL(c,x,n)    ((r_##c##cache_miss_buf.size()>0) and (r_##c##cache_miss_buf.front().num_cache==x))
     118# define CACHE_MISS_BUF_RSP_ACK(c,x)      (r_##c##cache_miss_buf.size()<2)
     119# define CACHE_MISS_BUF_RSP_DATA(c,x,n)   r_##c##cache_miss_buf.front().data
     120# define CACHE_MISS_BUF_RSP_POP(c,x)      do {                                            \
     121                                              r_##c##cache_miss_buf.pop(); \
     122                                          } while (0)
     123# define CACHE_MISS_BUF_RSP_PUSH(c,x,n,d) do { \
     124                                              miss_buf_t miss_buf;      \
     125                                              miss_buf.data = d;        \
     126                                              miss_buf.num_cache = x;   \
     127                                              r_##c##cache_miss_buf.push(miss_buf); \
     128                                          } while (0)
     129# define CACHE_MISS_BUF_RSP_PRINT(c)      do { \
     130                                              PRINTF("    * cache_miss_buf - size : %d\n",r_##c##cache_miss_buf.size()); \
    108131                                          } while (0)
    109132#else                                     
     
    187210            "DCACHE_IDLE",
    188211            "DCACHE_WRITE_UPDT",
    189 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    190212            "DCACHE_MISS_VICTIM",
    191 #endif
    192213            "DCACHE_MISS_WAIT",
    193214            "DCACHE_MISS_UPDT",
     
    204225        const char *icache_fsm_state_str[] = {
    205226            "ICACHE_IDLE",
    206 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    207227            "ICACHE_MISS_VICTIM",
    208 #endif
    209228            "ICACHE_MISS_WAIT",
    210229            "ICACHE_MISS_UPDT",
     
    254273    }
    255274
     275typedef long long unsigned int blob_t;
     276
    256277#define tmpl(...)  template<typename vci_param, typename iss_t> __VA_ARGS__ VciCcXCacheWrapperV4<vci_param, iss_t>
    257278
     
    382403                       "When multi cache is activated, need 4 bits (16 word) to the cache set .");
    383404
     405                if (m_nb_cpu > 1)
     406                    ASSERT(CC_XCACHE_MULTI_CPU!=0,
     407                           "Macro CC_XCACHE_MULTI_CPU in wbuf must be set at 1.");
     408
    384409                p_irq = new sc_in<bool> * [m_nb_cpu];
    385410                for (uint32_t num_cpu=0; num_cpu<m_nb_cpu; ++num_cpu)
     
    537562
    538563
     564#if CC_XCACHE_WRAPPER_VERBOSE
    539565                std::cout << "<VciCcXCacheWrapperV4> Parameters :" << std::endl;
    540566                std::cout << "  * nb_cpu             : " << nb_cpu << std::endl;
     
    546572                std::cout << "  * wbuf   (total)     : " <<  wbuf_nlines << " line(s), " <<  wbuf_nwords << " word(s), timeout : " <<  wbuf_timeout << std::endl;
    547573                std::cout << "  * wbuf   (per cache) : " << _wbuf_nlines << " line(s), " << _wbuf_nwords << " word(s), timeout : " << _wbuf_timeout << std::endl;
     574#endif
    548575
    549576                r_icache = new GenericCache<vci_addr_t>  * [m_nb_icache];
     
    10881115        PRINTF("  * CC_XCACHE_WRAPPER \"%s\" Transition - Time = %d\n",name().c_str(),(uint32_t)m_cpt_total_cycles);
    10891116        for (uint32_t num_cache=0; num_cache<m_nb_dcache; ++num_cache)
    1090         PRINTF("    * fsm dcache              = [%.2d] %s - (%.2d) %llx (%llx)\n",num_cache,dcache_fsm_state_str[r_dcache_fsm[num_cache]],r_dcache_lock[num_cache].read(),(uint64_t)r_dcache_addr_save[num_cache].read(),(uint64_t)set_num_dcache_only(r_dcache_addr_save[num_cache].read(),num_cache));
     1117        PRINTF("    * fsm dcache              = [%.2d] %s - (%.2d) %llx (%llx)\n",num_cache,dcache_fsm_state_str[r_dcache_fsm[num_cache]],r_dcache_lock[num_cache].read(),(blob_t)r_dcache_addr_save[num_cache].read(),(blob_t)set_num_dcache_only(r_dcache_addr_save[num_cache].read(),num_cache));
    10911118        for (uint32_t num_cache=0; num_cache<m_nb_icache; ++num_cache)
    1092         PRINTF("    * fsm icache              = [%.2d] %s - (%.2d) %llx (%llx)\n",num_cache,icache_fsm_state_str[r_icache_fsm[num_cache]],r_icache_lock[num_cache].read(),(uint64_t)r_icache_addr_save[num_cache].read(),(uint64_t)set_num_icache_only(r_icache_addr_save[num_cache].read(),num_cache));
     1119        PRINTF("    * fsm icache              = [%.2d] %s - (%.2d) %llx (%llx)\n",num_cache,icache_fsm_state_str[r_icache_fsm[num_cache]],r_icache_lock[num_cache].read(),(blob_t)r_icache_addr_save[num_cache].read(),(blob_t)set_num_icache_only(r_icache_addr_save[num_cache].read(),num_cache));
    10931120        PRINTF("    * fsm cmd                 = (%.2d) %s\n",r_vci_cmd_num_cache.read(), cmd_fsm_state_str[r_vci_cmd_fsm]);
    10941121        PRINTF("    * fsm rsp                 = (%.2d) %s\n",r_vci_rsp_num_cache.read(), rsp_fsm_state_str[r_vci_rsp_fsm]);
    1095         PRINTF("    * fsm tgt                 = (%.2d) %s - i %llx d %llx\n",r_tgt_num_cache.read(), tgt_fsm_state_str[r_vci_tgt_fsm],(uint64_t)r_tgt_iaddr.read(),(uint64_t)r_tgt_daddr.read());
    1096       //PRINTF("    * fsm tgt                 =      %s - %llx\n",tgt_fsm_state_str[r_vci_tgt_fsm],(uint64_t)r_tgt_addr.read());
     1122        PRINTF("    * fsm tgt                 = (%.2d) %s - i %llx d %llx\n",r_tgt_num_cache.read(), tgt_fsm_state_str[r_vci_tgt_fsm],(blob_t)r_tgt_iaddr.read(),(blob_t)r_tgt_daddr.read());
     1123      //PRINTF("    * fsm tgt                 =      %s - %llx\n",tgt_fsm_state_str[r_vci_tgt_fsm],(blob_t)r_tgt_addr.read());
    10971124        PRINTF("    * fsm cleanup             = (%.2d) %s\n",r_cleanup_num_cache.read(), cleanup_fsm_state_str[r_cleanup_fsm]);
    10981125        for (uint32_t num_cache=0; num_cache<m_nb_dcache; ++num_cache)
     
    11031130                       ,num_cpu
    11041131                       ,          r_dcache_ll_valid [num_cache][num_cpu].read()
    1105                        ,(uint64_t)r_dcache_ll_addr  [num_cache][num_cpu].read()
    1106                        ,(uint64_t)set_num_dcache_only(r_dcache_ll_addr [num_cache][num_cpu].read(),num_cache)
    1107                        ,(uint64_t)r_dcache_ll_data [num_cache][num_cpu].read());
     1132                       ,(blob_t)r_dcache_ll_addr  [num_cache][num_cpu].read()
     1133                       ,(blob_t)set_num_dcache_only(r_dcache_ll_addr [num_cache][num_cpu].read(),num_cache)
     1134                       ,(blob_t)r_dcache_ll_data [num_cache][num_cpu].read());
    11081135
    11091136            PRINTF("    * dcache_previous_unc     : [%.2d] %d\n",num_cache,r_dcache_previous_unc[num_cache].read());
     
    11961223                    PRINTF("    * <TGT> trdid            : %d\n",(uint32_t)p_vci_tgt.trdid.read());
    11971224                    PRINTF("    * <TGT> pktid            : %d\n",(uint32_t)p_vci_tgt.pktid.read());
    1198                     PRINTF("    * <TGT> address (before) : %llx\n",(uint64_t)tgt_iaddr);
     1225                    PRINTF("    * <TGT> address (before) : %llx\n",(blob_t)tgt_iaddr);
    11991226
    12001227                    r_tgt_srcid     = p_vci_tgt.srcid.read();
     
    12311258                                << "BROADCAST  "
    12321259                                << std::hex
    1233                                 << " L " << std::setw(10) << (uint64_t)tgt_addr
     1260                                << " L " << std::setw(10) << (blob_t)tgt_addr
    12341261                                << std::dec
    12351262                                << " - " << tgt_num_cache
     
    12681295                                    << "INVAL DATA "
    12691296                                    << std::hex
    1270                                     << " L " << std::setw(10) << (uint64_t)tgt_addr
     1297                                    << " L " << std::setw(10) << (blob_t)tgt_addr
    12711298                                    << std::dec
    12721299                                    << " - " << tgt_num_cache
     
    13011328                                    << "INVAL INS  "
    13021329                                    << std::hex
    1303                                     << " L " << std::setw(10) << (uint64_t)tgt_addr
     1330                                    << " L " << std::setw(10) << (blob_t)tgt_addr
    13041331                                    << std::dec
    13051332                                    << " - " << tgt_num_cache
     
    13341361                                        << "UPT DATA   "
    13351362                                        << std::hex
    1336                                         << " L " << std::setw(10) << (uint64_t)tgt_addr
     1363                                        << " L " << std::setw(10) << (blob_t)tgt_addr
    13371364                                        << std::dec
    13381365                                        << " - " << tgt_num_cache
     
    13591386                                        << "UPT INS    "
    13601387                                        << std::hex
    1361                                         << " L " << std::setw(10) << (uint64_t)tgt_addr
     1388                                        << " L " << std::setw(10) << (blob_t)tgt_addr
    13621389                                        << std::dec
    13631390                                        << " - " << tgt_num_cache
     
    13741401                    r_tgt_iaddr      = tgt_iaddr;
    13751402                    r_tgt_daddr      = tgt_daddr;
    1376                     PRINTF("    * <TGT> address (after)  : i %llx, d %llx\n",(uint64_t)tgt_iaddr,(uint64_t)tgt_daddr);
     1403                    PRINTF("    * <TGT> address (after)  : i %llx, d %llx\n",(blob_t)tgt_iaddr,(blob_t)tgt_daddr);
    13771404
    13781405                } // end if cmdval
     
    15621589                        // }
    15631590
    1564                         PRINTF("      * <TGT> icache_rsp    : %d\n",(uint32_t) r_tgt_icache_rsp);
     1591                        PRINTF("      * <TGT> icache_rsp    : %d\n",(uint32_t) r_tgt_icache_rsp[r_tgt_num_cache]);
    15651592                        PRINTF("      * <TGT> dcache_rsp[%d] : %d\n",(uint32_t)r_tgt_num_cache,(uint32_t)r_tgt_dcache_rsp[r_tgt_num_cache].read());
    15661593                        // if there is no need for a response
     
    18161843                                if ( icache_cached )
    18171844                                {
    1818 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    18191845                                    r_icache_fsm     [num_cache] = ICACHE_MISS_VICTIM;
    1820 #else
    1821                                     r_icache_fsm     [num_cache] = ICACHE_MISS_WAIT;
    1822 #endif
    18231846                                    r_icache_miss_req[num_cache] = true;
    18241847                                   
     
    18441867                }
    18451868                //////////////////////
    1846 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    18471869            case ICACHE_MISS_VICTIM:
    18481870                {
     
    18631885                    break;
    18641886                }
    1865 #endif
    18661887                //////////////////////
    18671888            case ICACHE_MISS_WAIT:
     
    18881909                            r_icache_fsm[num_cache] = ICACHE_ERROR;
    18891910                        } else {
    1890 #if not CC_XCACHE_WRAPPER_SELECT_VICTIM
    1891                             if (not r_icache_cleanup_req[num_cache].read())
    1892 #endif
    1893                             {
    1894                                 r_icache_update_addr[num_cache] = 0;
    1895                                 r_icache_fsm        [num_cache] = ICACHE_MISS_UPDT;
    1896                             }
     1911                            r_icache_update_addr[num_cache] = 0;
     1912                            r_icache_fsm        [num_cache] = ICACHE_MISS_UPDT;
    18971913                        }
    18981914                    }
     
    19411957                    size_t     word =              r_icache_update_addr[num_cache].read();
    19421958                    vci_addr_t addr = (vci_addr_t) r_icache_addr_save  [num_cache].read();
    1943                     size_t     way  = 0;
    1944                     size_t     set  = 0;
    1945 
    1946 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    1947                     way = r_icache_miss_way[num_cache].read();
    1948                     set = r_icache_miss_set[num_cache].read();
    1949 #else
    1950                     // need invalid rsp, don't select a victim
    1951                     if (not r_icache_inval_rsp[num_cache])
    1952                     {
    1953                         // First word : select an victim !
    1954                         if (word == 0)
    1955                         {
    1956                             vci_addr_t victim;
    1957                        
    1958                             // r_icache_cleanup_req is false because is the transition condition to go in ICACHE_MISS_UPDT state
    1959                             r_icache_cleanup_req[num_cache]  = r_icache[num_cache]->victim_select(addr, &victim, &way, &set );
    1960                             r_icache[num_cache]->victim_update_tag(addr, way, set);
    1961                        
    1962                             r_icache_cleanup_line[num_cache] = (addr_40) victim;
    1963                             r_icache_miss_way    [num_cache] = way;
    1964                             r_icache_miss_set    [num_cache] = set;
    1965                         }
    1966                         else
    1967                         {
    1968                             way = r_icache_miss_way[num_cache].read();
    1969                             set = r_icache_miss_set[num_cache].read();
    1970                         }
    1971                     }
    1972 #endif
     1959                    size_t     way  = r_icache_miss_way[num_cache].read();
     1960                    size_t     set  = r_icache_miss_set[num_cache].read();
     1961
    19731962                    bool val = CACHE_MISS_BUF_RSP_VAL(i,num_cache,word);
    19741963
    19751964                    if (val)
    19761965                    {
    1977                         PRINTF("    * <ICACHE [%d]> rsp_val            : %d/%d\n",num_cache,(int)r_icache_update_addr[num_cache],m_icache_words);
     1966                        PRINTF("    * <ICACHE [%d]> rsp_val            : %d/%d\n",num_cache,(int)r_icache_update_addr[num_cache],(int)m_icache_words);
    19781967                        PRINTF("    * <ICACHE [%d]> r_icache_inval_rsp : %d\n"   ,num_cache,(int)r_icache_inval_rsp[num_cache]);
    19791968                        PRINTF("    * <ICACHE [%d]> ins                : %x\n"   ,num_cache,(int)CACHE_MISS_BUF_RSP_DATA(i,num_cache,word));
     
    19941983                        if (word >= m_icache_words)
    19951984                        {
    1996 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    19971985                            // in all case (inval_rsp or not), update the victim tag
    19981986                            r_icache[num_cache]->victim_update_tag(addr, way, set);
    1999 #endif
    20001987
    20011988                            // Last word : if previous invalid_rsp, can cleanup, else update the TAG
     
    20172004            case ICACHE_CC_CLEANUP:
    20182005                {
    2019                     // external cache invalidate request
    2020                     if ( r_tgt_icache_req[num_cache])     
    2021                     {
    2022                         r_icache_fsm     [num_cache] = ICACHE_CC_CHECK;
    2023                         r_icache_fsm_save[num_cache] = r_icache_fsm[num_cache].read();
    2024                         break;
    2025                     }
    20262006                    // cleanup
    20272007                    if(not r_icache_cleanup_req[num_cache]){
     
    20302010                        r_icache_fsm         [num_cache] = ICACHE_IDLE;
    20312011
    2032                         // FIXME : too many access at the cache in this cycle
    20332012                        m_cpt_icache_dir_read += m_icache_ways;
    20342013                        r_icache[num_cache]->inval((addr_40)r_icache_addr_save[num_cache]);
     
    23132292                                                    m_cost_data_miss_frz++;
    23142293                                                    r_dcache_miss_req [num_cache] = true;
    2315 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    23162294                                                    r_dcache_fsm [num_cache] = DCACHE_MISS_VICTIM;
    2317 #else
    2318                                                     r_dcache_fsm [num_cache] = DCACHE_MISS_WAIT;
    2319 #endif
    23202295                                                   
    23212296                                                } else {
     
    24252400                                    set_num_dcache(addr,num_cache);
    24262401
    2427                                     // FIXME : virer le set_num_dcache !
    2428                                     valid = r_wbuf[num_cache]->write(addr, _dreq.be, _dreq.wdata, dcache_cached);
    2429 
     2402                                    // FIXME :
     2403                                    //  * dans le wbuf, ne pas mettre l'adresse au complet (economie de surface)
     2404                                    //  * pour cela, virer le set_num_dcache !
     2405                                    valid = r_wbuf[num_cache]->write(addr, _dreq.be, _dreq.wdata, dcache_cached, dcache_num_cpu);
    24302406                                    PRINTF("    * <DCACHE [%d]> r_wbuf valid          : %d\n",num_cache,valid);
    24312407
     
    24852461                }
    24862462                //////////////////////
    2487 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    24882463            case DCACHE_MISS_VICTIM:
    24892464                {
     
    25012476                         r_dcache_miss_set     [num_cache] = set;
    25022477                 
    2503                          PRINTF("    * <DCACHE [%d]> MISS_VICTIM : Victim %d - %llx (way %d, set %d)\n",num_cache,victim_val, (uint64_t)victim, way, set);
     2478                         PRINTF("    * <DCACHE [%d]> MISS_VICTIM : Victim %d - %llx (way %d, set %d)\n",num_cache,victim_val, (blob_t)victim, (int)way, (int)set);
    25042479       
    25052480                         r_dcache_fsm          [num_cache] = DCACHE_MISS_WAIT;
     
    25082483                    break;
    25092484                }
    2510 #endif
    25112485                //////////////////////
    25122486            case DCACHE_MISS_WAIT:
     
    25302504                        else
    25312505                        {
    2532 #if not CC_XCACHE_WRAPPER_SELECT_VICTIM
    2533                             if (not r_dcache_cleanup_req[num_cache].read())
    2534 #endif
    2535                             {
    2536                                 r_dcache_update_addr[num_cache] = 0;
    2537                                 r_dcache_fsm        [num_cache] = DCACHE_MISS_UPDT;
    2538                             }
     2506                            r_dcache_update_addr[num_cache] = 0;
     2507                            r_dcache_fsm        [num_cache] = DCACHE_MISS_UPDT;
    25392508                        }
    25402509                    }
     
    25462515                    size_t     word = r_dcache_update_addr[num_cache].read();
    25472516                    vci_addr_t addr = (vci_addr_t) r_dcache_addr_save[num_cache].read();
    2548                     size_t     way  = 0;
    2549                     size_t     set  = 0;
     2517                    size_t     way  = r_dcache_miss_way[num_cache].read();
     2518                    size_t     set  = r_dcache_miss_set[num_cache].read();
    25502519                   
    2551                     // need invalid rsp, don't select a victim
    2552 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    2553                     way = r_dcache_miss_way[num_cache].read();
    2554                     set = r_dcache_miss_set[num_cache].read();
    2555 #else
    2556                     if (not r_dcache_inval_rsp[num_cache] )
    2557                     {
    2558                         // First word : select an victim !
    2559                         if (word == 0)
    2560                         {
    2561                             vci_addr_t victim;
    2562                        
    2563                             // r_dcache_cleanup_req is false (condition to enter in DCACHE_MISS_UPDT
    2564                             r_dcache_cleanup_req [num_cache]  = r_dcache[num_cache]->victim_select(addr, &victim, &way, &set );
    2565                             r_dcache[num_cache]->victim_update_tag(addr, way, set);
    2566                             r_dcache_cleanup_line[num_cache] = (addr_40) victim;
    2567 
    2568                             r_dcache_miss_way [num_cache] = way;
    2569                             r_dcache_miss_set [num_cache] = set;
    2570                         }
    2571                         else
    2572                         {
    2573                             way = r_dcache_miss_way[num_cache].read();
    2574                             set = r_dcache_miss_set[num_cache].read();
    2575                         }
    2576                     }
    2577 #endif
    2578 
    2579                     PRINTF("    * <DCACHE [%d]> MISS_UPDT : Victim way %d, set %d\n",num_cache, way, set);
     2520                    PRINTF("    * <DCACHE [%d]> MISS_UPDT : Victim way %d, set %d\n",num_cache, (int)way, (int)set);
    25802521
    25812522                    if (CACHE_MISS_BUF_RSP_VAL(d,num_cache,word))
     
    25982539                        if (word >= m_dcache_words)
    25992540                        {
    2600 #if CC_XCACHE_WRAPPER_SELECT_VICTIM
    26012541                            // in all case (inval_rsp or not), update the victim tag
    26022542                            // because victim is already cleanup
    26032543                            r_dcache[num_cache]->victim_update_tag(addr, way, set);
    2604 #endif
    26052544
    26062545                            // Last word : if previous invalid_rsp, can cleanup, else update the TAG
     
    27362675                    PRINTF("    * <DCACHE [%d]> CC_CHECK\n",num_cache);
    27372676
     2677                    //
    27382678                    if((r_dcache_fsm_save[num_cache] == DCACHE_MISS_WAIT) and
    27392679                       ((r_dcache_addr_save[num_cache].read() & ~((m_dcache_words<<2)-1)) == (ad & ~((m_dcache_words<<2)-1)))) {
     
    28862826            case DCACHE_CC_CLEANUP:   
    28872827                {
    2888                     // external cache invalidate request
    2889                     if ( r_tgt_dcache_req[num_cache] )   
    2890                     {
    2891                         r_dcache_fsm     [num_cache] = DCACHE_CC_CHECK;
    2892                         r_dcache_fsm_save[num_cache] = r_dcache_fsm[num_cache];
    2893                         break;
    2894                     }       
    28952828                    // cleanup
    28962829                    if(not r_dcache_cleanup_req[num_cache]){
     
    28992832                        r_dcache_fsm          [num_cache] = DCACHE_IDLE;
    29002833
    2901                         // FIXME : too many access at the cache in this cycle
    29022834                        m_cpt_dcache_dir_read += m_dcache_ways;
    29032835                        r_dcache[num_cache]->inval((addr_40)r_dcache_addr_save[num_cache]);
     
    31083040                    r_cleanup_num_cache = num_cache;
    31093041
    3110                     PRINTF("      * <CLEANUP> address            : %llx\n",((cleanup_icache_req)?((uint64_t)set_num_icache_only(r_icache_cleanup_line[num_cache].read()<<m_icache_words_shift,num_cache)):((uint64_t)set_num_dcache_only(r_dcache_cleanup_line[num_cache].read()<<m_dcache_words_shift,num_cache))));
     3042                    PRINTF("      * <CLEANUP> address            : %llx\n",((cleanup_icache_req)?((blob_t)set_num_icache_only(r_icache_cleanup_line[num_cache].read()<<m_icache_words_shift,num_cache)):((blob_t)set_num_dcache_only(r_dcache_cleanup_line[num_cache].read()<<m_dcache_words_shift,num_cache))));
    31113043
    31123044#if CC_XCACHE_WRAPPER_DEBUG_FILE_TRANSACTION
     
    31163048                        << num_cache << " : "
    31173049                        << std::hex
    3118                         << " L "     << std::setw(10) << ((cleanup_icache_req)?((uint64_t)set_num_icache_only(r_icache_cleanup_line[num_cache].read()<<m_icache_words_shift,num_cache)):((uint64_t)set_num_dcache_only(r_dcache_cleanup_line[num_cache].read()<<m_dcache_words_shift,num_cache)))
     3050                        << " L "     << std::setw(10) << ((cleanup_icache_req)?((blob_t)set_num_icache_only(r_icache_cleanup_line[num_cache].read()<<m_icache_words_shift,num_cache)):((blob_t)set_num_dcache_only(r_dcache_cleanup_line[num_cache].read()<<m_dcache_words_shift,num_cache)))
    31193051                        // << " (" << std::setw(10) << addr << ")"
    31203052                        << std::dec
     
    32483180                    PRINTF("      * <CMD> dcache_miss_req (before) : %d\n",dcache_miss_req);
    32493181
    3250 // #if   (CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY==1)
    3251 //                     //  1) two access authorized
    3252 //                     dcache_miss_req =  r_dcache_miss_req[cache_miss_num_cache];
    3253 //                     icache_miss_req =  r_icache_miss_req[cache_miss_num_cache];
    3254 // #el
    3255 #if   (CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY==2)
    3256                     //  2) one access with static priority (dcache prior)
     3182#if   (CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY==1)
     3183                    //  1) one access with static priority (dcache prior)
    32573184                    icache_miss_req &= not dcache_miss_req;
     3185#elif (CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY==2)
     3186                    //  2) one access with static priority (icache prior)
     3187                    dcache_miss_req &= not icache_miss_req;
    32583188#elif (CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY==3)
    3259                     //  3) one access with static priority (icache prior)
    3260                     dcache_miss_req &= not icache_miss_req;
    3261 #elif (CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY==4)
    3262                     //  4) one access with round robin priority
     3189                    //  3) one access with round robin priority
    32633190                    dcache_miss_req = ((dcache_miss_req and not icache_miss_req) or // only dcache
    32643191                                       (dcache_miss_req and r_vci_cmd_dcache_prior)); // dcache prior
    32653192                    icache_miss_req &= not dcache_miss_req;
     3193// #elif (CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY==4)
     3194//                     //  4) two access authorized
     3195//                     dcache_miss_req =  r_dcache_miss_req[cache_miss_num_cache];
     3196//                     icache_miss_req =  r_icache_miss_req[cache_miss_num_cache];
    32663197#else
    32673198#error "Invalid value to CC_XCACHE_WRAPPER_VCI_CMD_PRIORITY"
     
    32783209                        addr = (icache_miss_req)?r_icache_addr_save[icache_miss_num_cache].read():r_dcache_addr_save[dcache_miss_num_cache].read();
    32793210
    3280                         PRINTF("      * <CMD> addr                     : %llx\n",(uint64_t)addr);
     3211                        PRINTF("      * <CMD> addr                     : %llx\n",(blob_t)addr);
    32813212
    32823213                        if (icache_miss_req)
     
    32913222                            set_num_dcache(addr,dcache_miss_num_cache);
    32923223
    3293                         PRINTF("      * <CMD> addr                     : %llx\n",(uint64_t)addr);
     3224                        PRINTF("      * <CMD> addr                     : %llx\n",(blob_t)addr);
    32943225                    }
    32953226                }
     
    33353266                            << "(" << dcache_miss_num_cache << ") "
    33363267                            << std::hex
    3337                             << " @ " << std::setw(10) << (uint64_t)addr
    3338                             << " (L " << std::setw(10) << ((uint64_t)addr&(uint64_t)m_dcache_yzmask) << ")"
     3268                            << " @ " << std::setw(10) << (blob_t)addr
     3269                            << " (L " << std::setw(10) << ((blob_t)addr&(blob_t)m_dcache_yzmask) << ")"
    33393270                            << std::dec
    33403271                            << std::endl;
     
    33623293                            << "(" << dcache_unc_num_cache << ") "
    33633294                            << std::hex
    3364                             << " @ " << std::setw(10) << (uint64_t)addr
    3365                             << " (L " << std::setw(10) << ((uint64_t)addr&(uint64_t)m_dcache_yzmask) << ")"
     3295                            << " @ " << std::setw(10) << (blob_t)addr
     3296                            << " (L " << std::setw(10) << ((blob_t)addr&(blob_t)m_dcache_yzmask) << ")"
    33663297                            << std::dec
    33673298                            << std::endl;
     
    33863317                            << "(" << icache_miss_num_cache << ") "
    33873318                            << std::hex
    3388                             << " @ " << std::setw(10) << (uint64_t)addr
    3389                             << " (L " << std::setw(10) << ((uint64_t)addr&(uint64_t)m_icache_yzmask) << ")"
     3319                            << " @ " << std::setw(10) << (blob_t)addr
     3320                            << " (L " << std::setw(10) << ((blob_t)addr&(blob_t)m_icache_yzmask) << ")"
    33903321                            << std::dec
    33913322                            << std::endl;
     
    34123343                            << "(" << icache_unc_num_cache << ") "
    34133344                            << std::hex
    3414                             << " @ " << std::setw(10) << (uint64_t)addr
    3415                             << " (L " << std::setw(10) << ((uint64_t)addr&(uint64_t)m_icache_yzmask) << ")"
     3345                            << " @ " << std::setw(10) << (blob_t)addr
     3346                            << " (L " << std::setw(10) << ((blob_t)addr&(blob_t)m_icache_yzmask) << ")"
    34163347                            << std::dec
    34173348                            << std::endl;
     
    34403371                            << "(" << dcache_write_num_cache << ") "
    34413372                            << std::hex
    3442                             << " @ " << std::setw(10) << (uint64_t)addr
    3443                             << " (L " << std::setw(10) << ((uint64_t)addr&(uint64_t)m_dcache_yzmask) << ")"
     3373                            << " @ " << std::setw(10) << (blob_t)addr
     3374                            << " (L " << std::setw(10) << ((blob_t)addr&(blob_t)m_dcache_yzmask) << ")"
    34443375                            << " [" << wbuf_min << ":" << wbuf_max << "]"
    34453376                            << " {" << wbuf_index << "}"
     
    34693400                            << "(" << dcache_sc_num_cache << ") "
    34703401                            << std::hex
    3471                             << " @ " << std::setw(10) << (uint64_t)addr
    3472                             << " (L " << std::setw(10) << ((uint64_t)addr&(uint64_t)m_dcache_yzmask) << ")"
     3402                            << " @ " << std::setw(10) << (blob_t)addr
     3403                            << " (L " << std::setw(10) << ((blob_t)addr&(blob_t)m_dcache_yzmask) << ")"
    34733404                            << std::dec
    34743405                            << std::endl;
     
    37373668                           "A VCI response packet must contain one flit for a write transaction");
    37383669                    r_vci_rsp_fsm = RSP_IDLE;
    3739                     bool cached = r_wbuf[r_vci_rsp_num_cache]->completed(p_vci_ini_rw.rtrdid.read() - (1<<(vci_param::T-1)));
     3670                    uint32_t wbuf_index = p_vci_ini_rw.rtrdid.read() - (1<<(vci_param::T-1));
     3671                    bool cached = r_wbuf[r_vci_rsp_num_cache]->completed(wbuf_index);
    37403672
    37413673                    PRINTF("      * <RSP> cached : %d\n",cached);
     
    37443676                        r_dcache_previous_unc[r_vci_rsp_num_cache] = false;
    37453677
    3746                     // FIXME : r_vci_rsp_num_cache != num_cpu ! -> pktid
    3747                     if ((p_vci_ini_rw.rerror.read()&0x1) != vci_param::ERR_NORMAL) m_iss[r_vci_rsp_num_cache]->setWriteBerr();
     3678                    if ((p_vci_ini_rw.rerror.read()&0x1) != vci_param::ERR_NORMAL)
     3679                        m_iss[r_wbuf[r_vci_rsp_num_cache]->getCpuId(wbuf_index)]->setWriteBerr();
    37483680                }
    37493681                break;
     
    38213753                    set_num_icache(addr,r_cleanup_num_cache);
    38223754
    3823                     PRINTF("      * <CLEANUP> icache             : %llx\n",(uint64_t)addr);
     3755                    PRINTF("      * <CLEANUP> icache             : %llx\n",(blob_t)addr);
    38243756                }
    38253757                else
     
    38283760                    set_num_dcache(addr,r_cleanup_num_cache);
    38293761
    3830                     PRINTF("      * <CLEANUP> dcache             : %llx\n",(uint64_t)addr);
     3762                    PRINTF("      * <CLEANUP> dcache             : %llx\n",(blob_t)addr);
    38313763                }
    38323764
     
    39203852                set_num_dcache(addr,r_vci_cmd_num_cache);
    39213853
    3922                 PRINTF("      * <CMD> DATA_UNC   : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(uint64_t)(addr));
     3854                PRINTF("      * <CMD> DATA_UNC   : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(blob_t)(addr));
    39233855
    39243856                p_vci_ini_rw.address = addr;
     
    39573889                set_num_dcache(addr,r_vci_cmd_num_cache);
    39583890
    3959                 PRINTF("      * <CMD> DATA_SC    : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(uint64_t)(addr));
     3891                PRINTF("      * <CMD> DATA_SC    : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(blob_t)(addr));
    39603892
    39613893                p_vci_ini_rw.address = addr;
     
    39933925                addr_40 addr       = (addr_40) r_wbuf[r_vci_cmd_num_cache]->getAddress(r_vci_cmd_cpt)&~0x3;
    39943926
    3995                 PRINTF("      * <CMD> DATA_WRITE : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(uint64_t)(addr));
     3927                PRINTF("      * <CMD> DATA_WRITE : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(blob_t)(addr));
    39963928
    39973929                p_vci_ini_rw.address = addr;
     
    40193951                set_num_dcache(addr,r_vci_cmd_num_cache);
    40203952
    4021                 PRINTF("      * <CMD> DATA_MISS  : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(uint64_t)(addr));
     3953                PRINTF("      * <CMD> DATA_MISS  : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(blob_t)(addr));
    40223954
    40233955                p_vci_ini_rw.address = addr;
     
    40443976                set_num_icache(addr,r_vci_cmd_num_cache);
    40453977
    4046                 PRINTF("      * <CMD> INS_MISS   : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(uint64_t)(addr));
     3978                PRINTF("      * <CMD> INS_MISS   : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(blob_t)(addr));
    40473979
    40483980                p_vci_ini_rw.address = addr;
     
    40694001                set_num_icache(addr,r_vci_cmd_num_cache);
    40704002
    4071                 PRINTF("      * <CMD> INS_UNC    : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(uint64_t)(addr));
     4003                PRINTF("      * <CMD> INS_UNC    : %d - %llx\n",(uint32_t)r_vci_cmd_num_cache,(blob_t)(addr));
    40724004
    40734005                p_vci_ini_rw.address = addr;
     
    42504182
    42514183    //////////////////////////////////////////////////////////////////////////////////
    4252     // fixme : mettre le type addr_40
     4184    // FIXME : mettre le type addr_40
    42534185    tmpl(sc_dt::sc_uint<40>)::set_num_cache_only(addr_40 addr, uint32_t num_cache)
    42544186    //////////////////////////////////////////////////////////////////////////////////
  • trunk/modules/vci_mem_cache_v4/caba/source/include/mem_cache_directory_v4.h

    r142 r143  
    77#include "arithmetics.h"
    88
    9 #define L1_MULTI_CACHE      1
     9#define L1_MULTI_CACHE 1
    1010//#define RANDOM_EVICTION
    1111
  • trunk/modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp

    r141 r143  
    2929#include "../include/vci_mem_cache_v4.h"
    3030
    31 // #define TDEBUG // Transaction tab debug
    32 // #define IDEBUG // Update tab debug
    33 // #define DDEBUG // Directory debug
    34 // #define LOCK_DEBUG // Lock debug
    35 
    3631#define DEBUG_VCI_MEM_CACHE 0
    37 #define DEBUG_START_CYCLE   949900
     32#define DEBUG_START_CYCLE   1500
    3833#define RANDOMIZE_SC
    3934
    4035#define ASSERT_VERBOSE
    4136#define ASSERT_NCYCLES m_cpt_cycles
     37
     38#if DEBUG_VCI_MEM_CACHE
     39#define TDEBUG // Transaction tab debug
     40#define IDEBUG // Update tab debug
     41#define DDEBUG // Directory debug
     42#define LOCK_DEBUG // Lock debug
     43#endif
     44
    4245
    4346#include "debug.h"
     
    26602663            bool match_heap         = match_heap_srcid and match_heap_cache_id and match_heap_inst;
    26612664
     2665            PRINTF("  * <MEM_CACHE.CLEANUP> %s - srcid %d\n",name().c_str(),r_cleanup_srcid.read());
     2666           
    26622667#if L1_MULTI_CACHE
    26632668            PRINTF("  * <MEM_CACHE.CLEANUP> match_dir  %d (match_dir_srcid  %d, match_dir_cache_id  %d, match_dir_inst  %d)\n",
     
    26832688            if(match_dir){
    26842689              DirectoryEntry dir_entry;
    2685               dir_entry.valid          = true;
     2690              dir_entry.valid            = true;
    26862691              dir_entry.is_cnt         = r_cleanup_is_cnt.read();
    2687               dir_entry.dirty          = r_cleanup_dirty.read();
     2692              dir_entry.dirty            = r_cleanup_dirty.read();
    26882693              dir_entry.tag                = r_cleanup_tag.read();
    2689               dir_entry.lock           = r_cleanup_lock.read();
     2694              dir_entry.lock             = r_cleanup_lock.read();
    26902695              dir_entry.ptr            = heap_entry.next;
    26912696              dir_entry.count          = r_cleanup_count.read()-1;
Note: See TracChangeset for help on using the changeset viewer.