Skip to content

Commit e49c63a

Browse files
author
Julian Speith
committed
Merge branch 'master' into fix/pin_group_indices
2 parents 5b20126 + f5844cd commit e49c63a

8 files changed

Lines changed: 89 additions & 65 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
1414
* added build support for RedHat Enterprise Linux
1515
* fixed `netlist_preprocessing` build dependencies
1616

17+
* added column for pin index in pin tree shown in selection details
1718
* fixed availability of "save as" so that does not required modifications to be enabaled
1819
* added feature to unzip and open hal project by dropping zipped file on welcome screen
1920
* added `get_shortest_path` overload to find shortest path from gate to module

cmake/hal_cmake_tools.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function(setup_output_directories)
9696
if(NOT CMAKE_${i}_OUTPUT_DIRECTORY)
9797
set(CMAKE_${i}_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}${appendix}" CACHE INTERNAL "")
9898
message(VERBOSE "CMAKE_${i}_OUTPUT_DIRECTORY: ${CMAKE_${i}_OUTPUT_DIRECTORY}")
99-
elseif()
99+
else()
100100
set(CMAKE_${i}_OUTPUT_DIRECTORY "${CMAKE_${i}_OUTPUT_DIRECTORY}${appendix}" CACHE INTERNAL "")
101101
message(VERBOSE "CMAKE_${i}_OUTPUT_DIRECTORY: ${CMAKE_${i}_OUTPUT_DIRECTORY}")
102102
endif()

plugins/gui/include/gui/selection_details_widget/gate_details_widget/pin_tree_model.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ namespace hal
4848
QString mPinDirection;
4949
QString mPinType;
5050
QString mNetName;
51+
int mIndex;
5152
public:
5253

53-
PinTreeItem(const std::string& pinName, QString pinDirection, QString pinTypee, QString netName);
54+
PinTreeItem(const std::string& pinName, QString pinDirection, QString pinTypee, QString netName, int inx);
5455
PinTreeItem();
5556
QVariant getData(int column) const override;
5657
void setData(QList<QVariant> data) override;

plugins/gui/include/gui/selection_details_widget/module_details_widget/port_tree_model.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ namespace hal
5050
PinDirection mPinDirection;
5151
PinType mPinType;
5252
QString mNetName;
53+
int mIndex;
5354

5455
public:
5556

56-
PortTreeItem(Type itype, u32 id_, QString pinName, PinDirection dir, PinType ptype, QString netName = QString());
57+
PortTreeItem(Type itype, u32 id_, QString pinName, PinDirection dir, PinType ptype, int inx, QString netName = QString());
5758
PortTreeItem() : mItemType(None), mId(0) {;}
5859
QVariant getData(int column) const override;
5960
void setData(QList<QVariant> data) override;

