Skip to content

Commit

Permalink
Merge branch 'master' of github.com:emsec/hal
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKlx committed Sep 6, 2024
2 parents 9e01dd3 + 9efd164 commit 8a60288
Show file tree
Hide file tree
Showing 31 changed files with 2,281 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [4.4.1](v4.4.1) - 2024-07-29 14:21:42+02:00 (urgency: medium)
* fixed `hal_py.GateLibrary.gate_types` pybind
* fixed `hal_py.NetlistFactory.load_netlist` pybind

## [4.4.0](v4.4.0) - 2024-07-19 15:55:24+02:00 (urgency: medium)
* **WARNING:** this release breaks the API of the `boolean_influence` and `bitorder_propagation` plugin
* **WARNING:** this release contains many new unstable plugin APIs that will likely change in the future
Expand Down Expand Up @@ -33,6 +37,7 @@ All notable changes to this project will be documented in this file.
* added `json.hpp` from nlohmann to deps to offer a light weight json api
* adapted cmake to consider the correct flags when finding and linking against the new version of Bitwuzla
* miscellaneous
* added logic evaluator plugin
* added backward compatibility for view management
* slightly improved symbolic execution engine
* added a version of `netlist_factory::load_netlist` that takes a path to a netlist file as well as a pointer to a gate library
Expand Down
2 changes: 1 addition & 1 deletion CURRENT_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.4.0
4.4.1
2 changes: 1 addition & 1 deletion include/hal_core/plugin_system/plugin_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace hal
class PluginParameter
{
public:
enum ParameterType { Absent, Boolean, Color, ComboBox, Dictionary, ExistingDir, ExistingFile, Float, Gate, Integer, Module, NewFile, PushButton, String, TabName };
enum ParameterType { Absent, Boolean, Color, ComboBox, Dictionary, ExistingDir, ExistingFile, Float, Gate, Integer, Label, Module, NewFile, PushButton, String, TabName };
private:
ParameterType m_type;
std::string m_tagname;
Expand Down
2 changes: 2 additions & 0 deletions plugins/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
!hgl_writer/**/*
!liberty_parser*
!liberty_parser/**/*
!logic_evaluator*
!logic_evaluator/**/*
!module_identification*
!module_identification/**/*
!netlist_preprocessing*
Expand Down
3 changes: 0 additions & 3 deletions plugins/gui/include/gui/module_dialog/module_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ namespace hal {
QTabWidget* mTabWidget;

ModuleProxyModel* mModuleTreeProxyModel;
ModuleSelectProxy* mModuleTableProxyModel;
ModuleSelectModel* mModuleSelectModel;

Searchbar* mSearchbar;
QAction* mToggleSearchbar;
ModuleSelectExclude mSelectExclude;
Expand Down
10 changes: 10 additions & 0 deletions plugins/gui/include/gui/module_model/module_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <QVariant>
#include <set>
#include <array>
#include <vector>
#include <QTextStream>

namespace hal
Expand Down Expand Up @@ -153,6 +154,15 @@ namespace hal
*/
void populateTree(const QVector<u32>& modIds = {}, const QVector<u32>& gatIds = {}, const QVector<u32>& netIds = {});

/**
* Clears current tree item model and repopulates it by a list of gates. This function will
* automatically load all parent modules to gates listed. Thus gates will be shown at their
* place within the module hierarchy.
*
* @param gates std::vector of gates to be added to the item model.
*/
void populateFromGatelist(const std::vector<Gate*>& gates);

/**
* Add a module to the item model. For the specified module new ModuleItems are created and stored.
*
Expand Down
3 changes: 3 additions & 0 deletions plugins/gui/include/gui/plugin_relay/gui_plugin_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace hal {
bool mUserInterface;
bool mGuiExtensions;
QString mCliOptions;
bool mFileFound;

public:
GuiPluginEntry(const QFileInfo& info);
Expand All @@ -72,6 +73,8 @@ namespace hal {
bool isLoaded() const { return mState == AutoLoad || mState == UserLoad; }
bool isPlugin() const { return mState != NotAPlugin; }
void updateFromLoaded(const BasePluginInterface* bpif, bool isUser, const QDateTime& modified = QDateTime());
bool isFileFound() const { return mFileFound; }
void setFileFound(bool fnd) { mFileFound = fnd; }
};

class GuiPluginManager;
Expand Down
137 changes: 137 additions & 0 deletions plugins/gui/resources/stylesheet/dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1511,3 +1511,140 @@ hal--Overlay
background : rgba(0, 0, 0, 150);
}

hal--LogicEvaluatorDialog
{
font-size : 14px;
color : #A9B7C6;
background : #515253;
}

hal--LogicEvaluatorPingroup
{
background : #717273;
border : 2px solid gray;
padding-top : 4px;
padding-bottom : 4px;
padding-left : 0px;
padding-right : 0px;
}


hal--LogicEvaluatorPingroup[output="true"]
{
border-color : #A0A5A8 #414243 #414243 black;
border-width : 2 2 2 0;
}

hal--LogicEvaluatorPingroup[output="false"]
{
border-color : #A0A5A8 black #414243 #A0A5A8;
border-width : 2 0 2 2;
}

hal--LogicEvaluatorValue
{
min-width : 48;
max-width : 48;
min-height : 28;
max-height : 28;
}

hal--LogicEvaluatorValue QSpinBox
{
color : #CBD2D0;
font-family : "Iosevka";
font-style : normal;
background-color : rgb(28, 28, 29);
border : none;
}

hal--LogicEvaluatorValue QSpinBox::up-button
{
color : #CBD2D0;
background-color : #505152;
border-style : solid;
border-color : #808182 #313233 #313233 #808182;
border-width : 1;
}

hal--LogicEvaluatorValue QSpinBox::down-button
{
color : #CBD2D0;
background-color : #505152;
border-style : solid;
border-color : #808182 #313233 #313233 #808182;
border-width : 1;
}

/*
hal--LogicEvaluatorValue QSpinBox::up-arrow
{
color : #CBD2D0;
background-color : rgb(128, 28, 29);
}

hal--LogicEvaluatorValue QSpinBox::down-arrow
{
color : #CBD2D0;
background-color : rgb(28, 28, 128);
}
*/

hal--LogicEvaluatorValue QLabel
{
color : #CBD2D0;
font-family : "Iosevka";
font-style : normal;
background-color : rgb(28, 28, 29);
border : none;
}

hal--LogicEvaluatorPingroup > QLabel
{
color : white;
font-family : "Iosevka";
font-style : bold;
border : none;
background-color : none;
max-height : 28;
}

hal--LogicEvaluatorPingroup QCheckBox
{
font : bold "Iosevka";
color : white;
background : black;
padding-top : 4px;
padding-bottom : 4px;
padding-left : 8px;
padding-right : 8px;
min-width : 250px;
}

hal--LogicEvaluatorPingroup QCheckBox::indicator:checked
{
background : rgb(255,0,0);
border : 1px solid black;
}

hal--LogicEvaluatorPingroup QCheckBox::indicator:unchecked
{
background : rgb(0,170,255);
border : 1px solid black;
}

hal--LogicEvaluatorDialog > QTreeView
{
border-style : solid;
border-color : #A0A5A8 black #414243 black;
border-width : 2 2 2 2;
background : black;
min-width : 400px;
}

hal--LogicEvaluatorSelectGates
{
qproperty-selForeground : #FFE8A0;
qproperty-selBackground : #102030;
min-width : 400px;
}
11 changes: 9 additions & 2 deletions plugins/gui/src/graph_widget/layouters/graph_layouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ namespace hal
int iy0 = mNodeBoundingBox.y() * 2;
float y0 = mCoordY[iy0].preLanes() * sLaneSpacing + sVRoadPadding;
mCoordY[iy0].setOffset(y0);
mYValues.append(mCoordY.value(iy0).lanePosition(0));
auto ityLast = mCoordY.begin();
for (auto itNext = ityLast + 1; itNext != mCoordY.end(); ++itNext)
{
Expand All @@ -789,7 +788,6 @@ namespace hal
{
// netjunction -> endpoint
itNext->setOffsetYje(ityLast.value(), mJunctionMinDistanceY.value(iy1));
mYValues.append(itNext.value().lanePosition(0));
}
else
{
Expand All @@ -802,6 +800,15 @@ namespace hal
}
ityLast = itNext;
}

iy0 = mNodeBoundingBox.y() * 2;
auto ity = mCoordY.find(iy0);
while(ity != mCoordY.end())
{
mYValues.append(ity.value().lanePosition(0));
iy0 += 2;
ity = mCoordY.find(iy0);
}
}

void GraphLayouter::placeGates()
Expand Down
12 changes: 12 additions & 0 deletions plugins/gui/src/main_window/plugin_parameter_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ namespace hal {
mWidgetMap[parTagname] = floatBox;
break;
}
case PluginParameter::Label:
{
QLabel* label = new QLabel(this);
label->setText(parDefault);
mWidgetMap[parTagname] = label;
break;
}
case PluginParameter::String:
{
QLineEdit* ledit = new QLineEdit(this);
Expand Down Expand Up @@ -247,6 +254,11 @@ namespace hal {
par.set_value(QString::number(floatBox->value()).toStdString());
break;
}
case PluginParameter::Label:
{
par.set_value(std::string());
break;
}
case PluginParameter::String:
{
const QLineEdit* ledit = static_cast<const QLineEdit*>(w);
Expand Down
11 changes: 3 additions & 8 deletions plugins/gui/src/module_dialog/module_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ namespace hal {
mTreeView->setModel(mModuleTreeProxyModel);
mTreeView->expandAll();

mModuleTableProxyModel = new ModuleSelectProxy(this),
mModuleTableProxyModel->setSourceModel(mTableView->model());
mTableView->setModel(mModuleTableProxyModel);


mButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this);
layout->addWidget(mButtonBox, 3, 0, 1, 3, Qt::AlignHCenter);

Expand All @@ -116,7 +111,7 @@ namespace hal {
if(mTabWidget->currentWidget() == mTreeView)
mSearchbar->setColumnNames(mModuleTreeProxyModel->getColumnNames());
else
mSearchbar->setColumnNames(mModuleTableProxyModel->getColumnNames());
mSearchbar->setColumnNames(static_cast<ModuleSelectProxy*>(mTableView->model())->getColumnNames());

connect(mTabWidget, &QTabWidget::currentChanged, this, &ModuleDialog::handleCurrentTabChanged);
connect(mToggleSearchbar, &QAction::triggered, this, &ModuleDialog::handleToggleSearchbar);
Expand All @@ -128,7 +123,7 @@ namespace hal {
connect(mTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ModuleDialog::handleTreeSelectionChanged);

connect(mSearchbar, &Searchbar::triggerNewSearch, mModuleTreeProxyModel, &ModuleProxyModel::startSearch);
connect(mSearchbar, &Searchbar::triggerNewSearch, mModuleTableProxyModel, &ModuleSelectProxy::startSearch);
connect(mSearchbar, &Searchbar::triggerNewSearch, static_cast<ModuleSelectProxy*>(mTableView->model()), &ModuleSelectProxy::startSearch);
}

void ModuleDialog::enableButtons()
Expand Down Expand Up @@ -247,7 +242,7 @@ namespace hal {
if(mTabWidget->currentWidget() == mTreeView)
mSearchbar->setColumnNames(mModuleTreeProxyModel->getColumnNames());
else
mSearchbar->setColumnNames(mModuleTableProxyModel->getColumnNames());
mSearchbar->setColumnNames(static_cast<ModuleSelectProxy*>(mTableView->model())->getColumnNames());
mTreeView->clearSelection();
mTableView->clearSelection();
mSearchbar->clear();
Expand Down
41 changes: 41 additions & 0 deletions plugins/gui/src/module_model/module_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,47 @@ namespace hal
endResetModel();
}

void ModuleModel::populateFromGatelist(const std::vector<Gate *> &gates)
{
setIsModifying(true);
beginResetModel();
clear();

QMap<Module*,ModuleItem*> parentMap;
for (const Gate* g : gates)
{
Module* parentModule = g->get_module();
ModuleItem* parentItem;
bool insertToRoot = true;
ModuleItem* childItem = new ModuleItem(g->get_id(), ModuleItem::TreeItemType::Gate);

while (parentModule && insertToRoot)
{
parentItem = parentMap.value(parentModule);
if (!parentItem)
{
parentItem = new ModuleItem(parentModule->get_id(), ModuleItem::TreeItemType::Module);
parentMap.insert(parentModule, parentItem);
}
else
{
insertToRoot = false;
}
parentItem->appendChild(childItem);
parentModule = parentModule->get_parent_module();
childItem = parentItem;
}

if (insertToRoot)
{
mRootItem->appendChild(parentItem);
}
}

setIsModifying(false);
endResetModel();
}

void ModuleModel::populateTree(const QVector<u32>& modIds, const QVector<u32>& gateIds, const QVector<u32>& netIds)
{
setIsModifying(true);
Expand Down
Loading

0 comments on commit 8a60288

Please sign in to comment.