Skip to content

Commit 900cc9f

Browse files
authored
Merge pull request #9002 from LucasYuki/gui-drc
GUI: show 3DIC Markers
2 parents 9fe29e4 + d582da5 commit 900cc9f

File tree

13 files changed

+192
-92
lines changed

13 files changed

+192
-92
lines changed

src/gui/src/drcWidget.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ DRCWidget::DRCWidget(QWidget* parent)
5050
logger_(nullptr),
5151
view_(new ObjectTree(this)),
5252
model_(new DRCItemModel(this)),
53-
block_(nullptr),
53+
chip_(nullptr),
5454
categories_(new QComboBox(this)),
5555
load_(new QPushButton("Load...", this)),
5656
renderer_(std::make_unique<DRCRenderer>())
@@ -119,7 +119,7 @@ void DRCWidget::setLogger(utl::Logger* logger)
119119

120120
void DRCWidget::selectReport()
121121
{
122-
if (!block_) {
122+
if (!chip_) {
123123
logger_->error(utl::GUI, 104, "No database has been loaded");
124124
}
125125

@@ -227,17 +227,19 @@ void DRCWidget::doubleClicked(const QModelIndex& index)
227227
showMarker(index, true);
228228
}
229229

230-
void DRCWidget::setBlock(odb::dbBlock* block)
230+
void DRCWidget::setChip(odb::dbChip* chip)
231231
{
232-
block_ = block;
232+
chip_ = chip;
233233

234-
addOwner(block_);
234+
addOwner(chip_);
235235
updateMarkerGroups();
236236
}
237237

238238
void DRCWidget::showEvent(QShowEvent* event)
239239
{
240-
addOwner(block_);
240+
if (chip_) {
241+
addOwner(chip_);
242+
}
241243

242244
updateMarkerGroups();
243245
toggleRenderer(true);
@@ -267,7 +269,7 @@ void DRCWidget::toggleRenderer(bool visible)
267269
void DRCWidget::updateModel()
268270
{
269271
const std::string name = categories_->currentText().toStdString();
270-
odb::dbMarkerCategory* category = block_->findMarkerCategory(name.c_str());
272+
odb::dbMarkerCategory* category = chip_->findMarkerCategory(name.c_str());
271273

272274
model_->removeRows(0, model_->rowCount());
273275

@@ -385,13 +387,13 @@ void DRCWidget::loadReport(const QString& filename)
385387
odb::dbMarkerCategory* DRCWidget::loadTRReport(const QString& filename)
386388
{
387389
const std::string file = filename.toStdString();
388-
return odb::dbMarkerCategory::fromTR(block_, "DRC", file);
390+
return odb::dbMarkerCategory::fromTR(chip_, "DRC", file);
389391
}
390392

391393
odb::dbMarkerCategory* DRCWidget::loadJSONReport(const QString& filename)
392394
{
393395
const std::string file = filename.toStdString();
394-
const auto categories = odb::dbMarkerCategory::fromJSON(block_, file);
396+
const auto categories = odb::dbMarkerCategory::fromJSON(chip_, file);
395397

396398
if (categories.size() > 1) {
397399
logger_->warn(utl::GUI,
@@ -414,7 +416,7 @@ void DRCWidget::updateMarkerGroups()
414416

415417
void DRCWidget::updateMarkerGroupsWithIgnore(odb::dbMarkerCategory* ignore)
416418
{
417-
if (block_ == nullptr) {
419+
if (chip_ == nullptr) {
418420
return;
419421
}
420422

@@ -425,7 +427,7 @@ void DRCWidget::updateMarkerGroupsWithIgnore(odb::dbMarkerCategory* ignore)
425427
categories_->clear();
426428

427429
categories_->addItem("");
428-
for (auto* category : block_->getMarkerCategories()) {
430+
for (auto* category : chip_->getMarkerCategories()) {
429431
if (ignore == category) {
430432
continue;
431433
}
@@ -452,7 +454,7 @@ void DRCWidget::inDbMarkerCategoryDestroy(odb::dbMarkerCategory* category)
452454
void DRCWidget::inDbMarkerCreate(odb::dbMarker* marker)
453455
{
454456
const std::string name = categories_->currentText().toStdString();
455-
odb::dbMarkerCategory* category = block_->findMarkerCategory(name.c_str());
457+
odb::dbMarkerCategory* category = chip_->findMarkerCategory(name.c_str());
456458

457459
if (marker->getCategory()->getTopCategory() == category) {
458460
updateModel();
@@ -462,7 +464,7 @@ void DRCWidget::inDbMarkerCreate(odb::dbMarker* marker)
462464
void DRCWidget::inDbMarkerDestroy(odb::dbMarker* marker)
463465
{
464466
const std::string name = categories_->currentText().toStdString();
465-
odb::dbMarkerCategory* category = block_->findMarkerCategory(name.c_str());
467+
odb::dbMarkerCategory* category = chip_->findMarkerCategory(name.c_str());
466468

467469
if (marker->getCategory()->getTopCategory() == category) {
468470
updateModel();

src/gui/src/drcWidget.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "gui/gui.h"
2020
#include "inspector.h"
2121
#include "odb/db.h"
22-
#include "odb/dbBlockCallBackObj.h"
22+
#include "odb/dbChipCallBackObj.h"
2323
#include "odb/geom.h"
2424

2525
namespace utl {
@@ -51,7 +51,7 @@ class DRCRenderer : public Renderer
5151
odb::dbMarkerCategory* category_;
5252
};
5353

54-
class DRCWidget : public QDockWidget, public odb::dbBlockCallBackObj
54+
class DRCWidget : public QDockWidget, public odb::dbChipCallBackObj
5555
{
5656
Q_OBJECT
5757

@@ -72,7 +72,7 @@ class DRCWidget : public QDockWidget, public odb::dbBlockCallBackObj
7272

7373
public slots:
7474
void loadReport(const QString& filename);
75-
void setBlock(odb::dbBlock* block);
75+
void setChip(odb::dbChip* chip);
7676
void clicked(const QModelIndex& index);
7777
void doubleClicked(const QModelIndex& index);
7878
void selectReport();
@@ -103,7 +103,7 @@ class DRCWidget : public QDockWidget, public odb::dbBlockCallBackObj
103103
ObjectTree* view_;
104104
DRCItemModel* model_;
105105

106-
odb::dbBlock* block_;
106+
odb::dbChip* chip_;
107107

108108
QComboBox* categories_;
109109
QPushButton* load_;

src/gui/src/mainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ MainWindow::MainWindow(bool load_settings, QWidget* parent)
362362
&MainWindow::reportSlackHistogramPaths);
363363

364364
connect(this, &MainWindow::blockLoaded, this, &MainWindow::setBlock);
365-
connect(this, &MainWindow::blockLoaded, drc_viewer_, &DRCWidget::setBlock);
365+
connect(this, &MainWindow::chipLoaded, drc_viewer_, &DRCWidget::setChip);
366366
connect(
367367
this, &MainWindow::blockLoaded, clock_viewer_, &ClockWidget::setBlock);
368368
connect(drc_viewer_,

src/odb/include/odb/db.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8215,15 +8215,15 @@ class dbMarkerCategory : public dbObject
82158215
void writeTR(const std::string& path) const;
82168216
void writeTR(std::ofstream& report) const;
82178217

8218-
static std::set<dbMarkerCategory*> fromJSON(dbBlock* block,
8218+
static std::set<dbMarkerCategory*> fromJSON(dbChip* chip,
82198219
const std::string& path);
8220-
static std::set<dbMarkerCategory*> fromJSON(dbBlock* block,
8220+
static std::set<dbMarkerCategory*> fromJSON(dbChip* chip,
82218221
const char* source,
82228222
std::ifstream& report);
8223-
static dbMarkerCategory* fromTR(dbBlock* block,
8223+
static dbMarkerCategory* fromTR(dbChip* chip,
82248224
const char* name,
82258225
const std::string& path);
8226-
static dbMarkerCategory* fromTR(dbBlock* block,
8226+
static dbMarkerCategory* fromTR(dbChip* chip,
82278227
const char* name,
82288228
const char* source,
82298229
std::ifstream& report);

src/odb/include/odb/dbBlockCallBackObj.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ class dbFill;
1818
class dbITerm;
1919
class dbInst;
2020
class dbIoType;
21-
class dbMarker;
22-
class dbMarkerCategory;
2321
class dbMaster;
2422
class dbModBTerm;
2523
class dbModule;
@@ -48,6 +46,9 @@ class dbWire;
4846
class dbBlockCallBackObj
4947
{
5048
public:
49+
dbBlockCallBackObj() { owner_ = nullptr; }
50+
virtual ~dbBlockCallBackObj() { removeOwner(); }
51+
5152
// dbInst Start
5253
virtual void inDbInstCreate(dbInst*) {}
5354
virtual void inDbInstCreate(dbInst*, dbRegion*) {}
@@ -182,16 +183,6 @@ class dbBlockCallBackObj
182183
virtual void inDbFillCreate(dbFill*) {}
183184
// dbFill End
184185

185-
// dbMarkerCategory Start
186-
virtual void inDbMarkerCategoryCreate(dbMarkerCategory*) {}
187-
virtual void inDbMarkerCategoryDestroy(dbMarkerCategory*) {}
188-
// dbMarkerCategory End
189-
190-
// dbMarker Start
191-
virtual void inDbMarkerCreate(dbMarker*) {}
192-
virtual void inDbMarkerDestroy(dbMarker*) {}
193-
// dbMarker End
194-
195186
virtual void inDbBlockStreamOutBefore(dbBlock*) {}
196187
virtual void inDbBlockStreamOutAfter(dbBlock*) {}
197188
virtual void inDbBlockReadNetsBefore(dbBlock*) {}
@@ -206,9 +197,6 @@ class dbBlockCallBackObj
206197
bool hasOwner() const { return (owner_ != nullptr); }
207198
void removeOwner();
208199

209-
dbBlockCallBackObj() { owner_ = nullptr; }
210-
virtual ~dbBlockCallBackObj() { removeOwner(); }
211-
212200
private:
213201
dbBlock* owner_;
214202
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
// Copyright (c) 2019-2025, The OpenROAD Authors
3+
4+
#pragma once
5+
6+
namespace odb {
7+
8+
class dbChip;
9+
class dbMarker;
10+
class dbMarkerCategory;
11+
12+
///////////////////////////////////////////////////////////////////////////////
13+
///
14+
/// dbChipCallBackObj - An object comprising a list of stub routines
15+
/// invoked by dbChip.
16+
/// Derived classes may implement these routines, causing external code
17+
/// to be invoked from inside dbBlock methods.
18+
///
19+
///////////////////////////////////////////////////////////////////////////////
20+
21+
class dbChipCallBackObj
22+
{
23+
public:
24+
dbChipCallBackObj() { _owner = nullptr; }
25+
virtual ~dbChipCallBackObj() { removeOwner(); }
26+
27+
// dbMarkerCategory Start
28+
virtual void inDbMarkerCategoryCreate(dbMarkerCategory*) {}
29+
virtual void inDbMarkerCategoryDestroy(dbMarkerCategory*) {}
30+
// dbMarkerCategory End
31+
32+
// dbMarker Start
33+
virtual void inDbMarkerCreate(dbMarker*) {}
34+
virtual void inDbMarkerDestroy(dbMarker*) {}
35+
// dbMarker End
36+
37+
// allow ECO client initialization - payam
38+
virtual dbChipCallBackObj& operator()() { return *this; }
39+
40+
// Manipulate _callback list of owner -- in journal.cpp
41+
void addOwner(dbChip* new_owner);
42+
bool hasOwner() const { return (_owner != nullptr); }
43+
void removeOwner();
44+
45+
private:
46+
dbChip* _owner = nullptr;
47+
};
48+
49+
} // namespace odb

src/odb/src/codeGenerator/schema/chip/dbChip.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
"flags": ["private", "no-serial"]
184184
}
185185
],
186-
"declared_classes": ["dbPropertyItr", "_dbNameCache","dbBlockItr"],
186+
"declared_classes": ["dbPropertyItr", "_dbNameCache","dbBlockItr","dbChipCallBackObj"],
187187
"h_includes": [
188188
"odb/geom.h"
189189
],
@@ -195,6 +195,15 @@
195195
"dbBlock.h",
196196
"dbTech.h",
197197
"dbPropertyItr.h",
198-
"dbChipConn.h"
198+
"dbChipConn.h",
199+
"dbChipConnItr.h",
200+
"dbChipInst.h",
201+
"dbChipInstItr.h",
202+
"dbChipNet.h",
203+
"dbChipNetItr.h",
204+
"dbCommon.h",
205+
"odb/dbChipCallBackObj.h",
206+
"odb/dbObject.h",
207+
"odb/geom.h"
199208
]
200209
}

src/odb/src/db/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ add_library(db
6161
dbJournal.cpp
6262
dbJournalLog.cpp
6363
dbBlockCallBackObj.cpp
64+
dbChipCallBackObj.cpp
6465
dbRegion.cpp
6566
dbRegionInstItr.cpp
6667
dbExtControl.cpp

src/odb/src/db/dbChip.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
#include "dbBlock.h"
1111
#include "dbBlockItr.h"
1212
#include "dbChipConn.h"
13+
#include "dbChipConnItr.h"
14+
#include "dbChipInst.h"
15+
#include "dbChipInstItr.h"
16+
#include "dbChipNet.h"
17+
#include "dbChipNetItr.h"
1318
#include "dbChipRegion.h"
19+
#include "dbCommon.h"
1420
#include "dbDatabase.h"
1521
#include "dbMarkerCategory.h"
1622
#include "dbNameCache.h"
@@ -20,18 +26,13 @@
2026
#include "dbTable.hpp"
2127
#include "dbTech.h"
2228
#include "odb/db.h"
29+
#include "odb/dbChipCallBackObj.h"
30+
#include "odb/dbObject.h"
2331
#include "odb/dbSet.h"
32+
#include "odb/geom.h"
2433
// User Code Begin Includes
2534
#include <cstdlib>
26-
27-
#include "dbChipConnItr.h"
28-
#include "dbChipInst.h"
29-
#include "dbChipInstItr.h"
30-
#include "dbChipNet.h"
31-
#include "dbChipNetItr.h"
32-
#include "dbCommon.h"
33-
#include "odb/dbObject.h"
34-
#include "odb/geom.h"
35+
#include <list>
3536
// User Code End Includes
3637
namespace odb {
3738
template class dbTable<_dbChip>;
@@ -342,6 +343,11 @@ _dbChip::~_dbChip()
342343
delete name_cache_;
343344
delete block_itr_;
344345
delete prop_itr_;
346+
347+
while (!callbacks_.empty()) {
348+
auto _cbitr = callbacks_.begin();
349+
(*_cbitr)->removeOwner();
350+
}
345351
// User Code End Destructor
346352
}
347353

src/odb/src/db/dbChip.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include "odb/dbId.h"
1212
#include "odb/geom.h"
1313
#include "odb/odb.h"
14+
// User Code Begin Includes
15+
#include <list>
16+
// User Code End Includes
1417

1518
namespace odb {
1619
class dbIStream;
@@ -19,6 +22,7 @@ class _dbDatabase;
1922
class dbPropertyItr;
2023
class _dbNameCache;
2124
class dbBlockItr;
25+
class dbChipCallBackObj;
2226
class _dbProperty;
2327
class _dbChipRegion;
2428
class _dbMarkerCategory;
@@ -75,6 +79,10 @@ class _dbChip : public _dbObject
7579
dbTable<_dbChipRegion>* chip_region_tbl_;
7680
dbTable<_dbMarkerCategory>* marker_categories_tbl_;
7781
dbId<_dbChip> next_entry_;
82+
83+
// User Code Begin Fields
84+
std::list<dbChipCallBackObj*> callbacks_;
85+
// User Code End Fields
7886
};
7987
dbIStream& operator>>(dbIStream& stream, _dbChip& obj);
8088
dbOStream& operator<<(dbOStream& stream, const _dbChip& obj);

0 commit comments

Comments
 (0)