added PCF load
This commit is contained in:
parent
fe26ce4471
commit
3407d76383
@ -47,6 +47,7 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent) : BaseMainWindow(_ctx, pa
|
|||||||
connect(task, SIGNAL(log(std::string)), this, SLOT(writeInfo(std::string)));
|
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(loadfile_finished(bool)), this, SLOT(loadfile_finished(bool)));
|
||||||
|
connect(task, SIGNAL(loadpcf_finished(bool)), this, SLOT(loadpcf_finished(bool)));
|
||||||
connect(task, SIGNAL(pack_finished(bool)), this, SLOT(pack_finished(bool)));
|
connect(task, SIGNAL(pack_finished(bool)), this, SLOT(pack_finished(bool)));
|
||||||
connect(task, SIGNAL(budget_finish(bool)), this, SLOT(budget_finish(bool)));
|
connect(task, SIGNAL(budget_finish(bool)), this, SLOT(budget_finish(bool)));
|
||||||
connect(task, SIGNAL(place_finished(bool)), this, SLOT(place_finished(bool)));
|
connect(task, SIGNAL(place_finished(bool)), this, SLOT(place_finished(bool)));
|
||||||
@ -56,9 +57,6 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent) : BaseMainWindow(_ctx, pa
|
|||||||
connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted()));
|
connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted()));
|
||||||
connect(task, SIGNAL(taskPaused()), this, SLOT(taskPaused()));
|
connect(task, SIGNAL(taskPaused()), this, SLOT(taskPaused()));
|
||||||
|
|
||||||
connect(this, SIGNAL(budget(double)), task, SIGNAL(budget(double)));
|
|
||||||
connect(this, SIGNAL(place(bool)), task, SIGNAL(place(bool)));
|
|
||||||
|
|
||||||
createMenu();
|
createMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +67,14 @@ void MainWindow::createMenu()
|
|||||||
QMenu *menu_Design = new QMenu("&Design", menuBar);
|
QMenu *menu_Design = new QMenu("&Design", menuBar);
|
||||||
menuBar->addAction(menu_Design->menuAction());
|
menuBar->addAction(menu_Design->menuAction());
|
||||||
|
|
||||||
|
actionLoadPCF = new QAction("Open PCF", this);
|
||||||
|
QIcon iconLoadPCF;
|
||||||
|
iconLoadPCF.addFile(QStringLiteral(":/icons/resources/open_pcf.png"));
|
||||||
|
actionLoadPCF->setIcon(iconLoadPCF);
|
||||||
|
actionLoadPCF->setStatusTip("Open PCF file");
|
||||||
|
connect(actionLoadPCF, SIGNAL(triggered()), this, SLOT(open_pcf()));
|
||||||
|
actionLoadPCF->setEnabled(false);
|
||||||
|
|
||||||
actionPack = new QAction("Pack", this);
|
actionPack = new QAction("Pack", this);
|
||||||
QIcon iconPack;
|
QIcon iconPack;
|
||||||
iconPack.addFile(QStringLiteral(":/icons/resources/pack.png"));
|
iconPack.addFile(QStringLiteral(":/icons/resources/pack.png"));
|
||||||
@ -104,11 +110,13 @@ void MainWindow::createMenu()
|
|||||||
QToolBar *taskFPGABar = new QToolBar();
|
QToolBar *taskFPGABar = new QToolBar();
|
||||||
addToolBar(Qt::TopToolBarArea, taskFPGABar);
|
addToolBar(Qt::TopToolBarArea, taskFPGABar);
|
||||||
|
|
||||||
|
taskFPGABar->addAction(actionLoadPCF);
|
||||||
taskFPGABar->addAction(actionPack);
|
taskFPGABar->addAction(actionPack);
|
||||||
taskFPGABar->addAction(actionAssignBudget);
|
taskFPGABar->addAction(actionAssignBudget);
|
||||||
taskFPGABar->addAction(actionPlace);
|
taskFPGABar->addAction(actionPlace);
|
||||||
taskFPGABar->addAction(actionRoute);
|
taskFPGABar->addAction(actionRoute);
|
||||||
|
|
||||||
|
menu_Design->addAction(actionLoadPCF);
|
||||||
menu_Design->addAction(actionPack);
|
menu_Design->addAction(actionPack);
|
||||||
menu_Design->addAction(actionAssignBudget);
|
menu_Design->addAction(actionAssignBudget);
|
||||||
menu_Design->addAction(actionPlace);
|
menu_Design->addAction(actionPlace);
|
||||||
@ -159,10 +167,23 @@ void MainWindow::open()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::open_pcf()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, QString(), QString(), QString("*.pcf"));
|
||||||
|
if (!fileName.isEmpty()) {
|
||||||
|
tabWidget->setCurrentWidget(info);
|
||||||
|
|
||||||
|
std::string fn = fileName.toStdString();
|
||||||
|
disableActions();
|
||||||
|
Q_EMIT task->loadpcf(fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::save() { return false; }
|
bool MainWindow::save() { return false; }
|
||||||
|
|
||||||
void MainWindow::disableActions()
|
void MainWindow::disableActions()
|
||||||
{
|
{
|
||||||
|
actionLoadPCF->setEnabled(false);
|
||||||
actionPack->setEnabled(false);
|
actionPack->setEnabled(false);
|
||||||
actionAssignBudget->setEnabled(false);
|
actionAssignBudget->setEnabled(false);
|
||||||
actionPlace->setEnabled(false);
|
actionPlace->setEnabled(false);
|
||||||
@ -178,11 +199,24 @@ void MainWindow::loadfile_finished(bool status)
|
|||||||
disableActions();
|
disableActions();
|
||||||
if (status) {
|
if (status) {
|
||||||
log("Loading design successful.\n");
|
log("Loading design successful.\n");
|
||||||
|
actionLoadPCF->setEnabled(true);
|
||||||
actionPack->setEnabled(true);
|
actionPack->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
log("Loading design failed.\n");
|
log("Loading design failed.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::loadpcf_finished(bool status)
|
||||||
|
{
|
||||||
|
disableActions();
|
||||||
|
if (status) {
|
||||||
|
log("Loading PCF successful.\n");
|
||||||
|
actionPack->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
log("Loading PCF failed.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::pack_finished(bool status)
|
void MainWindow::pack_finished(bool status)
|
||||||
{
|
{
|
||||||
disableActions();
|
disableActions();
|
||||||
@ -252,10 +286,10 @@ void MainWindow::budget()
|
|||||||
if (ok) {
|
if (ok) {
|
||||||
freq *= 1e6;
|
freq *= 1e6;
|
||||||
timing_driven = true;
|
timing_driven = true;
|
||||||
Q_EMIT budget(freq);
|
Q_EMIT task->budget(freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::place() { Q_EMIT place(timing_driven); }
|
void MainWindow::place() { Q_EMIT task->place(timing_driven); }
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
@ -36,18 +36,16 @@ class MainWindow : public BaseMainWindow
|
|||||||
public:
|
public:
|
||||||
void createMenu();
|
void createMenu();
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void budget(double freq);
|
|
||||||
void place(bool timing_driven);
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
virtual void open();
|
virtual void open();
|
||||||
virtual bool save();
|
virtual bool save();
|
||||||
|
|
||||||
|
void open_pcf();
|
||||||
void budget();
|
void budget();
|
||||||
void place();
|
void place();
|
||||||
|
|
||||||
void loadfile_finished(bool status);
|
void loadfile_finished(bool status);
|
||||||
|
void loadpcf_finished(bool status);
|
||||||
void pack_finished(bool status);
|
void pack_finished(bool status);
|
||||||
void budget_finish(bool status);
|
void budget_finish(bool status);
|
||||||
void place_finished(bool status);
|
void place_finished(bool status);
|
||||||
@ -61,6 +59,7 @@ class MainWindow : public BaseMainWindow
|
|||||||
void disableActions();
|
void disableActions();
|
||||||
|
|
||||||
TaskManager *task;
|
TaskManager *task;
|
||||||
|
QAction *actionLoadPCF;
|
||||||
QAction *actionPack;
|
QAction *actionPack;
|
||||||
QAction *actionAssignBudget;
|
QAction *actionAssignBudget;
|
||||||
QAction *actionPlace;
|
QAction *actionPlace;
|
||||||
|
@ -7,5 +7,6 @@
|
|||||||
<file>resources/place.png</file>
|
<file>resources/place.png</file>
|
||||||
<file>resources/route.png</file>
|
<file>resources/route.png</file>
|
||||||
<file>resources/time_add.png</file>
|
<file>resources/time_add.png</file>
|
||||||
|
<file>resources/open_pcf.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
gui/ice40/resources/open_pcf.png
Normal file
BIN
gui/ice40/resources/open_pcf.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@ -68,6 +68,18 @@ void Worker::loadfile(const std::string &filename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Worker::loadpcf(const std::string &filename)
|
||||||
|
{
|
||||||
|
Q_EMIT taskStarted();
|
||||||
|
std::string fn = filename;
|
||||||
|
std::ifstream f(fn);
|
||||||
|
try {
|
||||||
|
Q_EMIT loadpcf_finished(apply_pcf(ctx, f));
|
||||||
|
} catch (WorkerInterruptionRequested) {
|
||||||
|
Q_EMIT taskCanceled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Worker::pack()
|
void Worker::pack()
|
||||||
{
|
{
|
||||||
Q_EMIT taskStarted();
|
Q_EMIT taskStarted();
|
||||||
@ -119,6 +131,7 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
|
|||||||
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
|
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
|
||||||
|
|
||||||
connect(this, &TaskManager::loadfile, worker, &Worker::loadfile);
|
connect(this, &TaskManager::loadfile, worker, &Worker::loadfile);
|
||||||
|
connect(this, &TaskManager::loadpcf, worker, &Worker::loadpcf);
|
||||||
connect(this, &TaskManager::pack, worker, &Worker::pack);
|
connect(this, &TaskManager::pack, worker, &Worker::pack);
|
||||||
connect(this, &TaskManager::budget, worker, &Worker::budget);
|
connect(this, &TaskManager::budget, worker, &Worker::budget);
|
||||||
connect(this, &TaskManager::place, worker, &Worker::place);
|
connect(this, &TaskManager::place, worker, &Worker::place);
|
||||||
@ -126,6 +139,7 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
|
|||||||
|
|
||||||
connect(worker, &Worker::log, this, &TaskManager::info);
|
connect(worker, &Worker::log, this, &TaskManager::info);
|
||||||
connect(worker, &Worker::loadfile_finished, this, &TaskManager::loadfile_finished);
|
connect(worker, &Worker::loadfile_finished, this, &TaskManager::loadfile_finished);
|
||||||
|
connect(worker, &Worker::loadpcf_finished, this, &TaskManager::loadpcf_finished);
|
||||||
connect(worker, &Worker::pack_finished, this, &TaskManager::pack_finished);
|
connect(worker, &Worker::pack_finished, this, &TaskManager::pack_finished);
|
||||||
connect(worker, &Worker::budget_finish, this, &TaskManager::budget_finish);
|
connect(worker, &Worker::budget_finish, this, &TaskManager::budget_finish);
|
||||||
connect(worker, &Worker::place_finished, this, &TaskManager::place_finished);
|
connect(worker, &Worker::place_finished, this, &TaskManager::place_finished);
|
||||||
|
@ -35,6 +35,7 @@ class Worker : public QObject
|
|||||||
Worker(Context *ctx, TaskManager *parent);
|
Worker(Context *ctx, TaskManager *parent);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void loadfile(const std::string &);
|
void loadfile(const std::string &);
|
||||||
|
void loadpcf(const std::string &);
|
||||||
void pack();
|
void pack();
|
||||||
void budget(double freq);
|
void budget(double freq);
|
||||||
void place(bool timing_driven);
|
void place(bool timing_driven);
|
||||||
@ -42,6 +43,7 @@ class Worker : public QObject
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void log(const std::string &text);
|
void log(const std::string &text);
|
||||||
void loadfile_finished(bool status);
|
void loadfile_finished(bool status);
|
||||||
|
void loadpcf_finished(bool status);
|
||||||
void pack_finished(bool status);
|
void pack_finished(bool status);
|
||||||
void budget_finish(bool status);
|
void budget_finish(bool status);
|
||||||
void place_finished(bool status);
|
void place_finished(bool status);
|
||||||
@ -73,6 +75,7 @@ class TaskManager : public QObject
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void terminate();
|
void terminate();
|
||||||
void loadfile(const std::string &);
|
void loadfile(const std::string &);
|
||||||
|
void loadpcf(const std::string &);
|
||||||
void pack();
|
void pack();
|
||||||
void budget(double freq);
|
void budget(double freq);
|
||||||
void place(bool timing_driven);
|
void place(bool timing_driven);
|
||||||
@ -81,6 +84,7 @@ class TaskManager : public QObject
|
|||||||
// redirected signals
|
// redirected signals
|
||||||
void log(const std::string &text);
|
void log(const std::string &text);
|
||||||
void loadfile_finished(bool status);
|
void loadfile_finished(bool status);
|
||||||
|
void loadpcf_finished(bool status);
|
||||||
void pack_finished(bool status);
|
void pack_finished(bool status);
|
||||||
void budget_finish(bool status);
|
void budget_finish(bool status);
|
||||||
void place_finished(bool status);
|
void place_finished(bool status);
|
||||||
|
Loading…
Reference in New Issue
Block a user