Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#5820 from bnmfw/drt_set_multi…
Browse files Browse the repository at this point in the history
…ple_accesses

drt: suport por setting multiple accesses in a single call
  • Loading branch information
maliberty authored Sep 28, 2024
2 parents d0fa326 + ee240db commit ce07d1f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
7 changes: 7 additions & 0 deletions src/drt/src/db/obj/frAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ class frAccessPoint : public frBlockObject
std::cout << "Error: unexpected direction in setValidAccess\n";
}
}
template <std::size_t N>
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)
Expand Down
6 changes: 6 additions & 0 deletions src/drt/src/frBaseTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 7 additions & 15 deletions src/drt/src/pa/FlexPA_prep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,41 +211,33 @@ void FlexPA::gen_createAccessPoint(
return;
}
auto ap = std::make_unique<frAccessPoint>(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);
Expand Down

0 comments on commit ce07d1f

Please sign in to comment.