aboutsummaryrefslogtreecommitdiffstats
path: root/gui/ice40
diff options
context:
space:
mode:
Diffstat (limited to 'gui/ice40')
-rw-r--r--gui/ice40/mainwindow.cc286
-rw-r--r--gui/ice40/mainwindow.h36
-rw-r--r--gui/ice40/nextpnr.qrc8
-rw-r--r--gui/ice40/resources/control_pause.pngbin721 -> 0 bytes
-rw-r--r--gui/ice40/resources/control_play.pngbin717 -> 0 bytes
-rw-r--r--gui/ice40/resources/control_stop.pngbin695 -> 0 bytes
-rw-r--r--gui/ice40/resources/open_json.pngbin2093 -> 0 bytes
-rw-r--r--gui/ice40/resources/pack.pngbin853 -> 0 bytes
-rw-r--r--gui/ice40/resources/place.pngbin825 -> 0 bytes
-rw-r--r--gui/ice40/resources/route.pngbin683 -> 0 bytes
-rw-r--r--gui/ice40/resources/time_add.pngbin827 -> 0 bytes
-rw-r--r--gui/ice40/worker.cc221
-rw-r--r--gui/ice40/worker.h110
13 files changed, 38 insertions, 623 deletions
diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc
index f06971b6..2fa2e561 100644
--- a/gui/ice40/mainwindow.cc
+++ b/gui/ice40/mainwindow.cc
@@ -37,130 +37,45 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
NEXTPNR_NAMESPACE_BEGIN
MainWindow::MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent)
- : BaseMainWindow(std::move(context), parent), timing_driven(false), chipArgs(args)
+ : BaseMainWindow(std::move(context), parent), chipArgs(args)
{
initMainResource();
std::string title = "nextpnr-ice40 - [EMPTY]";
setWindowTitle(title.c_str());
- task = new TaskManager();
- connect(task, SIGNAL(log(std::string)), this, SLOT(writeInfo(std::string)));
-
- connect(task, SIGNAL(loadfile_finished(bool)), this, SLOT(loadfile_finished(bool)));
- connect(task, SIGNAL(loadpcf_finished(bool)), this, SLOT(loadpcf_finished(bool)));
- connect(task, SIGNAL(saveasc_finished(bool)), this, SLOT(saveasc_finished(bool)));
- connect(task, SIGNAL(pack_finished(bool)), this, SLOT(pack_finished(bool)));
- connect(task, SIGNAL(budget_finish(bool)), this, SLOT(budget_finish(bool)));
- connect(task, SIGNAL(place_finished(bool)), this, SLOT(place_finished(bool)));
- connect(task, SIGNAL(route_finished(bool)), this, SLOT(route_finished(bool)));
-
- connect(task, SIGNAL(taskCanceled()), this, SLOT(taskCanceled()));
- connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted()));
- connect(task, SIGNAL(taskPaused()), this, SLOT(taskPaused()));
-
- connect(this, SIGNAL(contextChanged(Context *)), this, SLOT(newContext(Context *)));
- connect(this, SIGNAL(contextChanged(Context *)), task, SIGNAL(contextChanged(Context *)));
+ connect(this, &BaseMainWindow::contextChanged, this, &MainWindow::newContext);
createMenu();
Q_EMIT contextChanged(ctx.get());
}
-MainWindow::~MainWindow() { delete task; }
+MainWindow::~MainWindow() {}
void MainWindow::createMenu()
{
- QMenu *menu_Design = new QMenu("&Design", menuBar);
- menuBar->addAction(menu_Design->menuAction());
-
- actionLoadJSON = new QAction("Open JSON", this);
- actionLoadJSON->setIcon(QIcon(":/icons/resources/open_json.png"));
- actionLoadJSON->setStatusTip("Open an existing JSON file");
- actionLoadJSON->setEnabled(true);
- connect(actionLoadJSON, SIGNAL(triggered()), this, SLOT(open_json()));
-
+ // Add arch specific actions
actionLoadPCF = new QAction("Open PCF", this);
actionLoadPCF->setIcon(QIcon(":/icons/resources/open_pcf.png"));
actionLoadPCF->setStatusTip("Open PCF file");
actionLoadPCF->setEnabled(false);
- connect(actionLoadPCF, SIGNAL(triggered()), this, SLOT(open_pcf()));
-
- actionPack = new QAction("Pack", this);
- actionPack->setIcon(QIcon(":/icons/resources/pack.png"));
- actionPack->setStatusTip("Pack current design");
- actionPack->setEnabled(false);
- connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
-
- actionAssignBudget = new QAction("Assign Budget", this);
- actionAssignBudget->setIcon(QIcon(":/icons/resources/time_add.png"));
- actionAssignBudget->setStatusTip("Assign time budget for current design");
- actionAssignBudget->setEnabled(false);
- connect(actionAssignBudget, SIGNAL(triggered()), this, SLOT(budget()));
-
- actionPlace = new QAction("Place", this);
- actionPlace->setIcon(QIcon(":/icons/resources/place.png"));
- actionPlace->setStatusTip("Place current design");
- actionPlace->setEnabled(false);
- connect(actionPlace, SIGNAL(triggered()), this, SLOT(place()));
-
- actionRoute = new QAction("Route", this);
- actionRoute->setIcon(QIcon(":/icons/resources/route.png"));
- actionRoute->setStatusTip("Route current design");
- actionRoute->setEnabled(false);
- connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
+ connect(actionLoadPCF, &QAction::triggered, this, &MainWindow::open_pcf);
actionSaveAsc = new QAction("Save ASC", this);
actionSaveAsc->setIcon(QIcon(":/icons/resources/save_asc.png"));
actionSaveAsc->setStatusTip("Save ASC file");
actionSaveAsc->setEnabled(false);
- connect(actionSaveAsc, SIGNAL(triggered()), this, SLOT(save_asc()));
-
- QToolBar *taskFPGABar = new QToolBar();
- addToolBar(Qt::TopToolBarArea, taskFPGABar);
-
- taskFPGABar->addAction(actionLoadJSON);
- taskFPGABar->addAction(actionLoadPCF);
- taskFPGABar->addAction(actionPack);
- taskFPGABar->addAction(actionAssignBudget);
- taskFPGABar->addAction(actionPlace);
- taskFPGABar->addAction(actionRoute);
- taskFPGABar->addAction(actionSaveAsc);
-
- menu_Design->addAction(actionLoadJSON);
- menu_Design->addAction(actionLoadPCF);
- menu_Design->addAction(actionPack);
- menu_Design->addAction(actionAssignBudget);
- menu_Design->addAction(actionPlace);
- menu_Design->addAction(actionRoute);
- menu_Design->addAction(actionSaveAsc);
-
- actionPlay = new QAction("Play", this);
- actionPlay->setIcon(QIcon(":/icons/resources/control_play.png"));
- actionPlay->setStatusTip("Continue running task");
- actionPlay->setEnabled(false);
- connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
-
- actionPause = new QAction("Pause", this);
- actionPause->setIcon(QIcon(":/icons/resources/control_pause.png"));
- actionPause->setStatusTip("Pause running task");
- actionPause->setEnabled(false);
- connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread()));
-
- actionStop = new QAction("Stop", this);
- actionStop->setIcon(QIcon(":/icons/resources/control_stop.png"));
- actionStop->setStatusTip("Stop running task");
- actionStop->setEnabled(false);
- connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread()));
-
- QToolBar *taskToolBar = new QToolBar();
- addToolBar(Qt::TopToolBarArea, taskToolBar);
-
- taskToolBar->addAction(actionPlay);
- taskToolBar->addAction(actionPause);
- taskToolBar->addAction(actionStop);
-
- createGraphicsBar();
+ connect(actionSaveAsc, &QAction::triggered, this, &MainWindow::save_asc);
+
+ // Add actions in menus
+ mainActionBar->addSeparator();
+ mainActionBar->addAction(actionLoadPCF);
+ mainActionBar->addAction(actionSaveAsc);
+
+ menuDesign->addSeparator();
+ menuDesign->addAction(actionLoadPCF);
+ menuDesign->addAction(actionSaveAsc);
}
#if defined(_MSC_VER)
@@ -238,19 +153,18 @@ void MainWindow::new_proj()
}
}
-void MainWindow::load_json(std::string filename, std::string pcf)
-{
- disableActions();
- currentJson = filename;
- currentPCF = pcf;
- Q_EMIT task->loadfile(filename);
-}
-
void MainWindow::load_pcf(std::string filename)
{
disableActions();
currentPCF = filename;
- Q_EMIT task->loadpcf(filename);
+ std::ifstream f(filename);
+ if (apply_pcf(ctx.get(), f)) {
+ log("Loading PCF successful.\n");
+ actionPack->setEnabled(true);
+ } else {
+ actionLoadPCF->setEnabled(true);
+ log("Loading PCF failed.\n");
+ }
}
void MainWindow::newContext(Context *ctx)
@@ -331,20 +245,14 @@ void MainWindow::open_proj()
}
log_info("Loading json: %s...\n", json.c_str());
- load_json(json, pcf);
+ load_json(json);
+ if (!pcf.empty())
+ load_pcf(json);
} catch (log_execution_error_exception) {
}
}
}
-void MainWindow::open_json()
-{
- QString fileName = QFileDialog::getOpenFileName(this, QString("Open JSON"), QString(), QString("*.json"));
- if (!fileName.isEmpty()) {
- load_json(fileName.toStdString(), "");
- }
-}
-
void MainWindow::open_pcf()
{
QString fileName = QFileDialog::getOpenFileName(this, QString("Open PCF"), QString(), QString("*.pcf"));
@@ -389,149 +297,19 @@ void MainWindow::save_asc()
if (!fileName.isEmpty()) {
std::string fn = fileName.toStdString();
disableActions();
- Q_EMIT task->saveasc(fn);
+ std::ofstream f(fn);
+ write_asc(ctx.get(), f);
+ log("Saving ASC successful.\n");
}
}
-void MainWindow::disableActions()
+void MainWindow::onDisableActions()
{
- actionLoadJSON->setEnabled(false);
actionLoadPCF->setEnabled(false);
- actionPack->setEnabled(false);
- actionAssignBudget->setEnabled(false);
- actionPlace->setEnabled(false);
- actionRoute->setEnabled(false);
actionSaveAsc->setEnabled(false);
-
- actionPlay->setEnabled(false);
- actionPause->setEnabled(false);
- actionStop->setEnabled(false);
-
- actionNew->setEnabled(true);
- actionOpen->setEnabled(true);
- actionSave->setEnabled(!currentJson.empty());
-}
-
-void MainWindow::loadfile_finished(bool status)
-{
- disableActions();
- if (status) {
- log("Loading design successful.\n");
- actionLoadPCF->setEnabled(true);
- actionPack->setEnabled(true);
- if (!currentPCF.empty())
- load_pcf(currentPCF);
- Q_EMIT updateTreeView();
- } else {
- log("Loading design failed.\n");
- currentPCF = "";
- }
-}
-
-void MainWindow::loadpcf_finished(bool status)
-{
- disableActions();
- if (status) {
- log("Loading PCF successful.\n");
- actionPack->setEnabled(true);
- } else {
- log("Loading PCF failed.\n");
- }
-}
-
-void MainWindow::saveasc_finished(bool status)
-{
- disableActions();
- if (status) {
- log("Saving ASC successful.\n");
- } else {
- log("Saving ASC failed.\n");
- }
-}
-
-void MainWindow::pack_finished(bool status)
-{
- disableActions();
- if (status) {
- log("Packing design successful.\n");
- Q_EMIT updateTreeView();
- actionPlace->setEnabled(true);
- actionAssignBudget->setEnabled(true);
- } else {
- log("Packing design failed.\n");
- }
-}
-
-void MainWindow::budget_finish(bool status)
-{
- disableActions();
- if (status) {
- log("Assigning timing budget successful.\n");
- actionPlace->setEnabled(true);
- } else {
- log("Assigning timing budget failed.\n");
- }
-}
-
-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");
- }
-}
-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");
-}
-
-void MainWindow::taskCanceled()
-{
- log("CANCELED\n");
- disableActions();
-}
-
-void MainWindow::taskStarted()
-{
- disableActions();
- actionPause->setEnabled(true);
- actionStop->setEnabled(true);
-
- actionNew->setEnabled(false);
- actionOpen->setEnabled(false);
-}
-
-void MainWindow::taskPaused()
-{
- disableActions();
- actionPlay->setEnabled(true);
- actionStop->setEnabled(true);
-
- actionNew->setEnabled(false);
- actionOpen->setEnabled(false);
-}
-
-void MainWindow::budget()
-{
- bool ok;
- double freq = QInputDialog::getDouble(this, "Assign timing budget", "Frequency [MHz]:", 50, 0, 250, 2, &ok);
- if (ok) {
- freq *= 1e6;
- timing_driven = true;
- Q_EMIT task->budget(freq);
- }
}
-void MainWindow::place() { Q_EMIT task->place(timing_driven); }
+void MainWindow::onJsonLoaded() { actionLoadPCF->setEnabled(true); }
+void MainWindow::onRouteFinished() { actionSaveAsc->setEnabled(true); }
NEXTPNR_NAMESPACE_END
diff --git a/gui/ice40/mainwindow.h b/gui/ice40/mainwindow.h
index 4600d1da..230ccc4e 100644
--- a/gui/ice40/mainwindow.h
+++ b/gui/ice40/mainwindow.h
@@ -21,7 +21,6 @@
#define MAINWINDOW_H
#include "../basewindow.h"
-#include "worker.h"
NEXTPNR_NAMESPACE_BEGIN
@@ -35,53 +34,30 @@ class MainWindow : public BaseMainWindow
public:
void createMenu();
- void load_json(std::string filename, std::string pcf);
void load_pcf(std::string filename);
+
+ protected:
+ void onDisableActions() override;
+ void onJsonLoaded() override;
+ void onRouteFinished() override;
+
protected Q_SLOTS:
virtual void new_proj();
virtual void open_proj();
virtual bool save_proj();
- void open_json();
void open_pcf();
- void budget();
- void place();
void save_asc();
- void loadfile_finished(bool status);
- void loadpcf_finished(bool status);
- void saveasc_finished(bool status);
- void pack_finished(bool status);
- void budget_finish(bool status);
- void place_finished(bool status);
- void route_finished(bool status);
-
- void taskCanceled();
- void taskStarted();
- void taskPaused();
-
void newContext(Context *ctx);
private:
- void disableActions();
-
- TaskManager *task;
- QAction *actionLoadJSON;
QAction *actionLoadPCF;
- QAction *actionPack;
- QAction *actionAssignBudget;
- QAction *actionPlace;
- QAction *actionRoute;
QAction *actionSaveAsc;
- QAction *actionPlay;
- QAction *actionPause;
- QAction *actionStop;
- bool timing_driven;
ArchArgs chipArgs;
std::string currentProj;
- std::string currentJson;
std::string currentPCF;
};
diff --git a/gui/ice40/nextpnr.qrc b/gui/ice40/nextpnr.qrc
index 3c86057d..8eca1e09 100644
--- a/gui/ice40/nextpnr.qrc
+++ b/gui/ice40/nextpnr.qrc
@@ -1,14 +1,6 @@
<RCC>
<qresource prefix="/icons">
- <file>resources/control_play.png</file>
- <file>resources/control_pause.png</file>
- <file>resources/control_stop.png</file>
- <file>resources/pack.png</file>
- <file>resources/place.png</file>
- <file>resources/route.png</file>
- <file>resources/time_add.png</file>
<file>resources/open_pcf.png</file>
<file>resources/save_asc.png</file>
- <file>resources/open_json.png</file>
</qresource>
</RCC>
diff --git a/gui/ice40/resources/control_pause.png b/gui/ice40/resources/control_pause.png
deleted file mode 100644
index ec61099b..00000000
--- a/gui/ice40/resources/control_pause.png
+++ /dev/null
Binary files differ
diff --git a/gui/ice40/resources/control_play.png b/gui/ice40/resources/control_play.png
deleted file mode 100644
index f8c8ec68..00000000
--- a/gui/ice40/resources/control_play.png
+++ /dev/null
Binary files differ
diff --git a/gui/ice40/resources/control_stop.png b/gui/ice40/resources/control_stop.png
deleted file mode 100644
index e6f75d23..00000000
--- a/gui/ice40/resources/control_stop.png
+++ /dev/null
Binary files differ
diff --git a/gui/ice40/resources/open_json.png b/gui/ice40/resources/open_json.png
deleted file mode 100644
index 90c07267..00000000
--- a/gui/ice40/resources/open_json.png
+++ /dev/null
Binary files differ
diff --git a/gui/ice40/resources/pack.png b/gui/ice40/resources/pack.png
deleted file mode 100644
index da3c2a2d..00000000
--- a/gui/ice40/resources/pack.png
+++ /dev/null
Binary files differ
diff --git a/gui/ice40/resources/place.png b/gui/ice40/resources/place.png
deleted file mode 100644
index 0905f933..00000000
--- a/gui/ice40/resources/place.png
+++ /dev/null
Binary files differ
diff --git a/gui/ice40/resources/route.png b/gui/ice40/resources/route.png
deleted file mode 100644
index 258c16c6..00000000
--- a/gui/ice40/resources/route.png
+++ /dev/null
Binary files differ
diff --git a/gui/ice40/resources/time_add.png b/gui/ice40/resources/time_add.png
deleted file mode 100644
index dcc45cb2..00000000
--- a/gui/ice40/resources/time_add.png
+++ /dev/null
Binary files differ
diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc
deleted file mode 100644
index 09093ec8..00000000
--- a/gui/ice40/worker.cc
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * nextpnr -- Next Generation Place and Route
- *
- * Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#include "worker.h"
-#include <fstream>
-#include "bitstream.h"
-#include "design_utils.h"
-#include "jsonparse.h"
-#include "log.h"
-#include "pcf.h"
-#include "timing.h"
-
-NEXTPNR_NAMESPACE_BEGIN
-
-struct WorkerInterruptionRequested
-{
-};
-
-Worker::Worker(TaskManager *parent) : ctx(nullptr)
-{
- log_write_function = [this, parent](std::string text) {
- Q_EMIT log(text);
- if (parent->shouldTerminate()) {
- parent->clearTerminate();
- throw WorkerInterruptionRequested();
- }
- if (parent->isPaused()) {
- Q_EMIT taskPaused();
- }
- while (parent->isPaused()) {
- if (parent->shouldTerminate()) {
- parent->clearTerminate();
- throw WorkerInterruptionRequested();
- }
- QThread::sleep(1);
- }
- };
-}
-
-void Worker::newContext(Context *ctx_) { ctx = ctx_; }
-
-void Worker::loadfile(const std::string &filename)
-{
- Q_EMIT taskStarted();
- std::string fn = filename;
- std::ifstream f(fn);
- try {
- Q_EMIT loadfile_finished(parse_json_file(f, fn, ctx));
- } catch (WorkerInterruptionRequested) {
- Q_EMIT taskCanceled();
- }
-}
-
-void Worker::loadpcf(const std::string &filename)
-{
- Q_EMIT taskStarted();
- std::string fn = filename;
- std::ifstream f(fn);
- try {
- Q_EMIT loadpcf_finished(apply_pcf(ctx, f));
- } catch (WorkerInterruptionRequested) {
- Q_EMIT taskCanceled();
- }
-}
-
-void Worker::saveasc(const std::string &filename)
-{
- Q_EMIT taskStarted();
- std::string fn = filename;
- std::ofstream f(fn);
- try {
- write_asc(ctx, f);
- Q_EMIT saveasc_finished(true);
- } catch (WorkerInterruptionRequested) {
- Q_EMIT taskCanceled();
- }
-}
-
-void Worker::pack()
-{
- Q_EMIT taskStarted();
- try {
- bool res = ctx->pack();
- print_utilisation(ctx);
- Q_EMIT pack_finished(res);
- } catch (WorkerInterruptionRequested) {
- Q_EMIT taskCanceled();
- }
-}
-
-void Worker::budget(double freq)
-{
- Q_EMIT taskStarted();
- try {
- ctx->target_freq = freq;
- assign_budget(ctx);
- Q_EMIT budget_finish(true);
- } catch (WorkerInterruptionRequested) {
- Q_EMIT taskCanceled();
- }
-}
-
-void Worker::place(bool timing_driven)
-{
- Q_EMIT taskStarted();
- try {
- ctx->timing_driven = timing_driven;
- Q_EMIT place_finished(ctx->place());
- } catch (WorkerInterruptionRequested) {
- Q_EMIT taskCanceled();
- }
-}
-
-void Worker::route()
-{
- Q_EMIT taskStarted();
- try {
- Q_EMIT route_finished(ctx->route());
- } catch (WorkerInterruptionRequested) {
- Q_EMIT taskCanceled();
- }
-}
-
-TaskManager::TaskManager() : toTerminate(false), toPause(false)
-{
- Worker *worker = new Worker(this);
- worker->moveToThread(&workerThread);
-
- connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
-
- connect(this, &TaskManager::loadfile, worker, &Worker::loadfile);
- connect(this, &TaskManager::loadpcf, worker, &Worker::loadpcf);
- connect(this, &TaskManager::saveasc, worker, &Worker::saveasc);
- connect(this, &TaskManager::pack, worker, &Worker::pack);
- connect(this, &TaskManager::budget, worker, &Worker::budget);
- connect(this, &TaskManager::place, worker, &Worker::place);
- connect(this, &TaskManager::route, worker, &Worker::route);
-
- connect(this, &TaskManager::contextChanged, worker, &Worker::newContext);
-
- connect(worker, &Worker::log, this, &TaskManager::info);
- connect(worker, &Worker::loadfile_finished, this, &TaskManager::loadfile_finished);
- connect(worker, &Worker::loadpcf_finished, this, &TaskManager::loadpcf_finished);
- connect(worker, &Worker::saveasc_finished, this, &TaskManager::saveasc_finished);
- connect(worker, &Worker::pack_finished, this, &TaskManager::pack_finished);
- connect(worker, &Worker::budget_finish, this, &TaskManager::budget_finish);
- connect(worker, &Worker::place_finished, this, &TaskManager::place_finished);
- connect(worker, &Worker::route_finished, this, &TaskManager::route_finished);
-
- connect(worker, &Worker::taskCanceled, this, &TaskManager::taskCanceled);
- connect(worker, &Worker::taskStarted, this, &TaskManager::taskStarted);
- connect(worker, &Worker::taskPaused, this, &TaskManager::taskPaused);
-
- workerThread.start();
-}
-
-TaskManager::~TaskManager()
-{
- if (workerThread.isRunning())
- terminate_thread();
- workerThread.quit();
- workerThread.wait();
-}
-
-void TaskManager::info(const std::string &result) { Q_EMIT log(result); }
-
-void TaskManager::terminate_thread()
-{
- QMutexLocker locker(&mutex);
- toPause = false;
- toTerminate = true;
-}
-
-bool TaskManager::shouldTerminate()
-{
- QMutexLocker locker(&mutex);
- return toTerminate;
-}
-
-void TaskManager::clearTerminate()
-{
- QMutexLocker locker(&mutex);
- toTerminate = false;
-}
-
-void TaskManager::pause_thread()
-{
- QMutexLocker locker(&mutex);
- toPause = true;
-}
-
-void TaskManager::continue_thread()
-{
- QMutexLocker locker(&mutex);
- toPause = false;
- Q_EMIT taskStarted();
-}
-
-bool TaskManager::isPaused()
-{
- QMutexLocker locker(&mutex);
- return toPause;
-}
-
-NEXTPNR_NAMESPACE_END
diff --git a/gui/ice40/worker.h b/gui/ice40/worker.h
deleted file mode 100644
index f4369535..00000000
--- a/gui/ice40/worker.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * nextpnr -- Next Generation Place and Route
- *
- * Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifndef WORKER_H
-#define WORKER_H
-
-#include <QMutex>
-#include <QThread>
-#include "nextpnr.h"
-
-NEXTPNR_NAMESPACE_BEGIN
-
-class TaskManager;
-
-class Worker : public QObject
-{
- Q_OBJECT
- public:
- explicit Worker(TaskManager *parent);
- public Q_SLOTS:
- void newContext(Context *);
- void loadfile(const std::string &);
- void loadpcf(const std::string &);
- void saveasc(const std::string &);
- void pack();
- void budget(double freq);
- void place(bool timing_driven);
- void route();
- Q_SIGNALS:
- void log(const std::string &text);
- void loadfile_finished(bool status);
- void loadpcf_finished(bool status);
- void saveasc_finished(bool status);
- void pack_finished(bool status);
- void budget_finish(bool status);
- void place_finished(bool status);
- void route_finished(bool status);
- void taskCanceled();
- void taskStarted();
- void taskPaused();
-
- private:
- Context *ctx;
-};
-
-class TaskManager : public QObject
-{
- Q_OBJECT
- QThread workerThread;
-
- public:
- explicit TaskManager();
- ~TaskManager();
- bool shouldTerminate();
- void clearTerminate();
- bool isPaused();
- public Q_SLOTS:
- void info(const std::string &text);
- void terminate_thread();
- void pause_thread();
- void continue_thread();
- Q_SIGNALS:
- void contextChanged(Context *ctx);
- void terminate();
- void loadfile(const std::string &);
- void loadpcf(const std::string &);
- void saveasc(const std::string &);
- void pack();
- void budget(double freq);
- void place(bool timing_driven);
- void route();
-
- // redirected signals
- void log(const std::string &text);
- void loadfile_finished(bool status);
- void loadpcf_finished(bool status);
- void saveasc_finished(bool status);
- void pack_finished(bool status);
- void budget_finish(bool status);
- void place_finished(bool status);
- void route_finished(bool status);
- void taskCanceled();
- void taskStarted();
- void taskPaused();
-
- private:
- QMutex mutex;
- bool toTerminate;
- bool toPause;
-};
-
-NEXTPNR_NAMESPACE_END
-
-#endif // WORKER_H