aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-07-05 20:06:12 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-07-05 20:06:12 +0200
commit6b904aefd36192dd94bef727634c287845ef5062 (patch)
treee7e328eca1e764dc4fca16c78683c4552b5f2c44
parent2dd7c77abde16518ed670716a15d6e14e3a5091d (diff)
downloadnextpnr-6b904aefd36192dd94bef727634c287845ef5062.tar.gz
nextpnr-6b904aefd36192dd94bef727634c287845ef5062.tar.bz2
nextpnr-6b904aefd36192dd94bef727634c287845ef5062.zip
Display nets and cells as well
-rw-r--r--gui/basewindow.cc1
-rw-r--r--gui/basewindow.h1
-rw-r--r--gui/designwidget.cc52
-rw-r--r--gui/designwidget.h3
-rw-r--r--gui/ice40/mainwindow.cc4
5 files changed, 60 insertions, 1 deletions
diff --git a/gui/basewindow.cc b/gui/basewindow.cc
index 5d2e21cc..2463027a 100644
--- a/gui/basewindow.cc
+++ b/gui/basewindow.cc
@@ -69,6 +69,7 @@ BaseMainWindow::BaseMainWindow(QWidget *parent) : QMainWindow(parent), ctx(nullp
splitter_h->addWidget(designview);
connect(this, SIGNAL(contextChanged(Context *)), designview, SLOT(newContext(Context *)));
+ connect(this, SIGNAL(updateTreeView()), designview, SLOT(updateTree()));
connect(designview, SIGNAL(info(std::string)), this, SLOT(writeInfo(std::string)));
diff --git a/gui/basewindow.h b/gui/basewindow.h
index 6180e795..5c06fa6e 100644
--- a/gui/basewindow.h
+++ b/gui/basewindow.h
@@ -55,6 +55,7 @@ class BaseMainWindow : public QMainWindow
Q_SIGNALS:
void contextChanged(Context *ctx);
+ void updateTreeView();
protected:
Context *ctx;
diff --git a/gui/designwidget.cc b/gui/designwidget.cc
index 4656be02..48a05ed4 100644
--- a/gui/designwidget.cc
+++ b/gui/designwidget.cc
@@ -83,7 +83,7 @@ class PipTreeItem : public ElementTreeItem
IdString data;
};
-DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr)
+DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), nets_root(nullptr), cells_root(nullptr)
{
treeWidget = new QTreeWidget();
@@ -217,6 +217,56 @@ void DesignWidget::newContext(Context *ctx)
for (auto pip : pip_items.toStdMap()) {
pip_root->addChild(pip.second);
}
+
+ // Add nets to tree
+ nets_root = new QTreeWidgetItem(treeWidget);
+ nets_root->setText(0, QString("Nets"));
+ treeWidget->insertTopLevelItem(0, nets_root);
+
+ // Add cells to tree
+ cells_root = new QTreeWidgetItem(treeWidget);
+ cells_root->setText(0, QString("Cells"));
+ treeWidget->insertTopLevelItem(0, cells_root);
+
+}
+
+void DesignWidget::updateTree()
+{
+ delete nets_root;
+ delete cells_root;
+
+ // Add nets to tree
+ nets_root = new QTreeWidgetItem(treeWidget);
+ QMap<QString, QTreeWidgetItem *> nets_items;
+ nets_root->setText(0, QString("Nets"));
+ treeWidget->insertTopLevelItem(0, nets_root);
+ if (ctx) {
+ for (auto& item : ctx->nets) {
+ auto id = item.first;
+ QString name = QString(id.c_str(ctx));
+ nets_items.insert(name,new ElementTreeItem(ElementType::NONE, name, nullptr));
+ }
+ }
+ for (auto item : nets_items.toStdMap()) {
+ nets_root->addChild(item.second);
+ }
+
+ // Add cells to tree
+ cells_root = new QTreeWidgetItem(treeWidget);
+ QMap<QString, QTreeWidgetItem *> cells_items;
+ cells_root->setText(0, QString("Cells"));
+ treeWidget->insertTopLevelItem(0, cells_root);
+ if (ctx) {
+ for (auto& item : ctx->cells) {
+ auto id = item.first;
+ QString name = QString(id.c_str(ctx));
+ cells_items.insert(name,new ElementTreeItem(ElementType::NONE, name, nullptr));
+ }
+ }
+ for (auto item : cells_items.toStdMap()) {
+ cells_root->addChild(item.second);
+ }
+
}
void DesignWidget::addProperty(QtVariantProperty *property, const QString &id)
diff --git a/gui/designwidget.h b/gui/designwidget.h
index e3fbb19e..8e4be062 100644
--- a/gui/designwidget.h
+++ b/gui/designwidget.h
@@ -49,6 +49,7 @@ class DesignWidget : public QWidget
void selectObject();
public Q_SLOTS:
void newContext(Context *ctx);
+ void updateTree();
private:
Context *ctx;
@@ -62,6 +63,8 @@ class DesignWidget : public QWidget
QMap<QtProperty *, QString> propertyToId;
QMap<QString, QtVariantProperty *> idToProperty;
+ QTreeWidgetItem *nets_root;
+ QTreeWidgetItem *cells_root;
};
NEXTPNR_NAMESPACE_END
diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc
index c89b5d2d..6cc8bc38 100644
--- a/gui/ice40/mainwindow.cc
+++ b/gui/ice40/mainwindow.cc
@@ -272,6 +272,7 @@ void MainWindow::loadfile_finished(bool status)
log("Loading design successful.\n");
actionLoadPCF->setEnabled(true);
actionPack->setEnabled(true);
+ Q_EMIT updateTreeView();
} else {
log("Loading design failed.\n");
}
@@ -303,6 +304,7 @@ void MainWindow::pack_finished(bool status)
disableActions();
if (status) {
log("Packing design successful.\n");
+ Q_EMIT updateTreeView();
actionPlace->setEnabled(true);
actionAssignBudget->setEnabled(true);
} else {
@@ -326,6 +328,7 @@ void MainWindow::place_finished(bool status)
disableActions();
if (status) {
log("Placing design successful.\n");
+ Q_EMIT updateTreeView();
actionRoute->setEnabled(true);
} else {
log("Placing design failed.\n");
@@ -336,6 +339,7 @@ void MainWindow::route_finished(bool status)
disableActions();
if (status) {
log("Routing design successful.\n");
+ Q_EMIT updateTreeView();
actionSaveAsc->setEnabled(true);
} else
log("Routing design failed.\n");