Updates from clang-format

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-07-12 22:04:13 +02:00
parent ad60ab2ef1
commit b8a42ff53b
17 changed files with 92 additions and 136 deletions

View File

@ -268,9 +268,9 @@ struct BaseCtx
delete idstring_idx_to_str;
}
Context *getCtx() { return reinterpret_cast<Context*>(this); }
Context *getCtx() { return reinterpret_cast<Context *>(this); }
const Context *getCtx() const { return reinterpret_cast<const Context*>(this); }
const Context *getCtx() const { return reinterpret_cast<const Context *>(this); }
// --------------------------------------------------------------
@ -281,35 +281,17 @@ struct BaseCtx
std::unordered_set<PipId> pipUiReload;
std::unordered_set<GroupId> groupUiReload;
void refreshUi()
{
allUiReload = true;
}
void refreshUi() { allUiReload = true; }
void refreshUiFrame()
{
frameUiReload = true;
}
void refreshUiFrame() { frameUiReload = true; }
void refreshUiBel(BelId bel)
{
belUiReload.insert(bel);
}
void refreshUiBel(BelId bel) { belUiReload.insert(bel); }
void refreshUiWire(WireId wire)
{
wireUiReload.insert(wire);
}
void refreshUiWire(WireId wire) { wireUiReload.insert(wire); }
void refreshUiPip(PipId pip)
{
pipUiReload.insert(pip);
}
void refreshUiPip(PipId pip) { pipUiReload.insert(pip); }
void refreshUiGroup(GroupId group)
{
groupUiReload.insert(group);
}
void refreshUiGroup(GroupId group) { groupUiReload.insert(group); }
};
NEXTPNR_NAMESPACE_END
@ -330,7 +312,8 @@ struct Context : Arch
// --------------------------------------------------------------
NPNR_DEPRECATED std::vector<GraphicElement> getFrameGraphics() const {
NPNR_DEPRECATED std::vector<GraphicElement> getFrameGraphics() const
{
std::vector<GraphicElement> ret;
DecalXY decalxy = getFrameDecal();
ret = getDecalGraphics(decalxy.decal);
@ -343,7 +326,8 @@ struct Context : Arch
return ret;
}
NPNR_DEPRECATED std::vector<GraphicElement> getBelGraphics(BelId bel) const {
NPNR_DEPRECATED std::vector<GraphicElement> getBelGraphics(BelId bel) const
{
std::vector<GraphicElement> ret;
DecalXY decalxy = getBelDecal(bel);
ret = getDecalGraphics(decalxy.decal);
@ -356,7 +340,8 @@ struct Context : Arch
return ret;
}
NPNR_DEPRECATED std::vector<GraphicElement> getWireGraphics(WireId wire) const {
NPNR_DEPRECATED std::vector<GraphicElement> getWireGraphics(WireId wire) const
{
std::vector<GraphicElement> ret;
DecalXY decalxy = getWireDecal(wire);
ret = getDecalGraphics(decalxy.decal);
@ -369,7 +354,8 @@ struct Context : Arch
return ret;
}
NPNR_DEPRECATED std::vector<GraphicElement> getPipGraphics(PipId pip) const {
NPNR_DEPRECATED std::vector<GraphicElement> getPipGraphics(PipId pip) const
{
std::vector<GraphicElement> ret;
DecalXY decalxy = getPipDecal(pip);
ret = getDecalGraphics(decalxy.decal);
@ -382,7 +368,8 @@ struct Context : Arch
return ret;
}
NPNR_DEPRECATED std::vector<GraphicElement> getGroupGraphics(GroupId group) const {
NPNR_DEPRECATED std::vector<GraphicElement> getGroupGraphics(GroupId group) const
{
std::vector<GraphicElement> ret;
DecalXY decalxy = getGroupDecal(group);
ret = getDecalGraphics(decalxy.decal);

View File

@ -290,15 +290,9 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// -----------------------------------------------------------------------
bool Arch::place()
{
return placer1(getCtx());
}
bool Arch::place() { return placer1(getCtx()); }
bool Arch::route()
{
return router1(getCtx());
}
bool Arch::route() { return router1(getCtx()); }
// -----------------------------------------------------------------------

View File

@ -119,8 +119,14 @@ struct DecalId
Location location;
uint32_t z = 0;
bool operator==(const DecalId &other) const { return type == other.type && location == other.location && z == other.z; }
bool operator!=(const DecalId &other) const { return type != other.type || location != other.location || z != other.z; }
bool operator==(const DecalId &other) const
{
return type == other.type && location == other.location && z == other.z;
}
bool operator!=(const DecalId &other) const
{
return type != other.type || location != other.location || z != other.z;
}
};
NEXTPNR_NAMESPACE_END

View File

@ -93,18 +93,16 @@ 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 "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
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";
return argc != 1;
}
if (vm.count("version")) {
std::cout << boost::filesystem::basename(argv[0])
<< " -- Next Generation Place and Route (git "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
return 1;
}

View File

@ -109,25 +109,13 @@ void Arch::addBelInout(IdString bel, IdString name, IdString wire)
wires.at(wire).downhill_bel_pins.push_back(BelPin{bel, name});
}
void Arch::addGroupBel(IdString group, IdString bel)
{
groups[group].bels.push_back(bel);
}
void Arch::addGroupBel(IdString group, IdString bel) { groups[group].bels.push_back(bel); }
void Arch::addGroupWire(IdString group, IdString wire)
{
groups[group].wires.push_back(wire);
}
void Arch::addGroupWire(IdString group, IdString wire) { groups[group].wires.push_back(wire); }
void Arch::addGroupPip(IdString group, IdString pip)
{
groups[group].pips.push_back(pip);
}
void Arch::addGroupPip(IdString group, IdString pip) { groups[group].pips.push_back(pip); }
void Arch::addGroupGroup(IdString group, IdString grp)
{
groups[group].groups.push_back(grp);
}
void Arch::addGroupGroup(IdString group, IdString grp) { groups[group].groups.push_back(grp); }
void Arch::addDecalGraphic(DecalId decal, const GraphicElement &graphic)
{
@ -330,7 +318,8 @@ GroupId Arch::getGroupByName(IdString name) const { return name; }
IdString Arch::getGroupName(GroupId group) const { return group; }
std::vector<GroupId> Arch::getGroups() const {
std::vector<GroupId> Arch::getGroups() const
{
std::vector<GroupId> ret;
for (auto &it : groups)
ret.push_back(it.first);
@ -365,15 +354,9 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// ---------------------------------------------------------------
bool Arch::place()
{
return placer1(getCtx());
}
bool Arch::place() { return placer1(getCtx()); }
bool Arch::route()
{
return router1(getCtx());
}
bool Arch::route() { return router1(getCtx()); }
// ---------------------------------------------------------------

View File

@ -75,18 +75,16 @@ 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 "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
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";
return argc != 1;
}
if (vm.count("version")) {
std::cout << boost::filesystem::basename(argv[0])
<< " -- Next Generation Place and Route (git "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
return 1;
}

View File

@ -26,10 +26,10 @@
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QProgressBar>
#include <QStatusBar>
#include <QTabWidget>
#include <QToolBar>
#include <QProgressBar>
Q_DECLARE_METATYPE(std::string)

View File

@ -91,7 +91,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net
propertyEditor->show();
const QIcon searchIcon(":/icons/resources/zoom.png");
QLineEdit* lineEdit = new QLineEdit();
QLineEdit *lineEdit = new QLineEdit();
lineEdit->setClearButtonEnabled(true);
lineEdit->addAction(searchIcon, QLineEdit::LeadingPosition);
lineEdit->setPlaceholderText("Search...");
@ -139,17 +139,17 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net
hbox->addWidget(toolbar);
QWidget *btmWidget = new QWidget();
QVBoxLayout *vbox2 = new QVBoxLayout();
btmWidget->setLayout(vbox2);
btmWidget->setLayout(vbox2);
vbox2->setSpacing(0);
vbox2->setContentsMargins(0, 0, 0, 0);
vbox2->addWidget(toolbarWidget);
vbox2->addWidget(propertyEditor);
QSplitter *splitter = new QSplitter(Qt::Vertical);
splitter->addWidget(topWidget);
splitter->addWidget(btmWidget);
splitter->addWidget(topWidget);
splitter->addWidget(btmWidget);
QGridLayout *mainLayout = new QGridLayout();
mainLayout->setSpacing(0);

View File

@ -240,8 +240,7 @@ void LineShader::draw(const LineShaderData &line, const QMatrix4x4 &projection)
vao_.release();
}
FPGAViewWidget::FPGAViewWidget(QWidget *parent)
: QOpenGLWidget(parent), lineShader_(this), zoom_(500.f), ctx_(nullptr)
FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), lineShader_(this), zoom_(500.f), ctx_(nullptr)
{
backgroundColor = QColor("#ffffff");
gridColor = QColor("#ddd");
@ -284,7 +283,7 @@ void FPGAViewWidget::initializeGL()
log_error("Could not compile shader.\n");
}
initializeOpenGLFunctions();
glClearColor(backgroundColor.red()/255, backgroundColor.green()/255, backgroundColor.blue()/255, 0.0);
glClearColor(backgroundColor.red() / 255, backgroundColor.green() / 255, backgroundColor.blue() / 255, 0.0);
}
void FPGAViewWidget::drawElement(LineShaderData &out, const GraphicElement &el)
@ -311,7 +310,7 @@ QMatrix4x4 FPGAViewWidget::getProjection(void)
QMatrix4x4 matrix;
const float aspect = float(width()) / float(height());
matrix.perspective(3.14/2, aspect, zoomNear_, zoomFar_);
matrix.perspective(3.14 / 2, aspect, zoomNear_, zoomFar_);
matrix.translate(0.0f, 0.0f, -zoom_);
return matrix;
}
@ -391,10 +390,7 @@ void FPGAViewWidget::paintGL()
void FPGAViewWidget::resizeGL(int width, int height) {}
void FPGAViewWidget::mousePressEvent(QMouseEvent *event)
{
lastPos_ = event->pos();
}
void FPGAViewWidget::mousePressEvent(QMouseEvent *event) { lastPos_ = event->pos(); }
// Invert the projection matrix to calculate screen/mouse to world/grid
// coordinates.
@ -403,8 +399,8 @@ QVector4D FPGAViewWidget::mouseToWorldCoordinates(int x, int y)
QMatrix4x4 p = getProjection();
QVector2D unit = p.map(QVector4D(1, 1, 0, 1)).toVector2DAffine();
float sx = (((float)x) / (width()/2));
float sy = (((float)y) / (height()/2));
float sx = (((float)x) / (width() / 2));
float sy = (((float)y) / (height() / 2));
return QVector4D(sx / unit.x(), sy / unit.y(), 0, 1);
}

