Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/gui/src/dbDescriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5158,8 +5158,12 @@ void DbMarkerDescriptor::paintMarker(odb::dbMarker* marker,
painter.drawLine(line.pt0(), line.pt1());
} else if (std::holds_alternative<odb::Rect>(shape)) {
painter.drawRect(std::get<odb::Rect>(shape));
} else {
} else if (std::holds_alternative<odb::Polygon>(shape)) {
painter.drawPolygon(std::get<odb::Polygon>(shape));
} else if (std::holds_alternative<odb::Cuboid>(shape)) {
const odb::Cuboid cuboid = std::get<odb::Cuboid>(shape);
const odb::Rect rect = cuboid.getEnclosingRect();
painter.drawRect(rect);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -8270,7 +8270,7 @@ class dbMarker : public dbObject

std::string getName() const;

using MarkerShape = std::variant<Point, Line, Rect, Polygon>;
using MarkerShape = std::variant<Point, Line, Rect, Polygon, Cuboid>;

dbMarkerCategory* getCategory() const;
std::vector<MarkerShape> getShapes() const;
Expand All @@ -8283,6 +8283,7 @@ class dbMarker : public dbObject
void addShape(const Line& line);
void addShape(const Rect& rect);
void addShape(const Polygon& polygon);
void addShape(const Cuboid& cuboid);

void setTechLayer(dbTechLayer* layer);

Expand Down
8 changes: 8 additions & 0 deletions src/odb/include/odb/geom.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class Cuboid
int xCenter() const { return (xlo_ + xhi_) / 2; }
int yCenter() const { return (ylo_ + yhi_) / 2; }
int zCenter() const { return (zlo_ + zhi_) / 2; }
Rect getEnclosingRect() const;

std::vector<Point3D> getPoints() const;
Point3D lll() const; // lower corner (xMin, yMin, zMin)
Expand Down Expand Up @@ -211,6 +212,8 @@ class Cuboid

void printf(FILE* fp, const char* prefix = "");
void print(const char* prefix = "");
friend dbIStream& operator>>(dbIStream& stream, Cuboid& c);
friend dbOStream& operator<<(dbOStream& stream, const Cuboid& c);

private:
int xlo_ = 0;
Expand Down Expand Up @@ -1246,6 +1249,11 @@ inline Point3D Cuboid::center() const
return Point3D(xCenter(), yCenter(), zCenter());
}

inline Rect Cuboid::getEnclosingRect() const
{
return Rect(xlo_, ylo_, xhi_, yhi_);
}

