Skip to content

Commit

Permalink
Merge branch 'master' into mpl2_centralization
Browse files Browse the repository at this point in the history
  • Loading branch information
AcKoucher committed Apr 3, 2024
2 parents e6f50b9 + 5e60e13 commit 0f4ba2d
Show file tree
Hide file tree
Showing 37 changed files with 1,137 additions and 173 deletions.
49 changes: 49 additions & 0 deletions src/drt/src/db/tech/frConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,55 @@ class frLef58SpacingTableConstraint : public frSpacingTableConstraint
bool exceptEol_{false};
frUInt4 eolWidth_{0};
};
// LEF58_TWOWIRESFORBIDDENSPACING
class frLef58TwoWiresForbiddenSpcConstraint : public frConstraint
{
public:
frLef58TwoWiresForbiddenSpcConstraint(
odb::dbTechLayerTwoWiresForbiddenSpcRule* db_rule)
: db_rule_(db_rule)
{
}
// getters
odb::dbTechLayerTwoWiresForbiddenSpcRule* getODBRule() const
{
return db_rule_;
}
// setters
void setODBRule(odb::dbTechLayerTwoWiresForbiddenSpcRule* in)
{
db_rule_ = in;
}
// others
frConstraintTypeEnum typeId() const override
{
return frConstraintTypeEnum::frcLef58EolKeepOutConstraint;
}
bool isValidForMinSpanLength(frCoord width)
{
return db_rule_->isMinExactSpanLength()
? (width == db_rule_->getMinSpanLength())
: (width >= db_rule_->getMinSpanLength());
}
bool isValidForMaxSpanLength(frCoord width)
{
return db_rule_->isMaxExactSpanLength()
? (width == db_rule_->getMaxSpanLength())
: (width <= db_rule_->getMaxSpanLength());
}
bool isForbiddenSpacing(frCoord spc)
{
return spc >= db_rule_->getMinSpacing() && spc <= db_rule_->getMaxSpacing();
}
bool isValidPrl(frCoord prl) { return prl > db_rule_->getPrl(); }
void report(utl::Logger* logger) const override
{
logger->report("TWOWIRESFORBIDDENSPACING");
}

private:
odb::dbTechLayerTwoWiresForbiddenSpcRule* db_rule_;
};

// ADJACENTCUTS
class frCutSpacingConstraint : public frConstraint
Expand Down
19 changes: 19 additions & 0 deletions src/drt/src/db/tech/frLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,23 @@ class frLayer
return !spacingRangeConstraints_.empty();
}

void addTwoWiresForbiddenSpacingConstraint(
frLef58TwoWiresForbiddenSpcConstraint* in)
{
twForbiddenSpcConstraints_.push_back(in);
}

const std::vector<frLef58TwoWiresForbiddenSpcConstraint*>&
getTwoWiresForbiddenSpacingConstraints() const
{
return twForbiddenSpcConstraints_;
}

bool hasTwoWiresForbiddenSpacingConstraints() const
{
return !twForbiddenSpcConstraints_.empty();
}

