Skip to content

Commit 067eb47

Browse files
committed
gui: update dbMod* descriptors
Signed-off-by: LucasYuki <[email protected]>
1 parent c82e630 commit 067eb47

File tree

1 file changed

+61
-197
lines changed

1 file changed

+61
-197
lines changed

src/gui/src/dbDescriptors.cpp

Lines changed: 61 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -3562,9 +3562,10 @@ Descriptor::Properties DbModuleDescriptor::getDBProperties(
35623562
}
35633563
}
35643564

3565-
SelectionSet children;
3565+
Descriptor::PropertyList children;
35663566
for (auto* child : module->getChildren()) {
3567-
children.insert(gui->makeSelected(child->getMaster()));
3567+
children.push_back(
3568+
{gui->makeSelected(child->getMaster()), gui->makeSelected(child)});
35683569
}
35693570
if (!children.empty()) {
35703571
props.push_back({"Children", children});
@@ -3576,6 +3577,18 @@ Descriptor::Properties DbModuleDescriptor::getDBProperties(
35763577
}
35773578
props.push_back({"Instances", insts});
35783579

3580+
SelectionSet modnets;
3581+
for (auto* modnet : module->getModNets()) {
3582+
modnets.insert(gui->makeSelected(modnet));
3583+
}
3584+
props.push_back({"ModNets", modnets});
3585+
3586+
SelectionSet ports;
3587+
for (auto* port : module->getPorts()) {
3588+
ports.insert(gui->makeSelected(port));
3589+
}
3590+
props.push_back({"Ports", ports});
3591+
35793592
SelectionSet modbterms;
35803593
for (auto* modbterm : module->getModBTerms()) {
35813594
modbterms.insert(gui->makeSelected(modbterm));
@@ -3639,97 +3652,59 @@ std::string DbModBTermDescriptor::getTypeName() const
36393652
return "ModBTerm";
36403653
}
36413654

3642-
bool DbModBTermDescriptor::getBBox(const std::any& object, odb::Rect& bbox) const
3655+
bool DbModBTermDescriptor::getBBox(const std::any& object,
3656+
odb::Rect& bbox) const
36433657
{
3644-
//auto* module = std::any_cast<odb::dbModBTerm*>(object);
3645-
bbox.mergeInit();
3646-
/*
3647-
for (auto* child : module->getChildren()) {
3648-
odb::Rect child_bbox;
3649-
if (getBBox(child->getMaster(), child_bbox)) {
3650-
bbox.merge(child_bbox);
3651-
}
3652-
}
3653-
3654-
for (auto* inst : module->getInsts()) {
3655-
auto* box = inst->getBBox();
3656-
odb::Rect box_rect = box->getBox();
3657-
bbox.merge(box_rect);
3658-
}
3659-
*/
3660-
return !bbox.isInverted();
3658+
return false;
36613659
}
36623660

36633661
void DbModBTermDescriptor::highlight(const std::any& object,
3664-
Painter& painter) const
3662+
Painter& painter) const
36653663
{
3666-
/*
3667-
auto* module = std::any_cast<odb::dbModule*>(object);
3668-
3669-
auto* inst_descriptor = Gui::get()->getDescriptor<odb::dbInst*>();
3670-
for (auto* inst : module->getInsts()) {
3671-
inst_descriptor->highlight(inst, painter);
3672-
}
3673-
3674-
const int level_alpha_scale = 2;
3675-
painter.saveState();
3676-
auto pen_color = painter.getPenColor();
3677-
pen_color.a /= level_alpha_scale;
3678-
painter.setPen(pen_color, true);
3679-
for (auto* children : module->getChildren()) {
3680-
highlight(children->getMaster(), painter);
3681-
}
3682-
painter.restoreState();
3683-
*/
36843664
}
36853665

