aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-07-23 19:53:56 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-07-23 19:54:36 +0200
commit139f7e0903b6c299b7c85bebfd7674933e952a50 (patch)
tree93e1cf48c0c28c0fc6420049325e4cce0b517c22
parent730e56e3ddf4959c061211eacf1180170b0c4b1b (diff)
downloadnextpnr-139f7e0903b6c299b7c85bebfd7674933e952a50.tar.gz
nextpnr-139f7e0903b6c299b7c85bebfd7674933e952a50.tar.bz2
nextpnr-139f7e0903b6c299b7c85bebfd7674933e952a50.zip
make update of tree for nets and cells partial
-rw-r--r--gui/designwidget.cc78
-rw-r--r--gui/ice40/worker.cc4
2 files changed, 56 insertions, 26 deletions
diff --git a/gui/designwidget.cc b/gui/designwidget.cc
index 7c40f16a..e63ee937 100644
--- a/gui/designwidget.cc
+++ b/gui/designwidget.cc
@@ -338,48 +338,78 @@ void DesignWidget::newContext(Context *ctx)
for (auto pip : nameToItem[2].toStdMap()) {
pip_root->addChild(pip.second);
}
+
+ nets_root = new QTreeWidgetItem(treeWidget);
+ nets_root->setText(0, "Nets");
+ treeWidget->insertTopLevelItem(0, nets_root);
+
+ cells_root = new QTreeWidgetItem(treeWidget);
+ cells_root->setText(0, "Cells");
+ treeWidget->insertTopLevelItem(0, cells_root);
+
updateTree();
}
void DesignWidget::updateTree()
{
+ if (!ctx)
+ return;
+
clearProperties();
- delete nets_root;
- delete cells_root;
- nameToItem[3].clear();
- nameToItem[4].clear();
+ // treeWidget->setSortingEnabled(false);
+
+ // Remove nets not existing any more
+ QMap<QString, QTreeWidgetItem *>::iterator i = nameToItem[3].begin();
+ while (i != nameToItem[3].end()) {
+ QMap<QString, QTreeWidgetItem *>::iterator prev = i;
+ ++i;
+ if (ctx->nets.find(ctx->id(prev.key().toStdString())) == ctx->nets.end()) {
+ if (treeWidget->currentItem() == prev.value())
+ treeWidget->setCurrentItem(nets_root);
+ if (highlightSelected.contains(prev.value()))
+ highlightSelected.remove(prev.value());
+ delete prev.value();
+ nameToItem[3].erase(prev);
+ }
+ }
// Add nets to tree
- nets_root = new QTreeWidgetItem(treeWidget);
- nets_root->setText(0, "Nets");
- treeWidget->insertTopLevelItem(0, nets_root);
- if (ctx) {
- for (auto &item : ctx->nets) {
- auto id = item.first;
- QString name = QString(id.c_str(ctx));
+ for (auto &item : ctx->nets) {
+ auto id = item.first;
+ QString name = QString(id.c_str(ctx));
+ if (!nameToItem[3].contains(name)) {
IdStringTreeItem *newItem = new IdStringTreeItem(id, ElementType::NET, name, nullptr);
+ nets_root->addChild(newItem);
nameToItem[3].insert(name, newItem);
}
}
- for (auto item : nameToItem[3].toStdMap()) {
- nets_root->addChild(item.second);
- }
+ // Remove cells not existing any more
+ i = nameToItem[4].begin();
+ while (i != nameToItem[4].end()) {
+ QMap<QString, QTreeWidgetItem *>::iterator prev = i;
+ ++i;
+ if (ctx->cells.find(ctx->id(prev.key().toStdString())) == ctx->cells.end()) {
+ if (treeWidget->currentItem() == prev.value())
+ treeWidget->setCurrentItem(cells_root);
+ if (highlightSelected.contains(prev.value()))
+ highlightSelected.remove(prev.value());
+ delete prev.value();
+ nameToItem[4].erase(prev);
+ }
+ }
// Add cells to tree
- cells_root = new QTreeWidgetItem(treeWidget);
- cells_root->setText(0, "Cells");
- treeWidget->insertTopLevelItem(0, cells_root);
- if (ctx) {
- for (auto &item : ctx->cells) {
- auto id = item.first;
- QString name = QString(id.c_str(ctx));
+ for (auto &item : ctx->cells) {
+ auto id = item.first;
+ QString name = QString(id.c_str(ctx));
+ if (!nameToItem[4].contains(name)) {
IdStringTreeItem *newItem = new IdStringTreeItem(id, ElementType::CELL, name, nullptr);
+ cells_root->addChild(newItem);
nameToItem[4].insert(name, newItem);
}
}
- for (auto item : nameToItem[4].toStdMap()) {
- cells_root->addChild(item.second);
- }
+ // treeWidget->sortByColumn(0, Qt::AscendingOrder);
+ // treeWidget->setSortingEnabled(true);
}
QtProperty *DesignWidget::addTopLevelProperty(const QString &id)
{
diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc
index d339d652..fd46ecad 100644
--- a/gui/ice40/worker.cc
+++ b/gui/ice40/worker.cc
@@ -108,7 +108,7 @@ void Worker::budget(double freq)
{
Q_EMIT taskStarted();
try {
- ctx->target_freq = freq;
+ ctx->target_freq = freq;
Q_EMIT budget_finish(true);
} catch (WorkerInterruptionRequested) {
Q_EMIT taskCanceled();
@@ -120,7 +120,7 @@ void Worker::place(bool timing_driven)
Q_EMIT taskStarted();
try {
ctx->timing_driven = timing_driven;
- log_info("Assigned budget %0.2f MHz",ctx->target_freq / 1e6);
+ log_info("Assigned budget %0.2f MHz", ctx->target_freq / 1e6);
assign_budget(ctx);
Q_EMIT place_finished(ctx->place());
} catch (WorkerInterruptionRequested) {