plugins/gui/src/selection_details_widget/gate_details_widget/pin_tree_model.cpp

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace hal
1313
{
1414

15-
PinTreeItem::PinTreeItem(const std::string &pinName, QString pinDirection, QString pinType, QString netName)
16-
:mPinName(pinName), mPinDirection(pinDirection), mPinType(pinType), mNetName(netName)
15+
PinTreeItem::PinTreeItem(const std::string &pinName, QString pinDirection, QString pinType, QString netName, int inx)
16+
:mPinName(pinName), mPinDirection(pinDirection), mPinType(pinType), mNetName(netName), mIndex(inx)
1717
{;}
1818

1919
PinTreeItem::PinTreeItem()
@@ -23,50 +23,51 @@ namespace hal
2323
{
2424
switch (index)
2525
{
26-
case 0: {
27-
QVariant qvPinName = QVariant(QString::fromStdString(mPinName));
28-
return qvPinName;
29-
break;}
30-
case 1: {
31-
QVariant qvPinDirection = QVariant(mPinDirection);
32-
return qvPinDirection;
33-
break;}
34-
case 2: {
35-
QVariant qvPinType = QVariant(mPinType);
36-
return qvPinType;
37-
break;}
38-
case 3: {
39-
QVariant qvNetName = QVariant(mNetName);
40-
return qvNetName;
41-
break;}
26+
case 0:
27+
return QString::fromStdString(mPinName);
28+
case 1:
29+
return mPinDirection;
30+
case 2:
31+
return mPinType;
32+
case 3:
33+
return mNetName;
34+
case 4:
35+
if (mType == PinTreeItem::Group)
36+
return (mIndex ? "descending" : "ascending");
37+
return mIndex;
4238
}
4339
return QVariant();
4440
}
4541

4642
void PinTreeItem::setData(QList<QVariant> data)
4743
{
44+
Q_ASSERT(data.size() >= 5);
4845
mPinName = data[0].toString().toStdString();
4946
mPinDirection = data[1].toString();
5047
mPinType = data[2].toString();
5148
mNetName = data[3].toString();
49+
mIndex = data[4].toInt();
5250
}
5351

5452
void PinTreeItem::setDataAtIndex(int index, QVariant &data)
5553
{
5654
switch (index)
5755
{
58-
case 0: {
56+
case 0:
5957
mPinName = data.toString().toStdString();
60-
break;}
61-
case 1: {
58+
break;
59+
case 1:
6260
mPinDirection = data.toString();
63-
break;}
64-
case 2: {
61+
break;
62+
case 2:
6563
mPinType = data.toString();
66-
break;}
67-
case 3: {
64+
break;
65+
case 3:
6866
mNetName = data.toString();
69-
break;}
67+
break;
68+
case 4:
69+
mIndex = data.toInt();
70+
break;
7071
}
7172

7273

@@ -76,15 +77,16 @@ namespace hal
7677

7778
int PinTreeItem::getColumnCount() const
7879
{
79-
return 4;
80+
return 5;
8081
}
8182

8283
GatePinsTreeModel::GatePinsTreeModel(QObject* parent) : BaseTreeModel(parent)
8384
{
8485
setHeaderLabels(QStringList() << "Name"
8586
<< "Direction"
8687
<< "Type"
87-
<< "Connected Net");
88+
<< "Connected Net"
89+
<< "Index");
8890

8991
//added to store a list of (multiple) net ids in a given treeitem (perhaps dont do this
9092
//at all, handle it in the view? (since the gate-id and pin name is accessable, the nets can be evaluated there
@@ -114,7 +116,10 @@ namespace hal
114116
{
115117
PinTreeItem* pinItem = new PinTreeItem();
116118
//get all infos for that pin
117-
const std::string& grouping = pin->get_group().first->get_name();
119+
const PinGroup<GatePin>* pg = pin->get_group().first;
120+
const std::string& grpName = pg->get_name();
121+
int iDescending = pg->is_ascending() ? 0 : 1;
122+
int inx = pin->get_group().second;
118123
PinDirection direction = pin->get_direction();
119124
QString pinDirection = QString::fromStdString(enum_to_string(direction));
120125
QString pinType = QString::fromStdString(enum_to_string(pin->get_type()));
@@ -158,19 +163,19 @@ namespace hal
158163
break; //none and internal, dont know how to handle internal (whatever an internal pin is)
159164
}
160165

161-
pinItem->setData(QList<QVariant>() << QString::fromStdString(pin->get_name()) << pinDirection << pinType << netName);
166+
pinItem->setData(QList<QVariant>() << QString::fromStdString(pin->get_name()) << pinDirection << pinType << netName << inx);
162167
pinItem->setType(PinTreeItem::Pin);
163168
pinItem->setNetIds(netIDs);
164-
if (!grouping.empty())
169+
if (!grpName.empty())
165170
{
166-
PinTreeItem* pingroupItem = dynamic_cast<PinTreeItem*>(mPinGroupToTreeItem.value(grouping, nullptr)); //since its a map, its okay
171+
PinTreeItem* pingroupItem = dynamic_cast<PinTreeItem*>(mPinGroupToTreeItem.value(grpName, nullptr)); //since its a map, its okay
167172
if (!pingroupItem)
168173
{
169174
//assume all items in the same grouping habe the same direction and type, so the grouping-item has also these types
170-
pingroupItem = new PinTreeItem(grouping, pinDirection, pinType, "");
175+
pingroupItem = new PinTreeItem(grpName, pinDirection, pinType, "", iDescending);
171176
pingroupItem->setType(PinTreeItem::Group);
172177
mRootItem->appendChild(pingroupItem);
173-
mPinGroupToTreeItem.insert(grouping, pingroupItem);
178+
mPinGroupToTreeItem.insert(grpName, pingroupItem);
174179
}
175180
pingroupItem->appendChild(pinItem);
176181
}

plugins/gui/src/selection_details_widget/module_details_widget/port_tree_model.cpp

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
namespace hal
2121
{
22-
PortTreeItem::PortTreeItem(Type itype, u32 id_, QString pinName, PinDirection dir, PinType ptype, QString netName)
23-
: mItemType(itype), mId(id_), mPinName(pinName), mPinDirection(dir), mPinType(ptype), mNetName(netName)
22+
PortTreeItem::PortTreeItem(Type itype, u32 id_, QString pinName, PinDirection dir, PinType ptype, int inx, QString netName)
23+
: mItemType(itype), mId(id_), mPinName(pinName), mPinDirection(dir), mPinType(ptype), mNetName(netName), mIndex(inx)
2424
{;}
2525

2626
QVariant PortTreeItem::getData(int index) const
@@ -35,34 +35,43 @@ namespace hal
3535
return QString::fromStdString(enum_to_string(mPinType));
3636
case 3:
3737
return mNetName;
38+
case 4:
39+
if (mItemType==PortTreeItem::Group)
40+
return ( mIndex ? "descending" : "ascending");
41+
return mIndex;
3842
}
3943
return QVariant();
4044
}
4145

4246
void PortTreeItem::setData(QList<QVariant> data)
4347
{
48+
Q_ASSERT(data.size() >= 5);
4449
mPinName = data[0].toString();
4550
mPinDirection = enum_from_string<PinDirection>(data[1].toString().toStdString());
4651
mPinType = enum_from_string<PinType>(data[2].toString().toStdString());
4752
mNetName = data[3].toString();
53+
mIndex = data[4].toInt();
4854
}
4955

5056
void PortTreeItem::setDataAtIndex(int index, QVariant &data)
5157
{
5258
switch (index)
5359
{
54-
case 0: {
60+
case 0:
5561
mPinName = data.toString();
56-
break;}
57-
case 1: {
62+
break;
63+
case 1:
5864
mPinDirection = enum_from_string<PinDirection>(data.toString().toStdString());
59-
break;}
60-
case 2: {
65+
break;
66+
case 2:
6167
mPinType = enum_from_string<PinType>(data.toString().toStdString());
62-
break;}
63-
case 3: {
68+
break;
69+
case 3:
6470
mNetName = data.toString();
65-
break;}
71+
break;
72+
case 4:
73+
mIndex = data.toInt();
74+
break;
6675
}
6776
}
6877

@@ -73,15 +82,16 @@ namespace hal
7382

7483
int PortTreeItem::getColumnCount() const
7584
{
76-
return 4;
85+
return 5;
7786
}
7887

7988
ModulePinsTreeModel::ModulePinsTreeModel(QObject* parent) : BaseTreeModel(parent)
8089
{
8190
setHeaderLabels(QStringList() << "Name"
8291
<< "Direction"
8392
<< "Type"
84-
<< "Connected Net");
93+
<< "Connected Net"
94+
<< "Index");
8595
setModule(gNetlist->get_module_by_id(1));
8696

8797
//connections
@@ -132,7 +142,7 @@ namespace hal
132142

133143
QMimeData* ModulePinsTreeModel::mimeData(const QModelIndexList& indexes) const
134144
{
135-
if (indexes.size() != 4) //columncount, only 1 item is allowed
145+
if (indexes.size() != 5) //columncount, only 1 item is allowed
136146
return new QMimeData();
137147

138148
QMimeData* data = new QMimeData();
@@ -281,7 +291,8 @@ namespace hal
281291
continue;
282292

283293
auto pinGroupName = QString::fromStdString(pinGroup->get_name());
284-
PortTreeItem* pinGroupItem = new PortTreeItem(PortTreeItem::Group, pinGroup->get_id(), pinGroupName, pinGroup->get_direction(), pinGroup->get_type());
294+
PortTreeItem* pinGroupItem = new PortTreeItem(PortTreeItem::Group, pinGroup->get_id(), pinGroupName, pinGroup->get_direction(),
295+
pinGroup->get_type(), pinGroup->is_ascending() ? 0 : 1);
285296
mIdToGroupItem.insert(pinGroup->get_id(), pinGroupItem);
286297
for(ModulePin* pin : pinGroup->get_pins())
287298
{
@@ -290,6 +301,7 @@ namespace hal
290301
QString::fromStdString(pin->get_name()),
291302
pin->get_direction(),
292303
pin->get_type(),
304+
pin->get_group().second,
293305
QString::fromStdString(pin->get_net()->get_name()));
294306
pinGroupItem->appendChild(pinItem);
295307
mNameToTreeItem.insert(QString::fromStdString(pin->get_name()), pinItem);
@@ -452,9 +464,10 @@ namespace hal
452464
{
453465
ptiGroup = new PortTreeItem(PortTreeItem::Group,
454466
pgroup->get_id(),
455-
QString::fromStdString(pgroup->get_name()),
456-
pgroup->get_direction(),
457-
pgroup->get_type());
467+
QString::fromStdString(pgroup->get_name()),
468+
pgroup->get_direction(),
469+
pgroup->get_type(),
470+
pgroup->is_ascending()?0:1);
458471
mIdToGroupItem.insert(ptiGroup->id(), ptiGroup);
459472
int inx = pinGroupIndex(m,pgroup);
460473
insertItem(ptiGroup, mRootItem, inx);
@@ -498,6 +511,7 @@ namespace hal
498511
QString::fromStdString(pin->get_name()),
499512
pin->get_direction(),
500513
pin->get_type(),
514+
pin->get_group().second,
501515
netName);
502516
mIdToPinItem.insert(ptiPin->id(), ptiPin);
503517
insertItem(ptiPin, ptiGroup, pinRow);

src/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ target_compile_options(core
2222
INTERFACE ${COMPILE_OPTIONS_INTERFACE})
2323
set_target_properties(PROPERTIES DEFINE_SYMBOL BUILDING_CORE)
2424

25+
# use cmake setup from boost library if provided
26+
if (POLICY CMP0167)
27+
cmake_policy (SET CMP0167 NEW)
28+
endif ()
2529
set(Boost_USE_MULTITHREADED ON)
26-
find_package(Boost REQUIRED COMPONENTS system)
30+
#find_package(Boost REQUIRED COMPONENTS system)
31+
set (BOOST_REQUIRED_COMPONENTS system)
32+
find_package(Boost REQUIRED)
2733

2834
if(Boost_FOUND)
2935
include_directories(${Boost_INCLUDE_DIRS})

src/python_bindings/bindings/module.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ namespace hal
118118
:rtype: hal_py.Module or None
119119
)");
120120

