Ignore:
Timestamp:
Apr 19, 2015, 5:19:35 PM (9 years ago)
Author:
cfuguet
Message:

reconf: mask the global bits of the configuration segment

  • This allow to handle configuration requests for reallocated segments.
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

    r915 r985  
    549549
    550550      // Component attributes
    551       std::list<soclib::common::Segment> m_seglist;          // segments allocated
    552551      size_t                             m_nseg;             // number of segments
    553       soclib::common::Segment            **m_seg;            // array of segments pointers
    554       size_t                             m_seg_config;       // config segment index
    555552      const size_t                       m_srcid_x;          // global index on RAM network
    556553      const size_t                       m_initiators;       // Number of initiators
     
    587584
    588585      // broadcast address
    589       uint32_t                           m_broadcast_boundaries;
     586      uint32_t m_broadcast_boundaries;
    590587
    591588      // configuration interface constants
     589      soclib::common::Segment* m_config_seg;
    592590      const uint32_t m_config_addr_mask;
    593591      const uint32_t m_config_regr_width;
  • branches/reconfiguration/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r919 r985  
    373373        p_dspin_clack("p_dspin_clack"),
    374374
    375         m_seglist(mtp.getSegmentList(tgtid_d)),
    376375        m_nseg(0),
    377376        m_srcid_x(mtx.indexForId(srcid_x)),
     
    408407
    409408        // CONFIG interface
     409        m_config_seg(NULL),
    410410        m_config_addr_mask((1 << 12) - 1),
    411 
    412411        m_config_regr_width(7),
    413412        m_config_func_width(3),
     
    532531
    533532            // Get the segments associated to the MemCache
     533            std::list<soclib::common::Segment> seglist = mtp.getSegmentList(tgtid_d);
    534534            std::list<soclib::common::Segment>::iterator seg;
    535             size_t i = 0;
    536 
    537             for (seg = m_seglist.begin(); seg != m_seglist.end(); seg++)
     535            for (seg = seglist.begin(); seg != seglist.end(); seg++)
    538536            {
    539537                std::cout << "    => segment " << seg->name()
     
    543541            }
    544542
    545             assert((m_nseg > 0) and
    546                     "MEMC ERROR : At least one segment must be mapped to this component");
    547 
    548             m_seg = new soclib::common::Segment*[m_nseg];
    549 
    550             for (seg = m_seglist.begin(); seg != m_seglist.end(); seg++)
    551             {
    552                 if (seg->special()) m_seg_config = i;
    553                 m_seg[i] = & (*seg);
    554                 i++;
    555             }
    556 
    557             addr_t gid = m_seg[0]->baseAddress() >> (vci_param_int::N - x_width - y_width);
     543            assert((m_nseg > 1) and
     544                    "MEMC ERROR : At least two segments must be mapped to this component");
     545
     546            for (seg = seglist.begin(); seg != seglist.end(); ++seg)
     547            {
     548                if (!seg->special()) continue;
     549                m_config_seg = new soclib::common::Segment(*seg);
     550                break;
     551            }
     552
     553            assert(m_config_seg && "MEMC_ERROR: the configuration segment is not mapped");
     554
     555            const int cluster_offset_width = (vci_param_int::N - x_width - y_width);
     556            const addr_t cluster_offset_mask = (1ULL << cluster_offset_width) - 1;
     557
     558            addr_t gid = m_config_seg->baseAddress() >> cluster_offset_width;
    558559            m_x_self = (gid >> m_y_width) & ((1 << m_x_width) - 1);
    559560            m_y_self =  gid               & ((1 << m_y_width) - 1);
     561
     562            // mask the cluster coordinates to support configuration requests on
     563            // reallocated segments
     564            *m_config_seg = m_config_seg->masked(cluster_offset_mask);
    560565
    561566            // Allocation for IXR_RSP FSM
     
    987992    /////////////////////////////////
    988993    {
    989         delete [] m_seg;
     994        if (m_config_seg) delete m_config_seg;
    990995
    991996        delete [] r_ixr_rsp_to_xram_rsp_rok;
     
    13031308                    }
    13041309#endif
    1305                     // checking segmentation violation
    1306                     addr_t   address = p_vci_tgt.address.read();
    1307                     uint32_t plen    = p_vci_tgt.plen.read();
    1308                     bool     config  = false;
    1309 
    1310                     for (size_t seg_id = 0; (seg_id < m_nseg) ; seg_id++)
    1311                     {
    1312                         if (m_seg[seg_id]->contains(address) &&
    1313                                 m_seg[seg_id]->contains(address + plen - vci_param_int::B))
    1314                         {
    1315                             if (m_seg[seg_id]->special()) config = true;
    1316                         }
    1317                     }
    1318 
    1319                     if (config)     /////////// configuration command
    1320                     {
     1310                    // check for configuration commands
     1311                    uint32_t plen = p_vci_tgt.plen.read();
     1312                    addr_t   mask = (1ULL << (vci_param_int::N - m_x_width - m_y_width)) - 1;
     1313                    addr_t   base = p_vci_tgt.address.read() & mask;
     1314                    addr_t   last = base + plen - vci_param_int::B;
     1315
     1316                    if (m_config_seg->contains(base) && m_config_seg->contains(last))
     1317                    {
     1318                        // configuration command
    13211319                        if (!p_vci_tgt.eop.read()) r_tgt_cmd_fsm = TGT_CMD_ERROR;
    13221320                        else                       r_tgt_cmd_fsm = TGT_CMD_CONFIG;
    13231321                    }
    1324                     else           //////////// memory access
    1325                     {
     1322                    else
     1323                    {
     1324                        // memory access
    13261325                        if (p_vci_tgt.cmd.read() == vci_param_int::CMD_READ)
    13271326                        {
Note: See TracChangeset for help on using the changeset viewer.