Skip to content

Commit 681327e

Browse files
committed
Merge branch 'master' of github.com:emsec/hal
2 parents 8c59634 + 47c535f commit 681327e

File tree

22 files changed

+277
-264
lines changed

22 files changed

+277
-264
lines changed

plugins/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ foreach(i IN ITEMS "" "_DEBUG" "_RELEASE" "_MINSIZEREL" "_RELWITHDEBINFO")
55
endforeach()
66
endforeach()
77

8+
# Build netlist_preprocessing and dependend libraries
9+
option(PL_NETLIST_PREPROCESSING "PL_NETLIST_PREPROCESSING" ON)
10+
811
include_directories(${include_directories}
912
${CMAKE_SOURCE_DIR}/include
1013
${CMAKE_SOURCE_DIR}/hal_plugins
@@ -14,6 +17,7 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib/hal_plugins/)
1417
file(WRITE ${CMAKE_BINARY_DIR}/lib/hal_plugins/__init__.py "")
1518
install(FILES ${CMAKE_BINARY_DIR}/lib/hal_plugins/__init__.py DESTINATION ${PLUGIN_LIBRARY_INSTALL_DIRECTORY})
1619

20+
1721
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
1822

1923
SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})

plugins/genlib_writer/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
option(PL_GENLIB_WRITER "PL_GENLIB_WRITER" OFF)
2-
if(PL_GENLIB_WRITER OR BUILD_ALL_PLUGINS)
2+
3+
# LINKED FROM RESYNTHESIS WHICH IS LINKED FROM NETLIST_PREPROCESSING
4+
if(PL_GENLIB_WRITER OR PL_RESYNTHESIS OR PL_NETLIST_PREPROCESSING OR BUILD_ALL_PLUGINS)
35
file(GLOB_RECURSE GENLIB_WRITER_INC ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
46
file(GLOB_RECURSE GENLIB_WRITER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
57
file(GLOB_RECURSE GENLIB_WRITER_PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/python/*.cpp)

plugins/gui/include/gui/graph_widget/graph_graphics_view.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ namespace hal
137137
private Q_SLOTS:
138138
void conditionalUpdate();
139139
void handleIsolationViewAction();
140-
void handleMoveAction(u32 moduleId);
141-
void handleMoveNewAction();
142140
void adjustMinScale();
143141
void handleAddCommentAction();
144142

@@ -163,7 +161,6 @@ namespace hal
163161
void handleHighlightPredecessor();
164162
void handleSuccessorDistance();
165163
void handlePredecessorDistance();
166-
void handleModuleDialog();
167164
void handleCancelPickMode();
168165
void handlePluginContextContributionTriggered();
169166
void selectedNodeToItem();

plugins/gui/include/gui/netlist_relay/netlist_relay.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "gui/grouping/grouping_color_serializer.h"
3131
#include "gui/module_model/module_color_manager.h"
3232
#include "gui/module_model/module_item.h"
33+
#include "gui/gui_def.h"
3334
#include <QMap>
3435
#include <QObject>
3536

@@ -123,6 +124,12 @@ namespace hal
123124
*/
124125
void addChildModuleDialog(const u32 id);
125126

127+
/**
128+
* Opens 'add to module' Dialog. Node gets added to selected module or new module.
129+
* @param node - The node to be added. If node is empty the current selection will be added.
130+
*/
131+
void addToModuleDialog(const Node& node = Node());
132+
126133
/**
127134
* Deletes the specified module from the netlist.
128135
*

plugins/gui/include/gui/selection_details_widget/selection_details_widget.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,6 @@ namespace hal
278278
*/
279279
void selectionToGrouping();
280280

281-
/**
282-
* Checks all modules if the current selection can be added to that specific module. Thereafter it
283-
* creates a context menu with all valid modules as options as well as a "New module..." option.
284-
*/
285-
void selectionToModuleMenu();
286-
287281
/**
288282
* Toggles the visibiliy of the searchbar.
289283
*/
@@ -299,12 +293,6 @@ namespace hal
299293
*/
300294
void singleSelectionInternal(const ModuleItem* sti);
301295

302-
/**
303-
* Adds the current selection to a module selected by id (=actionCode if positive).
304-
* Create new module an pops up new module dialog if actionCode is negative.
305-
*/
306-
void selectionToModuleAction(int actionCode);
307-
308296
void showNoSelection();
309297

310298
QSplitter* mSplitter;

plugins/gui/src/graph_widget/graph_graphics_view.cpp

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -166,70 +166,6 @@ namespace hal
166166
context->setDirty(false);
167167
}
168168

169-
void GraphGraphicsView::handleMoveAction(u32 moduleId)
170-
{
171-
ActionAddItemsToObject* act = new ActionAddItemsToObject(gSelectionRelay->selectedModules(),
172-
gSelectionRelay->selectedGates());
173-
act->setObject(UserActionObject(moduleId,UserActionObjectType::Module));
174-
act->exec();
175-
gSelectionRelay->clear();
176-
gSelectionRelay->addModule(moduleId);
177-
gSelectionRelay->setFocus(SelectionRelay::ItemType::Module,moduleId);
178-
gSelectionRelay->relaySelectionChanged(this);
179-
gContentManager->getGraphTabWidget()->ensureSelectionVisible();
180-
}
181-
182-
void GraphGraphicsView::handleMoveNewAction()
183-
{
184-
std::unordered_set<Gate*> gate_objs;
185-
std::unordered_set<Module*> module_objs;
186-
for (const auto& id : gSelectionRelay->selectedGatesList())
187-
{
188-
gate_objs.insert(gNetlist->get_gate_by_id(id));
189-
}
190-
for (const auto& id : gSelectionRelay->selectedModulesList())
191-
{
192-
module_objs.insert(gNetlist->get_module_by_id(id));
193-
}
194-
Module* parent = gui_utility::firstCommonAncestor(module_objs, gate_objs);
195-
QString parent_name = QString::fromStdString(parent->get_name());
196-
bool ok;
197-
QString name = QInputDialog::getText(nullptr, "", "New module will be created under \"" + parent_name + "\"\nModule Name:", QLineEdit::Normal, "", &ok);
198-
if (!ok || name.isEmpty())
199-
return;
200-
201-
ActionCreateObject* actNewModule = new ActionCreateObject(UserActionObjectType::Module, name);
202-
actNewModule->setParentId(parent->get_id());
203-
204-
UserActionCompound* compound = new UserActionCompound;
205-
compound->setUseCreatedObject();
206-
compound->addAction(actNewModule);
207-
compound->addAction(new ActionAddItemsToObject(gSelectionRelay->selectedModules(),
208-
gSelectionRelay->selectedGates()));
209-
if (mItem && (mItem->itemType()==ItemType::Gate || mItem->itemType()==ItemType::Module))
210-
{
211-
Node nd(mItem->id(),mItem->itemType()==ItemType::Gate ? Node::Gate : Node::Module);
212-
const NodeBox* box = mGraphWidget->getContext()->getLayouter()->boxes().boxForNode(nd);
213-
if (box)
214-
{
215-
ActionMoveNode* actMoveNode = new ActionMoveNode(mGraphWidget->getContext()->id(),
216-
QPoint(box->x(),box->y()));
217-
compound->addAction(actMoveNode);
218-
}
219-
}
220-
221-
GraphContext* context = mGraphWidget->getContext();
222-
context->setSpecialUpdate(true);
223-
context->setScheduleRemove(gSelectionRelay->selectedModules(),gSelectionRelay->selectedGates());
224-
225-
compound->exec();
226-
gSelectionRelay->clear();
227-
gSelectionRelay->addModule(compound->object().id());
228-
gSelectionRelay->setFocus(SelectionRelay::ItemType::Module,compound->object().id());
229-
gSelectionRelay->relaySelectionChanged(this);
230-
gContentManager->getGraphTabWidget()->ensureSelectionVisible();
231-
}
232-
233169
void GraphGraphicsView::adjustMinScale()
234170
{
235171
if (!scene())
@@ -689,14 +625,6 @@ namespace hal
689625
data.setValue(Node(mItem->id(), isGate ? Node::NodeType::Gate : Node::NodeType::Module));
690626
action->setData(data);
691627
connect(action, &QAction::triggered, this, &GraphGraphicsView::handleAddCommentAction);
692-
693-
// only allow move actions on anything that is not the top module
694-
Module* m = isModule ? gNetlist->get_module_by_id(mItem->id()) : nullptr;
695-
if (!(isModule && m == gNetlist->get_top_module()))
696-
{
697-
action = context_menu.addAction(" Move to module …");
698-
connect(action, &QAction::triggered, this, &GraphGraphicsView::handleModuleDialog);
699-
}
700628
}
701629
}
702630
else
@@ -1310,44 +1238,6 @@ namespace hal
13101238
act->exec();
13111239
}
13121240

