@@ -3029,7 +3029,8 @@ void io::Parser::readTechAndLibs(odb::dbDatabase* db)
30293029 }
30303030
30313031 auto tech = db->getTech ();
3032- if (tech == nullptr ) {
3032+ auto block = db_->getChip ()->getBlock ();
3033+ if (tech == nullptr || block == nullptr ) {
30333034 logger_->error (DRT, 136 , " Load design first." );
30343035 }
30353036 getTech ()->setDBUPerUU (tech->getDbUnitsPerMicron ());
@@ -3039,27 +3040,32 @@ void io::Parser::readTechAndLibs(odb::dbDatabase* db)
30393040 setLayers (tech);
30403041
30413042 auto fr_tech = getTech ();
3042- if (!router_cfg_->BOTTOM_ROUTING_LAYER_NAME .empty ()) {
3043- frLayer* layer = fr_tech->getLayer (router_cfg_->BOTTOM_ROUTING_LAYER_NAME );
3043+
3044+ const int min_routing_layer = block->getMinRoutingLayer ();
3045+ if (min_routing_layer > 0 ) {
3046+ odb::dbTechLayer* tech_layer = tech->findRoutingLayer (min_routing_layer);
3047+ frLayer* layer = fr_tech->getLayer (tech_layer->getName ());
30443048 if (layer) {
30453049 router_cfg_->BOTTOM_ROUTING_LAYER = layer->getLayerNum ();
30463050 } else {
30473051 logger_->warn (utl::DRT,
30483052 272 ,
30493053 " bottomRoutingLayer {} not found." ,
3050- router_cfg_-> BOTTOM_ROUTING_LAYER_NAME );
3054+ tech_layer-> getName () );
30513055 }
30523056 }
30533057
3054- if (!router_cfg_->TOP_ROUTING_LAYER_NAME .empty ()) {
3055- frLayer* layer = fr_tech->getLayer (router_cfg_->TOP_ROUTING_LAYER_NAME );
3058+ const int max_routing_layer = block->getMaxRoutingLayer ();
3059+ if (max_routing_layer > 0 ) {
3060+ odb::dbTechLayer* tech_layer = tech->findRoutingLayer (max_routing_layer);
3061+ frLayer* layer = fr_tech->getLayer (tech_layer->getName ());
30563062 if (layer) {
30573063 router_cfg_->TOP_ROUTING_LAYER = layer->getLayerNum ();
30583064 } else {
30593065 logger_->warn (utl::DRT,
30603066 273 ,
30613067 " topRoutingLayer {} not found." ,
3062- router_cfg_-> TOP_ROUTING_LAYER_NAME );
3068+ tech_layer-> getName () );
30633069 }
30643070 } else {
30653071 for (frLayerNum layer_num = fr_tech->getTopLayerNum ();
@@ -3929,8 +3935,9 @@ Point io::TopLayerBTermHandler::getBestViaPosition(Rect pin_rect)
39293935int io::TopLayerBTermHandler::countNetBTermsAboveMaxLayer (odb::dbNet* net)
39303936{
39313937 odb::dbTech* tech = db_->getTech ();
3932- odb::dbTechLayer* top_tech_layer
3933- = tech->findLayer (router_cfg_->TOP_ROUTING_LAYER_NAME .c_str ());
3938+ odb::dbBlock* block = db_->getChip ()->getBlock ();
3939+ const int max_routing_layer = block->getMaxRoutingLayer ();
3940+ odb::dbTechLayer* top_tech_layer = tech->findRoutingLayer (max_routing_layer);
39343941 int bterm_count = 0 ;
39353942 for (auto bterm : net->getBTerms ()) {
39363943 int bterm_bottom_layer_idx = std::numeric_limits<int >::max ();
@@ -4046,14 +4053,14 @@ void io::TopLayerBTermHandler::stackVias(odb::dbBTerm* bterm,
40464053
40474054void io::TopLayerBTermHandler::processBTermsAboveTopLayer (bool has_routing)
40484055{
4049- if (router_cfg_->TOP_ROUTING_LAYER_NAME .empty ()) {
4056+ odb::dbBlock* block = db_->getChip ()->getBlock ();
4057+ const int max_routing_layer = block->getMaxRoutingLayer ();
4058+ if (max_routing_layer < 0 ) {
40504059 return ;
40514060 }
40524061 odb::dbTech* tech = db_->getTech ();
4053- odb::dbBlock* block = db_->getChip ()->getBlock ();
40544062
4055- odb::dbTechLayer* top_tech_layer
4056- = tech->findLayer (router_cfg_->TOP_ROUTING_LAYER_NAME .c_str ());
4063+ odb::dbTechLayer* top_tech_layer = tech->findRoutingLayer (max_routing_layer);
40574064 if (top_tech_layer != nullptr ) {
40584065 int top_layer_idx = top_tech_layer->getRoutingLevel ();
40594066 for (auto bterm : block->getBTerms ()) {
0 commit comments