View File

@ -258,7 +258,7 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions
QMatrix4x4 getProjection(void);
QVector4D mouseToWorldCoordinates(int x, int y);
const float zoomNear_ = 1.0f; // do not zoom closer than this
const float zoomNear_ = 1.0f; // do not zoom closer than this
const float zoomFar_ = 10000.0f; // do not zoom further than this
const float zoomLvl1_ = 100.0f;

View File

@ -19,12 +19,12 @@
#include <algorithm>
#include <cmath>
#include "gfx.h"
#include "log.h"
#include "nextpnr.h"
#include "placer1.h"
#include "router1.h"
#include "util.h"
#include "gfx.h"
NEXTPNR_NAMESPACE_BEGIN
@ -380,10 +380,7 @@ GroupId Arch::getGroupByName(IdString name) const
return GroupId();
}
IdString Arch::getGroupName(GroupId group) const
{
return IdString();
}
IdString Arch::getGroupName(GroupId group) const { return IdString(); }
std::vector<GroupId> Arch::getGroups() const
{
@ -448,15 +445,9 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// -----------------------------------------------------------------------
bool Arch::place()
{
return placer1(getCtx());
}
bool Arch::place() { return placer1(getCtx()); }
bool Arch::route()
{
return router1(getCtx());
}
bool Arch::route() { return router1(getCtx()); }
// -----------------------------------------------------------------------
@ -499,8 +490,7 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
{
std::vector<GraphicElement> ret;
if (decal.type == DecalId::TYPE_FRAME)
{
if (decal.type == DecalId::TYPE_FRAME) {
for (int x = 0; x <= chip_info->width; x++)
for (int y = 0; y <= chip_info->height; y++) {
GraphicElement el;
@ -512,23 +502,21 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
}
}
if (decal.type == DecalId::TYPE_WIRE)
{
if (decal.type == DecalId::TYPE_WIRE) {
WireId wire;
wire.index = decal.index;
int n = chip_info->wire_data[wire.index].num_segments;
const WireSegmentPOD *p = chip_info->wire_data[wire.index].segments.get();
GraphicElement::style_t style = wire_to_net.at(wire.index) != IdString() ?
GraphicElement::G_ACTIVE : GraphicElement::G_INACTIVE;
GraphicElement::style_t style =
wire_to_net.at(wire.index) != IdString() ? GraphicElement::G_ACTIVE : GraphicElement::G_INACTIVE;
for (int i = 0; i < n; i++)
gfxTileWire(ret, p[i].x, p[i].y, GfxTileWireId(p[i].index), style);
}
if (decal.type == DecalId::TYPE_BEL)
{
if (decal.type == DecalId::TYPE_BEL) {
BelId bel;
bel.index = decal.index;
@ -540,8 +528,10 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
el.style = bel_to_cell.at(bel.index) != IdString() ? GraphicElement::G_ACTIVE : GraphicElement::G_INACTIVE;
el.x1 = chip_info->bel_data[bel.index].x + logic_cell_x1;
el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2;
el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 + (chip_info->bel_data[bel.index].z) * logic_cell_pitch;
el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 + (chip_info->bel_data[bel.index].z) * logic_cell_pitch;
el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 +
(chip_info->bel_data[bel.index].z) * logic_cell_pitch;
el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 +
(chip_info->bel_data[bel.index].z) * logic_cell_pitch;
el.z = 0;
ret.push_back(el);

View File

@ -111,7 +111,8 @@ struct PipId
struct GroupId
{
enum : int8_t {
enum : int8_t
{
TYPE_NONE,
TYPE_FRAME,
TYPE_MAIN_SW,
@ -133,7 +134,8 @@ struct GroupId
struct DecalId
{
enum : int8_t {
enum : int8_t
{
TYPE_NONE,
TYPE_FRAME,
TYPE_BEL,
@ -178,7 +180,8 @@ template <> struct hash<NEXTPNR_NAMESPACE_PREFIX PortPin> : hash<int>
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX GroupId>
{
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX GroupId &group) const noexcept {
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX GroupId &group) const noexcept
{
std::size_t seed = 0;
boost::hash_combine(seed, hash<int>()(group.type));
boost::hash_combine(seed, hash<int>()(group.x));
@ -189,7 +192,8 @@ template <> struct hash<NEXTPNR_NAMESPACE_PREFIX GroupId>
template <> struct hash<NEXTPNR_NAMESPACE_PREFIX DecalId>
{
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX DecalId &decal) const noexcept {
std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX DecalId &decal) const noexcept
{
std::size_t seed = 0;
boost::hash_combine(seed, hash<int>()(decal.type));
boost::hash_combine(seed, hash<int>()(decal.index));

View File

@ -341,9 +341,8 @@ void write_asc(const Context *ctx, std::ostream &out)
set_config(ti, config.at(y).at(x),
"Cascade.IPCON_LC0" + std::to_string(lc_idx) + "_inmux02_5", true);
else
set_config(ti, config.at(y).at(x),
"Cascade.MULT" + std::to_string(int(tile - TILE_DSP0)) + "_LC0" +
std::to_string(lc_idx) + "_inmux02_5",
set_config(ti, config.at(y).at(x), "Cascade.MULT" + std::to_string(int(tile - TILE_DSP0)) +
"_LC0" + std::to_string(lc_idx) + "_inmux02_5",
true);
}
}

View File

@ -73,10 +73,12 @@ with open(args.portspins) as f:
with open(args.gfxh) as f:
state = 0
for line in f:
if state == 0 and line.startswith("enum GfxTileWireId "):
if state == 0 and line.startswith("enum GfxTileWireId"):
state = 1
elif state == 1 and line.startswith("};"):
state = 0
elif state == 1 and line.startswith("{"):
pass
elif state == 1:
idx = len(gfx_wire_ids)
name = line.strip().rstrip(",")

View File

@ -333,7 +333,7 @@ void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId id,
// LC Inputs
if (id >= TILE_WIRE_LUTFF_0_IN_0 && id <= TILE_WIRE_LUTFF_7_IN_3) {
if (id >= TILE_WIRE_LUTFF_0_IN_0 && id <= TILE_WIRE_LUTFF_7_IN_3) {
int idx = id - TILE_WIRE_LUTFF_0_IN_0;
int z = idx / 4;
int input = idx % 4;
@ -354,7 +354,7 @@ void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId id,
el.y1 = y1;
el.y2 = y1;
el.x1 = x + main_swbox_x2;
el.x2 = x + 0.97 + 0.0025 * (7-idx);
el.x2 = x + 0.97 + 0.0025 * (7 - idx);
g.push_back(el);
el.y1 = y1;
@ -386,7 +386,7 @@ void gfxTileWire(std::vector<GraphicElement> &g, int x, int y, GfxTileWireId id,
el.x1 = el.x2;
g.push_back(el);
for (int i = 0; i < 7; i ++) {
for (int i = 0; i < 7; i++) {
el.y1 = y + logic_cell_y2 + i * logic_cell_pitch;
el.y2 = y + logic_cell_y1 + (i + 1) * logic_cell_pitch;
g.push_back(el);

View File

@ -40,7 +40,8 @@ const float logic_cell_y1 = 0.05;
const float logic_cell_y2 = 0.10;
const float logic_cell_pitch = 0.0625;
enum GfxTileWireId {
enum GfxTileWireId
{
TILE_WIRE_GLB2LOCAL_0,
TILE_WIRE_GLB2LOCAL_1,
TILE_WIRE_GLB2LOCAL_2,

View File

@ -128,18 +128,16 @@ int main(int argc, char *argv[])
if (vm.count("help") || argc == 1) {
help:
std::cout << boost::filesystem::basename(argv[0])
<< " -- Next Generation Place and Route (git "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
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";
return argc != 1;
}
if (vm.count("version")) {
std::cout << boost::filesystem::basename(argv[0])
<< " -- Next Generation Place and Route (git "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
std::cout << boost::filesystem::basename(argv[0]) << " -- Next Generation Place and Route (git "
"sha1 " GIT_COMMIT_HASH_STR ")\n";
return 1;
}