void setLef58SameNetInterCutSpcTblConstraint(
frLef58CutSpacingTableConstraint* con)
{
Expand Down Expand Up @@ -776,6 +793,8 @@ class frLayer
std::vector<frLef58AreaConstraint*> lef58AreaConstraints_;
std::vector<frLef58KeepOutZoneConstraint*> keepOutZoneConstraints_;
std::vector<frSpacingRangeConstraint*> spacingRangeConstraints_;
std::vector<frLef58TwoWiresForbiddenSpcConstraint*>
twForbiddenSpcConstraints_;
drEolSpacingConstraint drEolCon_;

friend class io::Parser;
Expand Down
10 changes: 7 additions & 3 deletions src/drt/src/db/tech/frTechObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,19 @@ class frTechObject
layer2Name2CutClass_.emplace_back();
layerCutClass_.emplace_back();
}
void addVia(std::unique_ptr<frViaDef> in)
frViaDef* addVia(std::unique_ptr<frViaDef> in)
{
in->setId(vias_.size());
if (name2via_.find(in->getName()) != name2via_.end()) {
std::cout << "Error: duplicated via definition for " << in->getName()
<< "\n";
if (*(name2via_[in->getName()]) == *in) {
return name2via_[in->getName()];
}
return nullptr;
}
frViaDef* rptr = in.get();
name2via_[in->getName()] = in.get();
vias_.push_back(std::move(in));
return rptr;
}
void addCutClass(frLayerNum lNum, std::unique_ptr<frLef58CutClass> in)
{
Expand Down
61 changes: 61 additions & 0 deletions src/drt/src/db/tech/frViaDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@

#pragma once

#include <algorithm>
#include <iostream>
#include <memory>
#include <set>
#include <vector>

#include "db/obj/frShape.h"
Expand Down Expand Up @@ -76,6 +78,65 @@ class frViaDef
// constructors
frViaDef() = default;
frViaDef(const std::string& nameIn) : name_(nameIn) {}
// operators
bool operator==(const frViaDef& in) const
{
if (name_ != in.name_) {
return false;
}
if (cutClassIdx_ != in.cutClassIdx_) {
return false;
}
if (cutClass_ != in.cutClass_) {
return false;
}
if (isDefault_ != in.isDefault_) {
return false;
}
auto equalFigs = [](const std::vector<std::unique_ptr<frShape>>& val1,
const std::vector<std::unique_ptr<frShape>>& val2) {
std::multiset<std::pair<frLayerNum, odb::Rect>> val1set;
std::multiset<std::pair<frLayerNum, odb::Rect>> val2set;
std::transform(val1.begin(),
val1.end(),
std::inserter(val1set, val1set.begin()),
[](const std::unique_ptr<frShape>& val) {
return std::make_pair(val->getLayerNum(),
val->getBBox());
});
std::transform(val2.begin(),
val2.end(),
std::inserter(val2set, val2set.begin()),
[](const std::unique_ptr<frShape>& val) {
return std::make_pair(val->getLayerNum(),
val->getBBox());
});
if (val1set.size() != val2set.size()) {
return false;
}
auto it1 = val1set.begin();
auto it2 = val2set.begin();
while (it1 != val1set.end()) {
if (*it1 != *it2) {
return false;
}
it1++;
it2++;
}
return true;
};
if (!equalFigs(layer1Figs_, in.layer1Figs_)) {
return false;
}
if (!equalFigs(layer2Figs_, in.layer2Figs_)) {
return false;
}
if (!equalFigs(cutFigs_, in.cutFigs_)) {
return false;
}
return true;
}
bool operator!=(const frViaDef& in) const { return !(*this == in); }
// getters
void getName(std::string& nameIn) const { nameIn = name_; }
std::string getName() const { return name_; }
Expand Down
11 changes: 4 additions & 7 deletions src/drt/src/gc/FlexGC_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class FlexGCWorker::Impl
void myBloat(const gtl::rectangle_data<frCoord>& rect,
frCoord val,
box_t& box);
bool hasRoute(gcRect* rect, gtl::rectangle_data<frCoord> markerRect);
void checkMetalSpacing_main(gcRect* rect,
bool checkNDRs = true,
bool isSpcRect = false);
Expand Down Expand Up @@ -273,6 +274,9 @@ class FlexGCWorker::Impl
frCoord distY,
bool checkNDRs = true,
bool checkPolyEdge = true);
void checkTwoWiresForbiddenSpc_main(
gcRect* rect,
frLef58TwoWiresForbiddenSpcConstraint* con);
box_t checkMetalCornerSpacing_getQueryBox(gcCorner* corner,
frCoord& maxSpcValX,
frCoord& maxSpcValY);
Expand Down Expand Up @@ -450,9 +454,6 @@ class FlexGCWorker::Impl
gcRect* rect2,
const gtl::rectangle_data<frCoord>& markerRect,
frCutSpacingConstraint* con);
frCoord checkCutSpacing_spc_getReqSpcVal(gcRect* ptr1,
gcRect* ptr2,
frCutSpacingConstraint* con);

// LEF58
void checkLef58CutSpacing_main(gcRect* rect);
Expand Down Expand Up @@ -485,10 +486,6 @@ class FlexGCWorker::Impl
bool checkLef58CutSpacing_spc_hasTwoCuts_helper(
gcRect* rect,
frLef58CutSpacingConstraint* con);
frCoord checkLef58CutSpacing_spc_getReqSpcVal(
gcRect* ptr1,
gcRect* ptr2,
frLef58CutSpacingConstraint* con);
// LEF58_KEEPOUTZONE
void checKeepOutZone_main(gcRect* rect, frLef58KeepOutZoneConstraint* con);

Expand Down
Loading

0 comments on commit 0f4ba2d

Please sign in to comment.