121-
py_module.def_property_readonly(
122-
"parent_modules", [](Module* mod) { return mod->get_parent_modules(); }, R"(
121+
py_module.def_property_readonly("parent_modules", [](Module* mod) { return mod->get_parent_modules(); }, R"(
123122
The parent modules of this module.
124123
125124
:type: list[hal_py.Module]
@@ -154,8 +153,7 @@ namespace hal
154153
:rtype: bool
155154
)");
156155

157-
py_module.def_property_readonly(
158-
"submodules", [](Module* mod) { return mod->get_submodules(); }, R"(
156+
py_module.def_property_readonly("submodules", [](Module* mod) { return mod->get_submodules(); }, R"(
159157
A list of all direct submodules of this module.
160158
161159
:type: list[hal_py.Module]
@@ -203,15 +201,13 @@ namespace hal
203201
:rtype: bool
204202
)");
205203

206-
py_module.def_property_readonly(
207-
"netlist", [](Module* module) { return RawPtrWrapper<Netlist>(module->get_netlist()); }, R"(
204+
py_module.def_property_readonly("netlist", [](Module* module) { return RawPtrWrapper<Netlist>(module->get_netlist()); }, R"(
208205
The netlist this module is associated with.
209206
210207
:type: hal_py.Netlist
211208
)");
212209

213-
py_module.def(
214-
"get_netlist", [](Module* module) { return RawPtrWrapper<Netlist>(module->get_netlist()); }, R"(
210+
py_module.def("get_netlist", [](Module* module) { return RawPtrWrapper<Netlist>(module->get_netlist()); }, R"(
215211
Get the netlist this module is associated with.
216212
217213
:returns: The netlist.
@@ -709,7 +705,7 @@ namespace hal
709705
},
710706
py::arg("id"),
711707
py::arg("name"),
712-
py::arg("pins"),
708+
py::arg("pins") = std::vector<ModulePin*>(),
713709
py::arg("direction") = PinDirection::none,
714710
py::arg("type") = PinType::none,
715711
py::arg("ascending") = true,
@@ -756,7 +752,7 @@ namespace hal
756752
}
757753
},
758754
py::arg("name"),
759-
py::arg("pins"),
755+
py::arg("pins") = std::vector<ModulePin*>(),
760756
py::arg("direction") = PinDirection::none,
761757
py::arg("type") = PinType::none,
762758
py::arg("ascending") = true,

0 commit comments

Comments
 (0)