|
135 | 135 |
|
136 | 136 | namespace odb { |
137 | 137 |
|
| 138 | +class dbLogicalInstItr : public dbIterator |
| 139 | +{ |
| 140 | + public: |
| 141 | + dbLogicalInstItr(dbTable<_dbInst>* inst_tbl) : _inst_tbl(inst_tbl) {} |
| 142 | + |
| 143 | + bool reversible() override { return false; } |
| 144 | + bool orderReversed() override { return false; } |
| 145 | + void reverse(dbObject* /*parent*/) override {} |
| 146 | + uint sequential() override { return 0; } |
| 147 | + |
| 148 | + uint size(dbObject* parent) override |
| 149 | + { |
| 150 | + uint count = 0; |
| 151 | + for (uint id = begin(parent); id != end(parent); id = next(id)) { |
| 152 | + count++; |
| 153 | + } |
| 154 | + return count; |
| 155 | + } |
| 156 | + |
| 157 | + uint begin(dbObject* parent) override |
| 158 | + { |
| 159 | + return findNext(_inst_tbl->begin(parent)); |
| 160 | + } |
| 161 | + |
| 162 | + uint end(dbObject* parent) override { return _inst_tbl->end(parent); } |
| 163 | + |
| 164 | + uint next(uint id, ...) override { return findNext(_inst_tbl->next(id)); } |
| 165 | + |
| 166 | + dbObject* getObject(uint id, ...) override |
| 167 | + { |
| 168 | + return _inst_tbl->getObject(id); |
| 169 | + } |
| 170 | + |
| 171 | + private: |
| 172 | + uint findNext(uint start_id) |
| 173 | + { |
| 174 | + uint cur_id = start_id; |
| 175 | + const uint end_id = _inst_tbl->end(nullptr); |
| 176 | + |
| 177 | + while (cur_id != end_id) { |
| 178 | + if (_inst_tbl->validId(cur_id)) { |
| 179 | + _dbInst* inst_impl = (_dbInst*) _inst_tbl->getPtr(cur_id); |
| 180 | + dbInst* inst = reinterpret_cast<dbInst*>(inst_impl); |
| 181 | + if (inst->isPhysicalOnly() == false) { |
| 182 | + return cur_id; |
| 183 | + } |
| 184 | + } |
| 185 | + cur_id = _inst_tbl->next(cur_id); |
| 186 | + } |
| 187 | + |
| 188 | + return end_id; |
| 189 | + } |
| 190 | + |
| 191 | + private: |
| 192 | + dbTable<_dbInst>* _inst_tbl; |
| 193 | +}; |
| 194 | + |
138 | 195 | struct OldTransform |
139 | 196 | { |
140 | 197 | int _orient; |
@@ -415,6 +472,9 @@ _dbBlock::_dbBlock(_dbDatabase* db) |
415 | 472 |
|
416 | 473 | _prop_itr = new dbPropertyItr(_prop_tbl); |
417 | 474 |
|
| 475 | + _logical_inst_itr |
| 476 | + = new dbLogicalInstItr((dbTable<_dbInst>*) getObjectTable(dbInstObj)); |
| 477 | + |
418 | 478 | _num_ext_dbs = 1; |
419 | 479 | _searchDb = nullptr; |
420 | 480 | _extmi = nullptr; |
@@ -506,6 +566,7 @@ _dbBlock::~_dbBlock() |
506 | 566 | delete _group_ground_net_itr; |
507 | 567 | delete _bpin_itr; |
508 | 568 | delete _prop_itr; |
| 569 | + delete _logical_inst_itr; |
509 | 570 | delete _dft_tbl; |
510 | 571 | delete _marker_categories_tbl; |
511 | 572 |
|
@@ -1797,6 +1858,12 @@ dbSet<dbInst> dbBlock::getInsts() |
1797 | 1858 | return dbSet<dbInst>(block, block->_inst_tbl); |
1798 | 1859 | } |
1799 | 1860 |
|
| 1861 | +dbSet<dbInst> dbBlock::getLogicalInsts() |
| 1862 | +{ |
| 1863 | + _dbBlock* block = (_dbBlock*) this; |
| 1864 | + return dbSet<dbInst>(block, block->_logical_inst_itr); |
| 1865 | +} |
| 1866 | + |
1800 | 1867 | dbSet<dbModule> dbBlock::getModules() |
1801 | 1868 | { |
1802 | 1869 | _dbBlock* block = (_dbBlock*) this; |
|
0 commit comments