diff options
author | Sergiusz Bazanski <q3k@q3k.org> | 2018-06-22 15:54:05 +0100 |
---|---|---|
committer | Sergiusz Bazanski <q3k@q3k.org> | 2018-06-22 15:54:05 +0100 |
commit | 15a7a76415cfb2e9fcbb534b324f829475036bb6 (patch) | |
tree | f5cd6d21aed83a341e786fa75a8b0053efb16656 /gui | |
parent | a68478598666d8fea0bef3c1814a96467bdb18ea (diff) | |
parent | e5bd4764b27c86fa804700b18bcac5cf18815314 (diff) | |
download | nextpnr-15a7a76415cfb2e9fcbb534b324f829475036bb6.tar.gz nextpnr-15a7a76415cfb2e9fcbb534b324f829475036bb6.tar.bz2 nextpnr-15a7a76415cfb2e9fcbb534b324f829475036bb6.zip |
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr into q3k/gl
Diffstat (limited to 'gui')
-rw-r--r-- | gui/application.cc | 47 | ||||
-rw-r--r-- | gui/application.h | 38 | ||||
-rw-r--r-- | gui/basewindow.cc | 19 | ||||
-rw-r--r-- | gui/basewindow.h | 19 | ||||
-rw-r--r-- | gui/designwidget.cc | 19 | ||||
-rw-r--r-- | gui/designwidget.h | 19 | ||||
-rw-r--r-- | gui/dummy/mainwindow.cc | 19 | ||||
-rw-r--r-- | gui/dummy/mainwindow.h | 19 | ||||
-rw-r--r-- | gui/ice40/mainwindow.cc | 172 | ||||
-rw-r--r-- | gui/ice40/mainwindow.h | 35 | ||||
-rw-r--r-- | gui/ice40/nextpnr.qrc | 3 | ||||
-rw-r--r-- | gui/ice40/resources/control_pause.png | bin | 598 -> 721 bytes | |||
-rw-r--r-- | gui/ice40/resources/control_play.png | bin | 592 -> 717 bytes | |||
-rw-r--r-- | gui/ice40/resources/control_stop.png | bin | 403 -> 695 bytes | |||
-rw-r--r-- | gui/ice40/resources/pack.png | bin | 0 -> 853 bytes | |||
-rw-r--r-- | gui/ice40/resources/place.png | bin | 0 -> 825 bytes | |||
-rw-r--r-- | gui/ice40/resources/route.png | bin | 0 -> 683 bytes | |||
-rw-r--r-- | gui/ice40/worker.cc | 94 | ||||
-rw-r--r-- | gui/ice40/worker.h | 45 | ||||
-rw-r--r-- | gui/infotab.cc | 19 | ||||
-rw-r--r-- | gui/infotab.h | 19 | ||||
-rw-r--r-- | gui/line_editor.cc | 19 | ||||
-rw-r--r-- | gui/line_editor.h | 19 | ||||
-rw-r--r-- | gui/pythontab.cc | 19 | ||||
-rw-r--r-- | gui/pythontab.h | 19 |
25 files changed, 631 insertions, 31 deletions
diff --git a/gui/application.cc b/gui/application.cc new file mode 100644 index 00000000..eaabeefb --- /dev/null +++ b/gui/application.cc @@ -0,0 +1,47 @@ + +/* + * nextpnr -- Next Generation Place and Route + * + * Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com> + * Copyright (C) 2018 Serge Bazanski <q3k@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 "application.h" +#include <QMessageBox> +#include <QSurfaceFormat> +#include <exception> + +NEXTPNR_NAMESPACE_BEGIN + +Application::Application(int &argc, char **argv) : QApplication(argc, argv) +{ + QSurfaceFormat fmt; + fmt.setSamples(10); + QSurfaceFormat::setDefaultFormat(fmt); +} + +bool Application::notify(QObject *receiver, QEvent *event) +{ + bool retVal = true; + try { + retVal = QApplication::notify(receiver, event); + } catch (...) { + QMessageBox::critical(0, "Error", "Fatal error !!!"); + } + return retVal; +} + +NEXTPNR_NAMESPACE_END diff --git a/gui/application.h b/gui/application.h new file mode 100644 index 00000000..321f6b65 --- /dev/null +++ b/gui/application.h @@ -0,0 +1,38 @@ +/* + * nextpnr -- Next Generation Place and Route + * + * Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com> + * Copyright (C) 2018 Serge Bazanski <q3k@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 APPLICATION_H +#define APPLICATION_H + +#include <QApplication> +#include "nextpnr.h" + +NEXTPNR_NAMESPACE_BEGIN + +class Application : public QApplication +{ + public: + Application(int &argc, char **argv); + bool notify(QObject *receiver, QEvent *event); +}; + +NEXTPNR_NAMESPACE_END + +#endif // APPLICATION_H
\ No newline at end of file diff --git a/gui/basewindow.cc b/gui/basewindow.cc index f16b205d..ac28e95f 100644 --- a/gui/basewindow.cc +++ b/gui/basewindow.cc @@ -1,3 +1,22 @@ +/*
+ * 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 <QAction>
#include <QFileDialog>
#include <QGridLayout>
diff --git a/gui/basewindow.h b/gui/basewindow.h index 55e4affc..f4ca5129 100644 --- a/gui/basewindow.h +++ b/gui/basewindow.h @@ -1,3 +1,22 @@ +/*
+ * 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 BASEMAINWINDOW_H
#define BASEMAINWINDOW_H
diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 7532653d..0f87f06c 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -1,3 +1,22 @@ +/*
+ * 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 "designwidget.h"
#include <QAction>
#include <QGridLayout>
diff --git a/gui/designwidget.h b/gui/designwidget.h index 5bd12d4d..498e73d7 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -1,3 +1,22 @@ +/*
+ * 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 DESIGNWIDGET_H
#define DESIGNWIDGET_H
diff --git a/gui/dummy/mainwindow.cc b/gui/dummy/mainwindow.cc index da162dd0..354b86ed 100644 --- a/gui/dummy/mainwindow.cc +++ b/gui/dummy/mainwindow.cc @@ -1,3 +1,22 @@ +/*
+ * 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 "mainwindow.h"
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
diff --git a/gui/dummy/mainwindow.h b/gui/dummy/mainwindow.h index c2786906..f16b7ad3 100644 --- a/gui/dummy/mainwindow.h +++ b/gui/dummy/mainwindow.h @@ -1,3 +1,22 @@ +/*
+ * 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 MAINWINDOW_H
#define MAINWINDOW_H
diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 4c7bc18f..a0739f92 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -1,3 +1,22 @@ +/*
+ * 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 "mainwindow.h"
#include <QAction>
#include <QFileDialog>
@@ -26,6 +45,18 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent) task = new TaskManager(_ctx);
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(pack_finished(bool)), this, SLOT(pack_finished(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()));
+
createMenu();
}
@@ -33,29 +64,67 @@ MainWindow::~MainWindow() { delete task; } void MainWindow::createMenu()
{
- QMenu *menu_Custom = new QMenu("&ICE 40", menuBar);
- menuBar->addAction(menu_Custom->menuAction());
-
- QAction *actionPlay = new QAction("Play", this);
- QIcon icon1;
- icon1.addFile(QStringLiteral(":/icons/resources/control_play.png"));
- actionPlay->setIcon(icon1);
+ QMenu *menu_Design = new QMenu("&Design", menuBar);
+ menuBar->addAction(menu_Design->menuAction());
+
+ actionPack = new QAction("Pack", this);
+ QIcon iconPack;
+ iconPack.addFile(QStringLiteral(":/icons/resources/pack.png"));
+ actionPack->setIcon(iconPack);
+ actionPack->setStatusTip("Pack current design");
+ connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
+ actionPack->setEnabled(false);
+
+ actionPlace = new QAction("Place", this);
+ QIcon iconPlace;
+ iconPlace.addFile(QStringLiteral(":/icons/resources/place.png"));
+ actionPlace->setIcon(iconPlace);
+ actionPlace->setStatusTip("Place current design");
+ connect(actionPlace, SIGNAL(triggered()), task, SIGNAL(place()));
+ actionPlace->setEnabled(false);
+
+ actionRoute = new QAction("Route", this);
+ QIcon iconRoute;
+ iconRoute.addFile(QStringLiteral(":/icons/resources/route.png"));
+ actionRoute->setIcon(iconRoute);
+ actionRoute->setStatusTip("Route current design");
+ connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
+ actionRoute->setEnabled(false);
+
+ QToolBar *taskFPGABar = new QToolBar();
+ addToolBar(Qt::TopToolBarArea, taskFPGABar);
+
+ taskFPGABar->addAction(actionPack);
+ taskFPGABar->addAction(actionPlace);
+ taskFPGABar->addAction(actionRoute);
+
+ menu_Design->addAction(actionPack);
+ menu_Design->addAction(actionPlace);
+ menu_Design->addAction(actionRoute);
+
+ actionPlay = new QAction("Play", this);
+ QIcon iconPlay;
+ iconPlay.addFile(QStringLiteral(":/icons/resources/control_play.png"));
+ actionPlay->setIcon(iconPlay);
actionPlay->setStatusTip("Continue running task");
connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
+ actionPlay->setEnabled(false);
- QAction *actionPause = new QAction("Pause", this);
- QIcon icon2;
- icon2.addFile(QStringLiteral(":/icons/resources/control_pause.png"));
- actionPause->setIcon(icon2);
+ actionPause = new QAction("Pause", this);
+ QIcon iconPause;
+ iconPause.addFile(QStringLiteral(":/icons/resources/control_pause.png"));
+ actionPause->setIcon(iconPause);
actionPause->setStatusTip("Pause running task");
connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread()));
+ actionPause->setEnabled(false);
- QAction *actionStop = new QAction("Stop", this);
- QIcon icon3;
- icon3.addFile(QStringLiteral(":/icons/resources/control_stop.png"));
- actionStop->setIcon(icon3);
+ actionStop = new QAction("Stop", this);
+ QIcon iconStop;
+ iconStop.addFile(QStringLiteral(":/icons/resources/control_stop.png"));
+ actionStop->setIcon(iconStop);
actionStop->setStatusTip("Stop running task");
connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread()));
+ actionStop->setEnabled(false);
QToolBar *taskToolBar = new QToolBar();
addToolBar(Qt::TopToolBarArea, taskToolBar);
@@ -73,10 +142,81 @@ void MainWindow::open() tabWidget->setCurrentWidget(info);
std::string fn = fileName.toStdString();
- Q_EMIT task->parsejson(fn);
+ disableActions();
+ Q_EMIT task->loadfile(fn);
}
}
bool MainWindow::save() { return false; }
+void MainWindow::disableActions()
+{
+ actionPack->setEnabled(false);
+ actionPlace->setEnabled(false);
+ actionRoute->setEnabled(false);
+
+ actionPlay->setEnabled(false);
+ actionPause->setEnabled(false);
+ actionStop->setEnabled(false);
+}
+
+void MainWindow::loadfile_finished(bool status)
+{
+ disableActions();
+ if (status) {
+ log("Loading design successful.\n");
+ actionPack->setEnabled(true);
+ } else {
+ log("Loading design failed.\n");
+ }
+}
+void MainWindow::pack_finished(bool status)
+{
+ disableActions();
+ if (status) {
+ log("Packing design successful.\n");
+ actionPlace->setEnabled(true);
+ } else {
+ log("Packing design failed.\n");
+ }
+}
+void MainWindow::place_finished(bool status)
+{
+ disableActions();
+ if (status) {
+ log("Placing design successful.\n");
+ actionRoute->setEnabled(true);
+ } else {
+ log("Placing design failed.\n");
+ }
+}
+void MainWindow::route_finished(bool status)
+{
+ disableActions();
+ if (status)
+ log("Routing design successful.\n");
+ else
+ log("Routing design failed.\n");
+}
+
+void MainWindow::taskCanceled()
+{
+ log("CANCELED\n");
+ disableActions();
+}
+
+void MainWindow::taskStarted()
+{
+ disableActions();
+ actionPause->setEnabled(true);
+ actionStop->setEnabled(true);
+}
+
+void MainWindow::taskPaused()
+{
+ disableActions();
+ actionPlay->setEnabled(true);
+ actionStop->setEnabled(true);
+}
+
NEXTPNR_NAMESPACE_END
\ No newline at end of file diff --git a/gui/ice40/mainwindow.h b/gui/ice40/mainwindow.h index 712f341a..c0c4bef8 100644 --- a/gui/ice40/mainwindow.h +++ b/gui/ice40/mainwindow.h @@ -1,3 +1,22 @@ +/*
+ * 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 MAINWINDOW_H
#define MAINWINDOW_H
@@ -20,9 +39,25 @@ class MainWindow : public BaseMainWindow protected Q_SLOTS:
virtual void open();
virtual bool save();
+ void loadfile_finished(bool status);
+ void pack_finished(bool status);
+ void place_finished(bool status);
+ void route_finished(bool status);
+
+ void taskCanceled();
+ void taskStarted();
+ void taskPaused();
private:
+ void disableActions();
+
TaskManager *task;
+ QAction *actionPack;
+ QAction *actionPlace;
+ QAction *actionRoute;
+ QAction *actionPlay;
+ QAction *actionPause;
+ QAction *actionStop;
};
NEXTPNR_NAMESPACE_END
diff --git a/gui/ice40/nextpnr.qrc b/gui/ice40/nextpnr.qrc index cbdb8b26..3bc68978 100644 --- a/gui/ice40/nextpnr.qrc +++ b/gui/ice40/nextpnr.qrc @@ -3,5 +3,8 @@ <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> </qresource> </RCC> diff --git a/gui/ice40/resources/control_pause.png b/gui/ice40/resources/control_pause.png Binary files differindex 2d9ce9c4..ec61099b 100644 --- a/gui/ice40/resources/control_pause.png +++ b/gui/ice40/resources/control_pause.png diff --git a/gui/ice40/resources/control_play.png b/gui/ice40/resources/control_play.png Binary files differindex 0846555d..f8c8ec68 100644 --- a/gui/ice40/resources/control_play.png +++ b/gui/ice40/resources/control_play.png diff --git a/gui/ice40/resources/control_stop.png b/gui/ice40/resources/control_stop.png Binary files differindex 893bb60e..e6f75d23 100644 --- a/gui/ice40/resources/control_stop.png +++ b/gui/ice40/resources/control_stop.png diff --git a/gui/ice40/resources/pack.png b/gui/ice40/resources/pack.png Binary files differnew file mode 100644 index 00000000..da3c2a2d --- /dev/null +++ b/gui/ice40/resources/pack.png diff --git a/gui/ice40/resources/place.png b/gui/ice40/resources/place.png Binary files differnew file mode 100644 index 00000000..0905f933 --- /dev/null +++ b/gui/ice40/resources/place.png diff --git a/gui/ice40/resources/route.png b/gui/ice40/resources/route.png Binary files differnew file mode 100644 index 00000000..258c16c6 --- /dev/null +++ b/gui/ice40/resources/route.png diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc index 9549f659..ecf473ce 100644 --- a/gui/ice40/worker.cc +++ b/gui/ice40/worker.cc @@ -1,3 +1,22 @@ +/* + * 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" @@ -24,33 +43,61 @@ Worker::Worker(Context *_ctx, TaskManager *parent) : ctx(_ctx) 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::parsejson(const std::string &filename) +void Worker::loadfile(const std::string &filename) { + Q_EMIT taskStarted(); std::string fn = filename; std::ifstream f(fn); try { - if (!parse_json_file(f, fn, ctx)) - log_error("Loading design failed.\n"); - if (!pack_design(ctx)) - log_error("Packing design failed.\n"); + Q_EMIT loadfile_finished(parse_json_file(f, fn, ctx)); + } catch (WorkerInterruptionRequested) { + Q_EMIT taskCanceled(); + } +} + +void Worker::pack() +{ + Q_EMIT taskStarted(); + try { + Q_EMIT pack_finished(pack_design(ctx)); + } catch (WorkerInterruptionRequested) { + Q_EMIT taskCanceled(); + } +} + +void Worker::place() +{ + Q_EMIT taskStarted(); + try { double freq = 50e6; assign_budget(ctx, freq); print_utilisation(ctx); + Q_EMIT place_finished(place_design_sa(ctx)); + } catch (WorkerInterruptionRequested) { + Q_EMIT taskCanceled(); + } +} - if (!place_design_sa(ctx)) - log_error("Placing design failed.\n"); - if (!route_design(ctx)) - log_error("Routing design failed.\n"); - Q_EMIT log("DONE\n"); - } catch (log_execution_error_exception) { +void Worker::route() +{ + Q_EMIT taskStarted(); + try { + Q_EMIT route_finished(route_design(ctx)); } catch (WorkerInterruptionRequested) { - Q_EMIT log("CANCELED\n"); + Q_EMIT taskCanceled(); } } @@ -58,9 +105,27 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false) { Worker *worker = new Worker(ctx, this); worker->moveToThread(&workerThread); + connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater); - connect(this, &TaskManager::parsejson, worker, &Worker::parsejson); + + connect(this, &TaskManager::loadfile, worker, &Worker::loadfile); + connect(this, &TaskManager::pack, worker, &Worker::pack); + connect(this, &TaskManager::place, worker, &Worker::place); + connect(this, &TaskManager::route, worker, &Worker::route); + connect(worker, &Worker::log, this, &TaskManager::info); + connect(worker, &Worker::loadfile_finished, this, + &TaskManager::loadfile_finished); + connect(worker, &Worker::pack_finished, this, &TaskManager::pack_finished); + 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(); } @@ -77,6 +142,7 @@ void TaskManager::info(const std::string &result) { Q_EMIT log(result); } void TaskManager::terminate_thread() { QMutexLocker locker(&mutex); + toPause = false; toTerminate = true; } @@ -102,7 +168,9 @@ void TaskManager::continue_thread() { QMutexLocker locker(&mutex); toPause = false; + Q_EMIT taskStarted(); } + bool TaskManager::isPaused() { QMutexLocker locker(&mutex); diff --git a/gui/ice40/worker.h b/gui/ice40/worker.h index 181fafa3..ae4dd146 100644 --- a/gui/ice40/worker.h +++ b/gui/ice40/worker.h @@ -1,3 +1,22 @@ +/* + * 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 @@ -15,9 +34,19 @@ class Worker : public QObject public: Worker(Context *ctx, TaskManager *parent); public Q_SLOTS: - void parsejson(const std::string &filename); + void loadfile(const std::string &); + void pack(); + void place(); + void route(); Q_SIGNALS: void log(const std::string &text); + void loadfile_finished(bool status); + void pack_finished(bool status); + void place_finished(bool status); + void route_finished(bool status); + void taskCanceled(); + void taskStarted(); + void taskPaused(); private: Context *ctx; @@ -41,8 +70,20 @@ class TaskManager : public QObject void continue_thread(); Q_SIGNALS: void terminate(); - void parsejson(const std::string &); + void loadfile(const std::string &); + void pack(); + void place(); + void route(); + + // redirected signals void log(const std::string &text); + void loadfile_finished(bool status); + void pack_finished(bool status); + void place_finished(bool status); + void route_finished(bool status); + void taskCanceled(); + void taskStarted(); + void taskPaused(); private: QMutex mutex; diff --git a/gui/infotab.cc b/gui/infotab.cc index 29d557d2..9127bd06 100644 --- a/gui/infotab.cc +++ b/gui/infotab.cc @@ -1,3 +1,22 @@ +/*
+ * 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 "infotab.h"
#include <QGridLayout>
diff --git a/gui/infotab.h b/gui/infotab.h index 3e0220c4..0116755e 100644 --- a/gui/infotab.h +++ b/gui/infotab.h @@ -1,3 +1,22 @@ +/*
+ * 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 INFOTAB_H
#define INFOTAB_H
diff --git a/gui/line_editor.cc b/gui/line_editor.cc index 6299c9cc..d4be9d3a 100644 --- a/gui/line_editor.cc +++ b/gui/line_editor.cc @@ -1,3 +1,22 @@ +/* + * 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 "line_editor.h" #include <QKeyEvent> diff --git a/gui/line_editor.h b/gui/line_editor.h index 5f27e502..91837182 100644 --- a/gui/line_editor.h +++ b/gui/line_editor.h @@ -1,3 +1,22 @@ +/* + * 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 LINE_EDITOR_H #define LINE_EDITOR_H diff --git a/gui/pythontab.cc b/gui/pythontab.cc index 19aa0162..531038a1 100644 --- a/gui/pythontab.cc +++ b/gui/pythontab.cc @@ -1,3 +1,22 @@ +/*
+ * 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 "pythontab.h"
#include <QGridLayout>
#include "emb.h"
diff --git a/gui/pythontab.h b/gui/pythontab.h index 52a8ff8d..f37381d7 100644 --- a/gui/pythontab.h +++ b/gui/pythontab.h @@ -1,3 +1,22 @@ +/*
+ * 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 PYTHONTAB_H
#define PYTHONTAB_H
|