Skip to content

Commit ca1ac3c

Browse files
committed
Minor changes (made two APIs private, revised comments).
Signed-off-by: Jaehyun Kim <[email protected]>
1 parent 8873ed2 commit ca1ac3c

File tree

4 files changed

+34
-35
lines changed

4 files changed

+34
-35
lines changed

src/dbSta/src/dbNetwork.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,8 +2578,7 @@ Net* dbNetwork::makeNet(const char* base_name, Instance* parent)
25782578
return makeNet(base_name, parent, odb::dbNameUniquifyType::ALWAYS);
25792579
}
25802580

2581-
// If uniquify is IF_NEEDED, unique postfix will be added only when
2582-
// necessary.
2581+
// If uniquify is IF_NEEDED, unique suffix will be added when necessary.
25832582
Net* dbNetwork::makeNet(const char* base_name,
25842583
Instance* parent,
25852584
const odb::dbNameUniquifyType& uniquify)

src/odb/include/odb/db.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,9 +1263,9 @@ class dbBlock : public dbObject
12631263
/// Make a unique net/instance name
12641264
/// If parent is nullptr, the net name will be unique in top module.
12651265
/// If base_name is nullptr, the default net name will be used.
1266-
/// If uniquify is IF_NEEDED*, unique postfix will be added only when
1267-
/// If uniquify is *_WITH_UNDERSCORE, underscore will be added before adding
1268-
/// unique postfix
1266+
/// If uniquify is IF_NEEDED*, unique suffix will be added when necessary.
1267+
/// If uniquify is *_WITH_UNDERSCORE, an underscore will be added before the
1268+
/// unique suffix.
12691269
///
12701270
std::string makeNewNetName(dbModInst* parent = nullptr,
12711271
const char* base_name = "net",
@@ -1366,14 +1366,6 @@ class dbBlock : public dbObject
13661366
//
13671367
void debugPrintContent(std::ostream& str_db);
13681368
void debugPrintContent() { debugPrintContent(std::cout); }
1369-
1370-
private:
1371-
void ComputeBBox();
1372-
std::string makeNewName(dbModInst* parent,
1373-
const char* base_name,
1374-
const dbNameUniquifyType& uniquify,
1375-
uint& unique_index,
1376-
const std::function<bool(const char*)>& exists);
13771369
};
13781370

13791371
///////////////////////////////////////////////////////////////////////////////

src/odb/src/db/dbBlock.cpp

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,27 +1468,26 @@ dbBox* dbBlock::getBBox()
14681468
_dbBlock* block = (_dbBlock*) this;
14691469

14701470
if (block->_flags._valid_bbox == 0) {
1471-
ComputeBBox();
1471+
block->ComputeBBox();
14721472
}
14731473

14741474
_dbBox* bbox = block->_box_tbl->getPtr(block->_bbox);
14751475
return (dbBox*) bbox;
14761476
}
14771477

