|
2 | 2 |
|
3 | 3 | #include <algorithm> |
4 | 4 | #include <cmath> /* Needed only for sqrt call (remove if sqrt removed) */ |
| 5 | +#include <cstddef> |
5 | 6 | #include <fstream> |
6 | 7 | #include <iomanip> |
7 | 8 | #include <numeric> |
@@ -108,9 +109,6 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph, |
108 | 109 | rr_indexed_data[RRIndexedDataId(i)].C_load = 0.; |
109 | 110 | } |
110 | 111 |
|
111 | | - //TODO: SM: IPIN t_linear assumes wire_to_ipin_switch which corresponds to within die switch connection |
112 | | - rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = rr_graph.rr_switch_inf(wire_to_ipin_switch).Tdel; |
113 | | - |
114 | 112 | std::vector<int> ortho_costs = find_ortho_cost_index(rr_graph, segment_inf_x, segment_inf_y, e_parallel_axis::X_AXIS); |
115 | 113 |
|
116 | 114 | /* AA: The code below should replace find_ortho_cost_index call once we deprecate the CLASSIC lookahead as it is the only lookahead |
@@ -531,12 +529,25 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, |
531 | 529 | vtr::vector<RRIndexedDataId, std::vector<float>> switch_Cinternal_total(rr_indexed_data.size()); |
532 | 530 | vtr::vector<RRIndexedDataId, short> switches_buffered(rr_indexed_data.size(), LIBRRGRAPH_UNDEFINED_VAL); |
533 | 531 |
|
| 532 | + std::map<short, int> ipin_switch_count; |
| 533 | + |
534 | 534 | // Walk through the RR graph and collect all R and C values of all the nodes, |
535 | 535 | // as well as their fan-in switches R, T_del, and Cinternal values. |
536 | 536 | // The median of R and C values for each cost index is assigned to the indexed data. |
537 | 537 | for (const RRNodeId rr_id : rr_graph.nodes()) { |
538 | 538 | e_rr_type rr_type = rr_graph.node_type(rr_id); |
539 | 539 |
|
| 540 | + if (rr_type == e_rr_type::IPIN) { |
| 541 | + for (const RREdgeId edge : fan_in_list[rr_id]) { |
| 542 | + short switch_index = rr_graph.rr_nodes().edge_switch(edge); |
| 543 | + if (ipin_switch_count.find(switch_index) == ipin_switch_count.end()) { |
| 544 | + ipin_switch_count[switch_index] = 1; |
| 545 | + } else { |
| 546 | + ipin_switch_count[switch_index]++; |
| 547 | + } |
| 548 | + } |
| 549 | + } |
| 550 | + |
540 | 551 | if (!is_chanxy(rr_type) && !is_chanz(rr_type)) { |
541 | 552 | continue; |
542 | 553 | } |
@@ -590,6 +601,16 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, |
590 | 601 | } |
591 | 602 | } |
592 | 603 |
|
| 604 | + int most_frequent_ipin_switch = -1; |
| 605 | + for (const auto& [switch_index, count] : ipin_switch_count) { |
| 606 | + if (count > most_frequent_ipin_switch_count) { |
| 607 | + most_frequent_ipin_switch = switch_index; |
| 608 | + } |
| 609 | + } |
| 610 | + VTR_ASSERT(most_frequent_ipin_switch != -1); |
| 611 | + rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = rr_graph.rr_switch_inf(RRSwitchId(most_frequent_ipin_switch)).Tdel; |
| 612 | + |
| 613 | + |
593 | 614 | unsigned num_occurences_of_no_instances_with_cost_index = 0; |
594 | 615 | for (size_t cost_index = CHANX_COST_INDEX_START; cost_index < rr_indexed_data.size(); cost_index++) { |
595 | 616 | if (num_nodes_of_index[RRIndexedDataId(cost_index)] == 0) { // Segments don't exist. |
|
0 commit comments