From ee240db94c70ef1a2eb762c88e5c949d5907cdab Mon Sep 17 00:00:00 2001 From: bernardo Date: Fri, 27 Sep 2024 22:34:35 +0000 Subject: [PATCH] drt: suport por setting multiple accesses in a single call Signed-off-by: bernardo --- src/drt/src/db/obj/frAccess.h | 7 +++++++ src/drt/src/frBaseTypes.h | 6 ++++++ src/drt/src/pa/FlexPA_prep.cpp | 22 +++++++--------------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/drt/src/db/obj/frAccess.h b/src/drt/src/db/obj/frAccess.h index 09d60329010..3d6a376007e 100644 --- a/src/drt/src/db/obj/frAccess.h +++ b/src/drt/src/db/obj/frAccess.h @@ -169,6 +169,13 @@ class frAccessPoint : public frBlockObject std::cout << "Error: unexpected direction in setValidAccess\n"; } } + template + void setMultipleAccesses(const frDirEnum (&dirArray)[N], bool isValid = true) + { + for (std::size_t i = 0; i < N; ++i) { + setAccess(dirArray[i], isValid); + } + } void addViaDef(frViaDef* in); void addToPinAccess(frPinAccess* in) { aps_ = in; } void setType(frAccessPointEnum in, bool isL = true) diff --git a/src/drt/src/frBaseTypes.h b/src/drt/src/frBaseTypes.h index c4deacca2e1..dabdb8a1b86 100644 --- a/src/drt/src/frBaseTypes.h +++ b/src/drt/src/frBaseTypes.h @@ -273,6 +273,12 @@ static constexpr frDirEnum frDirEnumAll[] = {frDirEnum::D, static constexpr frDirEnum frDirEnumPlanar[] = {frDirEnum::S, frDirEnum::W, frDirEnum::E, frDirEnum::N}; +static constexpr frDirEnum frDirEnumVia[] = {frDirEnum::U, frDirEnum::D}; + +static constexpr frDirEnum frDirEnumVert[] = {frDirEnum::N, frDirEnum::S}; + +static constexpr frDirEnum frDirEnumHorz[] = {frDirEnum::W, frDirEnum::E}; + enum class AccessPointTypeEnum { Ideal, diff --git a/src/drt/src/pa/FlexPA_prep.cpp b/src/drt/src/pa/FlexPA_prep.cpp index 32bc3865640..98fd8bc592f 100644 --- a/src/drt/src/pa/FlexPA_prep.cpp +++ b/src/drt/src/pa/FlexPA_prep.cpp @@ -211,41 +211,33 @@ void FlexPA::gen_createAccessPoint( return; } auto ap = std::make_unique(fpt, layer_num); + + ap->setMultipleAccesses(frDirEnumPlanar, allow_planar); + if (allow_planar) { const auto lower_layer = getDesign()->getTech()->getLayer(layer_num); - for (const frDirEnum dir : frDirEnumPlanar) { - ap->setAccess(dir, true); - } // rectonly forbid wrongway planar access // rightway on grid only forbid off track rightway planar access // horz layer if (lower_layer->getDir() == dbTechLayerDir::HORIZONTAL) { if (lower_layer->isUnidirectional()) { - ap->setAccess(frDirEnum::S, false); - ap->setAccess(frDirEnum::N, false); + ap->setMultipleAccesses(frDirEnumVert, false); } if (lower_layer->getLef58RightWayOnGridOnlyConstraint() && low_cost != frAccessPointEnum::OnGrid) { - ap->setAccess(frDirEnum::W, false); - ap->setAccess(frDirEnum::E, false); + ap->setMultipleAccesses(frDirEnumHorz, false); } } // vert layer if (lower_layer->getDir() == dbTechLayerDir::VERTICAL) { if (lower_layer->isUnidirectional()) { - ap->setAccess(frDirEnum::W, false); - ap->setAccess(frDirEnum::E, false); + ap->setMultipleAccesses(frDirEnumHorz, false); } if (lower_layer->getLef58RightWayOnGridOnlyConstraint() && low_cost != frAccessPointEnum::OnGrid) { - ap->setAccess(frDirEnum::S, false); - ap->setAccess(frDirEnum::N, false); + ap->setMultipleAccesses(frDirEnumVert, false); } } - } else { - for (const frDirEnum dir : frDirEnumPlanar) { - ap->setAccess(dir, false); - } } ap->setAccess(frDirEnum::D, false); ap->setAccess(frDirEnum::U, allow_via);