clangformat cleanup
This commit is contained in:
parent
c0b1078c12
commit
4b78ae15df
@ -107,8 +107,7 @@ PyMODINIT_FUNC PyInit_emb(void)
|
||||
PyObject *m = PyModule_Create(&embmodule);
|
||||
if (m) {
|
||||
Py_INCREF(&StdoutType);
|
||||
PyModule_AddObject(m, "Stdout",
|
||||
reinterpret_cast<PyObject *>(&StdoutType));
|
||||
PyModule_AddObject(m, "Stdout", reinterpret_cast<PyObject *>(&StdoutType));
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
@ -29,10 +29,10 @@
|
||||
#endif
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <iostream>
|
||||
#include "log.h"
|
||||
#include "nextpnr.h"
|
||||
#include "version.h"
|
||||
#include <iostream>
|
||||
|
||||
USING_NEXTPNR_NAMESPACE
|
||||
|
||||
@ -55,18 +55,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
po::positional_options_description pos;
|
||||
#ifndef NO_PYTHON
|
||||
options.add_options()("run", po::value<std::vector<std::string>>(),
|
||||
"python file to execute");
|
||||
options.add_options()("run", po::value<std::vector<std::string>>(), "python file to execute");
|
||||
pos.add("run", -1);
|
||||
#endif
|
||||
options.add_options()("version,V", "show version");
|
||||
|
||||
po::variables_map vm;
|
||||
try {
|
||||
po::parsed_options parsed = po::command_line_parser(argc, argv)
|
||||
.options(options)
|
||||
.positional(pos)
|
||||
.run();
|
||||
po::parsed_options parsed = po::command_line_parser(argc, argv).options(options).positional(pos).run();
|
||||
|
||||
po::store(parsed, vm);
|
||||
|
||||
@ -79,8 +75,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (vm.count("help") || argc == 1) {
|
||||
std::cout << boost::filesystem::basename(argv[0])
|
||||
<< " -- Next Generation Place and Route (git "
|
||||
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
|
||||
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
||||
std::cout << "\n";
|
||||
std::cout << options << "\n";
|
||||
@ -88,8 +83,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (vm.count("version")) {
|
||||
std::cout << boost::filesystem::basename(argv[0])
|
||||
<< " -- Next Generation Place and Route (git "
|
||||
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
|
||||
"sha1 " GIT_COMMIT_HASH_STR ")\n";
|
||||
return 1;
|
||||
}
|
||||
@ -115,8 +109,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#ifndef NO_PYTHON
|
||||
if (vm.count("run")) {
|
||||
std::vector<std::string> files =
|
||||
vm["run"].as<std::vector<std::string>>();
|
||||
std::vector<std::string> files = vm["run"].as<std::vector<std::string>>();
|
||||
for (auto filename : files)
|
||||
execute_python_file(filename.c_str());
|
||||
}
|
||||
|
@ -36,8 +36,7 @@ static void initBasenameResource() { Q_INIT_RESOURCE(base); }
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
|
||||
: QMainWindow(parent), ctx(_ctx)
|
||||
BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent) : QMainWindow(parent), ctx(_ctx)
|
||||
{
|
||||
initBasenameResource();
|
||||
qRegisterMetaType<std::string>();
|
||||
@ -69,8 +68,7 @@ BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
|
||||
designview->setMaximumWidth(300);
|
||||
splitter_h->addWidget(designview);
|
||||
|
||||
connect(designview, SIGNAL(info(std::string)), this,
|
||||
SLOT(writeInfo(std::string)));
|
||||
connect(designview, SIGNAL(info(std::string)), this, SLOT(writeInfo(std::string)));
|
||||
|
||||
tabWidget = new QTabWidget();
|
||||
#ifndef NO_PYTHON
|
||||
|
@ -37,10 +37,7 @@ enum class ElementType
|
||||
class ElementTreeItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
ElementTreeItem(ElementType t, QString str)
|
||||
: QTreeWidgetItem((QTreeWidget *)nullptr, QStringList(str)), type(t)
|
||||
{
|
||||
}
|
||||
ElementTreeItem(ElementType t, QString str) : QTreeWidgetItem((QTreeWidget *)nullptr, QStringList(str)), type(t) {}
|
||||
virtual ~ElementTreeItem(){};
|
||||
|
||||
ElementType getType() { return type; };
|
||||
@ -52,11 +49,7 @@ class ElementTreeItem : public QTreeWidgetItem
|
||||
class BelTreeItem : public ElementTreeItem
|
||||
{
|
||||
public:
|
||||
BelTreeItem(IdString d, ElementType type, QString str)
|
||||
: ElementTreeItem(type, str)
|
||||
{
|
||||
this->data = d;
|
||||
}
|
||||
BelTreeItem(IdString d, ElementType type, QString str) : ElementTreeItem(type, str) { this->data = d; }
|
||||
virtual ~BelTreeItem(){};
|
||||
|
||||
IdString getData() { return this->data; };
|
||||
@ -68,11 +61,7 @@ class BelTreeItem : public ElementTreeItem
|
||||
class WireTreeItem : public ElementTreeItem
|
||||
{
|
||||
public:
|
||||
WireTreeItem(IdString d, ElementType type, QString str)
|
||||
: ElementTreeItem(type, str)
|
||||
{
|
||||
this->data = d;
|
||||
}
|
||||
WireTreeItem(IdString d, ElementType type, QString str) : ElementTreeItem(type, str) { this->data = d; }
|
||||
virtual ~WireTreeItem(){};
|
||||
|
||||
IdString getData() { return this->data; };
|
||||
@ -84,11 +73,7 @@ class WireTreeItem : public ElementTreeItem
|
||||
class PipTreeItem : public ElementTreeItem
|
||||
{
|
||||
public:
|
||||
PipTreeItem(IdString d, ElementType type, QString str)
|
||||
: ElementTreeItem(type, str)
|
||||
{
|
||||
this->data = d;
|
||||
}
|
||||
PipTreeItem(IdString d, ElementType type, QString str) : ElementTreeItem(type, str) { this->data = d; }
|
||||
virtual ~PipTreeItem(){};
|
||||
|
||||
IdString getData() { return this->data; };
|
||||
@ -97,8 +82,7 @@ class PipTreeItem : public ElementTreeItem
|
||||
IdString data;
|
||||
};
|
||||
|
||||
DesignWidget::DesignWidget(Context *_ctx, QWidget *parent)
|
||||
: QWidget(parent), ctx(_ctx)
|
||||
DesignWidget::DesignWidget(Context *_ctx, QWidget *parent) : QWidget(parent), ctx(_ctx)
|
||||
{
|
||||
|
||||
treeWidget = new QTreeWidget();
|
||||
@ -115,8 +99,7 @@ DesignWidget::DesignWidget(Context *_ctx, QWidget *parent)
|
||||
QList<QTreeWidgetItem *> bel_items;
|
||||
for (auto bel : ctx->getBels()) {
|
||||
auto name = ctx->getBelName(bel);
|
||||
bel_items.append(new BelTreeItem(name, ElementType::BEL,
|
||||
QString(name.c_str(ctx))));
|
||||
bel_items.append(new BelTreeItem(name, ElementType::BEL, QString(name.c_str(ctx))));
|
||||
}
|
||||
bel_root->addChildren(bel_items);
|
||||
|
||||
@ -127,8 +110,7 @@ DesignWidget::DesignWidget(Context *_ctx, QWidget *parent)
|
||||
treeWidget->insertTopLevelItem(0, wire_root);
|
||||
for (auto wire : ctx->getWires()) {
|
||||
auto name = ctx->getWireName(wire);
|
||||
wire_items.append(new WireTreeItem(name, ElementType::WIRE,
|
||||
QString(name.c_str(ctx))));
|
||||
wire_items.append(new WireTreeItem(name, ElementType::WIRE, QString(name.c_str(ctx))));
|
||||
}
|
||||
wire_root->addChildren(wire_items);
|
||||
|
||||
@ -139,8 +121,7 @@ DesignWidget::DesignWidget(Context *_ctx, QWidget *parent)
|
||||
treeWidget->insertTopLevelItem(0, pip_root);
|
||||
for (auto pip : ctx->getPips()) {
|
||||
auto name = ctx->getPipName(pip);
|
||||
pip_items.append(new PipTreeItem(name, ElementType::PIP,
|
||||
QString(name.c_str(ctx))));
|
||||
pip_items.append(new PipTreeItem(name, ElementType::PIP, QString(name.c_str(ctx))));
|
||||
}
|
||||
pip_root->addChildren(pip_items);
|
||||
|
||||
@ -165,11 +146,9 @@ DesignWidget::DesignWidget(Context *_ctx, QWidget *parent)
|
||||
setLayout(mainLayout);
|
||||
|
||||
// Connection
|
||||
connect(treeWidget, &QTreeWidget::customContextMenuRequested, this,
|
||||
&DesignWidget::prepareMenu);
|
||||
connect(treeWidget, &QTreeWidget::customContextMenuRequested, this, &DesignWidget::prepareMenu);
|
||||
|
||||
connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
|
||||
SLOT(onItemClicked(QTreeWidgetItem *, int)));
|
||||
connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), SLOT(onItemClicked(QTreeWidgetItem *, int)));
|
||||
}
|
||||
|
||||
DesignWidget::~DesignWidget()
|
||||
@ -188,8 +167,7 @@ void DesignWidget::addProperty(QtVariantProperty *property, const QString &id)
|
||||
|
||||
void DesignWidget::clearProperties()
|
||||
{
|
||||
QMap<QtProperty *, QString>::ConstIterator itProp =
|
||||
propertyToId.constBegin();
|
||||
QMap<QtProperty *, QString>::ConstIterator itProp = propertyToId.constBegin();
|
||||
while (itProp != propertyToId.constEnd()) {
|
||||
delete itProp.key();
|
||||
itProp++;
|
||||
@ -210,23 +188,20 @@ void DesignWidget::onItemClicked(QTreeWidgetItem *item, int pos)
|
||||
if (type == ElementType::BEL) {
|
||||
IdString c = static_cast<BelTreeItem *>(item)->getData();
|
||||
|
||||
QtVariantProperty *topItem =
|
||||
variantManager->addProperty(QVariant::String, QString("Name"));
|
||||
QtVariantProperty *topItem = variantManager->addProperty(QVariant::String, QString("Name"));
|
||||
topItem->setValue(QString(c.c_str(ctx)));
|
||||
addProperty(topItem, QString("Name"));
|
||||
} else if (type == ElementType::WIRE) {
|
||||
IdString c = static_cast<WireTreeItem *>(item)->getData();
|
||||
|
||||
QtVariantProperty *topItem =
|
||||
variantManager->addProperty(QVariant::String, QString("Name"));
|
||||
QtVariantProperty *topItem = variantManager->addProperty(QVariant::String, QString("Name"));
|
||||
topItem->setValue(QString(c.c_str(ctx)));
|
||||
addProperty(topItem, QString("Name"));
|
||||
|
||||
} else if (type == ElementType::PIP) {
|
||||
IdString c = static_cast<PipTreeItem *>(item)->getData();
|
||||
|
||||
QtVariantProperty *topItem =
|
||||
variantManager->addProperty(QVariant::String, QString("Name"));
|
||||
QtVariantProperty *topItem = variantManager->addProperty(QVariant::String, QString("Name"));
|
||||
topItem->setValue(QString(c.c_str(ctx)));
|
||||
addProperty(topItem, QString("Name"));
|
||||
}
|
||||
@ -250,9 +225,6 @@ void DesignWidget::prepareMenu(const QPoint &pos)
|
||||
menu.exec(tree->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void DesignWidget::selectObject()
|
||||
{
|
||||
Q_EMIT info("selected " + itemContextMenu->text(0).toStdString() + "\n");
|
||||
}
|
||||
void DesignWidget::selectObject() { Q_EMIT info("selected " + itemContextMenu->text(0).toStdString() + "\n"); }
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
@ -23,8 +23,7 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
||||
: BaseMainWindow(_ctx, parent)
|
||||
MainWindow::MainWindow(Context *_ctx, QWidget *parent) : BaseMainWindow(_ctx, parent)
|
||||
{
|
||||
initMainResource();
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
void PolyLine::buildPoint(LineShaderData *building, const QVector2D *prev,
|
||||
const QVector2D *cur, const QVector2D *next) const
|
||||
void PolyLine::buildPoint(LineShaderData *building, const QVector2D *prev, const QVector2D *cur,
|
||||
const QVector2D *next) const
|
||||
{
|
||||
// buildPoint emits two vertices per line point, along with normals to move
|
||||
// them the right directio when rendering and miter to compensate for
|
||||
@ -164,13 +164,10 @@ void PolyLine::build(LineShaderData &target) const
|
||||
bool LineShader::compile(void)
|
||||
{
|
||||
program_ = new QOpenGLShaderProgram(parent_);
|
||||
program_->addShaderFromSourceCode(QOpenGLShader::Vertex,
|
||||
vertexShaderSource_);
|
||||
program_->addShaderFromSourceCode(QOpenGLShader::Fragment,
|
||||
fragmentShaderSource_);
|
||||
program_->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource_);
|
||||
program_->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource_);
|
||||
if (!program_->link()) {
|
||||
printf("could not link program: %s\n",
|
||||
program_->log().toStdString().c_str());
|
||||
printf("could not link program: %s\n", program_->log().toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -205,44 +202,35 @@ void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
|
||||
program_->bind();
|
||||
|
||||
buffers_.position.bind();
|
||||
buffers_.position.allocate(&line.vertices[0],
|
||||
sizeof(Vertex2DPOD) * line.vertices.size());
|
||||
buffers_.position.allocate(&line.vertices[0], sizeof(Vertex2DPOD) * line.vertices.size());
|
||||
|
||||
buffers_.normal.bind();
|
||||
buffers_.normal.allocate(&line.normals[0],
|
||||
sizeof(Vertex2DPOD) * line.normals.size());
|
||||
buffers_.normal.allocate(&line.normals[0], sizeof(Vertex2DPOD) * line.normals.size());
|
||||
|
||||
buffers_.miter.bind();
|
||||
buffers_.miter.allocate(&line.miters[0],
|
||||
sizeof(GLfloat) * line.miters.size());
|
||||
buffers_.miter.allocate(&line.miters[0], sizeof(GLfloat) * line.miters.size());
|
||||
|
||||
buffers_.index.bind();
|
||||
buffers_.index.allocate(&line.indices[0],
|
||||
sizeof(GLuint) * line.indices.size());
|
||||
buffers_.index.allocate(&line.indices[0], sizeof(GLuint) * line.indices.size());
|
||||
|
||||
program_->setUniformValue(uniforms_.projection, projection);
|
||||
program_->setUniformValue(uniforms_.thickness, line.thickness);
|
||||
program_->setUniformValue(uniforms_.color, line.color.r, line.color.g,
|
||||
line.color.b, line.color.a);
|
||||
program_->setUniformValue(uniforms_.color, line.color.r, line.color.g, line.color.b, line.color.a);
|
||||
|
||||
buffers_.position.bind();
|
||||
program_->enableAttributeArray("position");
|
||||
gl->glVertexAttribPointer(attributes_.position, 2, GL_FLOAT, GL_FALSE, 0,
|
||||
(void *)0);
|
||||
gl->glVertexAttribPointer(attributes_.position, 2, GL_FLOAT, GL_FALSE, 0, (void *)0);
|
||||
|
||||
buffers_.normal.bind();
|
||||
program_->enableAttributeArray("normal");
|
||||
gl->glVertexAttribPointer(attributes_.normal, 2, GL_FLOAT, GL_FALSE, 0,
|
||||
(void *)0);
|
||||
gl->glVertexAttribPointer(attributes_.normal, 2, GL_FLOAT, GL_FALSE, 0, (void *)0);
|
||||
|
||||
buffers_.miter.bind();
|
||||
program_->enableAttributeArray("miter");
|
||||
gl->glVertexAttribPointer(attributes_.miter, 1, GL_FLOAT, GL_FALSE, 0,
|
||||
(void *)0);
|
||||
gl->glVertexAttribPointer(attributes_.miter, 1, GL_FLOAT, GL_FALSE, 0, (void *)0);
|
||||
|
||||
buffers_.index.bind();
|
||||
gl->glDrawElements(GL_TRIANGLES, line.indices.size(), GL_UNSIGNED_INT,
|
||||
(void *)0);
|
||||
gl->glDrawElements(GL_TRIANGLES, line.indices.size(), GL_UNSIGNED_INT, (void *)0);
|
||||
|
||||
program_->disableAttributeArray("miter");
|
||||
program_->disableAttributeArray("normal");
|
||||
@ -253,8 +241,7 @@ void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
|
||||
}
|
||||
|
||||
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
||||
: QOpenGLWidget(parent), moveX_(0), moveY_(0), zoom_(10.0f),
|
||||
lineShader_(this)
|
||||
: QOpenGLWidget(parent), moveX_(0), moveY_(0), zoom_(10.0f), lineShader_(this)
|
||||
{
|
||||
ctx_ = qobject_cast<BaseMainWindow *>(getMainWindow())->getContext();
|
||||
auto fmt = format();
|
||||
@ -263,8 +250,7 @@ FPGAViewWidget::FPGAViewWidget(QWidget *parent)
|
||||
setFormat(fmt);
|
||||
|
||||
fmt = format();
|
||||
printf("FPGAViewWidget running on OpenGL %d.%d\n", fmt.majorVersion(),
|
||||
fmt.minorVersion());
|
||||
printf("FPGAViewWidget running on OpenGL %d.%d\n", fmt.majorVersion(), fmt.minorVersion());
|
||||
if (fmt.majorVersion() < 3) {
|
||||
printf("Could not get OpenGL 3.0 context. Aborting.\n");
|
||||
log_abort();
|
||||
@ -344,8 +330,7 @@ void FPGAViewWidget::drawElement(LineShaderData &out, const GraphicElement &el)
|
||||
}
|
||||
|
||||
if (el.type == GraphicElement::G_LINE) {
|
||||
PolyLine(offset + scale * el.x1, offset + scale * el.y1,
|
||||
offset + scale * el.x2, offset + scale * el.y2)
|
||||
PolyLine(offset + scale * el.x1, offset + scale * el.y1, offset + scale * el.x2, offset + scale * el.y2)
|
||||
.build(out);
|
||||
}
|
||||
}
|
||||
|
@ -51,15 +51,8 @@ struct ColorPOD
|
||||
GLfloat b;
|
||||
GLfloat a;
|
||||
|
||||
ColorPOD(GLfloat R, GLfloat G, GLfloat B, GLfloat A)
|
||||
: r(R), g(G), b(B), a(A)
|
||||
{
|
||||
}
|
||||
ColorPOD(const QColor &color)
|
||||
: r(color.redF()), g(color.greenF()), b(color.blueF()),
|
||||
a(color.alphaF())
|
||||
{
|
||||
}
|
||||
ColorPOD(GLfloat R, GLfloat G, GLfloat B, GLfloat A) : r(R), g(G), b(B), a(A) {}
|
||||
ColorPOD(const QColor &color) : r(color.redF()), g(color.greenF()), b(color.blueF()), a(color.alphaF()) {}
|
||||
} __attribute__((packed));
|
||||
|
||||
// LineShaderData is a built set of vertices that can be rendered by the
|
||||
@ -75,10 +68,7 @@ struct LineShaderData
|
||||
GLfloat thickness;
|
||||
ColorPOD color;
|
||||
|
||||
LineShaderData(GLfloat Thickness, QColor Color)
|
||||
: thickness(Thickness), color(Color)
|
||||
{
|
||||
}
|
||||
LineShaderData(GLfloat Thickness, QColor Color) : thickness(Thickness), color(Color) {}
|
||||
};
|
||||
|
||||
// PolyLine is a set of segments defined by points, that can be built to a
|
||||
@ -89,8 +79,7 @@ class PolyLine
|
||||
std::vector<QVector2D> points_;
|
||||
bool closed_;
|
||||
|
||||
void buildPoint(LineShaderData *building, const QVector2D *prev,
|
||||
const QVector2D *cur, const QVector2D *next) const;
|
||||
void buildPoint(LineShaderData *building, const QVector2D *prev, const QVector2D *cur, const QVector2D *next) const;
|
||||
|
||||
public:
|
||||
// Create an empty PolyLine.
|
||||
@ -212,8 +201,7 @@ class LineShader
|
||||
" gl_Position = projection * vec4(p, 0.0, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
static constexpr const char *fragmentShaderSource_ =
|
||||
"uniform lowp vec4 color;\n"
|
||||
static constexpr const char *fragmentShaderSource_ = "uniform lowp vec4 color;\n"
|
||||
"void main() {\n"
|
||||
" gl_FragColor = color;\n"
|
||||
"}\n";
|
||||
|
@ -36,8 +36,7 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
||||
: BaseMainWindow(_ctx, parent), timing_driven(false)
|
||||
MainWindow::MainWindow(Context *_ctx, QWidget *parent) : BaseMainWindow(_ctx, parent), timing_driven(false)
|
||||
{
|
||||
initMainResource();
|
||||
|
||||
@ -47,20 +46,16 @@ 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(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,
|
||||
SLOT(route_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()));
|
||||
|
||||
|
||||
connect(this, SIGNAL(budget(double)), task, SIGNAL(budget(double)));
|
||||
connect(this, SIGNAL(place(bool)), task, SIGNAL(place(bool)));
|
||||
|
||||
@ -153,8 +148,7 @@ void MainWindow::createMenu()
|
||||
|
||||
void MainWindow::open()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, QString(), QString(),
|
||||
QString("*.json"));
|
||||
QString fileName = QFileDialog::getOpenFileName(this, QString(), QString(), QString("*.json"));
|
||||
if (!fileName.isEmpty()) {
|
||||
tabWidget->setCurrentWidget(info);
|
||||
|
||||
@ -254,21 +248,14 @@ void MainWindow::taskPaused()
|
||||
void MainWindow::budget()
|
||||
{
|
||||
bool ok;
|
||||
double freq = QInputDialog::getDouble(this, "Assign timing budget",
|
||||
"Frequency [MHz]:",
|
||||
50, 0, 250, 2, &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);
|
||||
}
|
||||
|
||||
void MainWindow::place() { Q_EMIT place(timing_driven); }
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
@ -125,14 +125,11 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
|
||||
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::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,
|
||||
&TaskManager::route_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);
|
||||
|
@ -37,8 +37,7 @@ InfoTab::InfoTab(QWidget *parent) : QWidget(parent)
|
||||
contextMenu = plainTextEdit->createStandardContextMenu();
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(clearAction);
|
||||
connect(plainTextEdit, SIGNAL(customContextMenuRequested(const QPoint)),
|
||||
this, SLOT(showContextMenu(const QPoint)));
|
||||
connect(plainTextEdit, SIGNAL(customContextMenuRequested(const QPoint)), this, SLOT(showContextMenu(const QPoint)));
|
||||
|
||||
QGridLayout *mainLayout = new QGridLayout();
|
||||
mainLayout->addWidget(plainTextEdit);
|
||||
@ -52,10 +51,7 @@ void InfoTab::info(std::string str)
|
||||
plainTextEdit->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
void InfoTab::showContextMenu(const QPoint &pt)
|
||||
{
|
||||
contextMenu->exec(mapToGlobal(pt));
|
||||
}
|
||||
void InfoTab::showContextMenu(const QPoint &pt) { contextMenu->exec(mapToGlobal(pt)); }
|
||||
|
||||
void InfoTab::clearBuffer() { plainTextEdit->clear(); }
|
||||
|
||||
|
@ -33,8 +33,7 @@ LineEditor::LineEditor(QWidget *parent) : QLineEdit(parent), index(0)
|
||||
contextMenu->addAction(clearAction);
|
||||
|
||||
connect(this, SIGNAL(returnPressed()), SLOT(textInserted()));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint)), this,
|
||||
SLOT(showContextMenu(const QPoint)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint)), this, SLOT(showContextMenu(const QPoint)));
|
||||
}
|
||||
|
||||
void LineEditor::keyPressEvent(QKeyEvent *ev)
|
||||
@ -74,10 +73,7 @@ void LineEditor::textInserted()
|
||||
Q_EMIT textLineInserted(lines.back());
|
||||
}
|
||||
|
||||
void LineEditor::showContextMenu(const QPoint &pt)
|
||||
{
|
||||
contextMenu->exec(mapToGlobal(pt));
|
||||
}
|
||||
void LineEditor::showContextMenu(const QPoint &pt) { contextMenu->exec(mapToGlobal(pt)); }
|
||||
|
||||
void LineEditor::clearHistory()
|
||||
{
|
||||
|
@ -16,7 +16,7 @@
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef NO_PYTHON
|
||||
#ifndef NO_PYTHON
|
||||
|
||||
#include "pythontab.h"
|
||||
#include <QGridLayout>
|
||||
@ -44,8 +44,7 @@ PythonTab::PythonTab(QWidget *parent) : QWidget(parent)
|
||||
contextMenu = plainTextEdit->createStandardContextMenu();
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(clearAction);
|
||||
connect(plainTextEdit, SIGNAL(customContextMenuRequested(const QPoint)),
|
||||
this, SLOT(showContextMenu(const QPoint)));
|
||||
connect(plainTextEdit, SIGNAL(customContextMenuRequested(const QPoint)), this, SLOT(showContextMenu(const QPoint)));
|
||||
|
||||
lineEdit = new LineEditor();
|
||||
lineEdit->setMinimumHeight(30);
|
||||
@ -57,8 +56,7 @@ PythonTab::PythonTab(QWidget *parent) : QWidget(parent)
|
||||
mainLayout->addWidget(lineEdit, 1, 0);
|
||||
setLayout(mainLayout);
|
||||
|
||||
connect(lineEdit, SIGNAL(textLineInserted(QString)), this,
|
||||
SLOT(editLineReturnPressed(QString)));
|
||||
connect(lineEdit, SIGNAL(textLineInserted(QString)), this, SLOT(editLineReturnPressed(QString)));
|
||||
|
||||
write = [this](std::string s) {
|
||||
plainTextEdit->moveCursor(QTextCursor::End);
|
||||
@ -88,9 +86,7 @@ int PythonTab::executePython(std::string &command)
|
||||
if (m == NULL)
|
||||
return -1;
|
||||
d = PyModule_GetDict(m);
|
||||
v = PyRun_StringFlags(command.c_str(),
|
||||
(command.empty() ? Py_file_input : Py_single_input),
|
||||
d, d, NULL);
|
||||
v = PyRun_StringFlags(command.c_str(), (command.empty() ? Py_file_input : Py_single_input), d, d, NULL);
|
||||
if (v == NULL) {
|
||||
PyObject *exception, *v, *tb;
|
||||
|
||||
@ -111,8 +107,7 @@ int PythonTab::executePython(std::string &command)
|
||||
PyErr_Clear();
|
||||
|
||||
PyObject *objectsRepresentation = PyObject_Str(v);
|
||||
std::string errorStr =
|
||||
PyUnicode_AsUTF8(objectsRepresentation) + std::string("\n");
|
||||
std::string errorStr = PyUnicode_AsUTF8(objectsRepresentation) + std::string("\n");
|
||||
print(errorStr);
|
||||
Py_DECREF(objectsRepresentation);
|
||||
Py_XDECREF(exception);
|
||||
@ -131,10 +126,7 @@ void PythonTab::editLineReturnPressed(QString text)
|
||||
executePython(input);
|
||||
}
|
||||
|
||||
void PythonTab::showContextMenu(const QPoint &pt)
|
||||
{
|
||||
contextMenu->exec(mapToGlobal(pt));
|
||||
}
|
||||
void PythonTab::showContextMenu(const QPoint &pt) { contextMenu->exec(mapToGlobal(pt)); }
|
||||
|
||||
void PythonTab::clearBuffer() { plainTextEdit->clear(); }
|
||||
|
||||
|
@ -59,8 +59,7 @@ TEST_F(HX1KTest, uphill_to_downhill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||
bool found_downhill = false;
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||
ctx->getPipSrcWire(uphill_pip))) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(ctx->getPipSrcWire(uphill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_downhill);
|
||||
found_downhill = true;
|
||||
@ -76,8 +75,7 @@ TEST_F(HX1KTest, downhill_to_uphill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||
bool found_uphill = false;
|
||||
for (auto uphill_pip : ctx->getPipsUphill(
|
||||
ctx->getPipDstWire(downhill_pip))) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(ctx->getPipDstWire(downhill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_uphill);
|
||||
found_uphill = true;
|
||||
|
@ -59,8 +59,7 @@ TEST_F(HX8KTest, uphill_to_downhill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||
bool found_downhill = false;
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||
ctx->getPipSrcWire(uphill_pip))) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(ctx->getPipSrcWire(uphill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_downhill);
|
||||
found_downhill = true;
|
||||
@ -76,8 +75,7 @@ TEST_F(HX8KTest, downhill_to_uphill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||
bool found_uphill = false;
|
||||
for (auto uphill_pip : ctx->getPipsUphill(
|
||||
ctx->getPipDstWire(downhill_pip))) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(ctx->getPipDstWire(downhill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_uphill);
|
||||
found_uphill = true;
|
||||
|
@ -59,8 +59,7 @@ TEST_F(LP1KTest, uphill_to_downhill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||
bool found_downhill = false;
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||
ctx->getPipSrcWire(uphill_pip))) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(ctx->getPipSrcWire(uphill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_downhill);
|
||||
found_downhill = true;
|
||||
@ -76,8 +75,7 @@ TEST_F(LP1KTest, downhill_to_uphill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||
bool found_uphill = false;
|
||||
for (auto uphill_pip : ctx->getPipsUphill(
|
||||
ctx->getPipDstWire(downhill_pip))) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(ctx->getPipDstWire(downhill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_uphill);
|
||||
found_uphill = true;
|
||||
|
@ -59,8 +59,7 @@ TEST_F(LP384Test, uphill_to_downhill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||
bool found_downhill = false;
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||
ctx->getPipSrcWire(uphill_pip))) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(ctx->getPipSrcWire(uphill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_downhill);
|
||||
found_downhill = true;
|
||||
@ -76,8 +75,7 @@ TEST_F(LP384Test, downhill_to_uphill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||
bool found_uphill = false;
|
||||
for (auto uphill_pip : ctx->getPipsUphill(
|
||||
ctx->getPipDstWire(downhill_pip))) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(ctx->getPipDstWire(downhill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_uphill);
|
||||
found_uphill = true;
|
||||
|
@ -59,8 +59,7 @@ TEST_F(LP8KTest, uphill_to_downhill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||
bool found_downhill = false;
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||
ctx->getPipSrcWire(uphill_pip))) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(ctx->getPipSrcWire(uphill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_downhill);
|
||||
found_downhill = true;
|
||||
@ -76,8 +75,7 @@ TEST_F(LP8KTest, downhill_to_uphill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||
bool found_uphill = false;
|
||||
for (auto uphill_pip : ctx->getPipsUphill(
|
||||
ctx->getPipDstWire(downhill_pip))) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(ctx->getPipDstWire(downhill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_uphill);
|
||||
found_uphill = true;
|
||||
|
@ -59,8 +59,7 @@ TEST_F(UP5KTest, uphill_to_downhill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(dst)) {
|
||||
bool found_downhill = false;
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(
|
||||
ctx->getPipSrcWire(uphill_pip))) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(ctx->getPipSrcWire(uphill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_downhill);
|
||||
found_downhill = true;
|
||||
@ -76,8 +75,7 @@ TEST_F(UP5KTest, downhill_to_uphill)
|
||||
for (auto dst : ctx->getWires()) {
|
||||
for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
|
||||
bool found_uphill = false;
|
||||
for (auto uphill_pip : ctx->getPipsUphill(
|
||||
ctx->getPipDstWire(downhill_pip))) {
|
||||
for (auto uphill_pip : ctx->getPipsUphill(ctx->getPipDstWire(downhill_pip))) {
|
||||
if (uphill_pip == downhill_pip) {
|
||||
ASSERT_FALSE(found_uphill);
|
||||
found_uphill = true;
|
||||
|
Loading…
Reference in New Issue
Block a user