1313-
void GraphGraphicsView::handleModuleDialog()
1314-
{
1315-
QSet<u32> exclude_ids;
1316-
QList<u32> modules = gSelectionRelay->selectedModulesList();
1317-
QList<u32> gates = gSelectionRelay->selectedGatesList();
1318-
1319-
for (u32 gid : gates)
1320-
{
1321-
Gate* g = gNetlist->get_gate_by_id(gid);
1322-
if (!g)
1323-
continue;
1324-
exclude_ids.insert(g->get_module()->get_id());
1325-
}
1326-
1327-
for (u32 mid : modules)
1328-
{
1329-
exclude_ids.insert(mid);
1330-
Module* m = gNetlist->get_module_by_id(mid);
1331-
if (!m)
1332-
continue;
1333-
Module* pm = m->get_parent_module();
1334-
if (pm)
1335-
exclude_ids.insert(pm->get_id());
1336-
for (Module* sm : m->get_submodules(nullptr, true))
1337-
exclude_ids.insert(sm->get_id());
1338-
}
1339-
1340-
AddToModuleReceiver* receiver = new AddToModuleReceiver(this);
1341-
ModuleDialog md(exclude_ids, "Move to module", false, receiver, this);
1342-
if (md.exec() != QDialog::Accepted) return;
1343-
if (md.isNewModule())
1344-
{
1345-
handleMoveNewAction();
1346-
return;
1347-
}
1348-
handleMoveAction(md.selectedId());
1349-
}
1350-
13511241
void GraphGraphicsView::handleSelectOutputs()
13521242
{
13531243
auto context = mGraphWidget->getContext();

plugins/gui/src/gui_api/gui_api.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -920,13 +920,9 @@ namespace hal
920920

921921
GridPlacement* GuiApiClasses::View::getGridPlacement(int viewId)
922922
{
923-
GraphContext* context = gGraphContextManager->getContextById(viewId);
923+
const GraphContext* context = gGraphContextManager->getContextById(viewId);
924924
if (context == nullptr) return new GridPlacement();
925-
GridPlacement* retval = new GridPlacement();
926-
QMap<Node, QPoint> contextNodeMap = context->getLayouter()->nodeToPositionMap();
927-
for (auto it = contextNodeMap.begin(); it != contextNodeMap.end(); it++)
928-
retval->insert(it.key(), it.value());
929-
return retval;
925+
return context->getLayouter()->gridPlacementFactory();
930926
}
931927

932928
bool GuiApiClasses::View::setGridPlacement(int viewId, GridPlacement *gp)

plugins/gui/src/module_context_menu/module_context_menu.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ namespace hal {
7373
if(gSelectionRelay->selectedModules().contains(id))
7474
act->setEnabled(false);
7575

76+
if (gSelectionRelay->numberSelectedNodes() == 1)
77+
contextMenu->addAction(" Move to module …",
78+
[id](){
79+
gNetlistRelay->addToModuleDialog(Node(id,Node::Module));
80+
}
81+
);
7682
sm = contextMenu->addMenu(" To grouping …");
7783
QString actionText = " Assign module to grouping";
7884
if(module->get_grouping() != nullptr)
@@ -151,6 +157,12 @@ namespace hal {
151157
if(gSelectionRelay->selectedGates().contains(id))
152158
act->setEnabled(false);
153159

160+
if (gSelectionRelay->numberSelectedNodes() == 1)
161+
contextMenu->addAction(" Move to module …",
162+
[id](){
163+
gNetlistRelay->addToModuleDialog(Node(id,Node::Gate));
164+
}
165+
);
154166
sm = contextMenu->addMenu(" To grouping …");
155167
QString actionText = " Assign gate to grouping";
156168
if(gate->get_grouping() != nullptr)
@@ -251,6 +263,13 @@ namespace hal {
251263
{
252264
contextMenu->addSeparator();
253265
contextMenu->addAction("Entire selection:")->setDisabled(true);
266+
if (gSelectionRelay->numberSelectedNodes() > 1)
267+
contextMenu->addAction(" Move to module …",
268+
[](){
269+
gNetlistRelay->addToModuleDialog();
270+
}
271+
);
272+
254273
contextMenu->addAction(" Assign all to grouping",
255274
[modules, gates, nets]()
256275
{gContentManager->getGroupingManagerWidget()->assignElementsToGroupingDialog(modules, gates, nets);}
@@ -260,4 +279,4 @@ namespace hal {
260279
{gContentManager->getGroupingManagerWidget()->removeElementsFromGrouping(modules, gates, nets);}
261280
);
262281
}
263-
}
282+
}

0 commit comments

Comments
 (0)