Skip to content

Commit dcc6adc

Browse files
committed
GUI: Change DRC widget from block to chip
Signed-off-by: LucasYuki <[email protected]>
1 parent 3d6955e commit dcc6adc

File tree

5 files changed

+46
-37
lines changed

5 files changed

+46
-37
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_->getBlock());
235235
updateMarkerGroups();
236236
}
237237

238238
void DRCWidget::showEvent(QShowEvent* event)
239239
{
240-
addOwner(block_);
240+
if (chip_) {
241+
addOwner(chip_->getBlock());
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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/src/db/dbMarkerCategory.cpp

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -471,31 +471,31 @@ void dbMarkerCategory::writeTR(std::ofstream& report) const
471471
obj->writeTR(report);
472472
}
473473

474-
std::set<dbMarkerCategory*> dbMarkerCategory::fromJSON(dbBlock* block,
474+
std::set<dbMarkerCategory*> dbMarkerCategory::fromJSON(dbChip* chip,
475475
const std::string& path)
476476
{
477477
std::ifstream report(path);
478478
if (!report.is_open()) {
479-
_dbBlock* _block = (_dbBlock*) block;
480-
utl::Logger* logger = _block->getLogger();
479+
_dbChip* _chip = (_dbChip*) chip;
480+
utl::Logger* logger = _chip->getLogger();
481481

482482
logger->error(utl::ODB, 31, "Unable to open marker report: {}", path);
483483
}
484484

485485
std::set<dbMarkerCategory*> categories
486-
= fromJSON(block, path.c_str(), report);
486+
= fromJSON(chip, path.c_str(), report);
487487

488488
report.close();
489489

490490
return categories;
491491
}
492492

493-
std::set<dbMarkerCategory*> dbMarkerCategory::fromJSON(dbBlock* block,
493+
std::set<dbMarkerCategory*> dbMarkerCategory::fromJSON(dbChip* chip,
494494
const char* source,
495495
std::ifstream& report)
496496
{
497-
_dbBlock* _block = (_dbBlock*) block;
498-
utl::Logger* logger = _block->getLogger();
497+
_dbChip* _chip = (_dbChip*) chip;
498+
utl::Logger* logger = _chip->getLogger();
499499

500500
_dbMarkerCategory::PropertyTree tree;
501501
try {
@@ -507,7 +507,7 @@ std::set<dbMarkerCategory*> dbMarkerCategory::fromJSON(dbBlock* block,
507507
std::set<dbMarkerCategory*> categories;
508508
for (const auto& [name, subtree] : tree) {
509509
dbMarkerCategory* top_category
510-
= dbMarkerCategory::createOrReplace(block, name.c_str());
510+
= dbMarkerCategory::createOrReplace(chip, name.c_str());
511511
categories.insert(top_category);
512512
_dbMarkerCategory* top_category_ = (_dbMarkerCategory*) top_category;
513513

@@ -517,36 +517,36 @@ std::set<dbMarkerCategory*> dbMarkerCategory::fromJSON(dbBlock* block,
517517
return categories;
518518
}
519519

520-
dbMarkerCategory* dbMarkerCategory::fromTR(dbBlock* block,
520+
dbMarkerCategory* dbMarkerCategory::fromTR(dbChip* chip,
521521
const char* name,
522522
const std::string& path)
523523
{
524524
std::ifstream report(path);
525525
if (!report.is_open()) {
526-
_dbBlock* _block = (_dbBlock*) block;
527-
utl::Logger* logger = _block->getLogger();
526+
_dbChip* _chip = (_dbChip*) chip;
527+
utl::Logger* logger = _chip->getLogger();
528528

529529
logger->error(
530530
utl::ODB, 30, "Unable to open TritonRoute DRC report: {}", path);
531531
}
532532

533-
dbMarkerCategory* category = fromTR(block, name, path.c_str(), report);
533+
dbMarkerCategory* category = fromTR(chip, name, path.c_str(), report);
534534

535535
report.close();
536536

537537
return category;
538538
}
539539

540-
dbMarkerCategory* dbMarkerCategory::fromTR(dbBlock* block,
540+
dbMarkerCategory* dbMarkerCategory::fromTR(dbChip* chip,
541541
const char* name,
542542
const char* source,
543543
std::ifstream& report)
544544
{
545-
dbMarkerCategory* marker_category = createOrReplace(block, name);
545+
dbMarkerCategory* marker_category = createOrReplace(chip, name);
546546
marker_category->setSource(source);
547547

548-
_dbBlock* _block = (_dbBlock*) block;
549-
utl::Logger* logger = _block->getLogger();
548+
_dbChip* _chip = (_dbChip*) chip;
549+
utl::Logger* logger = _chip->getLogger();
550550

551551
const std::regex violation_type("\\s*violation type: (.*)");
552552
const boost::regex srcs("\\s*srcs: (.*)");
@@ -556,7 +556,8 @@ dbMarkerCategory* dbMarkerCategory::fromTR(dbBlock* block,
556556
"\\s*\\(\\s*(.*),\\s*(.*)\\s*\\)\\s*-\\s*\\(\\s*(.*),\\s*(.*)\\s*\\)");
557557

558558
int line_number = 0;
559-
dbTech* tech = block->getTech();
559+
dbTech* tech = chip->getTech();
560+
dbBlock* block = chip->getBlock();
560561
while (!report.eof()) {
561562
std::string line;
562563
std::smatch base_match;
@@ -823,17 +824,23 @@ dbMarkerCategory* dbMarkerCategory::createOrReplace(dbChip* chip,
823824
return create(chip, name);
824825
}
825826

827+
// For compatibility purposes only, Markers are now stored on the chip
828+
// This should be removed in the future
826829
dbMarkerCategory* dbMarkerCategory::create(dbBlock* block, const char* name)
827830
{
828831
return create(block->getChip(), name);
829832
}
830833

834+
// For compatibility purposes only, Markers are now stored on the chip
835+
// This should be removed in the future
831836
dbMarkerCategory* dbMarkerCategory::createOrGet(dbBlock* block,
832837
const char* name)
833838
{
834839
return createOrGet(block->getChip(), name);
835840
}
836841

842+
// For compatibility purposes only, Markers are now stored on the chip
843+
// This should be removed in the future
837844
dbMarkerCategory* dbMarkerCategory::createOrReplace(dbBlock* block,
838845
const char* name)
839846
{

0 commit comments

Comments
 (0)