// SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2020-2026, The OpenROAD Authors #include "fixture.h" #include #include #include #include #include #include #include #include "db/infra/frSegStyle.h" #include "db/obj/frBlockage.h" #include "db/obj/frBoundary.h" #include "db/obj/frFig.h" #include "db/obj/frInstBlockage.h" #include "db/obj/frMPin.h" #include "db/obj/frVia.h" #include "db/tech/frConstraint.h" #include "db/tech/frLayer.h" #include "db/tech/frLookupTbl.h" #include "db/tech/frTechObject.h" #include "db/tech/frViaDef.h" #include "drt-global.h" #include "frBaseTypes.h" #include "frDesign.h" #include "frRegionQuery.h" #include "odb/db.h" #include "odb/dbTypes.h" #include "utl/Logger.h" using odb::dbTechLayerDir; using odb::dbTechLayerType; namespace drt { Fixture::Fixture() : logger(std::make_unique()), router_cfg(std::make_unique()), design(std::make_unique(logger.get(), router_cfg.get())), numBlockages(0), numTerms(0), numMasters(0), numInsts(0) { makeDesign(); } void Fixture::addLayer(frTechObject* tech, const char* name, dbTechLayerType type, dbTechLayerDir dir) { auto layer = std::make_unique(); layer->setLayerNum(tech->getTopLayerNum() + 1); layer->setDbLayer(odb::dbTechLayer::create(db_tech, name, type)); layer->getDbLayer()->setDirection(dir); layer->setWidth(100); layer->setMinWidth(100); layer->getDbLayer()->setPitch(200); // These constraints are mandatory if (type == dbTechLayerType::ROUTING) { auto minWidthConstraint = std::make_unique(layer->getMinWidth()); layer->setMinWidthConstraint(minWidthConstraint.get()); tech->addUConstraint(std::move(minWidthConstraint)); auto offGridConstraint = std::make_unique(); layer->setOffGridConstraint(offGridConstraint.get()); tech->addUConstraint(std::move(offGridConstraint)); auto nsmetalConstraint = std::make_unique(); layer->setNonSufficientMetalConstraint(nsmetalConstraint.get()); tech->addUConstraint(std::move(nsmetalConstraint)); } auto shortConstraint = std::make_unique(); layer->setShortConstraint(shortConstraint.get()); tech->addUConstraint(std::move(shortConstraint)); tech->addLayer(std::move(layer)); } void Fixture::setupTech(frTechObject* tech) { tech->setManufacturingGrid(10); tech->setDBUPerUU(1000); auto db = odb::dbDatabase::create(); db_tech = odb::dbTech::create(db, "tech"); // TR assumes that masterslice always exists addLayer(tech, "masterslice", dbTechLayerType::MASTERSLICE); addLayer(tech, "v0", dbTechLayerType::CUT); addLayer(tech, "m1", dbTechLayerType::ROUTING, dbTechLayerDir::HORIZONTAL); } std::pair Fixture::makeMacro(const char* name, frCoord originX, frCoord originY, frCoord sizeX, frCoord sizeY) { auto block = std::make_unique(name); std::vector bounds; frBoundary bound; std::vector points; points.emplace_back(originX, originY); points.emplace_back(sizeX, originY); points.emplace_back(sizeX, sizeY); points.emplace_back(originX, sizeY); bound.setPoints(points); bounds.push_back(bound); block->setBoundaries(bounds); block->setMasterType(odb::dbMasterType::CORE); block->setId(++numMasters); auto blkPtr = block.get(); design->addMaster(std::move(block)); using odb::dbIoType; using odb::dbSigType; odb::dbMaster* master = odb::dbMaster::create(*db_->getLibs().begin(), "dummy"); master->setWidth(1000); master->setHeight(1000); master->setType(odb::dbMasterType::CORE); odb::dbMTerm::create(master, "a", dbIoType::INPUT, dbSigType::SIGNAL); odb::dbMTerm::create(master, "b", dbIoType::INPUT, dbSigType::SIGNAL); odb::dbMTerm::create(master, "c", dbIoType::OUTPUT, dbSigType::SIGNAL); master->setFrozen(); return {blkPtr, master}; } frBlockage* Fixture::makeMacroObs(frMaster* master, frCoord xl, frCoord yl, frCoord xh, frCoord yh, frLayerNum lNum, frCoord designRuleWidth) { int id = master->getBlockages().size(); auto blkIn = std::make_unique(); blkIn->setId(id); blkIn->setDesignRuleWidth(designRuleWidth); auto pinIn = std::make_unique(); pinIn->setId(0); // pinFig std::unique_ptr pinFig = std::make_unique(); pinFig->setBBox(odb::Rect(xl, yl, xh, yh)); pinFig->addToPin(pinIn.get()); pinFig->setLayerNum(lNum); std::unique_ptr uptr(std::move(pinFig)); pinIn->addPinFig(std::move(uptr)); blkIn->setPin(std::move(pinIn)); auto blk = blkIn.get(); master->addBlockage(std::move(blkIn)); return blk; } frTerm* Fixture::makeMacroPin(frMaster* master, const std::string& name, frCoord xl, frCoord yl, frCoord xh, frCoord yh, frLayerNum lNum) { int id = master->getTerms().size(); std::unique_ptr uTerm = std::make_unique(name); auto term = uTerm.get(); term->setId(id); master->addTerm(std::move(uTerm)); odb::dbSigType termType = odb::dbSigType::SIGNAL; term->setType(termType); auto pinIn = std::make_unique(); pinIn->setId(0); std::unique_ptr pinFig = std::make_unique(); pinFig->setBBox(odb::Rect(xl, yl, xh, yh)); pinFig->addToPin(pinIn.get()); pinFig->setLayerNum(lNum); std::unique_ptr uptr(std::move(pinFig)); pinIn->addPinFig(std::move(uptr)); term->addPin(std::move(pinIn)); return term; } frInst* Fixture::makeInst(const char* name, frMaster* master, odb::dbMaster* db_master) { auto db_inst = odb::dbInst::create(db_->getChip()->getBlock(), db_master, "dummy"); odb::dbTransform trans; db_inst->setTransform(trans); auto uInst = std::make_unique(name, master, db_inst); auto tmpInst = uInst.get(); tmpInst->setId(numInsts++); for (auto& uTerm : tmpInst->getMaster()->getTerms()) { auto term = uTerm.get(); std::unique_ptr instTerm = std::make_unique(tmpInst, term); instTerm->setId(numTerms++); int pinCnt = term->getPins().size(); instTerm->setAPSize(pinCnt); tmpInst->addInstTerm(std::move(instTerm)); } for (auto& uBlk : tmpInst->getMaster()->getBlockages()) { auto blk = uBlk.get(); std::unique_ptr instBlk = std::make_unique(tmpInst, blk); instBlk->setId(numBlockages); numBlockages++; tmpInst->addInstBlockage(std::move(instBlk)); } design->getTopBlock()->addInst(std::move(uInst)); return tmpInst; } void Fixture::makeDesign() { setupTech(design->getTech()); auto block = std::make_unique("test"); // GC assumes these fake nets exist auto vssFakeNet = std::make_unique("frFakeVSS", router_cfg.get()); vssFakeNet->setType(odb::dbSigType::GROUND); vssFakeNet->setIsFake(true); block->addFakeSNet(std::move(vssFakeNet)); auto vddFakeNet = std::make_unique("frFakeVDD", router_cfg.get()); vddFakeNet->setType(odb::dbSigType::POWER); vddFakeNet->setIsFake(true); block->addFakeSNet(std::move(vddFakeNet)); design->setTopBlock(std::move(block)); router_cfg->USEMINSPACING_OBS = false; utl::Logger* logger = new utl::Logger(); db_ = odb::dbDatabase::create(); db_->setLogger(logger); odb::dbTech* tech = odb::dbTech::create(db_, "tech"); odb::dbTechLayer::create(tech, "L1", dbTechLayerType::MASTERSLICE); odb::dbLib::create(db_, "lib1", tech, ','); odb::dbChip* chip = odb::dbChip::create(db_, tech); odb::dbBlock::create(chip, "simple_block"); } frLef58CornerSpacingConstraint* Fixture::makeCornerConstraint( frLayerNum layer_num, frCoord eolWidth, frCornerTypeEnum type) { fr1DLookupTbl> cornerSpacingTbl( "WIDTH", {0}, {{200, 200}}); auto con = std::make_unique(cornerSpacingTbl); auto rptr = con.get(); rptr->setCornerType(type); rptr->setSameXY(true); if (eolWidth >= 0) { rptr->setEolWidth(eolWidth); } frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->addLef58CornerSpacingConstraint(rptr); tech->addUConstraint(std::move(con)); return rptr; } void Fixture::makeSpacingConstraint(frLayerNum layer_num) { fr2DLookupTbl tbl("WIDTH", {0, 200}, "PARALLELRUNLENGTH", {0, 400}, {{100, 200}, {300, 400}}); auto con = std::make_unique(tbl); frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->setMinSpacing(con.get()); tech->addUConstraint(std::move(con)); } void Fixture::makeSimpleSpacingConstraint(frLayerNum layer_num, const frCoord spacing_value) { auto con = std::make_unique(spacing_value); frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->setMinSpacing(con.get()); tech->addUConstraint(std::move(con)); } void Fixture::makeMinStepConstraint(frLayerNum layer_num) { auto con = std::make_unique(); con->setMinstepType(frMinstepTypeEnum::STEP); con->setMinStepLength(50); frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->setMinStepConstraint(con.get()); tech->addUConstraint(std::move(con)); } frLef58MinStepConstraint* Fixture::makeMinStep58Constraint(frLayerNum layer_num) { auto con = std::make_unique(); con->setMinStepLength(50); con->setMaxEdges(1); auto rptr = con.get(); frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->addLef58MinStepConstraint(con.get()); tech->addUConstraint(std::move(con)); return rptr; } void Fixture::makeRectOnlyConstraint(frLayerNum layer_num) { auto con = std::make_unique(); frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->setLef58RectOnlyConstraint(con.get()); tech->addUConstraint(std::move(con)); } void Fixture::makeMinEnclosedAreaConstraint(frLayerNum layer_num) { auto con = std::make_unique(200 * 200); frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->addMinEnclosedAreaConstraint(con.get()); tech->addUConstraint(std::move(con)); } odb::dbTechLayerAreaRule* Fixture::makeLef58AreaConstraint( frLayerNum layer_num, int64_t area, int rect_width, bool except_rectangle) { frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); odb::dbTechLayer* db_layer = db_tech->findLayer(layer->getName().c_str()); auto rule = odb::dbTechLayerAreaRule::create(db_layer); rule->setArea(area); if (rect_width > 0) { rule->setRectWidth(rect_width); } rule->setExceptRectangle(except_rectangle); auto con = std::make_unique(rule); if (rule->getRectWidth() > 0) { layer->addLef58AreaConstraintRectWidth(con.get()); } else { layer->addLef58AreaConstraint(con.get()); } tech->addUConstraint(std::move(con)); return rule; } void Fixture::makeSpacingEndOfLineConstraint(frLayerNum layer_num, frCoord par_space, frCoord par_within, bool two_edges) { auto con = std::make_unique(); con->setMinSpacing(200); con->setEolWidth(200); con->setEolWithin(50); if (par_space != -1) { if (par_within == -1) { throw std::invalid_argument("Must give par_within with par_space"); } con->setParSpace(par_space); con->setParWithin(par_within); con->setTwoEdges(two_edges); } frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->addEolSpacing(con.get()); tech->addUConstraint(std::move(con)); } frSpacingTableInfluenceConstraint* Fixture::makeSpacingTableInfluenceConstraint( frLayerNum layer_num, const std::vector& widthTbl, const std::vector>& valTbl) { frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); fr1DLookupTbl> tbl( "WIDTH", widthTbl, valTbl); std::unique_ptr uCon = std::make_unique(tbl); auto rptr = static_cast(uCon.get()); tech->addUConstraint(std::move(uCon)); layer->setSpacingTableInfluence(rptr); return rptr; } frLef58EolExtensionConstraint* Fixture::makeEolExtensionConstraint( frLayerNum layer_num, frCoord spacing, const std::vector& eol, const std::vector& ext, bool parallelOnly) { frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); fr1DLookupTbl tbl("WIDTH", eol, ext, false); std::unique_ptr uCon = std::make_unique(tbl); uCon->setMinSpacing(spacing); uCon->setParallelOnly(parallelOnly); auto rptr = uCon.get(); tech->addUConstraint(std::move(uCon)); layer->addLef58EolExtConstraint(rptr); return rptr; } frSpacingTableTwConstraint* Fixture::makeSpacingTableTwConstraint( frLayerNum layer_num, const std::vector& widthTbl, const std::vector& prlTbl, const std::vector>& spacingTbl) { frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); frCollection rows; for (size_t i = 0; i < widthTbl.size(); i++) { rows.emplace_back(widthTbl[i], prlTbl[i]); } std::unique_ptr uCon = std::make_unique(rows, spacingTbl); auto rptr = static_cast(uCon.get()); rptr->setLayer(layer); tech->addUConstraint(std::move(uCon)); layer->setMinSpacing(rptr); return rptr; } frLef58WidthTableOrthConstraint* Fixture::makeWidthTblOrthConstraint( frLayerNum layer_num, frCoord horz_spc, frCoord vert_spc) { frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); std::unique_ptr uCon = std::make_unique(horz_spc, vert_spc); auto rptr = static_cast(uCon.get()); tech->addUConstraint(std::move(uCon)); layer->setWidthTblOrthCon(rptr); return rptr; } void Fixture::makeLef58EolKeepOutConstraint(frLayerNum layer_num, bool cornerOnly, bool exceptWithin, frCoord withinLow, frCoord withinHigh, frCoord forward, frCoord side, frCoord backward, frCoord width) { frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); auto con = std::make_unique(); auto rptr = con.get(); rptr->setEolWidth(width); rptr->setForwardExt(forward); rptr->setBackwardExt(backward); rptr->setSideExt(side); rptr->setCornerOnly(cornerOnly); rptr->setExceptWithin(exceptWithin); rptr->setWithinLow(withinLow); rptr->setWithinHigh(withinHigh); layer->addLef58EolKeepOutConstraint(rptr); tech->addUConstraint(std::move(con)); } frLef58SpacingEndOfLineConstraint* Fixture::makeLef58SpacingEolConstraint( frLayerNum layer_num, frCoord space, frCoord width, frCoord within, frCoord end_prl_spacing, frCoord end_prl) { auto uCon = std::make_unique(); auto con = uCon.get(); con->setEol(space, width); auto withinCon = std::make_shared(); con->setWithinConstraint(withinCon); withinCon->setEolWithin(within); withinCon->setEndPrl(end_prl_spacing, end_prl); frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->addLef58SpacingEndOfLineConstraint(con); tech->addUConstraint(std::move(uCon)); return con; } frSpacingRangeConstraint* Fixture::makeSpacingRangeConstraint( frLayerNum layer_num, frCoord spacing, frCoord minWidth, frCoord maxWidth) { auto uCon = std::make_unique(); auto con = uCon.get(); con->setMinSpacing(spacing); con->setMinWidth(minWidth); con->setMaxWidth(maxWidth); frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); layer->addSpacingRangeConstraint(con); tech->addUConstraint(std::move(uCon)); return con; } std::shared_ptr Fixture::makeLef58SpacingEolParEdgeConstraint( frLef58SpacingEndOfLineConstraint* con, drt::frCoord par_space, drt::frCoord par_within, bool two_edges) { auto parallelEdge = std::make_shared(); con->getWithinConstraint()->setParallelEdgeConstraint(parallelEdge); parallelEdge->setPar(par_space, par_within); parallelEdge->setTwoEdges(two_edges); return parallelEdge; } std::shared_ptr Fixture::makeLef58SpacingEolMinMaxLenConstraint( frLef58SpacingEndOfLineConstraint* con, drt::frCoord min_max_length, bool max, bool two_sides) { auto minMax = std::make_shared(); con->getWithinConstraint()->setMaxMinLengthConstraint(minMax); minMax->setLength(max, min_max_length, two_sides); return minMax; } std::shared_ptr Fixture::makeLef58SpacingEolCutEncloseConstraint( frLef58SpacingEndOfLineConstraint* con, frCoord encloseDist, frCoord cutToMetalSpacing, bool above, bool below, bool allCuts) { auto cutEnc = std::make_shared( encloseDist, cutToMetalSpacing); con->getWithinConstraint()->setEncloseCutConstraint(cutEnc); cutEnc->setAbove(above); cutEnc->setBelow(below); cutEnc->setAllCuts(allCuts); return cutEnc; } void Fixture::makeCutClass(frLayerNum layer_num, std::string name, frCoord width, frCoord height) { auto cutClass = std::make_unique(); cutClass->setName(name); cutClass->setViaWidth(width); cutClass->setViaLength(height); design->getTech()->addCutClass(layer_num, std::move(cutClass)); } void Fixture::makeLef58CutSpcTbl(frLayerNum layer_num, odb::dbTechLayerCutSpacingTableDefRule* dbRule) { auto con = std::make_unique(dbRule); auto layer = design->getTech()->getLayer(layer_num); if (dbRule->isLayerValid()) { if (dbRule->isSameMetal()) { layer->setLef58SameMetalInterCutSpcTblConstraint(con.get()); } else if (dbRule->isSameNet()) { layer->setLef58SameNetInterCutSpcTblConstraint(con.get()); } else { layer->setLef58DefaultInterCutSpcTblConstraint(con.get()); } } else { if (dbRule->isSameMetal()) { layer->setLef58SameMetalCutSpcTblConstraint(con.get()); } else if (dbRule->isSameNet()) { layer->setLef58SameNetCutSpcTblConstraint(con.get()); } else { layer->setLef58DiffNetCutSpcTblConstraint(con.get()); } } design->getTech()->addUConstraint(std::move(con)); } void Fixture::makeLef58TwoWiresForbiddenSpc( frLayerNum layer_num, odb::dbTechLayerTwoWiresForbiddenSpcRule* dbRule) { auto con = std::make_unique(dbRule); auto layer = design->getTech()->getLayer(layer_num); layer->addTwoWiresForbiddenSpacingConstraint(con.get()); design->getTech()->addUConstraint(std::move(con)); } void Fixture::makeLef58ForbiddenSpc( frLayerNum layer_num, odb::dbTechLayerForbiddenSpacingRule* dbRule) { auto con = std::make_unique(dbRule); auto layer = design->getTech()->getLayer(layer_num); layer->addForbiddenSpacingConstraint(con.get()); design->getTech()->addUConstraint(std::move(con)); } frLef58EnclosureConstraint* Fixture::makeLef58EnclosureConstrainut( frLayerNum layer_num, int cut_class_idx, frCoord width, frCoord firstOverhang, frCoord secondOverhang) { auto layer = design->getTech()->getLayer(layer_num); auto dbRule = odb::dbTechLayerCutEnclosureRule::create(layer->getDbLayer()); auto con = std::make_unique(dbRule); auto rptr = con.get(); rptr->setCutClassIdx(cut_class_idx); dbRule->setMinWidth(width); dbRule->setFirstOverhang(firstOverhang); dbRule->setSecondOverhang(secondOverhang); dbRule->setType(odb::dbTechLayerCutEnclosureRule::DEFAULT); layer->addLef58EnclosureConstraint(rptr); design->getTech()->addUConstraint(std::move(con)); return rptr; } void Fixture::makeMetalWidthViaMap(frLayerNum layer_num, odb::dbMetalWidthViaMap* dbRule) { auto con = std::make_unique(dbRule); auto layer = design->getTech()->getLayer(layer_num); layer->addMetalWidthViaConstraint(con.get()); design->getTech()->addUConstraint(std::move(con)); } void Fixture::makeKeepOutZoneRule(frLayerNum layer_num, odb::dbTechLayerKeepOutZoneRule* dbRule) { auto con = std::make_unique(dbRule); auto layer = design->getTech()->getLayer(layer_num); layer->addKeepOutZoneConstraint(con.get()); design->getTech()->addUConstraint(std::move(con)); } frLef58CutSpacingConstraint* Fixture::makeLef58CutSpacingConstraint_parallelOverlap(frLayerNum layer_num, frCoord spacing) { frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); auto uCon = std::make_unique(); auto con = uCon.get(); con->setCutSpacing(spacing); con->setParallelOverlap(true); layer->addLef58CutSpacingConstraint(con); design->getTech()->addUConstraint(std::move(uCon)); return con; } frLef58CutSpacingConstraint* Fixture::makeLef58CutSpacingConstraint_adjacentCut( frLayerNum layer_num, frCoord spacing, int adjacent_cuts, int two_cuts, frCoord within) { frTechObject* tech = design->getTech(); frLayer* layer = tech->getLayer(layer_num); auto rule = odb::dbTechLayerCutSpacingRule::create(layer->getDbLayer()); rule->setCutSpacing(spacing); rule->setAdjacentCuts(adjacent_cuts); // con->setTwoCuts(two_cuts); rule->setWithin(within); rule->setCenterToCenter(true); auto uCon = std::make_unique(); auto con = uCon.get(); con->setCutClassIdx(0); con->setCutSpacing(rule->getCutSpacing()); con->setAdjacentCuts(rule->getAdjacentCuts()); con->setCutWithin(rule->getWithin()); con->setCenterToCenter(rule->isCenterToCenter()); layer->addLef58CutSpacingConstraint(con); design->getTech()->addUConstraint(std::move(uCon)); return con; } void Fixture::makeMinimumCut(frLayerNum layerNum, frCoord width, frCoord length, frCoord distance, frMinimumcutConnectionEnum connection) { auto con = std::make_unique(); auto layer = design->getTech()->getLayer(layerNum); auto rptr = con.get(); con->setWidth(width); con->setLength(length, distance); con->setConnection(connection); design->getTech()->addUConstraint(std::move(con)); layer->addMinimumcutConstraint(rptr); } frNet* Fixture::makeNet(const char* name) { frBlock* block = design->getTopBlock(); auto net_p = std::make_unique(name, router_cfg.get()); frNet* net = net_p.get(); block->addNet(std::move(net_p)); return net; } frViaDef* Fixture::makeViaDef(const char* name, frLayerNum layer_num, const odb::Point& ll, const odb::Point& ur) { auto tech = design->getTech(); auto via_p = std::make_unique(name); for (frLayerNum l = layer_num - 1; l <= layer_num + 1; l++) { std::unique_ptr pinFig = std::make_unique(); pinFig->setBBox(odb::Rect(ll, ur)); pinFig->setLayerNum(l); switch (l - layer_num) { case -1: via_p->addLayer1Fig(std::move(pinFig)); break; case 0: via_p->addCutFig(std::move(pinFig)); break; case 1: via_p->addLayer2Fig(std::move(pinFig)); break; default: logger->error(DRT, 624, "Unexpected layer diff {}", l - layer_num); } } return tech->addVia(std::move(via_p)); } frVia* Fixture::makeVia(frViaDef* viaDef, frNet* net, const odb::Point& origin) { auto via_p = std::make_unique(viaDef, origin); via_p->addToNet(net); frVia* via = via_p.get(); net->addVia(std::move(via_p)); return via; } void Fixture::makePathseg(frNet* net, frLayerNum layer_num, const odb::Point& begin, const odb::Point& end, frUInt4 width, frEndStyleEnum begin_style, frEndStyleEnum end_style) { auto ps = std::make_unique(); ps->setPoints(begin, end); ps->setLayerNum(layer_num); if (begin_style == frcVariableEndStyle || end_style == frcVariableEndStyle) { throw std::invalid_argument("frcVariableEndStyle not supported"); } frCoord begin_ext = begin_style == frcExtendEndStyle ? width / 2 : 0; frCoord end_ext = begin_style == frcExtendEndStyle ? width / 2 : 0; frSegStyle style; style.setWidth(width); style.setBeginStyle(begin_style, begin_ext); style.setEndStyle(end_style, end_ext); ps->setStyle(style); net->addShape(std::move(ps)); } void Fixture::initRegionQuery() { frRegionQuery* query = design->getRegionQuery(); query->init(); query->initDRObj(); } void Fixture::makeLef58WrongDirSpcConstraint( frLayerNum layer_num, odb::dbTechLayerWrongDirSpacingRule* dbRule) { auto con = std::make_unique(dbRule); auto layer = design->getTech()->getLayer(layer_num); layer->addLef58SpacingWrongDirConstraint(con.get()); design->getTech()->addUConstraint(std::move(con)); } void Fixture::makeSpacingTableOrthConstraint(frLayerNum layer_num, frCoord within, frCoord spc) { std::vector> spc_tbl = {{within, spc}}; auto con = std::make_unique(spc_tbl); auto layer = design->getTech()->getLayer(layer_num); layer->setOrthSpacingTableConstraint(con.get()); design->getTech()->addUConstraint(std::move(con)); } } // namespace drt