Skip to content

Commit cbd6ded

Browse files
committed
odb: fix bmap reader to use bterm instead of net since net can have multiple bterms, but bterm can only have one net
Signed-off-by: Peter Gadfort <[email protected]>
1 parent 4a6119c commit cbd6ded

File tree

2 files changed

+37
-31
lines changed

2 files changed

+37
-31
lines changed

src/odb/include/odb/3dblox.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class dbChipInst;
2626
class BumpMapEntry;
2727
class dbChipRegion;
2828
class dbBlock;
29+
class dbBTerm;
2930
class dbInst;
3031
class dbTech;
3132
class dbLib;
@@ -49,7 +50,8 @@ class ThreeDBlox
4950
void createChipInst(const ChipletInst& chip_inst);
5051
void createConnection(const Connection& connection);
5152
void createBump(const BumpMapEntry& entry, dbChipRegion* chip_region);
52-
dbInst* createBump(const BumpMapEntry& entry, dbBlock* block);
53+
std::pair<dbInst*, dbBTerm*> createBump(const BumpMapEntry& entry,
54+
dbBlock* block);
5355
dbChipRegionInst* resolvePath(const std::string& path,
5456
std::vector<dbChipInst*>& path_insts);
5557
void readHeaderIncludes(const std::vector<std::string>& includes);

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

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ void ThreeDBlox::readBMap(const std::string& bmap_file)
581581

582582
BmapParser parser(logger_);
583583
BumpMapData data = parser.parseFile(bmap_file);
584-
std::vector<odb::dbInst*> bumps;
584+
std::vector<std::pair<odb::dbInst*, odb::dbBTerm*>> bumps;
585585
bumps.reserve(data.entries.size());
586586
for (const auto& entry : data.entries) {
587587
bumps.push_back(createBump(entry, block));
@@ -595,7 +595,7 @@ void ThreeDBlox::readBMap(const std::string& bmap_file)
595595

596596
// Populate where the bpins should be made
597597
std::map<odb::dbMaster*, BPinInfo> bpininfo;
598-
for (dbInst* inst : bumps) {
598+
for (const auto& [inst, bterm] : bumps) {
599599
dbMaster* master = inst->getMaster();
600600
if (bpininfo.find(master) != bpininfo.end()) {
601601
continue;
@@ -645,7 +645,11 @@ void ThreeDBlox::readBMap(const std::string& bmap_file)
645645
}
646646

647647
// create bpins
648-
for (dbInst* inst : bumps) {
648+
for (const auto& [inst, bterm] : bumps) {
649+
if (bterm == nullptr) {
650+
continue;
651+
}
652+
649653
auto masterbpin = bpininfo.find(inst->getMaster());
650654
if (masterbpin == bpininfo.end()) {
651655
continue;
@@ -654,28 +658,22 @@ void ThreeDBlox::readBMap(const std::string& bmap_file)
654658
const BPinInfo& pin_info = masterbpin->second;
655659

656660
const dbTransform xform = inst->getTransform();
657-
for (dbITerm* iterm : inst->getITerms()) {
658-
dbNet* net = iterm->getNet();
659-
if (net == nullptr) {
660-
continue;
661-
}
662-
dbBTerm* bterm = net->get1stBTerm();
663-
dbBPin* pin = dbBPin::create(bterm);
664-
Rect shape = pin_info.rect;
665-
xform.apply(shape);
666-
dbBox::create(pin,
667-
pin_info.layer,
668-
shape.xMin(),
669-
shape.yMin(),
670-
shape.xMax(),
671-
shape.yMax());
672-
pin->setPlacementStatus(odb::dbPlacementStatus::FIRM);
673-
break;
674-
}
661+
dbBPin* pin = dbBPin::create(bterm);
662+
Rect shape = pin_info.rect;
663+
xform.apply(shape);
664+
dbBox::create(pin,
665+
pin_info.layer,
666+
shape.xMin(),
667+
shape.yMin(),
668+
shape.xMax(),
669+
shape.yMax());
670+
pin->setPlacementStatus(odb::dbPlacementStatus::FIRM);
675671
}
676672
}
677673

678-
dbInst* ThreeDBlox::createBump(const BumpMapEntry& entry, dbBlock* block)
674+
std::pair<dbInst*, odb::dbBTerm*> ThreeDBlox::createBump(
675+
const BumpMapEntry& entry,
676+
dbBlock* block)
679677
{
680678
const int dbus = db_->getDbuPerMicron();
681679
dbInst* inst = block->findInst(entry.bump_inst_name.c_str());
@@ -693,22 +691,28 @@ dbInst* ThreeDBlox::createBump(const BumpMapEntry& entry, dbBlock* block)
693691
inst->setOrigin(entry.x * dbus, entry.y * dbus);
694692
inst->setPlacementStatus(dbPlacementStatus::FIRM);
695693

696-
// Net entry doesn't make sense
697-
if (entry.net_name != "-") {
698-
dbNet* net = block->findNet(entry.net_name.c_str());
699-
if (net == nullptr) {
694+
dbNet* net = nullptr;
695+
dbBTerm* term = nullptr;
696+
697+
// Find bterm
698+
if (entry.port_name != "-") {
699+
term = block->findBTerm(entry.port_name.c_str());
700+
if (term == nullptr) {
700701
logger_->error(utl::ODB,
701702
539,
702-
"3DBV Parser Error: Bump net {} not found",
703-
entry.net_name);
703+
"3DBV Parser Error: Bump port {} not found",
704+
entry.port_name);
704705
}
706+
net = term->getNet();
707+
}
708+
709+
if (net != nullptr) {
705710
for (odb::dbITerm* iterm : inst->getITerms()) {
706711
iterm->connect(net);
707712
}
708713
}
709-
// Port already on the net, so skip
710714

711-
return inst;
715+
return {inst, term};
712716
}
713717

714718
} // namespace odb

0 commit comments

Comments
 (0)