Ignore:
Timestamp:
Jan 6, 2015, 11:07:52 AM (9 years ago)
Author:
cfuguet
Message:

reconf: merge vci_mem_cache trunk modifications (rev 912)

Location:
branches/reconfiguration/modules/vci_mem_cache/caba/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h

    r869 r915  
    653653
    654654      sc_signal<int>      r_config_fsm;               // FSM state
    655       sc_signal<bool>     r_config_lock;              // lock protecting exclusive access
    656655      sc_signal<int>      r_config_cmd;               // config request type
    657656      sc_signal<addr_t>   r_config_address;           // target buffer physical address
  • branches/reconfiguration/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r899 r915  
    694694        uint8_t req_y = (req_srcid >> (srcid_width - m_x_width - m_y_width)) & ((1 << m_y_width) - 1);
    695695
    696         return abs(m_x_self - req_x) + abs(m_y_self - req_y);
     696        return abs(m_x_self - req_x) + abs(m_y_self - req_y) + 1;
    697697    }
    698698
     
    702702    /////////////////////////////////////////////////////
    703703    {
    704         return req_distance(req_srcid) == 0;
     704        return req_distance(req_srcid) == 1;
    705705    }
    706706
     
    896896    }
    897897
    898     /////////////////////////////////////////
     898    //////////////////////////////////////////////////////////////
    899899    tmpl(void)::print_stats(bool activity_counters, bool stats)
    900     /////////////////////////////////////////
     900    /////////////////////////////////////////////////////////////
    901901    {
    902902        std::cout << "**********************************" << std::dec << std::endl;
     
    10761076
    10771077            r_config_cmd  = MEMC_CMD_NOP;
    1078             r_config_lock = false;
    10791078
    10801079            m_config_to_cc_send_inst_fifo.init();
     
    14771476                    case MEMC_CONFIG:
    14781477                    {
    1479                         if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_READ) // get lock
    1480                                 and (regr == MEMC_LOCK))
    1481                         {
    1482                             rdata         = (uint32_t) r_config_lock.read();
    1483                             need_rsp      = true;
    1484                             error         = 0;
    1485                             r_config_lock = true;
    1486                         }
    1487                         else if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE)  // release lock
    1488                                 and (regr == MEMC_LOCK))
    1489                         {
    1490                             need_rsp = true;
    1491                             error    = 0;
    1492                             r_config_lock = false;
    1493                         }
    1494                         else if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE)   // set addr_lo
     1478                        if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE)   // set addr_lo
    14951479                                and (regr == MEMC_ADDR_LO))
    14961480                        {
     
    17181702                        m_cpt_ll_cost += 5 * req_distance(p_vci_tgt.srcid.read());
    17191703                    }
    1720                     else {
     1704                    else
     1705                    {
    17211706                        if (is_local_req(p_vci_tgt.srcid.read()))
    17221707                        {
     
    17551740                    cmd_write_fifo_put = true;
    17561741                    // <Activity counters>
    1757                     if (p_vci_tgt.cmd.read() == vci_param_int::CMD_NOP)
    1758                     {
    1759                         // (2 (CMD) + 1 (RSP)) flits VCI => 4 + (1 (success) || 2 (failure)) flits dspin
    1760                         m_cpt_sc_cost += 5 * req_distance(p_vci_tgt.srcid.read());
    1761                     }
    1762                     else {
     1742                    if (p_vci_tgt.cmd.read() != vci_param_int::CMD_NOP)
     1743                    {
    17631744                        if (is_local_req(p_vci_tgt.srcid.read()))
    17641745                        {
     
    17691750                            m_cpt_write_flits_remote++;
    17701751                        }
    1771                         // (burst_size (CMD) + 1 (RSP) flits VCI => 2 + burst_size + 1 flits dspin
    1772                         m_cpt_write_cost += (3 + (plen >> 2)) * req_distance(p_vci_tgt.srcid.read());
    17731752                    }
    17741753                    // </Activity counters>
     
    17791758                        if (p_vci_tgt.cmd.read() == vci_param_int::CMD_NOP)
    17801759                        {
     1760                            // SC
     1761                            // (2 (CMD) + 1 (RSP)) flits VCI => 4 + (1 (success) || 2 (failure)) flits dspin
     1762                            m_cpt_sc_cost += 5 * req_distance(p_vci_tgt.srcid.read());
    17811763                            if (is_local_req(p_vci_tgt.srcid.read()))
    17821764                            {
     
    17881770                            }
    17891771                        }
    1790                         else {
     1772                        else
     1773                        {
     1774                            // Writes
     1775                            // (burst_size + 1 (CMD) + 1 (RSP)) flits VCI => 2 + burst_size + 1 flits dspin
     1776                            m_cpt_write_cost += (3 + (plen >> 2)) * req_distance(p_vci_tgt.srcid.read());
     1777
    17911778                            if (is_local_req(p_vci_tgt.srcid.read()))
    17921779                            {
     
    20212008        //    CONFIG FSM
    20222009        ////////////////////////////////////////////////////////////////////////////////////
    2023         // The CONFIG FSM handles the VCI configuration requests (INVAL & SYNC).
     2010        // The CONFIG FSM handles the L2/L3 coherence requests:
    20242011        // The target buffer can have any size, and there is one single command for
    20252012        // all cache lines covered by the target buffer.
    2026         //
    2027         // An INVAL or SYNC configuration operation is defined by the following registers:
     2013        // An INVAL or SYNC operation is defined by the following registers:
    20282014        // - bool      r_config_cmd        : INVAL / SYNC / NOP
    20292015        // - uint64_t  r_config_address    : buffer base address
     
    20652051        //   The CONFIG SYNC response is sent only when the last PUT response is received.
    20662052        //
    2067         // From the software point of view, a configuration request is a sequence
    2068         // of 6 atomic accesses in an uncached segment. A dedicated lock is used
    2069         // to handle only one configuration command at a given time:
    2070         // - Read  MEMC_LOCK       : Get the lock
     2053        // From the software point of view, a L2/L3 coherence request is a sequence
     2054        // of 4 atomic accesses in an uncached segment:
    20712055        // - Write MEMC_ADDR_LO    : Set the buffer address LSB
    20722056        // - Write MEMC_ADDR_HI    : Set the buffer address MSB
    20732057        // - Write MEMC_BUF_LENGTH : set buffer length (bytes)
    20742058        // - Write MEMC_CMD_TYPE   : launch the actual operation
    2075         // - WRITE MEMC_LOCK       : release the lock
    20762059        ////////////////////////////////////////////////////////////////////////////////////
    20772060
     
    29442927                    m_heap.write_free_entry(heap_entry);
    29452928                    m_heap.write_free_ptr(r_read_next_ptr.read());
    2946                     if (r_read_last_free.read())  {
     2929                    if (r_read_last_free.read())
     2930                    {
    29472931                        m_heap.set_full();
    29482932                    }
     
    64646448                        data_vector.push_back(m_cmd_cas_wdata_fifo.read());
    64656449                    }
    6466                     else {
     6450                    else
     6451                    {
    64676452                        // unmodified words
    64686453                        data_vector.push_back(r_cas_data[i].read());
     
    75237508                    m_cpt_cleanup_local++;
    75247509                }
    7525                 else {
     7510                else
     7511                {
    75267512                    m_cpt_cleanup_remote++;
    75277513                }
     
    91999185                        p_vci_tgt.rdata = r_xram_rsp_to_tgt_rsp_ll_key.read();
    92009186                    }
    9201                     else {
     9187                    else
     9188                    {
    92029189                        // LL response second flit or READ response
    92039190                        p_vci_tgt.rdata = r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read();
Note: See TracChangeset for help on using the changeset viewer.