Skip to content

Commit 11aa8b6

Browse files
committed
odb: Refactored based on review feedback
Signed-off-by: Jaehyun Kim <[email protected]>
1 parent 6108bc5 commit 11aa8b6

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

src/odb/include/odb/db.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,13 +1844,7 @@ class dbNet : public dbObject
18441844
///
18451845
/// Set the driving term id assigned of this net.
18461846
///
1847-
void setDrivingITerm(int id);
1848-
1849-
///
1850-
/// Returns driving term id assigned of this net. -1 if not set, 0 if non
1851-
/// existent
1852-
///
1853-
int getDrivingITermId() const;
1847+
void setDrivingITerm(const dbITerm* iterm);
18541848

18551849
///
18561850
/// Returns the driving dbITerm* of this net.

src/odb/src/db/dbBlock.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3330,11 +3330,11 @@ void dbBlock::setDrivingItermsforNets()
33303330
continue;
33313331
}
33323332

3333-
net->setDrivingITerm(0);
3333+
net->setDrivingITerm(nullptr);
33343334

33353335
for (dbITerm* tr : net->getITerms()) {
33363336
if (tr->getIoType() == dbIoType::OUTPUT) {
3337-
net->setDrivingITerm(tr->getId());
3337+
net->setDrivingITerm(tr);
33383338
break;
33393339
}
33403340
}

src/odb/src/db/dbInsertBuffer.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ dbInst* dbInsertBuffer::insertBufferBeforeLoads(
185185
if (buffer_inst == nullptr) {
186186
logger_->error(
187187
utl::ODB, 1205, "BeforeLoads: Failed to create buffer instance.");
188-
return nullptr;
189188
}
190189

191190
// 3. Create Buffer Net
@@ -284,8 +283,8 @@ dbInst* dbInsertBuffer::checkAndCreateBuffer()
284283
uniquify_,
285284
target_module_);
286285

287-
buf_input_iterm_ = buffer_inst->findITerm(input_mterm->getConstName());
288-
buf_output_iterm_ = buffer_inst->findITerm(output_mterm->getConstName());
286+
buf_input_iterm_ = buffer_inst->getITerm(input_mterm);
287+
buf_output_iterm_ = buffer_inst->getITerm(output_mterm);
289288

290289
return buffer_inst;
291290
}
@@ -309,15 +308,19 @@ void dbInsertBuffer::placeNewBuffer(dbInst* buffer_inst,
309308
{
310309
int x = 0;
311310
int y = 0;
311+
bool placed = false;
312312
if (loc) {
313313
x = loc->getX();
314314
y = loc->getY();
315+
placed = true;
315316
} else {
316-
getPinLocation(term, x, y);
317+
placed = getPinLocation(term, x, y);
317318
}
318319

319-
buffer_inst->setLocation(x, y);
320-
buffer_inst->setPlacementStatus(dbPlacementStatus::PLACED);
320+
if (placed) {
321+
buffer_inst->setLocation(x, y);
322+
buffer_inst->setPlacementStatus(dbPlacementStatus::PLACED);
323+
}
321324
}
322325

323326
void dbInsertBuffer::rewireBufferSimple(bool insertBefore,

src/odb/src/db/dbNet.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -534,16 +534,10 @@ void dbNet::setCcAdjustOrder(uint32_t order)
534534
net->cc_adjust_order_ = order;
535535
}
536536

537-
void dbNet::setDrivingITerm(int id)
537+
void dbNet::setDrivingITerm(const dbITerm* iterm)
538538
{
539539
_dbNet* net = (_dbNet*) this;
540-
net->driving_iterm_ = id;
541-
}
542-
543-
int dbNet::getDrivingITermId() const
544-
{
545-
_dbNet* net = (_dbNet*) this;
546-
return net->driving_iterm_;
540+
net->driving_iterm_ = (iterm) ? iterm->getId() : 0;
547541
}
548542

549543
dbITerm* dbNet::getDrivingITerm() const
@@ -1246,9 +1240,8 @@ dbObject* dbNet::getFirstDriverTerm() const
12461240

12471241
dbITerm* dbNet::getFirstOutput() const
12481242
{
1249-
if (getDrivingITermId() > 0) {
1250-
return dbITerm::getITerm((dbBlock*) getImpl()->getOwner(),
1251-
getDrivingITermId());
1243+
if (dbITerm* drvrIterm = getDrivingITerm()) {
1244+
return drvrIterm;
12521245
}
12531246

12541247
for (dbITerm* tr : getITerms()) {

0 commit comments

Comments
 (0)