diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a64369f..1b05d296 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ foreach (family ${FAMILIES}) include(${family}/family.cmake) foreach (target ${family_targets}) # Include family-specific source files to all family targets and set defines appropriately - target_include_directories(${target} PRIVATE ${family}/ generated/ gui/${family}/) + target_include_directories(${target} PRIVATE ${family}/ generated/ gui/${family}/ gui/) target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} QT_NO_KEYWORDS) target_link_libraries(${target} LINK_PUBLIC gui_${family} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES_${ufamily}}) endforeach (target) diff --git a/common/design_utils.cc b/common/design_utils.cc index 92533fa3..28237b35 100644 --- a/common/design_utils.cc +++ b/common/design_utils.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/common/design_utils.h b/common/design_utils.h index d7f0b733..13e4ec1d 100644 --- a/common/design_utils.h +++ b/common/design_utils.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/common/log.cc b/common/log.cc index 495f83b1..73c764a4 100644 --- a/common/log.cc +++ b/common/log.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2012 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/common/log.h b/common/log.h index 65b3f178..ca936745 100644 --- a/common/log.h +++ b/common/log.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2012 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/common/nextpnr.cc b/common/nextpnr.cc index b24f66ea..d29d3fec 100644 --- a/common/nextpnr.cc +++ b/common/nextpnr.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/common/nextpnr.h b/common/nextpnr.h index 1cf0cbbb..9c6c9d68 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/common/place_sa.cc b/common/place_sa.cc index 058f0a84..7a876256 100644 --- a/common/place_sa.cc +++ b/common/place_sa.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Simulated annealing implementation based on arachne-pnr diff --git a/common/place_sa.h b/common/place_sa.h index 3c49c031..1fd8c712 100644 --- a/common/place_sa.h +++ b/common/place_sa.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/common/pybindings.cc b/common/pybindings.cc index 02dc2395..a9c32c1c 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/common/pybindings.h b/common/pybindings.h index 7616c055..4379a1aa 100644 --- a/common/pybindings.h +++ b/common/pybindings.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/common/pycontainers.h b/common/pycontainers.h index 9160dfb6..06e772a0 100644 --- a/common/pycontainers.h +++ b/common/pycontainers.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/common/route.cc b/common/route.cc index 967f9aa1..a60f1c41 100644 --- a/common/route.cc +++ b/common/route.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -408,6 +408,7 @@ NEXTPNR_NAMESPACE_BEGIN bool route_design(Context *ctx) { try { + int totalVisitCnt = 0, totalRevisitCnt = 0, totalOvertimeRevisitCnt = 0; delay_t ripup_penalty = ctx->getRipupDelayPenalty(); RipupScoreboard scores; @@ -637,12 +638,22 @@ bool route_design(Context *ctx) "nets with ripup.\n", iterCnt, normalRouteCnt, int(ripupQueue.size())); + totalVisitCnt += visitCnt; + totalRevisitCnt += revisitCnt; + totalOvertimeRevisitCnt += overtimeRevisitCnt; + if (iterCnt == 8 || iterCnt == 16 || iterCnt == 32 || iterCnt == 64 || iterCnt == 128) ripup_penalty += ctx->getRipupDelayPenalty(); } log_info("routing complete after %d iterations.\n", iterCnt); + + log_info("visited %d PIPs (%.2f%% revisits, %.2f%% " + "overtime revisits).\n", + totalVisitCnt, (100.0 * totalRevisitCnt) / totalVisitCnt, + (100.0 * totalOvertimeRevisitCnt) / totalVisitCnt); + log_info("Checksum: 0x%08x\n", ctx->checksum()); return true; } catch (log_execution_error_exception) { diff --git a/common/route.h b/common/route.h index af0de42e..7a7260f5 100644 --- a/common/route.h +++ b/common/route.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/dummy/arch.cc b/dummy/arch.cc index 0ed0f11e..64c0ca1e 100644 --- a/dummy/arch.cc +++ b/dummy/arch.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/dummy/arch.h b/dummy/arch.h index d8068b22..5bdf633e 100644 --- a/dummy/arch.h +++ b/dummy/arch.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/dummy/arch_place.cc b/dummy/arch_place.cc index f35cb6fe..e4881329 100644 --- a/dummy/arch_place.cc +++ b/dummy/arch_place.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/dummy/arch_place.h b/dummy/arch_place.h index 1111ac42..213472d9 100644 --- a/dummy/arch_place.h +++ b/dummy/arch_place.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/dummy/main.cc b/dummy/main.cc index 110c5b6c..fa1259d4 100644 --- a/dummy/main.cc +++ b/dummy/main.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -22,6 +22,7 @@ #include #include #include +#include "application.h" #include "log.h" #include "mainwindow.h" #include "nextpnr.h" @@ -107,7 +108,7 @@ int main(int argc, char *argv[]) } if (vm.count("gui")) { - QApplication a(argc, argv); + Application a(argc, argv); MainWindow w(&ctx); w.show(); diff --git a/dummy/pybindings.cc b/dummy/pybindings.cc index 87716267..59bf402f 100644 --- a/dummy/pybindings.cc +++ b/dummy/pybindings.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/frontend/json/jsonparse.cc b/frontend/json/jsonparse.cc index a832e9e5..eba6b6f1 100644 --- a/frontend/json/jsonparse.cc +++ b/frontend/json/jsonparse.cc @@ -5,7 +5,7 @@ * * jsonparse.cc -- liberally copied from the yosys file of the same name by * - * Copyright (C) 2012 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above 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 + * Copyright (C) 2018 Serge Bazanski + * + * 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 +#include +#include + +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 + * Copyright (C) 2018 Serge Bazanski + * + * 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 +#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 + * + * 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 #include #include 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 + * + * 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 + * + * 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 #include 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 + * + * 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 + * + * 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 + * + * 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 + * + * 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 #include @@ -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()); + QMenu *menu_Design = new QMenu("&Design", menuBar); + menuBar->addAction(menu_Design->menuAction()); - QAction *actionPlay = new QAction("Play", this); - QIcon icon1; - icon1.addFile(QStringLiteral(":/icons/resources/control_play.png")); - actionPlay->setIcon(icon1); + 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 + * + * 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 @@ resources/control_play.png resources/control_pause.png resources/control_stop.png + resources/pack.png + resources/place.png + resources/route.png diff --git a/gui/ice40/resources/control_pause.png b/gui/ice40/resources/control_pause.png index 2d9ce9c4..ec61099b 100644 Binary files a/gui/ice40/resources/control_pause.png and b/gui/ice40/resources/control_pause.png differ diff --git a/gui/ice40/resources/control_play.png b/gui/ice40/resources/control_play.png index 0846555d..f8c8ec68 100644 Binary files a/gui/ice40/resources/control_play.png and b/gui/ice40/resources/control_play.png differ diff --git a/gui/ice40/resources/control_stop.png b/gui/ice40/resources/control_stop.png index 893bb60e..e6f75d23 100644 Binary files a/gui/ice40/resources/control_stop.png and b/gui/ice40/resources/control_stop.png differ diff --git a/gui/ice40/resources/pack.png b/gui/ice40/resources/pack.png new file mode 100644 index 00000000..da3c2a2d Binary files /dev/null and b/gui/ice40/resources/pack.png differ diff --git a/gui/ice40/resources/place.png b/gui/ice40/resources/place.png new file mode 100644 index 00000000..0905f933 Binary files /dev/null and b/gui/ice40/resources/place.png differ diff --git a/gui/ice40/resources/route.png b/gui/ice40/resources/route.png new file mode 100644 index 00000000..258c16c6 Binary files /dev/null and b/gui/ice40/resources/route.png differ 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 + * + * 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 #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); - - 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) { + Q_EMIT place_finished(place_design_sa(ctx)); } catch (WorkerInterruptionRequested) { - Q_EMIT log("CANCELED\n"); + Q_EMIT taskCanceled(); + } +} + +void Worker::route() +{ + Q_EMIT taskStarted(); + try { + Q_EMIT route_finished(route_design(ctx)); + } catch (WorkerInterruptionRequested) { + 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 + * + * 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 + * + * 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 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 + * + * 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 + * + * 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 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 + * + * 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 + * + * 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 #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 + * + * 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 diff --git a/ice40/arch.cc b/ice40/arch.cc index 963b5994..f14c8045 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/ice40/arch.h b/ice40/arch.h index f3a46f5c..66292783 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -166,6 +166,11 @@ enum TileType : uint32_t TILE_IO = 2, TILE_RAMB = 3, TILE_RAMT = 4, + TILE_DSP0 = 5, + TILE_DSP1 = 6, + TILE_DSP2 = 7, + TILE_DSP3 = 8, + TILE_IPCON = 9 }; struct ConfigBitPOD diff --git a/ice40/arch_place.cc b/ice40/arch_place.cc index c607c9c6..25044525 100644 --- a/ice40/arch_place.cc +++ b/ice40/arch_place.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/arch_place.h b/ice40/arch_place.h index d276b9c4..339bf485 100644 --- a/ice40/arch_place.h +++ b/ice40/arch_place.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/bitstream.cc b/ice40/bitstream.cc index e722cea4..165971aa 100644 --- a/ice40/bitstream.cc +++ b/ice40/bitstream.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any @@ -370,6 +370,21 @@ void write_asc(const Context *ctx, std::ostream &out) case TILE_RAMT: out << ".ramt_tile"; break; + case TILE_DSP0: + out << ".dsp0_tile"; + break; + case TILE_DSP1: + out << ".dsp1_tile"; + break; + case TILE_DSP2: + out << ".dsp2_tile"; + break; + case TILE_DSP3: + out << ".dsp3_tile"; + break; + case TILE_IPCON: + out << ".ipcon_tile"; + break; default: assert(false); } diff --git a/ice40/bitstream.h b/ice40/bitstream.h index 4dcb79bc..2b6cda1d 100644 --- a/ice40/bitstream.h +++ b/ice40/bitstream.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/cells.cc b/ice40/cells.cc index c2bc4609..3f94d4ba 100644 --- a/ice40/cells.cc +++ b/ice40/cells.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/cells.h b/ice40/cells.h index 36c1ba19..b1f3d516 100644 --- a/ice40/cells.h +++ b/ice40/cells.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/chipdb.py b/ice40/chipdb.py index 37606b54..ac854fc8 100644 --- a/ice40/chipdb.py +++ b/ice40/chipdb.py @@ -36,10 +36,6 @@ wire_names = dict() wire_names_r = dict() wire_xy = dict() -num_tile_types = 5 -tile_sizes = {i: (0, 0) for i in range(num_tile_types)} -tile_bits = [[] for _ in range(num_tile_types)] - cbit_re = re.compile(r'B(\d+)\[(\d+)\]') portpins = dict() @@ -69,6 +65,11 @@ tiletypes["LOGIC"] = 1 tiletypes["IO"] = 2 tiletypes["RAMB"] = 3 tiletypes["RAMT"] = 4 +tiletypes["DSP0"] = 5 +tiletypes["DSP1"] = 6 +tiletypes["DSP2"] = 7 +tiletypes["DSP3"] = 8 +tiletypes["IPCON"] = 9 wiretypes["LOCAL"] = 1 wiretypes["GLOBAL"] = 2 @@ -187,6 +188,16 @@ def pipdelay(src, dst): # print(src, dst, src_type, dst_type, file=sys.stderr) assert 0 + +def init_tiletypes(device): + global num_tile_types, tile_sizes, tile_bits + if device == "5k": + num_tile_types = 10 + else: + num_tile_types = 5 + tile_sizes = {i: (0, 0) for i in range(num_tile_types)} + tile_bits = [[] for _ in range(num_tile_types)] + with open(sys.argv[1], "r") as f: mode = None @@ -198,6 +209,7 @@ with open(sys.argv[1], "r") as f: if line[0] == ".device": dev_name = line[1] + init_tiletypes(dev_name) dev_width = int(line[2]) dev_height = int(line[3]) num_wires = int(line[4]) @@ -237,6 +249,31 @@ with open(sys.argv[1], "r") as f: mode = None continue + if line[0] == ".dsp0_tile": + tiles[(int(line[1]), int(line[2]))] = "dsp0" + mode = None + continue + + if line[0] == ".dsp1_tile": + tiles[(int(line[1]), int(line[2]))] = "dsp1" + mode = None + continue + + if line[0] == ".dsp2_tile": + tiles[(int(line[1]), int(line[2]))] = "dsp2" + mode = None + continue + + if line[0] == ".dsp3_tile": + tiles[(int(line[1]), int(line[2]))] = "dsp3" + mode = None + continue + + if line[0] == ".ipcon_tile": + tiles[(int(line[1]), int(line[2]))] = "ipcon" + mode = None + continue + if line[0] == ".logic_tile_bits": mode = ("bits", 1) tile_sizes[1] = (int(line[1]), int(line[2])) @@ -257,6 +294,31 @@ with open(sys.argv[1], "r") as f: tile_sizes[4] = (int(line[1]), int(line[2])) continue + if line[0] == ".dsp0_tile_bits": + mode = ("bits", 5) + tile_sizes[5] = (int(line[1]), int(line[2])) + continue + + if line[0] == ".dsp1_tile_bits": + mode = ("bits", 6) + tile_sizes[6] = (int(line[1]), int(line[2])) + continue + + if line[0] == ".dsp2_tile_bits": + mode = ("bits", 7) + tile_sizes[7] = (int(line[1]), int(line[2])) + continue + + if line[0] == ".dsp3_tile_bits": + mode = ("bits", 8) + tile_sizes[8] = (int(line[1]), int(line[2])) + continue + + if line[0] == ".ipcon_tile_bits": + mode = ("bits", 9) + tile_sizes[9] = (int(line[1]), int(line[2])) + continue + if line[0] == ".ieren": mode = ("ieren",) continue diff --git a/ice40/main.cc b/ice40/main.cc index f2100d45..ae8c7705 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -25,6 +25,7 @@ #include #include #include +#include "application.h" #include "bitstream.h" #include "design_utils.h" #include "jsonparse.h" @@ -330,10 +331,7 @@ int main(int argc, char *argv[]) } if (vm.count("gui")) { - QApplication a(argc, argv); - QSurfaceFormat fmt; - fmt.setSamples(10); - QSurfaceFormat::setDefaultFormat(fmt); + Application a(argc, argv); MainWindow w(&ctx); w.show(); diff --git a/ice40/pack.cc b/ice40/pack.cc index 35cef8b8..e9f02ddf 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/pack.h b/ice40/pack.h index 92b76653..cdebdd79 100644 --- a/ice40/pack.h +++ b/ice40/pack.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/pcf.cc b/ice40/pcf.cc index 87d27ff1..13fe199e 100644 --- a/ice40/pcf.cc +++ b/ice40/pcf.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/pcf.h b/ice40/pcf.h index b86a7609..315f6270 100644 --- a/ice40/pcf.h +++ b/ice40/pcf.h @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/ice40/pybindings.cc b/ice40/pybindings.cc index 6ce35583..97eebd3e 100644 --- a/ice40/pybindings.cc +++ b/ice40/pybindings.cc @@ -1,7 +1,7 @@ /* * nextpnr -- Next Generation Place and Route * - * Copyright (C) 2018 Clifford Wolf + * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 David Shah * * Permission to use, copy, modify, and/or distribute this software for any