src/mem/ruby/network/Topology.cc
// Note: In this file, we use the first 2*m_nodes SwitchIDs to
// represent the input and output endpoint links.  These really are
// not 'switches', as they will not have a Switch object allocated for
// them. The first m_nodes SwitchIDs are the links into the network,
// the second m_nodes set of SwitchIDs represent the the output queues
// of the network.
In this file, we use the first 2*m_nodes SwitchIDs to
represent the input and output endpoint links.  These really are
not 'switches', as they will not have a Switch object allocated for
them. The first m_nodes SwitchIDs are the links into the network,
the second m_nodes set of SwitchIDs represent the the output queues
of the network.
In this file we use the first 2 * m_nodes SwitchIDs to represent the input and output endpoint links . These really are not ' switches ' as they will not have a Switch object allocated for them . The first m_nodes SwitchIDs are the links into the network the second m_nodes set of SwitchIDs represent the the output queues of the network .
Topology::Topology(uint32_t num_nodes, uint32_t num_routers,
                   uint32_t num_vnets,
                   const std::vector<BasicExtLink *> &ext_links,
                   const std::vector<BasicIntLink *> &int_links)
    : m_nodes(MachineType_base_number(MachineType_NUM)),
      m_number_of_switches(num_routers), m_vnets(num_vnets),
      m_ext_link_vector(ext_links), m_int_link_vector(int_links)
{
    assert(m_nodes > 1);
     External Links
    for (std::vector<BasicExtLink*>::const_iterator i = ext_links.begin();
         i != ext_links.end(); ++i) {
        BasicExtLink *ext_link = (*i);
        AbstractController *abs_cntrl = ext_link->params().ext_node;
        BasicRouter *router = ext_link->params().int_node;
        int machine_base_idx = MachineType_base_number(abs_cntrl->getType());
        int ext_idx1 = machine_base_idx + abs_cntrl->getVersion();
        int ext_idx2 = ext_idx1 + m_nodes;
        int int_idx = router->params().router_id + 2*m_nodes;
         create the internal uni-directional links in both directions
         ext to int
        addLink(ext_idx1, int_idx, ext_link);
         int to ext
        addLink(int_idx, ext_idx2, ext_link);
    }
     Internal Links
    for (std::vector<BasicIntLink*>::const_iterator i = int_links.begin();
         i != int_links.end(); ++i) {
        BasicIntLink *int_link = (*i);
        BasicRouter *router_src = int_link->params().src_node;
        BasicRouter *router_dst = int_link->params().dst_node;
        PortDirection src_outport = int_link->params().src_outport;
        PortDirection dst_inport = int_link->params().dst_inport;
         Store the IntLink pointers for later
        m_int_link_vector.push_back(int_link);
        int src = router_src->params().router_id + 2*m_nodes;
        int dst = router_dst->params().router_id + 2*m_nodes;
         create the internal uni-directional link from src to dst
        addLink(src, dst, int_link, src_outport, dst_inport);
    }
}
Topology :: Topology ( uint32_t num_nodes , uint32_t num_routers , uint32_t num_vnets , const std :: vector < BasicExtLink * > & ext_links , const std :: vector < BasicIntLink * > & int_links ) : m_nodes ( MachineType_base_number ( MachineType_NUM ) ) , m_number_of_switches ( num_routers ) , m_vnets ( num_vnets ) , m_ext_link_vector ( ext_links ) , m_int_link_vector ( int_links ) { assert ( m_nodes > 1 ) ; for ( std :: vector < BasicExtLink * > :: const_iterator i = ext_links . begin ( ) ; i != ext_links . end ( ) ; ++ i ) { BasicExtLink * ext_link = ( * i ) ; AbstractController * abs_cntrl = ext_link -> params ( ) . ext_node ; BasicRouter * router = ext_link -> params ( ) . int_node ; int machine_base_idx = MachineType_base_number ( abs_cntrl -> getType ( ) ) ; int ext_idx1 = machine_base_idx + abs_cntrl -> getVersion ( ) ; int ext_idx2 = ext_idx1 + m_nodes ; int int_idx = router -> params ( ) . router_id + 2 * m_nodes ; addLink ( ext_idx1 , int_idx , ext_link ) ; addLink ( int_idx , ext_idx2 , ext_link ) ; } for ( std :: vector < BasicIntLink * > :: const_iterator i = int_links . begin ( ) ; i != int_links . end ( ) ; ++ i ) { BasicIntLink * int_link = ( * i ) ; BasicRouter * router_src = int_link -> params ( ) . src_node ; BasicRouter * router_dst = int_link -> params ( ) . dst_node ; PortDirection src_outport = int_link -> params ( ) . src_outport ; PortDirection dst_inport = int_link -> params ( ) . dst_inport ; m_int_link_vector . push_back ( int_link ) ; int src = router_src -> params ( ) . router_id + 2 * m_nodes ; int dst = router_dst -> params ( ) . router_id + 2 * m_nodes ; addLink ( src , dst , int_link , src_outport , dst_inport ) ; } }
Note: In this file, we use the first 2*m_nodes SwitchIDs to
represent the input and output endpoint links.
Note : In this file we use the first 2 * m_nodes SwitchIDs to represent the input and output endpoint links .
// Total nodes/controllers in network // analyze both the internal and external links, create data structures. // The python created external links are bi-directional, // and the python created internal links are uni-directional. // The networks and topology utilize uni-directional links. // Thus each external link is converted to two calls to addLink, // one for each direction. // // External Links // create the internal uni-directional links in both directions // ext to int // int to ext // Internal Links // Store the IntLink pointers for later // create the internal uni-directional link from src to dst