Skip to content

Commit 14765f2

Browse files
authored
Merge pull request #7913 from AcKoucher/gui-scan-list-descriptor
gui: add descriptor for dbScanList
2 parents 5ce2d11 + cbea060 commit 14765f2

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

src/gui/src/dbDescriptors.cpp

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4665,6 +4665,83 @@ Descriptor::Property DbScanInstDescriptor::getScanPinProperty(
46654665

46664666
//////////////////////////////////////////////////
46674667

4668+
DbScanListDescriptor::DbScanListDescriptor(odb::dbDatabase* db)
4669+
: BaseDbDescriptor<odb::dbScanList>(db)
4670+
{
4671+
}
4672+
4673+
std::string DbScanListDescriptor::getName(std::any object) const
4674+
{
4675+
return "Scan List";
4676+
}
4677+
4678+
std::string DbScanListDescriptor::getTypeName() const
4679+
{
4680+
return "Scan List";
4681+
}
4682+
4683+
bool DbScanListDescriptor::getBBox(std::any object, odb::Rect& bbox) const
4684+
{
4685+
auto scan_list = getObject(object);
4686+
bbox.mergeInit();
4687+
4688+
for (odb::dbScanInst* scan_inst : scan_list->getScanInsts()) {
4689+
odb::dbInst* inst = scan_inst->getInst();
4690+
if (inst->getPlacementStatus().isPlaced()) {
4691+
bbox.merge(inst->getBBox()->getBox());
4692+
}
4693+
}
4694+
4695+
return !bbox.isInverted();
4696+
}
4697+
4698+
void DbScanListDescriptor::highlight(std::any object, Painter& painter) const
4699+
{
4700+
auto scan_list = getObject(object);
4701+
4702+
for (odb::dbScanInst* scan_inst : scan_list->getScanInsts()) {
4703+
odb::dbInst* inst = scan_inst->getInst();
4704+
if (inst->getPlacementStatus().isPlaced()) {
4705+
auto* inst_descriptor = Gui::get()->getDescriptor<odb::dbInst*>();
4706+
inst_descriptor->highlight(scan_inst->getInst(), painter);
4707+
}
4708+
}
4709+
}
4710+
4711+
bool DbScanListDescriptor::getAllObjects(SelectionSet& objects) const
4712+
{
4713+
auto* block = db_->getChip()->getBlock();
4714+
auto* db_dft = block->getDft();
4715+
4716+
for (auto* scan_chain : db_dft->getScanChains()) {
4717+
for (auto* scan_partition : scan_chain->getScanPartitions()) {
4718+
for (auto* scan_list : scan_partition->getScanLists()) {
4719+
objects.insert(makeSelected(scan_list));
4720+
}
4721+
}
4722+
}
4723+
4724+
return true;
4725+
}
4726+
4727+
Descriptor::Properties DbScanListDescriptor::getDBProperties(
4728+
odb::dbScanList* scan_list) const
4729+
{
4730+
Properties props;
4731+
4732+
auto gui = Gui::get();
4733+
4734+
SelectionSet scan_insts;
4735+
for (odb::dbScanInst* scan_inst : scan_list->getScanInsts()) {
4736+
scan_insts.insert(gui->makeSelected(scan_inst));
4737+
}
4738+
props.push_back({"Scan Insts", scan_insts});
4739+
4740+
return props;
4741+
}
4742+
4743+
//////////////////////////////////////////////////
4744+
46684745
DbBoxDescriptor::DbBoxDescriptor(odb::dbDatabase* db)
46694746
: BaseDbDescriptor<odb::dbBox>(db)
46704747
{

src/gui/src/dbDescriptors.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,24 @@ class DbScanInstDescriptor : public BaseDbDescriptor<odb::dbScanInst>
739739
Properties getDBProperties(odb::dbScanInst* scan_inst) const override;
740740
};
741741

742+
class DbScanListDescriptor : public BaseDbDescriptor<odb::dbScanList>
743+
{
744+
public:
745+
DbScanListDescriptor(odb::dbDatabase* db);
746+
747+
std::string getName(std::any object) const override;
748+
std::string getTypeName() const override;
749+
750+
bool getBBox(std::any object, odb::Rect& bbox) const override;
751+
752+
void highlight(std::any object, Painter& painter) const override;
753+
754+
bool getAllObjects(SelectionSet& objects) const override;
755+
756+
protected:
757+
Properties getDBProperties(odb::dbScanList* scan_list) const override;
758+
};
759+
742760
class DbBoxDescriptor : public BaseDbDescriptor<odb::dbBox>
743761
{
744762
public:

src/gui/src/mainWindow.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ void MainWindow::init(sta::dbSta* sta, const std::string& help_path)
562562
new DbMarkerCategoryDescriptor(db_));
563563
gui->registerDescriptor<odb::dbMarker*>(new DbMarkerDescriptor(db_));
564564
gui->registerDescriptor<odb::dbScanInst*>(new DbScanInstDescriptor(db_));
565+
gui->registerDescriptor<odb::dbScanList*>(new DbScanListDescriptor(db_));
565566
gui->registerDescriptor<odb::dbBox*>(new DbBoxDescriptor(db_));
566567
gui->registerDescriptor<DbBoxDescriptor::BoxWithTransform>(
567568
new DbBoxDescriptor(db_));

0 commit comments

Comments
 (0)