Added assign time budget and placement option
This commit is contained in:
parent
a1681560a3
commit
c0b1078c12
@ -21,6 +21,8 @@
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QIcon>
|
||||
#include <QInputDialog>
|
||||
#include <QLineEdit>
|
||||
#include "bitstream.h"
|
||||
#include "design_utils.h"
|
||||
#include "jsonparse.h"
|
||||
@ -35,7 +37,7 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
||||
: BaseMainWindow(_ctx, parent)
|
||||
: BaseMainWindow(_ctx, parent), timing_driven(false)
|
||||
{
|
||||
initMainResource();
|
||||
|
||||
@ -48,6 +50,7 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
||||
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(budget_finish(bool)), this, SLOT(budget_finish(bool)));
|
||||
connect(task, SIGNAL(place_finished(bool)), this,
|
||||
SLOT(place_finished(bool)));
|
||||
connect(task, SIGNAL(route_finished(bool)), this,
|
||||
@ -57,6 +60,10 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
||||
connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted()));
|
||||
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();
|
||||
}
|
||||
|
||||
@ -75,12 +82,20 @@ void MainWindow::createMenu()
|
||||
connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
|
||||
actionPack->setEnabled(false);
|
||||
|
||||
actionAssignBudget = new QAction("Assign Budget", this);
|
||||
QIcon iconAssignBudget;
|
||||
iconAssignBudget.addFile(QStringLiteral(":/icons/resources/time_add.png"));
|
||||
actionAssignBudget->setIcon(iconAssignBudget);
|
||||
actionAssignBudget->setStatusTip("Assign time budget for current design");
|
||||
connect(actionAssignBudget, SIGNAL(triggered()), this, SLOT(budget()));
|
||||
actionAssignBudget->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()));
|
||||
connect(actionPlace, SIGNAL(triggered()), this, SLOT(place()));
|
||||
actionPlace->setEnabled(false);
|
||||
|
||||
actionRoute = new QAction("Route", this);
|
||||
@ -95,10 +110,12 @@ void MainWindow::createMenu()
|
||||
addToolBar(Qt::TopToolBarArea, taskFPGABar);
|
||||
|
||||
taskFPGABar->addAction(actionPack);
|
||||
taskFPGABar->addAction(actionAssignBudget);
|
||||
taskFPGABar->addAction(actionPlace);
|
||||
taskFPGABar->addAction(actionRoute);
|
||||
|
||||
menu_Design->addAction(actionPack);
|
||||
menu_Design->addAction(actionAssignBudget);
|
||||
menu_Design->addAction(actionPlace);
|
||||
menu_Design->addAction(actionRoute);
|
||||
|
||||
@ -143,6 +160,7 @@ void MainWindow::open()
|
||||
|
||||
std::string fn = fileName.toStdString();
|
||||
disableActions();
|
||||
timing_driven = false;
|
||||
Q_EMIT task->loadfile(fn);
|
||||
}
|
||||
}
|
||||
@ -152,6 +170,7 @@ bool MainWindow::save() { return false; }
|
||||
void MainWindow::disableActions()
|
||||
{
|
||||
actionPack->setEnabled(false);
|
||||
actionAssignBudget->setEnabled(false);
|
||||
actionPlace->setEnabled(false);
|
||||
actionRoute->setEnabled(false);
|
||||
|
||||
@ -176,10 +195,23 @@ void MainWindow::pack_finished(bool status)
|
||||
if (status) {
|
||||
log("Packing design successful.\n");
|
||||
actionPlace->setEnabled(true);
|
||||
actionAssignBudget->setEnabled(true);
|
||||
} else {
|
||||
log("Packing design failed.\n");
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::budget_finish(bool status)
|
||||
{
|
||||
disableActions();
|
||||
if (status) {
|
||||
log("Assigning timing budget successful.\n");
|
||||
actionPlace->setEnabled(true);
|
||||
} else {
|
||||
log("Assigning timing budget failed.\n");
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::place_finished(bool status)
|
||||
{
|
||||
disableActions();
|
||||
@ -219,4 +251,24 @@ void MainWindow::taskPaused()
|
||||
actionStop->setEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::budget()
|
||||
{
|
||||
bool ok;
|
||||
double freq = QInputDialog::getDouble(this, "Assign timing budget",
|
||||
"Frequency [MHz]:",
|
||||
50, 0, 250, 2, &ok);
|
||||
if (ok) {
|
||||
freq *= 1e6;
|
||||
timing_driven = true;
|
||||
Q_EMIT budget(freq);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::place()
|
||||
{
|
||||
Q_EMIT place(timing_driven);
|
||||
}
|
||||
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
@ -36,11 +36,20 @@ class MainWindow : public BaseMainWindow
|
||||
public:
|
||||
void createMenu();
|
||||
|
||||
Q_SIGNALS:
|
||||
void budget(double freq);
|
||||
void place(bool timing_driven);
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void open();
|
||||
virtual bool save();
|
||||
|
||||
void budget();
|
||||
void place();
|
||||
|
||||
void loadfile_finished(bool status);
|
||||
void pack_finished(bool status);
|
||||
void budget_finish(bool status);
|
||||
void place_finished(bool status);
|
||||
void route_finished(bool status);
|
||||
|
||||
@ -53,11 +62,14 @@ class MainWindow : public BaseMainWindow
|
||||
|
||||
TaskManager *task;
|
||||
QAction *actionPack;
|
||||
QAction *actionAssignBudget;
|
||||
QAction *actionPlace;
|
||||
QAction *actionRoute;
|
||||
QAction *actionPlay;
|
||||
QAction *actionPause;
|
||||
QAction *actionStop;
|
||||
|
||||
bool timing_driven;
|
||||
};
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
@ -6,5 +6,6 @@
|
||||
<file>resources/pack.png</file>
|
||||
<file>resources/place.png</file>
|
||||
<file>resources/route.png</file>
|
||||
<file>resources/time_add.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
gui/ice40/resources/time_add.png
Normal file
BIN
gui/ice40/resources/time_add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 827 B |
@ -72,20 +72,30 @@ void Worker::pack()
|
||||
{
|
||||
Q_EMIT taskStarted();
|
||||
try {
|
||||
Q_EMIT pack_finished(pack_design(ctx));
|
||||
bool res = pack_design(ctx);
|
||||
print_utilisation(ctx);
|
||||
Q_EMIT pack_finished(res);
|
||||
} catch (WorkerInterruptionRequested) {
|
||||
Q_EMIT taskCanceled();
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::place()
|
||||
void Worker::budget(double freq)
|
||||
{
|
||||
Q_EMIT taskStarted();
|
||||
try {
|
||||
double freq = 50e6;
|
||||
assign_budget(ctx, freq);
|
||||
print_utilisation(ctx);
|
||||
Q_EMIT place_finished(place_design_sa(ctx));
|
||||
Q_EMIT budget_finish(true);
|
||||
} catch (WorkerInterruptionRequested) {
|
||||
Q_EMIT taskCanceled();
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::place(bool timing_driven)
|
||||
{
|
||||
Q_EMIT taskStarted();
|
||||
try {
|
||||
Q_EMIT place_finished(place_design_sa(ctx, timing_driven));
|
||||
} catch (WorkerInterruptionRequested) {
|
||||
Q_EMIT taskCanceled();
|
||||
}
|
||||
@ -110,6 +120,7 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
|
||||
|
||||
connect(this, &TaskManager::loadfile, worker, &Worker::loadfile);
|
||||
connect(this, &TaskManager::pack, worker, &Worker::pack);
|
||||
connect(this, &TaskManager::budget, worker, &Worker::budget);
|
||||
connect(this, &TaskManager::place, worker, &Worker::place);
|
||||
connect(this, &TaskManager::route, worker, &Worker::route);
|
||||
|
||||
@ -117,6 +128,7 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
|
||||
connect(worker, &Worker::loadfile_finished, this,
|
||||
&TaskManager::loadfile_finished);
|
||||
connect(worker, &Worker::pack_finished, this, &TaskManager::pack_finished);
|
||||
connect(worker, &Worker::budget_finish, this, &TaskManager::budget_finish);
|
||||
connect(worker, &Worker::place_finished, this,
|
||||
&TaskManager::place_finished);
|
||||
connect(worker, &Worker::route_finished, this,
|
||||
|
@ -36,12 +36,14 @@ class Worker : public QObject
|
||||
public Q_SLOTS:
|
||||
void loadfile(const std::string &);
|
||||
void pack();
|
||||
void place();
|
||||
void budget(double freq);
|
||||
void place(bool timing_driven);
|
||||
void route();
|
||||
Q_SIGNALS:
|
||||
void log(const std::string &text);
|
||||
void loadfile_finished(bool status);
|
||||
void pack_finished(bool status);
|
||||
void budget_finish(bool status);
|
||||
void place_finished(bool status);
|
||||
void route_finished(bool status);
|
||||
void taskCanceled();
|
||||
@ -72,13 +74,15 @@ class TaskManager : public QObject
|
||||
void terminate();
|
||||
void loadfile(const std::string &);
|
||||
void pack();
|
||||
void place();
|
||||
void budget(double freq);
|
||||
void place(bool timing_driven);
|
||||
void route();
|
||||
|
||||
// redirected signals
|
||||
void log(const std::string &text);
|
||||
void loadfile_finished(bool status);
|
||||
void pack_finished(bool status);
|
||||
void budget_finish(bool status);
|
||||
void place_finished(bool status);
|
||||
void route_finished(bool status);
|
||||
void taskCanceled();
|
||||
|
Loading…
Reference in New Issue
Block a user