diff --git a/src/drt/src/db/tech/frLayer.h b/src/drt/src/db/tech/frLayer.h index ea2a56229c6..c64d4ceae39 100644 --- a/src/drt/src/db/tech/frLayer.h +++ b/src/drt/src/db/tech/frLayer.h @@ -112,6 +112,14 @@ class frLayer ? false : db_layer_->getType() == odb::dbTechLayerType::ROUTING; } + // True for layers tagged with the LEF58_BACKSIDE property (BPR, + // backside metals and their cut layers in BSPDN flows). The detailed + // router does not currently route on these layers; they are treated + // as invisible to TA/DRT. + bool isBackside() const + { + return (fakeCut_ || fakeMasterslice_) ? false : db_layer_->isBackside(); + } bool isUnidirectional() const { // We don't handle coloring so any multiple patterned diff --git a/src/drt/src/dr/FlexGridGraph.cpp b/src/drt/src/dr/FlexGridGraph.cpp index 1fbe7ab5d02..70dcfe0cf4a 100644 --- a/src/drt/src/dr/FlexGridGraph.cpp +++ b/src/drt/src/dr/FlexGridGraph.cpp @@ -97,7 +97,7 @@ void FlexGridGraph::initGrids(const frLayerCoordTrackPatternMap& xMap, srcs_.clear(); dsts_.clear(); - prevDirs_.resize(capacity * 3, false); + prevDirs_.resize(static_cast(capacity) * 3, false); srcs_.resize(capacity, false); dsts_.resize(capacity, false); guides_.clear(); diff --git a/src/drt/src/dr/FlexGridGraph.h b/src/drt/src/dr/FlexGridGraph.h index 301ad0c3a4f..7b51a591855 100644 --- a/src/drt/src/dr/FlexGridGraph.h +++ b/src/drt/src/dr/FlexGridGraph.h @@ -1159,7 +1159,7 @@ class FlexGridGraph // unsafe access, no idx check void setPrevAstarNodeDir(frMIdx x, frMIdx y, frMIdx z, frDirEnum dir) { - auto baseIdx = 3 * getIdx(x, y, z); + auto baseIdx = static_cast(getIdx(x, y, z)) * 3; prevDirs_[baseIdx] = ((uint16_t) dir >> 2) & 1; prevDirs_[baseIdx + 1] = ((uint16_t) dir >> 1) & 1; prevDirs_[baseIdx + 2] = ((uint16_t) dir) & 1; @@ -1168,7 +1168,8 @@ class FlexGridGraph // unsafe access, no check frDirEnum getPrevAstarNodeDir(const FlexMazeIdx& idx) const { - auto baseIdx = 3 * getIdx(idx.x(), idx.y(), idx.z()); + auto baseIdx + = static_cast(getIdx(idx.x(), idx.y(), idx.z())) * 3; return (frDirEnum) (((uint16_t) (prevDirs_[baseIdx]) << 2) + ((uint16_t) (prevDirs_[baseIdx + 1]) << 1) + ((uint16_t) (prevDirs_[baseIdx + 2]) << 0)); diff --git a/src/drt/src/io/io.cpp b/src/drt/src/io/io.cpp index 2807a1be2fc..8779ef346bf 100644 --- a/src/drt/src/io/io.cpp +++ b/src/drt/src/io/io.cpp @@ -87,6 +87,11 @@ void io::Parser::setTracks(odb::dbBlock* block) { auto tracks = block->getTrackGrids(); for (auto track : tracks) { + // Skip track grids on backside layers; DRT filters those layers + // out of its frTech entirely (see setLayers). + if (track->getTechLayer()->isBackside()) { + continue; + } if (getTech()->name2layer_.find(track->getTechLayer()->getName()) == getTech()->name2layer_.end()) { logger_->error( @@ -202,6 +207,13 @@ void io::Parser::setVias(odb::dbBlock* block) for (auto via : block->getVias()) { if (via->getViaGenerateRule() != nullptr && via->hasParams()) { const odb::dbViaParams params = via->getViaParams(); + // Skip block vias whose cut/top/bottom layer is on the backside; + // those layers are filtered out of frTech by setLayers(). + if (params.getCutLayer()->isBackside() + || params.getBottomLayer()->isBackside() + || params.getTopLayer()->isBackside()) { + continue; + } frLayerNum cutLayerNum = 0; frLayerNum botLayerNum = 0; frLayerNum topLayerNum = 0; @@ -346,6 +358,17 @@ void io::Parser::setVias(odb::dbBlock* block) utl::DRT, 337, "Duplicated via definition for {}", via->getName()); } } else { + // Skip box-defined block vias touching backside layers. + bool any_backside = false; + for (auto box : via->getBoxes()) { + if (box->getTechLayer()->isBackside()) { + any_backside = true; + break; + } + } + if (any_backside) { + continue; + } std::map> lNum2Int; for (auto box : via->getBoxes()) { if (getTech()->name2layer_.find(box->getTechLayer()->getName()) @@ -427,6 +450,11 @@ void io::Parser::createNDR(odb::dbTechNonDefaultRule* ndr) std::vector lr; ndr->getLayerRules(lr); for (auto& l : lr) { + // Skip per-layer NDR rules that reference a filtered backside + // layer; DRT has no frLayer entry for it. + if (l->getLayer()->isBackside()) { + continue; + } auto layer = getTech()->getLayer(l->getLayer()->getName()); z = getZIdx(layer->getLayerNum()); fnd->setWidth(l->getWidth(), z); @@ -436,6 +464,10 @@ void io::Parser::createNDR(odb::dbTechNonDefaultRule* ndr) std::vector vias; ndr->getUseVias(vias); for (auto via : vias) { + if (via->getBottomLayer()->isBackside() + || via->getTopLayer()->isBackside()) { + continue; + } auto layer = getTech()->getLayer(via->getBottomLayer()->getName()); z = getZIdx(layer->getLayerNum()); fnd->addVia(getTech()->getVia(via->getName()), z); @@ -444,6 +476,16 @@ void io::Parser::createNDR(odb::dbTechNonDefaultRule* ndr) ndr->getUseViaRules(viaRules); z = std::numeric_limits::max(); for (auto via : viaRules) { + bool any_backside = false; + for (uint32_t i = 0; i < via->getViaLayerRuleCount(); i++) { + if (via->getViaLayerRule(i)->getLayer()->isBackside()) { + any_backside = true; + break; + } + } + if (any_backside) { + continue; + } for (int i = 0; i < (int) via->getViaLayerRuleCount(); i++) { if (via->getViaLayerRule(i)->getLayer()->getType() == odb::dbTechLayerType::CUT) { @@ -805,7 +847,13 @@ void io::Parser::updateNetRouting(frNet* netIn, odb::dbNet* net) endpath = true; } } while (!endpath); - auto layerNum = getTech()->name2layer_[layerName]->getLayerNum(); + // Skip path segments that reference a backside layer; DRT + // doesn't carry those in its frTech (see setLayers). + auto layer_it = getTech()->name2layer_.find(layerName); + if (layer_it == getTech()->name2layer_.end()) { + continue; + } + auto layerNum = layer_it->second->getLayerNum(); if (hasRect) { auto tmpPWire = std::make_unique(); tmpPWire->setLayerNum(layerNum); @@ -892,6 +940,11 @@ void io::Parser::updateNetRouting(frNet* netIn, odb::dbNet* net) for (auto swire : net->getSWires()) { for (auto box : swire->getWires()) { if (!box->isVia()) { + // Skip special-net path segments on backside layers (BPR + // followpins, backside stripes); DRT has no frLayer for them. + if (box->getTechLayer()->isBackside()) { + continue; + } getSBoxCoords(box, beginX, beginY, endX, endY, width); auto layerNum = getTech() ->name2layer_[box->getTechLayer()->getName()] @@ -929,10 +982,21 @@ void io::Parser::updateNetRouting(frNet* netIn, odb::dbNet* net) tmpP->setStyle(tmpSegStyle); netIn->addShape(std::move(tmpP)); } else { + // Skip backside vias (BV0..BV4, BVia*Array etc.) on special + // nets; DRT removes them from name2via_ when its frTech is + // populated. if (box->getTechVia()) { viaName = box->getTechVia()->getName(); + if (box->getTechVia()->getBottomLayer()->isBackside() + || box->getTechVia()->getTopLayer()->isBackside()) { + continue; + } } else if (box->getBlockVia()) { viaName = box->getBlockVia()->getName(); + if (box->getBlockVia()->getBottomLayer()->isBackside() + || box->getBlockVia()->getTopLayer()->isBackside()) { + continue; + } } if (getTech()->name2via_.find(viaName) @@ -1001,10 +1065,15 @@ frNet* io::Parser::addNet(odb::dbNet* db_net) return raw_net_in; } -void updatefrAccessPoint(odb::dbAccessPoint* db_ap, - frAccessPoint* ap, - frTechObject* tech) +static bool updatefrAccessPoint(odb::dbAccessPoint* db_ap, + frAccessPoint* ap, + frTechObject* tech) { + // Access points on backside layers (e.g. PG taps) are invisible to + // the front-side router; report so the caller can drop them. + if (db_ap->getLayer()->isBackside()) { + return false; + } ap->setPoint(db_ap->getPoint()); if (db_ap->hasAccess(odb::dbDirection::NORTH)) { ap->setAccess(frDirEnum::N, true); @@ -1056,6 +1125,7 @@ void updatefrAccessPoint(odb::dbAccessPoint* db_ap, ap->addPathSeg(path_seg); } + return true; } void io::Parser::setBTerms(odb::dbBlock* block) @@ -1089,6 +1159,11 @@ void io::Parser::setBTerms(odb::dbBlock* block) int bterm_bottom_layer_idx = std::numeric_limits::max(); for (auto bpin : term->getBPins()) { for (auto box : bpin->getBoxes()) { + // BTerms on backside layers (e.g. PG pins on BPR) have no + // representation in the filtered DRT layer table; skip them. + if (box->getTechLayer()->isBackside()) { + continue; + } frLayerNum layer_idx = getTech() ->name2layer_[box->getTechLayer()->getName()] ->getLayerNum(); @@ -1105,6 +1180,9 @@ void io::Parser::setBTerms(odb::dbBlock* block) } else { for (auto pin : term->getBPins()) { for (auto box : pin->getBoxes()) { + if (box->getTechLayer()->isBackside()) { + continue; + } odb::Rect bbox = box->getBox(); if (getTech()->name2layer_.find(box->getTechLayer()->getName()) == getTech()->name2layer_.end()) { @@ -1128,8 +1206,9 @@ void io::Parser::setBTerms(odb::dbBlock* block) auto db_pin = (odb::dbBPin*) *term->getBPins().begin(); for (auto& db_ap : db_pin->getAccessPoints()) { auto ap = std::make_unique(); - updatefrAccessPoint(db_ap, ap.get(), getTech()); - pa->addAccessPoint(std::move(ap)); + if (updatefrAccessPoint(db_ap, ap.get(), getTech())) { + pa->addAccessPoint(std::move(ap)); + } } } pinIn->addPinAccess(std::move(pa)); @@ -1217,7 +1296,9 @@ void io::Parser::setAccessPoints(odb::dbDatabase* db) for (auto db_ap : db_aps) { std::unique_ptr ap = std::make_unique(); - updatefrAccessPoint(db_ap, ap.get(), getTech()); + if (!updatefrAccessPoint(db_ap, ap.get(), getTech())) { + continue; + } ap->setDbAccessPoint(db_ap); ap_map[db_ap] = ap.get(); pa->addAccessPoint(std::move(ap)); @@ -2564,6 +2645,13 @@ void io::Parser::setLayers(odb::dbTech* db_tech) { masterSliceLayer_ = nullptr; for (auto layer : db_tech->getLayers()) { + // Skip layers marked LEF58_BACKSIDE (BPR / BM* / BV* / BRDL on + // backside-power PDKs). DRT only routes the front-side stack; + // backside layers exist in ODB and survive DEF/GDS round-trip, + // but the router treats them as invisible. + if (layer->isBackside()) { + continue; + } switch (layer->getType().getValue()) { case odb::dbTechLayerType::ROUTING: addRoutingLayer(layer); @@ -2822,6 +2910,19 @@ void io::Parser::setTechViaRules(odb::dbTech* db_tech) if (count != 3) { logger_->error(DRT, 128, "Unsupported viarule {}.", rule->getName()); } + // Skip viarules that reference any backside layer. The DRT layer + // table excludes backside layers entirely (see setLayers), so the + // viarule cannot be honored on the front-side stack. + bool has_backside = false; + for (int i = 0; i < count; i++) { + if (rule->getViaLayerRule(i)->getLayer()->isBackside()) { + has_backside = true; + break; + } + } + if (has_backside) { + continue; + } std::map lNum2Int; for (int i = 0; i < count; i++) { auto layerRule = rule->getViaLayerRule(i); diff --git a/src/drt/src/ta/FlexTA_init.cpp b/src/drt/src/ta/FlexTA_init.cpp index 978e69a69b2..06dcfae2215 100644 --- a/src/drt/src/ta/FlexTA_init.cpp +++ b/src/drt/src/ta/FlexTA_init.cpp @@ -770,14 +770,23 @@ void FlexTAWorker::initFixedObjs() && getTech()->getLayer(layerNum - 2)->getType() == dbTechLayerType::ROUTING) { auto cutLayer = getTech()->getLayer(layerNum - 1); - auto via = std::make_unique(cutLayer->getDefaultViaDef()); - odb::Rect viaBox = via->getLayer2BBox(); - frCoord viaWidth = viaBox.minDXDY(); - // only add for fat via - if (viaWidth > width) { - bloatDist = initFixedObjs_calcOBSBloatDistVia( - cutLayer->getDefaultViaDef(), layerNum, bounds, false); - initFixedObjs_helper(box, bloatDist, layerNum, netPtr, true); + // initDefaultVias() only guarantees a defaultViaDef for cut + // layers inside BOTTOM_ROUTING_LAYER..max(TOP_ROUTING_LAYER, + // topPinLayer). Cut layers outside that range (e.g. contact + // cuts below the routing range on PDKs whose MIN_ROUTING_LAYER + // is well above M0) can legitimately have a null default; + // skip them rather than constructing a frVia from nullptr. + auto defaultViaDef = cutLayer->getDefaultViaDef(); + if (defaultViaDef != nullptr) { + auto via = std::make_unique(defaultViaDef); + odb::Rect viaBox = via->getLayer2BBox(); + frCoord viaWidth = viaBox.minDXDY(); + // only add for fat via + if (viaWidth > width) { + bloatDist = initFixedObjs_calcOBSBloatDistVia( + defaultViaDef, layerNum, bounds, false); + initFixedObjs_helper(box, bloatDist, layerNum, netPtr, true); + } } } // up-via @@ -785,14 +794,17 @@ void FlexTAWorker::initFixedObjs() && getTech()->getLayer(layerNum + 2)->getType() == dbTechLayerType::ROUTING) { auto cutLayer = getTech()->getLayer(layerNum + 1); - auto via = std::make_unique(cutLayer->getDefaultViaDef()); - odb::Rect viaBox = via->getLayer1BBox(); - frCoord viaWidth = viaBox.minDXDY(); - // only add for fat via - if (viaWidth > width) { - bloatDist = initFixedObjs_calcOBSBloatDistVia( - cutLayer->getDefaultViaDef(), layerNum, bounds, false); - initFixedObjs_helper(box, bloatDist, layerNum, netPtr, true); + auto defaultViaDef = cutLayer->getDefaultViaDef(); + if (defaultViaDef != nullptr) { + auto via = std::make_unique(defaultViaDef); + odb::Rect viaBox = via->getLayer1BBox(); + frCoord viaWidth = viaBox.minDXDY(); + // only add for fat via + if (viaWidth > width) { + bloatDist = initFixedObjs_calcOBSBloatDistVia( + defaultViaDef, layerNum, bounds, false); + initFixedObjs_helper(box, bloatDist, layerNum, netPtr, true); + } } } } diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index 212de10a1fd..e1be24e7523 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -5498,6 +5498,18 @@ class dbMaster : public dbObject /// void setType(dbMasterType type); + /// + /// Marks a cell as physically bridging a front-side power layer to a + /// LEF58_BACKSIDE layer (typical use: BSPDN tap cells). Tools that + /// trace PG-net connectivity should treat the PG pins of such a + /// cell as electrically continuous even when they sit on layers + /// that disagree on dbTechLayer::isBackside(). Set by the + /// LEF58_BACKSIDE_BRIDGE macro property. + /// + void setBacksideBridge(bool is_bridge); + + bool isBacksideBridge() const; + /// /// Get the Logical equivalent of this master /// Returns nullptr if no equivalent was set. @@ -5920,6 +5932,21 @@ class dbTech : public dbObject /// dbTechLayer* findRoutingLayer(int level_number); + /// + /// Find the frontside (non-LEF58_BACKSIDE) routing layer closest to + /// the substrate (i.e. the lowest routing-level index that is not + /// marked backside). Returns nullptr if there is no such layer. + /// + dbTechLayer* firstFrontsideRoutingLayer(); + + /// + /// Find the LEF58_BACKSIDE routing layer closest to the substrate + /// (i.e. the highest routing-level index that is marked backside, + /// since backside metals are stacked outward from M0 toward BRDL in + /// LEF order). Returns nullptr if there is no backside routing layer. + /// + dbTechLayer* firstBacksideRoutingLayer(); + /// /// Get the technolgy vias. This includes non-default-rule-vias. /// @@ -9272,6 +9299,15 @@ class dbTechLayer : public dbObject LEF58_TYPE getLef58Type() const; std::string getLef58TypeString() const; + /// + /// Backside layers are physically located on the wafer's reverse side, + /// typically used for buried-power-rail (BPR) and backside power + /// delivery (BSPDN). Set by the LEF58_BACKSIDE property. + /// + void setBackside(bool is_backside); + + bool isBackside() const; + /// /// Get the layer name. /// diff --git a/src/odb/src/codeGenerator/schema/tech/dbTechLayer.json b/src/odb/src/codeGenerator/schema/tech/dbTechLayer.json index 88399a2d922..a3206244eaf 100644 --- a/src/odb/src/codeGenerator/schema/tech/dbTechLayer.json +++ b/src/odb/src/codeGenerator/schema/tech/dbTechLayer.json @@ -123,6 +123,14 @@ "no-get" ] }, + { + "type": "bit", + "name": "is_backside", + "flags": [ + "no-set", + "no-get" + ] + }, { "type": "uint32_t", "default": "0", diff --git a/src/odb/src/db/dbBlock.cpp b/src/odb/src/db/dbBlock.cpp index 4b95eeaacbf..96b8eecea1f 100644 --- a/src/odb/src/db/dbBlock.cpp +++ b/src/odb/src/db/dbBlock.cpp @@ -2516,7 +2516,20 @@ int dbBlock::getGCellTileSize() // lambda function to get the average track spacing of a given layer auto getAverageTrackSpacing = [this](int layer_idx) -> int { dbTech* tech = getTech(); - odb::dbTechLayer* tech_layer = tech->findRoutingLayer(layer_idx); + // Skip backside routing layers (e.g. BSPDN BPR/BM*/BRDL) so the Nth + // routing layer is counted among frontside metals regardless of LEF + // ordering. + odb::dbTechLayer* tech_layer = nullptr; + int count = 0; + for (auto* layer : tech->getLayers()) { + if (layer->getType() != dbTechLayerType::ROUTING || layer->isBackside()) { + continue; + } + if (++count == layer_idx) { + tech_layer = layer; + break; + } + } odb::dbTrackGrid* track_grid = findTrackGrid(tech_layer); if (track_grid == nullptr) { diff --git a/src/odb/src/db/dbMaster.cpp b/src/odb/src/db/dbMaster.cpp index 961ea70fbcc..8ff60d17db3 100644 --- a/src/odb/src/db/dbMaster.cpp +++ b/src/odb/src/db/dbMaster.cpp @@ -63,6 +63,10 @@ bool _dbMaster::operator==(const _dbMaster& rhs) const return false; } + if (flags_.is_backside_bridge != rhs.flags_.is_backside_bridge) { + return false; + } + if (x_ != rhs.x_) { return false; } @@ -169,6 +173,7 @@ _dbMaster::_dbMaster(_dbDatabase* db) flags_.mark = 0; flags_.special_power = 0; flags_.sequential = 0; + flags_.is_backside_bridge = 0; flags_.spare_bits_19 = 0; x_ = 0; @@ -642,6 +647,18 @@ void dbMaster::setSpecialPower(bool value) master->flags_.special_power = (value) ? 1 : 0; } +void dbMaster::setBacksideBridge(bool is_bridge) +{ + _dbMaster* master = (_dbMaster*) this; + master->flags_.is_backside_bridge = is_bridge ? 1 : 0; +} + +bool dbMaster::isBacksideBridge() const +{ + _dbMaster* master = (_dbMaster*) this; + return master->flags_.is_backside_bridge == 1; +} + bool dbMaster::isSpecialPower() { _dbMaster* master = (_dbMaster*) this; diff --git a/src/odb/src/db/dbMaster.h b/src/odb/src/db/dbMaster.h index 35f91736b64..cd99865af87 100644 --- a/src/odb/src/db/dbMaster.h +++ b/src/odb/src/db/dbMaster.h @@ -39,7 +39,8 @@ struct dbMasterFlags uint32_t mark : 1; uint32_t sequential : 1; uint32_t special_power : 1; - uint32_t spare_bits_19 : 19; + uint32_t is_backside_bridge : 1; + uint32_t spare_bits_19 : 18; }; class _dbMaster : public _dbObject diff --git a/src/odb/src/db/dbTech.cpp b/src/odb/src/db/dbTech.cpp index ea4f1ff881d..c9f791278ca 100644 --- a/src/odb/src/db/dbTech.cpp +++ b/src/odb/src/db/dbTech.cpp @@ -500,6 +500,33 @@ dbTechLayer* dbTech::findRoutingLayer(int level_number) return nullptr; } +dbTechLayer* dbTech::firstFrontsideRoutingLayer() +{ + const int n = getRoutingLayerCount(); + for (int level = 1; level <= n; ++level) { + dbTechLayer* layer = findRoutingLayer(level); + if (layer != nullptr && !layer->isBackside()) { + return layer; + } + } + return nullptr; +} + +dbTechLayer* dbTech::firstBacksideRoutingLayer() +{ + // Backside layers appear before frontside layers in the LEF, ordered + // outward from the substrate (BPR ... BM1 ... BRDL). Iterate top-down + // so we return the backside layer closest to the substrate. + const int n = getRoutingLayerCount(); + for (int level = n; level >= 1; --level) { + dbTechLayer* layer = findRoutingLayer(level); + if (layer != nullptr && layer->isBackside()) { + return layer; + } + } + return nullptr; +} + int dbTech::getDbUnitsPerMicron() { return getDb()->getDbuPerMicron(); diff --git a/src/odb/src/db/dbTechLayer.cpp b/src/odb/src/db/dbTechLayer.cpp index eeb1de0153c..0e7c7f9323a 100644 --- a/src/odb/src/db/dbTechLayer.cpp +++ b/src/odb/src/db/dbTechLayer.cpp @@ -101,6 +101,9 @@ bool _dbTechLayer::operator==(const _dbTechLayer& rhs) const if (flags_.lef58_type != rhs.flags_.lef58_type) { return false; } + if (flags_.is_backside != rhs.flags_.is_backside) { + return false; + } if (wrong_way_width_ != rhs.wrong_way_width_) { return false; } @@ -1248,6 +1251,18 @@ dbTechLayer::LEF58_TYPE dbTechLayer::getLef58Type() const return (dbTechLayer::LEF58_TYPE) layer->flags_.lef58_type; } +void dbTechLayer::setBackside(bool is_backside) +{ + _dbTechLayer* layer = (_dbTechLayer*) this; + layer->flags_.is_backside = is_backside; +} + +bool dbTechLayer::isBackside() const +{ + _dbTechLayer* layer = (_dbTechLayer*) this; + return layer->flags_.is_backside; +} + std::string dbTechLayer::getLef58TypeString() const { switch (getLef58Type()) { diff --git a/src/odb/src/db/dbTechLayer.h b/src/odb/src/db/dbTechLayer.h index e04affd25d6..51087b50dce 100644 --- a/src/odb/src/db/dbTechLayer.h +++ b/src/odb/src/db/dbTechLayer.h @@ -70,7 +70,8 @@ struct dbTechLayerFlags bool right_way_on_grid_only_check_mask : 1; bool rect_only_except_non_core_pins : 1; uint32_t lef58_type : 5; - uint32_t spare_bits : 4; + bool is_backside : 1; + uint32_t spare_bits : 3; }; class _dbTechLayer : public _dbObject diff --git a/src/odb/src/lefin/CMakeLists.txt b/src/odb/src/lefin/CMakeLists.txt index ef5e484ad22..47df4259c7c 100644 --- a/src/odb/src/lefin/CMakeLists.txt +++ b/src/odb/src/lefin/CMakeLists.txt @@ -12,6 +12,7 @@ add_library(lefin lefTechLayerSpacingTablePrlParser.cpp lefTechLayerRightWayOnGridOnlyParser.cpp lefTechLayerRectOnlyParser.cpp + lefTechLayerBacksideParser.cpp lefTechLayerCutClassParser.cpp lefTechLayerCutSpacingParser.cpp lefTechLayerCutSpacingTableParser.cpp @@ -24,6 +25,7 @@ add_library(lefin lefTechLayerForbiddenSpacingRuleParser.cpp lefTechLayerTwoWiresForbiddenSpcRuleParser.cpp lefTechLayerVoltageSpacing.cpp + lefMacroBacksideBridgeParser.cpp lefMacroClassParser.cpp lefMacroEdgeTypeParser.cpp CellEdgeSpacingTableParser.cpp diff --git a/src/odb/src/lefin/lefLayerPropParser.h b/src/odb/src/lefin/lefLayerPropParser.h index 63d7ab2c9d3..bd8c3fe8cae 100644 --- a/src/odb/src/lefin/lefLayerPropParser.h +++ b/src/odb/src/lefin/lefLayerPropParser.h @@ -88,6 +88,12 @@ class lefTechLayerRectOnlyParser static bool parse(const std::string&, dbTechLayer*, lefinReader*); }; +class lefTechLayerBacksideParser +{ + public: + static bool parse(const std::string&, dbTechLayer*, lefinReader*); +}; + class lefTechLayerTypeParser { public: diff --git a/src/odb/src/lefin/lefMacroBacksideBridgeParser.cpp b/src/odb/src/lefin/lefMacroBacksideBridgeParser.cpp new file mode 100644 index 00000000000..c7b75fdf35b --- /dev/null +++ b/src/odb/src/lefin/lefMacroBacksideBridgeParser.cpp @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2026, The OpenROAD Authors + +#include + +#include "boost/bind/bind.hpp" +#include "boostParser.h" +#include "lefMacroPropParser.h" +#include "odb/db.h" + +namespace odb { + +bool lefMacroBacksideBridgeParser::parse(std::string_view s, dbMaster* master) +{ + qi::rule rule + = (lit("BACKSIDEBRIDGE")[boost::bind( + &dbMaster::setBacksideBridge, master, true)] + >> lit(";")); + + auto first = s.begin(); + const bool valid = qi::phrase_parse(first, s.end(), rule, space); + return valid && first == s.end(); +} + +} // namespace odb diff --git a/src/odb/src/lefin/lefMacroPropParser.h b/src/odb/src/lefin/lefMacroPropParser.h index 03e1cf871c2..a92ad1b788e 100644 --- a/src/odb/src/lefin/lefMacroPropParser.h +++ b/src/odb/src/lefin/lefMacroPropParser.h @@ -16,6 +16,12 @@ class lefMacroClassTypeParser public: static bool parse(std::string_view, dbMaster*); }; + +class lefMacroBacksideBridgeParser +{ + public: + static bool parse(std::string_view, dbMaster*); +}; class lefMacroEdgeTypeParser { public: diff --git a/src/odb/src/lefin/lefTechLayerBacksideParser.cpp b/src/odb/src/lefin/lefTechLayerBacksideParser.cpp new file mode 100644 index 00000000000..50d5cf041cc --- /dev/null +++ b/src/odb/src/lefin/lefTechLayerBacksideParser.cpp @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2026, The OpenROAD Authors + +#include + +#include "boost/bind/bind.hpp" +#include "boostParser.h" +#include "lefLayerPropParser.h" +#include "odb/db.h" +#include "odb/lefin.h" + +namespace odb::lefTechLayerBackside { + +namespace { + +template +bool parse(Iterator first, + Iterator last, + odb::dbTechLayer* layer, + odb::lefinReader* /*lefinReader*/) +{ + qi::rule backsideRule + = (lit("BACKSIDE")[boost::bind( + &odb::dbTechLayer::setBackside, layer, true)] + >> lit(";")); + + bool valid = qi::phrase_parse(first, last, backsideRule, space); + return valid && first == last; +} + +} // namespace + +} // namespace odb::lefTechLayerBackside + +namespace odb { + +bool lefTechLayerBacksideParser::parse(const std::string& s, + dbTechLayer* layer, + odb::lefinReader* l) +{ + return lefTechLayerBackside::parse(s.begin(), s.end(), layer, l); +} + +} // namespace odb diff --git a/src/odb/src/lefin/lefin.cpp b/src/odb/src/lefin/lefin.cpp index d7d9d4ed1c8..9c778eee9eb 100644 --- a/src/odb/src/lefin/lefin.cpp +++ b/src/odb/src/lefin/lefin.cpp @@ -679,6 +679,9 @@ void lefinReader::layer(LefParser::lefiLayer* layer) } else if (!strcmp(layer->propName(iii), "LEF58_RECTONLY")) { valid = lefTechLayerRectOnlyParser::parse(layer->propValue(iii), l, this); + } else if (!strcmp(layer->propName(iii), "LEF58_BACKSIDE")) { + valid + = lefTechLayerBacksideParser::parse(layer->propValue(iii), l, this); } else if (!strcmp(layer->propName(iii), "LEF58_TYPE")) { valid = lefTechLayerTypeParser::parse(layer->propValue(iii), l, this); } else if (!strcmp(layer->propName(iii), "LEF58_EOLEXTENSIONSPACING")) { @@ -741,6 +744,9 @@ void lefinReader::layer(LefParser::lefiLayer* layer) valid = parser.parse(layer->propValue(iii)); } else if (!strcmp(layer->propName(iii), "LEF58_TYPE")) { valid = lefTechLayerTypeParser::parse(layer->propValue(iii), l, this); + } else if (!strcmp(layer->propName(iii), "LEF58_BACKSIDE")) { + valid + = lefTechLayerBacksideParser::parse(layer->propValue(iii), l, this); } else if (!strcmp(layer->propName(iii), "LEF58_KEEPOUTZONE")) { KeepOutZoneParser parser(l, this); parser.parse(layer->propValue(iii)); @@ -1255,6 +1261,8 @@ void lefinReader::macro(LefParser::lefiMacro* macro) valid = lefMacroClassTypeParser::parse(macro->propValue(i), master_); } else if (!strcmp(macro->propName(i), "LEF58_EDGETYPE")) { lefMacroEdgeTypeParser(master_, this).parse(macro->propValue(i)); + } else if (!strcmp(macro->propName(i), "LEF58_BACKSIDE_BRIDGE")) { + valid = lefMacroBacksideBridgeParser::parse(macro->propValue(i), master_); } else { dbStringProperty::create( master_, macro->propName(i), macro->propValue(i)); diff --git a/src/odb/test/BUILD b/src/odb/test/BUILD index 18365fb291d..60316c35f41 100644 --- a/src/odb/test/BUILD +++ b/src/odb/test/BUILD @@ -178,6 +178,7 @@ COMPULSORY_TESTS = [ "gcd_def_access", "gcd_pdn_def_access", "import_package", + "lef58_backside_bridge", "lef_data_access", "lef_mask", "multi_tech", diff --git a/src/odb/test/CMakeLists.txt b/src/odb/test/CMakeLists.txt index fd470ff6334..2b55746fe8f 100644 --- a/src/odb/test/CMakeLists.txt +++ b/src/odb/test/CMakeLists.txt @@ -34,6 +34,7 @@ or_integration_tests( gcd_def_access gcd_pdn_def_access import_package + lef58_backside_bridge lef_data_access lef_mask multi_tech diff --git a/src/odb/test/lef58_backside_bridge.lef b/src/odb/test/lef58_backside_bridge.lef new file mode 100644 index 00000000000..7223789b25c --- /dev/null +++ b/src/odb/test/lef58_backside_bridge.lef @@ -0,0 +1,56 @@ +VERSION 5.8 ; +BUSBITCHARS "[]" ; +DIVIDERCHAR "/" ; + +UNITS + DATABASE MICRONS 2000 ; +END UNITS + +SITE coreSite + CLASS CORE ; + SIZE 0.190 BY 1.400 ; + SYMMETRY Y ; +END coreSite + +LAYER M1 + TYPE ROUTING ; + DIRECTION VERTICAL ; + WIDTH 0.070 ; + PITCH 0.190 ; + SPACING 0.070 ; +END M1 + +MACRO bridge_tap + CLASS CORE ; + ORIGIN 0 0 ; + SIZE 0.380 BY 1.400 ; + SYMMETRY X Y ; + SITE coreSite ; + PROPERTY LEF58_BACKSIDE_BRIDGE "BACKSIDEBRIDGE ;" ; + PIN vdd + DIRECTION INOUT ; + USE POWER ; + PORT + LAYER M1 ; + RECT 0.060 0.050 0.130 1.350 ; + END + END vdd +END bridge_tap + +MACRO ordinary_cell + CLASS CORE ; + ORIGIN 0 0 ; + SIZE 0.190 BY 1.400 ; + SYMMETRY X Y ; + SITE coreSite ; + PIN vdd + DIRECTION INOUT ; + USE POWER ; + PORT + LAYER M1 ; + RECT 0.040 0.050 0.110 1.350 ; + END + END vdd +END ordinary_cell + +END LIBRARY diff --git a/src/odb/test/lef58_backside_bridge.ok b/src/odb/test/lef58_backside_bridge.ok new file mode 100644 index 00000000000..11451f51157 --- /dev/null +++ b/src/odb/test/lef58_backside_bridge.ok @@ -0,0 +1,3 @@ +[INFO ODB-0227] LEF file: lef58_backside_bridge.lef, created 1 layers, 2 library cells +bridge_tap isBacksideBridge=1 +ordinary_cell isBacksideBridge=0 diff --git a/src/odb/test/lef58_backside_bridge.tcl b/src/odb/test/lef58_backside_bridge.tcl new file mode 100644 index 00000000000..2d0d7604e90 --- /dev/null +++ b/src/odb/test/lef58_backside_bridge.tcl @@ -0,0 +1,12 @@ +# Verify that the LEF58_BACKSIDE_BRIDGE macro property is parsed and +# exposed via dbMaster::isBacksideBridge(). +source "helpers.tcl" + +read_lef lef58_backside_bridge.lef + +set db [ord::get_db] +set libs [$db getLibs] +set lib [lindex $libs 0] +foreach master [$lib getMasters] { + puts "[$master getName] isBacksideBridge=[$master isBacksideBridge]" +} diff --git a/src/pdn/src/connect.cpp b/src/pdn/src/connect.cpp index 7d3593b0eda..55efb204263 100644 --- a/src/pdn/src/connect.cpp +++ b/src/pdn/src/connect.cpp @@ -47,6 +47,24 @@ Connect::Connect(Grid* grid, odb::dbTechLayer* layer0, odb::dbTechLayer* layer1) utl::PDN, 5, "{} must be a routing layer", layer1->getName()); } + // Backside-power sanity check. A standard cut-layer via cannot bridge + // a front-side metal to a backside metal (BPR / BM* / BRDL); PDN cannot + // create TSVs or backside cut vias, so the connection has to be + // provided by a tap/bridge cell whose layout already stitches the two + // sides together. Refuse the request rather than silently building a + // via that won't exist on the die. + if (layer0_->isBackside() != layer1_->isBackside()) { + grid_->getLogger()->error( + utl::PDN, + 1200, + "Connect rule layers ({}, {}) span the front-side/backside " + "boundary. PDN cannot create TSVs or vias across this boundary; " + "the connection must come from a tap/bridge cell that internally " + "stitches the two sides.", + layer0_->getName(), + layer1_->getName()); + } + if (layer0_->getRoutingLevel() > layer1_->getRoutingLevel()) { // ensure layer0 is below layer1 std::swap(layer0_, layer1_); diff --git a/src/pdn/test/BUILD b/src/pdn/test/BUILD index 620d2d1ceed..d29e673821b 100644 --- a/src/pdn/test/BUILD +++ b/src/pdn/test/BUILD @@ -6,6 +6,7 @@ package(features = ["layering_check"]) # From CMakeLists.txt or_integration_tests(TESTS COMPULSORY_TESTS = [ "add_double_global_connection", + "add_pdn_connect_backside_err", "asap7_failed_macro_covered", "asap7_failed_macro_grid", "asap7_macro_covered_partial", @@ -279,6 +280,10 @@ filegroup( test_name + ".*", ], ) + { + "add_pdn_connect_backside_err": [ + "backside_data/backside.def", + "backside_data/backside.lef", + ], "asap7_failed_macro_covered": ["asap7_failed_macro_grid.def"], "asap7_macro_covered_partial": ["asap7_failed_macro_grid.def"], "asap7_macro_notcovered": ["asap7_failed_macro_grid.def"], diff --git a/src/pdn/test/CMakeLists.txt b/src/pdn/test/CMakeLists.txt index b07573a63fb..ecf1ae76830 100644 --- a/src/pdn/test/CMakeLists.txt +++ b/src/pdn/test/CMakeLists.txt @@ -2,6 +2,7 @@ or_integration_tests( "pdn" TESTS add_double_global_connection + add_pdn_connect_backside_err asap7_failed_macro_covered asap7_failed_macro_grid asap7_macro_covered_partial diff --git a/src/pdn/test/add_pdn_connect_backside_err.ok b/src/pdn/test/add_pdn_connect_backside_err.ok new file mode 100644 index 00000000000..bab021e0068 --- /dev/null +++ b/src/pdn/test/add_pdn_connect_backside_err.ok @@ -0,0 +1,8 @@ +[INFO ODB-0227] LEF file: backside_data/backside.lef, created 4 layers, 2 library cells +[INFO ODB-0128] Design: backside_top +[INFO ODB-0131] Created 5 components and 10 component-terminals. +[INFO ODB-0132] Created 2 special nets and 10 connections. +[INFO PDN-0101] Using vdd as power net for Core domain. +[INFO PDN-0102] Using vss as ground net for Core domain. +[ERROR PDN-1200] Connect rule layers (M1, B1) span the front-side/backside boundary. PDN cannot create TSVs or vias across this boundary; the connection must come from a tap/bridge cell that internally stitches the two sides. +PDN-1200 diff --git a/src/pdn/test/add_pdn_connect_backside_err.tcl b/src/pdn/test/add_pdn_connect_backside_err.tcl new file mode 100644 index 00000000000..d75d543408d --- /dev/null +++ b/src/pdn/test/add_pdn_connect_backside_err.tcl @@ -0,0 +1,20 @@ +# Verify add_pdn_connect errors out when its two layers span the +# front-side / backside boundary. A standard cut-layer via cannot +# bridge a normal routing metal to a LEF58_BACKSIDE layer; PDN cannot +# create TSVs, so the connection has to come from a tap/bridge cell. +# +# Regression test for the PDN-1200 error added on the bspdn branch. +source "helpers.tcl" + +read_lef backside_data/backside.lef +read_def backside_data/backside.def + +add_global_connection -net vdd -pin_pattern "^vdd$" -power +add_global_connection -net vss -pin_pattern "^vss$" -ground + +define_pdn_grid -name {grid} -voltage_domains {CORE} -pins {B1} +add_pdn_stripe -grid {grid} -layer {B1} -width {0.07} -pitch {1.4} -followpins +# This add_pdn_connect crosses the front-side / backside boundary +# (B1 has LEF58_BACKSIDE, M1 doesn't). Should trigger PDN-1200. +catch { add_pdn_connect -grid {grid} -layers {M1 B1} } err +puts $err diff --git a/src/pdn/test/backside_data/backside.def b/src/pdn/test/backside_data/backside.def new file mode 100644 index 00000000000..fce0398312c --- /dev/null +++ b/src/pdn/test/backside_data/backside.def @@ -0,0 +1,42 @@ +VERSION 5.8 ; +BUSBITCHARS "[]" ; +DIVIDERCHAR "/" ; +DESIGN backside_top ; + +UNITS DISTANCE MICRONS 2000 ; + +DIEAREA ( 0 0 ) ( 3800 2800 ) ; + +ROW row_0 coreSite 0 0 N DO 20 BY 1 STEP 380 0 ; +ROW row_1 coreSite 0 2800 FS DO 20 BY 1 STEP 380 0 ; + +TRACKS X 35 DO 20 STEP 380 LAYER M1 ; +TRACKS Y 35 DO 20 STEP 280 LAYER M2 ; +TRACKS X 35 DO 20 STEP 380 LAYER B1 ; + +COMPONENTS 5 ; +- u_tap_0 bridge_tap + PLACED ( 0 0 ) N ; +- u_fill_0 backside_filler + PLACED ( 760 0 ) N ; +- u_fill_1 backside_filler + PLACED ( 950 0 ) N ; +- u_fill_2 backside_filler + PLACED ( 1140 0 ) N ; +- u_tap_1 bridge_tap + PLACED ( 1330 0 ) N ; +END COMPONENTS + +PINS 0 ; +END PINS + +SPECIALNETS 2 ; +- vdd ( * vdd ) + USE POWER + + ROUTED B1 140 + SHAPE FOLLOWPIN + ( 0 2800 ) ( 3800 * ) + ; +- vss ( * vss ) + USE GROUND + + ROUTED B1 140 + SHAPE FOLLOWPIN + ( 0 0 ) ( 3800 * ) + ; +END SPECIALNETS + +NETS 0 ; +END NETS + +END DESIGN diff --git a/src/pdn/test/backside_data/backside.lef b/src/pdn/test/backside_data/backside.lef new file mode 100644 index 00000000000..b7ae4f3f76c --- /dev/null +++ b/src/pdn/test/backside_data/backside.lef @@ -0,0 +1,118 @@ +VERSION 5.8 ; +BUSBITCHARS "[]" ; +DIVIDERCHAR "/" ; + +UNITS + DATABASE MICRONS 2000 ; +END UNITS + +PROPERTYDEFINITIONS + LAYER LEF58_TYPE STRING ; + LAYER LEF58_BACKSIDE STRING ; + MACRO LEF58_BACKSIDE_BRIDGE STRING ; +END PROPERTYDEFINITIONS + +SITE coreSite + CLASS CORE ; + SIZE 0.190 BY 1.400 ; + SYMMETRY Y ; +END coreSite + +LAYER B1 + TYPE ROUTING ; + DIRECTION HORIZONTAL ; + WIDTH 0.070 ; + PITCH 1.400 ; + SPACING 0.070 ; + PROPERTY LEF58_BACKSIDE "BACKSIDE ;" ; +END B1 + +LAYER M1 + TYPE ROUTING ; + DIRECTION VERTICAL ; + WIDTH 0.070 ; + PITCH 0.190 ; + SPACING 0.070 ; +END M1 + +LAYER V1 + TYPE CUT ; + WIDTH 0.070 ; + SPACING 0.080 ; +END V1 + +LAYER M2 + TYPE ROUTING ; + DIRECTION HORIZONTAL ; + WIDTH 0.070 ; + PITCH 0.140 ; + SPACING 0.070 ; +END M2 + +# +# Bridge tap: vdd / vss pins exist on BOTH M1 and B1, conveying that +# the cell physically stitches the front-side and backside power rails. +# +MACRO bridge_tap + CLASS CORE ; + ORIGIN 0 0 ; + SIZE 0.380 BY 1.400 ; + SYMMETRY X Y ; + SITE coreSite ; + PROPERTY LEF58_BACKSIDE_BRIDGE "BACKSIDEBRIDGE ;" ; + PIN vdd + DIRECTION INOUT ; + USE POWER ; + PORT + LAYER M1 ; + RECT 0.060 0.050 0.130 1.350 ; + END + PORT + LAYER B1 ; + RECT 0.000 1.330 0.380 1.400 ; + END + END vdd + PIN vss + DIRECTION INOUT ; + USE GROUND ; + PORT + LAYER M1 ; + RECT 0.250 0.050 0.320 1.350 ; + END + PORT + LAYER B1 ; + RECT 0.000 0.000 0.380 0.070 ; + END + END vss +END bridge_tap + +# +# Backside-only filler: vdd / vss exist only on B1 (the backside rail). +# This is the common pattern on a BSPDN PDK -- the cell takes power +# from below and exposes no front-side power pin. +# +MACRO backside_filler + CLASS CORE ; + ORIGIN 0 0 ; + SIZE 0.190 BY 1.400 ; + SYMMETRY X Y ; + SITE coreSite ; + PIN vdd + DIRECTION INOUT ; + USE POWER ; + PORT + LAYER B1 ; + RECT 0.000 1.330 0.190 1.400 ; + END + END vdd + PIN vss + DIRECTION INOUT ; + USE GROUND ; + PORT + LAYER B1 ; + RECT 0.000 0.000 0.190 0.070 ; + END + END vss +END backside_filler + +END LIBRARY diff --git a/src/psm/src/connection.cpp b/src/psm/src/connection.cpp index afc3e8d01e1..55c9420869a 100644 --- a/src/psm/src/connection.cpp +++ b/src/psm/src/connection.cpp @@ -222,6 +222,18 @@ std::string TermConnection::describe() const ///////////////////////////// +BridgeConnection::BridgeConnection(Node* node0, Node* node1) + : Connection(node0, node1) +{ +} + +std::string BridgeConnection::describe() const +{ + return "Bridge Connection"; +} + +///////////////////////////// + FixedResistanceConnection::FixedResistanceConnection(Node* node0, Node* node1, Resistance resistance) diff --git a/src/psm/src/connection.h b/src/psm/src/connection.h index 6197c337800..ad1ae4dfe14 100644 --- a/src/psm/src/connection.h +++ b/src/psm/src/connection.h @@ -145,6 +145,31 @@ class TermConnection : public Connection static constexpr Resistance kResistance = 0.001; }; +// A virtual edge connecting a front-side iterm node to a backside iterm +// node on an instance whose master is tagged with LEF58_BACKSIDE_BRIDGE. +// These cells (taps / TSV-like structures) physically stitch the two +// sides together inside the cell layout; PSM models that stitch as a +// zero-impedance edge so the BFS over the PG graph crosses sides only +// through legitimate bridge cells. +class BridgeConnection : public Connection +{ + public: + BridgeConnection(Node* node0, Node* node1); + + Resistance getResistance(const ResistanceMap& res_map) const override + { + return kResistance; + } + bool isValid() const override { return true; } + + void mergeWith(const Connection* other) override {} + + std::string describe() const override; + + private: + static constexpr Resistance kResistance = 0.001; +}; + class FixedResistanceConnection : public Connection { public: diff --git a/src/psm/src/ir_network.cpp b/src/psm/src/ir_network.cpp index 0e109d7c06f..496a3040b8d 100644 --- a/src/psm/src/ir_network.cpp +++ b/src/psm/src/ir_network.cpp @@ -249,7 +249,8 @@ IRNetwork::generatePolygonsFromITerms(std::vector& terminals) const utl::DebugScopedTimer timer( logger_, utl::PSM, "timer", 1, "Generate shapes from ITerms: {}"); - auto* base_layer = getTech()->findRoutingLayer(1); + odb::dbTechLayer* front_base = getTech()->firstFrontsideRoutingLayer(); + odb::dbTechLayer* back_base = getTech()->firstBacksideRoutingLayer(); LayerMap shapes_by_layer; bool floorplan_asseted = false; @@ -268,11 +269,58 @@ IRNetwork::generatePolygonsFromITerms(std::vector& terminals) continue; } + // First pass: figure out which side(s) this iterm has pin geometry on + // so we can pick the iterm base node's layer accordingly. Only the + // layer matters here, so skip the polygon/transform work. + bool has_front_pin = false; + bool has_back_pin = false; + for (auto* mpin : iterm->getMTerm()->getMPins()) { + for (auto* geom : mpin->getGeometry()) { + odb::dbTechLayer* layer = geom->getTechLayer(); + if (layer == nullptr) { + continue; + } + if (layer->isBackside()) { + has_back_pin = true; + } else { + has_front_pin = true; + } + } + } + + // Place the iterm base node on the cell's "primary" side. A + // backside-only cell's base belongs on the backside grid so its + // pin connects to real shapes; otherwise default to the front side. + odb::dbTechLayer* base_layer = front_base; + if (!has_front_pin && has_back_pin && back_base != nullptr) { + base_layer = back_base; + } + const bool primary_is_back = base_layer == back_base; + const bool is_bridge = inst->getMaster()->isBacksideBridge(); + int x, y; iterm->getAvgXY(&x, &y); auto base_node = std::make_unique(iterm, odb::Point(x, y), base_layer); + auto link_terminal = [&](Node* term, odb::dbTechLayer* term_layer) { + const bool term_is_back = term_layer->isBackside(); + if (term_is_back == primary_is_back) { + // Same-side terminal: ordinary virtual edge into the base node. + connections_.push_back( + std::make_unique(base_node.get(), term)); + } else if (is_bridge) { + // Bridge cell: explicit virtual edge across the front/back boundary. + connections_.push_back( + std::make_unique(base_node.get(), term)); + } + // Non-bridge cross-side terminals are intentionally left + // unlinked from the iterm base node. They still join the + // local layer graph through cleanupOverlappingNodes(); if + // they end up unreachable, that surfaces as an open net, + // which is the correct outcome for a malformed PG. + }; + bool has_routing_term = false; for (auto* mpin : iterm->getMTerm()->getMPins()) { for (auto* geom : mpin->getGeometry()) { @@ -296,8 +344,7 @@ IRNetwork::generatePolygonsFromITerms(std::vector& terminals) auto center = std::make_unique(pin_shape, layer); terminals.push_back(center.get()); - connections_.push_back(std::make_unique( - base_node.get(), center.get())); + link_terminal(center.get(), layer); nodes_[layer].push_back(std::move(center)); } @@ -314,8 +361,7 @@ IRNetwork::generatePolygonsFromITerms(std::vector& terminals) auto center = std::make_unique(pin_shape, layer); terminals.push_back(center.get()); - connections_.push_back( - std::make_unique(base_node.get(), center.get())); + link_terminal(center.get(), layer); nodes_[layer].push_back(std::move(center)); } diff --git a/src/psm/test/BUILD b/src/psm/test/BUILD index 8535017148c..03b55657c73 100644 --- a/src/psm/test/BUILD +++ b/src/psm/test/BUILD @@ -16,6 +16,7 @@ COMPULSORY_TESTS = [ "aes_test_vdd", "aes_test_vss", "check_power_grid", + "check_power_grid_backside", "check_power_grid_disconnected", "check_power_grid_disconnected_macro", "check_power_grid_empty_net", @@ -113,6 +114,8 @@ filegroup( "asap7_data/asap7.lib", "asap7_data/fakeram7_256x32.lef", "asap7_data/riscv.def", + "backside_data/backside.def", + "backside_data/backside.lef", "gcd_all_vss-em.rptok", "gcd_all_vss-spice.spok", "gcd_all_vss-voltage.rptok", diff --git a/src/psm/test/CMakeLists.txt b/src/psm/test/CMakeLists.txt index 5f023c1e505..5a12a3e6aac 100644 --- a/src/psm/test/CMakeLists.txt +++ b/src/psm/test/CMakeLists.txt @@ -9,6 +9,7 @@ or_integration_tests( aes_test_vdd aes_test_vss check_power_grid + check_power_grid_backside check_power_grid_disconnected check_power_grid_disconnected_macro check_power_grid_empty_net diff --git a/src/psm/test/backside_data/backside.def b/src/psm/test/backside_data/backside.def new file mode 100644 index 00000000000..fce0398312c --- /dev/null +++ b/src/psm/test/backside_data/backside.def @@ -0,0 +1,42 @@ +VERSION 5.8 ; +BUSBITCHARS "[]" ; +DIVIDERCHAR "/" ; +DESIGN backside_top ; + +UNITS DISTANCE MICRONS 2000 ; + +DIEAREA ( 0 0 ) ( 3800 2800 ) ; + +ROW row_0 coreSite 0 0 N DO 20 BY 1 STEP 380 0 ; +ROW row_1 coreSite 0 2800 FS DO 20 BY 1 STEP 380 0 ; + +TRACKS X 35 DO 20 STEP 380 LAYER M1 ; +TRACKS Y 35 DO 20 STEP 280 LAYER M2 ; +TRACKS X 35 DO 20 STEP 380 LAYER B1 ; + +COMPONENTS 5 ; +- u_tap_0 bridge_tap + PLACED ( 0 0 ) N ; +- u_fill_0 backside_filler + PLACED ( 760 0 ) N ; +- u_fill_1 backside_filler + PLACED ( 950 0 ) N ; +- u_fill_2 backside_filler + PLACED ( 1140 0 ) N ; +- u_tap_1 bridge_tap + PLACED ( 1330 0 ) N ; +END COMPONENTS + +PINS 0 ; +END PINS + +SPECIALNETS 2 ; +- vdd ( * vdd ) + USE POWER + + ROUTED B1 140 + SHAPE FOLLOWPIN + ( 0 2800 ) ( 3800 * ) + ; +- vss ( * vss ) + USE GROUND + + ROUTED B1 140 + SHAPE FOLLOWPIN + ( 0 0 ) ( 3800 * ) + ; +END SPECIALNETS + +NETS 0 ; +END NETS + +END DESIGN diff --git a/src/psm/test/backside_data/backside.lef b/src/psm/test/backside_data/backside.lef new file mode 100644 index 00000000000..b7ae4f3f76c --- /dev/null +++ b/src/psm/test/backside_data/backside.lef @@ -0,0 +1,118 @@ +VERSION 5.8 ; +BUSBITCHARS "[]" ; +DIVIDERCHAR "/" ; + +UNITS + DATABASE MICRONS 2000 ; +END UNITS + +PROPERTYDEFINITIONS + LAYER LEF58_TYPE STRING ; + LAYER LEF58_BACKSIDE STRING ; + MACRO LEF58_BACKSIDE_BRIDGE STRING ; +END PROPERTYDEFINITIONS + +SITE coreSite + CLASS CORE ; + SIZE 0.190 BY 1.400 ; + SYMMETRY Y ; +END coreSite + +LAYER B1 + TYPE ROUTING ; + DIRECTION HORIZONTAL ; + WIDTH 0.070 ; + PITCH 1.400 ; + SPACING 0.070 ; + PROPERTY LEF58_BACKSIDE "BACKSIDE ;" ; +END B1 + +LAYER M1 + TYPE ROUTING ; + DIRECTION VERTICAL ; + WIDTH 0.070 ; + PITCH 0.190 ; + SPACING 0.070 ; +END M1 + +LAYER V1 + TYPE CUT ; + WIDTH 0.070 ; + SPACING 0.080 ; +END V1 + +LAYER M2 + TYPE ROUTING ; + DIRECTION HORIZONTAL ; + WIDTH 0.070 ; + PITCH 0.140 ; + SPACING 0.070 ; +END M2 + +# +# Bridge tap: vdd / vss pins exist on BOTH M1 and B1, conveying that +# the cell physically stitches the front-side and backside power rails. +# +MACRO bridge_tap + CLASS CORE ; + ORIGIN 0 0 ; + SIZE 0.380 BY 1.400 ; + SYMMETRY X Y ; + SITE coreSite ; + PROPERTY LEF58_BACKSIDE_BRIDGE "BACKSIDEBRIDGE ;" ; + PIN vdd + DIRECTION INOUT ; + USE POWER ; + PORT + LAYER M1 ; + RECT 0.060 0.050 0.130 1.350 ; + END + PORT + LAYER B1 ; + RECT 0.000 1.330 0.380 1.400 ; + END + END vdd + PIN vss + DIRECTION INOUT ; + USE GROUND ; + PORT + LAYER M1 ; + RECT 0.250 0.050 0.320 1.350 ; + END + PORT + LAYER B1 ; + RECT 0.000 0.000 0.380 0.070 ; + END + END vss +END bridge_tap + +# +# Backside-only filler: vdd / vss exist only on B1 (the backside rail). +# This is the common pattern on a BSPDN PDK -- the cell takes power +# from below and exposes no front-side power pin. +# +MACRO backside_filler + CLASS CORE ; + ORIGIN 0 0 ; + SIZE 0.190 BY 1.400 ; + SYMMETRY X Y ; + SITE coreSite ; + PIN vdd + DIRECTION INOUT ; + USE POWER ; + PORT + LAYER B1 ; + RECT 0.000 1.330 0.190 1.400 ; + END + END vdd + PIN vss + DIRECTION INOUT ; + USE GROUND ; + PORT + LAYER B1 ; + RECT 0.000 0.000 0.190 0.070 ; + END + END vss +END backside_filler + +END LIBRARY diff --git a/src/psm/test/check_power_grid_backside.ok b/src/psm/test/check_power_grid_backside.ok new file mode 100644 index 00000000000..7405971ea48 --- /dev/null +++ b/src/psm/test/check_power_grid_backside.ok @@ -0,0 +1,6 @@ +[INFO ODB-0227] LEF file: backside_data/backside.lef, created 4 layers, 2 library cells +[INFO ODB-0128] Design: backside_top +[INFO ODB-0131] Created 5 components and 10 component-terminals. +[INFO ODB-0132] Created 2 special nets and 10 connections. +[INFO PSM-0040] All shapes on net vdd are connected. +[INFO PSM-0040] All shapes on net vss are connected. diff --git a/src/psm/test/check_power_grid_backside.tcl b/src/psm/test/check_power_grid_backside.tcl new file mode 100644 index 00000000000..3b7b3cebb04 --- /dev/null +++ b/src/psm/test/check_power_grid_backside.tcl @@ -0,0 +1,32 @@ +# Verify analyze_power_grid handles a backside-power-delivery design. +# +# Regression test for: +# * isBackside()-aware ITerm base-layer selection in +# src/psm/src/ir_network.cpp (without this fix every ITerm reports +# PSM-0039 "Unconnected instance" on a BSPDN PDK because the +# virtual base node lands on a backside layer that has no shapes). +# * Multi-seed connectivity BFS in src/psm/src/ir_solver.cpp (without +# this fix the BFS misses subgraphs that only touch the top layer +# through bridge cells, flagging thousands of spurious PSM-0038 +# "Unconnected shape" warnings). +# +# Design (in backside_data/): +# * backside.lef declares one routing layer B1 marked LEF58_BACKSIDE +# plus a normal M1, two macros: bridge_tap (vdd / vss on both M1 +# and B1, modeling a TSV-like front<->back bridge cell) and +# backside_filler (vdd / vss only on B1, modeling a normal cell on +# a BSPDN PDK). +# * backside.def places two bridge taps and three fillers along one +# row, with B1 followpins running across the row and a pair of +# M1 stripes through each tap. +# +# Without the two fixes above check_power_grid floods the log with +# PSM-0038 and PSM-0039; with them it reports a single PSM-0040 +# "All shapes ... are connected" for each net. +source helpers.tcl + +read_lef backside_data/backside.lef +read_def backside_data/backside.def + +check_power_grid -net vdd -dont_require_terminals +check_power_grid -net vss -dont_require_terminals