Skip to content

Commit 4cb6b46

Browse files
committed
odb: multiple fixes to 3dblox
Signed-off-by: osamahammad21 <[email protected]>
1 parent a338452 commit 4cb6b46

File tree

12 files changed

+285
-144
lines changed

12 files changed

+285
-144
lines changed

src/odb/include/odb/db.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7226,12 +7226,6 @@ class dbChipInst : public dbObject
72267226
public:
72277227
std::string getName() const;
72287228

7229-
void setLoc(const Point3D& loc);
7230-
7231-
Point3D getLoc() const;
7232-
7233-
void setOrient(dbOrientType3D orient);
7234-
72357229
dbOrientType3D getOrient() const;
72367230

72377231
dbChip* getMasterChip() const;
@@ -7242,6 +7236,12 @@ class dbChipInst : public dbObject
72427236

72437237
dbTransform getTransform() const;
72447238

7239+
void setOrient(dbOrientType3D orient);
7240+
7241+
void setLoc(const Point3D& loc);
7242+
7243+
Point3D getLoc() const;
7244+
72457245
Rect getBBox() const;
72467246

72477247
Cuboid getCuboid() const;

src/odb/include/odb/dbTransform.h

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,79 @@ class dbTransform
1919
{
2020
friend class _dbBlock;
2121
dbOrientType::Value _orient = dbOrientType::R0;
22-
Point _offset;
22+
Point3D _offset;
23+
bool mirror_z_ = false;
2324

2425
public:
25-
// T = <R0, (0,0)>
26+
// T = <R0, (0,0,0), false>
2627
dbTransform() = default;
2728

28-
// T = <R0, offset>
29-
dbTransform(const Point offset) : _offset(offset) {}
29+
// T = <R0, (offset,0), false>
30+
dbTransform(const Point offset) : _offset(offset, 0) {}
3031

31-
// T = <orient, (0,0)>
32+
// T = <R0, offset, false>
33+
dbTransform(const Point3D& offset) : _offset(offset) {}
34+
35+
// T = <orient, (0,0,0), false>
3236
dbTransform(const dbOrientType orient) : _orient(orient) {}
3337

34-
// T = <orient, offset>
38+
// T = <orient, (0,0,0), orient.mirror_z_>
39+
dbTransform(const dbOrientType3D& orient)
40+
: _orient(orient.getOrientType2D()), mirror_z_(orient.isMirrorZ())
41+
{
42+
}
43+
44+
// T = <orient, (offset,0), false>
3545
dbTransform(const dbOrientType orient, const Point& offset)
36-
: _orient(orient), _offset(offset)
46+
: _orient(orient), _offset(offset, 0)
47+
{
48+
}
49+
50+
dbTransform(const dbOrientType3D orient, const Point3D& offset)
51+
: _orient(orient.getOrientType2D()),
52+
_offset(offset),
53+
mirror_z_(orient.isMirrorZ())
3754
{
3855
}
3956

4057
bool operator==(const dbTransform& t) const
4158
{
42-
return (_orient == t._orient) && (_offset == t._offset);
59+
return (_orient == t._orient) && (_offset == t._offset)
60+
&& (mirror_z_ == t.mirror_z_);
4361
}
4462

4563
bool operator!=(const dbTransform& t) const { return !operator==(t); }
4664

4765
void setOrient(const dbOrientType orient) { _orient = orient; }
4866

49-
void setOffset(const Point offset) { _offset = offset; }
67+
void setOrient(const dbOrientType3D& orient)
68+
{
69+
_orient = orient.getOrientType2D();
70+
mirror_z_ = orient.isMirrorZ();
71+
}
72+
73+
void setOffset(const Point offset) { _offset = Point3D(offset, 0); }
74+
75+
void setOffset(const Point3D& offset) { _offset = offset; }
5076

5177
void setTransform(const dbOrientType orient, const Point& offset)
5278
{
5379
_orient = orient;
54-
_offset = offset;
80+
_offset = Point3D(offset, 0);
5581
}
5682

5783
// Apply transform to this point
5884
void apply(Point& p) const;
5985

86+
// Apply transform to this point3D
87+
void apply(Point3D& p) const;
88+
6089
// Apply transform to this Rect
6190
void apply(Rect& r) const;
6291

92+
// Apply transform to this Cuboid
93+
void apply(Cuboid& c) const;
94+
6395
// Apply transform to this polygon
6496
void apply(Polygon& p) const;
6597

@@ -76,7 +108,7 @@ class dbTransform
76108
void invert();
77109

78110
dbOrientType getOrient() const { return _orient; }
79-
Point getOffset() const { return _offset; }
111+
Point getOffset() const { return Point(_offset.x(), _offset.y()); }
80112

81113
friend dbOStream& operator<<(dbOStream& stream, const dbTransform& t);
82114
friend dbIStream& operator>>(dbIStream& stream, dbTransform& t);

src/odb/include/odb/geom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ class Cuboid
217217
int yhi_ = 0;
218218
int zhi_ = 0;
219219
};
220+
std::ostream& operator<<(std::ostream& os, const Cuboid& cIn);
220221