1478-
void dbBlock::ComputeBBox()
1478+
void _dbBlock::ComputeBBox()
14791479
{
1480-
_dbBlock* block = (_dbBlock*) this;
1481-
_dbBox* bbox = block->_box_tbl->getPtr(block->_bbox);
1480+
_dbBox* bbox = _box_tbl->getPtr(_bbox);
14821481
bbox->_shape._rect.reset(INT_MAX, INT_MAX, INT_MIN, INT_MIN);
14831482

1484-
for (dbInst* inst : getInsts()) {
1483+
for (dbInst* inst : dbSet<dbInst>(this, _inst_tbl)) {
14851484
if (inst->isPlaced()) {
14861485
_dbBox* box = (_dbBox*) inst->getBBox();
14871486
bbox->_shape._rect.merge(box->_shape._rect);
14881487
}
14891488
}
14901489

1491-
for (dbBTerm* bterm : getBTerms()) {
1490+
for (dbBTerm* bterm : dbSet<dbBTerm>(this, _bterm_tbl)) {
14921491
for (dbBPin* bp : bterm->getBPins()) {
14931492
if (bp->getPlacementStatus().isPlaced()) {
14941493
for (dbBox* box : bp->getBoxes()) {
@@ -1499,17 +1498,17 @@ void dbBlock::ComputeBBox()
14991498
}
15001499
}
15011500

1502-
for (dbObstruction* obs : getObstructions()) {
1501+
for (dbObstruction* obs : dbSet<dbObstruction>(this, _obstruction_tbl)) {
15031502
_dbBox* box = (_dbBox*) obs->getBBox();
15041503
bbox->_shape._rect.merge(box->_shape._rect);
15051504
}
15061505

1507-
for (dbSBox* box : dbSet<dbSBox>(block, block->_sbox_tbl)) {
1506+
for (dbSBox* box : dbSet<dbSBox>(this, _sbox_tbl)) {
15081507
Rect rect = box->getBox();
15091508
bbox->_shape._rect.merge(rect);
15101509
}
15111510

1512-
for (dbWire* wire : dbSet<dbWire>(block, block->_wire_tbl)) {
1511+
for (dbWire* wire : dbSet<dbWire>(this, _wire_tbl)) {
15131512
const auto opt_bbox = wire->getBBox();
15141513
if (opt_bbox) {
15151514
bbox->_shape._rect.merge(opt_bbox.value());
@@ -1520,7 +1519,7 @@ void dbBlock::ComputeBBox()
15201519
bbox->_shape._rect.reset(0, 0, 0, 0);
15211520
}
15221521

1523-
block->_flags._valid_bbox = 1;
1522+
_flags._valid_bbox = 1;
15241523
}
15251524

15261525
dbDatabase* dbBlock::getDataBase()
@@ -3694,24 +3693,27 @@ void _dbBlock::ensureConstraintRegion(const Direction2D& edge,
36943693
}
36953694
}
36963695

3697-
std::string dbBlock::makeNewName(dbModInst* parent,
3698-
const char* base_name,
3699-
const dbNameUniquifyType& uniquify,
3700-
uint& unique_index,
3701-
const std::function<bool(const char*)>& exists)
3696+
std::string _dbBlock::makeNewName(
3697+
dbModInst* parent,
3698+
const char* base_name,
3699+
const dbNameUniquifyType& uniquify,
3700+
uint& unique_index,
3701+
const std::function<bool(const char*)>& exists)
37023702
{
3703+
dbBlock* block = (dbBlock*) this;
3704+
37033705
// Decide hierarchical name without unique index
37043706
fmt::memory_buffer buf;
37053707
if (parent) {
37063708
fmt::format_to(std::back_inserter(buf),
37073709
"{}{}",
37083710
parent->getHierarchicalName(),
3709-
getHierarchyDelimiter());
3711+
block->getHierarchyDelimiter());
37103712
}
37113713
buf.append(base_name, base_name + std::strlen(base_name));
37123714
buf.push_back('\0'); // Null-terminate for find* functions
37133715

3714-
// If uniquify is IF_NEEDED*, check for uniqueness before adding a postfix.
3716+
// If uniquify is IF_NEEDED*, check for uniqueness before adding a suffix.
37153717
bool uniquify_if_needed
37163718
= (dbNameUniquifyType::IF_NEEDED == uniquify)
37173719
|| (dbNameUniquifyType::IF_NEEDED_WITH_UNDERSCORE == uniquify);
@@ -3749,16 +3751,16 @@ std::string dbBlock::makeNewName(dbModInst* parent,
37493751
// Currently all nets are scoped within a dbBlock.
37503752
//
37513753

3752-
// If uniquify is IF_NEEDED, unique postfix will be added only when
3753-
// necessary. This is added to cover the existing multiple use cases of making a
3754-
// new net name w/ and w/o unique postfix.
3754+
// If uniquify is IF_NEEDED, unique suffix will be added when necessary.
3755+
// This is added to cover the existing multiple use cases of making a
3756+
// new net name w/ and w/o unique suffix.
37553757
std::string dbBlock::makeNewNetName(dbModInst* parent,
37563758
const char* base_name,
37573759
const dbNameUniquifyType& uniquify)
37583760
{
37593761
_dbBlock* block = reinterpret_cast<_dbBlock*>(this);
37603762
auto exists = [this](const char* name) { return findNet(name) != nullptr; };
3761-
return makeNewName(
3763+
return block->makeNewName(
37623764
parent, base_name, uniquify, block->_unique_net_index, exists);
37633765
}
37643766

@@ -3777,7 +3779,7 @@ std::string dbBlock::makeNewInstName(dbModInst* parent,
37773779
auto exists = [this](const char* name) {
37783780
return findInst(name) != nullptr || findModInst(name) != nullptr;
37793781
};
3780-
return makeNewName(
3782+
return block->makeNewName(
37813783
parent, base_name, uniquify, block->_unique_inst_index, exists);
37823784
}
37833785

src/odb/src/db/dbBlock.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@ class _dbBlock : public _dbObject
321321
void collectMemInfo(MemInfo& info);
322322
void clearSystemBlockagesAndObstructions();
323323
void ensureConstraintRegion(const Direction2D& edge, int& begin, int& end);
324+
void ComputeBBox();
325+
std::string makeNewName(dbModInst* parent,
326+
const char* base_name,
327+
const dbNameUniquifyType& uniquify,
328+
uint& unique_index,
329+
const std::function<bool(const char*)>& exists);
324330
};
325331

326332
dbOStream& operator<<(dbOStream& stream, const _dbBlock& block);

0 commit comments

Comments
 (0)