HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
gate_pins_tree_model.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 "gui/new_selection_details_widget/models/base_tree_model.h"
29 #include "hal_core/defines.h"
33 #include <QMap>
34 #include <QList>
35 
36 namespace hal
37 {
38 
39  class Gate;
40 
45  {
46  public:
47  enum Type {None, Pin, Group};
48 
49  private:
50  Type mType;
51  QList<u32> mNetIds;
52  std::string mPinName;
53  PinDirection mPinDirection;
54  PinType mPinType;
55  QString mNetName;
56  int mIndex;
57  public:
58 
59  GatePinsTreeItem(const std::string& pinName, PinDirection pinDirection, PinType pinTypee, QString netName, int inx);
61  QVariant getData(int column) const override;
62  void setData(QList<QVariant> data) override;
63  void setDataAtColumn(int column, QVariant& data) override;
64  void appendData(QVariant data) override;
65  int getColumnCount() const override;
66  void setType(Type tp) { mType = tp; }
67 
73  Type type() const { return mType; }
74  std::string pinName() const { return mPinName; }
75  PinDirection direction() const { return mPinDirection; }
76  void setNetIds(const QList<u32>& nids) { mNetIds = nids; }
77 
85  QList<u32> netIds() const { return mNetIds; }
86  };
87 
93 {
94  Q_OBJECT
95 
96 public:
97 
103  GatePinsTreeModel(QObject* parent = nullptr);
104 
109 
113  void clear() override;
114 
120  void setGate(Gate* g);
121 
128  int getCurrentGateID();
129 
136 
137 
138  //column identifier
139  static const int sNameColumn = 0;
140  static const int sDirectionColumn = 1;
141  static const int sTypeColumn = 2;
142  static const int sConnectedNetColumn = 3;
143 
144 private:
145  int mGateId;
146  QMap<std::string, BaseTreeItem*> mPinGroupToTreeItem;
147 
148 };
149 
150 }
(Future) Base class for all tree models related to the details widget.
The BaseTreeModel implements generic standard functions of a tree model.
Definition: gate.h:58
void appendData(QVariant data) override
int getColumnCount() const override
void setDataAtColumn(int column, QVariant &data) override
void setData(QList< QVariant > data) override
std::string pinName() const
QVariant getData(int column) const override
void setNetIds(const QList< u32 > &nids)
PinDirection direction() const
QList< u32 > netIds() const
A model to display the pins of a gate.
GatePinsTreeModel(QObject *parent=nullptr)
static const int sConnectedNetColumn
static const int sDirectionColumn
Definition: defines.h:45
PinDirection
Definition: pin_direction.h:36
PinType
Definition: pin_type.h:36
Q_OBJECTQ_OBJECT
QObject * parent() const const