Skip to content

Commit cfdbdbb

Browse files
committed
drt: get layer range from odb
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
1 parent 421a737 commit cfdbdbb

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

src/drt/src/io/io.cpp

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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,10 @@ Point io::TopLayerBTermHandler::getBestViaPosition(Rect pin_rect)
39293935
int io::TopLayerBTermHandler::countNetBTermsAboveMaxLayer(odb::dbNet* net)
39303936
{
39313937
odb::dbTech* tech = db_->getTech();
3938+
odb::dbBlock* block = db_->getChip()->getBlock();
3939+
const int max_routing_layer = block->getMaxRoutingLayer();
39323940
odb::dbTechLayer* top_tech_layer
3933-
= tech->findLayer(router_cfg_->TOP_ROUTING_LAYER_NAME.c_str());
3941+
= tech->findRoutingLayer(max_routing_layer);
39343942
int bterm_count = 0;
39353943
for (auto bterm : net->getBTerms()) {
39363944
int bterm_bottom_layer_idx = std::numeric_limits<int>::max();
@@ -4046,14 +4054,15 @@ void io::TopLayerBTermHandler::stackVias(odb::dbBTerm* bterm,
40464054

40474055
void io::TopLayerBTermHandler::processBTermsAboveTopLayer(bool has_routing)
40484056
{
4049-
if (router_cfg_->TOP_ROUTING_LAYER_NAME.empty()) {
4057+
odb::dbBlock* block = db_->getChip()->getBlock();
4058+
const int max_routing_layer = block->getMaxRoutingLayer();
4059+
if (max_routing_layer < 0) {
40504060
return;
40514061
}
40524062
odb::dbTech* tech = db_->getTech();
4053-
odb::dbBlock* block = db_->getChip()->getBlock();
40544063

40554064
odb::dbTechLayer* top_tech_layer
4056-
= tech->findLayer(router_cfg_->TOP_ROUTING_LAYER_NAME.c_str());
4065+
= tech->findRoutingLayer(max_routing_layer);
40574066
if (top_tech_layer != nullptr) {
40584067
int top_layer_idx = top_tech_layer->getRoutingLevel();
40594068
for (auto bterm : block->getBTerms()) {

0 commit comments

Comments
 (0)