Skip to content

Commit e2c0d8c

Browse files
committed
odb: allow empty bottom region for dbChipConn
Signed-off-by: osamahammad21 <[email protected]>
1 parent d987427 commit e2c0d8c

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

src/odb/src/db/dbChipConn.cpp

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ dbChipRegionInst* dbChipConn::getBottomRegion() const
130130
{
131131
_dbChipConn* obj = (_dbChipConn*) this;
132132
_dbDatabase* _db = (_dbDatabase*) obj->getOwner();
133+
if (!obj->bottom_region_.isValid()) {
134+
return nullptr;
135+
}
133136
return (dbChipRegionInst*) _db->chip_region_inst_tbl_->getPtr(
134137
obj->bottom_region_);
135138
}
@@ -191,34 +194,55 @@ dbChipConn* dbChipConn::create(
191194
const std::vector<dbChipInst*>& bottom_region_path,
192195
dbChipRegionInst* bottom_region)
193196
{
194-
_dbDatabase* _db = (_dbDatabase*) top_region->getImpl()->getOwner();
195-
if (parent_chip == nullptr || top_region_path.empty()
196-
|| bottom_region_path.empty() || top_region == nullptr
197-
|| bottom_region == nullptr) {
197+
if (parent_chip == nullptr) {
198198
return nullptr;
199199
}
200-
if (top_region->getChipInst() != top_region_path.back()) {
200+
_dbDatabase* _db = (_dbDatabase*) parent_chip->getImpl()->getOwner();
201+
if (top_region == nullptr || top_region_path.empty()) {
201202
_db->getLogger()->error(utl::ODB,
202203
511,
203-
"Cannot create chip connection. Top region path "
204-
"does not match top region");
204+
"Cannot create chip connection {}. Top region is "
205+
"not specified correctly",
206+
name);
205207
}
206-
if (bottom_region->getChipInst() != bottom_region_path.back()) {
208+
if (top_region->getChipInst() != top_region_path.back()) {
207209
_db->getLogger()->error(utl::ODB,
208-
512,
209-
"Cannot create chip connection. Bottom region path "
210-
"does not match bottom region");
210+
515,
211+
"Cannot create chip connection {}. Top region path "
212+
"does not match top region",
213+
name);
214+
}
215+
if (bottom_region != nullptr && bottom_region_path.empty()) {
216+
_db->getLogger()->error(
217+
utl::ODB,
218+
517,
219+
"Cannot create chip connection {}. Bottom region path "
220+
"is empty for non-empty bottom region",
221+
name);
222+
}
223+
if (bottom_region != nullptr
224+
&& bottom_region->getChipInst() != bottom_region_path.back()) {
225+
_db->getLogger()->error(
226+
utl::ODB,
227+
518,
228+
"Cannot create chip connection {}. Bottom region path "
229+
"does not match bottom region",
230+
name);
211231
}
212232
_dbChipConn* obj = (_dbChipConn*) _db->chip_conn_tbl_->create();
213233
_dbChip* chip = (_dbChip*) parent_chip;
214234
obj->name_ = name;
215235
obj->thickness_ = 0;
216236
obj->chip_ = chip->getOID();
217237
obj->top_region_ = top_region->getImpl()->getOID();
218-
obj->bottom_region_ = bottom_region->getImpl()->getOID();
238+
if (bottom_region != nullptr) {
239+
obj->bottom_region_ = bottom_region->getImpl()->getOID();
240+
}
219241
obj->top_region_path_ = extractChipInstsPath(parent_chip, top_region_path);
220-
obj->bottom_region_path_
221-
= extractChipInstsPath(parent_chip, bottom_region_path);
242+
if (bottom_region != nullptr) {
243+
obj->bottom_region_path_
244+
= extractChipInstsPath(parent_chip, bottom_region_path);
245+
}
222246

223247
obj->chip_conn_next_ = chip->conns_;
224248
chip->conns_ = obj->getOID();

0 commit comments

Comments
 (0)