36863666
Descriptor::Properties DbModBTermDescriptor::getDBProperties(
36873667
odb::dbModBTerm* modbterm) const
36883668
{
3689-
//auto* mod_inst = module->getModInst();
3690-
36913669
auto* gui = Gui::get();
36923670

36933671
Properties props;
3694-
if (modbterm != nullptr) {
3695-
auto* parent = modbterm->getParent();
3696-
if (parent != nullptr) {
3697-
props.push_back({"Parent", gui->makeSelected(parent)});
3698-
}
3699-
3700-
auto* moditerm = modbterm->getParentModITerm();
3701-
if (moditerm != nullptr) {
3702-
props.push_back({"ModITerm", gui->makeSelected(moditerm)});
3703-
}
3704-
3672+
auto* parent = modbterm->getParent();
3673+
if (parent != nullptr) {
3674+
props.push_back({"Parent", gui->makeSelected(parent)});
37053675
}
37063676

3707-
/*
3708-
SelectionSet children;
3709-
for (auto* child : module->getChildren()) {
3710-
children.insert(gui->makeSelected(child->getMaster()));
3677+
auto* moditerm = modbterm->getParentModITerm();
3678+
if (moditerm != nullptr) {
3679+
props.push_back({"Parent ModITerm", gui->makeSelected(moditerm)});
37113680
}
3712-
if (!children.empty()) {
3713-
props.push_back({"Children", children});
3681+
3682+
auto* modnet = modbterm->getModNet();
3683+
if (modnet != nullptr) {
3684+
props.push_back({"ModNet", gui->makeSelected(modnet)});
37143685
}
37153686

3716-
SelectionSet insts;
3717-
for (auto* inst : module->getInsts()) {
3718-
insts.insert(gui->makeSelected(inst));
3687+
auto signal = modbterm->getSigType().getString();
3688+
if (signal) {
3689+
props.push_back({"Signal type", signal});
37193690
}
3720-
props.push_back({"Instances", insts});
37213691

3722-
SelectionSet bmodterms;
3723-
for (auto* bmodterm : module->getModBTerms()) {
3724-
std::cout << bmodterm->getName() << std::endl;
3725-
bmodterms.insert(gui->makeSelected(bmodterm));
3692+
auto iotype = modbterm->getIoType().getString();
3693+
if (iotype != nullptr) {
3694+
props.push_back({"IO type", iotype});
37263695
}
3727-
props.push_back({"ModBTerms", bmodterms});
37283696

3729-
if (mod_inst != nullptr) {
3730-
populateODBProperties(props, mod_inst, "Instance");
3697+
auto* bus = modbterm->getBusPort();
3698+
if (bus) {
3699+
SelectionSet ports;
3700+
for (auto port : bus->getBusPortMembers()) {
3701+
ports.insert(gui->makeSelected(port));
3702+
}
3703+
3704+
props.push_back({"Bus port", ports});
3705+
} else {
3706+
props.push_back({"Is bus port", false});
37313707
}
3732-
*/
37333708

37343709
return props;
37353710
}
@@ -3746,21 +3721,8 @@ void DbModBTermDescriptor::visitAllObjects(
37463721
return;
37473722
}
37483723

3749-
//getModules(block->getTopModule(), func);
3750-
}
3751-
3752-
/*
3753-
void DbModBTermDescriptor::getModules(
3754-
odb::dbModule* module,
3755-
const std::function<void(const Selected&)>& func) const
3756-
{
3757-
func({module, this});
3758-
3759-
for (auto* mod_inst : module->getChildren()) {
3760-
getModules(mod_inst->getMaster(), func);
3761-
}
3724+
// getModules(block->getTopModule(), func);
37623725
}
3763-
*/
37643726

37653727
//////////////////////////////////////////////////
37663728

@@ -3786,55 +3748,20 @@ std::string DbModITermDescriptor::getTypeName() const
37863748
return "ModITerm";
37873749
}
37883750

3789-
bool DbModITermDescriptor::getBBox(const std::any& object, odb::Rect& bbox) const
3751+
bool DbModITermDescriptor::getBBox(const std::any& object,
3752+
odb::Rect& bbox) const
37903753
{
3791-
//auto* module = std::any_cast<odb::dbModBTerm*>(object);
3792-
bbox.mergeInit();
3793-
/*
3794-
for (auto* child : module->getChildren()) {
3795-
odb::Rect child_bbox;
3796-
if (getBBox(child->getMaster(), child_bbox)) {
3797-
bbox.merge(child_bbox);
3798-
}
3799-
}
3800-
3801-
for (auto* inst : module->getInsts()) {
3802-
auto* box = inst->getBBox();
3803-
odb::Rect box_rect = box->getBox();
3804-
bbox.merge(box_rect);
3805-
}
3806-
*/
3807-
return !bbox.isInverted();
3754+
return false;
38083755
}
38093756

38103757
void DbModITermDescriptor::highlight(const std::any& object,
3811-
Painter& painter) const
3758+
Painter& painter) const
38123759
{
3813-
/*
3814-
auto* module = std::any_cast<odb::dbModule*>(object);
3815-
3816-
auto* inst_descriptor = Gui::get()->getDescriptor<odb::dbInst*>();
3817-
for (auto* inst : module->getInsts()) {
3818-
inst_descriptor->highlight(inst, painter);
3819-
}
3820-
3821-
const int level_alpha_scale = 2;
3822-
painter.saveState();
3823-
auto pen_color = painter.getPenColor();
3824-
pen_color.a /= level_alpha_scale;
3825-
painter.setPen(pen_color, true);
3826-
for (auto* children : module->getChildren()) {
3827-
highlight(children->getMaster(), painter);
3828-
}
3829-
painter.restoreState();
3830-
*/
38313760
}
38323761

38333762
Descriptor::Properties DbModITermDescriptor::getDBProperties(
38343763
odb::dbModITerm* moditerm) const
38353764
{
3836-
//auto* mod_inst = module->getModInst();
3837-
38383765
auto* gui = Gui::get();
38393766

38403767
Properties props;
@@ -3848,6 +3775,11 @@ Descriptor::Properties DbModITermDescriptor::getDBProperties(
38483775
props.push_back({"ModNet", gui->makeSelected(modnet)});
38493776
}
38503777

3778+
auto* modbterm = moditerm->getChildModBTerm();
3779+
if (modbterm != nullptr) {
3780+
props.push_back({"Child ModBTerm", gui->makeSelected(modbterm)});
3781+
}
3782+
38513783
return props;
38523784
}
38533785