221222
/*
222223
an Oct represents a 45-degree routing segment as 2 connected octagons

src/odb/src/3dblox/3dblox.cpp

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,14 @@ void ThreeDBlox::writeDbx(const std::string& dbx_file, odb::dbChip* chip)
185185

186186
void ThreeDBlox::calculateSize(dbChip* chip)
187187
{
188-
Rect box;
189-
box.mergeInit();
188+
Cuboid cuboid;
189+
cuboid.mergeInit();
190190
for (auto inst : chip->getChipInsts()) {
191-
box.merge(inst->getBBox());
191+
cuboid.merge(inst->getCuboid());
192192
}
193-
chip->setWidth(box.dx());
194-
chip->setHeight(box.dy());
193+
chip->setWidth(cuboid.dx());
194+
chip->setHeight(cuboid.dy());
195+
chip->setThickness(cuboid.dz());
195196
}
196197

197198
void ThreeDBlox::readHeaderIncludes(const std::vector<std::string>& includes)
@@ -295,30 +296,46 @@ void ThreeDBlox::createChiplet(const ChipletDef& chiplet)
295296
chip,
296297
/*issue_callback*/ false);
297298
}
298-
chip->setWidth(chiplet.design_width * db_->getDbuPerMicron());
299-
chip->setHeight(chiplet.design_height * db_->getDbuPerMicron());
300-
chip->setThickness(chiplet.thickness * db_->getDbuPerMicron());
301-
chip->setShrink(chiplet.shrink);
299+
if (chiplet.design_width != -1.0) {
300+
chip->setWidth(chiplet.design_width * db_->getDbuPerMicron());
301+
}
302+
if (chiplet.design_height != -1.0) {
303+
chip->setHeight(chiplet.design_height * db_->getDbuPerMicron());
304+
}
305+
if (chiplet.thickness != -1.0) {
306+
chip->setThickness(chiplet.thickness * db_->getDbuPerMicron());
307+
}
308+
if (chiplet.shrink != -1.0) {
309+
chip->setShrink(chiplet.shrink);
310+
}
302311
chip->setTsv(chiplet.tsv);
303312

304-
chip->setScribeLineEast(chiplet.scribe_line_right * db_->getDbuPerMicron());
305-
chip->setScribeLineWest(chiplet.scribe_line_left * db_->getDbuPerMicron());
306-
chip->setScribeLineNorth(chiplet.scribe_line_top * db_->getDbuPerMicron());
307-
chip->setScribeLineSouth(chiplet.scribe_line_bottom * db_->getDbuPerMicron());
308-
309-
chip->setSealRingEast(chiplet.seal_ring_right * db_->getDbuPerMicron());
310-
chip->setSealRingWest(chiplet.seal_ring_left * db_->getDbuPerMicron());
311-
chip->setSealRingNorth(chiplet.seal_ring_top * db_->getDbuPerMicron());
312-
chip->setSealRingSouth(chiplet.seal_ring_bottom * db_->getDbuPerMicron());
313+
if (chiplet.scribe_line_right != -1.0) {
314+
chip->setScribeLineEast(chiplet.scribe_line_right * db_->getDbuPerMicron());
315+
chip->setScribeLineWest(chiplet.scribe_line_left * db_->getDbuPerMicron());
316+
chip->setScribeLineNorth(chiplet.scribe_line_top * db_->getDbuPerMicron());
317+
chip->setScribeLineSouth(chiplet.scribe_line_bottom
318+
* db_->getDbuPerMicron());
319+
}
320+
if (chiplet.seal_ring_right != -1.0) {
321+
chip->setSealRingEast(chiplet.seal_ring_right * db_->getDbuPerMicron());
322+
chip->setSealRingWest(chiplet.seal_ring_left * db_->getDbuPerMicron());
323+
chip->setSealRingNorth(chiplet.seal_ring_top * db_->getDbuPerMicron());
324+
chip->setSealRingSouth(chiplet.seal_ring_bottom * db_->getDbuPerMicron());
325+
}
313326

