diff --git a/src/grt/README.md b/src/grt/README.md index 3678508fe1f..5a45735f0da 100644 --- a/src/grt/README.md +++ b/src/grt/README.md @@ -31,6 +31,7 @@ global_route [-end_incremental] [-use_cugr] [-resistance_aware] + [-infinite_cap] ``` #### Options @@ -50,6 +51,7 @@ global_route | `-end_incremental` | This flag run incremental GRT with the nets modified. The default is false. | | `-use_cugr` | This flag run GRT using CUGR as the router solver. NOTE: this is not ready for production. | | `-resistance_aware` | This flag enables resistance-aware layer assignment and 3D routing. NOTE: this is not ready for production. | +| `-infinite_cap` | Enables "infinite" gcell capacity for testing purpose. NOTE: this is not recommended for production flows. | ### Set Routing Layers diff --git a/src/grt/include/grt/GlobalRouter.h b/src/grt/include/grt/GlobalRouter.h index a25524a11cf..147a6f74be8 100644 --- a/src/grt/include/grt/GlobalRouter.h +++ b/src/grt/include/grt/GlobalRouter.h @@ -160,6 +160,8 @@ class GlobalRouter skip_large_fanout_ = skip_large_fanout; }; + void setInfiniteCapacity(bool infinite_capacity); + // flow functions void readGuides(const char* file_name); void loadGuidesFromDB(); @@ -513,7 +515,7 @@ class GlobalRouter std::vector routing_tracks_; // Flow variables - bool is_incremental_; + bool infinite_capacity_; float adjustment_; int congestion_iterations_{50}; int congestion_report_iter_step_; @@ -563,6 +565,7 @@ class GlobalRouter // incremental grt GRouteDbCbk* grouter_cbk_; + bool is_incremental_; friend class IncrementalGRoute; friend class GRouteDbCbk; diff --git a/src/grt/src/GlobalRouter.cpp b/src/grt/src/GlobalRouter.cpp index 23c4a4271ca..ba6b62a6ca0 100644 --- a/src/grt/src/GlobalRouter.cpp +++ b/src/grt/src/GlobalRouter.cpp @@ -82,7 +82,7 @@ GlobalRouter::GlobalRouter(utl::Logger* logger, grid_origin_(0, 0), groute_renderer_(nullptr), grid_(new Grid), - is_incremental_(false), + infinite_capacity_(false), adjustment_(0.0), congestion_report_iter_step_(0), allow_congestion_(false), @@ -101,7 +101,8 @@ GlobalRouter::GlobalRouter(utl::Logger* logger, heatmap_(nullptr), heatmap_rudy_(nullptr), congestion_file_name_(nullptr), - grouter_cbk_(nullptr) + grouter_cbk_(nullptr), + is_incremental_(false) { fastroute_ = new FastRouteCore(db_, logger_, callback_handler_, stt_builder_, sta_); @@ -734,6 +735,8 @@ void GlobalRouter::setCapacities(int min_routing_layer, int max_routing_layer) fastroute_->initEdges(); int x_grids = grid_->getXGrids(); int y_grids = grid_->getYGrids(); + const int kBigInt = std::numeric_limits::max(); + const int16_t kBigCap = std::numeric_limits::max() / 10; for (int layer = 1; layer <= grid_->getNumLayers(); layer++) { odb::dbTechLayer* tech_layer = db_->getTech()->findRoutingLayer(layer); @@ -748,44 +751,49 @@ void GlobalRouter::setCapacities(int min_routing_layer, int max_routing_layer) = tech_layer->getDirection() == odb::dbTechLayerDir::HORIZONTAL; if (tech_layer->getDirection() == odb::dbTechLayerDir::HORIZONTAL) { - int min_cap = std::numeric_limits::max(); + int min_cap = kBigInt; for (int y = 1; y <= y_grids; y++) { for (int x = 1; x < x_grids; x++) { - const int cap = inside_layer_range ? computeGCellCapacity(x - 1, - y - 1, - track_init, - track_pitch, - track_count, - horizontal) - : 0; + int cap = 0; + if (infinite_capacity_) { + cap = kBigCap; + } else if (inside_layer_range) { + cap = computeGCellCapacity( + x - 1, y - 1, track_init, track_pitch, track_count, horizontal); + } min_cap = std::min(min_cap, cap); fastroute_->setEdgeCapacity(x - 1, y - 1, x, y - 1, layer, cap); } } - min_cap = min_cap == std::numeric_limits::max() ? 0 : min_cap; + min_cap = min_cap == kBigInt ? 0 : min_cap; fastroute_->addHCapacity(min_cap, layer); } else { - int min_cap = std::numeric_limits::max(); + int min_cap = kBigInt; for (int x = 1; x <= x_grids; x++) { for (int y = 1; y < y_grids; y++) { - const int cap = inside_layer_range ? computeGCellCapacity(x - 1, - y - 1, - track_init, - track_pitch, - track_count, - horizontal) - : 0; + int cap = 0; + if (infinite_capacity_) { + cap = kBigCap; + } else if (inside_layer_range) { + cap = computeGCellCapacity( + x - 1, y - 1, track_init, track_pitch, track_count, horizontal); + } min_cap = std::min(min_cap, cap); fastroute_->setEdgeCapacity(x - 1, y - 1, x - 1, y, layer, cap); } } - min_cap = min_cap == std::numeric_limits::max() ? 0 : min_cap; + min_cap = min_cap == kBigInt ? 0 : min_cap; fastroute_->addVCapacity(min_cap, layer); } } fastroute_->initLowerBoundCapacities(); } +void GlobalRouter::setInfiniteCapacity(bool infinite_capacity) +{ + infinite_capacity_ = infinite_capacity; +} + int GlobalRouter::computeGCellCapacity(const int x, const int y, const int track_init, diff --git a/src/grt/src/GlobalRouter.i b/src/grt/src/GlobalRouter.i index f4ada4f1b60..b2bf180bbb8 100644 --- a/src/grt/src/GlobalRouter.i +++ b/src/grt/src/GlobalRouter.i @@ -152,6 +152,12 @@ set_skip_large_fanout(int skip_large_fanout) getGlobalRouter()->setSkipLargeFanoutNets(skip_large_fanout); } +void +set_infinite_cap(bool infinite_capacity) +{ + getGlobalRouter()->setInfiniteCapacity(infinite_capacity); +} + void start_incremental() { getGlobalRouter()->startIncremental(); diff --git a/src/grt/src/GlobalRouter.tcl b/src/grt/src/GlobalRouter.tcl index 8c92dbfe088..3ed44fb7ed5 100644 --- a/src/grt/src/GlobalRouter.tcl +++ b/src/grt/src/GlobalRouter.tcl @@ -152,7 +152,8 @@ sta::define_cmd_args "global_route" {[-guide_file out_file] \ [-start_incremental] \ [-end_incremental] \ [-use_cugr] \ - [-resistance_aware] + [-resistance_aware] \ + [-infinite_cap] } proc global_route { args } { @@ -161,8 +162,8 @@ proc global_route { args } { -grid_origin -critical_nets_percentage -congestion_report_iter_step\ -skip_large_fanout_nets } \ - flags {-allow_congestion -resistance_aware -verbose -start_incremental -end_incremental \ - -use_cugr} + flags {-allow_congestion -resistance_aware -infinite_cap -verbose -start_incremental \ + -end_incremental -use_cugr} sta::check_argc_eq0 "global_route" $args @@ -228,6 +229,9 @@ proc global_route { args } { set resistance_aware [info exists flags(-resistance_aware)] grt::set_resistance_aware $resistance_aware + set infinite_cap [info exists flags(-infinite_cap)] + grt::set_infinite_cap $infinite_cap + set start_incremental [info exists flags(-start_incremental)] set end_incremental [info exists flags(-end_incremental)] diff --git a/src/grt/test/BUILD b/src/grt/test/BUILD index 3d427e95533..23d80fac412 100644 --- a/src/grt/test/BUILD +++ b/src/grt/test/BUILD @@ -32,6 +32,7 @@ TESTS = [ "gcd_cugr", "gcd_flute", "increase_capacity1", + "infinite_cap", "inst_pin_out_of_die", "invalid_pin_placement", "invalid_routing_layer", diff --git a/src/grt/test/CMakeLists.txt b/src/grt/test/CMakeLists.txt index 58ba004406a..3c9dfe5032f 100644 --- a/src/grt/test/CMakeLists.txt +++ b/src/grt/test/CMakeLists.txt @@ -30,6 +30,7 @@ or_integration_tests( gcd_cugr gcd_flute increase_capacity1 + infinite_cap inst_pin_out_of_die invalid_pin_placement invalid_routing_layer diff --git a/src/grt/test/infinite_cap.ok b/src/grt/test/infinite_cap.ok new file mode 100644 index 00000000000..82f0acb151f --- /dev/null +++ b/src/grt/test/infinite_cap.ok @@ -0,0 +1,65 @@ +[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells +[INFO ODB-0128] Design: gcd +[INFO ODB-0130] Created 54 pins. +[INFO ODB-0131] Created 676 components and 2850 component-terminals. +[INFO ODB-0133] Created 579 nets and 1498 connections. +[INFO GRT-0020] Min routing layer: metal2 +[INFO GRT-0021] Max routing layer: metal10 +[INFO GRT-0022] Global adjustment: 0% +[INFO GRT-0023] Grid origin: (0, 0) +[INFO GRT-0088] Layer metal1 Track-Pitch = 0.1400 line-2-Via Pitch: 0.1350 +[INFO GRT-0088] Layer metal2 Track-Pitch = 0.1900 line-2-Via Pitch: 0.1400 +[INFO GRT-0088] Layer metal3 Track-Pitch = 0.1400 line-2-Via Pitch: 0.1400 +[INFO GRT-0088] Layer metal4 Track-Pitch = 0.2800 line-2-Via Pitch: 0.2800 +[INFO GRT-0088] Layer metal5 Track-Pitch = 0.2800 line-2-Via Pitch: 0.2800 +[INFO GRT-0088] Layer metal6 Track-Pitch = 0.2800 line-2-Via Pitch: 0.2800 +[INFO GRT-0088] Layer metal7 Track-Pitch = 0.8000 line-2-Via Pitch: 0.8000 +[INFO GRT-0088] Layer metal8 Track-Pitch = 0.8000 line-2-Via Pitch: 0.8000 +[INFO GRT-0088] Layer metal9 Track-Pitch = 1.6000 line-2-Via Pitch: 1.6000 +[INFO GRT-0088] Layer metal10 Track-Pitch = 1.6000 line-2-Via Pitch: 1.6000 +[INFO GRT-0003] Macros: 0 +[INFO GRT-0004] Blockages: 0 +[INFO GRT-0019] Found 0 clock nets. +[INFO GRT-0001] Minimum degree: 2 +[INFO GRT-0002] Maximum degree: 36 + +[INFO GRT-0053] Routing resources analysis: + Routing Original Derated Resource +Layer Direction Resources Resources Reduction (%) +--------------------------------------------------------------- +metal1 Horizontal 3898440 3898440 0.00% +metal2 Vertical 3898440 3898440 0.00% +metal3 Horizontal 3898440 3898440 0.00% +metal4 Vertical 3898440 3898440 0.00% +metal5 Horizontal 3898440 3898440 0.00% +metal6 Vertical 3898440 3898440 0.00% +metal7 Horizontal 3898440 3898440 0.00% +metal8 Vertical 3898440 3898440 0.00% +metal9 Horizontal 3898440 3898440 0.00% +metal10 Vertical 3898440 3898440 0.00% +--------------------------------------------------------------- + +[INFO GRT-0197] Via related to pin nodes: 2686 +[INFO GRT-0198] Via related Steiner nodes: 44 +[INFO GRT-0199] Via filling finished. +[INFO GRT-0111] Final number of vias: 3505 +[INFO GRT-0112] Final usage 3D: 13039 + +[INFO GRT-0096] Final congestion report: +Layer Resource Demand Usage (%) Max H / Max V / Total Overflow +--------------------------------------------------------------------------------------- +metal1 3898440 0 0.00% 0 / 0 / 0 +metal2 3898440 1172 0.03% 0 / 0 / 0 +metal3 3898440 1212 0.03% 0 / 0 / 0 +metal4 3898440 41 0.00% 0 / 0 / 0 +metal5 3898440 51 0.00% 0 / 0 / 0 +metal6 3898440 48 0.00% 0 / 0 / 0 +metal7 3898440 0 0.00% 0 / 0 / 0 +metal8 3898440 0 0.00% 0 / 0 / 0 +metal9 3898440 0 0.00% 0 / 0 / 0 +metal10 3898440 0 0.00% 0 / 0 / 0 +--------------------------------------------------------------------------------------- +Total 38984400 2524 0.01% 0 / 0 / 0 + +[INFO GRT-0018] Total wirelength: 10767 um +[INFO GRT-0014] Routed nets: 563 diff --git a/src/grt/test/infinite_cap.tcl b/src/grt/test/infinite_cap.tcl new file mode 100644 index 00000000000..7d0483ef936 --- /dev/null +++ b/src/grt/test/infinite_cap.tcl @@ -0,0 +1,8 @@ +source "helpers.tcl" +read_lef "Nangate45/Nangate45.lef" +read_liberty Nangate45/Nangate45_typ.lib +read_def "gcd.def" + +set_routing_layers -signal metal2-metal10 + +global_route -infinite_cap -verbose