@@ -1889,6 +1889,81 @@ void FastRouteCore::getOverflowPositions(
18891889 }
18901890}
18911891
1892+ // Search in range of 5 the correct adjustment to fix the overflow
1893+ void FastRouteCore::getPrecisionAdjustment (const int x,
1894+ const int y,
1895+ bool is_horizontal,
1896+ int & adjustment)
1897+ {
1898+ int new_2D_cap, usage_2D, range = 5 ;
1899+ if (is_horizontal) {
1900+ usage_2D = graph2d_.getUsageH (x, y);
1901+ } else {
1902+ usage_2D = graph2d_.getUsageV (x, y);
1903+ }
1904+
1905+ new_2D_cap = 0 ;
1906+ while (range > 0 && new_2D_cap < usage_2D) {
1907+ // calculate new capacity with adjustment
1908+ for (int l = 0 ; l < num_layers_; l++) {
1909+ if (is_horizontal) {
1910+ new_2D_cap
1911+ += (1.0 - (adjustment / 100.0 )) * h_edges_3D_[l][y][x].real_cap ;
1912+ } else {
1913+ new_2D_cap
1914+ += (1.0 - (adjustment / 100.0 )) * v_edges_3D_[l][y][x].real_cap ;
1915+ }
1916+ }
1917+ // Reduce adjustment to increase capacity
1918+ if (usage_2D > new_2D_cap) {
1919+ adjustment--;
1920+ new_2D_cap = 0 ;
1921+ }
1922+ range--;
1923+ }
1924+ }
1925+
1926+ // For each edge with overflow, calculate the ideal adjustment
1927+ // Return the minimum value of all or -1 if no value can be found
1928+ bool FastRouteCore::computeSuggestedAdjustment (int & suggested_adjustment)
1929+ {
1930+ int horizontal_suggest = 100 , local_suggest;
1931+ bool has_new_adj;
1932+ // Find horizontal ggrids with congestion
1933+ for (const auto & [x, y] : graph2d_.getUsedGridsH ()) {
1934+ const int overflow = graph2d_.getOverflowH (x, y);
1935+ if (overflow > 0 ) {
1936+ has_new_adj
1937+ = graph2d_.computeSuggestedAdjustment (x, y, true , local_suggest);
1938+ if (has_new_adj) {
1939+ // modify the value to resolve the congestion at the position
1940+ getPrecisionAdjustment (x, y, true , local_suggest);
1941+ horizontal_suggest = std::min (horizontal_suggest, local_suggest);
1942+ } else {
1943+ return false ;
1944+ }
1945+ }
1946+ }
1947+ int vertical_suggest = 100 ;
1948+ // Find vertical ggrids with congestion
1949+ for (const auto & [x, y] : graph2d_.getUsedGridsV ()) {
1950+ const int overflow = graph2d_.getOverflowV (x, y);
1951+ if (overflow > 0 ) {
1952+ has_new_adj
1953+ = graph2d_.computeSuggestedAdjustment (x, y, false , local_suggest);
1954+ if (has_new_adj) {
1955+ // modify the value to resolve the congestion at the position
1956+ getPrecisionAdjustment (x, y, false , local_suggest);
1957+ vertical_suggest = std::min (vertical_suggest, local_suggest);
1958+ } else {
1959+ return false ;
1960+ }
1961+ }
1962+ }
1963+ suggested_adjustment = std::min (horizontal_suggest, vertical_suggest);
1964+ return true ;
1965+ }
1966+
18921967// The function will add the new nets to the congestion_nets set
18931968void FastRouteCore::getCongestionNets (std::set<odb::dbNet*>& congestion_nets)
18941969{
0 commit comments