314327
chip->setOffset(Point(chiplet.offset.x * db_->getDbuPerMicron(),
315328
chiplet.offset.y * db_->getDbuPerMicron()));
316329
if (chip->getChipType() != dbChip::ChipType::HIER
317330
&& chip->getBlock() == nullptr) {
318331
// blackbox stage, create block
319332
auto block = odb::dbBlock::create(chip, chiplet.name.c_str());
320-
block->setDieArea(Rect(0, 0, chip->getWidth(), chip->getHeight()));
321-
block->setCoreArea(Rect(0, 0, chip->getWidth(), chip->getHeight()));
333+
const int x_min = chip->getScribeLineWest() + chip->getSealRingWest();
334+
const int y_min = chip->getScribeLineSouth() + chip->getSealRingSouth();
335+
const int x_max = x_min + chip->getWidth();
336+
const int y_max = y_min + chip->getHeight();
337+
block->setDieArea(Rect(x_min, y_min, x_max, y_max));
338+
block->setCoreArea(Rect(x_min, y_min, x_max, y_max));
322339
}
323340
for (const auto& [_, region] : chiplet.regions) {
324341
createRegion(region, chip);
@@ -398,8 +415,11 @@ void ThreeDBlox::createBump(const BumpMapEntry& entry,
398415
auto bump = dbChipBump::create(chip_region, inst);
399416
Rect bbox;
400417
inst->getMaster()->getPlacementBoundary(bbox);
401-
inst->setOrigin((entry.x * db_->getDbuPerMicron()) - bbox.xCenter(),
402-
(entry.y * db_->getDbuPerMicron()) - bbox.yCenter());
418+
int x = (entry.x * db_->getDbuPerMicron()) - bbox.xCenter()
419+
+ chip->getOffset().x();
420+
int y = (entry.y * db_->getDbuPerMicron()) - bbox.yCenter()
421+
+ chip->getOffset().y();
422+
inst->setOrigin(x, y);
403423
inst->setPlacementStatus(dbPlacementStatus::FIRM);
404424
if (entry.net_name != "-") {
405425
auto net = block->findNet(entry.net_name.c_str());
@@ -447,9 +467,6 @@ void ThreeDBlox::createChipInst(const ChipletInst& chip_inst)
447467
chip_inst.name);
448468
}
449469
dbChipInst* inst = dbChipInst::create(db_->getChip(), chip, chip_inst.name);
450-
inst->setLoc(Point3D(chip_inst.loc.x * db_->getDbuPerMicron(),
451-
chip_inst.loc.y * db_->getDbuPerMicron(),
452-
chip_inst.z * db_->getDbuPerMicron()));
453470
auto orient_str = chip_inst.orient;
454471
if (dup_orient_map.find(orient_str) != dup_orient_map.end()) {
455472
orient_str = dup_orient_map[orient_str];
@@ -463,6 +480,9 @@ void ThreeDBlox::createChipInst(const ChipletInst& chip_inst)
463480
chip_inst.name);
464481
}
465482
inst->setOrient(orient.value());
483+
inst->setLoc(Point3D(chip_inst.loc.x * db_->getDbuPerMicron(),
484+
chip_inst.loc.y * db_->getDbuPerMicron(),
485+
chip_inst.z * db_->getDbuPerMicron()));
466486
}
467487
std::vector<std::string> splitPath(const std::string& path)
468488
{

0 commit comments

Comments
 (0)