@@ -265,7 +265,7 @@ static void min_global_cost_map(vtr::NdMatrix<util::Cost_Entry, 3>& internal_opi
265265 * @param delta_y
266266 * @return (delay, congestion)
267267 */
268- static std::pair<float , float > get_cost_from_src_opin (const std::map<int , util::t_reachable_wire_inf>& src_opin_delay_map,
268+ static std::pair<float , float > get_cost_from_src_opin (const std::vector<std:: map<int , util::t_reachable_wire_inf> >& src_opin_delay_map,
269269 int delta_x,
270270 int delta_y,
271271 int to_layer_num);
@@ -471,7 +471,7 @@ std::pair<float, float> MapLookahead::get_expected_delay_and_cong(RRNodeId from_
471471
472472 auto from_ptc = rr_graph.node_ptc_num (from_node);
473473
474- std::tie (expected_delay_cost, expected_cong_cost) = get_cost_from_src_opin (src_opin_delays[from_layer_num][from_tile_index][from_ptc][to_layer_num] ,
474+ std::tie (expected_delay_cost, expected_cong_cost) = get_cost_from_src_opin (src_opin_delays[from_layer_num][from_tile_index][from_ptc],
475475 delta_x,
476476 delta_y,
477477 to_layer_num);
@@ -1490,63 +1490,70 @@ static void min_global_cost_map(vtr::NdMatrix<util::Cost_Entry, 3>& internal_opi
14901490 }
14911491}
14921492
1493- static std::pair<float , float > get_cost_from_src_opin (const std::map<int , util::t_reachable_wire_inf>& src_opin_delay_map,
1493+ static std::pair<float , float > get_cost_from_src_opin (const std::vector<std:: map<int , util::t_reachable_wire_inf> >& src_opin_delay_map,
14941494 int delta_x,
14951495 int delta_y,
14961496 int to_layer_num) {
14971497 float expected_delay_cost = std::numeric_limits<float >::infinity ();
14981498 float expected_cong_cost = std::numeric_limits<float >::infinity ();
1499- if (src_opin_delay_map.empty ()) {
1500- // During lookahead profiling we were unable to find any wires which connected
1501- // to this PTC.
1502- //
1503- // This can sometimes occur at very low channel widths (e.g. during min W search on
1504- // small designs) where W discretization combined with fraction Fc may cause some
1505- // pins/sources to be left disconnected.
1506- //
1507- // Such RR graphs are of course unroutable, but that should be determined by the
1508- // router. So just return an arbitrary value here rather than error.
1509-
1510- // We choose to return the largest (non-infinite) value possible, but scaled
1511- // down by a large factor to maintain some dynaimc range in case this value ends
1512- // up being processed (e.g. by the timing analyzer).
1513- //
1514- // The cost estimate should still be *extremely* large compared to a typical delay, and
1515- // so should ensure that the router de-prioritizes exploring this path, but does not
1516- // forbid the router from trying.
1517- expected_delay_cost = std::numeric_limits<float >::max () / 1e12 ;
1518- expected_cong_cost = std::numeric_limits<float >::max () / 1e12 ;
1519- } else {
1520- // From the current SOURCE/OPIN we look-up the wiretypes which are reachable
1521- // and then add the estimates from those wire types for the distance of interest.
1522- // If there are multiple options we use the minimum value.
1523- for (const auto & kv : src_opin_delay_map) {
1524- const util::t_reachable_wire_inf& reachable_wire_inf = kv.second ;
1525-
1526- Cost_Entry wire_cost_entry;
1527- if (reachable_wire_inf.wire_rr_type == SINK) {
1528- // Some pins maybe reachable via a direct (OPIN -> IPIN) connection.
1529- // In the lookahead, we treat such connections as 'special' wire types
1530- // with no delay/congestion cost
1531- wire_cost_entry.delay = 0 ;
1532- wire_cost_entry.congestion = 0 ;
1533- } else {
1534- // For an actual accessible wire, we query the wire look-up to get it's
1535- // delay and congestion cost estimates
1536- wire_cost_entry = get_wire_cost_entry (reachable_wire_inf.wire_rr_type ,
1537- reachable_wire_inf.wire_seg_index ,
1538- reachable_wire_inf.layer_number ,
1539- delta_x,
1540- delta_y,
1541- to_layer_num);
1542- }
15431499
1544- float this_delay_cost = reachable_wire_inf.delay + wire_cost_entry.delay ;
1545- float this_cong_cost = reachable_wire_inf.congestion + wire_cost_entry.congestion ;
1500+ for (const auto & layer_src_opin_delay_map : src_opin_delay_map) {
1501+ float layer_expected_delay_cost = std::numeric_limits<float >::infinity ();
1502+ float layer_expected_cong_cost = std::numeric_limits<float >::infinity ();
1503+ if (layer_src_opin_delay_map.empty ()) {
1504+ // During lookahead profiling we were unable to find any wires which connected
1505+ // to this PTC.
1506+ //
1507+ // This can sometimes occur at very low channel widths (e.g. during min W search on
1508+ // small designs) where W discretization combined with fraction Fc may cause some
1509+ // pins/sources to be left disconnected.
1510+ //
1511+ // Such RR graphs are of course unroutable, but that should be determined by the
1512+ // router. So just return an arbitrary value here rather than error.
1513+
1514+ // We choose to return the largest (non-infinite) value possible, but scaled
1515+ // down by a large factor to maintain some dynaimc range in case this value ends
1516+ // up being processed (e.g. by the timing analyzer).
1517+ //
1518+ // The cost estimate should still be *extremely* large compared to a typical delay, and
1519+ // so should ensure that the router de-prioritizes exploring this path, but does not
1520+ // forbid the router from trying.
1521+ layer_expected_delay_cost = std::numeric_limits<float >::max () / 1e12 ;
1522+ layer_expected_cong_cost = std::numeric_limits<float >::max () / 1e12 ;
1523+ } else {
1524+ // From the current SOURCE/OPIN we look-up the wiretypes which are reachable
1525+ // and then add the estimates from those wire types for the distance of interest.
1526+ // If there are multiple options we use the minimum value.
1527+ for (const auto & kv : layer_src_opin_delay_map) {
1528+ const util::t_reachable_wire_inf& reachable_wire_inf = kv.second ;
1529+
1530+ Cost_Entry wire_cost_entry;
1531+ if (reachable_wire_inf.wire_rr_type == SINK) {
1532+ // Some pins maybe reachable via a direct (OPIN -> IPIN) connection.
1533+ // In the lookahead, we treat such connections as 'special' wire types
1534+ // with no delay/congestion cost
1535+ wire_cost_entry.delay = 0 ;
1536+ wire_cost_entry.congestion = 0 ;
1537+ } else {
1538+ // For an actual accessible wire, we query the wire look-up to get it's
1539+ // delay and congestion cost estimates
1540+ wire_cost_entry = get_wire_cost_entry (reachable_wire_inf.wire_rr_type ,
1541+ reachable_wire_inf.wire_seg_index ,
1542+ reachable_wire_inf.layer_number ,
1543+ delta_x,
1544+ delta_y,
1545+ to_layer_num);
1546+ }
1547+
1548+ float this_delay_cost = reachable_wire_inf.delay + wire_cost_entry.delay ;
1549+ float this_cong_cost = reachable_wire_inf.congestion + wire_cost_entry.congestion ;
15461550
1547- expected_delay_cost = std::min (expected_delay_cost, this_delay_cost);
1548- expected_cong_cost = std::min (expected_cong_cost, this_cong_cost);
1551+ layer_expected_delay_cost = std::min (layer_expected_delay_cost, this_delay_cost);
1552+ layer_expected_cong_cost = std::min (layer_expected_cong_cost, this_cong_cost);
1553+ }
15491554 }
1555+ expected_delay_cost = std::min (expected_delay_cost, layer_expected_delay_cost);
1556+ expected_cong_cost = std::min (expected_cong_cost, layer_expected_cong_cost);
15501557 }
15511558
15521559 return std::make_pair (expected_delay_cost, expected_cong_cost);
0 commit comments