Skip to content

Commit

Permalink
open view on doubleclick on net with all connected gates
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaleee committed Dec 6, 2023
1 parent ceb241d commit 27ffe35
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions plugins/gui/include/gui/module_widget/module_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ namespace hal

void openGateInView(const QModelIndex& index);

void openNetEndpointsInView(const QModelIndex &index);

void changeGateName(const QModelIndex& index);

void changeNetName(const QModelIndex& index);
Expand Down
22 changes: 20 additions & 2 deletions plugins/gui/src/module_widget/module_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,7 @@ namespace hal
switch(mi->getType()){
case ModuleItem::TreeItemType::Module: openModuleInView(index); break;
case ModuleItem::TreeItemType::Gate: openGateInView(index); break;
case ModuleItem::TreeItemType::Net: //openNetEndpointsInView(index);
break;
case ModuleItem::TreeItemType::Net: openNetEndpointsInView(index); break;
}
}

Expand All @@ -504,6 +503,25 @@ namespace hal
act->exec();
}

void ModuleWidget::openNetEndpointsInView(const QModelIndex &index){
QSet<u32> gates;

Net* net = gNetlist->get_net_by_id(getModuleItemFromIndex(index)->id());
for(auto endpoint : net->get_sources())
gates.insert(endpoint->get_gate()->get_id());
for(auto endpoint : net->get_destinations())
gates.insert(endpoint->get_gate()->get_id());

QString name = gGraphContextManager->nextViewName("Isolated View");

UserActionCompound* act = new UserActionCompound;
act->setUseCreatedObject();
act->addAction(new ActionCreateObject(UserActionObjectType::Context, name));
act->addAction(new ActionAddItemsToObject({}, gates));
//Add placement hints
act->exec();
}

void ModuleWidget::changeGateName(const QModelIndex &index)
{
QString oldName = getModuleItemFromIndex(index)->name();
Expand Down

0 comments on commit 27ffe35

Please sign in to comment.