nextpnr/gui/ice40/mainwindow.cc

536 lines
18 KiB
C++
Raw Normal View History

2018-06-22 22:21:20 +08:00
/*
* 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.
*
*/
2018-06-21 19:41:16 +08:00
#include "mainwindow.h"
#include <QAction>
#include <QFileDialog>
2018-07-21 17:24:29 +08:00
#include <QFileInfo>
2018-06-21 19:41:16 +08:00
#include <QIcon>
#include <QInputDialog>
#include <QLineEdit>
2018-07-21 17:24:29 +08:00
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
2018-06-21 19:55:36 +08:00
#include "bitstream.h"
#include "design_utils.h"
2018-06-21 19:41:16 +08:00
#include "jsonparse.h"
#include "log.h"
#include "pcf.h"
2018-06-22 19:10:27 +08:00
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)
2018-06-21 19:41:16 +08:00
{
2018-06-22 19:10:27 +08:00
initMainResource();
2018-06-26 21:47:22 +08:00
std::string title = "nextpnr-ice40 - [EMPTY]";
2018-06-21 19:41:16 +08:00
setWindowTitle(title.c_str());
2018-06-26 21:47:22 +08:00
task = new TaskManager();
connect(task, SIGNAL(log(std::string)), this, SLOT(writeInfo(std::string)));
2018-06-22 18:11:22 +08:00
2018-06-23 22:06:49 +08:00
connect(task, SIGNAL(loadfile_finished(bool)), this, SLOT(loadfile_finished(bool)));
2018-06-23 22:55:13 +08:00
connect(task, SIGNAL(loadpcf_finished(bool)), this, SLOT(loadpcf_finished(bool)));
2018-06-26 19:49:32 +08:00
connect(task, SIGNAL(saveasc_finished(bool)), this, SLOT(saveasc_finished(bool)));
2018-06-22 21:35:07 +08:00
connect(task, SIGNAL(pack_finished(bool)), this, SLOT(pack_finished(bool)));
connect(task, SIGNAL(budget_finish(bool)), this, SLOT(budget_finish(bool)));
2018-06-23 22:06:49 +08:00
connect(task, SIGNAL(place_finished(bool)), this, SLOT(place_finished(bool)));
connect(task, SIGNAL(route_finished(bool)), this, SLOT(route_finished(bool)));
2018-06-22 21:35:07 +08:00
connect(task, SIGNAL(taskCanceled()), this, SLOT(taskCanceled()));
connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted()));
connect(task, SIGNAL(taskPaused()), this, SLOT(taskPaused()));
2018-06-22 21:35:07 +08:00
2018-06-29 00:06:31 +08:00
connect(this, SIGNAL(contextChanged(Context *)), this, SLOT(newContext(Context *)));
connect(this, SIGNAL(contextChanged(Context *)), task, SIGNAL(contextChanged(Context *)));
2018-06-26 21:47:22 +08:00
2018-06-22 18:11:22 +08:00
createMenu();
Q_EMIT contextChanged(ctx.get());
2018-06-21 19:41:16 +08:00
}
2018-06-22 18:11:22 +08:00
MainWindow::~MainWindow() { delete task; }
2018-06-21 19:41:16 +08:00
void MainWindow::createMenu()
{
2018-06-22 21:35:07 +08:00
QMenu *menu_Design = new QMenu("&Design", menuBar);
menuBar->addAction(menu_Design->menuAction());
2018-07-15 21:12:31 +08:00
actionLoadJSON = new QAction("Open JSON", this);
2018-07-14 23:58:58 +08:00
actionLoadJSON->setIcon(QIcon(":/icons/resources/open_json.png"));
2018-06-26 20:17:17 +08:00
actionLoadJSON->setStatusTip("Open an existing JSON file");
actionLoadJSON->setEnabled(true);
2018-07-14 23:58:58 +08:00
connect(actionLoadJSON, SIGNAL(triggered()), this, SLOT(open_json()));
2018-06-26 20:17:17 +08:00
2018-07-15 21:12:31 +08:00
actionLoadPCF = new QAction("Open PCF", this);
2018-07-14 23:58:58 +08:00
actionLoadPCF->setIcon(QIcon(":/icons/resources/open_pcf.png"));
2018-06-23 22:55:13 +08:00
actionLoadPCF->setStatusTip("Open PCF file");
actionLoadPCF->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionLoadPCF, SIGNAL(triggered()), this, SLOT(open_pcf()));
2018-06-23 22:55:13 +08:00
2018-07-15 21:12:31 +08:00
actionPack = new QAction("Pack", this);
2018-07-14 23:58:58 +08:00
actionPack->setIcon(QIcon(":/icons/resources/pack.png"));
2018-06-22 21:35:07 +08:00
actionPack->setStatusTip("Pack current design");
actionPack->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
2018-06-22 21:35:07 +08:00
2018-07-15 21:12:31 +08:00
actionAssignBudget = new QAction("Assign Budget", this);
2018-07-14 23:58:58 +08:00
actionAssignBudget->setIcon(QIcon(":/icons/resources/time_add.png"));
actionAssignBudget->setStatusTip("Assign time budget for current design");
actionAssignBudget->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionAssignBudget, SIGNAL(triggered()), this, SLOT(budget()));
2018-07-15 21:12:31 +08:00
actionPlace = new QAction("Place", this);
2018-07-14 23:58:58 +08:00
actionPlace->setIcon(QIcon(":/icons/resources/place.png"));
2018-06-22 21:35:07 +08:00
actionPlace->setStatusTip("Place current design");
actionPlace->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionPlace, SIGNAL(triggered()), this, SLOT(place()));
2018-06-22 21:35:07 +08:00
2018-07-15 21:12:31 +08:00
actionRoute = new QAction("Route", this);
2018-07-14 23:58:58 +08:00
actionRoute->setIcon(QIcon(":/icons/resources/route.png"));
2018-06-22 21:35:07 +08:00
actionRoute->setStatusTip("Route current design");
actionRoute->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
2018-06-22 21:35:07 +08:00
2018-07-15 21:12:31 +08:00
actionSaveAsc = new QAction("Save ASC", this);
2018-07-14 23:58:58 +08:00
actionSaveAsc->setIcon(QIcon(":/icons/resources/save_asc.png"));
2018-06-26 19:49:32 +08:00
actionSaveAsc->setStatusTip("Save ASC file");
actionSaveAsc->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionSaveAsc, SIGNAL(triggered()), this, SLOT(save_asc()));
2018-06-26 19:49:32 +08:00
2018-06-22 21:35:07 +08:00
QToolBar *taskFPGABar = new QToolBar();
addToolBar(Qt::TopToolBarArea, taskFPGABar);
2018-06-26 20:17:17 +08:00
taskFPGABar->addAction(actionLoadJSON);
2018-06-23 22:55:13 +08:00
taskFPGABar->addAction(actionLoadPCF);
2018-06-22 21:35:07 +08:00
taskFPGABar->addAction(actionPack);
taskFPGABar->addAction(actionAssignBudget);
2018-06-22 21:35:07 +08:00
taskFPGABar->addAction(actionPlace);
taskFPGABar->addAction(actionRoute);
2018-06-26 19:49:32 +08:00
taskFPGABar->addAction(actionSaveAsc);
2018-06-22 21:35:07 +08:00
2018-06-26 20:17:17 +08:00
menu_Design->addAction(actionLoadJSON);
2018-06-23 22:55:13 +08:00
menu_Design->addAction(actionLoadPCF);
2018-06-22 21:35:07 +08:00
menu_Design->addAction(actionPack);
menu_Design->addAction(actionAssignBudget);
2018-06-22 21:35:07 +08:00
menu_Design->addAction(actionPlace);
menu_Design->addAction(actionRoute);
2018-06-26 19:49:32 +08:00
menu_Design->addAction(actionSaveAsc);
2018-06-22 21:35:07 +08:00
2018-07-15 21:12:31 +08:00
actionPlay = new QAction("Play", this);
2018-07-14 23:58:58 +08:00
actionPlay->setIcon(QIcon(":/icons/resources/control_play.png"));
2018-06-22 18:49:20 +08:00
actionPlay->setStatusTip("Continue running task");
2018-06-22 21:35:07 +08:00
actionPlay->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
2018-06-22 18:49:20 +08:00
2018-07-15 21:12:31 +08:00
actionPause = new QAction("Pause", this);
2018-07-14 23:58:58 +08:00
actionPause->setIcon(QIcon(":/icons/resources/control_pause.png"));
2018-06-22 18:49:20 +08:00
actionPause->setStatusTip("Pause running task");
2018-06-22 21:35:07 +08:00
actionPause->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread()));
2018-06-22 18:49:20 +08:00
2018-07-15 21:12:31 +08:00
actionStop = new QAction("Stop", this);
2018-07-14 23:58:58 +08:00
actionStop->setIcon(QIcon(":/icons/resources/control_stop.png"));
2018-06-22 18:49:20 +08:00
actionStop->setStatusTip("Stop running task");
2018-06-22 21:35:07 +08:00
actionStop->setEnabled(false);
2018-07-14 23:58:58 +08:00
connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread()));
2018-06-22 18:49:20 +08:00
QToolBar *taskToolBar = new QToolBar();
addToolBar(Qt::TopToolBarArea, taskToolBar);
taskToolBar->addAction(actionPlay);
taskToolBar->addAction(actionPause);
taskToolBar->addAction(actionStop);
2018-06-21 19:41:16 +08:00
}
#if defined(_MSC_VER)
void load_chipdb();
#endif
static const ChipInfoPOD *get_chip_info(const RelPtr<ChipInfoPOD> *ptr) { return ptr->get(); }
QStringList getSupportedPackages(ArchArgs::ArchArgsTypes chip)
2018-06-26 20:17:17 +08:00
{
QStringList packages;
#if defined(_MSC_VER)
load_chipdb();
#endif
const ChipInfoPOD *chip_info;
#ifdef ICE40_HX1K_ONLY
if (chip == ArchArgs::HX1K) {
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k));
} else {
log_error("Unsupported iCE40 chip type.\n");
}
#else
if (chip == ArchArgs::LP384) {
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_384));
} else if (chip == ArchArgs::LP1K || chip == ArchArgs::HX1K) {
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k));
} else if (chip == ArchArgs::UP5K) {
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_5k));
} else if (chip == ArchArgs::LP8K || chip == ArchArgs::HX8K) {
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_8k));
} else {
log_error("Unsupported iCE40 chip type.\n");
}
#endif
2018-06-29 00:06:31 +08:00
for (int i = 0; i < chip_info->num_packages; i++) {
packages << chip_info->packages_data[i].name.get();
}
return packages;
}
2018-06-26 21:47:22 +08:00
void MainWindow::new_proj()
{
QMap<QString, int> arch;
#ifdef ICE40_HX1K_ONLY
arch.insert("Lattice HX1K", ArchArgs::HX1K);
#else
arch.insert("Lattice LP384", ArchArgs::LP384);
arch.insert("Lattice LP1K", ArchArgs::LP1K);
arch.insert("Lattice HX1K", ArchArgs::HX1K);
arch.insert("Lattice UP5K", ArchArgs::UP5K);
arch.insert("Lattice LP8K", ArchArgs::LP8K);
arch.insert("Lattice HX8K", ArchArgs::HX8K);
#endif
bool ok;
QString item = QInputDialog::getItem(this, "Select new context", "Chip:", arch.keys(), 0, false, &ok);
if (ok && !item.isEmpty()) {
chipArgs.type = (ArchArgs::ArchArgsTypes)arch.value(item);
QString package = QInputDialog::getItem(this, "Select package", "Package:", getSupportedPackages(chipArgs.type),
0, false, &ok);
if (ok && !item.isEmpty()) {
2018-07-21 18:15:50 +08:00
currentProj = "";
currentJson = "";
currentPCF = "";
2018-07-21 18:22:41 +08:00
disableActions();
chipArgs.package = package.toStdString().c_str();
ctx = std::unique_ptr<Context>(new Context(chipArgs));
actionLoadJSON->setEnabled(true);
Q_EMIT contextChanged(ctx.get());
}
}
2018-06-26 20:17:17 +08:00
}
void MainWindow::load_json(std::string filename, std::string pcf)
{
disableActions();
2018-07-21 18:15:50 +08:00
currentJson = filename;
currentPCF = pcf;
Q_EMIT task->loadfile(filename);
}
void MainWindow::load_pcf(std::string filename)
{
disableActions();
2018-07-21 18:15:50 +08:00
currentPCF = filename;
Q_EMIT task->loadpcf(filename);
}
2018-06-26 21:47:22 +08:00
void MainWindow::newContext(Context *ctx)
{
std::string title = "nextpnr-ice40 - " + ctx->getChipName() + " ( " + chipArgs.package + " )";
2018-06-26 21:47:22 +08:00
setWindowTitle(title.c_str());
}
2018-06-26 20:17:17 +08:00
void MainWindow::open_proj()
{
2018-07-21 17:24:29 +08:00
QMap<std::string, int> arch;
#ifdef ICE40_HX1K_ONLY
arch.insert("hx1k", ArchArgs::HX1K);
#else
arch.insert("lp384", ArchArgs::LP384);
arch.insert("lp1k", ArchArgs::LP1K);
arch.insert("hx1k", ArchArgs::HX1K);
arch.insert("up5k", ArchArgs::UP5K);
arch.insert("lp8k", ArchArgs::LP8K);
arch.insert("hx8k", ArchArgs::HX8K);
#endif
2018-06-26 21:47:22 +08:00
QString fileName = QFileDialog::getOpenFileName(this, QString("Open Project"), QString(), QString("*.proj"));
2018-06-26 20:17:17 +08:00
if (!fileName.isEmpty()) {
2018-07-21 17:24:29 +08:00
try {
namespace pt = boost::property_tree;
std::string fn = fileName.toStdString();
2018-07-21 18:15:50 +08:00
currentProj = fn;
2018-07-21 17:24:29 +08:00
disableActions();
pt::ptree root;
std::string filename = fileName.toStdString();
pt::read_json(filename, root);
log_info("Loading project %s...\n", filename.c_str());
log_break();
int version = root.get<int>("project.version");
if (version != 1)
log_error("Wrong project format version.\n");
std::string arch_name = root.get<std::string>("project.arch.name");
if (arch_name != "ice40")
log_error("Unsuported project architecture.\n");
std::string arch_type = root.get<std::string>("project.arch.type");
std::string arch_package = root.get<std::string>("project.arch.package");
chipArgs.type = (ArchArgs::ArchArgsTypes)arch.value(arch_type);
chipArgs.package = arch_package;
ctx = std::unique_ptr<Context>(new Context(chipArgs));
Q_EMIT contextChanged(ctx.get());
QFileInfo fi(fileName);
QDir::setCurrent(fi.absoluteDir().absolutePath());
log_info("Setting current dir to %s...\n", fi.absoluteDir().absolutePath().toStdString().c_str());
log_info("Loading project %s...\n", filename.c_str());
log_info("Context changed to %s (%s)\n", arch_type.c_str(), arch_package.c_str());
auto project = root.get_child("project");
std::string json;
std::string pcf;
if (project.count("input")) {
auto input = project.get_child("input");
if (input.count("json"))
json = input.get<std::string>("json");
if (input.count("pcf"))
pcf = input.get<std::string>("pcf");
}
if (!(QFileInfo::exists(json.c_str()) && QFileInfo(json.c_str()).isFile())) {
log_error("Json file does not exist.\n");
}
if (!pcf.empty()) {
if (!(QFileInfo::exists(pcf.c_str()) && QFileInfo(pcf.c_str()).isFile())) {
log_error("PCF file does not exist.\n");
}
}
log_info("Loading json: %s...\n", json.c_str());
load_json(json, pcf);
} catch (log_execution_error_exception) {
}
2018-06-26 20:17:17 +08:00
}
}
void MainWindow::open_json()
{
2018-06-26 20:17:17 +08:00
QString fileName = QFileDialog::getOpenFileName(this, QString("Open JSON"), QString(), QString("*.json"));
if (!fileName.isEmpty()) {
load_json(fileName.toStdString(), "");
}
}
2018-06-22 19:10:27 +08:00
2018-06-23 22:55:13 +08:00
void MainWindow::open_pcf()
{
2018-06-26 19:49:32 +08:00
QString fileName = QFileDialog::getOpenFileName(this, QString("Open PCF"), QString(), QString("*.pcf"));
2018-06-23 22:55:13 +08:00
if (!fileName.isEmpty()) {
load_pcf(fileName.toStdString());
2018-06-23 22:55:13 +08:00
}
}
2018-07-21 18:15:50 +08:00
bool MainWindow::save_proj()
{
if (currentProj.empty()) {
QString fileName = QFileDialog::getSaveFileName(this, QString("Save Project"), QString(), QString("*.proj"));
if (fileName.isEmpty())
return false;
currentProj = fileName.toStdString();
}
if (!currentProj.empty()) {
namespace pt = boost::property_tree;
QFileInfo fi(currentProj.c_str());
QDir dir(fi.absoluteDir().absolutePath());
std::ofstream f(currentProj);
pt::ptree root;
root.put("project.version", 1);
root.put("project.name", fi.baseName().toStdString());
root.put("project.arch.name", ctx->archId().c_str(ctx.get()));
root.put("project.arch.type", ctx->archArgsToId(chipArgs).c_str(ctx.get()));
root.put("project.arch.package", chipArgs.package);
if (!currentJson.empty())
root.put("project.input.json", dir.relativeFilePath(currentJson.c_str()).toStdString());
if (!currentPCF.empty())
root.put("project.input.pcf", dir.relativeFilePath(currentPCF.c_str()).toStdString());
pt::write_json(f, root);
log_info("Project %s saved...\n", fi.baseName().toStdString().c_str());
return true;
}
return false;
}
2018-06-22 19:10:27 +08:00
2018-06-26 19:49:32 +08:00
void MainWindow::save_asc()
{
QString fileName = QFileDialog::getSaveFileName(this, QString("Save ASC"), QString(), QString("*.asc"));
if (!fileName.isEmpty()) {
std::string fn = fileName.toStdString();
disableActions();
Q_EMIT task->saveasc(fn);
}
}
void MainWindow::disableActions()
2018-06-22 21:35:07 +08:00
{
2018-06-26 20:17:17 +08:00
actionLoadJSON->setEnabled(false);
2018-06-23 22:55:13 +08:00
actionLoadPCF->setEnabled(false);
2018-06-22 21:35:07 +08:00
actionPack->setEnabled(false);
actionAssignBudget->setEnabled(false);
2018-06-22 21:35:07 +08:00
actionPlace->setEnabled(false);
actionRoute->setEnabled(false);
2018-06-26 19:49:32 +08:00
actionSaveAsc->setEnabled(false);
2018-06-22 21:35:07 +08:00
actionPlay->setEnabled(false);
actionPause->setEnabled(false);
actionStop->setEnabled(false);
actionNew->setEnabled(true);
actionOpen->setEnabled(true);
2018-07-21 18:15:50 +08:00
actionSave->setEnabled(!currentJson.empty());
2018-06-22 21:35:07 +08:00
}
void MainWindow::loadfile_finished(bool status)
{
disableActions();
if (status) {
log("Loading design successful.\n");
2018-06-23 22:55:13 +08:00
actionLoadPCF->setEnabled(true);
2018-06-22 21:35:07 +08:00
actionPack->setEnabled(true);
2018-07-21 18:15:50 +08:00
if (!currentPCF.empty())
load_pcf(currentPCF);
2018-07-06 02:06:12 +08:00
Q_EMIT updateTreeView();
} else {
2018-06-22 21:35:07 +08:00
log("Loading design failed.\n");
2018-07-21 18:15:50 +08:00
currentPCF = "";
2018-06-22 21:35:07 +08:00
}
}
2018-06-23 22:55:13 +08:00
void MainWindow::loadpcf_finished(bool status)
{
disableActions();
if (status) {
log("Loading PCF successful.\n");
actionPack->setEnabled(true);
} else {
log("Loading PCF failed.\n");
}
}
2018-06-26 19:49:32 +08:00
void MainWindow::saveasc_finished(bool status)
{
disableActions();
if (status) {
log("Saving ASC successful.\n");
} else {
log("Saving ASC failed.\n");
}
}
2018-06-22 21:35:07 +08:00
void MainWindow::pack_finished(bool status)
{
disableActions();
if (status) {
log("Packing design successful.\n");
2018-07-06 02:06:12 +08:00
Q_EMIT updateTreeView();
2018-06-22 21:35:07 +08:00
actionPlace->setEnabled(true);
actionAssignBudget->setEnabled(true);
} else {
2018-06-22 21:35:07 +08:00
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");
}
}
2018-06-22 21:35:07 +08:00
void MainWindow::place_finished(bool status)
{
disableActions();
if (status) {
log("Placing design successful.\n");
2018-07-06 02:06:12 +08:00
Q_EMIT updateTreeView();
2018-06-22 21:35:07 +08:00
actionRoute->setEnabled(true);
} else {
2018-06-22 21:35:07 +08:00
log("Placing design failed.\n");
}
}
void MainWindow::route_finished(bool status)
{
disableActions();
2018-06-26 19:49:32 +08:00
if (status) {
2018-06-22 21:35:07 +08:00
log("Routing design successful.\n");
2018-07-06 02:06:12 +08:00
Q_EMIT updateTreeView();
2018-06-26 19:49:32 +08:00
actionSaveAsc->setEnabled(true);
} else
2018-06-22 21:35:07 +08:00
log("Routing design failed.\n");
}
void MainWindow::taskCanceled()
{
log("CANCELED\n");
disableActions();
}
void MainWindow::taskStarted()
{
disableActions();
actionPause->setEnabled(true);
actionStop->setEnabled(true);
2018-06-29 00:06:31 +08:00
actionNew->setEnabled(false);
actionOpen->setEnabled(false);
2018-06-22 21:35:07 +08:00
}
void MainWindow::taskPaused()
{
disableActions();
actionPlay->setEnabled(true);
actionStop->setEnabled(true);
2018-06-29 00:06:31 +08:00
actionNew->setEnabled(false);
actionOpen->setEnabled(false);
2018-06-22 21:35:07 +08:00
}
void MainWindow::budget()
{
bool ok;
2018-06-23 22:06:49 +08:00
double freq = QInputDialog::getDouble(this, "Assign timing budget", "Frequency [MHz]:", 50, 0, 250, 2, &ok);
if (ok) {
freq *= 1e6;
timing_driven = true;
2018-06-23 22:55:13 +08:00
Q_EMIT task->budget(freq);
}
}
2018-06-23 22:55:13 +08:00
void MainWindow::place() { Q_EMIT task->place(timing_driven); }
NEXTPNR_NAMESPACE_END