@@ -3863,7 +3795,7 @@ void DbModITermDescriptor::visitAllObjects(
38633795
return;
38643796
}
38653797

3866-
//getModules(block->getTopModule(), func);
3798+
// getModules(block->getTopModule(), func);
38673799
}
38683800

38693801
//////////////////////////////////////////////////
@@ -3892,46 +3824,12 @@ std::string DbModInstDescriptor::getTypeName() const
38923824

38933825
bool DbModInstDescriptor::getBBox(const std::any& object, odb::Rect& bbox) const
38943826
{
3895-
//auto* module = std::any_cast<odb::dbModBTerm*>(object);
3896-
bbox.mergeInit();
3897-
/*
3898-
for (auto* child : module->getChildren()) {
3899-
odb::Rect child_bbox;
3900-
if (getBBox(child->getMaster(), child_bbox)) {
3901-
bbox.merge(child_bbox);
3902-
}
3903-
}
3904-
3905-
for (auto* inst : module->getInsts()) {
3906-
auto* box = inst->getBBox();
3907-
odb::Rect box_rect = box->getBox();
3908-
bbox.merge(box_rect);
3909-
}
3910-
*/
3911-
return !bbox.isInverted();
3827+
return false;
39123828
}
39133829

39143830
void DbModInstDescriptor::highlight(const std::any& object,
3915-
Painter& painter) const
3831+
Painter& painter) const
39163832
{
3917-
/*
3918-
auto* module = std::any_cast<odb::dbModule*>(object);
3919-
3920-
auto* inst_descriptor = Gui::get()->getDescriptor<odb::dbInst*>();
3921-
for (auto* inst : module->getInsts()) {
3922-
inst_descriptor->highlight(inst, painter);
3923-
}
3924-
3925-
const int level_alpha_scale = 2;
3926-
painter.saveState();
3927-
auto pen_color = painter.getPenColor();
3928-
pen_color.a /= level_alpha_scale;
3929-
painter.setPen(pen_color, true);
3930-
for (auto* children : module->getChildren()) {
3931-
highlight(children->getMaster(), painter);
3932-
}
3933-
painter.restoreState();
3934-
*/
39353833
}
39363834

39373835
Descriptor::Properties DbModInstDescriptor::getDBProperties(
@@ -3976,7 +3874,7 @@ void DbModInstDescriptor::visitAllObjects(
39763874
return;
39773875
}
39783876

3979-
//getModules(block->getTopModule(), func);
3877+
// getModules(block->getTopModule(), func);
39803878
}
39813879

39823880
//////////////////////////////////////////////////
@@ -4005,46 +3903,12 @@ std::string DbModNetDescriptor::getTypeName() const
40053903

40063904
bool DbModNetDescriptor::getBBox(const std::any& object, odb::Rect& bbox) const
40073905
{
4008-
//auto* module = std::any_cast<odb::dbModBTerm*>(object);
4009-
bbox.mergeInit();
4010-
/*
4011-
for (auto* child : module->getChildren()) {
4012-
odb::Rect child_bbox;
4013-
if (getBBox(child->getMaster(), child_bbox)) {
4014-
bbox.merge(child_bbox);
4015-
}
4016-
}
4017-
4018-
for (auto* inst : module->getInsts()) {
4019-
auto* box = inst->getBBox();
4020-
odb::Rect box_rect = box->getBox();
4021-
bbox.merge(box_rect);
4022-
}
4023-
*/
4024-
return !bbox.isInverted();
3906+
return false;
40253907
}
40263908

40273909
void DbModNetDescriptor::highlight(const std::any& object,
40283910
Painter& painter) const
40293911
{
4030-
/*
4031-
auto* module = std::any_cast<odb::dbModule*>(object);
4032-
4033-
auto* inst_descriptor = Gui::get()->getDescriptor<odb::dbInst*>();
4034-
for (auto* inst : module->getInsts()) {
4035-
inst_descriptor->highlight(inst, painter);
4036-
}
4037-
4038-
const int level_alpha_scale = 2;
4039-
painter.saveState();
4040-
auto pen_color = painter.getPenColor();
4041-
pen_color.a /= level_alpha_scale;
4042-
painter.setPen(pen_color, true);
4043-
for (auto* children : module->getChildren()) {
4044-
highlight(children->getMaster(), painter);
4045-
}
4046-
painter.restoreState();
4047-
*/
40483912
}
40493913

40503914
Descriptor::Properties DbModNetDescriptor::getDBProperties(
@@ -4097,7 +3961,7 @@ void DbModNetDescriptor::visitAllObjects(
40973961
return;
40983962
}
40993963

4100-
//getModules(block->getTopModule(), func);
3964+
// getModules(block->getTopModule(), func);
41013965
}
41023966

41033967
//////////////////////////////////////////////////

0 commit comments

Comments
 (0)