Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
This commit is contained in:
commit
001c6ceb56
@ -11,9 +11,6 @@ Prequisites
|
|||||||
|
|
||||||
- CMake 3.3 or later
|
- CMake 3.3 or later
|
||||||
- Modern C++11 compiler (`clang-format` required for development)
|
- Modern C++11 compiler (`clang-format` required for development)
|
||||||
- Note: clang may run out of memory building the chipdbs (peak memory
|
|
||||||
~11GB) due to the system currently used. Use gcc, or the 1k-only
|
|
||||||
flag, if this causes a problem.
|
|
||||||
- Qt5 or later (`qt5-default` for Ubuntu 16.04)
|
- Qt5 or later (`qt5-default` for Ubuntu 16.04)
|
||||||
- Python 3.5 or later, including development libraries (`python3-dev` for Ubuntu)
|
- Python 3.5 or later, including development libraries (`python3-dev` for Ubuntu)
|
||||||
- Boost libraries (`libboost-dev` or `libboost-all-dev` for Ubuntu)
|
- Boost libraries (`libboost-dev` or `libboost-all-dev` for Ubuntu)
|
||||||
@ -29,8 +26,8 @@ Building
|
|||||||
- For a release build, run `cmake .`
|
- For a release build, run `cmake .`
|
||||||
- Add `-DCMAKE_INSTALL_PREFIX=/your/install/prefix` to use a different install prefix to the default `/usr/local`
|
- Add `-DCMAKE_INSTALL_PREFIX=/your/install/prefix` to use a different install prefix to the default `/usr/local`
|
||||||
- Use Make to run the build itself
|
- Use Make to run the build itself
|
||||||
- For all targets, just run `make`
|
- For all binary targets, just run `make`
|
||||||
- For just the iCE40 CLI binary, run `make nextpnr-ice40`
|
- For just the iCE40 CLI&GUI binary, run `make nextpnr-ice40`
|
||||||
- For just the iCE40 Python module, run `make nextpnrpy_ice40`
|
- For just the iCE40 Python module, run `make nextpnrpy_ice40`
|
||||||
- Using too many parallel jobs may lead to out-of-memory issues due to the significant memory needed to build the chipdbs
|
- Using too many parallel jobs may lead to out-of-memory issues due to the significant memory needed to build the chipdbs
|
||||||
- To install nextpnr, run `make install`
|
- To install nextpnr, run `make install`
|
||||||
|
@ -146,8 +146,9 @@ class SAPlacer
|
|||||||
|
|
||||||
// Calculate wirelength after initial placement
|
// Calculate wirelength after initial placement
|
||||||
curr_wirelength = 0;
|
curr_wirelength = 0;
|
||||||
|
curr_tns = 0;
|
||||||
for (auto net : ctx->nets) {
|
for (auto net : ctx->nets) {
|
||||||
wirelen_t wl = get_wirelength(net.second);
|
wirelen_t wl = get_wirelength(net.second, curr_tns);
|
||||||
wirelengths[net.first] = wl;
|
wirelengths[net.first] = wl;
|
||||||
curr_wirelength += wl;
|
curr_wirelength += wl;
|
||||||
}
|
}
|
||||||
@ -162,8 +163,9 @@ class SAPlacer
|
|||||||
improved = false;
|
improved = false;
|
||||||
|
|
||||||
if (iter % 5 == 0 || iter == 1)
|
if (iter % 5 == 0 || iter == 1)
|
||||||
log_info(" at iteration #%d: temp = %f, wire length = %f\n",
|
log_info(" at iteration #%d: temp = %f, wire length = "
|
||||||
iter, temp, double(curr_wirelength));
|
"%.0f, est tns = %.02fns\n",
|
||||||
|
iter, temp, double(curr_wirelength), curr_tns);
|
||||||
|
|
||||||
for (int m = 0; m < 15; ++m) {
|
for (int m = 0; m < 15; ++m) {
|
||||||
// Loop through all automatically placed cells
|
// Loop through all automatically placed cells
|
||||||
@ -220,8 +222,9 @@ class SAPlacer
|
|||||||
// Recalculate total wirelength entirely to avoid rounding errors
|
// Recalculate total wirelength entirely to avoid rounding errors
|
||||||
// accumulating over time
|
// accumulating over time
|
||||||
curr_wirelength = 0;
|
curr_wirelength = 0;
|
||||||
|
curr_tns = 0;
|
||||||
for (auto net : ctx->nets) {
|
for (auto net : ctx->nets) {
|
||||||
wirelen_t wl = get_wirelength(net.second);
|
wirelen_t wl = get_wirelength(net.second, curr_tns);
|
||||||
wirelengths[net.first] = wl;
|
wirelengths[net.first] = wl;
|
||||||
curr_wirelength += wl;
|
curr_wirelength += wl;
|
||||||
}
|
}
|
||||||
@ -308,7 +311,7 @@ class SAPlacer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the total estimated wirelength for a net
|
// Get the total estimated wirelength for a net
|
||||||
wirelen_t get_wirelength(NetInfo *net)
|
wirelen_t get_wirelength(NetInfo *net, float &tns)
|
||||||
{
|
{
|
||||||
wirelen_t wirelength = 0;
|
wirelen_t wirelength = 0;
|
||||||
int driver_x, driver_y;
|
int driver_x, driver_y;
|
||||||
@ -337,6 +340,8 @@ class SAPlacer
|
|||||||
delay_t raw_wl = ctx->estimateDelay(drv_wire, user_wire);
|
delay_t raw_wl = ctx->estimateDelay(drv_wire, user_wire);
|
||||||
float slack =
|
float slack =
|
||||||
ctx->getDelayNS(load.budget) - ctx->getDelayNS(raw_wl);
|
ctx->getDelayNS(load.budget) - ctx->getDelayNS(raw_wl);
|
||||||
|
if (slack < 0)
|
||||||
|
tns += slack;
|
||||||
worst_slack = std::min(slack, worst_slack);
|
worst_slack = std::min(slack, worst_slack);
|
||||||
int load_x, load_y;
|
int load_x, load_y;
|
||||||
bool load_gb;
|
bool load_gb;
|
||||||
@ -348,8 +353,9 @@ class SAPlacer
|
|||||||
xmax = std::max(xmax, load_x);
|
xmax = std::max(xmax, load_x);
|
||||||
ymax = std::max(ymax, load_y);
|
ymax = std::max(ymax, load_y);
|
||||||
}
|
}
|
||||||
wirelength = wirelen_t((((ymax - ymin) + (xmax - xmin)) *
|
wirelength =
|
||||||
(1.0 + std::exp(-worst_slack / 5))));
|
wirelen_t((((ymax - ymin) + (xmax - xmin)) *
|
||||||
|
std::min(5.0, (1.0 + std::exp(-worst_slack / 5)))));
|
||||||
return wirelength;
|
return wirelength;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,16 +409,16 @@ class SAPlacer
|
|||||||
// Recalculate wirelengths for all nets touched by the peturbation
|
// Recalculate wirelengths for all nets touched by the peturbation
|
||||||
for (auto net : update) {
|
for (auto net : update) {
|
||||||
new_wirelength -= wirelengths.at(net->name);
|
new_wirelength -= wirelengths.at(net->name);
|
||||||
wirelen_t net_new_wl = get_wirelength(net);
|
float temp_tns = 0;
|
||||||
|
wirelen_t net_new_wl = get_wirelength(net, temp_tns);
|
||||||
new_wirelength += net_new_wl;
|
new_wirelength += net_new_wl;
|
||||||
new_lengths.push_back(std::make_pair(net->name, net_new_wl));
|
new_lengths.push_back(std::make_pair(net->name, net_new_wl));
|
||||||
}
|
}
|
||||||
delta = new_wirelength - curr_wirelength;
|
delta = new_wirelength - curr_wirelength;
|
||||||
n_move++;
|
n_move++;
|
||||||
// SA acceptance criterea
|
// SA acceptance criterea
|
||||||
if (delta < 0 || (temp > 1e-6 &&
|
if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <=
|
||||||
(ctx->rng() / float(0x3fffffff)) <=
|
std::exp(-delta / temp))) {
|
||||||
std::exp(-(delta / 2) / temp))) {
|
|
||||||
n_accept++;
|
n_accept++;
|
||||||
if (delta < 2)
|
if (delta < 2)
|
||||||
improved = true;
|
improved = true;
|
||||||
@ -466,6 +472,7 @@ class SAPlacer
|
|||||||
Context *ctx;
|
Context *ctx;
|
||||||
std::unordered_map<IdString, wirelen_t> wirelengths;
|
std::unordered_map<IdString, wirelen_t> wirelengths;
|
||||||
wirelen_t curr_wirelength = std::numeric_limits<wirelen_t>::max();
|
wirelen_t curr_wirelength = std::numeric_limits<wirelen_t>::max();
|
||||||
|
float curr_tns = 0;
|
||||||
float temp = 1000;
|
float temp = 1000;
|
||||||
bool improved = false;
|
bool improved = false;
|
||||||
int n_move, n_accept;
|
int n_move, n_accept;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#ifndef UTIL_H
|
#ifndef UTIL_H
|
||||||
#define UTIL_H
|
#define UTIL_H
|
||||||
|
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
|
||||||
@ -56,6 +57,14 @@ bool bool_or_default(const Container &ct, const KeyType &key, bool def = false)
|
|||||||
{
|
{
|
||||||
return bool(int_or_default(ct, key, int(def)));
|
return bool(int_or_default(ct, key, int(def)));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Wrap an unordered_map, and allow it to be iterated over sorted by key
|
||||||
|
template <typename K, typename V>
|
||||||
|
std::map<K, V> sorted(const std::unordered_map<K, V> &orig)
|
||||||
|
{
|
||||||
|
return std::map<K, V>(orig.begin(), orig.end());
|
||||||
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|||||||
|
|
||||||
aux_source_directory(. GUI_SOURCE_FILES)
|
aux_source_directory(. GUI_SOURCE_FILES)
|
||||||
aux_source_directory(${family}/ GUI_SOURCE_FILES)
|
aux_source_directory(${family}/ GUI_SOURCE_FILES)
|
||||||
set(_RESOURCES nextpnr.qrc)
|
set(_RESOURCES base.qrc ${family}/nextpnr.qrc)
|
||||||
|
|
||||||
qt5_add_resources(GUI_RESOURCE_FILES ${_RESOURCES})
|
qt5_add_resources(GUI_RESOURCE_FILES ${_RESOURCES})
|
||||||
|
|
||||||
|
@ -10,10 +10,14 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "pythontab.h"
|
#include "pythontab.h"
|
||||||
|
|
||||||
|
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
|
BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
|
||||||
: QMainWindow(parent), ctx(_ctx)
|
: QMainWindow(parent), ctx(_ctx)
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(nextpnr);
|
initBasenameResource();
|
||||||
qRegisterMetaType<std::string>();
|
qRegisterMetaType<std::string>();
|
||||||
|
|
||||||
log_files.clear();
|
log_files.clear();
|
||||||
@ -114,3 +118,5 @@ void BaseMainWindow::createMenusAndBars()
|
|||||||
mainToolBar->addAction(actionOpen);
|
mainToolBar->addAction(actionOpen);
|
||||||
mainToolBar->addAction(actionSave);
|
mainToolBar->addAction(actionSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -11,11 +11,10 @@
|
|||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
|
||||||
// FIXME
|
|
||||||
USING_NEXTPNR_NAMESPACE
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(std::string)
|
Q_DECLARE_METATYPE(std::string)
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
class BaseMainWindow : public QMainWindow
|
class BaseMainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -45,4 +44,6 @@ class BaseMainWindow : public QMainWindow
|
|||||||
QStatusBar *statusBar;
|
QStatusBar *statusBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // BASEMAINWINDOW_H
|
#endif // BASEMAINWINDOW_H
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "fpgaviewwidget.h"
|
#include "fpgaviewwidget.h"
|
||||||
#include "pybindings.h"
|
#include "pybindings.h"
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
enum class ElementType
|
enum class ElementType
|
||||||
{
|
{
|
||||||
BEL,
|
BEL,
|
||||||
@ -234,3 +236,5 @@ void DesignWidget::selectObject()
|
|||||||
{
|
{
|
||||||
Q_EMIT info("selected " + itemContextMenu->text(0).toStdString() + "\n");
|
Q_EMIT info("selected " + itemContextMenu->text(0).toStdString() + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
#include "qttreepropertybrowser.h"
|
#include "qttreepropertybrowser.h"
|
||||||
#include "qtvariantproperty.h"
|
#include "qtvariantproperty.h"
|
||||||
|
|
||||||
// FIXME
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
USING_NEXTPNR_NAMESPACE
|
|
||||||
|
|
||||||
class DesignWidget : public QWidget
|
class DesignWidget : public QWidget
|
||||||
{
|
{
|
||||||
@ -45,4 +44,6 @@ class DesignWidget : public QWidget
|
|||||||
QMap<QString, QtVariantProperty *> idToProperty;
|
QMap<QString, QtVariantProperty *> idToProperty;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // DESIGNWIDGET_H
|
#endif // DESIGNWIDGET_H
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
||||||
: BaseMainWindow(_ctx, parent)
|
: BaseMainWindow(_ctx, parent)
|
||||||
{
|
{
|
||||||
|
initMainResource();
|
||||||
|
|
||||||
std::string title = "nextpnr-dummy - " + ctx->getChipName();
|
std::string title = "nextpnr-dummy - " + ctx->getChipName();
|
||||||
setWindowTitle(title.c_str());
|
setWindowTitle(title.c_str());
|
||||||
|
|
||||||
@ -19,4 +25,6 @@ void MainWindow::createMenu()
|
|||||||
|
|
||||||
void MainWindow::open() {}
|
void MainWindow::open() {}
|
||||||
|
|
||||||
bool MainWindow::save() { return false; }
|
bool MainWindow::save() { return false; }
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
#include "../basewindow.h"
|
#include "../basewindow.h"
|
||||||
|
|
||||||
// FIXME
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
USING_NEXTPNR_NAMESPACE
|
|
||||||
|
|
||||||
class MainWindow : public BaseMainWindow
|
class MainWindow : public BaseMainWindow
|
||||||
{
|
{
|
||||||
@ -22,4 +21,6 @@ class MainWindow : public BaseMainWindow
|
|||||||
virtual bool save();
|
virtual bool save();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
2
gui/dummy/nextpnr.qrc
Normal file
2
gui/dummy/nextpnr.qrc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<RCC>
|
||||||
|
</RCC>
|
@ -6,6 +6,8 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
||||||
: QOpenGLWidget(parent), m_xMove(0), m_yMove(0), m_zDistance(1.0)
|
: QOpenGLWidget(parent), m_xMove(0), m_yMove(0), m_zDistance(1.0)
|
||||||
{
|
{
|
||||||
@ -173,3 +175,5 @@ void FPGAViewWidget::wheelEvent(QWheelEvent *event)
|
|||||||
setZoom(step.y() * -0.1f);
|
setZoom(step.y() * -0.1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
|
||||||
// FIXME
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
USING_NEXTPNR_NAMESPACE
|
|
||||||
|
|
||||||
class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
||||||
{
|
{
|
||||||
@ -49,4 +48,6 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|||||||
Context *ctx;
|
Context *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,24 +11,105 @@
|
|||||||
#include "place_sa.h"
|
#include "place_sa.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
||||||
|
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
||||||
: BaseMainWindow(_ctx, parent)
|
: BaseMainWindow(_ctx, parent)
|
||||||
{
|
{
|
||||||
|
initMainResource();
|
||||||
|
|
||||||
std::string title = "nextpnr-ice40 - " + ctx->getChipName();
|
std::string title = "nextpnr-ice40 - " + ctx->getChipName();
|
||||||
setWindowTitle(title.c_str());
|
setWindowTitle(title.c_str());
|
||||||
|
|
||||||
createMenu();
|
|
||||||
|
|
||||||
task = new TaskManager(_ctx);
|
task = new TaskManager(_ctx);
|
||||||
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(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();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {}
|
MainWindow::~MainWindow() { delete task; }
|
||||||
|
|
||||||
void MainWindow::createMenu()
|
void MainWindow::createMenu()
|
||||||
{
|
{
|
||||||
QMenu *menu_Custom = new QMenu("&ICE 40", menuBar);
|
QMenu *menu_Design = new QMenu("&Design", menuBar);
|
||||||
menuBar->addAction(menu_Custom->menuAction());
|
menuBar->addAction(menu_Design->menuAction());
|
||||||
|
|
||||||
|
actionPack = new QAction("Pack", this);
|
||||||
|
QIcon iconPack;
|
||||||
|
iconPack.addFile(QStringLiteral(":/icons/resources/pack.png"));
|
||||||
|
actionPack->setIcon(iconPack);
|
||||||
|
actionPack->setStatusTip("Pack current design");
|
||||||
|
connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
|
||||||
|
actionPack->setEnabled(false);
|
||||||
|
|
||||||
|
actionPlace = new QAction("Place", this);
|
||||||
|
QIcon iconPlace;
|
||||||
|
iconPlace.addFile(QStringLiteral(":/icons/resources/place.png"));
|
||||||
|
actionPlace->setIcon(iconPlace);
|
||||||
|
actionPlace->setStatusTip("Place current design");
|
||||||
|
connect(actionPlace, SIGNAL(triggered()), task, SIGNAL(place()));
|
||||||
|
actionPlace->setEnabled(false);
|
||||||
|
|
||||||
|
actionRoute = new QAction("Route", this);
|
||||||
|
QIcon iconRoute;
|
||||||
|
iconRoute.addFile(QStringLiteral(":/icons/resources/route.png"));
|
||||||
|
actionRoute->setIcon(iconRoute);
|
||||||
|
actionRoute->setStatusTip("Route current design");
|
||||||
|
connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
|
||||||
|
actionRoute->setEnabled(false);
|
||||||
|
|
||||||
|
QToolBar *taskFPGABar = new QToolBar();
|
||||||
|
addToolBar(Qt::TopToolBarArea, taskFPGABar);
|
||||||
|
|
||||||
|
taskFPGABar->addAction(actionPack);
|
||||||
|
taskFPGABar->addAction(actionPlace);
|
||||||
|
taskFPGABar->addAction(actionRoute);
|
||||||
|
|
||||||
|
menu_Design->addAction(actionPack);
|
||||||
|
menu_Design->addAction(actionPlace);
|
||||||
|
menu_Design->addAction(actionRoute);
|
||||||
|
|
||||||
|
actionPlay = new QAction("Play", this);
|
||||||
|
QIcon iconPlay;
|
||||||
|
iconPlay.addFile(QStringLiteral(":/icons/resources/control_play.png"));
|
||||||
|
actionPlay->setIcon(iconPlay);
|
||||||
|
actionPlay->setStatusTip("Continue running task");
|
||||||
|
connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
|
||||||
|
actionPlay->setEnabled(false);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
taskToolBar->addAction(actionPlay);
|
||||||
|
taskToolBar->addAction(actionPause);
|
||||||
|
taskToolBar->addAction(actionStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::open()
|
void MainWindow::open()
|
||||||
@ -39,7 +120,84 @@ void MainWindow::open()
|
|||||||
tabWidget->setCurrentWidget(info);
|
tabWidget->setCurrentWidget(info);
|
||||||
|
|
||||||
std::string fn = fileName.toStdString();
|
std::string fn = fileName.toStdString();
|
||||||
task->parsejson(fn);
|
disableActions();
|
||||||
|
Q_EMIT task->loadfile(fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool MainWindow::save() { return false; }
|
|
||||||
|
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
|
@ -4,8 +4,7 @@
|
|||||||
#include "../basewindow.h"
|
#include "../basewindow.h"
|
||||||
#include "worker.h"
|
#include "worker.h"
|
||||||
|
|
||||||
// FIXME
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
USING_NEXTPNR_NAMESPACE
|
|
||||||
|
|
||||||
class MainWindow : public BaseMainWindow
|
class MainWindow : public BaseMainWindow
|
||||||
{
|
{
|
||||||
@ -21,9 +20,27 @@ class MainWindow : public BaseMainWindow
|
|||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
virtual void open();
|
virtual void open();
|
||||||
virtual bool save();
|
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:
|
private:
|
||||||
|
void disableActions();
|
||||||
|
|
||||||
TaskManager *task;
|
TaskManager *task;
|
||||||
|
QAction *actionPack;
|
||||||
|
QAction *actionPlace;
|
||||||
|
QAction *actionRoute;
|
||||||
|
QAction *actionPlay;
|
||||||
|
QAction *actionPause;
|
||||||
|
QAction *actionStop;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
10
gui/ice40/nextpnr.qrc
Normal file
10
gui/ice40/nextpnr.qrc
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/icons">
|
||||||
|
<file>resources/control_play.png</file>
|
||||||
|
<file>resources/control_pause.png</file>
|
||||||
|
<file>resources/control_stop.png</file>
|
||||||
|
<file>resources/pack.png</file>
|
||||||
|
<file>resources/place.png</file>
|
||||||
|
<file>resources/route.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
BIN
gui/ice40/resources/control_pause.png
Normal file
BIN
gui/ice40/resources/control_pause.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 721 B |
BIN
gui/ice40/resources/control_play.png
Normal file
BIN
gui/ice40/resources/control_play.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 717 B |
BIN
gui/ice40/resources/control_stop.png
Normal file
BIN
gui/ice40/resources/control_stop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 695 B |
BIN
gui/ice40/resources/pack.png
Normal file
BIN
gui/ice40/resources/pack.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 853 B |
BIN
gui/ice40/resources/place.png
Normal file
BIN
gui/ice40/resources/place.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 825 B |
BIN
gui/ice40/resources/route.png
Normal file
BIN
gui/ice40/resources/route.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 683 B |
@ -10,47 +10,151 @@
|
|||||||
#include "route.h"
|
#include "route.h"
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
|
|
||||||
Worker::Worker(Context *_ctx) : ctx(_ctx)
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
struct WorkerInterruptionRequested
|
||||||
{
|
{
|
||||||
log_write_function = [this](std::string text) { Q_EMIT log(text); };
|
};
|
||||||
|
|
||||||
|
Worker::Worker(Context *_ctx, TaskManager *parent) : ctx(_ctx)
|
||||||
|
{
|
||||||
|
log_write_function = [this, parent](std::string text) {
|
||||||
|
Q_EMIT log(text);
|
||||||
|
if (parent->shouldTerminate()) {
|
||||||
|
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::string fn = filename;
|
||||||
std::ifstream f(fn);
|
std::ifstream f(fn);
|
||||||
try {
|
try {
|
||||||
if (!parse_json_file(f, fn, ctx))
|
Q_EMIT loadfile_finished(parse_json_file(f, fn, ctx));
|
||||||
log_error("Loading design failed.\n");
|
} catch (WorkerInterruptionRequested) {
|
||||||
if (!pack_design(ctx))
|
Q_EMIT taskCanceled();
|
||||||
log_error("Packing design failed.\n");
|
|
||||||
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");
|
|
||||||
} catch (log_execution_error_exception) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager::TaskManager(Context *ctx)
|
void Worker::pack()
|
||||||
{
|
{
|
||||||
Worker *worker = new Worker(ctx);
|
Q_EMIT taskStarted();
|
||||||
|
try {
|
||||||
|
Q_EMIT pack_finished(pack_design(ctx));
|
||||||
|
} catch (WorkerInterruptionRequested) {
|
||||||
|
Q_EMIT taskCanceled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Worker::place()
|
||||||
|
{
|
||||||
|
Q_EMIT taskStarted();
|
||||||
|
try {
|
||||||
|
double freq = 50e6;
|
||||||
|
assign_budget(ctx, freq);
|
||||||
|
print_utilisation(ctx);
|
||||||
|
Q_EMIT place_finished(place_design_sa(ctx));
|
||||||
|
} catch (WorkerInterruptionRequested) {
|
||||||
|
Q_EMIT taskCanceled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Worker::route()
|
||||||
|
{
|
||||||
|
Q_EMIT taskStarted();
|
||||||
|
try {
|
||||||
|
Q_EMIT route_finished(route_design(ctx));
|
||||||
|
} catch (WorkerInterruptionRequested) {
|
||||||
|
Q_EMIT taskCanceled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
|
||||||
|
{
|
||||||
|
Worker *worker = new Worker(ctx, this);
|
||||||
worker->moveToThread(&workerThread);
|
worker->moveToThread(&workerThread);
|
||||||
|
|
||||||
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
|
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::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();
|
workerThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskManager::~TaskManager()
|
TaskManager::~TaskManager()
|
||||||
{
|
{
|
||||||
|
if (workerThread.isRunning())
|
||||||
|
terminate_thread();
|
||||||
workerThread.quit();
|
workerThread.quit();
|
||||||
workerThread.wait();
|
workerThread.wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskManager::info(const std::string &result) { Q_EMIT log(result); }
|
void TaskManager::info(const std::string &result) { Q_EMIT log(result); }
|
||||||
|
|
||||||
|
void TaskManager::terminate_thread()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
toPause = false;
|
||||||
|
toTerminate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TaskManager::shouldTerminate()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
return toTerminate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskManager::clearTerminate()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
toTerminate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskManager::pause_thread()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
toPause = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskManager::continue_thread()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
toPause = false;
|
||||||
|
Q_EMIT taskStarted();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TaskManager::isPaused()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
return toPause;
|
||||||
|
}
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -1,21 +1,33 @@
|
|||||||
#ifndef WORKER_H
|
#ifndef WORKER_H
|
||||||
#define WORKER_H
|
#define WORKER_H
|
||||||
|
|
||||||
|
#include <QMutex>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
|
||||||
// FIXME
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
USING_NEXTPNR_NAMESPACE
|
|
||||||
|
class TaskManager;
|
||||||
|
|
||||||
class Worker : public QObject
|
class Worker : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Worker(Context *ctx);
|
Worker(Context *ctx, TaskManager *parent);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void parsejson(const std::string &filename);
|
void loadfile(const std::string &);
|
||||||
|
void pack();
|
||||||
|
void place();
|
||||||
|
void route();
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void log(const std::string &text);
|
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:
|
private:
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
@ -29,11 +41,37 @@ class TaskManager : public QObject
|
|||||||
public:
|
public:
|
||||||
TaskManager(Context *ctx);
|
TaskManager(Context *ctx);
|
||||||
~TaskManager();
|
~TaskManager();
|
||||||
|
bool shouldTerminate();
|
||||||
|
void clearTerminate();
|
||||||
|
bool isPaused();
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void info(const std::string &text);
|
void info(const std::string &text);
|
||||||
|
void terminate_thread();
|
||||||
|
void pause_thread();
|
||||||
|
void continue_thread();
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void parsejson(const std::string &);
|
void terminate();
|
||||||
|
void loadfile(const std::string &);
|
||||||
|
void pack();
|
||||||
|
void place();
|
||||||
|
void route();
|
||||||
|
|
||||||
|
// redirected signals
|
||||||
void log(const std::string &text);
|
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;
|
||||||
|
bool toTerminate;
|
||||||
|
bool toPause;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // WORKER_H
|
#endif // WORKER_H
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "infotab.h"
|
#include "infotab.h"
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
InfoTab::InfoTab(QWidget *parent) : QWidget(parent)
|
InfoTab::InfoTab(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
plainTextEdit = new QPlainTextEdit();
|
plainTextEdit = new QPlainTextEdit();
|
||||||
@ -37,3 +39,5 @@ void InfoTab::showContextMenu(const QPoint &pt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InfoTab::clearBuffer() { plainTextEdit->clear(); }
|
void InfoTab::clearBuffer() { plainTextEdit->clear(); }
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
|
||||||
// FIXME
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
USING_NEXTPNR_NAMESPACE
|
|
||||||
|
|
||||||
class InfoTab : public QWidget
|
class InfoTab : public QWidget
|
||||||
{
|
{
|
||||||
@ -24,4 +23,6 @@ class InfoTab : public QWidget
|
|||||||
QMenu *contextMenu;
|
QMenu *contextMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // INFOTAB_H
|
#endif // INFOTAB_H
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "line_editor.h"
|
#include "line_editor.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
LineEditor::LineEditor(QWidget *parent) : QLineEdit(parent), index(0)
|
LineEditor::LineEditor(QWidget *parent) : QLineEdit(parent), index(0)
|
||||||
{
|
{
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
@ -64,4 +65,6 @@ void LineEditor::clearHistory()
|
|||||||
lines.clear();
|
lines.clear();
|
||||||
index = 0;
|
index = 0;
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include "nextpnr.h"
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
class LineEditor : public QLineEdit
|
class LineEditor : public QLineEdit
|
||||||
{
|
{
|
||||||
@ -28,4 +31,6 @@ class LineEditor : public QLineEdit
|
|||||||
QMenu *contextMenu;
|
QMenu *contextMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // LINE_EDITOR_H
|
#endif // LINE_EDITOR_H
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "emb.h"
|
#include "emb.h"
|
||||||
#include "pybindings.h"
|
#include "pybindings.h"
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
PythonTab::PythonTab(QWidget *parent) : QWidget(parent)
|
PythonTab::PythonTab(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
PyImport_ImportModule("emb");
|
PyImport_ImportModule("emb");
|
||||||
@ -114,4 +116,6 @@ void PythonTab::showContextMenu(const QPoint &pt)
|
|||||||
contextMenu->exec(mapToGlobal(pt));
|
contextMenu->exec(mapToGlobal(pt));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonTab::clearBuffer() { plainTextEdit->clear(); }
|
void PythonTab::clearBuffer() { plainTextEdit->clear(); }
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
#include "line_editor.h"
|
#include "line_editor.h"
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
|
|
||||||
// FIXME
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
USING_NEXTPNR_NAMESPACE
|
|
||||||
|
|
||||||
class PythonTab : public QWidget
|
class PythonTab : public QWidget
|
||||||
{
|
{
|
||||||
@ -33,4 +32,6 @@ class PythonTab : public QWidget
|
|||||||
emb::stdout_write_type write;
|
emb::stdout_write_type write;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif // PYTHONTAB_H
|
#endif // PYTHONTAB_H
|
||||||
|
@ -229,6 +229,16 @@ void write_asc(const Context *ctx, std::ostream &out)
|
|||||||
set_config(ti, config.at(iey).at(iex),
|
set_config(ti, config.at(iey).at(iex),
|
||||||
"IoCtrl.REN_" + std::to_string(iez), !pullup);
|
"IoCtrl.REN_" + std::to_string(iez), !pullup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->args.type == ArchArgs::UP5K) {
|
||||||
|
if (iez == 0) {
|
||||||
|
set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_39",
|
||||||
|
!pullup);
|
||||||
|
} else if (iez == 1) {
|
||||||
|
set_config(ti, config.at(iey).at(iex), "IoCtrl.cf_bit_35",
|
||||||
|
!pullup);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (cell.second->type == ctx->id("SB_GB")) {
|
} else if (cell.second->type == ctx->id("SB_GB")) {
|
||||||
// no cell config bits
|
// no cell config bits
|
||||||
} else if (cell.second->type == ctx->id("ICESTORM_RAM")) {
|
} else if (cell.second->type == ctx->id("ICESTORM_RAM")) {
|
||||||
@ -312,7 +322,8 @@ void write_asc(const Context *ctx, std::ostream &out)
|
|||||||
ctx->args.type == ArchArgs::HX8K) {
|
ctx->args.type == ArchArgs::HX8K) {
|
||||||
setColBufCtrl = (y == 8 || y == 9 || y == 24 || y == 25);
|
setColBufCtrl = (y == 8 || y == 9 || y == 24 || y == 25);
|
||||||
} else if (ctx->args.type == ArchArgs::UP5K) {
|
} else if (ctx->args.type == ArchArgs::UP5K) {
|
||||||
if (tile == TILE_LOGIC) {
|
if (tile == TILE_LOGIC || tile == TILE_RAMB ||
|
||||||
|
tile == TILE_RAMT) {
|
||||||
setColBufCtrl = (y == 4 || y == 5 || y == 14 || y == 15 ||
|
setColBufCtrl = (y == 4 || y == 5 || y == 14 || y == 15 ||
|
||||||
y == 26 || y == 27);
|
y == 26 || y == 27);
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
USING_NEXTPNR_NAMESPACE
|
||||||
|
|
||||||
void svg_dump_el(const GraphicElement &el)
|
void svg_dump_el(const GraphicElement &el)
|
||||||
{
|
{
|
||||||
float scale = 10.0, offset = 10.0;
|
float scale = 10.0, offset = 10.0;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "cells.h"
|
#include "cells.h"
|
||||||
#include "design_utils.h"
|
#include "design_utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ static void pack_lut_lutffs(Context *ctx)
|
|||||||
|
|
||||||
std::unordered_set<IdString> packed_cells;
|
std::unordered_set<IdString> packed_cells;
|
||||||
std::vector<CellInfo *> new_cells;
|
std::vector<CellInfo *> new_cells;
|
||||||
for (auto cell : ctx->cells) {
|
for (auto cell : sorted(ctx->cells)) {
|
||||||
CellInfo *ci = cell.second;
|
CellInfo *ci = cell.second;
|
||||||
if (ctx->verbose)
|
if (ctx->verbose)
|
||||||
log_info("cell '%s' is of type '%s'\n", ci->name.c_str(ctx),
|
log_info("cell '%s' is of type '%s'\n", ci->name.c_str(ctx),
|
||||||
@ -96,7 +97,7 @@ static void pack_nonlut_ffs(Context *ctx)
|
|||||||
std::unordered_set<IdString> packed_cells;
|
std::unordered_set<IdString> packed_cells;
|
||||||
std::vector<CellInfo *> new_cells;
|
std::vector<CellInfo *> new_cells;
|
||||||
|
|
||||||
for (auto cell : ctx->cells) {
|
for (auto cell : sorted(ctx->cells)) {
|
||||||
CellInfo *ci = cell.second;
|
CellInfo *ci = cell.second;
|
||||||
if (is_ff(ctx, ci)) {
|
if (is_ff(ctx, ci)) {
|
||||||
CellInfo *packed = create_ice_cell(ctx, "ICESTORM_LC",
|
CellInfo *packed = create_ice_cell(ctx, "ICESTORM_LC",
|
||||||
@ -126,7 +127,7 @@ static void pack_carries(Context *ctx)
|
|||||||
|
|
||||||
std::unordered_set<IdString> packed_cells;
|
std::unordered_set<IdString> packed_cells;
|
||||||
|
|
||||||
for (auto cell : ctx->cells) {
|
for (auto cell : sorted(ctx->cells)) {
|
||||||
CellInfo *ci = cell.second;
|
CellInfo *ci = cell.second;
|
||||||
if (is_carry(ctx, ci)) {
|
if (is_carry(ctx, ci)) {
|
||||||
packed_cells.insert(cell.first);
|
packed_cells.insert(cell.first);
|
||||||
@ -201,7 +202,7 @@ static void pack_ram(Context *ctx)
|
|||||||
std::unordered_set<IdString> packed_cells;
|
std::unordered_set<IdString> packed_cells;
|
||||||
std::vector<CellInfo *> new_cells;
|
std::vector<CellInfo *> new_cells;
|
||||||
|
|
||||||
for (auto cell : ctx->cells) {
|
for (auto cell : sorted(ctx->cells)) {
|
||||||
CellInfo *ci = cell.second;
|
CellInfo *ci = cell.second;
|
||||||
if (is_ram(ctx, ci)) {
|
if (is_ram(ctx, ci)) {
|
||||||
CellInfo *packed = create_ice_cell(ctx, "ICESTORM_RAM",
|
CellInfo *packed = create_ice_cell(ctx, "ICESTORM_RAM",
|
||||||
@ -285,7 +286,7 @@ static void pack_constants(Context *ctx)
|
|||||||
|
|
||||||
bool gnd_used = false, vcc_used = false;
|
bool gnd_used = false, vcc_used = false;
|
||||||
|
|
||||||
for (auto net : ctx->nets) {
|
for (auto net : sorted(ctx->nets)) {
|
||||||
NetInfo *ni = net.second;
|
NetInfo *ni = net.second;
|
||||||
if (ni->driver.cell != nullptr &&
|
if (ni->driver.cell != nullptr &&
|
||||||
ni->driver.cell->type == ctx->id("GND")) {
|
ni->driver.cell->type == ctx->id("GND")) {
|
||||||
@ -329,7 +330,7 @@ static void pack_io(Context *ctx)
|
|||||||
|
|
||||||
log_info("Packing IOs..\n");
|
log_info("Packing IOs..\n");
|
||||||
|
|
||||||
for (auto cell : ctx->cells) {
|
for (auto cell : sorted(ctx->cells)) {
|
||||||
CellInfo *ci = cell.second;
|
CellInfo *ci = cell.second;
|
||||||
if (is_nextpnr_iob(ctx, ci)) {
|
if (is_nextpnr_iob(ctx, ci)) {
|
||||||
CellInfo *sb = nullptr;
|
CellInfo *sb = nullptr;
|
||||||
@ -412,8 +413,8 @@ static void promote_globals(Context *ctx)
|
|||||||
{
|
{
|
||||||
log_info("Promoting globals..\n");
|
log_info("Promoting globals..\n");
|
||||||
|
|
||||||
std::unordered_map<IdString, int> clock_count, reset_count, cen_count;
|
std::map<IdString, int> clock_count, reset_count, cen_count;
|
||||||
for (auto net : ctx->nets) {
|
for (auto net : sorted(ctx->nets)) {
|
||||||
NetInfo *ni = net.second;
|
NetInfo *ni = net.second;
|
||||||
if (ni->driver.cell != nullptr && !is_global_net(ctx, ni)) {
|
if (ni->driver.cell != nullptr && !is_global_net(ctx, ni)) {
|
||||||
clock_count[net.first] = 0;
|
clock_count[net.first] = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user