Topology.cc (11663:cf870cd20cfc) | Topology.cc (11664:2365e9e396f7) |
---|---|
1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 74 unchanged lines hidden (view full) --- 83 84 // Internal Links 85 for (vector<BasicIntLink*>::const_iterator i = int_links.begin(); 86 i != int_links.end(); ++i) { 87 BasicIntLink *int_link = (*i); 88 BasicRouter *router_src = int_link->params()->src_node; 89 BasicRouter *router_dst = int_link->params()->dst_node; 90 | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 74 unchanged lines hidden (view full) --- 83 84 // Internal Links 85 for (vector<BasicIntLink*>::const_iterator i = int_links.begin(); 86 i != int_links.end(); ++i) { 87 BasicIntLink *int_link = (*i); 88 BasicRouter *router_src = int_link->params()->src_node; 89 BasicRouter *router_dst = int_link->params()->dst_node; 90 |
91 PortDirection src_outport = int_link->params()->src_outport; 92 PortDirection dst_inport = int_link->params()->dst_inport; 93 |
|
91 // Store the IntLink pointers for later 92 m_int_link_vector.push_back(int_link); 93 94 int src = router_src->params()->router_id + 2*m_nodes; 95 int dst = router_dst->params()->router_id + 2*m_nodes; 96 97 // create the internal uni-directional link from src to dst | 94 // Store the IntLink pointers for later 95 m_int_link_vector.push_back(int_link); 96 97 int src = router_src->params()->router_id + 2*m_nodes; 98 int dst = router_dst->params()->router_id + 2*m_nodes; 99 100 // create the internal uni-directional link from src to dst |
98 addLink(src, dst, int_link); | 101 addLink(src, dst, int_link, src_outport, dst_inport); |
99 } 100} 101 102void 103Topology::createLinks(Network *net) 104{ 105 // Find maximum switchID 106 SwitchID max_switch_id = 0; --- 41 unchanged lines hidden (view full) --- 148 shortest_path_to_node(i, j, topology_weights, dist); 149 makeLink(net, i, j, destination_set); 150 } 151 } 152 } 153} 154 155void | 102 } 103} 104 105void 106Topology::createLinks(Network *net) 107{ 108 // Find maximum switchID 109 SwitchID max_switch_id = 0; --- 41 unchanged lines hidden (view full) --- 151 shortest_path_to_node(i, j, topology_weights, dist); 152 makeLink(net, i, j, destination_set); 153 } 154 } 155 } 156} 157 158void |
156Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link) | 159Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link, 160 PortDirection src_outport_dirn, 161 PortDirection dst_inport_dirn) |
157{ 158 assert(src <= m_number_of_switches+m_nodes+m_nodes); 159 assert(dest <= m_number_of_switches+m_nodes+m_nodes); 160 161 std::pair<int, int> src_dest_pair; 162 LinkEntry link_entry; 163 164 src_dest_pair.first = src; 165 src_dest_pair.second = dest; 166 link_entry.link = link; | 162{ 163 assert(src <= m_number_of_switches+m_nodes+m_nodes); 164 assert(dest <= m_number_of_switches+m_nodes+m_nodes); 165 166 std::pair<int, int> src_dest_pair; 167 LinkEntry link_entry; 168 169 src_dest_pair.first = src; 170 src_dest_pair.second = dest; 171 link_entry.link = link; |
172 link_entry.src_outport_dirn = src_outport_dirn; 173 link_entry.dst_inport_dirn = dst_inport_dirn; |
|
167 m_link_map[src_dest_pair] = link_entry; 168} 169 170void 171Topology::makeLink(Network *net, SwitchID src, SwitchID dest, 172 const NetDest& routing_table_entry) 173{ 174 // Make sure we're not trying to connect two end-point nodes --- 19 unchanged lines hidden (view full) --- 194 routing_table_entry); 195 } else { 196 assert((src >= 2 * m_nodes) && (dest >= 2 * m_nodes)); 197 src_dest.first = src; 198 src_dest.second = dest; 199 link_entry = m_link_map[src_dest]; 200 net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes), 201 link_entry.link, | 174 m_link_map[src_dest_pair] = link_entry; 175} 176 177void 178Topology::makeLink(Network *net, SwitchID src, SwitchID dest, 179 const NetDest& routing_table_entry) 180{ 181 // Make sure we're not trying to connect two end-point nodes --- 19 unchanged lines hidden (view full) --- 201 routing_table_entry); 202 } else { 203 assert((src >= 2 * m_nodes) && (dest >= 2 * m_nodes)); 204 src_dest.first = src; 205 src_dest.second = dest; 206 link_entry = m_link_map[src_dest]; 207 net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes), 208 link_entry.link, |
202 routing_table_entry); | 209 routing_table_entry, 210 link_entry.src_outport_dirn, 211 link_entry.dst_inport_dirn); |
203 } 204} 205 206// The following all-pairs shortest path algorithm is based on the 207// discussion from Cormen et al., Chapter 26.1. 208void 209Topology::extend_shortest_path(Matrix ¤t_dist, Matrix &latencies, 210 Matrix &inter_switches) --- 88 unchanged lines hidden --- | 212 } 213} 214 215// The following all-pairs shortest path algorithm is based on the 216// discussion from Cormen et al., Chapter 26.1. 217void 218Topology::extend_shortest_path(Matrix ¤t_dist, Matrix &latencies, 219 Matrix &inter_switches) --- 88 unchanged lines hidden --- |