inline bool Cuboid::intersects(const Point3D& p) const
{
return (p.x() >= xlo_) && (p.x() <= xhi_) && (p.y() >= ylo_)
Expand Down
15 changes: 3 additions & 12 deletions src/odb/src/3dblox/checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ void Checker::checkFloatingChips(dbMarkerCategory* top_cat,
for (const auto& group : groups | std::views::reverse) {
auto* marker = dbMarker::create(cat);
for (auto* chip : group) {
marker->addShape(Rect(chip->cuboid.xMin(),
chip->cuboid.yMin(),
chip->cuboid.xMax(),
chip->cuboid.yMax()));
marker->addShape(chip->cuboid);
marker->addSource(chip->chip_inst_path.back());
}
marker->setComment("Isolated chip set starting with " + group[0]->name);
Expand Down Expand Up @@ -209,10 +206,7 @@ void Checker::checkOverlappingChips(dbMarkerCategory* top_cat,
for (const auto& [inst1, inst2] : overlaps) {
auto* marker = dbMarker::create(cat);
auto intersection = inst1->cuboid.intersect(inst2->cuboid);
marker->addShape(Rect(intersection.xMin(),
intersection.yMin(),
intersection.xMax(),
intersection.yMax()));
marker->addShape(intersection);
marker->addSource(inst1->chip_inst_path.back());
marker->addSource(inst2->chip_inst_path.back());
marker->setComment(
Expand All @@ -238,10 +232,7 @@ void Checker::checkInternalExtUsage(dbMarkerCategory* top_cat,
region.region_inst->getChipRegion()->getName());
auto* marker = dbMarker::create(cat);
marker->addSource(region.region_inst);
marker->addShape(Rect(region.cuboid.xMin(),
region.cuboid.yMin(),
region.cuboid.xMax(),
region.cuboid.yMax()));
marker->addShape(region.cuboid);
marker->setComment(
fmt::format("Unused internal_ext region: {}",
region.region_inst->getChipRegion()->getName()));
Expand Down
2 changes: 1 addition & 1 deletion src/odb/src/db/dbDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace odb {
inline constexpr uint32_t kSchemaMajor = 0; // Not used...
inline constexpr uint32_t kSchemaInitial = 57;

inline constexpr uint32_t kSchemaMinor = 126; // Current revision number
inline constexpr uint32_t kSchemaMinor = 127; // Current revision number

// Revision where dbTechLayer::wrong_way_min_width_ was added
inline constexpr uint32_t kSchemaTechLayerMinWidthWrongway = 126;
Expand Down
21 changes: 19 additions & 2 deletions src/odb/src/db/dbMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ dbIStream& operator>>(dbIStream& stream, _dbMarker& obj)
obj.shapes_.emplace_back(p);
break;
}
case _dbMarker::ShapeType::kCuboid: {
Cuboid c;
Comment thread
osamahammad21 marked this conversation as resolved.
stream >> c;
obj.shapes_.emplace_back(c);
break;
}
Comment on lines +149 to +154
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The populatePTree and fromPTree methods in this file (lines 275 and 382 in the full file) also need to be updated to handle the Cuboid shape type. Currently, populatePTree has a default else block that assumes a Polygon, which will cause a std::bad_variant_access exception when encountering a Cuboid. Similarly, fromPTree will fail to reconstruct markers containing cuboids from JSON/TR reports.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True but 3dblox violations are not yet handled in that scope altogether. I intent to address this in a separate PR.

}
}
// User Code End >>
Expand Down Expand Up @@ -182,9 +188,12 @@ dbOStream& operator<<(dbOStream& stream, const _dbMarker& obj)
} else if (std::holds_alternative<Rect>(shape)) {
stream << _dbMarker::ShapeType::kRect;
stream << std::get<Rect>(shape);
} else {
} else if (std::holds_alternative<Polygon>(shape)) {
Comment thread
osamahammad21 marked this conversation as resolved.
stream << _dbMarker::ShapeType::kPolygon;
stream << std::get<Polygon>(shape);
} else if (std::holds_alternative<Cuboid>(shape)) {
Comment thread
osamahammad21 marked this conversation as resolved.
stream << _dbMarker::ShapeType::kCuboid;
stream << std::get<Cuboid>(shape);
}
}
// User Code End <<
Expand Down Expand Up @@ -708,6 +717,12 @@ void dbMarker::addShape(const Polygon& polygon)
marker->shapes_.emplace_back(polygon);
}

void dbMarker::addShape(const Cuboid& cuboid)
{
_dbMarker* marker = (_dbMarker*) this;
marker->shapes_.emplace_back(cuboid);
}

void dbMarker::setTechLayer(dbTechLayer* layer)
{
_dbMarker* marker = (_dbMarker*) this;
Expand Down Expand Up @@ -782,8 +797,10 @@ Rect dbMarker::getBBox() const
}
} else if (std::holds_alternative<Rect>(shape)) {
bbox.merge(std::get<Rect>(shape));
} else {
} else if (std::holds_alternative<Polygon>(shape)) {
bbox.merge(std::get<Polygon>(shape).getEnclosingRect());
} else if (std::holds_alternative<Cuboid>(shape)) {
bbox.merge(std::get<Cuboid>(shape).getEnclosingRect());
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/odb/src/db/dbMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class _dbMarker : public _dbObject
kPoint = 0,
kLine = 1,
kRect = 2,
kPolygon = 3
kPolygon = 3,
kCuboid = 4
};
// User Code End Enums

Expand Down
22 changes: 22 additions & 0 deletions src/odb/src/db/dbStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,28 @@ dbIStream& operator>>(dbIStream& stream, Point3D& p)
return stream;
}

dbOStream& operator<<(dbOStream& stream, const Cuboid& c)
{
stream << c.xlo_;
stream << c.ylo_;
stream << c.zlo_;
stream << c.xhi_;
stream << c.yhi_;
stream << c.zhi_;
return stream;
}

dbIStream& operator>>(dbIStream& stream, Cuboid& c)
{
stream >> c.xlo_;
stream >> c.ylo_;
stream >> c.zlo_;
stream >> c.xhi_;
stream >> c.yhi_;
stream >> c.zhi_;
return stream;
}

dbOStream& operator<<(dbOStream& stream, const Oct& o)
{
stream << o.center_high_;
Expand Down