HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
logic_evaluator_truthtable.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
26 #pragma once
27 
28 #include <QDialog>
29 #include <QAbstractTableModel>
30 #include <QList>
31 #include <QComboBox>
32 
33 namespace hal {
34  class Net;
35 
40  {
41  int mRows;
42  int* mArray;
43  public:
44  LogicEvaluatorTruthtableColumn(int nrows, QList<int> values);
46  int data(int irow) const;
47  bool lessThan(const LogicEvaluatorTruthtableColumn& other, const QList<int>& sortRows) const;
48  };
49 
54  {
55  Q_OBJECT
56  public:
58  private:
59  DisplayFormat mDisplayFormat;
60  QList<const Net*> mInputList;
61  QList<const Net*> mOutputList;
63  int mInputSize;
64  int mOutputSize;
65  public Q_SLOTS:
66  void sortModelRow(int irow);
67  void sortModelRows(const QList<int>& sortRows);
68  public:
69  LogicEvaluatorTruthtableModel(const QList<const Net*>& inpList, const QList<const Net*>& outList, QObject* parent = nullptr);
71  QList<const Net*> getNets() const { return mInputList + mOutputList; }
72  QMap<const Net*, int> selectedColumn(int icol) const;
73 
76  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
77  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
78  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
79  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
80  };
81 
86  {
87  Q_OBJECT
88  QComboBox* mSortKey[5];
89  QList<const Net*> mNets;
90  public:
92  QList<int> sortOrder() const;
93  };
94 
99  {
100  Q_OBJECT
101  QAction* mActionDisplayFormat[LogicEvaluatorTruthtableModel::MAXFORMAT];
102  QAction* mActionSort;
104  int mColumnDubbleClicked;
105  private Q_SLOT:
106  void handleDisplayFormatChanged(QAction* act);
107  void handleSortTriggered();
108  void handleColumnDubbleClicked(int icol);
109  public:
112  };
113 }
LogicEvaluatorTruthtableColumn(int nrows, QList< int > values)
bool lessThan(const LogicEvaluatorTruthtableColumn &other, const QList< int > &sortRows) const
LogicEvaluatorTruthtable(LogicEvaluatorTruthtableModel *model, QWidget *parent=nullptr)
QMap< const Net *, int > selectedColumn() const
int rowCount(const QModelIndex &parent=QModelIndex()) const override
LogicEvaluatorTruthtableModel(const QList< const Net * > &inpList, const QList< const Net * > &outList, QObject *parent=nullptr)
void sortModelRows(const QList< int > &sortRows)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QMap< const Net *, int > selectedColumn(int icol) const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void addColumn(LogicEvaluatorTruthtableColumn *letc)
LogicEvaluatorTruthtableSort(QList< const Net * > &nets, QWidget *parent=nullptr)
Definition: defines.h:45
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_OBJECTQ_OBJECT
Q_SLOTQ_SLOT
Q_SLOTSQ_SLOTS
QObject * parent() const const
DisplayRole
Orientation